diff --git a/.gitignore b/.gitignore index 1cbb2ba444..52d0b48600 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,6 @@ tools/tojs/user.cfg tools/tojs/userconf.ini # ... userconf.ini generated if running from tools/jenkins_scripts/mac/android/ tools/jenkins_scripts/mac/android/userconf.ini + +# CTags +tags diff --git a/.gitmodules b/.gitmodules index b3e3547623..5d1959ba87 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,15 @@ -[submodule "tools/cxx-generator"] - path = tools/cxx-generator - url = git://github.com/funkaster/cxx-generator.git +[submodule "tools/bindings-generator"] + path = tools/bindings-generator + url = https://github.com/cocos2d/bindings-generator.git [submodule "scripting/javascript/bindings/generated"] path = scripting/javascript/bindings/generated url = git://github.com/folecr/cocos2dx-autogen-bindings.git [submodule "samples/Javascript/Shared"] path = samples/Javascript/Shared url = https://github.com/minggo/cocos2d-js-tests.git +[submodule "external/emscripten"] + path = external/emscripten + url = https://github.com/kripken/emscripten.git +[submodule "tools/cocos2d-console"] + path = tools/cocos2d-console + url = https://github.com/cocos2d/cocos2d-console.git diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..7bf773a3cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +--- +language: cpp +env: + matrix: + - GEN_JSB=YES + - PLATFORM=linux DEBUG=1 + - PLATFORM=nacl DEBUG=1 + - PLATFORM=android + global: + - secure: |- + cHXOjAda+t2tmBVuVAiQfvhDN+unToO6hX1rc3dJeGDOk4rlQnylJacjA7o/ + enkWeHagbW2Ja4h7BxQz4h7dada8zEbIbEMK4VEHx6AWwQM+GIEqkJPv5g8k + 4P20MLpX4XyUwm/16btpnqgXlyd8Q3Zjh3Vui/5/VzwPnxUQEho= + - secure: |- + U/JsyiSR9q+8wX1arfciy3BdbMQaKmgt48/9tiU7P2RQJ/FR2AHGq85sNGI/ + ZUxN4JPLGALEvkFMo4NYyJDUcsdRHZX3vbp5xbSSRaBigqJIj3HDxtlPVf2m + /W2GzcfNNX1ACO18hSWH0d2yFlF263ZmvudzQIfqTESfjGQBzwA= + - secure: |- + Wsngwo3jlZtvuPfr3RNhqrz/liNIhKYnlw4KYJO90gMQ9ZQKRTlMv2BMiPw/ + 9lV+vgJQDRcFe7dKwtC86vk10EU7Ym2bhVmhMxi/AlmJXgavjmPVdizRT7rh + X2Ry/Nb6hGRkH3WS0T3D/KG1+e7lP/TMB9bvo6/locLJ2A6Z1YI= +script: +- export NACL_SDK_ROOT=$HOME/bin/nacl_sdk/pepper_canary +- export PATH=$PATH:$NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin +- export NDK_ROOT=$HOME/bin/android-ndk +- ./tools/travis-scripts/run-script.sh + +before_install: +- ./tools/travis-scripts/before-install.sh + diff --git a/AUTHORS b/AUTHORS index 58a56e2cb1..687918c6f5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,56 @@ Developers: Ricardo Quesada Rolando Abarca Javascript Binding and testjs + + carlomorgantinizynga + CCLabelTTF supports for shadow and stroke + + James Gregory (j4m3z0r, Zynga) + Maintainer of Emscripten port. + Initial Emscripten port. + Use browser font rendering instead of FreeType. + + DarraghCoy + Fix a potential crash SimpleAudioEngineOpenSL::playEffect + + silverscania + Pass correct parameter to glPixelStorei when creating a texture + + FlagellumDei + Center the window correctly on windows + + ggggamer + fixed memory leak of preloadEffect on windows + + CodeSnooker + Added Method to create a CCMenuItemToggle from a CCArray with a target selector + + wagaf-d + Move ccpX functions to CCPoint methods and operators + + sergey-shambir + Added CC_DISABLE_COPY macro + Added __attribute__(__format__()) for CCLog and CCString + Refactoring network extension and fixing unlikely memory leaks. + Adding PUT/DELETE methods for CCHttpRequest. + + savdalion + Added example for russian language in TestCpp + Added const modifier for classes CCArray, CCObject + + rodrigogolive + Fix broke linux build + + kdejongh + Fix for spaces at the beginning of wrapped lines on Android + + martell + use tinyxml2 to replace libxml2 + Added Mingw-crt Support without breaking VS SDK + + mchinen + fix emulator issue for OpenGL ES 2.0 on Android + Fix missing protocol method warning for iOS 6.0 addition DenizPiri use CCLOG to implement print() function in LUA @@ -28,9 +78,13 @@ Developers: DarraghCoy fix for loading custom fonts on iOS when referenced from a CCB file Fix CCUserDefault.cpp compiling on Android. + Fixing CCFileUtils 'createXXXXWithContentsOfFile' path lookup issue. + Add CCDirector::popToSceneStackLevel(int level). + Fixing a bug that custom font can't be loaded correctly if using full path of filename on android. Waiter fix an error that OpenSLEngine can't load resources from SD card + add CCRemoveSelf action billy1380 make CCLens3d support concave effect. @@ -78,6 +132,10 @@ Developers: Some improvements for CCScrollView and CCTableView. Touch priority can't be set to the value specified by a call to CCMenu::setTouchPriority(int). CCTableView crashes if a CCTableViewDelegate is not provided. + Fixing a bug that _realOpacity isn't assigned in CCLayerColor::initWithColor. + CCScrollView TouchPriority Fix + Add encrypted PVR.CCZ support to ZipUtils + Tests + Fix for broken of ccArrayGetIndexOfObject after merging this commit(076f38c). Weeds (Andre Rudlaff) Used fontconfig to enhance font rendering on linux. @@ -86,10 +144,16 @@ Developers: Fixed the size calculations for true type fonts (especially for italic fonts). Added a very simple greedy line break algorithmfor true type labels. Fixed font rendering crash for certain fonts on linux. + Fixed potential crash in CCScheduler::removeHashElement. + Fixed potential crash in CCSaxParser. + Added kResolutionFixedHeight and kResolutionFixedWidth resolution policy. + Use pthread mutex and condition variable instead of pthred semaphore to load image asynchronizely. + Fixed crash in HttpClient request on 64Bit. Nat Weiss (iphonegamekit.com) author of Mac port add TMX polygon parsing + Properly resets the tile's Y flipping XiaoLong Zhang (Chukong Inc) Mike McGary (Zynga) @@ -105,16 +169,22 @@ Developers: Surith Thekkiam (folecr, Zynga) contribute for Android module building Simpler, correct handling of spritesheet sources for CCScale9Sprite. + Clean up linked libraries for android. + JavaScript debugger improved and bugfixed. Nicolas Gramlich (nicolasgramlich, Zynga) fixed CCDirector to use CCLabelBMFont instead of CCLabelTTF added CCBReader (CCBI format) Added cleanup and reset methods to ScriptingCore. + Fixed a bug in ScriptingCore::evalString not setting the outval. + Updated .classpath of Android project to latest ADT 22 build tool compatibility. Rohan Kuruvilla (rohankuruvilla, Zynga) Improvements to JS Bindings. Synchronizing CCBReader to version 5. Adding OpenGL Bindings to Javascript. + Fixing a bug that nested ccb-files are not positioned correctly. + Fixing a bug that crash when loading valid project. Jianfeng Zou (NetDragon Inc) contributes CCListView and CCTextureWatcher. @@ -218,12 +288,15 @@ Developers: Adding CCEditBox implementation for Mac OSX. tiantian20007 - Fix crash for call runAnimation() in CCBAnimationManagerDelegate::completedAnimationSequenceNamed. + Fixing a crash for call runAnimation() in CCBAnimationManagerDelegate::completedAnimationSequenceNamed. Fixing a bug that CCControl's touch priority is not set correctly; m_nDefaultTouchPriority is never used. + Fixing a syntax error for RENDER_IN_SUBPIXEL macro. + Implement CCDictionary::writeToFile(). xyhl515 Fixed a bug that CCControlSwitch::setOn(isOn,false) doesn't work. Adds VS2012 Express template installing support. + Fixing a logical error in CCDrawNode::drawPolygon. DarraghCoy Fix for unaligned memory access crash in CCBReader::readFloat(). @@ -231,6 +304,8 @@ Developers: Sergej Tatarincev (SevInf) Making ScriptingCore.cpp compiled fine with C++11 on iOS. Using shared NodeLoaderLibrary in CCBReader bindings. + CCEditBox iOS enchantments/bugfixes. + Support variable cell sizes in CCTableView. ThePickleMan Adding 'rotationIsDir' property to ParticleSystem. @@ -250,12 +325,19 @@ Developers: Refactor linux build system and fix many warnings. Fixing a bug where missing packages would cause the script to exit on linux. Adding 'make run' target for linux projects. + Stripping newlines from log message and fixing linux library location. + Fixing a bug that CCPhysicsSprite was overriding only some of the getPosition methods. + Adding a macro USE_BOX2D to check whether to enable Box2D for linux and nacl port. + Adding Travis build support for linux and NaCl. + Logging assert messages to the console. + Renaming CCScriptSupport::executeAssert to CCScriptSupport::handleAssert. Peter Young (young40) Implements setVisible() for CCEditBox - + csy1988525 Fixing a bug about display result is wrong when invoking CCControlButton:: setHighlighted. + fixed a bug when button's parent is hided, the button still can responce to clicked event. Asad ur Rehman (AsadR) Adding CCNotificationCenter::removeAllObservers(CCObject *target). @@ -268,9 +350,102 @@ Developers: Zecken (gelldur) Fixing a profiling compilation error in CCParticleBatchNode. + Fixing linking errors for TestCPP with libcurl on linux. flamingo (flaming0) Null pointer check in order to prevent crashes. + Updating spine-runtime to EsotericSoftware/spine-runtimes@5f90386. + + rtissera (Romain TISSERAND) + Adding missing JNIEXPORT / JNICALL declarations. + Fix iOS 4.3 JPEG loading issue. + + Yodesoft + Improving font rendering performance for linux platform. + Reducing function call in nativeInitBitmapDC to improve performance. + Refactoring writable path to "/.config/" for linux platform. + + sjchao + Fixing a display bug when a scrollView nested in another scrollView. + + Éloi Rivard (azmeuk) + Linux OpenAL support. + + elmiro + Correction of passed buffer size to readlink and verification of result return by readlink. + + harikrishnar (Hari Krishna) + Wrong logic in CCArray::initWithObjects. + Fixing a bug that button should not get respond if its parent is invisable. + + rogerzanoni + Fixing a linking error that libpthread and libGL libraries need to be linked on linux. + Fixing a compiling error of [-Werror=array-bounds] when compiling Box2dTestBed. + + zhanghaojie + Fixing a bug that anchorPoint property of CCScale9Sprite doesn't work in CCBReader. + + MarkEHenderson (Mark Henderson) + Fixing of variable initialization in SpriteBatchNode. + + akira-cn + Adding response for back and menu keypad event for Android. + + lgb (Oleg) + Fixing a compilation error for BlackBerry PlayBook. + Comparing float number by using epsilon and absolute difference. + + jotel (Jaroslaw Lewandowski) + Fixing a bug that wrong type of argument signature is used in setAccelerometerIntervalJNI function. + Fix for broken of ccArrayGetIndexOfObject after merging this commit(076f38c). + + MarcelBloemendaal + Adding secureTextEntry property to CCTextFieldTTF. + + brawsome + Adding new macro CCB_MEMBERVARIABLEASSIGNER_GLUE_WEAK to CCBMemberVariableAssigner.h. + Adding CCLOG before original path is returned in CCFileUtils::fullPathForFileName to aid in debugging. + Optmization to ccArrayGetIndexOfObject. + + sunzhuoshi + Adding support for javascript bytecode. + + ptekchand (Pranav Tekchand) + Supporting negative node scales for CCScrollView. + + coolengineer (Hojin Choi) + Refactoring callback selector for HttpResponse. + + djh- + Fixing a bug that displayed color of CCDrawNode is incorrect when VAO is disabled. + + acai (beingstudio) + Fix of null pointer access in CCBAnimationManager::getRunningSequenceName. + + metalgit92 + Adding const qualification to some CCNode's getters + + Clarinexus + Fixing a bug that setColor and setOpacity of CCControlButton and CCScale9Sprite are broken. + + Xander84 + Fixing a bug in CCBValue::getByteValue. + + smshuja + Fixing a bug that pointQueryFirst returns invalid Shape when a shape is not found in JSB. + Fixing a bug that New PivotJoint can't access 4 parameters like in html5 version. + + Carsten Sandtner (casarock) + Adding XMLHttpRequest support for JSB. + + Lee, Jae-Hong (pyrasis) + Maintainer of tizen port. + + lumendes + Updating spine-runtime to EsotericSoftware/spine-runtimes@5f90386. + + sunxiaoyu + Refactoring CCEditBox to add UITextField only when keyboard was opened, remove it when keyboard was closed. Retired Core Developers: WenSheng Yang diff --git a/CHANGELOG b/CHANGELOG index 6bc87629b4..4002d73d77 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,87 @@ +cocos2d-2.1rc0-x-2.1.3 @May.01 2013 +[all platforms] + Bug #1853: use SHELLOPTS instead of "-o igncr" for Android Eclipse project + Bug #1860: fix a bug that onNodeLoaded will be called twice if ccb was added as a CCBFile + Bug #1862: fix a bug that CCScrollView::setContainer may cause dangling pointer when NULL is passed into + Bug #1876: fix a bug that CCScale9Sprite::setColor() & setOpacity() are broken + Bug #1935: fix a bug that use "==" for float comparison of CCPoint and CCSize + Bug #1937: fix a bug that CCControl's touch priority is not set correctly, m_nDefaultTouchPriority is never used + Bug #1943: added some missing function for setting integer shader uniforms in CCGLProgram + Bug #1999: allowing to set fontName and fontSize separately for CCEditBox + Bug #2003: fix a potential crash in CCScheduler::removeHashElement() + Bug #2030: fix a bug that scissor rectangle in nested CCScrollView is wrong + Bug #2031: make CCFileUtils::createXXXXWithContentsOfFile() support relative path + Bug #2035: fix a potential crash in CCSaxParser + Bug #2037: fix a wrong logic in CCArray::initWithObjects() + Bug #2040: get scale property from sub-ccb node may trigger an assert + Bug #2054: fix a bug that anchorPoint property of CCScale9Sprite doesn't work in CCBReader + Bug #2055: enable easy switching between Box2D and chipmunk + Bug #2058: properly resets the tile's Y flipping + Bug #2061: fix a bug that wrong type of argument signature is used in setAccelerometerIntervalJNI function + Bug #2073: fix a memory leak in CCUserDefault + Bug #2080: fix a bug that _realOpacity isn't assigned in CCLayerColor::initWithColor + Feature #2001: add CCRemoveSelf Action + Feature #2048: support variable cell sizes in CCTableView + Feature #2065: adding kResolutionFixedHeight and kResolutionFixedWidth resolution policy + Feature #2068: adding a secureTextEntry property to CCTextFieldTTF + Feature #2069: adding new macro CCB_MEMBERVARIABLEASSIGNER_GLUE_WEAK to CCBMemberVariableAssigner.h + Feature #2075: support spine editor + Feature #2076: adding a method CCBReader::setResolutionScale for setting resolution scale manually + Refactor #1592: updating UTHASH to v1.9.8 + Refactor #2042: remove libxml2 + Refactor #2097: use pthread mutex and condition variable instead of pthread semaphore to load image asynchronizely +[android] + Bug #1996: adding missing JNIEXPORT / JNICALL declarations + Bug #2028: fix a bug taht application can not run correctly on Android simulator + Bug #2045: some small fixes to CocosPlayer + Bug #2062: fix for spaces at the beginning of wrapped lines + Bug #2083: fix a bug that Bytecode of LuaJIT can't work on android + Refactor #1613: not reload resources when coming from background on Android + Refactor #1861: CocosPlayer Android update + Refactor #1904: strip libcurl.a on x86 architecture + Refactor #2027: reduce function call in nativeInitBitmapDC to improve performance + Refactor #2047: clean up linked libraries for android +[iOS] + Bug #1863: fix a bug that CCUserDefault on iOS may not save immediately + Feature #2096: adding Cocosplayer for iOS and bug fixes +[linux] + Bug #1932: fix a bug that font rendering crashed for certain fonts + Bug #2036: correct passed buffer size to readlink + Bug #2044: link libpthread and libGL + Bug #2046: strip newlines from log message and fixing linux library location + Bug #2052: fix a bug that [-Werror=array-bounds] error appears when compiling Box2dTestBed + Feature #2032: Linux OpenAL support + Refactor #2000: improve font rendering performance for linux platform + Refactor #2053: set writable path to "/.config/" +[mac] + Bug #2051: fix a bug that TestCpp/ExtensionsTest/CocosbuilderTest crashes under x86_64 target + Feature #1856: adding 64bit target for Mac project +[javascript binding] + Bug #1855: fix a bug that std_string_to_jsval generates messy js string when passed a non-ascii UTF8 std::string + Bug #2057: adding response for back and menu keypad event for Android + Bug #2059: fix a bug that cc.FileUtils.getInstance().getStringFromFile(filename) doesn't return a whole string + Bug #2071: fix a bug that cc.TMXLayer.getTiles() can't work + Feature #1841: find a way to obfuscate javascript code on the top of JSB + Feature #1936: adding OpenGL Bindings to Javascript + Feature #2043: upgrading SpiderMonkey to Firefox20.0 + Feature #2060: support for cc.FileUtils.getInstance().getByteArrayFromFile(filename) + Feature #2064: exposing cc.Node.nodeTo***Transform to JS + Refactor #1944: subclass of cc.Sprite,cc.Layer... doesn't need cc.associateWithNative anymore +[lua binding] + Feature #1814: add menutest + Feature #1941: add TileMapTest + Feature #1942: add LayerTest + Feature #1945: use CCLOG to implement print() function + Feature #1993: add ParallaxTest + Feature #1994: add ActionManagerTest + Feature #1997: add IntervalTest + Feature #1998: add SceneTest + Feature #2002: add Texture2dTest, RenderTexture, ZwoptexTest, FontTest, CocosDenshionTest and EffectsAdvancedTest + Feature #2004: add UserDefaultTest + Feature #2005: add CurrentLanguageTest + Refactor #1847: use luajit + Refactor #2084: unify the method of loading lua files on all platforms + cocos2d-2.1rc0-x-2.1.2 @Mar.20 2013 [all platforms] Bug #1529: use NSUserDefaults on iOS and SharedPreferences on Android implement CCUserDefault diff --git a/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp b/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp index 78323e9f00..b65ed58f1c 100644 --- a/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp +++ b/CocosDenshion/android/opensl/SimpleAudioEngineOpenSL.cpp @@ -88,24 +88,25 @@ void SimpleAudioEngineOpenSL::setEffectsVolume(float volume) unsigned int SimpleAudioEngineOpenSL::playEffect(const char* pszFilePath, bool bLoop) { - unsigned int soundID; - do - { - soundID = s_pOpenSL->preloadEffect(pszFilePath); - if (soundID != FILE_NOT_FOUND) - { - if (s_pOpenSL->getEffectState(soundID) == PLAYSTATE_PLAYING) - { - // recreate an effect player - s_pOpenSL->recreatePlayer(pszFilePath); - break; - } - s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED); - s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING); - } - } while (0); - s_pOpenSL->setEffectLooping(soundID, bLoop); - return soundID; + unsigned int soundID = s_pOpenSL->preloadEffect(pszFilePath); + + if (soundID != FILE_NOT_FOUND) + { + if (s_pOpenSL->getEffectState(soundID) == PLAYSTATE_PLAYING) + { + // recreate an effect player + s_pOpenSL->recreatePlayer(pszFilePath); + } + else + { + s_pOpenSL->setEffectState(soundID, PLAYSTATE_STOPPED); + s_pOpenSL->setEffectState(soundID, PLAYSTATE_PLAYING); + } + + s_pOpenSL->setEffectLooping(soundID, bLoop); + } + + return soundID; } void SimpleAudioEngineOpenSL::pauseEffect(unsigned int nSoundId) diff --git a/CocosDenshion/emscripten/SimpleAudioEngine.cpp b/CocosDenshion/emscripten/SimpleAudioEngine.cpp new file mode 100644 index 0000000000..5cff595dbc --- /dev/null +++ b/CocosDenshion/emscripten/SimpleAudioEngine.cpp @@ -0,0 +1,303 @@ +/**************************************************************************** +Copyright (c) 2013 Zynga Inc. +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +// XXX: This is all just a bit of a hack. SDL uses channels as its underlying +// abstraction, whilst CocosDenshion deals in individual effects. Consequently +// we can't set start/stop, because to SDL, effects (chunks) are just opaque +// blocks of data that get scheduled on channels. To workaround this, we assign +// each sound to a channel, but since there are only 32 channels, we use the +// modulus of the sound's address (which on Emscripten is just an incrementing +// integer) to decide which channel. +// +// A more rigorous implementation would have logic to store the state of +// channels and restore it as necessary. This should probably just be +// considered a toy for now, but it will probably prove sufficient for many +// use-cases. Recall also that Emscripten undoes this abstraction on the other +// side because it is using HTML5 audio objects as its underlying primitive! + +#include +#include +#include +#include + +#include "SimpleAudioEngine.h" +#include "cocos2d.h" + +#include +#include + +USING_NS_CC; + +using namespace std; + +namespace CocosDenshion +{ + struct soundData { + Mix_Chunk *chunk; + bool isLooped; + }; + + typedef map EffectsMap; + EffectsMap s_effects; + float s_effectsVolume = 1.0; + + typedef enum { + PLAYING, + STOPPED, + PAUSED, + } playStatus; + + struct backgroundMusicData { + Mix_Music *music; + }; + typedef map BackgroundMusicsMap; + BackgroundMusicsMap s_backgroundMusics; + float s_backgroundVolume = 1.0; + + static SimpleAudioEngine *s_engine = 0; + + // Unfortunately this is just hard-coded in Emscripten's SDL + // implementation. + static const int NR_CHANNELS = 32; + static void stopBackground(bool bReleaseData) + { + SimpleAudioEngine *engine = SimpleAudioEngine::sharedEngine(); + engine->stopBackgroundMusic(); + } + + SimpleAudioEngine::SimpleAudioEngine() + { + } + + SimpleAudioEngine::~SimpleAudioEngine() + { + } + + SimpleAudioEngine* SimpleAudioEngine::sharedEngine() + { + if (!s_engine) + s_engine = new SimpleAudioEngine(); + + return s_engine; + } + + void SimpleAudioEngine::end() + { + // clear all the sounds + EffectsMap::const_iterator end = s_effects.end(); + for (EffectsMap::iterator it = s_effects.begin(); it != end; it++) + { + Mix_FreeChunk(it->second->chunk); + delete it->second; + } + s_effects.clear(); + + // and the background too + stopBackground(true); + + for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) + { + Mix_FreeMusic(it->second->music); + delete it->second; + } + s_backgroundMusics.clear(); + } + + // + // background audio + // + void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) + { + } + + void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) + { + std::string key = std::string(pszFilePath); + struct backgroundMusicData *musicData; + if(!s_backgroundMusics.count(key)) + { + musicData = new struct backgroundMusicData(); + musicData->music = Mix_LoadMUS(pszFilePath); + s_backgroundMusics[key] = musicData; + } + else + { + musicData = s_backgroundMusics[key]; + } + + Mix_PlayMusic(musicData->music, bLoop ? -1 : 0); + } + + void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData) + { + Mix_HaltMusic(); + } + + void SimpleAudioEngine::pauseBackgroundMusic() + { + Mix_PauseMusic(); + } + + void SimpleAudioEngine::resumeBackgroundMusic() + { + Mix_ResumeMusic(); + } + + void SimpleAudioEngine::rewindBackgroundMusic() + { + CCLOGWARN("Cannot rewind background in Emscripten"); + } + + bool SimpleAudioEngine::willPlayBackgroundMusic() + { + return true; + } + + bool SimpleAudioEngine::isBackgroundMusicPlaying() + { + return Mix_PlayingMusic(); + } + + float SimpleAudioEngine::getBackgroundMusicVolume() + { + return s_backgroundVolume; + } + + void SimpleAudioEngine::setBackgroundMusicVolume(float volume) + { + // Ensure volume is between 0.0 and 1.0. + volume = volume > 1.0 ? 1.0 : volume; + volume = volume < 0.0 ? 0.0 : volume; + + Mix_VolumeMusic(volume * MIX_MAX_VOLUME); + s_backgroundVolume = volume; + } + + float SimpleAudioEngine::getEffectsVolume() + { + return s_effectsVolume; + } + + void SimpleAudioEngine::setEffectsVolume(float volume) + { + volume = volume > 1.0 ? 1.0 : volume; + volume = volume < 0.0 ? 0.0 : volume; + + // Need to set volume on every channel. SDL will then read this volume + // level and apply it back to the individual sample. + for(int i = 0; i < NR_CHANNELS; i++) + { + Mix_Volume(i, volume * MIX_MAX_VOLUME); + } + + s_effectsVolume = volume; + } + + unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) + { + std::string key = std::string(pszFilePath); + struct soundData *sound; + if(!s_effects.count(key)) + { + sound = new struct soundData(); + sound->chunk = Mix_LoadWAV(pszFilePath); + sound->isLooped = bLoop; + s_effects[key] = sound; + } + else + { + sound = s_effects[key]; + } + // This is safe here since Emscripten is just passing back an + // incrementing integer each time you use the Mix_LoadWAV method. + unsigned int result = (unsigned int) sound->chunk; + + // XXX: This is a bit of a hack, but... Choose a channel based on the + // modulo of the # of channels. This allows us to set the volume + // without passing around both chunk address and channel. + Mix_PlayChannel(result % NR_CHANNELS, sound->chunk, bLoop ? -1 : 0); + + return result; + } + + void SimpleAudioEngine::stopEffect(unsigned int nSoundId) + { + Mix_HaltChannel(nSoundId % NR_CHANNELS); + } + + void SimpleAudioEngine::preloadEffect(const char* pszFilePath) + { + } + + void SimpleAudioEngine::unloadEffect(const char* pszFilePath) + { + std::string key = std::string(pszFilePath); + if(!s_effects.count(key)) + { + return; + } + + struct soundData *sound = s_effects[key]; + + Mix_FreeChunk(sound->chunk); + delete sound; + s_effects.erase(key); + } + + void SimpleAudioEngine::pauseEffect(unsigned int nSoundId) + { + Mix_Pause(nSoundId % NR_CHANNELS); + } + + void SimpleAudioEngine::pauseAllEffects() + { + for(int i = 0; i < NR_CHANNELS; i++) + { + Mix_Pause(i); + } + } + + void SimpleAudioEngine::resumeEffect(unsigned int nSoundId) + { + Mix_Resume(nSoundId % NR_CHANNELS); + } + + void SimpleAudioEngine::resumeAllEffects() + { + for(int i = 0; i < NR_CHANNELS; i++) + { + Mix_Resume(i); + } + } + + void SimpleAudioEngine::stopAllEffects() + { + for(int i = 0; i < NR_CHANNELS; i++) + { + Mix_HaltChannel(i); + } + } + +} diff --git a/CocosDenshion/linux/SimpleAudioEngine.cpp b/CocosDenshion/linux/SimpleAudioEngineFMOD.cpp similarity index 100% rename from CocosDenshion/linux/SimpleAudioEngine.cpp rename to CocosDenshion/linux/SimpleAudioEngineFMOD.cpp diff --git a/CocosDenshion/linux/SimpleAudioEngineOpenAL.cpp b/CocosDenshion/linux/SimpleAudioEngineOpenAL.cpp new file mode 100644 index 0000000000..9cf81cfa2f --- /dev/null +++ b/CocosDenshion/linux/SimpleAudioEngineOpenAL.cpp @@ -0,0 +1,606 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifndef DISABLE_VORBIS +#include +#endif + +#include "SimpleAudioEngine.h" +#include "cocos2d.h" +USING_NS_CC; + +using namespace std; + +namespace CocosDenshion +{ + struct soundData { + ALuint buffer; + ALuint source; + bool isLooped; + }; + + typedef map EffectsMap; + EffectsMap s_effects; + + typedef enum { + PLAYING, + STOPPED, + PAUSED, + } playStatus; + + static float s_volume = 1.0f; + static float s_effectVolume = 1.0f; + + struct backgroundMusicData { + ALuint buffer; + ALuint source; + }; + typedef map BackgroundMusicsMap; + BackgroundMusicsMap s_backgroundMusics; + + static ALuint s_backgroundSource = AL_NONE; + + static SimpleAudioEngine *s_engine = 0; + + static int checkALError(const char *funcName) + { + int err = alGetError(); + + if (err != AL_NO_ERROR) + { + switch (err) + { + case AL_INVALID_NAME: + fprintf(stderr, "AL_INVALID_NAME in %s\n", funcName); + break; + + case AL_INVALID_ENUM: + fprintf(stderr, "AL_INVALID_ENUM in %s\n", funcName); + break; + + case AL_INVALID_VALUE: + fprintf(stderr, "AL_INVALID_VALUE in %s\n", funcName); + break; + + case AL_INVALID_OPERATION: + fprintf(stderr, "AL_INVALID_OPERATION in %s\n", funcName); + break; + + case AL_OUT_OF_MEMORY: + fprintf(stderr, "AL_OUT_OF_MEMORY in %s\n", funcName); + break; + } + } + + return err; + } + + static void stopBackground(bool bReleaseData) + { + alSourceStop(s_backgroundSource); + + if (bReleaseData) + { + for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) + { + if (it->second->source == s_backgroundSource) + { + alDeleteBuffers(1, &it->second->buffer); + checkALError("stopBackground:alDeleteBuffers"); + alDeleteSources(1, &it->second->source); + checkALError("stopBackground:alDeleteSources"); + delete it->second; + s_backgroundMusics.erase(it); + break; + } + } + } + + s_backgroundSource = AL_NONE; + } + + static void setBackgroundVolume(float volume) + { + alSourcef(s_backgroundSource, AL_GAIN, volume); + } + + SimpleAudioEngine::SimpleAudioEngine() + { + alutInit(0, 0); + checkALError("SimpleAudioEngine:alutInit"); + } + + SimpleAudioEngine::~SimpleAudioEngine() + { + alutExit(); + } + + SimpleAudioEngine* SimpleAudioEngine::sharedEngine() + { + if (!s_engine) + s_engine = new SimpleAudioEngine(); + + return s_engine; + } + + void SimpleAudioEngine::end() + { + checkALError("end:init"); + + // clear all the sounds + EffectsMap::const_iterator end = s_effects.end(); + for (EffectsMap::iterator it = s_effects.begin(); it != end; it++) + { + alSourceStop(it->second->source); + checkALError("end:alSourceStop"); + alDeleteBuffers(1, &it->second->buffer); + checkALError("end:alDeleteBuffers"); + alDeleteSources(1, &it->second->source); + checkALError("end:alDeleteSources"); + delete it->second; + } + s_effects.clear(); + + // and the background too + stopBackground(true); + + for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) + { + alSourceStop(it->second->source); + checkALError("end:alSourceStop"); + alDeleteBuffers(1, &it->second->buffer); + checkALError("end:alDeleteBuffers"); + alDeleteSources(1, &it->second->source); + checkALError("end:alDeleteSources"); + delete it->second; + } + s_backgroundMusics.clear(); + } + +#ifndef DISABLE_VORBIS + + // + // OGG support + // + static bool isOGGFile(const char *pszFilePath) + { + FILE *file; + OggVorbis_File ogg_file; + int result; + + file = fopen(pszFilePath, "rb"); + result = ov_test(file, &ogg_file, 0, 0); + ov_clear(&ogg_file); + + return (result == 0); + } + + static ALuint createBufferFromOGG(const char *pszFilePath) + { + ALuint buffer; + OggVorbis_File ogg_file; + vorbis_info* info; + ALenum format; + int result; + int section; + unsigned int size = 0; + + if (ov_fopen(pszFilePath, &ogg_file) < 0) + { + ov_clear(&ogg_file); + fprintf(stderr, "Could not open OGG file %s\n", pszFilePath); + return -1; + } + + info = ov_info(&ogg_file, -1); + + if (info->channels == 1) + format = AL_FORMAT_MONO16; + else + format = AL_FORMAT_STEREO16; + + // size = #samples * #channels * 2 (for 16 bit) + unsigned int data_size = ov_pcm_total(&ogg_file, -1) * info->channels * 2; + char* data = new char[data_size]; + + while (size < data_size) + { + result = ov_read(&ogg_file, data + size, data_size - size, 0, 2, 1, §ion); + if (result > 0) + { + size += result; + } + else if (result < 0) + { + delete [] data; + fprintf(stderr, "OGG file problem %s\n", pszFilePath); + return -1; + } + else + { + break; + } + } + + if (size == 0) + { + delete [] data; + fprintf(stderr, "Unable to read OGG data\n"); + return -1; + } + + // clear al errors + checkALError("createBufferFromOGG:init"); + + // Load audio data into a buffer. + alGenBuffers(1, &buffer); + + if (checkALError("createBufferFromOGG:alGenBuffers") != AL_NO_ERROR) + { + fprintf(stderr, "Couldn't generate a buffer for OGG file\n"); + delete [] data; + return buffer; + } + + alBufferData(buffer, format, data, data_size, info->rate); + checkALError("createBufferFromOGG:alBufferData"); + + delete [] data; + ov_clear(&ogg_file); + + return buffer; + } +#endif + + // + // background audio + // + void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) + { + // Changing file path to full path + std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); + + BackgroundMusicsMap::const_iterator it = s_backgroundMusics.find(fullPath); + if (it == s_backgroundMusics.end()) + { + ALuint buffer = AL_NONE; +#ifndef DISABLE_VORBIS + if (isOGGFile(fullPath.data())) + { + buffer = createBufferFromOGG(fullPath.data()); + } + else +#endif + buffer = alutCreateBufferFromFile(fullPath.data()); + + + checkALError("preloadBackgroundMusic:createBuffer"); + + if (buffer == AL_NONE) + { + fprintf(stderr, "Error loading file: '%s'\n", fullPath.data()); + alDeleteBuffers(1, &buffer); + return; + } + + ALuint source = AL_NONE; + alGenSources(1, &source); + checkALError("preloadBackgroundMusic:alGenSources"); + + alSourcei(source, AL_BUFFER, buffer); + checkALError("preloadBackgroundMusic:alSourcei"); + + backgroundMusicData* data = new backgroundMusicData(); + data->buffer = buffer; + data->source = source; + s_backgroundMusics.insert(BackgroundMusicsMap::value_type(fullPath, data)); + } + } + + void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) + { + if (s_backgroundSource != AL_NONE) + stopBackgroundMusic(false); + + // Changing file path to full path + std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); + + BackgroundMusicsMap::const_iterator it = s_backgroundMusics.find(fullPath); + if (it == s_backgroundMusics.end()) + { + preloadBackgroundMusic(fullPath.c_str()); + it = s_backgroundMusics.find(fullPath); + } + + if (it != s_backgroundMusics.end()) + { + s_backgroundSource = it->second->source; + alSourcei(s_backgroundSource, AL_LOOPING, bLoop ? AL_TRUE : AL_FALSE); + alSourcePlay(s_backgroundSource); + checkALError("playBackgroundMusic:alSourcePlay"); + } + } + + void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData) + { + stopBackground(bReleaseData); + } + + void SimpleAudioEngine::pauseBackgroundMusic() + { + ALint state; + alGetSourcei(s_backgroundSource, AL_SOURCE_STATE, &state); + if (state == AL_PLAYING) + alSourcePause(s_backgroundSource); + checkALError("pauseBackgroundMusic:alSourcePause"); + } + + void SimpleAudioEngine::resumeBackgroundMusic() + { + ALint state; + alGetSourcei(s_backgroundSource, AL_SOURCE_STATE, &state); + if (state == AL_PAUSED) + alSourcePlay(s_backgroundSource); + checkALError("resumeBackgroundMusic:alSourcePlay"); + } + + void SimpleAudioEngine::rewindBackgroundMusic() + { + alSourceRewind(s_backgroundSource); + checkALError("rewindBackgroundMusic:alSourceRewind"); + } + + bool SimpleAudioEngine::willPlayBackgroundMusic() + { + return true; + } + + bool SimpleAudioEngine::isBackgroundMusicPlaying() + { + ALint play_status; + alGetSourcei(s_backgroundSource, AL_SOURCE_STATE, &play_status); + + return (play_status == AL_PLAYING); + } + + float SimpleAudioEngine::getBackgroundMusicVolume() + { + return s_volume; + } + + void SimpleAudioEngine::setBackgroundMusicVolume(float volume) + { + if (s_volume != volume && volume >= -0.0001 && volume <= 1.0001) + { + s_volume = volume; + + setBackgroundVolume(volume); + } + } + + // + // Effect audio (using OpenAL) + // + float SimpleAudioEngine::getEffectsVolume() + { + return s_effectVolume; + } + + void SimpleAudioEngine::setEffectsVolume(float volume) + { + if (volume != s_effectVolume) + { + EffectsMap::const_iterator end = s_effects.end(); + for (EffectsMap::const_iterator it = s_effects.begin(); it != end; it++) + { + alSourcef(it->second->source, AL_GAIN, volume); + } + + s_effectVolume = volume; + } + } + + unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) + { + // Changing file path to full path + std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); + + EffectsMap::iterator iter = s_effects.find(fullPath); + + if (iter == s_effects.end()) + { + preloadEffect(fullPath.c_str()); + + // let's try again + iter = s_effects.find(fullPath); + if (iter == s_effects.end()) + { + fprintf(stderr, "could not find play sound %s\n", fullPath.c_str()); + return -1; + } + } + + checkALError("playEffect:init"); + iter->second->isLooped = bLoop; + alSourcei(iter->second->source, AL_LOOPING, iter->second->isLooped ? AL_TRUE : AL_FALSE); + alSourcePlay(iter->second->source); + checkALError("playEffect:alSourcePlay"); + + return iter->second->source; + } + + void SimpleAudioEngine::stopEffect(unsigned int nSoundId) + { + alSourceStop(nSoundId); + checkALError("stopEffect:alSourceStop"); + } + + void SimpleAudioEngine::preloadEffect(const char* pszFilePath) + { + // Changing file path to full path + std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); + + EffectsMap::iterator iter = s_effects.find(fullPath); + + // check if we have this already + if (iter == s_effects.end()) + { + ALuint buffer; + ALuint source; + soundData *data = new soundData; + string path = fullPath; + + checkALError("preloadEffect:init"); +#ifndef DISABLE_VORBIS + if (isOGGFile(path.data())) + { + buffer = createBufferFromOGG(path.data()); + } + else +#endif + { + buffer = alutCreateBufferFromFile(path.data()); + checkALError("preloadEffect:createBufferFromFile"); + } + + if (buffer == AL_NONE) + { + fprintf(stderr, "Error loading file: '%s'\n", path.data()); + alDeleteBuffers(1, &buffer); + return; + } + + alGenSources(1, &source); + + if (checkALError("preloadEffect:alGenSources") != AL_NO_ERROR) + { + alDeleteBuffers(1, &buffer); + return; + } + + alSourcei(source, AL_BUFFER, buffer); + checkALError("preloadEffect:alSourcei"); + + data->isLooped = false; + data->buffer = buffer; + data->source = source; + + s_effects.insert(EffectsMap::value_type(fullPath, data)); + } + } + + void SimpleAudioEngine::unloadEffect(const char* pszFilePath) + { + // Changing file path to full path + std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath); + + EffectsMap::iterator iter = s_effects.find(fullPath); + + if (iter != s_effects.end()) + { + checkALError("unloadEffect:init"); + + alSourceStop(iter->second->source); + checkALError("unloadEffect:alSourceStop"); + + alDeleteSources(1, &iter->second->source); + checkALError("unloadEffect:DeletSources"); + + alDeleteBuffers(1, &iter->second->buffer); + checkALError("unloadEffect:alDeleteBuffers"); + delete iter->second; + + s_effects.erase(iter); + } + } + + void SimpleAudioEngine::pauseEffect(unsigned int nSoundId) + { + ALint state; + alGetSourcei(nSoundId, AL_SOURCE_STATE, &state); + if (state == AL_PLAYING) + alSourcePause(nSoundId); + checkALError("pauseEffect:alSourcePause"); + } + + void SimpleAudioEngine::pauseAllEffects() + { + EffectsMap::iterator iter = s_effects.begin(); + ALint state; + while (iter != s_effects.end()) + { + alGetSourcei(iter->second->source, AL_SOURCE_STATE, &state); + if (state == AL_PLAYING) + alSourcePause(iter->second->source); + checkALError("pauseAllEffects:alSourcePause"); + ++iter; + } + } + + void SimpleAudioEngine::resumeEffect(unsigned int nSoundId) + { + ALint state; + alGetSourcei(nSoundId, AL_SOURCE_STATE, &state); + if (state == AL_PAUSED) + alSourcePlay(nSoundId); + checkALError("resumeEffect:alSourcePlay"); + } + + void SimpleAudioEngine::resumeAllEffects() + { + EffectsMap::iterator iter = s_effects.begin(); + ALint state; + while (iter != s_effects.end()) + { + alGetSourcei(iter->second->source, AL_SOURCE_STATE, &state); + if (state == AL_PAUSED) + alSourcePlay(iter->second->source); + checkALError("resumeAllEffects:alSourcePlay"); + ++iter; + } + } + + void SimpleAudioEngine::stopAllEffects() + { + EffectsMap::iterator iter = s_effects.begin(); + + if (iter != s_effects.end()) + { + checkALError("stopAllEffects:init"); + alSourceStop(iter->second->source); + checkALError("stopAllEffects:alSourceStop"); + } + } + +} diff --git a/CocosDenshion/proj.blackberry/.cproject b/CocosDenshion/proj.blackberry/.cproject index 7a94534dd5..39b8b82b8b 100644 --- a/CocosDenshion/proj.blackberry/.cproject +++ b/CocosDenshion/proj.blackberry/.cproject @@ -124,7 +124,7 @@ @@ -200,7 +200,7 @@ @@ -279,7 +279,7 @@ @@ -433,7 +433,7 @@ @@ -511,7 +511,7 @@ diff --git a/CocosDenshion/proj.emscripten/Makefile b/CocosDenshion/proj.emscripten/Makefile new file mode 100644 index 0000000000..a20833dee5 --- /dev/null +++ b/CocosDenshion/proj.emscripten/Makefile @@ -0,0 +1,20 @@ +TARGET = libcocosdenshion.so + +INCLUDES += -I.. -I../include + +SOURCES = ../emscripten/SimpleAudioEngine.cpp + +COCOS_ROOT = ../.. +include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk + +TARGET := $(LIB_DIR)/$(TARGET) + +all: $(TARGET) + +$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(OBJECTS) -shared -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) + +$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ diff --git a/CocosDenshion/proj.linux/Makefile b/CocosDenshion/proj.linux/Makefile index 080a86b670..6510a4b9f4 100644 --- a/CocosDenshion/proj.linux/Makefile +++ b/CocosDenshion/proj.linux/Makefile @@ -2,14 +2,30 @@ TARGET = libcocosdenshion.so INCLUDES += -I.. -I../include +##Using OpenAL +ifeq ($(OPENAL),1) +SOURCES = ../linux/SimpleAudioEngineOpenAL.cpp +SHAREDLIBS += -lopenal -lalut + +ifneq ($(NOVORBIS),1) +SHAREDLIBS += -logg -lvorbis -lvorbisfile +else +DEFINES += -DDISABLE_VORBIS +endif + +##Using FMOD +else +SOURCES = \ + ../linux/SimpleAudioEngineFMOD.cpp \ + ../linux/FmodAudioPlayer.cpp + ifeq ($(LBITS),64) INCLUDES += -I../third_party/fmod/lib64/api/inc else INCLUDES += -I../third_party/fmod/api/inc endif - -SOURCES = ../linux/FmodAudioPlayer.cpp \ - ../linux/SimpleAudioEngine.cpp \ + +endif COCOS_ROOT = ../.. include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk diff --git a/CocosDenshion/proj.tizen/.cproject b/CocosDenshion/proj.tizen/.cproject new file mode 100644 index 0000000000..255f35d585 --- /dev/null +++ b/CocosDenshion/proj.tizen/.cproject @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CocosDenshion/proj.tizen/.project b/CocosDenshion/proj.tizen/.project new file mode 100644 index 0000000000..3f44ed4404 --- /dev/null +++ b/CocosDenshion/proj.tizen/.project @@ -0,0 +1,105 @@ + + + cocosdenshion + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + sbi-make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/cocosdenshion/Debug-Tizen-Emulator} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + org.tizen.nativecpp.apichecker.core.builder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecpp.apichecker.core.tizenCppNature + + + + src/OspPlayer.cpp + 1 + PARENT-1-PROJECT_LOC/tizen/OspPlayer.cpp + + + src/OspPlayer.h + 1 + PARENT-1-PROJECT_LOC/tizen/OspPlayer.h + + + src/SimpleAudioEngine.cpp + 1 + PARENT-1-PROJECT_LOC/tizen/SimpleAudioEngine.cpp + + + diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/marmalade/config.h b/CocosDenshion/proj.tizen/src/placeholder.txt similarity index 100% rename from cocos2dx/platform/third_party/marmalade/libxml2/marmalade/config.h rename to CocosDenshion/proj.tizen/src/placeholder.txt diff --git a/CocosDenshion/tizen/OspPlayer.cpp b/CocosDenshion/tizen/OspPlayer.cpp new file mode 100644 index 0000000000..f152d8d8c7 --- /dev/null +++ b/CocosDenshion/tizen/OspPlayer.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "OspPlayer.h" + +using namespace Tizen::Media; + +OspPlayer::OspPlayer() + : __pPlayer(null) + , m_nSoundID(0) +{ + Initialize(); +} + +OspPlayer::~OspPlayer() +{ + Close(); +} + +result +OspPlayer::Initialize() +{ + result r = E_SUCCESS; + + __pPlayer = new (std::nothrow) Player(); + if (__pPlayer == null) + { + AppLogException("pPlyaer = new (std::nothrow) Player() has failed"); + return E_FAILURE; + } + + r = __pPlayer->Construct(*this, null); + if (IsFailed(r)) + { + AppLog("pPlayer->Construct has failed\n"); + return E_FAILURE; + } + + return r; +} + +void +OspPlayer::Open(const char* pFileName, unsigned int uId) +{ + result r = E_SUCCESS; + + Close(); + + r = __pPlayer->OpenFile(pFileName); + if (IsFailed(r)) + { + AppLog("pPlayer->OpenFile has failed\n"); + } + + m_nSoundID = uId; +} + +void +OspPlayer::Play(bool bLoop) +{ + result r = E_SUCCESS; + + r = __pPlayer->SetLooping(bLoop); + if (IsFailed(r)) + { + AppLog("pPlayer->SetLooping has failed\n"); + return; + } + + r = __pPlayer->Play(); + if (IsFailed(r)) + { + AppLog("pPlayer->Play has failed\n"); + } +} + +void +OspPlayer::Pause() +{ + result r = E_SUCCESS; + + r = __pPlayer->Pause(); + if (IsFailed(r)) + { + AppLog("pPlayer->Pause has failed\n"); + } +} + +void +OspPlayer::Stop() +{ + result r = E_SUCCESS; + + r = __pPlayer->Stop(); + if (IsFailed(r)) + { + AppLog("pPlayer->Stop has failed\n"); + } +} + +void +OspPlayer::Resume() +{ + result r = E_SUCCESS; + + if (__pPlayer->GetState() == PLAYER_STATE_PAUSED) + { + r = __pPlayer->Play(); + if (IsFailed(r)) + { + AppLog("pPlayer->Play has failed\n"); + } + } +} + +void +OspPlayer::Rewind() +{ + result r = E_SUCCESS; + + r = __pPlayer->SeekTo(0); + if (IsFailed(r)) + { + AppLog("pPlayer->SeekTo has failed\n"); + } +} + +bool +OspPlayer::IsPlaying() +{ + PlayerState state = __pPlayer->GetState(); + + return (state == PLAYER_STATE_PLAYING) ? true : false; +} + +void +OspPlayer::Close() +{ + result r = E_SUCCESS; + + if (__pPlayer->GetState() == PLAYER_STATE_PLAYING) + { + r = __pPlayer->Stop(); + if (IsFailed(r)) + { + AppLog("pPlayer->Stop has failed\n"); + } + } + + r = __pPlayer->Close(); + if (IsFailed(r)) + { + AppLog("pPlayer->Close has failed\n"); + } +} + +unsigned int +OspPlayer::GetSoundID() +{ + return m_nSoundID; +} + +void +OspPlayer::SetVolume(int volume) +{ + result r = E_SUCCESS; + + if (volume > 100 || volume < 0) + { + return; + } + + r = __pPlayer->SetVolume(volume); + if (IsFailed(r)) + { + AppLog("pPlayer->SetVolume has failed\n"); + } +} + +int +OspPlayer::GetVolume() +{ + return __pPlayer->GetVolume(); +} + +void +OspPlayer::OnPlayerOpened(result r) +{ +} + +void +OspPlayer::OnPlayerEndOfClip(void) +{ +} + +void +OspPlayer::OnPlayerBuffering(int percent) +{ +} + +void +OspPlayer::OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r) +{ +} + +void +OspPlayer::OnPlayerInterrupted(void) +{ +} + +void +OspPlayer::OnPlayerReleased(void) +{ +} + +void +OspPlayer::OnPlayerSeekCompleted(result r) +{ +} + +void +OspPlayer::OnPlayerAudioFocusChanged(void) +{ +} diff --git a/CocosDenshion/tizen/OspPlayer.h b/CocosDenshion/tizen/OspPlayer.h new file mode 100644 index 0000000000..78d54d3571 --- /dev/null +++ b/CocosDenshion/tizen/OspPlayer.h @@ -0,0 +1,65 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef _OSP_PLAYER_H_ +#define _OSP_PLAYER_H_ + +#include + +class OspPlayer : public Tizen::Media::IPlayerEventListener +{ +public: + OspPlayer(); + ~OspPlayer(); + + result Initialize(); + void Open(const char* pFileName, unsigned int uId); + void Play(bool bLoop); + void Pause(); + void Stop(); + void Resume(); + void Rewind(); + bool IsPlaying(); + void SetVolume(int volume); + int GetVolume(); + void Close(); + unsigned int GetSoundID(); + +protected: + void OnPlayerOpened(result r); + void OnPlayerEndOfClip(void); + void OnPlayerBuffering(int percent); + void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r); + void OnPlayerInterrupted(void); + void OnPlayerReleased(void); + void OnPlayerSeekCompleted(result r); + void OnPlayerAudioFocusChanged(void); + +private: + Tizen::Media::Player* __pPlayer; + unsigned int m_nSoundID; +}; + +#endif // _OSP_PLAYER_H_ diff --git a/CocosDenshion/tizen/SimpleAudioEngine.cpp b/CocosDenshion/tizen/SimpleAudioEngine.cpp new file mode 100644 index 0000000000..d90c1875cd --- /dev/null +++ b/CocosDenshion/tizen/SimpleAudioEngine.cpp @@ -0,0 +1,293 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "SimpleAudioEngine.h" +#include "OspPlayer.h" +#include "cocos2d.h" +#include + +USING_NS_CC; +using namespace std; + +namespace CocosDenshion { + +typedef map EffectList; +typedef pair Effect; + +static std::string _FullPath(const char * szPath); +static unsigned int _Hash(const char *key); + +#define BREAK_IF(cond) if (cond) break; + +static EffectList& sharedList() +{ + static EffectList s_List; + return s_List; +} + +static OspPlayer& sharedMusic() +{ + static OspPlayer s_Music; + return s_Music; +} + +SimpleAudioEngine::SimpleAudioEngine() +{ +} + +SimpleAudioEngine::~SimpleAudioEngine() +{ +} + +SimpleAudioEngine* SimpleAudioEngine::sharedEngine() +{ + static SimpleAudioEngine s_SharedEngine; + return &s_SharedEngine; +} + +void SimpleAudioEngine::end() +{ + sharedMusic().Close(); + + EffectList::iterator p = sharedList().begin(); + while (p != sharedList().end()) + { + delete p->second; + p->second = NULL; + p++; + } + sharedList().clear(); +} + +void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) +{ +} + +void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) +{ + if (!pszFilePath) + { + return; + } + + sharedMusic().Open(_FullPath(pszFilePath).c_str(), _Hash(pszFilePath)); + sharedMusic().Play(bLoop); +} + +void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData) +{ + if (bReleaseData) + { + sharedMusic().Close(); + } + else + { + sharedMusic().Stop(); + } +} + +void SimpleAudioEngine::pauseBackgroundMusic() +{ + sharedMusic().Pause(); +} + +void SimpleAudioEngine::resumeBackgroundMusic() +{ + sharedMusic().Resume(); +} + +void SimpleAudioEngine::rewindBackgroundMusic() +{ + sharedMusic().Rewind(); +} + +bool SimpleAudioEngine::willPlayBackgroundMusic() +{ + return false; +} + +bool SimpleAudioEngine::isBackgroundMusicPlaying() +{ + return sharedMusic().IsPlaying(); +} + +float SimpleAudioEngine::getBackgroundMusicVolume() +{ + return float(sharedMusic().GetVolume()) / 100.f; +} + +void SimpleAudioEngine::setBackgroundMusicVolume(float volume) +{ + sharedMusic().SetVolume(int(volume * 100)); +} + +float SimpleAudioEngine::getEffectsVolume() +{ + EffectList::iterator iter; + iter = sharedList().begin(); + if (iter != sharedList().end()) + { + return float(iter->second->GetVolume()) / 100.f; + } +} + +void SimpleAudioEngine::setEffectsVolume(float volume) +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->SetVolume(int(volume * 100)); + } +} + +unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) +{ + unsigned int nRet = _Hash(pszFilePath); + + preloadEffect(pszFilePath); + + EffectList::iterator p = sharedList().find(nRet); + if (p != sharedList().end()) + { + p->second->Play(bLoop); + } + + return nRet; +} + +void SimpleAudioEngine::stopEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Stop(); + } +} + +void SimpleAudioEngine::preloadEffect(const char* pszFilePath) +{ + int nRet = 0; + do + { + BREAK_IF(! pszFilePath); + + nRet = _Hash(pszFilePath); + + BREAK_IF(sharedList().end() != sharedList().find(nRet)); + + sharedList().insert(Effect(nRet, new (std::nothrow) OspPlayer())); + OspPlayer * pPlayer = sharedList()[nRet]; + pPlayer->Open(_FullPath(pszFilePath).c_str(), nRet); + + BREAK_IF(nRet == pPlayer->GetSoundID()); + + sharedList().erase(nRet); + nRet = 0; + } + while (0); +} + +void SimpleAudioEngine::unloadEffect(const char* pszFilePath) +{ + unsigned nId = _Hash(pszFilePath); + + EffectList::iterator p = sharedList().find(nId); + if (p != sharedList().end()) + { + delete p->second; + p->second = NULL; + sharedList().erase(nId); + } +} + +void SimpleAudioEngine::pauseEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Pause(); + } +} + +void SimpleAudioEngine::pauseAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Pause(); + } +} + +void SimpleAudioEngine::resumeEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Resume(); + } +} + +void SimpleAudioEngine::resumeAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Resume(); + } +} + +void SimpleAudioEngine::stopAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Stop(); + } +} + +////////////////////////////////////////////////////////////////////////// +// static function +////////////////////////////////////////////////////////////////////////// + +static std::string _FullPath(const char * szPath) +{ + return CCFileUtils::sharedFileUtils()->fullPathForFilename(szPath); +} + +unsigned int _Hash(const char *key) +{ + unsigned int len = strlen(key); + const char *end=key+len; + unsigned int hash; + + for (hash = 0; key < end; key++) + { + hash *= 16777619; + hash ^= (unsigned int) (unsigned char) toupper(*key); + } + return (hash); +} + +} diff --git a/CocosDenshion/win32/SimpleAudioEngine.cpp b/CocosDenshion/win32/SimpleAudioEngine.cpp index cc38d43227..870bd15029 100644 --- a/CocosDenshion/win32/SimpleAudioEngine.cpp +++ b/CocosDenshion/win32/SimpleAudioEngine.cpp @@ -74,7 +74,7 @@ void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) { return; } - + sharedMusic().Open(_FullPath(pszFilePath).c_str(), _Hash(pszFilePath)); sharedMusic().Play((bLoop) ? -1 : 1); } @@ -161,6 +161,7 @@ void SimpleAudioEngine::preloadEffect(const char* pszFilePath) BREAK_IF(nRet == pPlayer->GetSoundID()); + delete pPlayer; sharedList().erase(nRet); nRet = 0; } while (0); diff --git a/Emscripten.TODO b/Emscripten.TODO new file mode 100644 index 0000000000..a00ca3ce9e --- /dev/null +++ b/Emscripten.TODO @@ -0,0 +1,60 @@ +* Need to figure out how to get correct screen resolutions consistently. + +* Touch handler screwed up after TouchesTest? MenuTest? (TestCpp sample) + +* TTF Font rendering is slow and seems to wrap around by a few pixels + horizontally. Need to investigate here, but I suspect the right answer is to + offload font rendering to an offscreen canvas and let the browser handle it. + Potentially creates new challenges in packaging which would need to be solved + somehow. + + + +### +DONE: +### + +* Need to switch to server-side buffers in +- cocos2dx/draw_nodes/CCDrawingPrimitives + +* Need to compile with -O2 -- possible -s VERBOSE=1 will give a clue? + +* SchedulerTest crashes + - cocos2d::CCNode::boundingBox() + +* Parallax Test crashes + - cocos2d::CCAtlasNode::calculateMaxItems() + +* Particle Test crashes + - TIFFClientOpen not a function. Looks like we need to build and link in libtiff. + +* cocos2d::CCAtlasNode::calculateMaxItems() throwing an error; related to + CCTextureAtlas? Preventing particle test from working. + +* Need to switch to server-side buffers in +- cocos2dx/draw_nodes/CCDrawNode.cpp -- Think this is fixed by undef CC_TEXTURE_ATLAS_USE_VAO? +- cocos2dx/particle_nodes/CCParticleSystemQuad.cpp -- Think this is fixed by CC_REBIND_INDICES_BUFFER? +- cocos2dx/textures/CCTextureAtlas.cpp -- Think this works already. + +* Layer Test crashes + - cocos2d::CCLabelBMFont::create(char const*, char const*, float, cocos2d::CCTextAlignment, cocos2d::CCPoint) + +* IntervalTest crashes + - cocos2d::CCLabelBMFont::create(char const*, char const*, float, cocos2d::CCTextAlignment, cocos2d::CCPoint) + +* TileMap Test crashes + - void CCNode::insertChild(CCNode* child, int z) + +* LabelTest crashes + - cocos2d::CCAtlasNode::calculateMaxItems() + +* ZwoptexTest crashes. + - ZwoptexGenericTest::onEnter() + +* ChipmunkTest crashes: + Aborting due to Chipmunk error: Moment of Inertia must be positive and non-zero. + Failed condition: moment > 0.0f + Source:../src/cpBody.c:151 + +* Add linkage to libjpeg to get RenderTexture test to work. + diff --git a/Makefile b/Makefile index f8c529b257..a22d1a7399 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PLATFORM = linux +PLATFORM ?= linux define MAKE_TARGET +$(MAKE) -C external/chipmunk/proj.$(PLATFORM) $@ diff --git a/Makefile.emscripten b/Makefile.emscripten new file mode 100644 index 0000000000..b618f4e949 --- /dev/null +++ b/Makefile.emscripten @@ -0,0 +1,26 @@ +PLATFORM = emscripten + +define MAKE_TARGET + +$(MAKE) -C external/chipmunk/proj.$(PLATFORM) $@ + +$(MAKE) -C external/Box2D/proj.$(PLATFORM) $@ + +$(MAKE) -C CocosDenshion/proj.$(PLATFORM) $@ + +$(MAKE) -C extensions/proj.$(PLATFORM) $@ + +$(MAKE) -C cocos2dx/proj.$(PLATFORM) $@ + +$(MAKE) -C scripting/lua/proj.$(PLATFORM) $@ + +$(MAKE) -C samples/Cpp/HelloCpp/proj.$(PLATFORM) $@ + +$(MAKE) -C samples/Cpp/TestCpp/proj.$(PLATFORM) $@ + +$(MAKE) -C samples/Cpp/SimpleGame/proj.$(PLATFORM) $@ +endef + + +# Haven't yet got the lua projects working. +# +$(MAKE) -C samples/Lua/HelloLua/proj.$(PLATFORM) $@ +# +$(MAKE) -C samples/Lua/TestLua/proj.$(PLATFORM) $@ + +all: + $(call MAKE_TARGET,all) + +clean: + $(call MAKE_TARGET,clean) + +.PHONY: all clean diff --git a/README.mdown b/README.mdown index bd22f1f99d..e672981fea 100644 --- a/README.mdown +++ b/README.mdown @@ -1,6 +1,8 @@ cocos2d-x ========= +[![Build Status](https://travis-ci.org/cocos2d/cocos2d-x.png?branch=master)](https://travis-ci.org/cocos2d/cocos2d-x) + [cocos2d-x][1] is a multi-platform 2D game framework in C++, branched on [cocos2d-iphone][2] and licensed under MIT. The master branch on github uses OpenGL ES 2.0 rendering, while the old gles11 branch uses OpenGL ES 1.1 @@ -16,12 +18,16 @@ Supported Platforms http://github.com/cocos2d-x/cocos2dx-win8. * Bada: cocos2d-x v1.x supports Bada SDK 1.0 & 2.0. Bada support was deprecated since cocos2d-x v2.0. - * BlackBerry: stable, contribued by staffs in RIM, supports Playbook & BB10. + * BlackBerry: stable, contributed by staffs in RIM, supports Playbook & BB10. * Marmalade: stable since cocos2d-x v0.11.0, contributed by Marmalade's staff. * Native Client (NaCl): contributed by the Native Client authors. * Windows: stable, well tested on WinXP/Vista/Win7. Please upgrde the drive of your video card if you meet problems on OpenGL functions * Linux: support but not very stable. + * Emscripten: Alpha-level. Most features implemented. Needs testing. + Contributed by Zynga staff. + * Tizen: Experimental. Essential features implemented. Needs more implementing. + Contributed by Lee, Jae-Hong. You can visit our continuous integration system http://ci.cocos2d-x.org to check the stability on edge version. diff --git a/cocos2d-win32.vc2010.sln b/cocos2d-win32.vc2010.sln index 8cb99bb8c3..54f7cba9b2 100644 --- a/cocos2d-win32.vc2010.sln +++ b/cocos2d-win32.vc2010.sln @@ -14,6 +14,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "cocos2dx\proj EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "scripting\lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" ProjectSection(ProjectDependencies) = postProject + {21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} EndProjectSection @@ -30,12 +31,17 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\Cpp\TestCpp\proj.win32\TestCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "samples\Lua\HelloLua\proj.win32\HelloLua.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}" + ProjectSection(ProjectDependencies) = postProject + {21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\Lua\TestLua\proj.win32\TestLua.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}" ProjectSection(ProjectDependencies) = postProject {21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28} {DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} + {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} + {929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} EndProjectSection EndProject @@ -97,9 +103,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AssetsManagerTest", "sample EndProjectSection EndProject Global - GlobalSection(DPCodeReviewSolutionGUID) = preSolution - DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 @@ -196,4 +199,7 @@ Global {39379840-825A-45A0-B363-C09FFEF864BD} = {68B43009-A1C1-41B2-8AF7-77278B70E897} {9A17D9A4-4B11-4E32-94F6-895FF4909EC5} = {68B43009-A1C1-41B2-8AF7-77278B70E897} EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection EndGlobal diff --git a/cocos2dx/Android.mk b/cocos2dx/Android.mk index df26232cd0..cf308a6b48 100644 --- a/cocos2dx/Android.mk +++ b/cocos2dx/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES := \ CCConfiguration.cpp \ CCScheduler.cpp \ CCCamera.cpp \ +ccFPSImages.c \ actions/CCAction.cpp \ actions/CCActionCamera.cpp \ actions/CCActionCatmullRom.cpp \ @@ -35,6 +36,7 @@ cocoa/CCSet.cpp \ cocoa/CCString.cpp \ cocoa/CCZone.cpp \ cocoa/CCArray.cpp \ +cocoa/CCDataVisitor.cpp \ cocos2d.cpp \ CCDirector.cpp \ draw_nodes/CCDrawingPrimitives.cpp \ @@ -121,11 +123,14 @@ support/tinyxml2/tinyxml2.cpp \ support/zip_support/ZipUtils.cpp \ support/zip_support/ioapi.cpp \ support/zip_support/unzip.cpp \ +support/component/CCComponent.cpp \ +support/component/CCComponentContainer.cpp \ text_input_node/CCIMEDispatcher.cpp \ text_input_node/CCTextFieldTTF.cpp \ textures/CCTexture2D.cpp \ textures/CCTextureAtlas.cpp \ textures/CCTextureCache.cpp \ +textures/CCTextureETC.cpp \ textures/CCTexturePVR.cpp \ tilemap_parallax_nodes/CCParallaxNode.cpp \ tilemap_parallax_nodes/CCTMXLayer.cpp \ @@ -142,21 +147,19 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \ $(LOCAL_PATH)/kazmath/include \ $(LOCAL_PATH)/platform/android - -LOCAL_EXPORT_LDLIBS := -llog\ - -lz \ - -lGLESv2 - LOCAL_C_INCLUDES := $(LOCAL_PATH) \ $(LOCAL_PATH)/include \ $(LOCAL_PATH)/kazmath/include \ $(LOCAL_PATH)/platform/android LOCAL_LDLIBS := -lGLESv2 \ - -lEGL \ -llog \ -lz +LOCAL_EXPORT_LDLIBS := -lGLESv2 \ + -llog \ + -lz + LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libxml2_static diff --git a/cocos2dx/CCConfiguration.cpp b/cocos2dx/CCConfiguration.cpp index 162411ec24..ba7d1f0082 100644 --- a/cocos2dx/CCConfiguration.cpp +++ b/cocos2dx/CCConfiguration.cpp @@ -27,11 +27,17 @@ THE SOFTWARE. #include "ccMacros.h" #include "ccConfig.h" #include +#include "cocoa/CCDictionary.h" +#include "cocoa/CCInteger.h" +#include "cocoa/CCBool.h" +#include "cocos2d.h" +#include "platform/CCFileUtils.h" using namespace std; NS_CC_BEGIN + CCConfiguration* CCConfiguration::s_gSharedConfiguration = NULL; CCConfiguration::CCConfiguration(void) @@ -45,57 +51,96 @@ CCConfiguration::CCConfiguration(void) , m_nMaxSamplesAllowed(0) , m_nMaxTextureUnits(0) , m_pGlExtensions(NULL) +, m_pValueDict(NULL) { } bool CCConfiguration::init(void) { - CCLOG("cocos2d: GL_VENDOR: %s", glGetString(GL_VENDOR)); - CCLOG("cocos2d: GL_RENDERER: %s", glGetString(GL_RENDERER)); - CCLOG("cocos2d: GL_VERSION: %s", glGetString(GL_VERSION)); + m_pValueDict = CCDictionary::create(); + m_pValueDict->retain(); + + m_pValueDict->setObject( CCString::create( cocos2dVersion() ), "cocos2d.x.version"); + + +#if CC_ENABLE_PROFILERS + m_pValueDict->setObject( CCBool::create(true), "cocos2d.x.compiled_with_profiler"); +#else + m_pValueDict->setObject( CCBool::create(false), "cocos2d.x.compiled_with_profiler"); +#endif + +#if CC_ENABLE_GL_STATE_CACHE == 0 + m_pValueDict->setObject( CCBool::create(false), "cocos2d.x.compiled_with_gl_state_cache"); +#else + m_pValueDict->setObject( CCBool::create(true), "cocos2d.x.compiled_with_gl_state_cache"); +#endif + + return true; +} + +CCConfiguration::~CCConfiguration(void) +{ + m_pValueDict->release(); +} + +void CCConfiguration::dumpInfo(void) const +{ + // Dump + CCPrettyPrinter visitor(0); + m_pValueDict->acceptVisitor(visitor); + + CCLOG("%s", visitor.getResult().c_str()); + + + // And Dump some warnings as well +#if CC_ENABLE_PROFILERS + CCLOG("cocos2d: **** WARNING **** CC_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from ccConfig.h)"); + printf("\n"); +#endif + +#if CC_ENABLE_GL_STATE_CACHE == 0 + CCLOG(""); + CCLOG("cocos2d: **** WARNING **** CC_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it (from ccConfig.h)"); + printf("\n"); +#endif + +} + +void CCConfiguration::gatherGPUInfo() +{ + m_pValueDict->setObject( CCString::create( (const char*)glGetString(GL_VENDOR)), "gl.vendor"); + m_pValueDict->setObject( CCString::create( (const char*)glGetString(GL_RENDERER)), "gl.renderer"); + m_pValueDict->setObject( CCString::create( (const char*)glGetString(GL_VERSION)), "gl.version"); m_pGlExtensions = (char *)glGetString(GL_EXTENSIONS); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_nMaxTextureSize); + m_pValueDict->setObject( CCInteger::create((int)m_nMaxTextureSize), "gl.max_texture_size"); + glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &m_nMaxTextureUnits); + m_pValueDict->setObject( CCInteger::create((int)m_nMaxTextureUnits), "gl.max_texture_units"); + #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) glGetIntegerv(GL_MAX_SAMPLES_APPLE, &m_nMaxSamplesAllowed); + m_pValueDict->setObject( CCInteger::create((int)m_nMaxSamplesAllowed), "gl.max_samples_allowed"); #endif m_bSupportsPVRTC = checkForGLExtension("GL_IMG_texture_compression_pvrtc"); + m_pValueDict->setObject( CCBool::create(m_bSupportsPVRTC), "gl.supports_PVRTC"); + m_bSupportsNPOT = true; + m_pValueDict->setObject( CCBool::create(m_bSupportsNPOT), "gl.supports_NPOT"); + m_bSupportsBGRA8888 = checkForGLExtension("GL_IMG_texture_format_BGRA888"); + m_pValueDict->setObject( CCBool::create(m_bSupportsBGRA8888), "gl.supports_BGRA8888"); + m_bSupportsDiscardFramebuffer = checkForGLExtension("GL_EXT_discard_framebuffer"); + m_pValueDict->setObject( CCBool::create(m_bSupportsDiscardFramebuffer), "gl.supports_discard_framebuffer"); m_bSupportsShareableVAO = checkForGLExtension("vertex_array_object"); - - CCLOG("cocos2d: GL_MAX_TEXTURE_SIZE: %d", m_nMaxTextureSize); - CCLOG("cocos2d: GL_MAX_TEXTURE_UNITS: %d",m_nMaxTextureUnits); - CCLOG("cocos2d: GL supports PVRTC: %s", (m_bSupportsPVRTC ? "YES" : "NO")); - CCLOG("cocos2d: GL supports BGRA8888 textures: %s", (m_bSupportsBGRA8888 ? "YES" : "NO")); - CCLOG("cocos2d: GL supports NPOT textures: %s", (m_bSupportsNPOT ? "YES" : "NO")); - CCLOG("cocos2d: GL supports discard_framebuffer: %s", (m_bSupportsDiscardFramebuffer ? "YES" : "NO")); - CCLOG("cocos2d: GL supports shareable VAO: %s", (m_bSupportsShareableVAO ? "YES" : "NO") ); - - bool CC_UNUSED bEnableProfilers = false; - -#if CC_ENABLE_PROFILERS - bEnableProfilers = true; -#else - bEnableProfilers = false; -#endif - CCLOG("cocos2d: compiled with Profiling Support: %s", - bEnableProfilers ? "YES - *** Disable it when you finish profiling ***" : "NO"); - -#if CC_ENABLE_GL_STATE_CACHE == 0 - CCLOG(""); - CCLOG("cocos2d: **** WARNING **** CC_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it by editing ccConfig.h"); - printf("\n"); -#endif + m_pValueDict->setObject( CCBool::create(m_bSupportsShareableVAO), "gl.supports_vertex_array_object"); CHECK_GL_ERROR_DEBUG(); - - return true; } CCConfiguration* CCConfiguration::sharedConfiguration(void) @@ -114,7 +159,7 @@ void CCConfiguration::purgeConfiguration(void) CC_SAFE_RELEASE_NULL(s_gSharedConfiguration); } -bool CCConfiguration::checkForGLExtension(const string &searchName) +bool CCConfiguration::checkForGLExtension(const string &searchName) const { bool bRet = false; const char *kSearchName = searchName.c_str(); @@ -128,4 +173,161 @@ bool CCConfiguration::checkForGLExtension(const string &searchName) return bRet; } +// +// getters for specific variables. +// Mantained for backward compatiblity reasons only. +// +int CCConfiguration::getMaxTextureSize(void) const +{ + return m_nMaxTextureSize; +} + +int CCConfiguration::getMaxModelviewStackDepth(void) const +{ + return m_nMaxModelviewStackDepth; +} + +int CCConfiguration::getMaxTextureUnits(void) const +{ + return m_nMaxTextureUnits; +} + +bool CCConfiguration::supportsNPOT(void) const +{ + return m_bSupportsNPOT; +} + +bool CCConfiguration::supportsPVRTC(void) const +{ + return m_bSupportsPVRTC; +} + +bool CCConfiguration::supportsBGRA8888(void) const +{ + return m_bSupportsBGRA8888; +} + +bool CCConfiguration::supportsDiscardFramebuffer(void) const +{ + return m_bSupportsDiscardFramebuffer; +} + +bool CCConfiguration::supportsShareableVAO(void) const +{ + return m_bSupportsShareableVAO; +} + +// +// generic getters for properties +// +const char *CCConfiguration::getCString( const char *key, const char *default_value ) const +{ + CCObject *ret = m_pValueDict->objectForKey(key); + if( ret ) { + if( CCString *str=dynamic_cast(ret) ) + return str->getCString(); + + CCAssert(false, "Key found, but from different type"); + } + + // XXX: Should it throw an exception ? + return default_value; +} + +/** returns the value of a given key as a boolean */ +bool CCConfiguration::getBool( const char *key, bool default_value ) const +{ + CCObject *ret = m_pValueDict->objectForKey(key); + if( ret ) { + if( CCBool *boolobj=dynamic_cast(ret) ) + return boolobj->getValue(); + if( CCString *strobj=dynamic_cast(ret) ) + return strobj->boolValue(); + CCAssert(false, "Key found, but from different type"); + } + + // XXX: Should it throw an exception ? + return default_value; +} + +/** returns the value of a given key as a double */ +double CCConfiguration::getNumber( const char *key, double default_value ) const +{ + CCObject *ret = m_pValueDict->objectForKey(key); + if( ret ) { + if( CCDouble *obj=dynamic_cast(ret) ) + return obj->getValue(); + + if( CCInteger *obj=dynamic_cast(ret) ) + return obj->getValue(); + + if( CCString *strobj=dynamic_cast(ret) ) + return strobj->doubleValue(); + + CCAssert(false, "Key found, but from different type"); + } + + // XXX: Should it throw an exception ? + return default_value; +} + +CCObject * CCConfiguration::getObject( const char *key ) const +{ + return m_pValueDict->objectForKey(key); +} + +void CCConfiguration::setObject( const char *key, CCObject *value ) +{ + m_pValueDict->setObject(value, key); +} + + +// +// load file +// +void CCConfiguration::loadConfigFile( const char *filename ) +{ + CCDictionary *dict = CCDictionary::createWithContentsOfFile(filename); + CCAssert(dict, "cannot create dictionary"); + + // search for metadata + bool metadata_ok = false; + CCObject *metadata = dict->objectForKey("metadata"); + if( metadata && dynamic_cast(metadata) ) { + CCObject *format_o = static_cast(metadata)->objectForKey("format"); + + // XXX: cocos2d-x returns CCStrings when importing from .plist. This bug will be addressed in cocos2d-x v3.x + if( format_o && dynamic_cast(format_o) ) { + int format = static_cast(format_o)->intValue(); + + // Support format: 1 + if( format == 1 ) { + metadata_ok = true; + } + } + } + + if( ! metadata_ok ) { + CCLOG("Invalid config format for file: %s", filename); + return; + } + + CCObject *data = dict->objectForKey("data"); + if( !data || !dynamic_cast(data) ) { + CCLOG("Expected 'data' dict, but not found. Config file: %s", filename); + return; + } + + // Add all keys in the existing dictionary + CCDictionary *data_dict = static_cast(data); + CCDictElement* element; + CCDICT_FOREACH(data_dict, element) + { + if( ! m_pValueDict->objectForKey( element->getStrKey() ) ) + m_pValueDict->setObject(element->getObject(), element->getStrKey() ); + else + CCLOG("Key already present. Ignoring '%s'", element->getStrKey() ); + } +} + NS_CC_END diff --git a/cocos2dx/CCConfiguration.h b/cocos2dx/CCConfiguration.h index 0c8a78b78d..1668d12a9b 100644 --- a/cocos2dx/CCConfiguration.h +++ b/cocos2dx/CCConfiguration.h @@ -28,10 +28,22 @@ THE SOFTWARE. #include "cocoa/CCObject.h" #include "CCGL.h" +#include "cocoa/CCString.h" #include + + NS_CC_BEGIN +typedef enum _ccConfigurationType { + ConfigurationError, + ConfigurationString, + ConfigurationInt, + ConfigurationDouble, + ConfigurationBoolean +} ccConfigurationType; + + /** * @addtogroup global * @{ @@ -45,78 +57,86 @@ class CC_DLL CCConfiguration : public CCObject public: /** returns a shared instance of CCConfiguration */ static CCConfiguration *sharedConfiguration(void); + /** purge the shared instance of CCConfiguration */ static void purgeConfiguration(void); -public: - + +public: + + virtual ~CCConfiguration(void); + /** OpenGL Max texture size. */ - inline int getMaxTextureSize(void) - { - return m_nMaxTextureSize; - } - + int getMaxTextureSize(void) const; + /** OpenGL Max Modelview Stack Depth. */ - inline int getMaxModelviewStackDepth(void) - { - return m_nMaxModelviewStackDepth; - } + int getMaxModelviewStackDepth(void) const; /** returns the maximum texture units @since v2.0.0 */ - inline int getMaxTextureUnits(void) - { - return m_nMaxTextureUnits; - } + int getMaxTextureUnits(void) const; /** Whether or not the GPU supports NPOT (Non Power Of Two) textures. OpenGL ES 2.0 already supports NPOT (iOS). @since v0.99.2 */ - inline bool supportsNPOT(void) - { - return m_bSupportsNPOT; - } + bool supportsNPOT(void) const; /** Whether or not PVR Texture Compressed is supported */ - inline bool supportsPVRTC(void) - { - return m_bSupportsPVRTC; - } + bool supportsPVRTC(void) const; /** Whether or not BGRA8888 textures are supported. @since v0.99.2 */ - inline bool supportsBGRA8888(void) - { - return m_bSupportsBGRA8888; - } + bool supportsBGRA8888(void) const; /** Whether or not glDiscardFramebufferEXT is supported @since v0.99.2 */ - inline bool supportsDiscardFramebuffer(void) - { - return m_bSupportsDiscardFramebuffer; - } + bool supportsDiscardFramebuffer(void) const; /** Whether or not shareable VAOs are supported. @since v2.0.0 */ - inline bool supportsShareableVAO(void) - { - return m_bSupportsShareableVAO; - } + bool supportsShareableVAO(void) const; /** returns whether or not an OpenGL is supported */ - bool checkForGLExtension(const std::string &searchName); + bool checkForGLExtension(const std::string &searchName) const; bool init(void); + /** returns the value of a given key as a string. + If the key is not found, it will return the default value */ + const char* getCString( const char *key, const char *default_value=NULL ) const; + + /** returns the value of a given key as a boolean. + If the key is not found, it will return the default value */ + bool getBool( const char *key, bool default_value=false ) const; + + /** returns the value of a given key as a double. + If the key is not found, it will return the default value */ + double getNumber( const char *key, double default_value=0.0 ) const; + + /** returns the value of a given key as a double */ + CCObject * getObject( const char *key ) const; + + /** sets a new key/value pair in the configuration dictionary */ + void setObject( const char *key, CCObject *value ); + + /** dumps the current configuration on the console */ + void dumpInfo(void) const; + + /** gathers OpenGL / GPU information */ + void gatherGPUInfo( void ); + + /** Loads a config file. If the keys are already present, then they are going to be replaced. Otherwise the new keys are added. */ + void loadConfigFile( const char *filename ); + private: CCConfiguration(void); static CCConfiguration *s_gSharedConfiguration; + static std::string s_sConfigfile; protected: GLint m_nMaxTextureSize; @@ -129,6 +149,8 @@ protected: GLint m_nMaxSamplesAllowed; GLint m_nMaxTextureUnits; char * m_pGlExtensions; + + CCDictionary *m_pValueDict; }; // end of global group diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index a4fd396b5a..f1f5ef28cc 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -23,6 +23,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ + +// standard includes +#include + +// cocos2d includes #include "CCDirector.h" #include "ccFPSImages.h" #include "draw_nodes/CCDrawingPrimitives.h" @@ -56,8 +61,11 @@ THE SOFTWARE. #include "kazmath/kazmath.h" #include "kazmath/GL/matrix.h" #include "support/CCProfiling.h" +#include "platform/CCImage.h" #include "CCEGLView.h" -#include +#include "CCConfiguration.h" + + /** Position of the FPS @@ -98,9 +106,7 @@ CCDirector::CCDirector(void) } bool CCDirector::init(void) -{ - CCLOG("cocos2d: %s", cocos2dVersion()); - +{ // scenes m_pRunningScene = NULL; m_pNextScene = NULL; @@ -304,6 +310,11 @@ void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView) if (m_pobOpenGLView != pobOpenGLView) { + // Configuration. Gather GPU info + CCConfiguration *conf = CCConfiguration::sharedConfiguration(); + conf->gatherGPUInfo(); + conf->dumpInfo(); + // EAGLView is not a CCObject delete m_pobOpenGLView; // [openGLView_ release] m_pobOpenGLView = pobOpenGLView; @@ -578,33 +589,44 @@ void CCDirector::popScene(void) } void CCDirector::popToRootScene(void) +{ + popToSceneStackLevel(1); +} + +void CCDirector::popToSceneStackLevel(int level) { CCAssert(m_pRunningScene != NULL, "A running Scene is needed"); - unsigned int c = m_pobScenesStack->count(); + int c = (int)m_pobScenesStack->count(); - if (c == 1) + // level 0? -> end + if (level == 0) { - m_pobScenesStack->removeLastObject(); - this->end(); - } - else - { - while (c > 1) - { - CCScene *current = (CCScene*)m_pobScenesStack->lastObject(); - if( current->isRunning() ) - { - current->onExitTransitionDidStart(); - current->onExit(); - } - current->cleanup(); - - m_pobScenesStack->removeLastObject(); - c--; - } - m_pNextScene = (CCScene*)m_pobScenesStack->lastObject(); - m_bSendCleanupToScene = false; + end(); + return; } + + // current level or lower -> nothing + if (level >= c) + return; + + // pop stack until reaching desired level + while (c > level) + { + CCScene *current = (CCScene*)m_pobScenesStack->lastObject(); + + if (current->isRunning()) + { + current->onExitTransitionDidStart(); + current->onExit(); + } + + current->cleanup(); + m_pobScenesStack->removeLastObject(); + c--; + } + + m_pNextScene = (CCScene*)m_pobScenesStack->lastObject(); + m_bSendCleanupToScene = false; } void CCDirector::end() @@ -787,43 +809,75 @@ void CCDirector::calculateMPF() void CCDirector::getFPSImageData(unsigned char** datapointer, unsigned int* length) { // XXX fixed me if it should be used -// *datapointer = cc_fps_images_png; -// *length = cc_fps_images_len(); + *datapointer = cc_fps_images_png; + *length = cc_fps_images_len(); } void CCDirector::createStatsLabel() -{ - if( m_pFPSLabel && m_pSPFLabel ) +{ + CCTexture2D *texture = NULL; + CCTextureCache *textureCache = CCTextureCache::sharedTextureCache(); + + if( m_pFPSLabel && m_pSPFLabel ) { CC_SAFE_RELEASE_NULL(m_pFPSLabel); CC_SAFE_RELEASE_NULL(m_pSPFLabel); CC_SAFE_RELEASE_NULL(m_pDrawsLabel); + textureCache->removeTextureForKey("cc_fps_images"); CCFileUtils::sharedFileUtils()->purgeCachedEntries(); } - int fontSize = 0; - if (m_obWinSizeInPoints.width > m_obWinSizeInPoints.height) - { - fontSize = (int)(m_obWinSizeInPoints.height / 320.0f * 24); - } - else - { - fontSize = (int)(m_obWinSizeInPoints.width / 320.0f * 24); - } - - m_pFPSLabel = CCLabelTTF::create("00.0", "Arial", fontSize); - m_pFPSLabel->retain(); - m_pSPFLabel = CCLabelTTF::create("0.000", "Arial", fontSize); - m_pSPFLabel->retain(); - m_pDrawsLabel = CCLabelTTF::create("000", "Arial", fontSize); - m_pDrawsLabel->retain(); + CCTexture2DPixelFormat currentFormat = CCTexture2D::defaultAlphaPixelFormat(); + CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444); + unsigned char *data = NULL; + unsigned int data_len = 0; + getFPSImageData(&data, &data_len); - CCSize contentSize = m_pDrawsLabel->getContentSize(); - m_pDrawsLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height*5/2), CC_DIRECTOR_STATS_POSITION)); - contentSize = m_pSPFLabel->getContentSize(); - m_pSPFLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height*3/2), CC_DIRECTOR_STATS_POSITION)); - contentSize = m_pFPSLabel->getContentSize(); - m_pFPSLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height/2), CC_DIRECTOR_STATS_POSITION)); + CCImage* image = new CCImage(); + bool isOK = image->initWithImageData(data, data_len); + if (!isOK) { + CCLOGERROR("%s", "Fails: init fps_images"); + return; + } + + texture = textureCache->addUIImage(image, "cc_fps_images"); + CC_SAFE_RELEASE(image); + + /* + We want to use an image which is stored in the file named ccFPSImage.c + for any design resolutions and all resource resolutions. + + To achieve this, + + Firstly, we need to ignore 'contentScaleFactor' in 'CCAtlasNode' and 'CCLabelAtlas'. + So I added a new method called 'setIgnoreContentScaleFactor' for 'CCAtlasNode', + this is not exposed to game developers, it's only used for displaying FPS now. + + Secondly, the size of this image is 480*320, to display the FPS label with correct size, + a factor of design resolution ratio of 480x320 is also needed. + */ + float factor = CCEGLView::sharedOpenGLView()->getDesignResolutionSize().height / 320.0f; + + m_pFPSLabel = new CCLabelAtlas(); + m_pFPSLabel->setIgnoreContentScaleFactor(true); + m_pFPSLabel->initWithString("00.0", texture, 12, 32 , '.'); + m_pFPSLabel->setScale(factor); + + m_pSPFLabel = new CCLabelAtlas(); + m_pSPFLabel->setIgnoreContentScaleFactor(true); + m_pSPFLabel->initWithString("0.000", texture, 12, 32, '.'); + m_pSPFLabel->setScale(factor); + + m_pDrawsLabel = new CCLabelAtlas(); + m_pDrawsLabel->setIgnoreContentScaleFactor(true); + m_pDrawsLabel->initWithString("000", texture, 12, 32, '.'); + m_pDrawsLabel->setScale(factor); + + CCTexture2D::setDefaultAlphaPixelFormat(currentFormat); + + m_pDrawsLabel->setPosition(ccpAdd(ccp(0, 34*factor), CC_DIRECTOR_STATS_POSITION)); + m_pSPFLabel->setPosition(ccpAdd(ccp(0, 17*factor), CC_DIRECTOR_STATS_POSITION)); + m_pFPSLabel->setPosition(CC_DIRECTOR_STATS_POSITION); } float CCDirector::getContentScaleFactor(void) @@ -948,7 +1002,9 @@ void CCDisplayLinkDirector::startAnimation(void) } m_bInvalid = false; +#ifndef EMSCRIPTEN CCApplication::sharedApplication()->setAnimationInterval(m_dAnimationInterval); +#endif // EMSCRIPTEN } void CCDisplayLinkDirector::mainLoop(void) diff --git a/cocos2dx/CCDirector.h b/cocos2dx/CCDirector.h index 8e19e33b37..d9c6408e3a 100644 --- a/cocos2dx/CCDirector.h +++ b/cocos2dx/CCDirector.h @@ -34,7 +34,7 @@ THE SOFTWARE. #include "cocoa/CCArray.h" #include "CCGL.h" #include "kazmath/mat4.h" -#include "label_nodes/CCLabelTTF.h" +#include "label_nodes/CCLabelAtlas.h" #include "ccTypeInfo.h" @@ -204,7 +204,7 @@ public: // Scene Management - /**Enters the Director's main loop with the given Scene. + /** Enters the Director's main loop with the given Scene. * Call it to run only your FIRST scene. * Don't call it if there is already a running scene. * @@ -212,27 +212,33 @@ public: */ void runWithScene(CCScene *pScene); - /**Suspends the execution of the running scene, pushing it on the stack of suspended scenes. + /** Suspends the execution of the running scene, pushing it on the stack of suspended scenes. * The new scene will be executed. * Try to avoid big stacks of pushed scenes to reduce memory allocation. * ONLY call it if there is a running scene. */ void pushScene(CCScene *pScene); - /**Pops out a scene from the queue. + /** Pops out a scene from the queue. * This scene will replace the running one. * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated. * ONLY call it if there is a running scene. */ void popScene(void); - /**Pops out all scenes from the queue until the root scene in the queue. + /** Pops out all scenes from the queue until the root scene in the queue. * This scene will replace the running one. - * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated. - * ONLY call it if there is a running scene. + * Internally it will call `popToSceneStackLevel(1)` */ void popToRootScene(void); + /** Pops out all scenes from the queue until it reaches `level`. + If level is 0, it will end the director. + If level is 1, it will pop all scenes until it reaches to root scene. + If level is <= than the current stack level, it won't do anything. + */ + void popToSceneStackLevel(int level); + /** Replaces the running scene with a new one. The running scene is terminated. * ONLY call it if there is a running scene. */ @@ -329,6 +335,7 @@ public: /* delta time since last tick to main loop */ CC_PROPERTY_READONLY(float, m_fDeltaTime, DeltaTime); +public: /** returns a shared instance of the director */ static CCDirector* sharedDirector(void); @@ -360,9 +367,9 @@ protected: float m_fAccumDt; float m_fFrameRate; - CCLabelTTF *m_pFPSLabel; - CCLabelTTF *m_pSPFLabel; - CCLabelTTF *m_pDrawsLabel; + CCLabelAtlas *m_pFPSLabel; + CCLabelAtlas *m_pSPFLabel; + CCLabelAtlas *m_pDrawsLabel; /** Whether or not the Director is paused */ bool m_bPaused; diff --git a/cocos2dx/CCScheduler.cpp b/cocos2dx/CCScheduler.cpp index 583094e510..b7e0138d7d 100644 --- a/cocos2dx/CCScheduler.cpp +++ b/cocos2dx/CCScheduler.cpp @@ -257,11 +257,18 @@ CCScheduler::~CCScheduler(void) void CCScheduler::removeHashElement(_hashSelectorEntry *pElement) { + + cocos2d::CCObject *target = pElement->target; + ccArrayFree(pElement->timers); - pElement->target->release(); - pElement->target = NULL; HASH_DEL(m_pHashForTimers, pElement); free(pElement); + + // make sure the target is released after we have removed the hash element + // otherwise we access invalid memory when the release call deletes the target + // and the target calls removeAllSelectors() during its destructor + target->release(); + } void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, CCObject *pTarget, float fInterval, bool bPaused) diff --git a/cocos2dx/actions/CCActionGrid.h b/cocos2dx/actions/CCActionGrid.h index c0e90dfe91..cc9c6f506c 100644 --- a/cocos2dx/actions/CCActionGrid.h +++ b/cocos2dx/actions/CCActionGrid.h @@ -53,7 +53,7 @@ public: public: /** creates the action with size and duration */ - // We can't make this create function compatible with previous version, cxx-generator will be confused since they + // We can't make this create function compatible with previous version, bindings-generator will be confused since they // have the same function name and the same number of arguments. So sorry about that. //CC_DEPRECATED_ATTRIBUTE static CCGridAction* create(const CCSize& gridSize, float duration); diff --git a/cocos2dx/actions/CCActionInstant.cpp b/cocos2dx/actions/CCActionInstant.cpp index 580d00927b..540cf38b83 100644 --- a/cocos2dx/actions/CCActionInstant.cpp +++ b/cocos2dx/actions/CCActionInstant.cpp @@ -188,6 +188,51 @@ CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone) return pRet; } +// +// Remove Self +// +CCRemoveSelf * CCRemoveSelf::create(bool isNeedCleanUp /*= true*/) +{ + CCRemoveSelf *pRet = new CCRemoveSelf(); + + if (pRet && pRet->init(isNeedCleanUp)) { + pRet->autorelease(); + } + + return pRet; +} + +bool CCRemoveSelf::init(bool isNeedCleanUp) { + m_bIsNeedCleanUp = isNeedCleanUp; + return true; +} + +void CCRemoveSelf::update(float time) { + CC_UNUSED_PARAM(time); + m_pTarget->removeFromParentAndCleanup(m_bIsNeedCleanUp); +} + +CCFiniteTimeAction *CCRemoveSelf::reverse() { + return (CCFiniteTimeAction*) (CCRemoveSelf::create(m_bIsNeedCleanUp)); +} + +CCObject* CCRemoveSelf::copyWithZone(CCZone *pZone) { + CCZone *pNewZone = NULL; + CCRemoveSelf *pRet = NULL; + + if (pZone && pZone->m_pCopyObject) { + pRet = (CCRemoveSelf*) (pZone->m_pCopyObject); + } else { + pRet = new CCRemoveSelf(); + pZone = pNewZone = new CCZone(pRet); + } + + CCActionInstant::copyWithZone(pZone); + pRet->init(m_bIsNeedCleanUp); + CC_SAFE_DELETE(pNewZone); + return pRet; +} + // // FlipX // @@ -398,6 +443,9 @@ CCObject * CCCallFunc::copyWithZone(CCZone *pZone) { CCActionInstant::copyWithZone(pZone); pRet->initWithTarget(m_pSelectorTarget); pRet->m_pCallFunc = m_pCallFunc; + if (m_nScriptHandler > 0 ) { + pRet->m_nScriptHandler = cocos2d::CCScriptEngineManager::sharedManager()->getScriptEngine()->reallocateScriptHandler(m_nScriptHandler); + } CC_SAFE_DELETE(pNewZone); return pRet; } diff --git a/cocos2dx/actions/CCActionInstant.h b/cocos2dx/actions/CCActionInstant.h index ad22f77233..1ca45a2a72 100644 --- a/cocos2dx/actions/CCActionInstant.h +++ b/cocos2dx/actions/CCActionInstant.h @@ -109,6 +109,27 @@ public: static CCToggleVisibility * create(); }; +/** +@brief Remove the node +*/ +class CC_DLL CCRemoveSelf : public CCActionInstant +{ +public: + CCRemoveSelf(){} + virtual ~CCRemoveSelf(){} + //super methods + virtual void update(float time); + virtual CCFiniteTimeAction * reverse(void); + virtual CCObject* copyWithZone(CCZone *pZone); +public: + /** create the action */ + static CCRemoveSelf * create(bool isNeedCleanUp = true); + /** init the action */ + bool init(bool isNeedCleanUp); +protected: + bool m_bIsNeedCleanUp; +}; + /** @brief Flips the sprite horizontally @since v0.99.0 diff --git a/cocos2dx/actions/CCActionManager.cpp b/cocos2dx/actions/CCActionManager.cpp index 6308e7c8d1..488d769435 100644 --- a/cocos2dx/actions/CCActionManager.cpp +++ b/cocos2dx/actions/CCActionManager.cpp @@ -313,7 +313,7 @@ CCAction* CCActionManager::getActionByTag(unsigned int tag, CCObject *pTarget) } } } - CCLOG("cocos2d : getActionByTag: Action not found"); + CCLOG("cocos2d : getActionByTag(tag = %d): Action not found", tag); } else { diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index 972b13bed8..7a7bbffb99 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -52,6 +52,7 @@ CCAtlasNode::CCAtlasNode() , m_bIsOpacityModifyRGB(false) , m_uQuadsToDraw(0) , m_nUniformColor(0) +, m_bIgnoreContentScaleFactor(false) { } @@ -120,7 +121,13 @@ bool CCAtlasNode::initWithTexture(CCTexture2D* texture, unsigned int tileWidth, void CCAtlasNode::calculateMaxItems() { - const CCSize& s = m_pTextureAtlas->getTexture()->getContentSize(); + CCSize s = m_pTextureAtlas->getTexture()->getContentSize(); + + if (m_bIgnoreContentScaleFactor) + { + s = m_pTextureAtlas->getTexture()->getContentSizeInPixels(); + } + m_uItemsPerColumn = (int)(s.height / m_uItemHeight); m_uItemsPerRow = (int)(s.width / m_uItemWidth); } @@ -194,6 +201,11 @@ void CCAtlasNode::updateOpacityModifyRGB() m_bIsOpacityModifyRGB = m_pTextureAtlas->getTexture()->hasPremultipliedAlpha(); } +void CCAtlasNode::setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor) +{ + m_bIgnoreContentScaleFactor = bIgnoreContentScaleFactor; +} + // CCAtlasNode - CocosNodeTexture protocol ccBlendFunc CCAtlasNode::getBlendFunc() diff --git a/cocos2dx/base_nodes/CCAtlasNode.h b/cocos2dx/base_nodes/CCAtlasNode.h index 1fa4f09d3e..b2b0412faf 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.h +++ b/cocos2dx/base_nodes/CCAtlasNode.h @@ -75,6 +75,9 @@ protected: CC_PROPERTY(unsigned int, m_uQuadsToDraw, QuadsToDraw); // color uniform GLint m_nUniformColor; + // This varible is only used for CCLabelAtlas FPS display. So plz don't modify its value. + bool m_bIgnoreContentScaleFactor; + public: CCAtlasNode(); virtual ~CCAtlasNode(); @@ -114,7 +117,9 @@ private : void calculateMaxItems(); void updateBlendFunc(); void updateOpacityModifyRGB(); - + + friend class CCDirector; + void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor); }; // end of base_node group diff --git a/cocos2dx/base_nodes/CCGLBufferedNode.cpp b/cocos2dx/base_nodes/CCGLBufferedNode.cpp new file mode 100644 index 0000000000..af34e8bc0d --- /dev/null +++ b/cocos2dx/base_nodes/CCGLBufferedNode.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +Copyright (c) 2013 Zynga Inc. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCGLBufferedNode.h" + +CCGLBufferedNode::CCGLBufferedNode(void) +{ + for(int i = 0; i < BUFFER_SLOTS; i++) + { + m_bufferObject[i] = 0; + m_bufferSize[i] = 0; + m_indexBufferObject[i] = 0; + m_indexBufferSize[i] = 0; + } +} + +void CCGLBufferedNode::setGLBufferData(void *buf, GLuint bufSize, int slot) +{ + // WebGL doesn't support client-side arrays, so generate a buffer and load the data first. + if(m_bufferSize[slot] < bufSize) + { + if(m_bufferObject[slot]) + { + glDeleteBuffers(1, &(m_bufferObject[slot])); + } + glGenBuffers(1, &(m_bufferObject[slot])); + m_bufferSize[slot] = bufSize; + + glBindBuffer(GL_ARRAY_BUFFER, m_bufferObject[slot]); + glBufferData(GL_ARRAY_BUFFER, bufSize, buf, GL_DYNAMIC_DRAW); + } + else + { + glBindBuffer(GL_ARRAY_BUFFER, m_bufferObject[slot]); + glBufferSubData(GL_ARRAY_BUFFER, 0, bufSize, buf); + } +} + +void CCGLBufferedNode::setGLIndexData(void *buf, GLuint bufSize, int slot) +{ + // WebGL doesn't support client-side arrays, so generate a buffer and load the data first. + if(m_indexBufferSize[slot] < bufSize) + { + if(m_indexBufferObject[slot]) + { + glDeleteBuffers(1, &(m_indexBufferObject[slot])); + } + glGenBuffers(1, &(m_indexBufferObject[slot])); + m_indexBufferSize[slot] = bufSize; + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferObject[slot]); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufSize, buf, GL_DYNAMIC_DRAW); + } + else + { + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferObject[slot]); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, bufSize, buf); + } +} + diff --git a/cocos2dx/base_nodes/CCGLBufferedNode.h b/cocos2dx/base_nodes/CCGLBufferedNode.h new file mode 100644 index 0000000000..0892639764 --- /dev/null +++ b/cocos2dx/base_nodes/CCGLBufferedNode.h @@ -0,0 +1,48 @@ +/**************************************************************************** +Copyright (c) 2013 Zynga Inc. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CC_GL_BUFFERED_NODE__ +#define __CC_GL_BUFFERED_NODE__ + +#include + +class CCGLBufferedNode +{ +public: + CCGLBufferedNode(void); + + /** + * Load the given data into this CCNode's GL Buffer. Needed for WebGL, as it does not support client-side arrays. + */ + void setGLBufferData(void *buf, GLuint bufSize, int slot); + void setGLIndexData(void *buf, GLuint bufSize, int slot); + + // We allocate 4 buffer objs per node, and index into them as slots. +#define BUFFER_SLOTS 4 + GLuint m_bufferObject[BUFFER_SLOTS]; + GLuint m_bufferSize[BUFFER_SLOTS]; + + GLuint m_indexBufferObject[BUFFER_SLOTS]; + GLuint m_indexBufferSize[BUFFER_SLOTS]; +}; +#endif // __CC_GL_BUFFERED_NODE__ diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 6602c679a4..26e257b6c1 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -38,12 +38,13 @@ THE SOFTWARE. #include "shaders/CCGLProgram.h" // externals #include "kazmath/GL/matrix.h" - +#include "support/component/CCComponent.h" +#include "support/component/CCComponentContainer.h" #if CC_NODE_RENDER_SUBPIXEL #define RENDER_IN_SUBPIXEL #else -#define RENDER_IN_SUBPIXEL (__ARGS__) (ceil(__ARGS__)) +#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__)) #endif NS_CC_BEGIN @@ -71,7 +72,7 @@ CCNode::CCNode(void) , m_nZOrder(0) , m_pChildren(NULL) , m_pParent(NULL) -// "whole screen" objects. like Scenes and Layers, should set m_bIgnoreAnchorPointForPosition to false +// "whole screen" objects. like Scenes and Layers, should set m_bIgnoreAnchorPointForPosition to true , m_nTag(kCCNodeTagInvalid) // userData is always inited as nil , m_pUserData(NULL) @@ -88,6 +89,7 @@ CCNode::CCNode(void) , m_bReorderChildDirty(false) , m_nScriptHandler(0) , m_nUpdateScriptHandler(0) +, m_pComponentContainer(NULL) { // set default scheduler and actionManager CCDirector *director = CCDirector::sharedDirector(); @@ -98,6 +100,7 @@ CCNode::CCNode(void) CCScriptEngineProtocol* pEngine = CCScriptEngineManager::sharedManager()->getScriptEngine(); m_eScriptType = pEngine != NULL ? pEngine->getScriptType() : kScriptTypeNone; + m_pComponentContainer = new CCComponentContainer(this); } CCNode::~CCNode(void) @@ -134,6 +137,10 @@ CCNode::~CCNode(void) // children CC_SAFE_RELEASE(m_pChildren); + + // m_pComsContainer + m_pComponentContainer->removeAll(); + CC_SAFE_DELETE(m_pComponentContainer); } bool CCNode::init() @@ -326,7 +333,7 @@ CCArray* CCNode::getChildren() return m_pChildren; } -unsigned int CCNode::getChildrenCount(void) +unsigned int CCNode::getChildrenCount(void) const { return m_pChildren ? m_pChildren->count() : 0; } @@ -392,7 +399,7 @@ void CCNode::setAnchorPoint(const CCPoint& point) } /// contentSize getter -const CCSize& CCNode::getContentSize() +const CCSize& CCNode::getContentSize() const { return m_obContentSize; } @@ -441,7 +448,7 @@ void CCNode::ignoreAnchorPointForPosition(bool newValue) } /// tag getter -int CCNode::getTag() +int CCNode::getTag() const { return m_nTag; } @@ -662,7 +669,7 @@ void CCNode::removeChildByTag(int tag, bool cleanup) if (child == NULL) { - CCLOG("cocos2d: removeChildByTag: child not found!"); + CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag); } else { @@ -1107,6 +1114,11 @@ void CCNode::update(float fDelta) { CCScriptEngineManager::sharedManager()->getScriptEngine()->executeSchedule(m_nUpdateScriptHandler, fDelta, this); } + + if (m_pComponentContainer && !m_pComponentContainer->isEmpty()) + { + m_pComponentContainer->visit(fDelta); + } } CCAffineTransform CCNode::nodeToParentTransform(void) @@ -1265,6 +1277,26 @@ void CCNode::updateTransform() arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCNode*); } +CCComponent* CCNode::getComponent(const char *pName) const +{ + return m_pComponentContainer->get(pName); +} + +bool CCNode::addComponent(CCComponent *pComponent) +{ + return m_pComponentContainer->add(pComponent); +} + +bool CCNode::removeComponent(const char *pName) +{ + return m_pComponentContainer->remove(pName); +} + +void CCNode::removeAllComponents() +{ + m_pComponentContainer->removeAll(); +} + // CCNodeRGBA CCNodeRGBA::CCNodeRGBA() : _displayedOpacity(255) diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 79b6a3657e..775200a2e1 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -49,6 +49,9 @@ class CCRGBAProtocol; class CCLabelProtocol; class CCScheduler; class CCActionManager; +class CCComponent; +class CCDictionary; +class CCComponentContainer; /** * @addtogroup base_nodes @@ -308,21 +311,21 @@ public: * @param x X coordinate for position * @param y Y coordinate for position */ - void setPosition(float x, float y); + virtual void setPosition(float x, float y); /** * Gets position in a more efficient way, returns two number instead of a CCPoint object * * @see setPosition(float, float) */ - void getPosition(float* x, float* y); + virtual void getPosition(float* x, float* y); /** * Gets/Sets x or y coordinate individually for position. * These methods are used in Lua and Javascript Bindings */ - void setPositionX(float x); - float getPositionX(void); - void setPositionY(float y); - float getPositionY(void); + virtual void setPositionX(float x); + virtual float getPositionX(void); + virtual void setPositionY(float y); + virtual float getPositionY(void); /** @@ -412,7 +415,7 @@ public: * * @return The untransformed size of the node. */ - virtual const CCSize& getContentSize(); + virtual const CCSize& getContentSize() const; /** @@ -608,7 +611,7 @@ public: * * @return The amount of children. */ - unsigned int getChildrenCount(void); + unsigned int getChildrenCount(void) const; /** * Sets the parent node @@ -757,7 +760,7 @@ public: * * @return A interger that identifies the node. */ - virtual int getTag(); + virtual int getTag() const; /** * Changes the tag that is used to identify the node easily. * @@ -1298,8 +1301,32 @@ public: * @endcode */ void setAdditionalTransform(const CCAffineTransform& additionalTransform); + /// @} end of Coordinate Converters + /// @{ + /// @name component functions + /** + * gets a component by its name + */ + CCComponent* getComponent(const char *pName) const; + + /** + * adds a component + */ + virtual bool addComponent(CCComponent *pComponent); + + /** + * removes a component by its name + */ + virtual bool removeComponent(const char *pName); + + /** + * removes all components + */ + virtual void removeAllComponents(); + /// @} end of component functions + private: /// lazy allocs void childrenAlloc(void); @@ -1376,6 +1403,9 @@ protected: int m_nScriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding. int m_nUpdateScriptHandler; ///< script handler for update() callback per frame, which is invoked from lua & javascript. ccScriptType m_eScriptType; ///< type of script binding, lua or javascript + + CCComponentContainer *m_pComponentContainer; ///< Dictionary of components + }; //#pragma mark - CCNodeRGBA diff --git a/cocos2dx/ccFPSImages.c b/cocos2dx/ccFPSImages.c new file mode 100644 index 0000000000..045980e048 --- /dev/null +++ b/cocos2dx/ccFPSImages.c @@ -0,0 +1,613 @@ +/* + * cocos2d for iPhone: http://www.cocos2d-iphone.org + * + * Copyright (c) 2012 Zynga Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "ccFPSImages.h" + +unsigned char cc_fps_images_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xfd, 0xa9, 0xa6, 0xe4, 0x00, 0x00, 0x0a, + 0x43, 0x69, 0x43, 0x43, 0x50, 0x49, 0x43, 0x43, 0x20, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x78, 0xda, 0x9d, 0x53, 0x77, 0x58, + 0x93, 0xf7, 0x16, 0x3e, 0xdf, 0xf7, 0x65, 0x0f, 0x56, 0x42, 0xd8, 0xf0, + 0xb1, 0x97, 0x6c, 0x81, 0x00, 0x22, 0x23, 0xac, 0x08, 0xc8, 0x10, 0x59, + 0xa2, 0x10, 0x92, 0x00, 0x61, 0x84, 0x10, 0x12, 0x40, 0xc5, 0x85, 0x88, + 0x0a, 0x56, 0x14, 0x15, 0x11, 0x9c, 0x48, 0x55, 0xc4, 0x82, 0xd5, 0x0a, + 0x48, 0x9d, 0x88, 0xe2, 0xa0, 0x28, 0xb8, 0x67, 0x41, 0x8a, 0x88, 0x5a, + 0x8b, 0x55, 0x5c, 0x38, 0xee, 0x1f, 0xdc, 0xa7, 0xb5, 0x7d, 0x7a, 0xef, + 0xed, 0xed, 0xfb, 0xd7, 0xfb, 0xbc, 0xe7, 0x9c, 0xe7, 0xfc, 0xce, 0x79, + 0xcf, 0x0f, 0x80, 0x11, 0x12, 0x26, 0x91, 0xe6, 0xa2, 0x6a, 0x00, 0x39, + 0x52, 0x85, 0x3c, 0x3a, 0xd8, 0x1f, 0x8f, 0x4f, 0x48, 0xc4, 0xc9, 0xbd, + 0x80, 0x02, 0x15, 0x48, 0xe0, 0x04, 0x20, 0x10, 0xe6, 0xcb, 0xc2, 0x67, + 0x05, 0xc5, 0x00, 0x00, 0xf0, 0x03, 0x79, 0x78, 0x7e, 0x74, 0xb0, 0x3f, + 0xfc, 0x01, 0xaf, 0x6f, 0x00, 0x02, 0x00, 0x70, 0xd5, 0x2e, 0x24, 0x12, + 0xc7, 0xe1, 0xff, 0x83, 0xba, 0x50, 0x26, 0x57, 0x00, 0x20, 0x91, 0x00, + 0xe0, 0x22, 0x12, 0xe7, 0x0b, 0x01, 0x90, 0x52, 0x00, 0xc8, 0x2e, 0x54, + 0xc8, 0x14, 0x00, 0xc8, 0x18, 0x00, 0xb0, 0x53, 0xb3, 0x64, 0x0a, 0x00, + 0x94, 0x00, 0x00, 0x6c, 0x79, 0x7c, 0x42, 0x22, 0x00, 0xaa, 0x0d, 0x00, + 0xec, 0xf4, 0x49, 0x3e, 0x05, 0x00, 0xd8, 0xa9, 0x93, 0xdc, 0x17, 0x00, + 0xd8, 0xa2, 0x1c, 0xa9, 0x08, 0x00, 0x8d, 0x01, 0x00, 0x99, 0x28, 0x47, + 0x24, 0x02, 0x40, 0xbb, 0x00, 0x60, 0x55, 0x81, 0x52, 0x2c, 0x02, 0xc0, + 0xc2, 0x00, 0xa0, 0xac, 0x40, 0x22, 0x2e, 0x04, 0xc0, 0xae, 0x01, 0x80, + 0x59, 0xb6, 0x32, 0x47, 0x02, 0x80, 0xbd, 0x05, 0x00, 0x76, 0x8e, 0x58, + 0x90, 0x0f, 0x40, 0x60, 0x00, 0x80, 0x99, 0x42, 0x2c, 0xcc, 0x00, 0x20, + 0x38, 0x02, 0x00, 0x43, 0x1e, 0x13, 0xcd, 0x03, 0x20, 0x4c, 0x03, 0xa0, + 0x30, 0xd2, 0xbf, 0xe0, 0xa9, 0x5f, 0x70, 0x85, 0xb8, 0x48, 0x01, 0x00, + 0xc0, 0xcb, 0x95, 0xcd, 0x97, 0x4b, 0xd2, 0x33, 0x14, 0xb8, 0x95, 0xd0, + 0x1a, 0x77, 0xf2, 0xf0, 0xe0, 0xe2, 0x21, 0xe2, 0xc2, 0x6c, 0xb1, 0x42, + 0x61, 0x17, 0x29, 0x10, 0x66, 0x09, 0xe4, 0x22, 0x9c, 0x97, 0x9b, 0x23, + 0x13, 0x48, 0xe7, 0x03, 0x4c, 0xce, 0x0c, 0x00, 0x00, 0x1a, 0xf9, 0xd1, + 0xc1, 0xfe, 0x38, 0x3f, 0x90, 0xe7, 0xe6, 0xe4, 0xe1, 0xe6, 0x66, 0xe7, + 0x6c, 0xef, 0xf4, 0xc5, 0xa2, 0xfe, 0x6b, 0xf0, 0x6f, 0x22, 0x3e, 0x21, + 0xf1, 0xdf, 0xfe, 0xbc, 0x8c, 0x02, 0x04, 0x00, 0x10, 0x4e, 0xcf, 0xef, + 0xda, 0x5f, 0xe5, 0xe5, 0xd6, 0x03, 0x70, 0xc7, 0x01, 0xb0, 0x75, 0xbf, + 0x6b, 0xa9, 0x5b, 0x00, 0xda, 0x56, 0x00, 0x68, 0xdf, 0xf9, 0x5d, 0x33, + 0xdb, 0x09, 0xa0, 0x5a, 0x0a, 0xd0, 0x7a, 0xf9, 0x8b, 0x79, 0x38, 0xfc, + 0x40, 0x1e, 0x9e, 0xa1, 0x50, 0xc8, 0x3c, 0x1d, 0x1c, 0x0a, 0x0b, 0x0b, + 0xed, 0x25, 0x62, 0xa1, 0xbd, 0x30, 0xe3, 0x8b, 0x3e, 0xff, 0x33, 0xe1, + 0x6f, 0xe0, 0x8b, 0x7e, 0xf6, 0xfc, 0x40, 0x1e, 0xfe, 0xdb, 0x7a, 0xf0, + 0x00, 0x71, 0x9a, 0x40, 0x99, 0xad, 0xc0, 0xa3, 0x83, 0xfd, 0x71, 0x61, + 0x6e, 0x76, 0xae, 0x52, 0x8e, 0xe7, 0xcb, 0x04, 0x42, 0x31, 0x6e, 0xf7, + 0xe7, 0x23, 0xfe, 0xc7, 0x85, 0x7f, 0xfd, 0x8e, 0x29, 0xd1, 0xe2, 0x34, + 0xb1, 0x5c, 0x2c, 0x15, 0x8a, 0xf1, 0x58, 0x89, 0xb8, 0x50, 0x22, 0x4d, + 0xc7, 0x79, 0xb9, 0x52, 0x91, 0x44, 0x21, 0xc9, 0x95, 0xe2, 0x12, 0xe9, + 0x7f, 0x32, 0xf1, 0x1f, 0x96, 0xfd, 0x09, 0x93, 0x77, 0x0d, 0x00, 0xac, + 0x86, 0x4f, 0xc0, 0x4e, 0xb6, 0x07, 0xb5, 0xcb, 0x6c, 0xc0, 0x7e, 0xee, + 0x01, 0x02, 0x8b, 0x0e, 0x58, 0xd2, 0x76, 0x00, 0x40, 0x7e, 0xf3, 0x2d, + 0x8c, 0x1a, 0x0b, 0x91, 0x00, 0x10, 0x67, 0x34, 0x32, 0x79, 0xf7, 0x00, + 0x00, 0x93, 0xbf, 0xf9, 0x8f, 0x40, 0x2b, 0x01, 0x00, 0xcd, 0x97, 0xa4, + 0xe3, 0x00, 0x00, 0xbc, 0xe8, 0x18, 0x5c, 0xa8, 0x94, 0x17, 0x4c, 0xc6, + 0x08, 0x00, 0x00, 0x44, 0xa0, 0x81, 0x2a, 0xb0, 0x41, 0x07, 0x0c, 0xc1, + 0x14, 0xac, 0xc0, 0x0e, 0x9c, 0xc1, 0x1d, 0xbc, 0xc0, 0x17, 0x02, 0x61, + 0x06, 0x44, 0x40, 0x0c, 0x24, 0xc0, 0x3c, 0x10, 0x42, 0x06, 0xe4, 0x80, + 0x1c, 0x0a, 0xa1, 0x18, 0x96, 0x41, 0x19, 0x54, 0xc0, 0x3a, 0xd8, 0x04, + 0xb5, 0xb0, 0x03, 0x1a, 0xa0, 0x11, 0x9a, 0xe1, 0x10, 0xb4, 0xc1, 0x31, + 0x38, 0x0d, 0xe7, 0xe0, 0x12, 0x5c, 0x81, 0xeb, 0x70, 0x17, 0x06, 0x60, + 0x18, 0x9e, 0xc2, 0x18, 0xbc, 0x86, 0x09, 0x04, 0x41, 0xc8, 0x08, 0x13, + 0x61, 0x21, 0x3a, 0x88, 0x11, 0x62, 0x8e, 0xd8, 0x22, 0xce, 0x08, 0x17, + 0x99, 0x8e, 0x04, 0x22, 0x61, 0x48, 0x34, 0x92, 0x80, 0xa4, 0x20, 0xe9, + 0x88, 0x14, 0x51, 0x22, 0xc5, 0xc8, 0x72, 0xa4, 0x02, 0xa9, 0x42, 0x6a, + 0x91, 0x5d, 0x48, 0x23, 0xf2, 0x2d, 0x72, 0x14, 0x39, 0x8d, 0x5c, 0x40, + 0xfa, 0x90, 0xdb, 0xc8, 0x20, 0x32, 0x8a, 0xfc, 0x8a, 0xbc, 0x47, 0x31, + 0x94, 0x81, 0xb2, 0x51, 0x03, 0xd4, 0x02, 0x75, 0x40, 0xb9, 0xa8, 0x1f, + 0x1a, 0x8a, 0xc6, 0xa0, 0x73, 0xd1, 0x74, 0x34, 0x0f, 0x5d, 0x80, 0x96, + 0xa2, 0x6b, 0xd1, 0x1a, 0xb4, 0x1e, 0x3d, 0x80, 0xb6, 0xa2, 0xa7, 0xd1, + 0x4b, 0xe8, 0x75, 0x74, 0x00, 0x7d, 0x8a, 0x8e, 0x63, 0x80, 0xd1, 0x31, + 0x0e, 0x66, 0x8c, 0xd9, 0x61, 0x5c, 0x8c, 0x87, 0x45, 0x60, 0x89, 0x58, + 0x1a, 0x26, 0xc7, 0x16, 0x63, 0xe5, 0x58, 0x35, 0x56, 0x8f, 0x35, 0x63, + 0x1d, 0x58, 0x37, 0x76, 0x15, 0x1b, 0xc0, 0x9e, 0x61, 0xef, 0x08, 0x24, + 0x02, 0x8b, 0x80, 0x13, 0xec, 0x08, 0x5e, 0x84, 0x10, 0xc2, 0x6c, 0x82, + 0x90, 0x90, 0x47, 0x58, 0x4c, 0x58, 0x43, 0xa8, 0x25, 0xec, 0x23, 0xb4, + 0x12, 0xba, 0x08, 0x57, 0x09, 0x83, 0x84, 0x31, 0xc2, 0x27, 0x22, 0x93, + 0xa8, 0x4f, 0xb4, 0x25, 0x7a, 0x12, 0xf9, 0xc4, 0x78, 0x62, 0x3a, 0xb1, + 0x90, 0x58, 0x46, 0xac, 0x26, 0xee, 0x21, 0x1e, 0x21, 0x9e, 0x25, 0x5e, + 0x27, 0x0e, 0x13, 0x5f, 0x93, 0x48, 0x24, 0x0e, 0xc9, 0x92, 0xe4, 0x4e, + 0x0a, 0x21, 0x25, 0x90, 0x32, 0x49, 0x0b, 0x49, 0x6b, 0x48, 0xdb, 0x48, + 0x2d, 0xa4, 0x53, 0xa4, 0x3e, 0xd2, 0x10, 0x69, 0x9c, 0x4c, 0x26, 0xeb, + 0x90, 0x6d, 0xc9, 0xde, 0xe4, 0x08, 0xb2, 0x80, 0xac, 0x20, 0x97, 0x91, + 0xb7, 0x90, 0x0f, 0x90, 0x4f, 0x92, 0xfb, 0xc9, 0xc3, 0xe4, 0xb7, 0x14, + 0x3a, 0xc5, 0x88, 0xe2, 0x4c, 0x09, 0xa2, 0x24, 0x52, 0xa4, 0x94, 0x12, + 0x4a, 0x35, 0x65, 0x3f, 0xe5, 0x04, 0xa5, 0x9f, 0x32, 0x42, 0x99, 0xa0, + 0xaa, 0x51, 0xcd, 0xa9, 0x9e, 0xd4, 0x08, 0xaa, 0x88, 0x3a, 0x9f, 0x5a, + 0x49, 0x6d, 0xa0, 0x76, 0x50, 0x2f, 0x53, 0x87, 0xa9, 0x13, 0x34, 0x75, + 0x9a, 0x25, 0xcd, 0x9b, 0x16, 0x43, 0xcb, 0xa4, 0x2d, 0xa3, 0xd5, 0xd0, + 0x9a, 0x69, 0x67, 0x69, 0xf7, 0x68, 0x2f, 0xe9, 0x74, 0xba, 0x09, 0xdd, + 0x83, 0x1e, 0x45, 0x97, 0xd0, 0x97, 0xd2, 0x6b, 0xe8, 0x07, 0xe9, 0xe7, + 0xe9, 0x83, 0xf4, 0x77, 0x0c, 0x0d, 0x86, 0x0d, 0x83, 0xc7, 0x48, 0x62, + 0x28, 0x19, 0x6b, 0x19, 0x7b, 0x19, 0xa7, 0x18, 0xb7, 0x19, 0x2f, 0x99, + 0x4c, 0xa6, 0x05, 0xd3, 0x97, 0x99, 0xc8, 0x54, 0x30, 0xd7, 0x32, 0x1b, + 0x99, 0x67, 0x98, 0x0f, 0x98, 0x6f, 0x55, 0x58, 0x2a, 0xf6, 0x2a, 0x7c, + 0x15, 0x91, 0xca, 0x12, 0x95, 0x3a, 0x95, 0x56, 0x95, 0x7e, 0x95, 0xe7, + 0xaa, 0x54, 0x55, 0x73, 0x55, 0x3f, 0xd5, 0x79, 0xaa, 0x0b, 0x54, 0xab, + 0x55, 0x0f, 0xab, 0x5e, 0x56, 0x7d, 0xa6, 0x46, 0x55, 0xb3, 0x50, 0xe3, + 0xa9, 0x09, 0xd4, 0x16, 0xab, 0xd5, 0xa9, 0x1d, 0x55, 0xbb, 0xa9, 0x36, + 0xae, 0xce, 0x52, 0x77, 0x52, 0x8f, 0x50, 0xcf, 0x51, 0x5f, 0xa3, 0xbe, + 0x5f, 0xfd, 0x82, 0xfa, 0x63, 0x0d, 0xb2, 0x86, 0x85, 0x46, 0xa0, 0x86, + 0x48, 0xa3, 0x54, 0x63, 0xb7, 0xc6, 0x19, 0x8d, 0x21, 0x16, 0xc6, 0x32, + 0x65, 0xf1, 0x58, 0x42, 0xd6, 0x72, 0x56, 0x03, 0xeb, 0x2c, 0x6b, 0x98, + 0x4d, 0x62, 0x5b, 0xb2, 0xf9, 0xec, 0x4c, 0x76, 0x05, 0xfb, 0x1b, 0x76, + 0x2f, 0x7b, 0x4c, 0x53, 0x43, 0x73, 0xaa, 0x66, 0xac, 0x66, 0x91, 0x66, + 0x9d, 0xe6, 0x71, 0xcd, 0x01, 0x0e, 0xc6, 0xb1, 0xe0, 0xf0, 0x39, 0xd9, + 0x9c, 0x4a, 0xce, 0x21, 0xce, 0x0d, 0xce, 0x7b, 0x2d, 0x03, 0x2d, 0x3f, + 0x2d, 0xb1, 0xd6, 0x6a, 0xad, 0x66, 0xad, 0x7e, 0xad, 0x37, 0xda, 0x7a, + 0xda, 0xbe, 0xda, 0x62, 0xed, 0x72, 0xed, 0x16, 0xed, 0xeb, 0xda, 0xef, + 0x75, 0x70, 0x9d, 0x40, 0x9d, 0x2c, 0x9d, 0xf5, 0x3a, 0x6d, 0x3a, 0xf7, + 0x75, 0x09, 0xba, 0x36, 0xba, 0x51, 0xba, 0x85, 0xba, 0xdb, 0x75, 0xcf, + 0xea, 0x3e, 0xd3, 0x63, 0xeb, 0x79, 0xe9, 0x09, 0xf5, 0xca, 0xf5, 0x0e, + 0xe9, 0xdd, 0xd1, 0x47, 0xf5, 0x6d, 0xf4, 0xa3, 0xf5, 0x17, 0xea, 0xef, + 0xd6, 0xef, 0xd1, 0x1f, 0x37, 0x30, 0x34, 0x08, 0x36, 0x90, 0x19, 0x6c, + 0x31, 0x38, 0x63, 0xf0, 0xcc, 0x90, 0x63, 0xe8, 0x6b, 0x98, 0x69, 0xb8, + 0xd1, 0xf0, 0x84, 0xe1, 0xa8, 0x11, 0xcb, 0x68, 0xba, 0x91, 0xc4, 0x68, + 0xa3, 0xd1, 0x49, 0xa3, 0x27, 0xb8, 0x26, 0xee, 0x87, 0x67, 0xe3, 0x35, + 0x78, 0x17, 0x3e, 0x66, 0xac, 0x6f, 0x1c, 0x62, 0xac, 0x34, 0xde, 0x65, + 0xdc, 0x6b, 0x3c, 0x61, 0x62, 0x69, 0x32, 0xdb, 0xa4, 0xc4, 0xa4, 0xc5, + 0xe4, 0xbe, 0x29, 0xcd, 0x94, 0x6b, 0x9a, 0x66, 0xba, 0xd1, 0xb4, 0xd3, + 0x74, 0xcc, 0xcc, 0xc8, 0x2c, 0xdc, 0xac, 0xd8, 0xac, 0xc9, 0xec, 0x8e, + 0x39, 0xd5, 0x9c, 0x6b, 0x9e, 0x61, 0xbe, 0xd9, 0xbc, 0xdb, 0xfc, 0x8d, + 0x85, 0xa5, 0x45, 0x9c, 0xc5, 0x4a, 0x8b, 0x36, 0x8b, 0xc7, 0x96, 0xda, + 0x96, 0x7c, 0xcb, 0x05, 0x96, 0x4d, 0x96, 0xf7, 0xac, 0x98, 0x56, 0x3e, + 0x56, 0x79, 0x56, 0xf5, 0x56, 0xd7, 0xac, 0x49, 0xd6, 0x5c, 0xeb, 0x2c, + 0xeb, 0x6d, 0xd6, 0x57, 0x6c, 0x50, 0x1b, 0x57, 0x9b, 0x0c, 0x9b, 0x3a, + 0x9b, 0xcb, 0xb6, 0xa8, 0xad, 0x9b, 0xad, 0xc4, 0x76, 0x9b, 0x6d, 0xdf, + 0x14, 0xe2, 0x14, 0x8f, 0x29, 0xd2, 0x29, 0xf5, 0x53, 0x6e, 0xda, 0x31, + 0xec, 0xfc, 0xec, 0x0a, 0xec, 0x9a, 0xec, 0x06, 0xed, 0x39, 0xf6, 0x61, + 0xf6, 0x25, 0xf6, 0x6d, 0xf6, 0xcf, 0x1d, 0xcc, 0x1c, 0x12, 0x1d, 0xd6, + 0x3b, 0x74, 0x3b, 0x7c, 0x72, 0x74, 0x75, 0xcc, 0x76, 0x6c, 0x70, 0xbc, + 0xeb, 0xa4, 0xe1, 0x34, 0xc3, 0xa9, 0xc4, 0xa9, 0xc3, 0xe9, 0x57, 0x67, + 0x1b, 0x67, 0xa1, 0x73, 0x9d, 0xf3, 0x35, 0x17, 0xa6, 0x4b, 0x90, 0xcb, + 0x12, 0x97, 0x76, 0x97, 0x17, 0x53, 0x6d, 0xa7, 0x8a, 0xa7, 0x6e, 0x9f, + 0x7a, 0xcb, 0x95, 0xe5, 0x1a, 0xee, 0xba, 0xd2, 0xb5, 0xd3, 0xf5, 0xa3, + 0x9b, 0xbb, 0x9b, 0xdc, 0xad, 0xd9, 0x6d, 0xd4, 0xdd, 0xcc, 0x3d, 0xc5, + 0x7d, 0xab, 0xfb, 0x4d, 0x2e, 0x9b, 0x1b, 0xc9, 0x5d, 0xc3, 0x3d, 0xef, + 0x41, 0xf4, 0xf0, 0xf7, 0x58, 0xe2, 0x71, 0xcc, 0xe3, 0x9d, 0xa7, 0x9b, + 0xa7, 0xc2, 0xf3, 0x90, 0xe7, 0x2f, 0x5e, 0x76, 0x5e, 0x59, 0x5e, 0xfb, + 0xbd, 0x1e, 0x4f, 0xb3, 0x9c, 0x26, 0x9e, 0xd6, 0x30, 0x6d, 0xc8, 0xdb, + 0xc4, 0x5b, 0xe0, 0xbd, 0xcb, 0x7b, 0x60, 0x3a, 0x3e, 0x3d, 0x65, 0xfa, + 0xce, 0xe9, 0x03, 0x3e, 0xc6, 0x3e, 0x02, 0x9f, 0x7a, 0x9f, 0x87, 0xbe, + 0xa6, 0xbe, 0x22, 0xdf, 0x3d, 0xbe, 0x23, 0x7e, 0xd6, 0x7e, 0x99, 0x7e, + 0x07, 0xfc, 0x9e, 0xfb, 0x3b, 0xfa, 0xcb, 0xfd, 0x8f, 0xf8, 0xbf, 0xe1, + 0x79, 0xf2, 0x16, 0xf1, 0x4e, 0x05, 0x60, 0x01, 0xc1, 0x01, 0xe5, 0x01, + 0xbd, 0x81, 0x1a, 0x81, 0xb3, 0x03, 0x6b, 0x03, 0x1f, 0x04, 0x99, 0x04, + 0xa5, 0x07, 0x35, 0x05, 0x8d, 0x05, 0xbb, 0x06, 0x2f, 0x0c, 0x3e, 0x15, + 0x42, 0x0c, 0x09, 0x0d, 0x59, 0x1f, 0x72, 0x93, 0x6f, 0xc0, 0x17, 0xf2, + 0x1b, 0xf9, 0x63, 0x33, 0xdc, 0x67, 0x2c, 0x9a, 0xd1, 0x15, 0xca, 0x08, + 0x9d, 0x15, 0x5a, 0x1b, 0xfa, 0x30, 0xcc, 0x26, 0x4c, 0x1e, 0xd6, 0x11, + 0x8e, 0x86, 0xcf, 0x08, 0xdf, 0x10, 0x7e, 0x6f, 0xa6, 0xf9, 0x4c, 0xe9, + 0xcc, 0xb6, 0x08, 0x88, 0xe0, 0x47, 0x6c, 0x88, 0xb8, 0x1f, 0x69, 0x19, + 0x99, 0x17, 0xf9, 0x7d, 0x14, 0x29, 0x2a, 0x32, 0xaa, 0x2e, 0xea, 0x51, + 0xb4, 0x53, 0x74, 0x71, 0x74, 0xf7, 0x2c, 0xd6, 0xac, 0xe4, 0x59, 0xfb, + 0x67, 0xbd, 0x8e, 0xf1, 0x8f, 0xa9, 0x8c, 0xb9, 0x3b, 0xdb, 0x6a, 0xb6, + 0x72, 0x76, 0x67, 0xac, 0x6a, 0x6c, 0x52, 0x6c, 0x63, 0xec, 0x9b, 0xb8, + 0x80, 0xb8, 0xaa, 0xb8, 0x81, 0x78, 0x87, 0xf8, 0x45, 0xf1, 0x97, 0x12, + 0x74, 0x13, 0x24, 0x09, 0xed, 0x89, 0xe4, 0xc4, 0xd8, 0xc4, 0x3d, 0x89, + 0xe3, 0x73, 0x02, 0xe7, 0x6c, 0x9a, 0x33, 0x9c, 0xe4, 0x9a, 0x54, 0x96, + 0x74, 0x63, 0xae, 0xe5, 0xdc, 0xa2, 0xb9, 0x17, 0xe6, 0xe9, 0xce, 0xcb, + 0x9e, 0x77, 0x3c, 0x59, 0x35, 0x59, 0x90, 0x7c, 0x38, 0x85, 0x98, 0x12, + 0x97, 0xb2, 0x3f, 0xe5, 0x83, 0x20, 0x42, 0x50, 0x2f, 0x18, 0x4f, 0xe5, + 0xa7, 0x6e, 0x4d, 0x1d, 0x13, 0xf2, 0x84, 0x9b, 0x85, 0x4f, 0x45, 0xbe, + 0xa2, 0x8d, 0xa2, 0x51, 0xb1, 0xb7, 0xb8, 0x4a, 0x3c, 0x92, 0xe6, 0x9d, + 0x56, 0x95, 0xf6, 0x38, 0xdd, 0x3b, 0x7d, 0x43, 0xfa, 0x68, 0x86, 0x4f, + 0x46, 0x75, 0xc6, 0x33, 0x09, 0x4f, 0x52, 0x2b, 0x79, 0x91, 0x19, 0x92, + 0xb9, 0x23, 0xf3, 0x4d, 0x56, 0x44, 0xd6, 0xde, 0xac, 0xcf, 0xd9, 0x71, + 0xd9, 0x2d, 0x39, 0x94, 0x9c, 0x94, 0x9c, 0xa3, 0x52, 0x0d, 0x69, 0x96, + 0xb4, 0x2b, 0xd7, 0x30, 0xb7, 0x28, 0xb7, 0x4f, 0x66, 0x2b, 0x2b, 0x93, + 0x0d, 0xe4, 0x79, 0xe6, 0x6d, 0xca, 0x1b, 0x93, 0x87, 0xca, 0xf7, 0xe4, + 0x23, 0xf9, 0x73, 0xf3, 0xdb, 0x15, 0x6c, 0x85, 0x4c, 0xd1, 0xa3, 0xb4, + 0x52, 0xae, 0x50, 0x0e, 0x16, 0x4c, 0x2f, 0xa8, 0x2b, 0x78, 0x5b, 0x18, + 0x5b, 0x78, 0xb8, 0x48, 0xbd, 0x48, 0x5a, 0xd4, 0x33, 0xdf, 0x66, 0xfe, + 0xea, 0xf9, 0x23, 0x0b, 0x82, 0x16, 0x7c, 0xbd, 0x90, 0xb0, 0x50, 0xb8, + 0xb0, 0xb3, 0xd8, 0xb8, 0x78, 0x59, 0xf1, 0xe0, 0x22, 0xbf, 0x45, 0xbb, + 0x16, 0x23, 0x8b, 0x53, 0x17, 0x77, 0x2e, 0x31, 0x5d, 0x52, 0xba, 0x64, + 0x78, 0x69, 0xf0, 0xd2, 0x7d, 0xcb, 0x68, 0xcb, 0xb2, 0x96, 0xfd, 0x50, + 0xe2, 0x58, 0x52, 0x55, 0xf2, 0x6a, 0x79, 0xdc, 0xf2, 0x8e, 0x52, 0x83, + 0xd2, 0xa5, 0xa5, 0x43, 0x2b, 0x82, 0x57, 0x34, 0x95, 0xa9, 0x94, 0xc9, + 0xcb, 0x6e, 0xae, 0xf4, 0x5a, 0xb9, 0x63, 0x15, 0x61, 0x95, 0x64, 0x55, + 0xef, 0x6a, 0x97, 0xd5, 0x5b, 0x56, 0x7f, 0x2a, 0x17, 0x95, 0x5f, 0xac, + 0x70, 0xac, 0xa8, 0xae, 0xf8, 0xb0, 0x46, 0xb8, 0xe6, 0xe2, 0x57, 0x4e, + 0x5f, 0xd5, 0x7c, 0xf5, 0x79, 0x6d, 0xda, 0xda, 0xde, 0x4a, 0xb7, 0xca, + 0xed, 0xeb, 0x48, 0xeb, 0xa4, 0xeb, 0x6e, 0xac, 0xf7, 0x59, 0xbf, 0xaf, + 0x4a, 0xbd, 0x6a, 0x41, 0xd5, 0xd0, 0x86, 0xf0, 0x0d, 0xad, 0x1b, 0xf1, + 0x8d, 0xe5, 0x1b, 0x5f, 0x6d, 0x4a, 0xde, 0x74, 0xa1, 0x7a, 0x6a, 0xf5, + 0x8e, 0xcd, 0xb4, 0xcd, 0xca, 0xcd, 0x03, 0x35, 0x61, 0x35, 0xed, 0x5b, + 0xcc, 0xb6, 0xac, 0xdb, 0xf2, 0xa1, 0x36, 0xa3, 0xf6, 0x7a, 0x9d, 0x7f, + 0x5d, 0xcb, 0x56, 0xfd, 0xad, 0xab, 0xb7, 0xbe, 0xd9, 0x26, 0xda, 0xd6, + 0xbf, 0xdd, 0x77, 0x7b, 0xf3, 0x0e, 0x83, 0x1d, 0x15, 0x3b, 0xde, 0xef, + 0x94, 0xec, 0xbc, 0xb5, 0x2b, 0x78, 0x57, 0x6b, 0xbd, 0x45, 0x7d, 0xf5, + 0x6e, 0xd2, 0xee, 0x82, 0xdd, 0x8f, 0x1a, 0x62, 0x1b, 0xba, 0xbf, 0xe6, + 0x7e, 0xdd, 0xb8, 0x47, 0x77, 0x4f, 0xc5, 0x9e, 0x8f, 0x7b, 0xa5, 0x7b, + 0x07, 0xf6, 0x45, 0xef, 0xeb, 0x6a, 0x74, 0x6f, 0x6c, 0xdc, 0xaf, 0xbf, + 0xbf, 0xb2, 0x09, 0x6d, 0x52, 0x36, 0x8d, 0x1e, 0x48, 0x3a, 0x70, 0xe5, + 0x9b, 0x80, 0x6f, 0xda, 0x9b, 0xed, 0x9a, 0x77, 0xb5, 0x70, 0x5a, 0x2a, + 0x0e, 0xc2, 0x41, 0xe5, 0xc1, 0x27, 0xdf, 0xa6, 0x7c, 0x7b, 0xe3, 0x50, + 0xe8, 0xa1, 0xce, 0xc3, 0xdc, 0xc3, 0xcd, 0xdf, 0x99, 0x7f, 0xb7, 0xf5, + 0x08, 0xeb, 0x48, 0x79, 0x2b, 0xd2, 0x3a, 0xbf, 0x75, 0xac, 0x2d, 0xa3, + 0x6d, 0xa0, 0x3d, 0xa1, 0xbd, 0xef, 0xe8, 0x8c, 0xa3, 0x9d, 0x1d, 0x5e, + 0x1d, 0x47, 0xbe, 0xb7, 0xff, 0x7e, 0xef, 0x31, 0xe3, 0x63, 0x75, 0xc7, + 0x35, 0x8f, 0x57, 0x9e, 0xa0, 0x9d, 0x28, 0x3d, 0xf1, 0xf9, 0xe4, 0x82, + 0x93, 0xe3, 0xa7, 0x64, 0xa7, 0x9e, 0x9d, 0x4e, 0x3f, 0x3d, 0xd4, 0x99, + 0xdc, 0x79, 0xf7, 0x4c, 0xfc, 0x99, 0x6b, 0x5d, 0x51, 0x5d, 0xbd, 0x67, + 0x43, 0xcf, 0x9e, 0x3f, 0x17, 0x74, 0xee, 0x4c, 0xb7, 0x5f, 0xf7, 0xc9, + 0xf3, 0xde, 0xe7, 0x8f, 0x5d, 0xf0, 0xbc, 0x70, 0xf4, 0x22, 0xf7, 0x62, + 0xdb, 0x25, 0xb7, 0x4b, 0xad, 0x3d, 0xae, 0x3d, 0x47, 0x7e, 0x70, 0xfd, + 0xe1, 0x48, 0xaf, 0x5b, 0x6f, 0xeb, 0x65, 0xf7, 0xcb, 0xed, 0x57, 0x3c, + 0xae, 0x74, 0xf4, 0x4d, 0xeb, 0x3b, 0xd1, 0xef, 0xd3, 0x7f, 0xfa, 0x6a, + 0xc0, 0xd5, 0x73, 0xd7, 0xf8, 0xd7, 0x2e, 0x5d, 0x9f, 0x79, 0xbd, 0xef, + 0xc6, 0xec, 0x1b, 0xb7, 0x6e, 0x26, 0xdd, 0x1c, 0xb8, 0x25, 0xba, 0xf5, + 0xf8, 0x76, 0xf6, 0xed, 0x17, 0x77, 0x0a, 0xee, 0x4c, 0xdc, 0x5d, 0x7a, + 0x8f, 0x78, 0xaf, 0xfc, 0xbe, 0xda, 0xfd, 0xea, 0x07, 0xfa, 0x0f, 0xea, + 0x7f, 0xb4, 0xfe, 0xb1, 0x65, 0xc0, 0x6d, 0xe0, 0xf8, 0x60, 0xc0, 0x60, + 0xcf, 0xc3, 0x59, 0x0f, 0xef, 0x0e, 0x09, 0x87, 0x9e, 0xfe, 0x94, 0xff, + 0xd3, 0x87, 0xe1, 0xd2, 0x47, 0xcc, 0x47, 0xd5, 0x23, 0x46, 0x23, 0x8d, + 0x8f, 0x9d, 0x1f, 0x1f, 0x1b, 0x0d, 0x1a, 0xbd, 0xf2, 0x64, 0xce, 0x93, + 0xe1, 0xa7, 0xb2, 0xa7, 0x13, 0xcf, 0xca, 0x7e, 0x56, 0xff, 0x79, 0xeb, + 0x73, 0xab, 0xe7, 0xdf, 0xfd, 0xe2, 0xfb, 0x4b, 0xcf, 0x58, 0xfc, 0xd8, + 0xf0, 0x0b, 0xf9, 0x8b, 0xcf, 0xbf, 0xae, 0x79, 0xa9, 0xf3, 0x72, 0xef, + 0xab, 0xa9, 0xaf, 0x3a, 0xc7, 0x23, 0xc7, 0x1f, 0xbc, 0xce, 0x79, 0x3d, + 0xf1, 0xa6, 0xfc, 0xad, 0xce, 0xdb, 0x7d, 0xef, 0xb8, 0xef, 0xba, 0xdf, + 0xc7, 0xbd, 0x1f, 0x99, 0x28, 0xfc, 0x40, 0xfe, 0x50, 0xf3, 0xd1, 0xfa, + 0x63, 0xc7, 0xa7, 0xd0, 0x4f, 0xf7, 0x3e, 0xe7, 0x7c, 0xfe, 0xfc, 0x2f, + 0xf7, 0x84, 0xf3, 0xfb, 0x80, 0x39, 0x25, 0x11, 0x00, 0x00, 0x00, 0x06, + 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, + 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, + 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, + 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xdc, 0x02, 0x07, 0x10, + 0x2f, 0x1c, 0x54, 0x04, 0xda, 0x7f, 0x00, 0x00, 0x10, 0x67, 0x49, 0x44, + 0x41, 0x54, 0x78, 0xda, 0xed, 0x9b, 0x7b, 0x74, 0x15, 0x55, 0x96, 0xc6, + 0xbf, 0x53, 0x75, 0xef, 0xcd, 0xbd, 0x79, 0x12, 0xf2, 0x20, 0xa0, 0x04, + 0x3a, 0x22, 0x12, 0x12, 0xd3, 0xe1, 0x25, 0x32, 0x40, 0x62, 0xec, 0x81, + 0x0e, 0x68, 0x56, 0x8c, 0x01, 0x31, 0xe2, 0x20, 0x06, 0x06, 0x1c, 0x40, + 0xe3, 0x00, 0x01, 0x6d, 0x50, 0x0c, 0x59, 0x40, 0x1e, 0xca, 0x43, 0x02, + 0x33, 0xe1, 0xd1, 0x4d, 0xc0, 0x51, 0x5a, 0x43, 0x47, 0xda, 0x5e, 0x66, + 0xa1, 0x2d, 0x0b, 0x08, 0x2a, 0xd0, 0x4e, 0x46, 0x1e, 0x41, 0x60, 0x50, + 0x48, 0x20, 0x08, 0x81, 0x84, 0x57, 0x12, 0x92, 0x9b, 0x5b, 0xf5, 0xcd, + 0x1f, 0x9c, 0xd2, 0xe2, 0x7a, 0x11, 0xed, 0xf6, 0x8f, 0x11, 0xeb, 0xb7, + 0xd6, 0x5d, 0x21, 0xe1, 0xd4, 0xa9, 0xbd, 0xcf, 0xad, 0xfd, 0x9d, 0x7d, + 0xf6, 0x39, 0x05, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, + 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, + 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, + 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, + 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, + 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xfc, 0x7f, 0x43, 0xfc, 0xc4, 0x7d, + 0xa9, 0xf2, 0xa7, 0x2e, 0x3f, 0xf4, 0xd1, 0x4e, 0xf5, 0x6a, 0xa7, 0xc9, + 0x9f, 0xdf, 0x87, 0x0a, 0x40, 0x91, 0xfd, 0x69, 0x37, 0xe9, 0xd7, 0x6c, + 0x83, 0x22, 0x7f, 0xd7, 0x01, 0x78, 0x7e, 0x40, 0xdf, 0xaa, 0xa9, 0xbd, + 0xfe, 0x03, 0xec, 0x51, 0xe4, 0xe7, 0x56, 0xbe, 0x9a, 0xdb, 0x19, 0x50, + 0x7e, 0x7c, 0x5d, 0x23, 0xbc, 0xec, 0xd1, 0x6e, 0xe2, 0xaf, 0x30, 0xf5, + 0xed, 0x8b, 0x5b, 0xd9, 0x64, 0xfb, 0x11, 0xe3, 0x6f, 0xfe, 0xbe, 0x28, + 0xc7, 0x53, 0xb7, 0x42, 0xe7, 0xf6, 0x40, 0xfd, 0xa9, 0x82, 0xdf, 0x6e, + 0xb7, 0x07, 0xe8, 0xba, 0xde, 0x05, 0x40, 0x4f, 0x00, 0x54, 0x14, 0xa5, + 0x9d, 0xa4, 0x66, 0x7e, 0xf0, 0x14, 0x45, 0x09, 0x20, 0xd9, 0x19, 0x40, + 0x6f, 0x00, 0x7d, 0x01, 0x38, 0x65, 0x5b, 0x92, 0xf4, 0x19, 0xa8, 0x8a, + 0xa2, 0x38, 0x49, 0x86, 0x03, 0x88, 0x06, 0xa0, 0xda, 0xed, 0x76, 0x8f, + 0xae, 0xeb, 0x1d, 0x3e, 0xda, 0xf9, 0x91, 0x0c, 0x05, 0xd0, 0x15, 0x40, + 0x02, 0x80, 0x48, 0x00, 0x14, 0x42, 0x28, 0x37, 0x79, 0x68, 0x55, 0x21, + 0x44, 0x30, 0x00, 0xc3, 0x9e, 0xde, 0x00, 0xec, 0x00, 0x84, 0xa2, 0x28, + 0xba, 0x97, 0xed, 0xdf, 0x3a, 0x2a, 0x84, 0x1d, 0x40, 0xa8, 0xbc, 0x2e, + 0x1c, 0x80, 0x6e, 0xb7, 0xdb, 0x85, 0xb7, 0x4d, 0xaa, 0xaa, 0xfa, 0x91, + 0x0c, 0x94, 0x76, 0x74, 0x01, 0x10, 0x26, 0x3f, 0xc1, 0x00, 0xe8, 0xe7, + 0xe7, 0xa7, 0x6a, 0x9a, 0x66, 0xbe, 0xc6, 0x26, 0x84, 0x08, 0x01, 0x10, + 0x01, 0x60, 0x20, 0x80, 0xbb, 0x01, 0xe8, 0x0e, 0x87, 0x43, 0x68, 0x9a, + 0x66, 0x08, 0x01, 0x84, 0x10, 0x2a, 0x80, 0x40, 0x00, 0x9d, 0x00, 0x74, + 0x93, 0x36, 0x84, 0x99, 0x3e, 0x21, 0x00, 0x84, 0xd3, 0xe9, 0x54, 0x3c, + 0x1e, 0x8f, 0xc7, 0x24, 0x02, 0x8a, 0x10, 0x22, 0x50, 0xb6, 0xbf, 0x0b, + 0xc0, 0x3d, 0x72, 0xfc, 0x0d, 0x7f, 0xbd, 0xc7, 0x5f, 0x11, 0x42, 0x04, + 0xc9, 0xf6, 0x7d, 0x01, 0xc4, 0x1b, 0x62, 0xf6, 0x7d, 0xe3, 0x63, 0xf1, + 0xf3, 0xc2, 0xf6, 0x53, 0x09, 0x49, 0x47, 0x47, 0x47, 0xd0, 0x43, 0x0f, + 0x3d, 0xb4, 0x63, 0xe6, 0xcc, 0x99, 0x3d, 0x47, 0x8d, 0x1a, 0xb5, 0xd1, + 0xed, 0x76, 0xff, 0xeb, 0x8d, 0x71, 0x23, 0x02, 0x75, 0x5d, 0x8f, 0x4d, + 0x49, 0x49, 0x59, 0x9b, 0x9d, 0x9d, 0x7d, 0x6f, 0x97, 0x2e, 0x5d, 0x70, + 0xf2, 0xe4, 0x49, 0xcc, 0x9f, 0x3f, 0xff, 0xe3, 0x86, 0x86, 0x86, 0x09, + 0xaa, 0xaa, 0x9e, 0xd5, 0x34, 0xad, 0xd5, 0x6b, 0x26, 0xf4, 0xd3, 0x75, + 0x3d, 0x22, 0x2a, 0x2a, 0x6a, 0xf5, 0xda, 0xb5, 0x6b, 0x47, 0x95, 0x94, + 0x94, 0x7c, 0xb5, 0x6d, 0xdb, 0xb6, 0x01, 0x00, 0xae, 0x99, 0x67, 0x37, + 0x21, 0x84, 0x43, 0xd7, 0xf5, 0x30, 0x55, 0x55, 0xe7, 0x15, 0x14, 0x14, + 0x4c, 0x8b, 0x8d, 0x8d, 0x45, 0x73, 0x73, 0x33, 0x76, 0xef, 0xde, 0xdd, + 0x58, 0x52, 0x52, 0x92, 0xaf, 0x28, 0xca, 0x66, 0x5d, 0xd7, 0x9b, 0x00, + 0x18, 0x01, 0x27, 0x14, 0x45, 0x09, 0xd6, 0x75, 0xfd, 0x9f, 0x32, 0x33, + 0x33, 0x57, 0x67, 0x66, 0x66, 0x46, 0x87, 0x84, 0x84, 0xe0, 0xe4, 0xc9, + 0x93, 0x98, 0x39, 0x73, 0xe6, 0x5f, 0xdb, 0xdb, 0xdb, 0xa7, 0xda, 0x6c, + 0xb6, 0xb3, 0x1e, 0x8f, 0xa7, 0xd5, 0x3b, 0x28, 0x48, 0x86, 0x00, 0x18, + 0x53, 0x58, 0x58, 0xf8, 0x1f, 0xa1, 0xa1, 0xa1, 0xa8, 0xa8, 0xa8, 0x38, + 0x5d, 0x59, 0x59, 0x79, 0xaf, 0x97, 0x4d, 0x42, 0xd3, 0x34, 0x57, 0x42, + 0x42, 0xc2, 0xc6, 0x89, 0x13, 0x27, 0x3e, 0xe4, 0x76, 0xbb, 0x75, 0x21, + 0x04, 0xe5, 0x7d, 0x79, 0xe0, 0xc0, 0x01, 0x65, 0xd3, 0xa6, 0x4d, 0x3d, + 0xe4, 0x35, 0x1e, 0xe9, 0x6b, 0x28, 0xc9, 0x11, 0x39, 0x39, 0x39, 0x6b, + 0xd2, 0xd2, 0xd2, 0x02, 0xec, 0x76, 0x3b, 0xf6, 0xec, 0xd9, 0xc3, 0xb9, + 0x73, 0xe7, 0xbe, 0xa6, 0x28, 0xca, 0x52, 0x92, 0x17, 0x48, 0x76, 0x90, + 0x54, 0x01, 0xa4, 0xbc, 0xf2, 0xca, 0x2b, 0xef, 0xba, 0x5c, 0xae, 0x0e, + 0x92, 0xc2, 0x4b, 0x08, 0x59, 0x57, 0x57, 0x67, 0x2f, 0x29, 0x29, 0x49, + 0x04, 0x50, 0x23, 0x85, 0x4f, 0xb1, 0xd9, 0x6c, 0x21, 0x1e, 0x8f, 0x67, + 0x50, 0x7a, 0x7a, 0xfa, 0xea, 0xcc, 0xcc, 0xcc, 0xbb, 0xc2, 0xc2, 0xc2, + 0x50, 0x5f, 0x5f, 0x8f, 0x17, 0x5f, 0x7c, 0xf1, 0xe3, 0xc6, 0xc6, 0xc6, + 0x89, 0x36, 0x9b, 0xed, 0x6b, 0x8f, 0xc7, 0xd3, 0x62, 0x12, 0xeb, 0x4e, + 0xba, 0xae, 0x0f, 0xc8, 0xc8, 0xc8, 0xf8, 0xcf, 0xac, 0xac, 0xac, 0x98, + 0xa8, 0xa8, 0x28, 0x1c, 0x3e, 0x7c, 0x18, 0x33, 0x66, 0xcc, 0xd8, 0xea, + 0xf1, 0x78, 0x72, 0x54, 0x55, 0x3d, 0x6f, 0xfa, 0xbe, 0x2c, 0x7e, 0xe1, + 0x04, 0x01, 0x18, 0xbb, 0x73, 0xe7, 0x4e, 0x56, 0x55, 0x55, 0x11, 0x40, + 0x1a, 0x00, 0x97, 0xe9, 0xff, 0xed, 0x00, 0x7a, 0x0e, 0x1c, 0x38, 0xf0, + 0x6b, 0x4a, 0x76, 0xee, 0xdc, 0x69, 0xfc, 0x93, 0xbd, 0x7b, 0xf7, 0xfe, + 0x40, 0xce, 0xdc, 0x8a, 0x9c, 0x3d, 0x9d, 0xf2, 0xf7, 0x91, 0x00, 0x4a, + 0xb7, 0x6c, 0xd9, 0x42, 0x92, 0x7c, 0xee, 0xb9, 0xe7, 0xea, 0x64, 0x26, + 0xa0, 0x78, 0xa5, 0xc3, 0x61, 0x00, 0x0a, 0xcf, 0x9c, 0x39, 0x43, 0x92, + 0xac, 0xaf, 0xaf, 0x67, 0x53, 0x53, 0x13, 0x49, 0xf2, 0xa3, 0x8f, 0x3e, + 0x22, 0x80, 0x69, 0xc6, 0xcc, 0x28, 0x05, 0xc3, 0x09, 0xe0, 0xd7, 0x63, + 0xc7, 0x8e, 0xf5, 0x90, 0xe4, 0xc5, 0x8b, 0x17, 0xb9, 0x77, 0xef, 0x5e, + 0x92, 0xa4, 0xc7, 0xe3, 0x61, 0xff, 0xfe, 0xfd, 0x77, 0x03, 0x88, 0xf2, + 0xce, 0x90, 0x14, 0x45, 0xf1, 0x07, 0xd0, 0x7f, 0xce, 0x9c, 0x39, 0xed, + 0x86, 0xed, 0x73, 0xe6, 0xcc, 0x39, 0xe7, 0xc3, 0x26, 0x15, 0x40, 0x8f, + 0x59, 0xb3, 0x66, 0x9d, 0xa3, 0x0f, 0xde, 0x7a, 0xeb, 0x2d, 0x9a, 0x32, + 0x0e, 0x63, 0xfc, 0x1e, 0x5e, 0xbc, 0x78, 0x31, 0x49, 0xf2, 0xc8, 0x91, + 0x23, 0xdf, 0xd8, 0x73, 0xec, 0xd8, 0x31, 0x02, 0x98, 0x29, 0xdb, 0x40, + 0xce, 0xda, 0xd3, 0xae, 0x5d, 0xbb, 0xc6, 0x9b, 0x51, 0x5d, 0x5d, 0x4d, + 0x00, 0xa3, 0x00, 0x38, 0x0c, 0x81, 0x04, 0x10, 0x3f, 0x63, 0xc6, 0x8c, + 0x76, 0x92, 0xec, 0xe8, 0xe8, 0xe0, 0xc7, 0x1f, 0x7f, 0xfc, 0x4d, 0xfb, + 0xfb, 0xef, 0xbf, 0xff, 0x6f, 0x72, 0xbc, 0x55, 0xe9, 0xa7, 0x0b, 0xc0, + 0xc0, 0xc7, 0x1e, 0x7b, 0xcc, 0x63, 0xb4, 0x31, 0xec, 0xb9, 0x72, 0xe5, + 0x0a, 0xa3, 0xa3, 0xa3, 0xff, 0xe2, 0x6b, 0x7c, 0x2c, 0x7e, 0x99, 0x28, + 0x00, 0xba, 0x85, 0x86, 0x86, 0x6e, 0x21, 0xc9, 0x09, 0x13, 0x26, 0x9c, + 0x92, 0x29, 0xa6, 0xdd, 0xd4, 0x26, 0x10, 0xc0, 0xd4, 0x9a, 0x9a, 0x1a, + 0x92, 0x64, 0x48, 0x48, 0xc8, 0x61, 0x00, 0x73, 0x87, 0x0f, 0x1f, 0xde, + 0x40, 0x92, 0x1b, 0x37, 0x6e, 0x24, 0x80, 0xa1, 0x32, 0x30, 0x01, 0xc0, + 0x15, 0x13, 0x13, 0xb3, 0x65, 0xd7, 0xae, 0x5d, 0x6c, 0x69, 0x69, 0x21, + 0x49, 0x9d, 0x24, 0xa7, 0x4f, 0x9f, 0x7e, 0x1a, 0xc0, 0xaf, 0x7c, 0x04, + 0x5b, 0xf4, 0xbc, 0x79, 0xf3, 0xae, 0x90, 0xe4, 0x4b, 0x2f, 0xbd, 0xa4, + 0x03, 0x58, 0x0a, 0x60, 0xc3, 0xd6, 0xad, 0x5b, 0x49, 0x92, 0x4f, 0x3d, + 0xf5, 0xd4, 0x49, 0x00, 0x77, 0x98, 0xae, 0x0b, 0x04, 0xb0, 0x84, 0x24, + 0x8f, 0x1f, 0x3f, 0x4e, 0x00, 0xef, 0x00, 0xf8, 0xdd, 0xe3, 0x8f, 0x3f, + 0xde, 0x46, 0x92, 0x6f, 0xbc, 0xf1, 0x06, 0x65, 0x1a, 0xee, 0xf0, 0xba, + 0xcf, 0x9d, 0xc1, 0xc1, 0xc1, 0x5b, 0x48, 0x72, 0xfd, 0xfa, 0xf5, 0x3a, + 0x49, 0xce, 0x9a, 0x35, 0xeb, 0x3c, 0x80, 0x5e, 0x5e, 0xc1, 0x60, 0x07, + 0xd0, 0xf7, 0xd5, 0x57, 0x5f, 0x25, 0x49, 0x02, 0xf8, 0x0c, 0xc0, 0x46, + 0x21, 0xc4, 0x3a, 0x00, 0xab, 0x5c, 0x2e, 0x57, 0x81, 0x14, 0x2d, 0xa3, + 0x5e, 0xd1, 0x6d, 0xf0, 0xe0, 0xc1, 0x7b, 0x48, 0xb2, 0xa2, 0xa2, 0x82, + 0x00, 0x96, 0x01, 0xc8, 0x2f, 0x2a, 0x2a, 0x62, 0x43, 0x43, 0x03, 0xb3, + 0xb2, 0xb2, 0xbe, 0x30, 0x09, 0xaa, 0xa3, 0x53, 0xa7, 0x4e, 0xf7, 0x87, + 0x86, 0x86, 0xbe, 0x19, 0x19, 0x19, 0xf9, 0x76, 0x64, 0x64, 0xe4, 0x96, + 0x88, 0x88, 0x88, 0xbf, 0x38, 0x1c, 0x8e, 0x4f, 0x66, 0xce, 0x9c, 0xa9, + 0x91, 0x64, 0x66, 0x66, 0xe6, 0x69, 0x99, 0xb6, 0x1b, 0x19, 0x5e, 0x00, + 0x80, 0xf9, 0xcd, 0xcd, 0xcd, 0x6c, 0x6b, 0x6b, 0x23, 0x80, 0xdd, 0x00, + 0xe6, 0x24, 0x26, 0x26, 0xd6, 0x92, 0x64, 0x79, 0x79, 0x39, 0x01, 0xdc, + 0x6f, 0xf2, 0xb7, 0xb3, 0xcd, 0x66, 0x5b, 0x4b, 0x92, 0x4d, 0x4d, 0x4d, + 0x04, 0x50, 0x05, 0x60, 0x56, 0xdf, 0xbe, 0x7d, 0x4f, 0x93, 0xe4, 0xdb, + 0x6f, 0xbf, 0x4d, 0x00, 0x0f, 0x08, 0x21, 0x5c, 0xd6, 0xe3, 0x6f, 0xe1, + 0x07, 0x20, 0x3e, 0x3f, 0x3f, 0xdf, 0x2d, 0x1f, 0xf6, 0x65, 0x72, 0x1d, + 0x6b, 0x4e, 0x4d, 0x23, 0xfc, 0xfd, 0xfd, 0x37, 0x91, 0xe4, 0x9e, 0x3d, + 0x7b, 0x08, 0x60, 0xaa, 0x5c, 0x53, 0xae, 0xd2, 0x34, 0x8d, 0x8d, 0x8d, + 0x8d, 0x04, 0x30, 0xdf, 0x34, 0xcb, 0xb9, 0x62, 0x62, 0x62, 0x36, 0x94, + 0x94, 0x94, 0xe8, 0x4b, 0x96, 0x2c, 0xe9, 0xf8, 0xe4, 0x93, 0x4f, 0x34, + 0x93, 0x00, 0xc4, 0x78, 0x09, 0x80, 0x0d, 0xc0, 0x3d, 0x1b, 0x36, 0x6c, + 0x20, 0x49, 0x46, 0x45, 0x45, 0xbd, 0x0b, 0x20, 0x16, 0xc0, 0xb0, 0x29, + 0x53, 0xa6, 0x34, 0x90, 0xe4, 0x8a, 0x15, 0x2b, 0x28, 0x83, 0xd4, 0x08, + 0x08, 0x67, 0x44, 0x44, 0xc4, 0xc6, 0xb2, 0xb2, 0x32, 0x66, 0x65, 0x65, + 0x11, 0xc0, 0xbd, 0x00, 0x1e, 0x08, 0x0f, 0x0f, 0xdf, 0x4e, 0x92, 0xdb, + 0xb6, 0x6d, 0x23, 0x80, 0xdf, 0x78, 0x09, 0x40, 0x27, 0x00, 0x99, 0x95, + 0x95, 0x95, 0x5c, 0xb3, 0x66, 0x8d, 0x67, 0xf2, 0xe4, 0xc9, 0x17, 0x49, + 0x72, 0xf6, 0xec, 0xd9, 0xbe, 0x04, 0xc0, 0x09, 0x20, 0x65, 0xf3, 0xe6, + 0xcd, 0x3c, 0x70, 0xe0, 0x00, 0x01, 0x14, 0x03, 0x78, 0x06, 0x40, 0xba, + 0xbc, 0x57, 0x94, 0x49, 0xec, 0x1c, 0x00, 0xee, 0x5d, 0xb9, 0x72, 0x25, + 0x49, 0x32, 0x21, 0x21, 0xa1, 0x1a, 0xc0, 0x63, 0x00, 0xc6, 0x02, 0x98, + 0x02, 0x60, 0x06, 0x80, 0x24, 0xbb, 0xdd, 0xee, 0x6f, 0xac, 0xa5, 0x64, + 0xff, 0x21, 0xb2, 0xb6, 0x10, 0x0d, 0x60, 0x48, 0x42, 0x42, 0xc2, 0x21, + 0x92, 0x5c, 0xbe, 0x7c, 0x39, 0x01, 0xa4, 0xaa, 0xaa, 0x1a, 0x62, 0xfa, + 0x0e, 0x02, 0x00, 0x2c, 0x32, 0x8d, 0xff, 0x7c, 0x99, 0xa5, 0x55, 0x90, + 0x64, 0x65, 0x65, 0x25, 0x01, 0x3c, 0x68, 0xf2, 0x37, 0x2a, 0x23, 0x23, + 0xa3, 0x9a, 0x24, 0x57, 0xad, 0x5a, 0x45, 0x00, 0x23, 0x00, 0xf4, 0x01, + 0x30, 0xf7, 0xc8, 0x91, 0x23, 0x74, 0xbb, 0xdd, 0x04, 0x50, 0x20, 0x6d, + 0xb0, 0xf8, 0x85, 0x13, 0x0a, 0x60, 0x6e, 0x7d, 0x7d, 0x3d, 0xd7, 0xad, + 0x5b, 0x67, 0xcc, 0xe4, 0xde, 0x33, 0x43, 0xd7, 0xa4, 0xa4, 0xa4, 0x2a, + 0x92, 0xdc, 0xb4, 0x69, 0x13, 0x01, 0xa4, 0xc8, 0xe2, 0x58, 0xce, 0x89, + 0x13, 0x27, 0x48, 0x92, 0x8a, 0xa2, 0xac, 0x95, 0x05, 0x27, 0xa8, 0xaa, + 0xea, 0x90, 0x0f, 0x57, 0x2f, 0x00, 0xe9, 0xc6, 0x4c, 0x7a, 0x13, 0x01, + 0x50, 0x00, 0x84, 0xb9, 0x5c, 0xae, 0x17, 0x01, 0xbc, 0x1c, 0x1c, 0x1c, + 0x3c, 0x42, 0x16, 0xc7, 0x7e, 0xbb, 0x64, 0xc9, 0x12, 0x8d, 0x24, 0x17, + 0x2d, 0x5a, 0xd4, 0x26, 0x8b, 0x93, 0x46, 0x8a, 0xeb, 0x90, 0x01, 0xdd, + 0x03, 0xc0, 0x5d, 0x42, 0x88, 0x2c, 0x00, 0xeb, 0x0a, 0x0b, 0x0b, 0x49, + 0x92, 0x63, 0xc6, 0x8c, 0x39, 0x2f, 0x33, 0x0d, 0x9b, 0x0c, 0x3a, 0x3f, + 0x00, 0x31, 0x23, 0x46, 0x8c, 0xf8, 0x5f, 0x29, 0x72, 0x15, 0xb9, 0xb9, + 0xb9, 0x8d, 0x26, 0x01, 0xb8, 0xcb, 0xcb, 0x26, 0x7f, 0x00, 0xe3, 0xab, + 0xab, 0xab, 0x59, 0x56, 0x56, 0xd6, 0xb1, 0x60, 0xc1, 0x82, 0x8e, 0xbd, + 0x7b, 0xf7, 0xb2, 0xa2, 0xa2, 0x82, 0x83, 0x07, 0x0f, 0x3e, 0x0e, 0x20, + 0x49, 0x06, 0xa8, 0x21, 0x16, 0xe9, 0xdb, 0xb7, 0x6f, 0x37, 0xb2, 0x85, + 0xfa, 0xd2, 0xd2, 0x52, 0xbd, 0xbc, 0xbc, 0x9c, 0x05, 0x05, 0x05, 0xed, + 0x32, 0x9b, 0xe9, 0x61, 0x12, 0x0c, 0xef, 0xec, 0x2b, 0x02, 0x40, 0xde, + 0xa9, 0x53, 0xa7, 0x78, 0xf6, 0xec, 0x59, 0x02, 0x28, 0x34, 0xa7, 0xf3, + 0xa6, 0x25, 0xcf, 0x83, 0xcb, 0x97, 0x2f, 0x27, 0x49, 0x26, 0x27, 0x27, + 0x37, 0x01, 0x78, 0x7f, 0xe9, 0xd2, 0xa5, 0x6e, 0x92, 0x4c, 0x4b, 0x4b, + 0xab, 0x97, 0xe3, 0x63, 0x08, 0x64, 0xd7, 0x09, 0x13, 0x26, 0xd4, 0x90, + 0xe4, 0xeb, 0xaf, 0xbf, 0x4e, 0x00, 0xa9, 0x32, 0xa3, 0xf8, 0xdd, 0xb1, + 0x63, 0xc7, 0x48, 0x92, 0x01, 0x01, 0x01, 0x6f, 0xc8, 0x7b, 0x5b, 0xfc, + 0xc2, 0x77, 0x11, 0x7a, 0x0c, 0x19, 0x32, 0x64, 0x2f, 0x49, 0xf6, 0xeb, + 0xd7, 0x6f, 0xb7, 0x51, 0xad, 0xf7, 0x5a, 0xa3, 0xdf, 0x39, 0x66, 0xcc, + 0x98, 0xfd, 0x24, 0x59, 0x5a, 0x5a, 0x4a, 0x00, 0x83, 0x64, 0x0a, 0x9c, + 0x7d, 0xe8, 0xd0, 0x21, 0x63, 0x59, 0xb0, 0x41, 0x8a, 0x82, 0xf9, 0xe1, + 0xf6, 0x07, 0xd0, 0x6f, 0xd9, 0xb2, 0x65, 0xdf, 0x27, 0x00, 0x42, 0x55, + 0x55, 0x9b, 0x4c, 0x91, 0x43, 0x64, 0xf0, 0x27, 0x0d, 0x1d, 0x3a, 0xb4, + 0x96, 0x24, 0x75, 0x5d, 0x67, 0x58, 0x58, 0xd8, 0x66, 0x1f, 0x59, 0x89, + 0x22, 0x67, 0xbc, 0xd0, 0xe9, 0xd3, 0xa7, 0x5f, 0x31, 0xd6, 0xba, 0x79, + 0x79, 0x79, 0x04, 0xb0, 0xd2, 0x66, 0xb3, 0xdd, 0x85, 0x6f, 0xb7, 0xbf, + 0x22, 0x01, 0x2c, 0xbc, 0x7c, 0xf9, 0x32, 0x9f, 0x7d, 0xf6, 0xd9, 0x26, + 0x00, 0x8f, 0xe5, 0xe6, 0xe6, 0x5e, 0x30, 0x2d, 0x01, 0xee, 0xf1, 0x2a, + 0xa8, 0x06, 0x00, 0xc8, 0xbd, 0x74, 0xe9, 0x12, 0x49, 0xb2, 0xb6, 0xb6, + 0x96, 0x95, 0x95, 0x95, 0xdf, 0xac, 0xb9, 0xc7, 0x8f, 0x1f, 0x7f, 0x19, + 0x40, 0x6f, 0xb9, 0x36, 0x77, 0x01, 0x78, 0xea, 0xe0, 0xc1, 0x83, 0x24, + 0xa9, 0xb7, 0xb7, 0xb7, 0xf3, 0xe8, 0xd1, 0xa3, 0xac, 0xad, 0xad, 0x35, + 0xd7, 0x00, 0x16, 0xca, 0x5d, 0x07, 0xef, 0x1d, 0x09, 0x27, 0x80, 0xc4, + 0xf9, 0xf3, 0xe7, 0xbb, 0x49, 0x32, 0x3d, 0x3d, 0xbd, 0x0e, 0xc0, 0xdd, + 0x52, 0xb0, 0x6e, 0xc8, 0xd2, 0x84, 0x10, 0x09, 0x00, 0x76, 0x9c, 0x3f, + 0x7f, 0xfe, 0x86, 0x7a, 0x81, 0x0c, 0xf0, 0x65, 0x26, 0x7f, 0x01, 0x20, + 0x3c, 0x22, 0x22, 0xa2, 0x9c, 0x24, 0x1b, 0x1b, 0x1b, 0x69, 0xb3, 0xd9, + 0x3e, 0x03, 0xb0, 0xe8, 0xbe, 0xfb, 0xee, 0xfb, 0xe6, 0xe2, 0x9e, 0x3d, + 0x7b, 0x6e, 0x95, 0x19, 0x88, 0xc5, 0x2f, 0x15, 0x21, 0x84, 0x3f, 0x80, + 0xa4, 0xb2, 0xb2, 0x32, 0x9e, 0x38, 0x71, 0xc2, 0x28, 0x56, 0x75, 0xf2, + 0x6e, 0x06, 0xe0, 0xce, 0x47, 0x1f, 0x7d, 0xf4, 0x73, 0x92, 0x5c, 0xb3, + 0x66, 0x0d, 0x01, 0x0c, 0x96, 0x02, 0x30, 0xc9, 0xa8, 0x0b, 0x04, 0x05, + 0x05, 0x79, 0x0b, 0x80, 0xb1, 0x96, 0xbe, 0xf7, 0x16, 0x02, 0x00, 0x53, + 0xa1, 0x2b, 0x0a, 0xc0, 0xd3, 0xd3, 0xa7, 0x4f, 0x6f, 0x31, 0x1e, 0xd4, + 0xb8, 0xb8, 0xb8, 0xaf, 0x01, 0xf4, 0x96, 0x05, 0x3c, 0x73, 0xf0, 0xdb, + 0xe5, 0xec, 0xdb, 0x79, 0xe4, 0xc8, 0x91, 0x15, 0xb3, 0x67, 0xcf, 0xbe, + 0x68, 0xcc, 0x6e, 0xf9, 0xf9, 0xf9, 0x04, 0xf0, 0x80, 0x0c, 0x1c, 0x07, + 0x80, 0xfe, 0x0b, 0x17, 0x2e, 0xf4, 0xd4, 0xd5, 0xd5, 0x11, 0x40, 0x09, + 0x80, 0x09, 0xcf, 0x3f, 0xff, 0x7c, 0x93, 0x2c, 0x4c, 0x36, 0x01, 0xe8, + 0xe7, 0x70, 0x38, 0xcc, 0x7e, 0xfb, 0x05, 0x04, 0x04, 0x4c, 0xcb, 0xcf, + 0xcf, 0xbf, 0x94, 0x9b, 0x9b, 0xdb, 0x06, 0xe0, 0x25, 0x00, 0x53, 0x12, + 0x13, 0x13, 0xcf, 0x99, 0xd6, 0xd5, 0x2f, 0x4a, 0xa1, 0xf0, 0x07, 0x30, + 0xf1, 0xf0, 0xe1, 0xc3, 0x94, 0x82, 0x72, 0x15, 0x40, 0x11, 0x80, 0x15, + 0x6f, 0xbe, 0xf9, 0x26, 0x49, 0xf2, 0x85, 0x17, 0x5e, 0x68, 0x96, 0x33, + 0xb4, 0x77, 0xf1, 0x33, 0x02, 0xc0, 0x6a, 0xa3, 0x70, 0x08, 0x60, 0xb6, + 0x14, 0x0a, 0xef, 0xf3, 0x1d, 0x21, 0x00, 0x72, 0x8d, 0x2c, 0x63, 0xca, + 0x94, 0x29, 0x9e, 0xe4, 0xe4, 0xe4, 0xfd, 0x9b, 0x37, 0x6f, 0x36, 0xfb, + 0x3b, 0x4c, 0x0a, 0x8a, 0x21, 0xbc, 0x29, 0x79, 0x79, 0x79, 0xdf, 0x08, + 0xc5, 0xe9, 0xd3, 0xa7, 0x49, 0x92, 0x47, 0x8f, 0x1e, 0xd5, 0x49, 0xb2, + 0x5b, 0xb7, 0x6e, 0x5b, 0x2c, 0x01, 0xb8, 0x3d, 0xb1, 0xc9, 0x07, 0x20, + 0x14, 0x40, 0xa0, 0xa2, 0x28, 0x7e, 0xf0, 0x7d, 0x60, 0xc8, 0x98, 0x19, + 0x57, 0x92, 0xe4, 0xcb, 0x2f, 0xbf, 0xdc, 0x26, 0xd3, 0x44, 0x87, 0x8f, + 0xb6, 0x5d, 0x87, 0x0c, 0x19, 0xb2, 0xc3, 0x54, 0x01, 0x1f, 0x21, 0x83, + 0x75, 0x76, 0x5d, 0x5d, 0x1d, 0x49, 0x52, 0x08, 0x51, 0x2a, 0x45, 0xc1, + 0x8c, 0xe3, 0x07, 0x0a, 0x80, 0x5d, 0xa6, 0xbd, 0x0b, 0xde, 0x7b, 0xef, + 0x3d, 0x92, 0xe4, 0x17, 0x5f, 0x7c, 0xc1, 0xe8, 0xe8, 0xe8, 0xed, 0x00, + 0xe2, 0x55, 0x55, 0x0d, 0x36, 0xfb, 0xe0, 0x74, 0x3a, 0x03, 0x00, 0xfc, + 0x5a, 0xae, 0xc9, 0x87, 0xca, 0xe0, 0x1a, 0x00, 0xe0, 0x43, 0x5d, 0xd7, + 0x8d, 0x54, 0x7c, 0xa9, 0xac, 0x49, 0xb8, 0x00, 0xcc, 0x6e, 0x69, 0x69, + 0x61, 0x79, 0x79, 0xb9, 0x5e, 0x54, 0x54, 0xd4, 0x56, 0x50, 0x50, 0xe0, + 0x7e, 0xff, 0xfd, 0xf7, 0x75, 0x63, 0xfd, 0x9c, 0x9d, 0x9d, 0x4d, 0x5c, + 0xdf, 0xb7, 0x87, 0x5c, 0xc2, 0xf8, 0x4b, 0x7b, 0xe2, 0x01, 0xc4, 0x2a, + 0x8a, 0xd2, 0x43, 0xda, 0x5d, 0x74, 0xe1, 0xc2, 0x05, 0x63, 0xc9, 0x53, + 0x2a, 0xc5, 0xd2, 0x05, 0x60, 0x4c, 0x55, 0x55, 0x95, 0x71, 0xdf, 0x72, + 0x79, 0xdd, 0x80, 0xd4, 0xd4, 0xd4, 0x43, 0xa6, 0x65, 0xd3, 0x40, 0xaf, + 0x2c, 0xc3, 0x0e, 0xa0, 0x77, 0x6e, 0x6e, 0x6e, 0xb3, 0x14, 0x89, 0x56, + 0x39, 0xfe, 0x7e, 0x3e, 0xc6, 0x3f, 0x2a, 0x3d, 0x3d, 0xbd, 0xda, 0xd4, + 0xd7, 0x54, 0x00, 0xc3, 0x01, 0xac, 0xbf, 0x78, 0xf1, 0x22, 0x4d, 0xb5, + 0x9b, 0x60, 0xd9, 0xaf, 0x5d, 0x08, 0xd1, 0x15, 0xc0, 0xb8, 0x07, 0x1f, + 0x7c, 0xf0, 0x60, 0x69, 0x69, 0x29, 0x57, 0xaf, 0x5e, 0x4d, 0x87, 0xc3, + 0x71, 0xd8, 0xb0, 0x53, 0x16, 0x34, 0xc3, 0xac, 0x70, 0xf9, 0xf9, 0x57, + 0xf0, 0xbd, 0x71, 0x02, 0x98, 0xde, 0xbd, 0x7b, 0xf7, 0x95, 0x11, 0x11, + 0x11, 0xa5, 0xba, 0xae, 0x87, 0xc1, 0xf7, 0x76, 0x8f, 0x0d, 0x40, 0xd0, + 0xa4, 0x49, 0x93, 0x32, 0x01, 0xe0, 0xb5, 0xd7, 0x5e, 0xab, 0x00, 0x70, + 0x11, 0xdf, 0xee, 0xb5, 0x9b, 0xe9, 0xa8, 0xae, 0xae, 0x3e, 0x01, 0x00, + 0x71, 0x71, 0x71, 0x90, 0x0f, 0x78, 0x37, 0x00, 0x7d, 0xba, 0x77, 0xef, + 0x8e, 0xb3, 0x67, 0xcf, 0x82, 0xe4, 0x97, 0x00, 0xdc, 0x7f, 0x4f, 0x22, + 0x22, 0xab, 0xfa, 0xe9, 0x9b, 0x36, 0x6d, 0x7a, 0xe5, 0xe1, 0x87, 0x1f, + 0xc6, 0x8a, 0x15, 0x2b, 0x10, 0x1b, 0x1b, 0xbb, 0xaa, 0xae, 0xae, 0x6e, + 0x01, 0x80, 0x36, 0x4d, 0xd3, 0x84, 0xaa, 0xaa, 0x46, 0x60, 0x88, 0xb6, + 0xb6, 0x36, 0xe5, 0xe9, 0xa7, 0x9f, 0x7e, 0xef, 0xd8, 0xb1, 0x63, 0xef, + 0xe6, 0xe4, 0xe4, 0xec, 0x96, 0x82, 0xd7, 0x01, 0xe0, 0xe0, 0xf9, 0xf3, + 0xe7, 0x8d, 0x8c, 0xc2, 0x85, 0x6f, 0x4f, 0x1f, 0xb6, 0xd5, 0xd6, 0xd6, + 0x62, 0xf8, 0xf0, 0xe1, 0x62, 0xe2, 0xc4, 0x89, 0x7e, 0xd9, 0xd9, 0xd9, + 0xf6, 0x51, 0xa3, 0x46, 0x09, 0x92, 0x4c, 0x4d, 0x4d, 0x45, 0x4a, 0x4a, + 0x0a, 0x4c, 0x05, 0x4c, 0x68, 0x9a, 0xc6, 0xd4, 0xd4, 0xd4, 0xe5, 0xd3, + 0xa6, 0x4d, 0xfb, 0xd3, 0xb0, 0x61, 0xc3, 0xfe, 0xa0, 0xeb, 0xba, 0x43, + 0x8a, 0x99, 0xd3, 0xe1, 0xb8, 0xae, 0x8f, 0xba, 0xae, 0xb7, 0xe2, 0xdb, + 0x93, 0x75, 0x5f, 0xd6, 0xd4, 0xd4, 0x5c, 0x8f, 0x6a, 0xbb, 0xdd, 0x4f, + 0x8e, 0xad, 0x50, 0x14, 0x45, 0x01, 0x80, 0x96, 0x96, 0x16, 0x00, 0x68, + 0xf3, 0x21, 0x8e, 0x43, 0xc7, 0x8d, 0x1b, 0x17, 0x00, 0x00, 0xeb, 0xd7, + 0xaf, 0xff, 0x10, 0xc0, 0x15, 0x1f, 0x63, 0x28, 0x00, 0x28, 0xbd, 0x7a, + 0xf5, 0xea, 0x02, 0x00, 0x17, 0x2e, 0x5c, 0x00, 0x80, 0x5a, 0xd9, 0xf6, + 0x84, 0xe1, 0xaf, 0xd3, 0xe9, 0x0c, 0x34, 0xed, 0x4a, 0x88, 0xf0, 0xf0, + 0xf0, 0x5e, 0x00, 0xe2, 0xb6, 0x6f, 0xdf, 0xfe, 0xd1, 0xd4, 0xa9, 0x53, + 0x47, 0x4f, 0x9b, 0x36, 0xed, 0x61, 0xb7, 0xdb, 0xbd, 0xaf, 0x5f, 0xbf, + 0x7e, 0xa8, 0xad, 0xad, 0x05, 0xc9, 0x83, 0x00, 0xda, 0xad, 0x10, 0xba, + 0xfd, 0x08, 0xcf, 0xce, 0xce, 0x3e, 0x40, 0x92, 0x1f, 0x7c, 0xf0, 0x81, + 0xf7, 0xf6, 0x90, 0x99, 0x20, 0x00, 0xe3, 0x77, 0xed, 0xda, 0x65, 0xb4, + 0x7b, 0x54, 0x06, 0xa2, 0x2f, 0x02, 0x00, 0xfc, 0x8b, 0xb1, 0x97, 0x1c, + 0x13, 0x13, 0x53, 0x0b, 0x60, 0x65, 0x46, 0x46, 0xc6, 0x45, 0xd3, 0xb2, + 0x60, 0x90, 0x8f, 0xd9, 0xcb, 0x01, 0x20, 0xde, 0x94, 0x01, 0x9c, 0xc2, + 0x77, 0xb7, 0x01, 0x6d, 0x00, 0xa2, 0x8d, 0x8a, 0x7f, 0x75, 0x75, 0x35, + 0x13, 0x13, 0x13, 0xcf, 0xa4, 0xa6, 0xa6, 0xd6, 0x8c, 0x1e, 0x3d, 0xfa, + 0x7f, 0xd2, 0xd2, 0xd2, 0xf6, 0x25, 0x24, 0x24, 0x6c, 0x97, 0xa9, 0xb1, + 0x21, 0x64, 0x9d, 0xbb, 0x77, 0xef, 0xfe, 0x0e, 0x49, 0xee, 0xdf, 0xbf, + 0x9f, 0x00, 0xb6, 0x01, 0x28, 0x4c, 0x4e, 0x4e, 0xbe, 0x48, 0x92, 0x9f, + 0x7f, 0xfe, 0x39, 0x01, 0x64, 0x4b, 0x61, 0xb0, 0xfb, 0xf9, 0xf9, 0xdd, + 0x01, 0xe0, 0xdf, 0xe4, 0x12, 0x67, 0x2e, 0x80, 0x82, 0xc9, 0x93, 0x27, + 0xb7, 0x92, 0x64, 0x76, 0x76, 0x76, 0x0b, 0x80, 0x7f, 0x17, 0x42, 0x84, + 0x9b, 0x53, 0xee, 0xf8, 0xf8, 0xf8, 0xad, 0x24, 0xf9, 0xe5, 0x97, 0x5f, + 0x12, 0xc0, 0x56, 0x00, 0xaf, 0xa6, 0xa5, 0xa5, 0x5d, 0x32, 0x8d, 0xeb, + 0x68, 0x39, 0xfb, 0x2b, 0x00, 0xee, 0x48, 0x4a, 0x4a, 0xfa, 0x6f, 0x92, + 0xdc, 0xb0, 0x61, 0x03, 0x01, 0xbc, 0x0e, 0xe0, 0xad, 0x1d, 0x3b, 0x76, + 0x50, 0x16, 0xe9, 0x8e, 0x00, 0xb8, 0xd3, 0xcb, 0xef, 0x70, 0x55, 0x55, + 0xd7, 0x91, 0xe4, 0xb9, 0x73, 0xe7, 0x8c, 0xca, 0x7e, 0xa7, 0x9b, 0x8c, + 0x7f, 0x44, 0x5c, 0x5c, 0xdc, 0x87, 0x24, 0xd9, 0xd0, 0xd0, 0x40, 0x55, + 0x55, 0xf7, 0x02, 0x58, 0x14, 0x17, 0x17, 0x77, 0xc6, 0xf8, 0x9b, 0xf4, + 0xcb, 0x10, 0x01, 0x3f, 0x00, 0x79, 0x2d, 0x2d, 0x2d, 0x46, 0x61, 0x71, + 0x37, 0x80, 0x65, 0x4f, 0x3c, 0xf1, 0xc4, 0x65, 0x92, 0x5c, 0xbc, 0x78, + 0xb1, 0x2e, 0x45, 0xdc, 0x61, 0x85, 0xcb, 0xed, 0x47, 0xa7, 0x94, 0x94, + 0x94, 0x9a, 0xba, 0xba, 0x3a, 0x16, 0x17, 0x17, 0x53, 0xa6, 0xc6, 0x76, + 0x1f, 0xed, 0x22, 0x23, 0x23, 0x23, 0xff, 0x48, 0x92, 0x59, 0x59, 0x59, + 0x5f, 0x99, 0xab, 0xe6, 0x37, 0xc9, 0x16, 0xba, 0x0f, 0x1b, 0x36, 0xac, + 0xc6, 0x58, 0x53, 0x9e, 0x3a, 0x75, 0x8a, 0x24, 0xd9, 0xdc, 0xdc, 0x4c, + 0x97, 0xcb, 0x65, 0xac, 0x27, 0x7d, 0xa5, 0xf6, 0xbd, 0x4a, 0x4a, 0x4a, + 0x48, 0x92, 0x39, 0x39, 0x39, 0xa7, 0x64, 0xe6, 0xa0, 0x78, 0xb5, 0x19, + 0x66, 0xac, 0x6f, 0x7d, 0x51, 0x56, 0x56, 0x46, 0x5c, 0x3f, 0x07, 0x60, + 0x37, 0x09, 0xd2, 0x08, 0xa3, 0xea, 0x6f, 0x5e, 0xe3, 0x92, 0x64, 0x7c, + 0x7c, 0xfc, 0xdf, 0x64, 0xc0, 0xd9, 0xe4, 0x24, 0x6c, 0x14, 0x19, 0x8d, + 0x23, 0xb8, 0x7d, 0xe6, 0xcd, 0x9b, 0xd7, 0x28, 0x53, 0xef, 0xf3, 0x00, + 0x62, 0x64, 0xad, 0xc0, 0x2c, 0x78, 0xbf, 0x2d, 0x2e, 0x2e, 0xa6, 0xb7, + 0xbf, 0x9a, 0xa6, 0x11, 0xc0, 0x9f, 0xbd, 0x2a, 0xf5, 0x41, 0x00, 0x1e, + 0x5d, 0xbd, 0x7a, 0x35, 0x8d, 0xc2, 0x9b, 0x71, 0xd0, 0xe7, 0x9d, 0x77, + 0xde, 0x21, 0x80, 0xa7, 0xe4, 0xb1, 0x65, 0x33, 0x61, 0x29, 0x29, 0x29, + 0x7f, 0x35, 0x1d, 0x76, 0x4a, 0xc5, 0x8d, 0x87, 0xaf, 0xcc, 0x04, 0x02, + 0x78, 0x68, 0xe9, 0xd2, 0xa5, 0xdf, 0xb1, 0x87, 0x24, 0x63, 0x63, 0x63, + 0x4f, 0x00, 0xf8, 0x95, 0xe1, 0x83, 0x2c, 0x22, 0xf6, 0x1d, 0x37, 0x6e, + 0x9c, 0xdb, 0x68, 0x63, 0xec, 0xd6, 0x48, 0x71, 0x5c, 0x20, 0x77, 0x6c, + 0x14, 0x2b, 0x5c, 0x7e, 0xe6, 0x75, 0xbc, 0xef, 0x44, 0xaa, 0xcd, 0xe6, + 0xef, 0xf1, 0x78, 0xee, 0xc6, 0xf5, 0x93, 0x6a, 0x97, 0xfd, 0xfd, 0xfd, + 0xf7, 0xb5, 0xb6, 0xb6, 0x5e, 0xc1, 0x8d, 0x67, 0xe9, 0x05, 0x80, 0xce, + 0xcf, 0x3c, 0xf3, 0xcc, 0x85, 0x49, 0x93, 0x26, 0x61, 0xd0, 0xa0, 0x41, + 0x0b, 0x01, 0x2c, 0x07, 0x70, 0x09, 0xbe, 0x5f, 0x40, 0x11, 0x36, 0x9b, + 0x2d, 0xc0, 0xe3, 0xf1, 0xdc, 0x11, 0x15, 0x15, 0xb5, 0x72, 0xd6, 0xac, + 0x59, 0xbf, 0x09, 0x0a, 0x0a, 0x52, 0xce, 0x9d, 0x3b, 0x77, 0xad, 0xb0, + 0xb0, 0xf0, 0xbf, 0x5a, 0x5b, 0x5b, 0xf3, 0x14, 0x45, 0x69, 0xd4, 0x75, + 0xfd, 0x9a, 0x8f, 0x5d, 0x86, 0xe0, 0x01, 0x03, 0x06, 0x6c, 0x8d, 0x8f, + 0x8f, 0x0f, 0xfe, 0xea, 0xab, 0xaf, 0xf6, 0x57, 0x55, 0x55, 0x3d, 0x2b, + 0xd3, 0x57, 0xb3, 0xb8, 0xf4, 0x49, 0x49, 0x49, 0xf9, 0x63, 0xd7, 0xae, + 0x5d, 0x75, 0x5d, 0xd7, 0x55, 0xb3, 0x0d, 0xaa, 0xaa, 0xea, 0x47, 0x8f, + 0x1e, 0x6d, 0xfe, 0xec, 0xb3, 0xcf, 0x46, 0x03, 0xb8, 0x2a, 0x53, 0x6e, + 0xc5, 0x66, 0xb3, 0x85, 0x7a, 0x3c, 0x9e, 0xe4, 0xe4, 0xe4, 0xe4, 0x97, + 0x32, 0x32, 0x32, 0x12, 0x5d, 0x2e, 0x17, 0x1a, 0x1a, 0x1a, 0xda, 0x8a, + 0x8a, 0x8a, 0xfe, 0x74, 0xf5, 0xea, 0xd5, 0x57, 0x54, 0x55, 0x3d, 0x23, + 0x8f, 0xba, 0xfa, 0xf2, 0x27, 0xa8, 0x4f, 0x9f, 0x3e, 0xbf, 0x1f, 0x32, + 0x64, 0xc8, 0xdd, 0xc7, 0x8f, 0x1f, 0x3f, 0x52, 0x55, 0x55, 0x35, 0x45, + 0xf6, 0x6d, 0xb4, 0x55, 0x6d, 0x36, 0x5b, 0x27, 0xd9, 0x7f, 0xde, 0xd8, + 0xb1, 0x63, 0xe3, 0x5d, 0x2e, 0x17, 0xea, 0xea, 0xea, 0x5a, 0xf3, 0xf2, + 0xf2, 0x36, 0x02, 0x58, 0x2c, 0x84, 0xb8, 0x40, 0xd2, 0xf0, 0x57, 0x55, + 0x14, 0xa5, 0xb3, 0xae, 0xeb, 0xff, 0xfc, 0xe4, 0x93, 0x4f, 0x2e, 0x4e, + 0x4e, 0x4e, 0xee, 0xa9, 0x69, 0x1a, 0x3e, 0xfd, 0xf4, 0xd3, 0xba, 0xb2, + 0xb2, 0xb2, 0x7c, 0x45, 0x51, 0xfe, 0x2c, 0x8f, 0x32, 0x9b, 0xcf, 0xeb, + 0x07, 0x74, 0xee, 0xdc, 0x79, 0xd1, 0x23, 0x8f, 0x3c, 0x92, 0x72, 0xe8, + 0xd0, 0xa1, 0xb6, 0x7d, 0xfb, 0xf6, 0x65, 0x02, 0x38, 0x0b, 0xdf, 0x2f, + 0x3f, 0xa9, 0xaa, 0xaa, 0x86, 0x6a, 0x9a, 0x96, 0x9c, 0x96, 0x96, 0xb6, + 0x70, 0xe4, 0xc8, 0x91, 0x7d, 0xfd, 0xfd, 0xfd, 0xd1, 0xd0, 0xd0, 0xd0, + 0x51, 0x5c, 0x5c, 0xfc, 0x6e, 0x53, 0x53, 0xd3, 0xcb, 0xaa, 0xaa, 0xd6, + 0x6b, 0x9a, 0xd6, 0x2c, 0x7d, 0x50, 0x54, 0x55, 0x0d, 0xd1, 0x34, 0xad, + 0x5f, 0x52, 0x52, 0x52, 0xf1, 0xf8, 0xf1, 0xe3, 0xfb, 0x07, 0x06, 0x06, + 0xe2, 0xe0, 0xc1, 0x83, 0x57, 0x0a, 0x0a, 0x0a, 0x5e, 0x05, 0xb0, 0x5e, + 0xda, 0xef, 0xb6, 0x42, 0xe8, 0x36, 0x13, 0x00, 0xf9, 0x37, 0x9b, 0x0c, + 0x3e, 0xe3, 0x6d, 0x31, 0xef, 0x17, 0x3f, 0x84, 0xd3, 0xe9, 0x0c, 0x68, + 0x6b, 0x6b, 0x1b, 0x20, 0x67, 0x97, 0xbd, 0x42, 0x88, 0x2b, 0xb7, 0x78, + 0x20, 0x84, 0xa2, 0x28, 0x2e, 0x5d, 0xd7, 0x03, 0xe5, 0x8c, 0xe7, 0xc0, + 0xf5, 0xb3, 0xf0, 0xcd, 0x8a, 0xa2, 0x5c, 0xd5, 0x75, 0xdd, 0xd7, 0x7a, + 0x52, 0xa8, 0xaa, 0xea, 0xa7, 0x69, 0x9a, 0x5d, 0xa6, 0xa5, 0xed, 0x36, + 0x9b, 0xad, 0xdd, 0xe3, 0xf1, 0xb8, 0xbd, 0xc4, 0xc5, 0xe5, 0xf1, 0x78, + 0xec, 0xb2, 0x5f, 0xef, 0x59, 0xc9, 0x03, 0xa0, 0x59, 0x55, 0x55, 0xb7, + 0xa6, 0x69, 0xed, 0xb8, 0xf1, 0xe5, 0x98, 0x00, 0xf9, 0xc2, 0x4e, 0x90, + 0xf4, 0xd9, 0xdb, 0x1e, 0x9f, 0x6f, 0x1d, 0xaa, 0xaa, 0xea, 0xd0, 0x34, + 0xcd, 0x4f, 0xfa, 0xe0, 0xf6, 0x61, 0x93, 0x51, 0x5f, 0x09, 0x90, 0x7d, + 0x1b, 0xfd, 0xb7, 0x00, 0xb8, 0xaa, 0x28, 0x4a, 0xb3, 0x0f, 0x7f, 0x6d, + 0xa6, 0xf6, 0xc6, 0x52, 0xaa, 0x05, 0xc0, 0x55, 0x21, 0x44, 0xb3, 0xf7, + 0xcb, 0x3a, 0x42, 0x08, 0x3b, 0x49, 0xa7, 0x1c, 0x97, 0x0e, 0xe9, 0x5f, + 0x1b, 0x6e, 0xfe, 0xa6, 0xa4, 0x51, 0xdc, 0x35, 0xec, 0x51, 0x65, 0x5d, + 0xe1, 0x8a, 0xb4, 0xc7, 0xfb, 0x5a, 0x55, 0x08, 0xe1, 0x22, 0x19, 0x2c, + 0x0b, 0xc2, 0xfe, 0x00, 0x1a, 0x4c, 0xf6, 0x58, 0xc1, 0x7f, 0x9b, 0x0a, + 0xc0, 0x8f, 0x29, 0x20, 0x1a, 0xfb, 0xe4, 0xbe, 0x44, 0xe2, 0xfb, 0xee, + 0xf9, 0x43, 0x5e, 0x1b, 0xf6, 0xbe, 0x86, 0xff, 0x80, 0x2f, 0xbc, 0x85, + 0x1f, 0xca, 0x8f, 0xb4, 0xe7, 0xc7, 0x8e, 0xd3, 0x8f, 0xe9, 0x5f, 0xc1, + 0x8d, 0xaf, 0x03, 0xeb, 0x3f, 0xc1, 0xd8, 0xdc, 0xac, 0xff, 0x5b, 0xbd, + 0x5e, 0xfd, 0xf7, 0xb4, 0xb7, 0xf8, 0x19, 0xf1, 0x7f, 0x2c, 0x2e, 0x06, + 0x08, 0x9c, 0x01, 0xc9, 0x62, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82 +}; + +unsigned int cc_fps_images_len(void) +{ + return sizeof(cc_fps_images_png); +} diff --git a/cocos2dx/ccFPSImages.c.REMOVED.git-id b/cocos2dx/ccFPSImages.c.REMOVED.git-id deleted file mode 100644 index 343717a465..0000000000 --- a/cocos2dx/ccFPSImages.c.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -5ad94003f4c67bd0d732389ccf7aa438a0956a39 \ No newline at end of file diff --git a/cocos2dx/ccFPSImages.h b/cocos2dx/ccFPSImages.h index ad35566d04..20807f8849 100644 --- a/cocos2dx/ccFPSImages.h +++ b/cocos2dx/ccFPSImages.h @@ -22,17 +22,12 @@ * THE SOFTWARE. */ -extern unsigned char cc_fps_images_png[]; -extern unsigned char cc_fps_images_hd_png[]; -extern unsigned char cc_fps_images_ipadhd_png[]; - #ifdef __cplusplus extern "C" { #endif - + +extern unsigned char cc_fps_images_png[]; unsigned int cc_fps_images_len(void); -unsigned int cc_fps_images_hd_len(void); -unsigned int cc_fps_images_ipadhd_len(void); #ifdef __cplusplus } diff --git a/cocos2dx/cocoa/CCArray.cpp b/cocos2dx/cocoa/CCArray.cpp index 7da453e05b..12e5bb2971 100644 --- a/cocos2dx/cocoa/CCArray.cpp +++ b/cocos2dx/cocoa/CCArray.cpp @@ -160,27 +160,22 @@ bool CCArray::initWithObjects(CCObject* pObject, ...) bool bRet = false; do { - CC_BREAK_IF(pObject != NULL); + CC_BREAK_IF(pObject == NULL); va_list args; va_start(args, pObject); - CCArray* pArray = new CCArray(); - if (pArray && pObject) + if (pObject) { - pArray->addObject(pObject); + this->addObject(pObject); CCObject* i = va_arg(args, CCObject*); while(i) { - pArray->addObject(i); + this->addObject(i); i = va_arg(args, CCObject*); } bRet = true; } - else - { - CC_SAFE_DELETE(pArray); - } va_end(args); } while (false); @@ -210,17 +205,17 @@ bool CCArray::initWithArray(CCArray* otherArray) return bRet; } -unsigned int CCArray::count() +unsigned int CCArray::count() const { return data->num; } -unsigned int CCArray::capacity() +unsigned int CCArray::capacity() const { return data->max; } -unsigned int CCArray::indexOfObject(CCObject* object) +unsigned int CCArray::indexOfObject(CCObject* object) const { return ccArrayGetIndexOfObject(data, object); } @@ -257,7 +252,7 @@ CCObject* CCArray::randomObject() return data->arr[(int)(data->num * r)]; } -bool CCArray::containsObject(CCObject* object) +bool CCArray::containsObject(CCObject* object) const { return ccArrayContainsObject(data, object); } @@ -396,4 +391,9 @@ CCObject* CCArray::copyWithZone(CCZone* pZone) return pArray; } +void CCArray::acceptVisitor(CCDataVisitor &visitor) +{ + visitor.visit(this); +} + NS_CC_END diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h index fa92ab3998..01c196f9b1 100644 --- a/cocos2dx/cocoa/CCArray.h +++ b/cocos2dx/cocoa/CCArray.h @@ -151,11 +151,11 @@ public: // Querying an Array /** Returns element count of the array */ - unsigned int count(); + unsigned int count() const; /** Returns capacity of the array */ - unsigned int capacity(); + unsigned int capacity() const; /** Returns index of a certain object, return UINT_MAX if doesn't contain the object */ - unsigned int indexOfObject(CCObject* object); + unsigned int indexOfObject(CCObject* object) const; /** Returns an element with a certain index */ CCObject* objectAtIndex(unsigned int index); /** Returns last element */ @@ -163,7 +163,7 @@ public: /** Returns a random element */ CCObject* randomObject(); /** Returns a Boolean value that indicates whether object is present in array. */ - bool containsObject(CCObject* object); + bool containsObject(CCObject* object) const; /** @since 1.1 */ bool isEqualToArray(CCArray* pOtherArray); // Adding Objects @@ -210,6 +210,9 @@ public: /* override functions */ virtual CCObject* copyWithZone(CCZone* pZone); + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor); + public: ccArray* data; CCArray(); diff --git a/cocos2dx/cocoa/CCBool.h b/cocos2dx/cocoa/CCBool.h index 7f49e03a80..e2a172c519 100755 --- a/cocos2dx/cocoa/CCBool.h +++ b/cocos2dx/cocoa/CCBool.h @@ -50,6 +50,10 @@ public: } return pRet; } + + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); } + private: bool m_bValue; }; diff --git a/cocos2dx/cocoa/CCDataVisitor.cpp b/cocos2dx/cocoa/CCDataVisitor.cpp new file mode 100644 index 0000000000..cb4ac8c73a --- /dev/null +++ b/cocos2dx/cocoa/CCDataVisitor.cpp @@ -0,0 +1,228 @@ +/**************************************************************************** + Copyright (c) 2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "CCObject.h" +#include "CCBool.h" +#include "CCInteger.h" +#include "CCFloat.h" +#include "CCDouble.h" +#include "CCString.h" +#include "CCArray.h" +#include "CCDictionary.h" +#include "CCSet.h" + +NS_CC_BEGIN + +void CCDataVisitor::visit(const CCBool *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCInteger *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCFloat *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCDouble *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCString *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCArray *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCDictionary *value) +{ + visitObject(value); +} + +void CCDataVisitor::visit(const CCSet *value) +{ + visitObject(value); +} + +// CCPrettyPrinter +CCPrettyPrinter::CCPrettyPrinter(int indentLevel/* = 0 */) +{ + setIndentLevel(indentLevel); +} + +void CCPrettyPrinter::clear() +{ + _result.clear(); +} + +std::string CCPrettyPrinter::getResult() +{ + return _result; +} + +void CCPrettyPrinter::visitObject(const CCObject *p) +{ + char buf[50] = {0}; + sprintf(buf, "%p", p); + _result += buf; +} + +void CCPrettyPrinter::visit(const CCBool * p) +{ + char buf[50] = {0}; + sprintf(buf, "%s", p->getValue() ? "true" : "false"); + _result += buf; +} + +void CCPrettyPrinter::visit(const CCInteger *p) +{ + char buf[50] = {0}; + sprintf(buf, "%d", p->getValue()); + _result += buf; +} + +void CCPrettyPrinter::visit(const CCFloat *p) +{ + char buf[50] = {0}; + sprintf(buf, "%f", p->getValue()); + _result += buf; +} + +void CCPrettyPrinter::visit(const CCDouble *p) +{ + char buf[50] = {0}; + sprintf(buf, "%lf", p->getValue()); + _result += buf; +} + +void CCPrettyPrinter::visit(const CCString *p) +{ + _result += p->getCString(); +} + +void CCPrettyPrinter::visit(const CCArray *p) +{ + _result += "\n"; + _result += _indentStr; + _result += "\n"; + + setIndentLevel(_indentLevel+1); + CCObject* obj; + int i = 0; + char buf[50] = {0}; + CCARRAY_FOREACH(p, obj) + { + if (i > 0) { + _result += "\n"; + } + sprintf(buf, "%s%02d: ", _indentStr.c_str(), i); + _result += buf; + CCPrettyPrinter v(_indentLevel); + obj->acceptVisitor(v); + _result += v.getResult(); + i++; + } + setIndentLevel(_indentLevel-1); + + _result += "\n"; + _result += _indentStr; + _result += ""; +} + +void CCPrettyPrinter::visit(const CCDictionary *p) +{ + _result += "\n"; + _result += _indentStr; + _result += "\n"; + + setIndentLevel(_indentLevel+1); + CCDictElement* element; + bool bFirstElement = true; + char buf[1000] = {0}; + CCDICT_FOREACH(p, element) + { + if (!bFirstElement) { + _result += "\n"; + } + sprintf(buf, "%s%s: ", _indentStr.c_str(),element->getStrKey()); + _result += buf; + CCPrettyPrinter v(_indentLevel); + element->getObject()->acceptVisitor(v); + _result += v.getResult(); + bFirstElement = false; + } + setIndentLevel(_indentLevel-1); + + _result += "\n"; + _result += _indentStr; + _result += ""; +} + +void CCPrettyPrinter::visit(const CCSet *p) +{ + _result += "\n"; + _result += _indentStr; + _result += "\n"; + + setIndentLevel(_indentLevel+1); + + int i = 0; + CCSet* tmp = const_cast(p); + CCSetIterator it = tmp->begin(); + + for (; it != tmp->end(); ++it, ++i) { + if (i > 0) { + _result += "\n"; + } + _result += _indentStr.c_str(); + CCPrettyPrinter v(_indentLevel); + (*it)->acceptVisitor(v); + _result += v.getResult(); + } + setIndentLevel(_indentLevel-1); + + _result += "\n"; + _result += _indentStr; + _result += "\n"; +} + +void CCPrettyPrinter::setIndentLevel(int indentLevel) +{ + _indentLevel = indentLevel; + _indentStr.clear(); + for (int i = 0; i < _indentLevel; ++i) { + _indentStr += "\t"; + } +} + +NS_CC_END diff --git a/cocos2dx/cocoa/CCDataVisitor.h b/cocos2dx/cocoa/CCDataVisitor.h new file mode 100644 index 0000000000..636021d971 --- /dev/null +++ b/cocos2dx/cocoa/CCDataVisitor.h @@ -0,0 +1,110 @@ +/**************************************************************************** + Copyright (c) 2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#ifndef __CCDATAVISITOR_H__ +#define __CCDATAVISITOR_H__ + +#include "platform/CCPlatformMacros.h" +#include + +NS_CC_BEGIN + +class CCObject; +class CCBool; +class CCInteger; +class CCFloat; +class CCDouble; +class CCString; +class CCArray; +class CCDictionary; +class CCSet; + +/** + * @addtogroup data_structures + * @{ + */ + +/** + * Visitor that helps to perform action that depends on polymorphic object type + * + * Use cases: + * - data serialization, + * - pretty printing of \a CCObject * + * - safe value reading from \a CCArray, \a CCDictionary, \a CCSet + * + * Usage: + * 1. subclass CCDataVisitor + * 2. overload visit() methods for object that you need to handle + * 3. handle other objects in \a visitObject() + * 4. pass your visitor to \a CCObject::acceptVisitor() + */ +class CC_DLL CCDataVisitor +{ +public: + virtual ~CCDataVisitor() {} + + /** default method, called from non-overloaded methods and for unrecognized objects */ + virtual void visitObject(const CCObject *p) = 0; + + virtual void visit(const CCBool *p); + virtual void visit(const CCInteger *p); + virtual void visit(const CCFloat *p); + virtual void visit(const CCDouble *p); + virtual void visit(const CCString *p); + virtual void visit(const CCArray *p); + virtual void visit(const CCDictionary *p); + virtual void visit(const CCSet *p); +}; + + +class CC_DLL CCPrettyPrinter : public CCDataVisitor +{ +public: + CCPrettyPrinter(int indentLevel = 0); + + virtual void clear(); + virtual std::string getResult(); + + virtual void visitObject(const CCObject *p); + virtual void visit(const CCBool * p); + virtual void visit(const CCInteger *p); + virtual void visit(const CCFloat *p); + virtual void visit(const CCDouble *p); + virtual void visit(const CCString *p); + virtual void visit(const CCArray *p); + virtual void visit(const CCDictionary *p); + virtual void visit(const CCSet *p); +private: + void setIndentLevel(int indentLevel); + int _indentLevel; + std::string _indentStr; + std::string _result; +}; + +// end of data_structure group +/// @} + +NS_CC_END + +#endif // __CCDATAVISITOR_H__ diff --git a/cocos2dx/cocoa/CCDictionary.cpp b/cocos2dx/cocoa/CCDictionary.cpp index 520051d264..b7f15d3a84 100644 --- a/cocos2dx/cocoa/CCDictionary.cpp +++ b/cocos2dx/cocoa/CCDictionary.cpp @@ -169,7 +169,7 @@ CCObject* CCDictionary::objectForKey(const std::string& key) return pRetObject; } -CCObject* CCDictionary::objectForKey(int key) +CCObject* CCDictionary::objectForKey(intptr_t key) { // if dictionary wasn't initialized, return NULL directly. if (m_eDictType == kCCDictUnknown) return NULL; @@ -179,7 +179,7 @@ CCObject* CCDictionary::objectForKey(int key) CCObject* pRetObject = NULL; CCDictElement *pElement = NULL; - HASH_FIND_INT(m_pElements, &key, pElement); + HASH_FIND_PTR(m_pElements, &key, pElement); if (pElement != NULL) { pRetObject = pElement->m_pObject; @@ -197,7 +197,7 @@ const CCString* CCDictionary::valueForKey(const std::string& key) return pStr; } -const CCString* CCDictionary::valueForKey(int key) +const CCString* CCDictionary::valueForKey(intptr_t key) { CCString* pStr = dynamic_cast(objectForKey(key)); if (pStr == NULL) @@ -233,7 +233,7 @@ void CCDictionary::setObject(CCObject* pObject, const std::string& key) } } -void CCDictionary::setObject(CCObject* pObject, int key) +void CCDictionary::setObject(CCObject* pObject, intptr_t key) { CCAssert(pObject != NULL, "Invalid Argument!"); if (m_eDictType == kCCDictUnknown) @@ -244,7 +244,7 @@ void CCDictionary::setObject(CCObject* pObject, int key) CCAssert(m_eDictType == kCCDictInt, "this dictionary doesn't use integer as key."); CCDictElement *pElement = NULL; - HASH_FIND_INT(m_pElements, &key, pElement); + HASH_FIND_PTR(m_pElements, &key, pElement); if (pElement == NULL) { setObjectUnSafe(pObject, key); @@ -274,7 +274,7 @@ void CCDictionary::removeObjectForKey(const std::string& key) removeObjectForElememt(pElement); } -void CCDictionary::removeObjectForKey(int key) +void CCDictionary::removeObjectForKey(intptr_t key) { if (m_eDictType == kCCDictUnknown) { @@ -283,7 +283,7 @@ void CCDictionary::removeObjectForKey(int key) CCAssert(m_eDictType == kCCDictInt, "this dictionary doesn't use integer as its key"); CCDictElement *pElement = NULL; - HASH_FIND_INT(m_pElements, &key, pElement); + HASH_FIND_PTR(m_pElements, &key, pElement); removeObjectForElememt(pElement); } @@ -294,11 +294,11 @@ void CCDictionary::setObjectUnSafe(CCObject* pObject, const std::string& key) HASH_ADD_STR(m_pElements, m_szKey, pElement); } -void CCDictionary::setObjectUnSafe(CCObject* pObject, const int key) +void CCDictionary::setObjectUnSafe(CCObject* pObject, const intptr_t key) { pObject->retain(); CCDictElement* pElement = new CCDictElement(key, pObject); - HASH_ADD_INT(m_pElements, m_iKey, pElement); + HASH_ADD_PTR(m_pElements, m_iKey, pElement); } void CCDictionary::removeObjectsForKeys(CCArray* pKeyArray) @@ -408,6 +408,11 @@ CCDictionary* CCDictionary::createWithContentsOfFileThreadSafe(const char *pFile return CCFileUtils::sharedFileUtils()->createCCDictionaryWithContentsOfFile(pFileName); } +void CCDictionary::acceptVisitor(CCDataVisitor &visitor) +{ + return visitor.visit(this); +} + CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName) { CCDictionary* pRet = createWithContentsOfFileThreadSafe(pFileName); @@ -415,4 +420,10 @@ CCDictionary* CCDictionary::createWithContentsOfFile(const char *pFileName) return pRet; } +bool CCDictionary::writeToFile(const char *fullPath) +{ + return CCFileUtils::sharedFileUtils()->writeToFile(this, fullPath); +} + + NS_CC_END diff --git a/cocos2dx/cocoa/CCDictionary.h b/cocos2dx/cocoa/CCDictionary.h index fe176e5ddc..6ae92fe684 100644 --- a/cocos2dx/cocoa/CCDictionary.h +++ b/cocos2dx/cocoa/CCDictionary.h @@ -139,6 +139,7 @@ public: */ #define CCDICT_FOREACH(__dict__, __el__) \ CCDictElement* pTmp##__dict__##__el__ = NULL; \ + if (__dict__) \ HASH_ITER(hh, (__dict__)->m_pElements, __el__, pTmp##__dict__##__el__) @@ -218,7 +219,7 @@ public: * // Do something about pStr2 * } * @endcode - * @see objectForKey(int) + * @see objectForKey(intptr_t) */ CCObject* objectForKey(const std::string& key); @@ -230,7 +231,7 @@ public: * @return The object matches the key. * @see objectForKey(const std::string&) */ - CCObject* objectForKey(int key); + CCObject* objectForKey(intptr_t key); /** Get the value according to the specified string key. * @@ -238,7 +239,7 @@ public: * @param key The string key for searching * @return An instance of CCString. * It will return an empty string if the objects aren't CCString pointer or the key wasn't found. - * @see valueForKey(int) + * @see valueForKey(intptr_t) */ const CCString* valueForKey(const std::string& key); @@ -248,9 +249,9 @@ public: * @param key The string key for searching. * @return An instance of CCString. * It will return an empty string if the objects aren't CCString pointer or the key wasn't found. - * @see valueForKey(int) + * @see valueForKey(intptr_t) */ - const CCString* valueForKey(int key); + const CCString* valueForKey(intptr_t key); /** Insert an object to dictionary, and match it with the specified string key. * @@ -261,7 +262,7 @@ public: * * @param pObject The Object to be inserted. * @param key The string key for searching. - * @see setObject(CCObject*, int) + * @see setObject(CCObject*, intptr_t) */ void setObject(CCObject* pObject, const std::string& key); @@ -275,13 +276,13 @@ public: * @param key The string key for searching. * @see setObject(CCObject*, const std::string&) */ - void setObject(CCObject* pObject, int key); + void setObject(CCObject* pObject, intptr_t key); /** * Remove an object by the specified string key. * * @param key The string key for searching. - * @see removeObjectForKey(int), removeObjectsForKeys(CCArray*), + * @see removeObjectForKey(intptr_t), removeObjectsForKeys(CCArray*), * removeObjectForElememt(CCDictElement*), removeAllObjects(). */ void removeObjectForKey(const std::string& key); @@ -293,13 +294,13 @@ public: * @see removeObjectForKey(const std::string&), removeObjectsForKeys(CCArray*), * removeObjectForElememt(CCDictElement*), removeAllObjects(). */ - void removeObjectForKey(int key); + void removeObjectForKey(intptr_t key); /** * Remove objects by an array of keys. * * @param pKeyArray The array contains keys to be removed. - * @see removeObjectForKey(const std::string&), removeObjectForKey(int), + * @see removeObjectForKey(const std::string&), removeObjectForKey(intptr_t), * removeObjectForElememt(CCDictElement*), removeAllObjects(). */ void removeObjectsForKeys(CCArray* pKeyArray); @@ -308,7 +309,7 @@ public: * Remove an object by an element. * * @param pElement The element need to be removed. - * @see removeObjectForKey(const std::string&), removeObjectForKey(int), + * @see removeObjectForKey(const std::string&), removeObjectForKey(intptr_t), * removeObjectsForKeys(CCArray*), removeAllObjects(). */ void removeObjectForElememt(CCDictElement* pElement); @@ -316,7 +317,7 @@ public: /** * Remove all objects in the dictionary. * - * @see removeObjectForKey(const std::string&), removeObjectForKey(int), + * @see removeObjectForKey(const std::string&), removeObjectForKey(intptr_t), * removeObjectsForKeys(CCArray*), removeObjectForElememt(CCDictElement*). */ void removeAllObjects(); @@ -334,7 +335,7 @@ public: * Return a random object in the dictionary. * * @return The random object. - * @see objectForKey(int), objectForKey(const std::string&) + * @see objectForKey(intptr_t), objectForKey(const std::string&) */ CCObject* randomObject(); @@ -361,7 +362,14 @@ public: * @see create(), createWithDictionary(CCDictionary*), createWithContentsOfFileThreadSafe(const char*). */ static CCDictionary* createWithContentsOfFile(const char *pFileName); - + + /** + * Write a dictionary to a plist file. + * @param fullPath The full path of the plist file. You can get writeable path by getWritablePath() + * @return true if successed, false if failed + */ + bool writeToFile(const char *fullPath); + /** * Create a dictionary with a plist file. * @@ -375,12 +383,15 @@ public: */ static CCDictionary* createWithContentsOfFileThreadSafe(const char *pFileName); + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor); + private: /** * For internal usage, invoked by setObject. */ void setObjectUnSafe(CCObject* pObject, const std::string& key); - void setObjectUnSafe(CCObject* pObject, const int key); + void setObjectUnSafe(CCObject* pObject, const intptr_t key); public: /** diff --git a/cocos2dx/cocoa/CCDouble.h b/cocos2dx/cocoa/CCDouble.h index e1f3101e08..920b228baa 100755 --- a/cocos2dx/cocoa/CCDouble.h +++ b/cocos2dx/cocoa/CCDouble.h @@ -50,6 +50,10 @@ public: } return pRet; } + + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); } + private: double m_dValue; }; diff --git a/cocos2dx/cocoa/CCFloat.h b/cocos2dx/cocoa/CCFloat.h index 37433c82e7..36c9642951 100755 --- a/cocos2dx/cocoa/CCFloat.h +++ b/cocos2dx/cocoa/CCFloat.h @@ -50,6 +50,10 @@ public: } return pRet; } + + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); } + private: float m_fValue; }; diff --git a/cocos2dx/cocoa/CCGeometry.cpp b/cocos2dx/cocoa/CCGeometry.cpp index 3560a4d3b5..417906ffa7 100644 --- a/cocos2dx/cocoa/CCGeometry.cpp +++ b/cocos2dx/cocoa/CCGeometry.cpp @@ -28,19 +28,20 @@ THE SOFTWARE. // implementation of CCPoint NS_CC_BEGIN -CCPoint::CCPoint(void) +CCPoint::CCPoint(void) : x(0), y(0) { - setPoint(0.0f, 0.0f); } -CCPoint::CCPoint(float x, float y) +CCPoint::CCPoint(float x, float y) : x(x), y(y) { - setPoint(x, y); } -CCPoint::CCPoint(const CCPoint& other) +CCPoint::CCPoint(const CCPoint& other) : x(other.x), y(other.y) +{ +} + +CCPoint::CCPoint(const CCSize& size) : x(size.width), y(size.height) { - setPoint(other.x, other.y); } CCPoint& CCPoint::operator= (const CCPoint& other) @@ -49,6 +50,38 @@ CCPoint& CCPoint::operator= (const CCPoint& other) return *this; } +CCPoint& CCPoint::operator= (const CCSize& size) +{ + setPoint(size.width, size.height); + return *this; +} + +CCPoint CCPoint::operator+(const CCPoint& right) const +{ + return CCPoint(this->x + right.x, this->y + right.y); +} + +CCPoint CCPoint::operator-(const CCPoint& right) const +{ + return CCPoint(this->x - right.x, this->y - right.y); +} + +CCPoint CCPoint::operator-() const +{ + return CCPoint(-x, -y); +} + +CCPoint CCPoint::operator*(float a) const +{ + return CCPoint(this->x * a, this->y * a); +} + +CCPoint CCPoint::operator/(float a) const +{ + CCAssert(a, "CCPoint division by 0."); + return CCPoint(this->x / a, this->y / a); +} + void CCPoint::setPoint(float x, float y) { this->x = x; @@ -57,24 +90,48 @@ void CCPoint::setPoint(float x, float y) bool CCPoint::equals(const CCPoint& target) const { - return ((x == target.x) && (y == target.y)); + return (fabs(this->x - target.x) < FLT_EPSILON) + && (fabs(this->y - target.y) < FLT_EPSILON); +} + +bool CCPoint::fuzzyEquals(const CCPoint& b, float var) const +{ + if(x - var <= b.x && b.x <= x + var) + if(y - var <= b.y && b.y <= y + var) + return true; + return false; +} + +float CCPoint::getAngle(const CCPoint& other) const +{ + CCPoint a2 = normalize(); + CCPoint b2 = other.normalize(); + float angle = atan2f(a2.cross(b2), a2.dot(b2)); + if( fabs(angle) < FLT_EPSILON ) return 0.f; + return angle; +} + +CCPoint CCPoint::rotateByAngle(const CCPoint& pivot, float angle) const +{ + return pivot + (*this - pivot).rotate(CCPoint::forAngle(angle)); } // implementation of CCSize -CCSize::CCSize(void) +CCSize::CCSize(void) : width(0), height(0) { - setSize(0.0f, 0.0f); } -CCSize::CCSize(float width, float height) +CCSize::CCSize(float width, float height) : width(width), height(height) { - setSize(width, height); } -CCSize::CCSize(const CCSize& other) +CCSize::CCSize(const CCSize& other) : width(other.width), height(other.height) +{ +} + +CCSize::CCSize(const CCPoint& point) : width(point.x), height(point.y) { - setSize(other.width, other.height); } CCSize& CCSize::operator= (const CCSize& other) @@ -83,6 +140,33 @@ CCSize& CCSize::operator= (const CCSize& other) return *this; } +CCSize& CCSize::operator= (const CCPoint& point) +{ + setSize(point.x, point.y); + return *this; +} + +CCSize CCSize::operator+(const CCSize& right) const +{ + return CCSize(this->width + right.width, this->height + right.height); +} + +CCSize CCSize::operator-(const CCSize& right) const +{ + return CCSize(this->width - right.width, this->height - right.height); +} + +CCSize CCSize::operator*(float a) const +{ + return CCSize(this->width * a, this->height * a); +} + +CCSize CCSize::operator/(float a) const +{ + CCAssert(a, "CCSize division by 0."); + return CCSize(this->width / a, this->height / a); +} + void CCSize::setSize(float width, float height) { this->width = width; @@ -91,7 +175,8 @@ void CCSize::setSize(float width, float height) bool CCSize::equals(const CCSize& target) const { - return ((width == target.width) && (height == target.height)); + return (fabs(this->width - target.width) < FLT_EPSILON) + && (fabs(this->height - target.height) < FLT_EPSILON); } // implementation of CCRect diff --git a/cocos2dx/cocoa/CCGeometry.h b/cocos2dx/cocoa/CCGeometry.h index e0caabf2d2..46f837b29a 100644 --- a/cocos2dx/cocoa/CCGeometry.h +++ b/cocos2dx/cocoa/CCGeometry.h @@ -27,6 +27,7 @@ THE SOFTWARE. #include "platform/CCPlatformMacros.h" #include "CCObject.h" +#include NS_CC_BEGIN @@ -35,6 +36,9 @@ NS_CC_BEGIN * @{ */ +// for CCPoint assignement operator and copy constructor +class CC_DLL CCSize; + class CC_DLL CCPoint { public: @@ -45,9 +49,158 @@ public: CCPoint(); CCPoint(float x, float y); CCPoint(const CCPoint& other); + CCPoint(const CCSize& size); CCPoint& operator= (const CCPoint& other); + CCPoint& operator= (const CCSize& size); + CCPoint operator+(const CCPoint& right) const; + CCPoint operator-(const CCPoint& right) const; + CCPoint operator-() const; + CCPoint operator*(float a) const; + CCPoint operator/(float a) const; void setPoint(float x, float y); bool equals(const CCPoint& target) const; + + /** @returns if points have fuzzy equality which means equal with some degree of variance. + @since v2.1.4 + */ + bool fuzzyEquals(const CCPoint& target, float variance) const; + + /** Calculates distance between point an origin + @return float + @since v2.1.4 + */ + inline float getLength() const { + return sqrtf(x*x + y*y); + }; + + /** Calculates the square length of a CCPoint (not calling sqrt() ) + @return float + @since v2.1.4 + */ + inline float getLengthSq() const { + return dot(*this); //x*x + y*y; + }; + + /** Calculates the square distance between two points (not calling sqrt() ) + @return float + @since v2.1.4 + */ + inline float getDistanceSq(const CCPoint& other) const { + return (*this - other).getLengthSq(); + }; + + /** Calculates the distance between two points + @return float + @since v2.1.4 + */ + inline float getDistance(const CCPoint& other) const { + return (*this - other).getLength(); + }; + + /** @returns the angle in radians between this vector and the x axis + @since v2.1.4 + */ + inline float getAngle() const { + return atan2f(y, x); + }; + + /** @returns the angle in radians between two vector directions + @since v2.1.4 + */ + float getAngle(const CCPoint& other) const; + + /** Calculates dot product of two points. + @return float + @since v2.1.4 + */ + inline float dot(const CCPoint& other) const { + return x*other.x + y*other.y; + }; + + /** Calculates cross product of two points. + @return float + @since v2.1.4 + */ + inline float cross(const CCPoint& other) const { + return x*other.y - y*other.x; + }; + + /** Calculates perpendicular of v, rotated 90 degrees counter-clockwise -- cross(v, perp(v)) >= 0 + @return CCPoint + @since v2.1.4 + */ + inline CCPoint getPerp() const { + return CCPoint(-y, x); + }; + + /** Calculates perpendicular of v, rotated 90 degrees clockwise -- cross(v, rperp(v)) <= 0 + @return CCPoint + @since v2.1.4 + */ + inline CCPoint getRPerp() const { + return CCPoint(y, -x); + }; + + /** Calculates the projection of this over other. + @return CCPoint + @since v2.1.4 + */ + inline CCPoint project(const CCPoint& other) const { + return other * (dot(other)/other.dot(other)); + }; + + /** Complex multiplication of two points ("rotates" two points). + @return CCPoint vector with an angle of this.getAngle() + other.getAngle(), + and a length of this.getLength() * other.getLength(). + @since v2.1.4 + */ + inline CCPoint rotate(const CCPoint& other) const { + return CCPoint(x*other.x - y*other.y, x*other.y + y*other.x); + }; + + /** Unrotates two points. + @return CCPoint vector with an angle of this.getAngle() - other.getAngle(), + and a length of this.getLength() * other.getLength(). + @since v2.1.4 + */ + inline CCPoint unrotate(const CCPoint& other) const { + return CCPoint(x*other.x + y*other.y, y*other.x - x*other.y); + }; + + /** Returns point multiplied to a length of 1. + * If the point is 0, it returns (1, 0) + @return CCPoint + @since v2.1.4 + */ + inline CCPoint normalize() const { + float length = getLength(); + if(length == 0.) return CCPoint(1.f, 0); + return *this / getLength(); + }; + + /** Linear Interpolation between two points a and b + @returns + alpha == 0 ? a + alpha == 1 ? b + otherwise a value between a..b + @since v2.1.4 + */ + inline CCPoint lerp(const CCPoint& other, float alpha) const { + return *this * (1.f - alpha) + other * alpha; + }; + + /** Rotates a point counter clockwise by the angle around a pivot + @param pivot is the pivot, naturally + @param angle is the angle of rotation ccw in radians + @returns the rotated point + @since v2.1.4 + */ + CCPoint rotateByAngle(const CCPoint& pivot, float angle) const; + + static inline CCPoint forAngle(const float a) + { + return CCPoint(cosf(a), sinf(a)); + } }; class CC_DLL CCSize @@ -60,7 +213,13 @@ public: CCSize(); CCSize(float width, float height); CCSize(const CCSize& other); + CCSize(const CCPoint& point); CCSize& operator= (const CCSize& other); + CCSize& operator= (const CCPoint& point); + CCSize operator+(const CCSize& right) const; + CCSize operator-(const CCSize& right) const; + CCSize operator*(float a) const; + CCSize operator/(float a) const; void setSize(float width, float height); bool equals(const CCSize& target) const; }; @@ -72,10 +231,10 @@ public: CCSize size; public: - CCRect(); + CCRect(); CCRect(float x, float y, float width, float height); CCRect(const CCRect& other); - CCRect& operator= (const CCRect& other); + CCRect& operator= (const CCRect& other); void setRect(float x, float y, float width, float height); float getMinX() const; /// return the leftmost x-value of current rect float getMidX() const; /// return the midpoint x-value of current rect diff --git a/cocos2dx/cocoa/CCInteger.h b/cocos2dx/cocoa/CCInteger.h index f412dd4a3a..e9f34cb3af 100644 --- a/cocos2dx/cocoa/CCInteger.h +++ b/cocos2dx/cocoa/CCInteger.h @@ -23,6 +23,10 @@ public: pRet->autorelease(); return pRet; } + + /* override functions */ + virtual void acceptVisitor(CCDataVisitor &visitor) { visitor.visit(this); } + private: int m_nValue; }; diff --git a/cocos2dx/cocoa/CCObject.cpp b/cocos2dx/cocoa/CCObject.cpp index 40546ded8a..dd74c695a3 100644 --- a/cocos2dx/cocoa/CCObject.cpp +++ b/cocos2dx/cocoa/CCObject.cpp @@ -100,12 +100,12 @@ CCObject* CCObject::autorelease(void) return this; } -bool CCObject::isSingleReference(void) +bool CCObject::isSingleReference(void) const { return m_uReference == 1; } -unsigned int CCObject::retainCount(void) +unsigned int CCObject::retainCount(void) const { return m_uReference; } @@ -115,4 +115,9 @@ bool CCObject::isEqual(const CCObject *pObject) return this == pObject; } +void CCObject::acceptVisitor(CCDataVisitor &visitor) +{ + visitor.visitObject(this); +} + NS_CC_END diff --git a/cocos2dx/cocoa/CCObject.h b/cocos2dx/cocoa/CCObject.h index 010e55df62..d79224848b 100644 --- a/cocos2dx/cocoa/CCObject.h +++ b/cocos2dx/cocoa/CCObject.h @@ -25,7 +25,11 @@ THE SOFTWARE. #ifndef __CCOBJECT_H__ #define __CCOBJECT_H__ -#include "platform/CCPlatformMacros.h" +#include "CCDataVisitor.h" + +#ifdef EMSCRIPTEN +#include +#endif // EMSCRIPTEN NS_CC_BEGIN @@ -65,10 +69,12 @@ public: void retain(void); CCObject* autorelease(void); CCObject* copy(void); - bool isSingleReference(void); - unsigned int retainCount(void); + bool isSingleReference(void) const; + unsigned int retainCount(void) const; virtual bool isEqual(const CCObject* pObject); + virtual void acceptVisitor(CCDataVisitor &visitor); + virtual void update(float dt) {CC_UNUSED_PARAM(dt);}; friend class CCAutoreleasePool; diff --git a/cocos2dx/cocoa/CCSet.cpp b/cocos2dx/cocoa/CCSet.cpp index cb6f654992..8de3b02e2d 100644 --- a/cocos2dx/cocoa/CCSet.cpp +++ b/cocos2dx/cocoa/CCSet.cpp @@ -56,6 +56,11 @@ CCSet::~CCSet(void) CC_SAFE_DELETE(m_pSet); } +void CCSet::acceptVisitor(CCDataVisitor &visitor) +{ + visitor.visit(this); +} + CCSet * CCSet::create() { CCSet * pRet = new CCSet(); diff --git a/cocos2dx/cocoa/CCSet.h b/cocos2dx/cocoa/CCSet.h index 042ee71c83..85d36d6d9d 100644 --- a/cocos2dx/cocoa/CCSet.h +++ b/cocos2dx/cocoa/CCSet.h @@ -90,6 +90,8 @@ public: */ CCObject* anyObject(); + virtual void acceptVisitor(CCDataVisitor &visitor); + private: std::set *m_pSet; }; diff --git a/cocos2dx/cocoa/CCString.cpp b/cocos2dx/cocoa/CCString.cpp index d22f5724ad..caf320b26a 100644 --- a/cocos2dx/cocoa/CCString.cpp +++ b/cocos2dx/cocoa/CCString.cpp @@ -200,4 +200,9 @@ CCString* CCString::createWithContentsOfFile(const char* pszFileName) return pRet; } +void CCString::acceptVisitor(CCDataVisitor &visitor) +{ + visitor.visit(this); +} + NS_CC_END diff --git a/cocos2dx/cocoa/CCString.h b/cocos2dx/cocoa/CCString.h index 895a96cf35..9548a0e63c 100644 --- a/cocos2dx/cocoa/CCString.h +++ b/cocos2dx/cocoa/CCString.h @@ -54,7 +54,7 @@ public: CCString& operator= (const CCString& other); /** init a string with format, it's similar with the c function 'sprintf' */ - bool initWithFormat(const char* format, ...); + bool initWithFormat(const char* format, ...) CC_FORMAT_PRINTF(2, 3); /** convert to int value */ int intValue() const; @@ -95,7 +95,7 @@ public: * @return A CCString pointer which is an autorelease object pointer, * it means that you needn't do a release operation unless you retain it. */ - static CCString* createWithFormat(const char* format, ...); + static CCString* createWithFormat(const char* format, ...) CC_FORMAT_PRINTF(1, 2); /** create a string with binary data * @return A CCString pointer which is an autorelease object pointer, @@ -109,6 +109,8 @@ public: */ static CCString* createWithContentsOfFile(const char* pszFileName); + virtual void acceptVisitor(CCDataVisitor &visitor); + private: /** only for internal use */ diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index e382d4b376..1306380f7c 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "cocos2d-2.1rc0-x-2.1.2"; + return "2.1rc0-x-2.1.4"; } NS_CC_END diff --git a/cocos2dx/draw_nodes/CCDrawNode.cpp b/cocos2dx/draw_nodes/CCDrawNode.cpp index cd53c9db77..bb35a4e4e4 100644 --- a/cocos2dx/draw_nodes/CCDrawNode.cpp +++ b/cocos2dx/draw_nodes/CCDrawNode.cpp @@ -201,7 +201,7 @@ void CCDrawNode::render() glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid *)offsetof(ccV2F_C4B_T2F, vertices)); // color - glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid *)offsetof(ccV2F_C4B_T2F, colors)); + glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ccV2F_C4B_T2F), (GLvoid *)offsetof(ccV2F_C4B_T2F, colors)); // texcood glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid *)offsetof(ccV2F_C4B_T2F, texCoords)); @@ -338,7 +338,7 @@ void CCDrawNode::drawPolygon(CCPoint *verts, unsigned int count, const ccColor4F extrude[i] = tmp; } - bool outline = (fillColor.a > 0.0 && borderWidth > 0.0); + bool outline = (borderColor.a > 0.0 && borderWidth > 0.0); unsigned int triangle_count = 3*count - 2; unsigned int vertex_count = 3*triangle_count; diff --git a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp index 1b245a5a2c..2d27ce0d4c 100644 --- a/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp +++ b/cocos2dx/draw_nodes/CCDrawingPrimitives.cpp @@ -60,6 +60,33 @@ static ccColor4F s_tColor = {1.0f,1.0f,1.0f,1.0f}; static int s_nPointSizeLocation = -1; static GLfloat s_fPointSize = 1.0f; +#ifdef EMSCRIPTEN +static GLuint s_bufferObject = 0; +static GLuint s_bufferSize = 0; + +static void setGLBufferData(void *buf, GLuint bufSize) +{ + if(s_bufferSize < bufSize) + { + if(s_bufferObject) + { + glDeleteBuffers(1, &s_bufferObject); + } + glGenBuffers(1, &s_bufferObject); + s_bufferSize = bufSize; + + glBindBuffer(GL_ARRAY_BUFFER, s_bufferObject); + glBufferData(GL_ARRAY_BUFFER, bufSize, buf, GL_DYNAMIC_DRAW); + } + else + { + glBindBuffer(GL_ARRAY_BUFFER, s_bufferObject); + glBufferSubData(GL_ARRAY_BUFFER, 0, bufSize, buf); + } +} + +#endif // EMSCRIPTEN + static void lazy_init( void ) { if( ! s_bInitialized ) { @@ -106,7 +133,12 @@ void ccDrawPoint( const CCPoint& point ) s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); s_pShader->setUniformLocationWith1f(s_nPointSizeLocation, s_fPointSize); +#ifdef EMSCRIPTEN + setGLBufferData(&p, 8); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, &p); +#endif // EMSCRIPTEN glDrawArrays(GL_POINTS, 0, 1); @@ -129,7 +161,12 @@ void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ) // iPhone and 32-bit machines optimization if( sizeof(CCPoint) == sizeof(ccVertex2F) ) { +#ifdef EMSCRIPTEN + setGLBufferData((void*) points, numberOfPoints * sizeof(CCPoint)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, points); +#endif // EMSCRIPTEN } else { @@ -138,7 +175,14 @@ void ccDrawPoints( const CCPoint *points, unsigned int numberOfPoints ) newPoints[i].x = points[i].x; newPoints[i].y = points[i].y; } +#ifdef EMSCRIPTEN + // Suspect Emscripten won't be emitting 64-bit code for a while yet, + // but want to make sure this continues to work even if they do. + setGLBufferData(newPoints, numberOfPoints * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoints); +#endif // EMSCRIPTEN } glDrawArrays(GL_POINTS, 0, (GLsizei) numberOfPoints); @@ -163,7 +207,12 @@ void ccDrawLine( const CCPoint& origin, const CCPoint& destination ) s_pShader->setUniformLocationWith4fv(s_nColorLocation, (GLfloat*) &s_tColor.r, 1); ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); +#ifdef EMSCRIPTEN + setGLBufferData(vertices, 16); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN glDrawArrays(GL_LINES, 0, 2); CC_INCREMENT_GL_DRAWS(1); @@ -202,7 +251,12 @@ void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePol // iPhone and 32-bit machines optimization if( sizeof(CCPoint) == sizeof(ccVertex2F) ) { +#ifdef EMSCRIPTEN + setGLBufferData((void*) poli, numberOfPoints * sizeof(CCPoint)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, poli); +#endif // EMSCRIPTEN if( closePolygon ) glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints); @@ -218,7 +272,12 @@ void ccDrawPoly( const CCPoint *poli, unsigned int numberOfPoints, bool closePol newPoli[i].x = poli[i].x; newPoli[i].y = poli[i].y; } +#ifdef EMSCRIPTEN + setGLBufferData(newPoli, numberOfPoints * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli); +#endif // EMSCRIPTEN if( closePolygon ) glDrawArrays(GL_LINE_LOOP, 0, (GLsizei) numberOfPoints); @@ -247,7 +306,12 @@ void ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4 // iPhone and 32-bit machines optimization if( sizeof(CCPoint) == sizeof(ccVertex2F) ) { +#ifdef EMSCRIPTEN + setGLBufferData((void*) poli, numberOfPoints * sizeof(CCPoint)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, poli); +#endif // EMSCRIPTEN } else { @@ -256,7 +320,12 @@ void ccDrawSolidPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4 { newPoli[i] = vertex2( poli[i].x, poli[i].y ); } +#ifdef EMSCRIPTEN + setGLBufferData(newPoli, numberOfPoints * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli); +#endif // EMSCRIPTEN } glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints); @@ -296,7 +365,12 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned in ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); +#ifdef EMSCRIPTEN + setGLBufferData(vertices, sizeof(GLfloat)*2*(segments+2)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments+additionalSegment); free( vertices ); @@ -331,7 +405,12 @@ void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoi ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); +#ifdef EMSCRIPTEN + setGLBufferData(vertices, (segments + 1) * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); CC_SAFE_DELETE_ARRAY(vertices); @@ -383,7 +462,12 @@ void ccDrawCardinalSpline( CCPointArray *config, float tension, unsigned int se ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); +#ifdef EMSCRIPTEN + setGLBufferData(vertices, (segments + 1) * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); CC_SAFE_DELETE_ARRAY(vertices); @@ -412,7 +496,12 @@ void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCP ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position ); +#ifdef EMSCRIPTEN + setGLBufferData(vertices, (segments + 1) * sizeof(ccVertex2F)); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices); +#endif // EMSCRIPTEN glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); CC_SAFE_DELETE_ARRAY(vertices); diff --git a/cocos2dx/effects/CCGrid.cpp b/cocos2dx/effects/CCGrid.cpp index a3e18980ce..352b454e1a 100644 --- a/cocos2dx/effects/CCGrid.cpp +++ b/cocos2dx/effects/CCGrid.cpp @@ -182,12 +182,12 @@ void CCGridBase::set2DProjection() CCSize size = director->getWinSizeInPixels(); - glViewport(0, 0, (GLsizei)(size.width * CC_CONTENT_SCALE_FACTOR()), (GLsizei)(size.height * CC_CONTENT_SCALE_FACTOR()) ); + glViewport(0, 0, (GLsizei)(size.width), (GLsizei)(size.height) ); kmGLMatrixMode(KM_GL_PROJECTION); kmGLLoadIdentity(); kmMat4 orthoMatrix; - kmMat4OrthographicProjection(&orthoMatrix, 0, size.width * CC_CONTENT_SCALE_FACTOR(), 0, size.height * CC_CONTENT_SCALE_FACTOR(), -1, 1); + kmMat4OrthographicProjection(&orthoMatrix, 0, size.width, 0, size.height, -1, 1); kmGLMultMatrix( &orthoMatrix ); kmGLMatrixMode(KM_GL_MODELVIEW); @@ -323,7 +323,21 @@ void CCGrid3D::blit(void) // // Attributes // +#ifdef EMSCRIPTEN + // Size calculations from calculateVertexPoints(). + unsigned int numOfPoints = (m_sGridSize.width+1) * (m_sGridSize.height+1); + // position + setGLBufferData(m_pVertices, numOfPoints * sizeof(ccVertex3F), 0); + glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, 0); + + // texCoords + setGLBufferData(m_pTexCoordinates, numOfPoints * sizeof(ccVertex2F), 1); + glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, 0); + + setGLIndexData(m_pIndices, n * 12, 0); + glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, 0); +#else // position glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices); @@ -331,6 +345,7 @@ void CCGrid3D::blit(void) glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates); glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, m_pIndices); +#endif // EMSCRIPTEN CC_INCREMENT_GL_DRAWS(1); } @@ -524,6 +539,20 @@ void CCTiledGrid3D::blit(void) // Attributes // ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position | kCCVertexAttribFlag_TexCoords ); +#ifdef EMSCRIPTEN + int numQuads = m_sGridSize.width * m_sGridSize.height; + + // position + setGLBufferData(m_pVertices, (numQuads*4*sizeof(ccVertex3F)), 0); + glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, 0); + + // texCoords + setGLBufferData(m_pTexCoordinates, (numQuads*4*sizeof(ccVertex2F)), 1); + glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, 0); + + setGLIndexData(m_pIndices, n * 12, 0); + glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, 0); +#else // position glVertexAttribPointer(kCCVertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, 0, m_pVertices); @@ -531,6 +560,8 @@ void CCTiledGrid3D::blit(void) glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoordinates); glDrawElements(GL_TRIANGLES, (GLsizei)n*6, GL_UNSIGNED_SHORT, m_pIndices); +#endif // EMSCRIPTEN + CC_INCREMENT_GL_DRAWS(1); } diff --git a/cocos2dx/effects/CCGrid.h b/cocos2dx/effects/CCGrid.h index 5c18fbf7ed..4dee8487f5 100644 --- a/cocos2dx/effects/CCGrid.h +++ b/cocos2dx/effects/CCGrid.h @@ -32,6 +32,9 @@ THE SOFTWARE. #include "textures/CCTexture2D.h" #include "CCDirector.h" #include "kazmath/mat4.h" +#ifdef EMSCRIPTEN +#include "base_nodes/CCGLBufferedNode.h" +#endif // EMSCRIPTEN NS_CC_BEGIN @@ -105,6 +108,9 @@ protected: CCGrid3D is a 3D grid implementation. Each vertex has 3 dimensions: x,y,z */ class CC_DLL CCGrid3D : public CCGridBase +#ifdef EMSCRIPTEN +, public CCGLBufferedNode +#endif // EMSCRIPTEN { public: CCGrid3D(); @@ -139,6 +145,9 @@ protected: the tiles can be separated from the grid. */ class CC_DLL CCTiledGrid3D : public CCGridBase +#ifdef EMSCRIPTEN +, public CCGLBufferedNode +#endif // EMSCRIPTEN { public: CCTiledGrid3D(); diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index dde93334e2..13a41ba744 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -36,12 +36,14 @@ THE SOFTWARE. #ifndef CCAssert #if COCOS2D_DEBUG > 0 -extern void CC_DLL cc_assert_script_compatible(bool cond, const char *msg); -#define CCAssert(cond, msg) \ - { \ - cc_assert_script_compatible(!!(cond), (msg)); \ - CC_ASSERT(cond); \ - } +extern bool CC_DLL cc_assert_script_compatible(const char *msg); +#define CCAssert(cond, msg) do { \ + if (!(cond)) { \ + if (!cc_assert_script_compatible(msg) && strlen(msg)) \ + cocos2d::CCLog("Assert failed: %s", msg); \ + CC_ASSERT(cond); \ + } \ + } while (0) #else #define CCAssert(cond, msg) #endif diff --git a/cocos2dx/include/ccTypes.h b/cocos2dx/include/ccTypes.h index 11a75339fd..67ebaeab21 100644 --- a/cocos2dx/include/ccTypes.h +++ b/cocos2dx/include/ccTypes.h @@ -27,9 +27,11 @@ THE SOFTWARE. #ifndef __CCTYPES_H__ #define __CCTYPES_H__ +#include #include "cocoa/CCGeometry.h" #include "CCGL.h" + NS_CC_BEGIN /** RGB color composed of bytes 3 bytes @@ -49,6 +51,14 @@ ccc3(const GLubyte r, const GLubyte g, const GLubyte b) ccColor3B c = {r, g, b}; return c; } + +/** returns true if both ccColor3B are equal. Otherwise it returns false. + */ +static inline bool ccc3BEqual(const ccColor3B &col1, const ccColor3B &col2) +{ + return col1.r == col2.r && col1.g == col2.g && col1.b == col2.b; +} + //ccColor3B predefined colors //! White color (255,255,255) static const ccColor3B ccWHITE={255,255,255}; @@ -350,6 +360,78 @@ typedef struct CCSize size; } ccAnimationFrameData; + + +/** + types used for defining fonts properties (i.e. font name, size, stroke or shadow) + */ + +// shadow attributes +typedef struct _ccFontShadow +{ +public: + + // shadow is not enabled by default + _ccFontShadow(): m_shadowEnabled(false) {} + + // true if shadow enabled + bool m_shadowEnabled; + // shadow x and y offset + CCSize m_shadowOffset; + // shadow blurrines + float m_shadowBlur; + // shadow opacity + float m_shadowOpacity; + +} ccFontShadow; + +// stroke attributes +typedef struct _ccFontStroke +{ +public: + + // stroke is disabled by default + _ccFontStroke(): m_strokeEnabled(false) {} + + // true if stroke enabled + bool m_strokeEnabled; + // stroke color + ccColor3B m_strokeColor; + // stroke size + float m_strokeSize; + +} ccFontStroke; + +// font attributes +typedef struct _ccFontDefinition +{ +public: + + _ccFontDefinition(): m_alignment(kCCTextAlignmentCenter), + m_vertAlignment(kCCVerticalTextAlignmentTop), + m_fontFillColor(ccWHITE) + { m_dimensions = CCSizeMake(0,0); } + + // font name + std::string m_fontName; + // font size + int m_fontSize; + // horizontal alignment + CCTextAlignment m_alignment; + // vertical alignment + CCVerticalTextAlignment m_vertAlignment; + // renering box + CCSize m_dimensions; + // font color + ccColor3B m_fontFillColor; + // font shadow + ccFontShadow m_shadow; + // font stroke + ccFontStroke m_stroke; + +} ccFontDefinition; + + NS_CC_END #endif //__CCTYPES_H__ diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index de8cdcf09f..7d6aed56b1 100755 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -199,6 +199,22 @@ THE SOFTWARE. #include "platform/nacl/CCStdC.h" #endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID +#if (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN) + #include "platform/emscripten/CCAccelerometer.h" + #include "platform/emscripten/CCApplication.h" + #include "platform/emscripten/CCEGLView.h" + #include "platform/emscripten/CCGL.h" + #include "platform/emscripten/CCStdC.h" +#endif // CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) + #include "platform/tizen/CCAccelerometer.h" + #include "platform/tizen/CCApplication.h" + #include "platform/tizen/CCEGLView.h" + #include "platform/tizen/CCGL.h" + #include "platform/tizen/CCStdC.h" +#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN + // script_support #include "script_support/CCScriptSupport.h" @@ -256,6 +272,10 @@ THE SOFTWARE. #include "CCDirector.h" #include "CCScheduler.h" +// component +#include "support/component/CCComponent.h" +#include "support/component/CCComponentContainer.h" + NS_CC_BEGIN CC_DLL const char* cocos2dVersion(); diff --git a/cocos2dx/label_nodes/CCLabelAtlas.cpp b/cocos2dx/label_nodes/CCLabelAtlas.cpp index 060c87c20e..9d1c789398 100644 --- a/cocos2dx/label_nodes/CCLabelAtlas.cpp +++ b/cocos2dx/label_nodes/CCLabelAtlas.cpp @@ -116,8 +116,6 @@ void CCLabelAtlas::updateAtlasValues() { unsigned int n = m_sString.length(); - ccV3F_C4B_T2F_Quad quad; - const unsigned char *s = (unsigned char*)m_sString.c_str(); CCTexture2D *texture = m_pTextureAtlas->getTexture(); @@ -125,8 +123,16 @@ void CCLabelAtlas::updateAtlasValues() float textureHigh = (float) texture->getPixelsHigh(); float itemWidthInPixels = m_uItemWidth * CC_CONTENT_SCALE_FACTOR(); float itemHeightInPixels = m_uItemHeight * CC_CONTENT_SCALE_FACTOR(); + if (m_bIgnoreContentScaleFactor) + { + itemWidthInPixels = m_uItemWidth; + itemHeightInPixels = m_uItemHeight; + } + CCAssert( n <= m_pTextureAtlas->getCapacity(), "updateAtlasValues: Invalid String length"); + ccV3F_C4B_T2F_Quad* quads = m_pTextureAtlas->getQuads(); for(unsigned int i = 0; i < n; i++) { + unsigned char a = s[i] - m_uMapStartChar; float row = (float) (a % m_uItemsPerRow); float col = (float) (a / m_uItemsPerRow); @@ -144,34 +150,39 @@ void CCLabelAtlas::updateAtlasValues() float bottom = top + itemHeightInPixels / textureHigh; #endif // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL - quad.tl.texCoords.u = left; - quad.tl.texCoords.v = top; - quad.tr.texCoords.u = right; - quad.tr.texCoords.v = top; - quad.bl.texCoords.u = left; - quad.bl.texCoords.v = bottom; - quad.br.texCoords.u = right; - quad.br.texCoords.v = bottom; + quads[i].tl.texCoords.u = left; + quads[i].tl.texCoords.v = top; + quads[i].tr.texCoords.u = right; + quads[i].tr.texCoords.v = top; + quads[i].bl.texCoords.u = left; + quads[i].bl.texCoords.v = bottom; + quads[i].br.texCoords.u = right; + quads[i].br.texCoords.v = bottom; - quad.bl.vertices.x = (float) (i * m_uItemWidth); - quad.bl.vertices.y = 0; - quad.bl.vertices.z = 0.0f; - quad.br.vertices.x = (float)(i * m_uItemWidth + m_uItemWidth); - quad.br.vertices.y = 0; - quad.br.vertices.z = 0.0f; - quad.tl.vertices.x = (float)(i * m_uItemWidth); - quad.tl.vertices.y = (float)(m_uItemHeight); - quad.tl.vertices.z = 0.0f; - quad.tr.vertices.x = (float)(i * m_uItemWidth + m_uItemWidth); - quad.tr.vertices.y = (float)(m_uItemHeight); - quad.tr.vertices.z = 0.0f; - + quads[i].bl.vertices.x = (float) (i * m_uItemWidth); + quads[i].bl.vertices.y = 0; + quads[i].bl.vertices.z = 0.0f; + quads[i].br.vertices.x = (float)(i * m_uItemWidth + m_uItemWidth); + quads[i].br.vertices.y = 0; + quads[i].br.vertices.z = 0.0f; + quads[i].tl.vertices.x = (float)(i * m_uItemWidth); + quads[i].tl.vertices.y = (float)(m_uItemHeight); + quads[i].tl.vertices.z = 0.0f; + quads[i].tr.vertices.x = (float)(i * m_uItemWidth + m_uItemWidth); + quads[i].tr.vertices.y = (float)(m_uItemHeight); + quads[i].tr.vertices.z = 0.0f; ccColor4B c = { _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity }; - quad.tl.colors = c; - quad.tr.colors = c; - quad.bl.colors = c; - quad.br.colors = c; - m_pTextureAtlas->updateQuad(&quad, i); + quads[i].tl.colors = c; + quads[i].tr.colors = c; + quads[i].bl.colors = c; + quads[i].br.colors = c; + } + if (n > 0 ){ + m_pTextureAtlas->setDirty(true); + unsigned int totalQuads = m_pTextureAtlas->getTotalQuads(); + if (n > totalQuads) { + m_pTextureAtlas->increaseTotalQuadsWith(n - totalQuads); + } } } diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index 6d21292619..6d7fd93436 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -45,7 +45,6 @@ http://www.angelcode.com/products/bmfont/ (Free, Windows only) using namespace std; - NS_CC_BEGIN // The return value needs to be deleted by CC_SAFE_DELETE_ARRAY. @@ -153,8 +152,8 @@ CCBMFontConfiguration::~CCBMFontConfiguration() const char* CCBMFontConfiguration::description(void) { return CCString::createWithFormat( - "", - this, + "", + (size_t)this, HASH_COUNT(m_pFontDefDictionary), HASH_COUNT(m_pKerningDictionary), m_sAtlasName.c_str() diff --git a/cocos2dx/label_nodes/CCLabelTTF.cpp b/cocos2dx/label_nodes/CCLabelTTF.cpp index e7707164de..b96cf7d3f8 100644 --- a/cocos2dx/label_nodes/CCLabelTTF.cpp +++ b/cocos2dx/label_nodes/CCLabelTTF.cpp @@ -45,6 +45,9 @@ CCLabelTTF::CCLabelTTF() , m_pFontName(NULL) , m_fFontSize(0.0) , m_string("") +, m_shadowEnabled(false) +, m_strokeEnabled(false) +, m_textFillColor(ccWHITE) { } @@ -120,10 +123,10 @@ bool CCLabelTTF::initWithString(const char *string, const char *fontName, float this->setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(SHADER_PROGRAM)); m_tDimensions = CCSizeMake(dimensions.width, dimensions.height); - m_hAlignment = hAlignment; - m_vAlignment = vAlignment; - m_pFontName = new std::string(fontName); - m_fFontSize = fontSize; + m_hAlignment = hAlignment; + m_vAlignment = vAlignment; + m_pFontName = new std::string(fontName); + m_fFontSize = fontSize; this->setString(string); @@ -133,6 +136,29 @@ bool CCLabelTTF::initWithString(const char *string, const char *fontName, float return false; } +bool CCLabelTTF::initWithStringAndTextDefinition(const char *string, ccFontDefinition &textDefinition) +{ + if (CCSprite::init()) + { + // shader program + this->setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(SHADER_PROGRAM)); + + // prepare everythin needed to render the label + _updateWithTextDefinition(textDefinition, false); + + // set the string + this->setString(string); + + // + return true; + } + else + { + return false; + } +} + + void CCLabelTTF::setString(const char *string) { CCAssert(string != NULL, "Invalid string"); @@ -255,30 +281,275 @@ void CCLabelTTF::setFontName(const char *fontName) bool CCLabelTTF::updateTexture() { CCTexture2D *tex; - - // let system compute label's width or height when its value is 0 - // refer to cocos2d-x issue #1430 tex = new CCTexture2D(); - if (!tex) - { - return false; - } - tex->initWithString( m_string.c_str(), - m_pFontName->c_str(), - m_fFontSize * CC_CONTENT_SCALE_FACTOR(), - CC_SIZE_POINTS_TO_PIXELS(m_tDimensions), - m_hAlignment, - m_vAlignment); - + if (!tex) + return false; + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + ccFontDefinition texDef = _prepareTextDefinition(true); + tex->initWithString( m_string.c_str(), &texDef ); + + #else + + tex->initWithString( m_string.c_str(), + m_pFontName->c_str(), + m_fFontSize * CC_CONTENT_SCALE_FACTOR(), + CC_SIZE_POINTS_TO_PIXELS(m_tDimensions), + m_hAlignment, + m_vAlignment); + + #endif + + // set the texture this->setTexture(tex); + // release it tex->release(); - - CCRect rect = CCRectZero; - rect.size = m_pobTexture->getContentSize(); + + // set the size in the sprite + CCRect rect =CCRectZero; + rect.size = m_pobTexture->getContentSize(); this->setTextureRect(rect); - + + //ok return true; } +void CCLabelTTF::enableShadow(const CCSize &shadowOffset, float shadowOpacity, float shadowBlur, bool updateTexture) +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + bool valueChanged = false; + + if (false == m_shadowEnabled) + { + m_shadowEnabled = true; + valueChanged = true; + } + + if ( (m_shadowOffset.width != shadowOffset.width) || (m_shadowOffset.height!=shadowOffset.height) ) + { + m_shadowOffset.width = shadowOffset.width; + m_shadowOffset.height = shadowOffset.height; + + valueChanged = true; + } + + if (m_shadowOpacity != shadowOpacity ) + { + m_shadowOpacity = shadowOpacity; + valueChanged = true; + } + + if (m_shadowBlur != shadowBlur) + { + m_shadowBlur = shadowBlur; + valueChanged = true; + } + + + if ( valueChanged && updateTexture ) + { + this->updateTexture(); + } + + #else + CCAssert(false, "Currently only supported on iOS and Android!"); + #endif + +} + +void CCLabelTTF::disableShadow(bool updateTexture) +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + if (m_shadowEnabled) + { + m_shadowEnabled = false; + + if (updateTexture) + this->updateTexture(); + + } + + #else + CCAssert(false, "Currently only supported on iOS and Android!"); + #endif +} + +void CCLabelTTF::enableStroke(const ccColor3B &strokeColor, float strokeSize, bool updateTexture) +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + bool valueChanged = false; + + if(m_strokeEnabled == false) + { + m_strokeEnabled = true; + valueChanged = true; + } + + if ( (m_strokeColor.r != strokeColor.r) || (m_strokeColor.g != strokeColor.g) || (m_strokeColor.b != strokeColor.b) ) + { + m_strokeColor = strokeColor; + valueChanged = true; + } + + if (m_strokeSize!=strokeSize) + { + m_strokeSize = strokeSize; + valueChanged = true; + } + + if ( valueChanged && updateTexture ) + { + this->updateTexture(); + } + + #else + CCAssert(false, "Currently only supported on iOS and Android!"); + #endif + +} + +void CCLabelTTF::disableStroke(bool updateTexture) +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + if (m_strokeEnabled) + { + m_strokeEnabled = false; + + if (updateTexture) + this->updateTexture(); + } + + #else + CCAssert(false, "Currently only supported on iOS and Android!"); + #endif + +} + +void CCLabelTTF::setFontFillColor(const ccColor3B &tintColor, bool updateTexture) +{ + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + if (m_textFillColor.r != tintColor.r || m_textFillColor.g != tintColor.g || m_textFillColor.b != tintColor.b) + { + m_textFillColor = tintColor; + + if (updateTexture) + this->updateTexture(); + } + #else + CCAssert(false, "Currently only supported on iOS and Android!"); + #endif +} + +void CCLabelTTF::setTextDefinition(ccFontDefinition *theDefinition) +{ + if (theDefinition) + { + _updateWithTextDefinition(*theDefinition, true); + } +} + +ccFontDefinition *CCLabelTTF::getTextDefinition() +{ + ccFontDefinition *tempDefinition = new ccFontDefinition; + *tempDefinition = _prepareTextDefinition(false); + return tempDefinition; +} + +void CCLabelTTF::_updateWithTextDefinition(ccFontDefinition & textDefinition, bool mustUpdateTexture) +{ + m_tDimensions = CCSizeMake(textDefinition.m_dimensions.width, textDefinition.m_dimensions.height); + m_hAlignment = textDefinition.m_alignment; + m_vAlignment = textDefinition.m_vertAlignment; + + m_pFontName = new std::string(textDefinition.m_fontName); + m_fFontSize = textDefinition.m_fontSize; + + + // shadow + if ( textDefinition.m_shadow.m_shadowEnabled ) + { + enableShadow(textDefinition.m_shadow.m_shadowOffset, textDefinition.m_shadow.m_shadowOpacity, textDefinition.m_shadow.m_shadowBlur, false); + } + + // stroke + if ( textDefinition.m_stroke.m_strokeEnabled ) + { + enableStroke(textDefinition.m_stroke.m_strokeColor, textDefinition.m_stroke.m_strokeSize, false); + } + + // fill color + setFontFillColor(textDefinition.m_fontFillColor, false); + + if (mustUpdateTexture) + updateTexture(); +} + +ccFontDefinition CCLabelTTF::_prepareTextDefinition(bool adjustForResolution) +{ + ccFontDefinition texDef; + + if (adjustForResolution) + texDef.m_fontSize = m_fFontSize * CC_CONTENT_SCALE_FACTOR(); + else + texDef.m_fontSize = m_fFontSize; + + texDef.m_fontName = *m_pFontName; + texDef.m_alignment = m_hAlignment; + texDef.m_vertAlignment = m_vAlignment; + + + if (adjustForResolution) + texDef.m_dimensions = CC_SIZE_POINTS_TO_PIXELS(m_tDimensions); + else + texDef.m_dimensions = m_tDimensions; + + + // stroke + if ( m_strokeEnabled ) + { + texDef.m_stroke.m_strokeEnabled = true; + texDef.m_stroke.m_strokeColor = m_strokeColor; + + if (adjustForResolution) + texDef.m_stroke.m_strokeSize = m_strokeSize * CC_CONTENT_SCALE_FACTOR(); + else + texDef.m_stroke.m_strokeSize = m_strokeSize; + + + } + else + { + texDef.m_stroke.m_strokeEnabled = false; + } + + + // shadow + if ( m_shadowEnabled ) + { + texDef.m_shadow.m_shadowEnabled = true; + texDef.m_shadow.m_shadowBlur = m_shadowBlur; + texDef.m_shadow.m_shadowOpacity = m_shadowOpacity; + + if (adjustForResolution) + texDef.m_shadow.m_shadowOffset = CC_SIZE_POINTS_TO_PIXELS(m_shadowOffset); + else + texDef.m_shadow.m_shadowOffset = m_shadowOffset; + } + else + { + texDef.m_shadow.m_shadowEnabled = false; + } + + // text tint + texDef.m_fontFillColor = m_textFillColor; + + return texDef; +} + NS_CC_END diff --git a/cocos2dx/label_nodes/CCLabelTTF.h b/cocos2dx/label_nodes/CCLabelTTF.h index 01ddea119a..a5f950d5c3 100644 --- a/cocos2dx/label_nodes/CCLabelTTF.h +++ b/cocos2dx/label_nodes/CCLabelTTF.h @@ -37,6 +37,8 @@ NS_CC_BEGIN * @{ */ + + /** @brief CCLabelTTF is a subclass of CCTextureNode that knows how to render text labels * * All features from CCTextureNode are valid in CCLabelTTF @@ -80,6 +82,34 @@ public: const CCSize& dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment); + /** initializes the CCLabelTTF with a font name, alignment, dimension and font size */ + bool initWithStringAndTextDefinition(const char *string, ccFontDefinition &textDefinition); + + /** set the text definition used by this label */ + void setTextDefinition(ccFontDefinition *theDefinition); + + /** get the text definition used by this label */ + ccFontDefinition * getTextDefinition(); + + + + /** enable or disable shadow for the label */ + void enableShadow(const CCSize &shadowOffset, float shadowOpacity, float shadowBlur, bool mustUpdateTexture = true); + + /** disable shadow rendering */ + void disableShadow(bool mustUpdateTexture = true); + + /** enable or disable stroke */ + void enableStroke(const ccColor3B &strokeColor, float strokeSize, bool mustUpdateTexture = true); + + /** disable stroke */ + void disableStroke(bool mustUpdateTexture = true); + + /** set text tinting */ + void setFontFillColor(const ccColor3B &tintColor, bool mustUpdateTexture = true); + + + /** initializes the CCLabelTTF */ bool init(); @@ -107,10 +137,15 @@ public: const char* getFontName(); void setFontName(const char *fontName); - + private: bool updateTexture(); protected: + + /** set the text definition for this label */ + void _updateWithTextDefinition(ccFontDefinition & textDefinition, bool mustUpdateTexture = true); + ccFontDefinition _prepareTextDefinition(bool adjustForResolution = false); + /** Dimensions of the label in Points */ CCSize m_tDimensions; /** The alignment of the label */ @@ -121,8 +156,25 @@ protected: std::string * m_pFontName; /** Font size of the label */ float m_fFontSize; - + /** label's string */ std::string m_string; + + /** font shadow */ + bool m_shadowEnabled; + CCSize m_shadowOffset; + float m_shadowOpacity; + float m_shadowBlur; + + + /** font stroke */ + bool m_strokeEnabled; + ccColor3B m_strokeColor; + float m_strokeSize; + + /** font tint */ + ccColor3B m_textFillColor; + + }; diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 692623bd23..660ece70d0 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -314,7 +314,7 @@ void CCLayer::unregisterScriptKeypadHandler(void) void CCLayer::keyBackClicked(void) { - if (m_pScriptKeypadHandlerEntry) + if (m_pScriptKeypadHandlerEntry || m_eScriptType == kScriptTypeJavascript) { CCScriptEngineManager::sharedManager()->getScriptEngine()->executeLayerKeypadEvent(this, kTypeBackClicked); } @@ -709,7 +709,7 @@ bool CCLayerColor::initWithColor(const ccColor4B& color, GLfloat w, GLfloat h) _displayedColor.r = _realColor.r = color.r; _displayedColor.g = _realColor.g = color.g; _displayedColor.b = _realColor.b = color.b; - _displayedOpacity = color.a; + _displayedOpacity = _realOpacity = color.a; for (size_t i = 0; iCCMenuItem::initWithTarget(target, selector); + pRet->m_pSubItems = CCArray::create(); + pRet->m_pSubItems->retain(); + + for (unsigned int z=0; z < menuItems->count(); z++) + { + CCMenuItem* menuItem = (CCMenuItem*)menuItems->objectAtIndex(z); + pRet->m_pSubItems->addObject(menuItem); + } + + pRet->m_uSelectedIndex = UINT_MAX; + pRet->setSelectedIndex(0); + return pRet; +} + CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...) { va_list args; diff --git a/cocos2dx/menu_nodes/CCMenuItem.h b/cocos2dx/menu_nodes/CCMenuItem.h index 04290de5e5..3707c8e082 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.h +++ b/cocos2dx/menu_nodes/CCMenuItem.h @@ -322,6 +322,9 @@ public: , m_pSubItems(NULL) {} virtual ~CCMenuItemToggle(); + + /** creates a menu item from a CCArray with a target selector */ + static CCMenuItemToggle * createWithTarget(CCObject* target, SEL_MenuHandler selector, CCArray* menuItems); /** creates a menu item from a list of items with a target/selector */ static CCMenuItemToggle* createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...); diff --git a/cocos2dx/misc_nodes/CCClippingNode.cpp b/cocos2dx/misc_nodes/CCClippingNode.cpp index 2cb28272d3..74973e818c 100644 --- a/cocos2dx/misc_nodes/CCClippingNode.cpp +++ b/cocos2dx/misc_nodes/CCClippingNode.cpp @@ -177,9 +177,9 @@ void CCClippingNode::visit() static bool once = true; if (once) { - char warning[200]; - snprintf(warning, 50, "Nesting more than %d stencils is not supported. Everything will be drawn without stencil for this node and its childs.", g_sStencilBits); - CCLOG(warning); + char warning[200] = {0}; + snprintf(warning, sizeof(warning), "Nesting more than %d stencils is not supported. Everything will be drawn without stencil for this node and its childs.", g_sStencilBits); + CCLOG("%s", warning); once = false; } diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index bebde09fd4..4fef149986 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -337,9 +337,21 @@ void CCMotionStreak::draw() ccGLBindTexture2D( m_pTexture->getName() ); +#ifdef EMSCRIPTEN + // Size calculations from ::initWithFade + setGLBufferData(m_pVertices, (sizeof(ccVertex2F) * m_uMaxPoints * 2), 0); + glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, 0); + + setGLBufferData(m_pTexCoords, (sizeof(ccTex2F) * m_uMaxPoints * 2), 1); + glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, 0); + + setGLBufferData(m_pColorPointer, (sizeof(GLubyte) * m_uMaxPoints * 2 * 4), 2); + glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, 0); +#else glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, m_pVertices); glVertexAttribPointer(kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, 0, m_pTexCoords); glVertexAttribPointer(kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, m_pColorPointer); +#endif // EMSCRIPTEN glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)m_uNuPoints*2); diff --git a/cocos2dx/misc_nodes/CCMotionStreak.h b/cocos2dx/misc_nodes/CCMotionStreak.h index 4c8f0a4ec7..325cd78e3b 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.h +++ b/cocos2dx/misc_nodes/CCMotionStreak.h @@ -29,6 +29,9 @@ THE SOFTWARE. #include "textures/CCTexture2D.h" #include "ccTypes.h" #include "base_nodes/CCNode.h" +#ifdef EMSCRIPTEN +#include "base_nodes/CCGLBufferedNode.h" +#endif // EMSCRIPTEN NS_CC_BEGIN @@ -41,6 +44,9 @@ NS_CC_BEGIN Creates a trailing path. */ class CC_DLL CCMotionStreak : public CCNodeRGBA, public CCTextureProtocol +#ifdef EMSCRIPTEN +, public CCGLBufferedNode +#endif // EMSCRIPTEN { public: CCMotionStreak(); diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index afd782be36..533a904189 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -499,9 +499,22 @@ void CCProgressTimer::draw(void) ccGLBindTexture2D( m_pSprite->getTexture()->getName() ); +#ifdef EMSCRIPTEN + setGLBufferData((void*) m_pVertexData, (m_nVertexDataCount * sizeof(ccV2F_C4B_T2F)), 0); + + int offset = 0; + glVertexAttribPointer( kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid*)offset); + + offset += sizeof(ccVertex2F); + glVertexAttribPointer( kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ccV2F_C4B_T2F), (GLvoid*)offset); + + offset += sizeof(ccColor4B); + glVertexAttribPointer( kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(ccV2F_C4B_T2F), (GLvoid*)offset); +#else glVertexAttribPointer( kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, sizeof(m_pVertexData[0]) , &m_pVertexData[0].vertices); glVertexAttribPointer( kCCVertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, sizeof(m_pVertexData[0]), &m_pVertexData[0].texCoords); glVertexAttribPointer( kCCVertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(m_pVertexData[0]), &m_pVertexData[0].colors); +#endif // EMSCRIPTEN if(m_eType == kCCProgressTimerTypeRadial) { diff --git a/cocos2dx/misc_nodes/CCProgressTimer.h b/cocos2dx/misc_nodes/CCProgressTimer.h index 2a4fb2d870..03ed3448b0 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.h +++ b/cocos2dx/misc_nodes/CCProgressTimer.h @@ -26,6 +26,9 @@ THE SOFTWARE. #define __MISC_NODE_CCPROGRESS_TIMER_H__ #include "sprite_nodes/CCSprite.h" +#ifdef EMSCRIPTEN +#include "base_nodes/CCGLBufferedNode.h" +#endif // EMSCRIPTEN NS_CC_BEGIN @@ -51,6 +54,9 @@ typedef enum { @since v0.99.1 */ class CC_DLL CCProgressTimer : public CCNodeRGBA +#ifdef EMSCRIPTEN +, public CCGLBufferedNode +#endif // EMSCRIPTEN { public: CCProgressTimer(); diff --git a/cocos2dx/platform/CCApplicationProtocol.h b/cocos2dx/platform/CCApplicationProtocol.h index e0ef105085..102128c188 100644 --- a/cocos2dx/platform/CCApplicationProtocol.h +++ b/cocos2dx/platform/CCApplicationProtocol.h @@ -13,6 +13,8 @@ enum TargetPlatform kTargetIpad, kTargetBlackBerry, kTargetNaCl, + kTargetEmscripten, + kTargetTizen }; /** diff --git a/cocos2dx/platform/CCCommon.h b/cocos2dx/platform/CCCommon.h index 6b76011687..4ed73467f6 100644 --- a/cocos2dx/platform/CCCommon.h +++ b/cocos2dx/platform/CCCommon.h @@ -40,7 +40,7 @@ static const int kMaxLogLen = 16*1024; /** @brief Output Debug message. */ -void CC_DLL CCLog(const char * pszFormat, ...); +void CC_DLL CCLog(const char * pszFormat, ...) CC_FORMAT_PRINTF(1, 2); /** * lua can not deal with ... diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp index a4515c8673..976684246f 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.cpp +++ b/cocos2dx/platform/CCEGLViewProtocol.cpp @@ -79,6 +79,16 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol m_fScaleX = m_fScaleY = MIN(m_fScaleX, m_fScaleY); } + if ( resolutionPolicy == kResolutionFixedHeight) { + m_fScaleX = m_fScaleY; + m_obDesignResolutionSize.width = ceilf(m_obScreenSize.width/m_fScaleX); + } + + if ( resolutionPolicy == kResolutionFixedWidth) { + m_fScaleY = m_fScaleX; + m_obDesignResolutionSize.height = ceilf(m_obScreenSize.height/m_fScaleY); + } + // calculate the rect of viewport float viewPortW = m_obDesignResolutionSize.width * m_fScaleX; float viewPortH = m_obDesignResolutionSize.height * m_fScaleY; @@ -154,17 +164,33 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h (GLsizei)(h * m_fScaleY)); } -void CCEGLViewProtocol::setViewName(const char* pszViewName) -{ - if (pszViewName != NULL && strlen(pszViewName) > 0) - { - strncpy(m_szViewName, pszViewName, sizeof(m_szViewName)); - } -} - -const char* CCEGLViewProtocol::getViewName() -{ - return m_szViewName; +bool CCEGLViewProtocol::isScissorEnabled() +{ + return glIsEnabled(GL_SCISSOR_TEST); +} + +CCRect CCEGLViewProtocol::getScissorRect() +{ + GLfloat params[4]; + glGetFloatv(GL_SCISSOR_BOX, params); + float x = (params[0] - m_obViewPortRect.origin.x) / m_fScaleX; + float y = (params[1] - m_obViewPortRect.origin.y) / m_fScaleY; + float w = params[2] / m_fScaleX; + float h = params[3] / m_fScaleY; + return CCRectMake(x, y, w, h); +} + +void CCEGLViewProtocol::setViewName(const char* pszViewName) +{ + if (pszViewName != NULL && strlen(pszViewName) > 0) + { + strncpy(m_szViewName, pszViewName, sizeof(m_szViewName)); + } +} + +const char* CCEGLViewProtocol::getViewName() +{ + return m_szViewName; } void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[]) diff --git a/cocos2dx/platform/CCEGLViewProtocol.h b/cocos2dx/platform/CCEGLViewProtocol.h index 9cc1c65334..0fd7b54e8e 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.h +++ b/cocos2dx/platform/CCEGLViewProtocol.h @@ -14,6 +14,16 @@ enum ResolutionPolicy // The entire application is visible in the specified area without distortion while maintaining the original // aspect ratio of the application. Borders can appear on two sides of the application. kResolutionShowAll, + // The application takes the height of the design resolution size and modifies the width of the internal + // canvas so that it fits the aspect ratio of the device + // no distortion will occur however you must make sure your application works on different + // aspect ratios + kResolutionFixedHeight, + // The application takes the width of the design resolution size and modifies the height of the internal + // canvas so that it fits the aspect ratio of the device + // no distortion will occur however you must make sure your application works on different + // aspect ratios + kResolutionFixedWidth, kResolutionUnKnown, }; @@ -98,6 +108,16 @@ public: */ virtual void setScissorInPoints(float x , float y , float w , float h); + /** + * Get whether GL_SCISSOR_TEST is enable + */ + virtual bool isScissorEnabled(); + + /** + * Get the current scissor rectangle + */ + virtual CCRect getScissorRect(); + virtual void setViewName(const char* pszViewName); const char* getViewName(); diff --git a/cocos2dx/platform/CCFileUtils.cpp b/cocos2dx/platform/CCFileUtils.cpp index 20a0cc66e2..34831d8387 100644 --- a/cocos2dx/platform/CCFileUtils.cpp +++ b/cocos2dx/platform/CCFileUtils.cpp @@ -27,6 +27,7 @@ THE SOFTWARE. #include "cocoa/CCDictionary.h" #include "cocoa/CCString.h" #include "CCSAXParser.h" +#include "support/tinyxml2/tinyxml2.h" #include "support/zip_support/unzip.h" #include @@ -333,21 +334,141 @@ public: CCDictionary* CCFileUtils::createCCDictionaryWithContentsOfFile(const std::string& filename) { + std::string fullPath = fullPathForFilename(filename.c_str()); CCDictMaker tMaker; - return tMaker.dictionaryWithContentsOfFile(filename.c_str()); + return tMaker.dictionaryWithContentsOfFile(fullPath.c_str()); } CCArray* CCFileUtils::createCCArrayWithContentsOfFile(const std::string& filename) { + std::string fullPath = fullPathForFilename(filename.c_str()); CCDictMaker tMaker; - return tMaker.arrayWithContentsOfFile(filename.c_str()); + return tMaker.arrayWithContentsOfFile(fullPath.c_str()); } +/* + * forward statement + */ +static tinyxml2::XMLElement* generateElementForArray(cocos2d::CCArray *array, tinyxml2::XMLDocument *pDoc); +static tinyxml2::XMLElement* generateElementForDict(cocos2d::CCDictionary *dict, tinyxml2::XMLDocument *pDoc); + +/* + * Use tinyxml2 to write plist files + */ +bool CCFileUtils::writeToFile(cocos2d::CCDictionary *dict, const std::string &fullPath) +{ + //CCLOG("tinyxml2 CCDictionary %d writeToFile %s", dict->m_uID, fullPath.c_str()); + tinyxml2::XMLDocument *pDoc = new tinyxml2::XMLDocument(); + if (NULL == pDoc) + return false; + + tinyxml2::XMLDeclaration *pDeclaration = pDoc->NewDeclaration("xml version=\"1.0\" encoding=\"UTF-8\""); + if (NULL == pDeclaration) + { + delete pDoc; + return false; + } + + pDoc->LinkEndChild(pDeclaration); + tinyxml2::XMLElement *docType = pDoc->NewElement("!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""); + pDoc->LinkEndChild(docType); + + tinyxml2::XMLElement *pRootEle = pDoc->NewElement("plist"); + pRootEle->SetAttribute("version", "1.0"); + if (NULL == pRootEle) + { + delete pDoc; + return false; + } + pDoc->LinkEndChild(pRootEle); + + tinyxml2::XMLElement *innerDict = generateElementForDict(dict, pDoc); + if (NULL == innerDict ) + { + delete pDoc; + return false; + } + pRootEle->LinkEndChild(innerDict); + + bool bRet = tinyxml2::XML_SUCCESS == pDoc->SaveFile(fullPath.c_str()); + + delete pDoc; + return bRet; +} + +/* + * Generate tinyxml2::XMLElement for CCObject through a tinyxml2::XMLDocument + */ +static tinyxml2::XMLElement* generateElementForObject(cocos2d::CCObject *object, tinyxml2::XMLDocument *pDoc) +{ + // object is CCString + if (CCString *str = dynamic_cast(object)) + { + tinyxml2::XMLElement* node = pDoc->NewElement("string"); + tinyxml2::XMLText* content = pDoc->NewText(str->getCString()); + node->LinkEndChild(content); + return node; + } + + // object is CCArray + if (CCArray *array = dynamic_cast(object)) + return generateElementForArray(array, pDoc); + + // object is CCDictionary + if (CCDictionary *innerDict = dynamic_cast(object)) + return generateElementForDict(innerDict, pDoc); + + CCLOG("This type cannot appear in property list"); + return NULL; +} + +/* + * Generate tinyxml2::XMLElement for CCDictionary through a tinyxml2::XMLDocument + */ +static tinyxml2::XMLElement* generateElementForDict(cocos2d::CCDictionary *dict, tinyxml2::XMLDocument *pDoc) +{ + tinyxml2::XMLElement* rootNode = pDoc->NewElement("dict"); + + CCDictElement *dictElement = NULL; + CCDICT_FOREACH(dict, dictElement) + { + tinyxml2::XMLElement* tmpNode = pDoc->NewElement("key"); + rootNode->LinkEndChild(tmpNode); + tinyxml2::XMLText* content = pDoc->NewText(dictElement->getStrKey()); + tmpNode->LinkEndChild(content); + + CCObject *object = dictElement->getObject(); + tinyxml2::XMLElement *element = generateElementForObject(object, pDoc); + if (element) + rootNode->LinkEndChild(element); + } + return rootNode; +} + +/* + * Generate tinyxml2::XMLElement for CCArray through a tinyxml2::XMLDocument + */ +static tinyxml2::XMLElement* generateElementForArray(cocos2d::CCArray *array, tinyxml2::XMLDocument *pDoc) +{ + tinyxml2::XMLElement* rootNode = pDoc->NewElement("array"); + + CCObject *object = NULL; + CCARRAY_FOREACH(array, object) + { + tinyxml2::XMLElement *element = generateElementForObject(object, pDoc); + if (element) + rootNode->LinkEndChild(element); + } + return rootNode; +} + + #else NS_CC_BEGIN /* The subclass CCFileUtilsIOS and CCFileUtilsMac should override these two method. */ CCDictionary* CCFileUtils::createCCDictionaryWithContentsOfFile(const std::string& filename) {return NULL;} +bool CCFileUtils::writeToFile(cocos2d::CCDictionary *dict, const std::string &fullPath) {return NULL;} CCArray* CCFileUtils::createCCArrayWithContentsOfFile(const std::string& filename) {return NULL;} #endif /* (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_MAC) */ @@ -407,7 +528,7 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz std::string msg = "Get data from file("; msg.append(pszFileName).append(") failed!"); - CCLOG(msg.c_str()); + CCLOG("%s", msg.c_str()); } return pBuffer; } @@ -534,6 +655,8 @@ std::string CCFileUtils::fullPathForFilename(const char* pszFileName) } } + //CCLOG("cocos2d: fullPathForFilename: No file found at %s. Possible missing file.", pszFileName); + // The file wasn't found, return the file name passed in. return pszFileName; } diff --git a/cocos2dx/platform/CCFileUtils.h b/cocos2dx/platform/CCFileUtils.h index 82a0203487..f99a74a926 100644 --- a/cocos2dx/platform/CCFileUtils.h +++ b/cocos2dx/platform/CCFileUtils.h @@ -346,6 +346,12 @@ protected: */ virtual CCDictionary* createCCDictionaryWithContentsOfFile(const std::string& filename); + /** + * Write a dictionary to a plist file. + * @note This method is used internally. + */ + virtual bool writeToFile(CCDictionary *dict, const std::string& fullPath); + /** * Creates an array by the contents of a file. * @note This method is used internally. diff --git a/cocos2dx/platform/CCImage.h b/cocos2dx/platform/CCImage.h index af9c47991d..201812a240 100644 --- a/cocos2dx/platform/CCImage.h +++ b/cocos2dx/platform/CCImage.h @@ -112,12 +112,42 @@ public: ETextAlign eAlignMask = kAlignCenter, const char * pFontName = 0, int nSize = 0); + + #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + + bool initWithStringShadowStroke( + const char * pText, + int nWidth = 0, + int nHeight = 0, + ETextAlign eAlignMask = kAlignCenter, + const char * pFontName = 0, + int nSize = 0, + float textTintR = 1, + float textTintG = 1, + float textTintB = 1, + bool shadow = false, + float shadowOffsetX = 0.0, + float shadowOffsetY = 0.0, + float shadowOpacity = 0.0, + float shadowBlur = 0.0, + bool stroke = false, + float strokeR = 1, + float strokeG = 1, + float strokeB = 1, + float strokeSize = 1 + + ); + + #endif + unsigned char * getData() { return m_pData; } - int getDataLen() { return m_nWidth * m_nHeight; } + int getDataLen() { return m_nWidth * m_nHeight; } + + + bool hasAlpha() { return m_bHasAlpha; } + bool isPremultipliedAlpha() { return m_bPreMulti; } - bool hasAlpha() { return m_bHasAlpha; } - bool isPremultipliedAlpha() { return m_bPreMulti; } /** @brief Save CCImage data to the specified file, with specified format. @@ -136,7 +166,7 @@ protected: bool _initWithTiffData(void *pData, int nDataLen); bool _initWithWebpData(void *pData, int nDataLen); // @warning kFmtRawData only support RGBA8888 - bool _initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent); + bool _initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti); bool _saveImageToPNG(const char *pszFilePath, bool bIsToRGB = true); bool _saveImageToJPG(const char *pszFilePath); @@ -145,6 +175,7 @@ protected: bool m_bHasAlpha; bool m_bPreMulti; + private: // noncopyable CCImage(const CCImage& rImg); diff --git a/cocos2dx/platform/CCImageCommonWebp.cpp b/cocos2dx/platform/CCImageCommonWebp.cpp index ba0480e7ff..878b8408b3 100644 --- a/cocos2dx/platform/CCImageCommonWebp.cpp +++ b/cocos2dx/platform/CCImageCommonWebp.cpp @@ -24,7 +24,7 @@ #include "platform/CCImage.h" #include "textures/CCTexture2D.h" -#ifdef __native_client__ +#if defined(__native_client__) || defined(EMSCRIPTEN) // TODO(sbc): I'm pretty sure all platforms should be including // webph headers in this way. #include "webp/decode.h" diff --git a/cocos2dx/platform/CCImageCommon_cpp.h b/cocos2dx/platform/CCImageCommon_cpp.h index 1153eef191..d033ac19b2 100644 --- a/cocos2dx/platform/CCImageCommon_cpp.h +++ b/cocos2dx/platform/CCImageCommon_cpp.h @@ -36,6 +36,11 @@ THE SOFTWARE. #include #include +#ifdef EMSCRIPTEN +#include +#include +#endif // EMSCRIPTEN + NS_CC_BEGIN // premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D, @@ -93,6 +98,27 @@ CCImage::~CCImage() bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = eFmtPng*/) { bool bRet = false; + +#ifdef EMSCRIPTEN + // Emscripten includes a re-implementation of SDL that uses HTML5 canvas + // operations underneath. Consequently, loading images via IMG_Load (an SDL + // API) will be a lot faster than running libpng et al as compiled with + // Emscripten. + SDL_Surface *iSurf = IMG_Load(strPath); + + int size = 4 * (iSurf->w * iSurf->h); + bRet = _initWithRawData((void*)iSurf->pixels, size, iSurf->w, iSurf->h, 8, true); + + unsigned int *tmp = (unsigned int *)m_pData; + int nrPixels = iSurf->w * iSurf->h; + for(int i = 0; i < nrPixels; i++) + { + unsigned char *p = m_pData + i * 4; + tmp[i] = CC_RGB_PREMULTIPLY_ALPHA( p[0], p[1], p[2], p[3] ); + } + + SDL_FreeSurface(iSurf); +#else unsigned long nSize = 0; std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(strPath); unsigned char* pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullPath.c_str(), "rb", &nSize); @@ -101,6 +127,8 @@ bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = e bRet = initWithImageData(pBuffer, nSize, eImgFmt); } CC_SAFE_DELETE_ARRAY(pBuffer); +#endif // EMSCRIPTEN + return bRet; } @@ -151,7 +179,7 @@ bool CCImage::initWithImageData(void * pData, } else if (kFmtRawData == eFmt) { - bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent); + bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent, false); break; } else @@ -288,7 +316,12 @@ bool CCImage::_initWithJpgData(void * data, int nSize) jpeg_mem_src( &cinfo, (unsigned char *) data, nSize ); /* reading the image header which contains image information */ +#if (JPEG_LIB_VERSION >= 90) + // libjpeg 0.9 adds stricter types. + jpeg_read_header( &cinfo, TRUE ); +#else jpeg_read_header( &cinfo, true ); +#endif // we only support RGB or grayscale if (cinfo.jpeg_color_space != JCS_RGB) @@ -647,7 +680,7 @@ bool CCImage::_initWithTiffData(void* pData, int nDataLen) return bRet; } -bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent) +bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti) { bool bRet = false; do @@ -658,6 +691,7 @@ bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeig m_nHeight = (short)nHeight; m_nWidth = (short)nWidth; m_bHasAlpha = true; + m_bPreMulti = bPreMulti; // only RGBA8888 supported int nBytesPerComponent = 4; @@ -668,6 +702,7 @@ bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeig bRet = true; } while (0); + return bRet; } diff --git a/cocos2dx/platform/CCPlatformConfig.h b/cocos2dx/platform/CCPlatformConfig.h index 342148b4d2..68d86a764e 100644 --- a/cocos2dx/platform/CCPlatformConfig.h +++ b/cocos2dx/platform/CCPlatformConfig.h @@ -44,6 +44,8 @@ Config of cocos2d-x project, per target platform. #define CC_PLATFORM_BLACKBERRY 7 #define CC_PLATFORM_MAC 8 #define CC_PLATFORM_NACL 9 +#define CC_PLATFORM_EMSCRIPTEN 10 +#define CC_PLATFORM_TIZEN 11 // Determine target platform by compile environment macro. #define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN @@ -102,6 +104,17 @@ Config of cocos2d-x project, per target platform. #define CC_TARGET_PLATFORM CC_PLATFORM_NACL #endif +// Emscripten +#if defined(EMSCRIPTEN) + #undef CC_TARGET_PLATFORM + #define CC_TARGET_PLATFORM CC_PLATFORM_EMSCRIPTEN +#endif + +// tizen +#if defined(TIZEN) + #undef CC_TARGET_PLATFORM + #define CC_TARGET_PLATFORM CC_PLATFORM_TIZEN +#endif ////////////////////////////////////////////////////////////////////////// // post configure diff --git a/cocos2dx/platform/CCPlatformMacros.h b/cocos2dx/platform/CCPlatformMacros.h index 3b4e584e32..1aeecbf7ba 100644 --- a/cocos2dx/platform/CCPlatformMacros.h +++ b/cocos2dx/platform/CCPlatformMacros.h @@ -76,17 +76,17 @@ CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \ /** @def CC_ENABLE_CACHE_TEXTURE_DATA Enable it if you want to cache the texture data. -Basically,it's only enabled in android +Basically, it's only enabled for Emscripten. It's new in cocos2d-x since v0.99.5 */ -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN) #define CC_ENABLE_CACHE_TEXTURE_DATA 1 #else #define CC_ENABLE_CACHE_TEXTURE_DATA 0 #endif -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN) /* Application will crash in glDrawElements function on some win32 computers and some android devices. Indices should be bound again while drawing to avoid this bug. */ @@ -233,6 +233,19 @@ public: virtual void set##funName(varType var) \ #define LUALOG(format, ...) cocos2d::CCLog(format, ##__VA_ARGS__) #endif // Lua engine debug +#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \ + || (defined(__clang__) && (__clang_major__ >= 3)) +#define CC_DISABLE_COPY(Class) \ +private: \ + Class(const Class &) = delete; \ + Class &operator =(const Class &) = delete; +#else +#define CC_DISABLE_COPY(Class) \ +private: \ + Class(const Class &); \ + Class &operator =(const Class &); +#endif + /* * only certain compilers support __attribute__((deprecated)) */ @@ -244,6 +257,27 @@ public: virtual void set##funName(varType var) \ #define CC_DEPRECATED_ATTRIBUTE #endif +/* + * only certain compiler support __attribute__((format)) + * formatPos - 1-based position of format string argument + * argPos - 1-based position of first format-dependent argument + */ +#if defined(__GNUC__) && (__GNUC__ >= 4) +#define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) +#elif defined(__has_attribute) + #if __has_attribute(format) + #define CC_FORMAT_PRINTF(formatPos, argPos) __attribute__((__format__(printf, formatPos, argPos))) + #endif // __has_attribute(format) +#else +#define CC_FORMAT_PRINTF(formatPos, argPos) +#endif + +#if defined(_MSC_VER) +#define CC_FORMAT_PRINTF_SIZE_T "%08lX" +#else +#define CC_FORMAT_PRINTF_SIZE_T "%08zX" +#endif + #ifdef __GNUC__ #define CC_UNUSED __attribute__ ((unused)) #else diff --git a/cocos2dx/platform/CCSAXParser.cpp b/cocos2dx/platform/CCSAXParser.cpp index 6d16d9a678..d63f0a7007 100644 --- a/cocos2dx/platform/CCSAXParser.cpp +++ b/cocos2dx/platform/CCSAXParser.cpp @@ -105,7 +105,7 @@ bool CCSAXParser::init(const char *pszEncoding) bool CCSAXParser::parse(const char* pXMLData, unsigned int uDataLength) { tinyxml2::XMLDocument tinyDoc; - tinyDoc.Parse(pXMLData); + tinyDoc.Parse(pXMLData, uDataLength); XmlSaxHander printer; printer.setCCSAXParserImp(this); diff --git a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp index 9e54d9a8a4..2bcf2397ea 100644 --- a/cocos2dx/platform/android/CCFileUtilsAndroid.cpp +++ b/cocos2dx/platform/android/CCFileUtilsAndroid.cpp @@ -62,6 +62,11 @@ bool CCFileUtilsAndroid::init() bool CCFileUtilsAndroid::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + bool bFound = false; // Check whether file exists in apk. diff --git a/cocos2dx/platform/android/CCImage.cpp b/cocos2dx/platform/android/CCImage.cpp index 8518543d2e..85ef335620 100644 --- a/cocos2dx/platform/android/CCImage.cpp +++ b/cocos2dx/platform/android/CCImage.cpp @@ -28,18 +28,22 @@ THE SOFTWARE. #include "platform/CCImageCommon_cpp.h" #include "platform/CCPlatformMacros.h" #include "platform/CCImage.h" +#include "platform/CCFileUtils.h" #include "jni/JniHelper.h" #include #include #include +// prototype +void swapAlphaChannel(unsigned int *pImageMemory, unsigned int numPixels); NS_CC_BEGIN class BitmapDC { public: + BitmapDC() : m_pData(NULL) , m_nWidth(0) @@ -55,37 +59,74 @@ public: } } + bool getBitmapFromJavaShadowStroke( const char *text, + int nWidth, + int nHeight, + CCImage::ETextAlign eAlignMask, + const char * pFontName, + float fontSize, + float textTintR = 1.0, + float textTintG = 1.0, + float textTintB = 1.0, + bool shadow = false, + float shadowDeltaX = 0.0, + float shadowDeltaY = 0.0, + float shadowBlur = 0.0, + float shadowIntensity = 0.0, + bool stroke = false, + float strokeColorR = 0.0, + float strokeColorG = 0.0, + float strokeColorB = 0.0, + float strokeSize = 0.0 ) + { + JniMethodInfo methodInfo; + if (! JniHelper::getStaticMethodInfo(methodInfo, "org/cocos2dx/lib/Cocos2dxBitmap", "createTextBitmapShadowStroke", + "(Ljava/lang/String;Ljava/lang/String;IFFFIIIZFFFZFFFF)V")) + { + CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__); + return false; + } + + + + // Do a full lookup for the font path using CCFileUtils in case the given font name is a relative path to a font file asset, + // or the path has been mapped to a different location in the app package: + std::string fullPathOrFontName = CCFileUtils::sharedFileUtils()->fullPathForFilename(pFontName); + + // If the path name returned includes the 'assets' dir then that needs to be removed, because the android.content.Context + // requires this portion of the path to be omitted for assets inside the app package. + if (fullPathOrFontName.find("assets/") == 0) + { + fullPathOrFontName = fullPathOrFontName.substr(strlen("assets/")); // Chop out the 'assets/' portion of the path. + } + + /**create bitmap + * this method call Cococs2dx.createBitmap()(java code) to create the bitmap, the java code + * will call Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC() to init the width, height + * and data. + * use this approach to decrease the jni call number + */ + jstring jstrText = methodInfo.env->NewStringUTF(text); + jstring jstrFont = methodInfo.env->NewStringUTF(fullPathOrFontName.c_str()); + + methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, jstrText, + jstrFont, (int)fontSize, textTintR, textTintG, textTintB, eAlignMask, nWidth, nHeight, shadow, shadowDeltaX, -shadowDeltaY, shadowBlur, stroke, strokeColorR, strokeColorG, strokeColorB, strokeSize); + + methodInfo.env->DeleteLocalRef(jstrText); + methodInfo.env->DeleteLocalRef(jstrFont); + methodInfo.env->DeleteLocalRef(methodInfo.classID); + + return true; + } + + bool getBitmapFromJava(const char *text, int nWidth, int nHeight, CCImage::ETextAlign eAlignMask, const char * pFontName, float fontSize) { - JniMethodInfo methodInfo; - if (! JniHelper::getStaticMethodInfo(methodInfo, "org/cocos2dx/lib/Cocos2dxBitmap", "createTextBitmap", - "(Ljava/lang/String;Ljava/lang/String;IIII)V")) - { - CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__); - return false; - } - - /**create bitmap - * this method call Cococs2dx.createBitmap()(java code) to create the bitmap, the java code - * will call Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC() to init the width, height - * and data. - * use this approach to decrease the jni call number - */ - jstring jstrText = methodInfo.env->NewStringUTF(text); - jstring jstrFont = methodInfo.env->NewStringUTF(pFontName); - - methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, jstrText, - jstrFont, (int)fontSize, eAlignMask, nWidth, nHeight); - - methodInfo.env->DeleteLocalRef(jstrText); - methodInfo.env->DeleteLocalRef(jstrFont); - methodInfo.env->DeleteLocalRef(methodInfo.classID); - - return true; + return getBitmapFromJavaShadowStroke( text, nWidth, nHeight, eAlignMask, pFontName, fontSize ); } // ARGB -> RGBA - unsigned int swapAlpha(unsigned int value) + inline unsigned int swapAlpha(unsigned int value) { return ((value << 8 & 0xffffff00) | (value >> 24 & 0x000000ff)); } @@ -137,31 +178,102 @@ bool CCImage::initWithString( return bRet; } +bool CCImage::initWithStringShadowStroke( + const char * pText, + int nWidth , + int nHeight , + ETextAlign eAlignMask , + const char * pFontName , + int nSize , + float textTintR, + float textTintG, + float textTintB, + bool shadow, + float shadowOffsetX, + float shadowOffsetY, + float shadowOpacity, + float shadowBlur, + bool stroke, + float strokeR, + float strokeG, + float strokeB, + float strokeSize) +{ + bool bRet = false; + do + { + CC_BREAK_IF(! pText); + + BitmapDC &dc = sharedBitmapDC(); + + + CC_BREAK_IF(! dc.getBitmapFromJavaShadowStroke(pText, nWidth, nHeight, eAlignMask, pFontName, + nSize, textTintR, textTintG, textTintB, shadow, + shadowOffsetX, shadowOffsetY, shadowBlur, shadowOpacity, + stroke, strokeR, strokeG, strokeB, strokeSize )); + + + // assign the dc.m_pData to m_pData in order to save time + m_pData = dc.m_pData; + + CC_BREAK_IF(! m_pData); + + m_nWidth = (short)dc.m_nWidth; + m_nHeight = (short)dc.m_nHeight; + m_bHasAlpha = true; + m_bPreMulti = true; + m_nBitsPerComponent = 8; + + // swap the alpha channel (ARGB to RGBA) + swapAlphaChannel((unsigned int *)m_pData, (m_nWidth * m_nHeight) ); + + // ok + bRet = true; + + } while (0); + + return bRet; +} + NS_CC_END +// swap the alpha channel in an 32 bit image (from ARGB to RGBA) +void swapAlphaChannel(unsigned int *pImageMemory, unsigned int numPixels) +{ + for(int c = 0; c < numPixels; ++c, ++pImageMemory) + { + // copy the current pixel + unsigned int currenPixel = (*pImageMemory); + // swap channels and store back + char *pSource = (char *) ¤Pixel; + *pImageMemory = (pSource[0] << 24) | (pSource[3]<<16) | (pSource[2]<<8) | pSource[1]; + } +} + // this method is called by Cocos2dxBitmap extern "C" { /** * this method is called by java code to init width, height and pixels data */ - void Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC(JNIEnv* env, jobject thiz, int width, int height, jbyteArray pixels) + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxBitmap_nativeInitBitmapDC(JNIEnv* env, jobject thiz, int width, int height, jbyteArray pixels) { int size = width * height * 4; - cocos2d::sharedBitmapDC().m_nWidth = width; - cocos2d::sharedBitmapDC().m_nHeight = height; - cocos2d::sharedBitmapDC().m_pData = new unsigned char[size]; - env->GetByteArrayRegion(pixels, 0, size, (jbyte*)cocos2d::sharedBitmapDC().m_pData); + cocos2d::BitmapDC& bitmapDC = cocos2d::sharedBitmapDC(); + bitmapDC.m_nWidth = width; + bitmapDC.m_nHeight = height; + bitmapDC.m_pData = new unsigned char[size]; + env->GetByteArrayRegion(pixels, 0, size, (jbyte*)bitmapDC.m_pData); // swap data - unsigned int *tempPtr = (unsigned int*)cocos2d::sharedBitmapDC().m_pData; + unsigned int *tempPtr = (unsigned int*)bitmapDC.m_pData; unsigned int tempdata = 0; for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { tempdata = *tempPtr; - *tempPtr++ = cocos2d::sharedBitmapDC().swapAlpha(tempdata); + *tempPtr++ = bitmapDC.swapAlpha(tempdata); } } } diff --git a/cocos2dx/platform/android/java/.classpath b/cocos2dx/platform/android/java/.classpath index 3f9691c5dd..f7b8a1f99e 100644 --- a/cocos2dx/platform/android/java/.classpath +++ b/cocos2dx/platform/android/java/.classpath @@ -1,8 +1,9 @@ - + + diff --git a/cocos2dx/platform/android/java/project.properties b/cocos2dx/platform/android/java/project.properties index cd0ca122a3..4a46b9d1c9 100644 --- a/cocos2dx/platform/android/java/project.properties +++ b/cocos2dx/platform/android/java/project.properties @@ -12,4 +12,4 @@ android.library=true # Project target. -target=android-8 +target=android-17 diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index 7b6faae647..57aa11cc27 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -27,9 +27,11 @@ import org.cocos2dx.lib.Cocos2dxHelper.Cocos2dxHelperListener; import android.app.Activity; import android.content.Context; +import android.os.Build; import android.os.Bundle; import android.os.Message; import android.view.ViewGroup; +import android.util.Log; import android.widget.FrameLayout; public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelperListener { @@ -139,6 +141,10 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe // ...add to FrameLayout framelayout.addView(this.mGLSurfaceView); + // Switch to supported OpenGL (ARGB888) mode on emulator + if (isAndroidEmulator()) + this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0); + this.mGLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer()); this.mGLSurfaceView.setCocos2dxEditText(edittext); @@ -150,6 +156,19 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe return new Cocos2dxGLSurfaceView(this); } + private final static boolean isAndroidEmulator() { + String model = Build.MODEL; + Log.d(TAG, "model=" + model); + String product = Build.PRODUCT; + Log.d(TAG, "product=" + product); + boolean isEmulator = false; + if (product != null) { + isEmulator = product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_"); + } + Log.d(TAG, "isEmulator=" + isEmulator); + return isEmulator; + } + // =========================================================== // Inner and Anonymous Classes // =========================================================== diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java index 8ebefb10e3..fabb135263 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -80,7 +80,8 @@ public class Cocos2dxBitmap { // Methods // =========================================================== - private static native void nativeInitBitmapDC(final int pWidth, final int pHeight, final byte[] pPixels); + private static native void nativeInitBitmapDC(final int pWidth, + final int pHeight, final byte[] pPixels); /** * @param pWidth @@ -88,47 +89,124 @@ public class Cocos2dxBitmap { * @param pHeight * the height to draw, it can be 0 */ - public static void createTextBitmap(String pString, final String pFontName, final int pFontSize, final int pAlignment, final int pWidth, final int pHeight) { + public static void createTextBitmap(String pString, final String pFontName, + final int pFontSize, final int pAlignment, final int pWidth, + final int pHeight) { + + // + createTextBitmapShadowStroke( pString, pFontName, pFontSize, 1.0f, 1.0f, 1.0f, // text font and color + pAlignment, pWidth, pHeight, // alignment and size + false, 0.0f, 0.0f, 0.0f, // no shadow + false, 1.0f, 1.0f, 1.0f, 1.0f); // no stroke + + } + + public static void createTextBitmapShadowStroke(String pString, final String pFontName, final int pFontSize, + final float fontTintR, final float fontTintG, final float fontTintB, + final int pAlignment, final int pWidth, final int pHeight, final boolean shadow, + final float shadowDX, final float shadowDY, final float shadowBlur, final boolean stroke, + final float strokeR, final float strokeG, final float strokeB, final float strokeSize) { + + final int horizontalAlignment = pAlignment & 0x0F; - final int verticalAlignment = (pAlignment >> 4) & 0x0F; + final int verticalAlignment = (pAlignment >> 4) & 0x0F; pString = Cocos2dxBitmap.refactorString(pString); final Paint paint = Cocos2dxBitmap.newPaint(pFontName, pFontSize, horizontalAlignment); + + // set the paint color + paint.setARGB(255, (int)(255.0 * fontTintR), (int)(255.0 * fontTintG), (int)(255.0 * fontTintB)); final TextProperty textProperty = Cocos2dxBitmap.computeTextProperty(pString, pWidth, pHeight, paint); + final int bitmapTotalHeight = (pHeight == 0 ? textProperty.mTotalHeight: pHeight); + + // padding needed when using shadows (not used otherwise) + float bitmapPaddingX = 0.0f; + float bitmapPaddingY = 0.0f; + float renderTextDeltaX = 0.0f; + float renderTextDeltaY = 0.0f; + + if ( shadow ) { - final int bitmapTotalHeight = (pHeight == 0 ? textProperty.mTotalHeight : pHeight); - - final Bitmap bitmap = Bitmap.createBitmap(textProperty.mMaxWidth, bitmapTotalHeight, Bitmap.Config.ARGB_8888); + int shadowColor = 0xff7d7d7d; + paint.setShadowLayer(shadowBlur, shadowDX, shadowDY, shadowColor); + + bitmapPaddingX = Math.abs(shadowDX); + bitmapPaddingY = Math.abs(shadowDY); + + if ( shadowDX < 0.0 ) + { + renderTextDeltaX = bitmapPaddingX; + } + + if ( shadowDY < 0.0 ) + { + renderTextDeltaY = bitmapPaddingY; + } + } + + final Bitmap bitmap = Bitmap.createBitmap(textProperty.mMaxWidth + (int)bitmapPaddingX, + bitmapTotalHeight + (int)bitmapPaddingY, Bitmap.Config.ARGB_8888); + final Canvas canvas = new Canvas(bitmap); /* Draw string. */ final FontMetricsInt fontMetricsInt = paint.getFontMetricsInt(); + int x = 0; int y = Cocos2dxBitmap.computeY(fontMetricsInt, pHeight, textProperty.mTotalHeight, verticalAlignment); + final String[] lines = textProperty.mLines; + for (final String line : lines) { + x = Cocos2dxBitmap.computeX(line, textProperty.mMaxWidth, horizontalAlignment); - canvas.drawText(line, x, y, paint); + canvas.drawText(line, x + renderTextDeltaX, y + renderTextDeltaY, paint); y += textProperty.mHeightPerLine; + } - + + // draw again with stroke on if needed + if ( stroke ) { + + final Paint paintStroke = Cocos2dxBitmap.newPaint(pFontName, pFontSize, horizontalAlignment); + paintStroke.setStyle(Paint.Style.STROKE); + paintStroke.setStrokeWidth(strokeSize * 0.5f); + paintStroke.setARGB(255, (int)strokeR * 255, (int)strokeG * 255, (int)strokeB * 255); + + x = 0; + y = Cocos2dxBitmap.computeY(fontMetricsInt, pHeight, textProperty.mTotalHeight, verticalAlignment); + final String[] lines2 = textProperty.mLines; + + for (final String line : lines2) { + + x = Cocos2dxBitmap.computeX(line, textProperty.mMaxWidth, horizontalAlignment); + canvas.drawText(line, x + renderTextDeltaX, y + renderTextDeltaY, paintStroke); + y += textProperty.mHeightPerLine; + + } + + } + Cocos2dxBitmap.initNativeObject(bitmap); } - private static Paint newPaint(final String pFontName, final int pFontSize, final int pHorizontalAlignment) { + private static Paint newPaint(final String pFontName, final int pFontSize, + final int pHorizontalAlignment) { final Paint paint = new Paint(); paint.setColor(Color.WHITE); - paint.setTextSize(pFontSize); + paint.setTextSize(pFontSize); paint.setAntiAlias(true); /* Set type face for paint, now it support .ttf file. */ if (pFontName.endsWith(".ttf")) { try { - final Typeface typeFace = Cocos2dxTypefaces.get(Cocos2dxBitmap.sContext, pFontName); + final Typeface typeFace = Cocos2dxTypefaces.get( + Cocos2dxBitmap.sContext, pFontName); paint.setTypeface(typeFace); } catch (final Exception e) { - Log.e("Cocos2dxBitmap", "error to create ttf type face: " + pFontName); + Log.e("Cocos2dxBitmap", "error to create ttf type face: " + + pFontName); /* The file may not find, use system font. */ paint.setTypeface(Typeface.create(pFontName, Typeface.NORMAL)); @@ -138,27 +216,29 @@ public class Cocos2dxBitmap { } switch (pHorizontalAlignment) { - case HORIZONTALALIGN_CENTER: - paint.setTextAlign(Align.CENTER); - break; - case HORIZONTALALIGN_RIGHT: - paint.setTextAlign(Align.RIGHT); - break; - case HORIZONTALALIGN_LEFT: - default: - paint.setTextAlign(Align.LEFT); - break; + case HORIZONTALALIGN_CENTER: + paint.setTextAlign(Align.CENTER); + break; + case HORIZONTALALIGN_RIGHT: + paint.setTextAlign(Align.RIGHT); + break; + case HORIZONTALALIGN_LEFT: + default: + paint.setTextAlign(Align.LEFT); + break; } return paint; } - - private static TextProperty computeTextProperty(final String pString, final int pWidth, final int pHeight, final Paint pPaint) { + + private static TextProperty computeTextProperty(final String pString, + final int pWidth, final int pHeight, final Paint pPaint) { final FontMetricsInt fm = pPaint.getFontMetricsInt(); final int h = (int) Math.ceil(fm.bottom - fm.top); int maxContentWidth = 0; - final String[] lines = Cocos2dxBitmap.splitString(pString, pWidth, pHeight, pPaint); + final String[] lines = Cocos2dxBitmap.splitString(pString, pWidth, + pHeight, pPaint); if (pWidth != 0) { maxContentWidth = pWidth; @@ -166,7 +246,8 @@ public class Cocos2dxBitmap { /* Compute the max width. */ int temp = 0; for (final String line : lines) { - temp = (int) FloatMath.ceil(pPaint.measureText(line, 0, line.length())); + temp = (int) FloatMath.ceil(pPaint.measureText(line, 0, + line.length())); if (temp > maxContentWidth) { maxContentWidth = temp; } @@ -176,40 +257,44 @@ public class Cocos2dxBitmap { return new TextProperty(maxContentWidth, h, lines); } - private static int computeX(final String pText, final int pMaxWidth, final int pHorizontalAlignment) { + private static int computeX(final String pText, final int pMaxWidth, + final int pHorizontalAlignment) { int ret = 0; switch (pHorizontalAlignment) { - case HORIZONTALALIGN_CENTER: - ret = pMaxWidth / 2; - break; - case HORIZONTALALIGN_RIGHT: - ret = pMaxWidth; - break; - case HORIZONTALALIGN_LEFT: - default: - break; + case HORIZONTALALIGN_CENTER: + ret = pMaxWidth / 2; + break; + case HORIZONTALALIGN_RIGHT: + ret = pMaxWidth; + break; + case HORIZONTALALIGN_LEFT: + default: + break; } return ret; } - private static int computeY(final FontMetricsInt pFontMetricsInt, final int pConstrainHeight, final int pTotalHeight, final int pVerticalAlignment) { + private static int computeY(final FontMetricsInt pFontMetricsInt, + final int pConstrainHeight, final int pTotalHeight, + final int pVerticalAlignment) { int y = -pFontMetricsInt.top; if (pConstrainHeight > pTotalHeight) { switch (pVerticalAlignment) { - case VERTICALALIGN_TOP: - y = -pFontMetricsInt.top; - break; - case VERTICALALIGN_CENTER: - y = -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight) / 2; - break; - case VERTICALALIGN_BOTTOM: - y = -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight); - break; - default: - break; + case VERTICALALIGN_TOP: + y = -pFontMetricsInt.top; + break; + case VERTICALALIGN_CENTER: + y = -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight) + / 2; + break; + case VERTICALALIGN_BOTTOM: + y = -pFontMetricsInt.top + (pConstrainHeight - pTotalHeight); + break; + default: + break; } } @@ -217,9 +302,11 @@ public class Cocos2dxBitmap { } /* - * If maxWidth or maxHeight is not 0, split the string to fix the maxWidth and maxHeight. + * If maxWidth or maxHeight is not 0, split the string to fix the maxWidth + * and maxHeight. */ - private static String[] splitString(final String pString, final int pMaxWidth, final int pMaxHeight, final Paint pPaint) { + private static String[] splitString(final String pString, + final int pMaxWidth, final int pMaxHeight, final Paint pPaint) { final String[] lines = pString.split("\\n"); String[] ret = null; final FontMetricsInt fm = pPaint.getFontMetricsInt(); @@ -229,10 +316,15 @@ public class Cocos2dxBitmap { if (pMaxWidth != 0) { final LinkedList strList = new LinkedList(); for (final String line : lines) { - /* The width of line is exceed maxWidth, should divide it into two or more lines. */ - final int lineWidth = (int) FloatMath.ceil(pPaint.measureText(line)); + /* + * The width of line is exceed maxWidth, should divide it into + * two or more lines. + */ + final int lineWidth = (int) FloatMath.ceil(pPaint + .measureText(line)); if (lineWidth > pMaxWidth) { - strList.addAll(Cocos2dxBitmap.divideStringWithMaxWidth(line, pMaxWidth, pPaint)); + strList.addAll(Cocos2dxBitmap.divideStringWithMaxWidth( + line, pMaxWidth, pPaint)); } else { strList.add(line); } @@ -267,7 +359,8 @@ public class Cocos2dxBitmap { return ret; } - private static LinkedList divideStringWithMaxWidth(final String pString, final int pMaxWidth, final Paint pPaint) { + private static LinkedList divideStringWithMaxWidth( + final String pString, final int pMaxWidth, final Paint pPaint) { final int charLength = pString.length(); int start = 0; int tempWidth = 0; @@ -275,14 +368,16 @@ public class Cocos2dxBitmap { /* Break a String into String[] by the width & should wrap the word. */ for (int i = 1; i <= charLength; ++i) { - tempWidth = (int) FloatMath.ceil(pPaint.measureText(pString, start, i)); + tempWidth = (int) FloatMath.ceil(pPaint.measureText(pString, start, + i)); if (tempWidth >= pMaxWidth) { - final int lastIndexOfSpace = pString.substring(0, i).lastIndexOf(" "); + final int lastIndexOfSpace = pString.substring(0, i) + .lastIndexOf(" "); if (lastIndexOfSpace != -1 && lastIndexOfSpace > start) { /* Should wrap the word. */ strList.add(pString.substring(start, lastIndexOfSpace)); - i = lastIndexOfSpace; + i = lastIndexOfSpace + 1; // skip space } else { /* Should not exceed the width. */ if (tempWidth > pMaxWidth) { @@ -295,7 +390,7 @@ public class Cocos2dxBitmap { } /* Remove spaces at the beginning of a new line. */ - while (pString.indexOf(i) == ' ') { + while (pString.charAt(i) == ' ') { ++i; } @@ -318,7 +413,8 @@ public class Cocos2dxBitmap { } /* - * If the font of "\n" is "" or "\n", insert " " in front of it. For example: "\nabc" -> " \nabc" "\nabc\n\n" -> " \nabc\n \n". + * If the font of "\n" is "" or "\n", insert " " in front of it. For + * example: "\nabc" -> " \nabc" "\nabc\n\n" -> " \nabc\n \n". */ final StringBuilder strBuilder = new StringBuilder(pString); int start = 0; @@ -347,12 +443,14 @@ public class Cocos2dxBitmap { return; } - Cocos2dxBitmap.nativeInitBitmapDC(pBitmap.getWidth(), pBitmap.getHeight(), pixels); + Cocos2dxBitmap.nativeInitBitmapDC(pBitmap.getWidth(), + pBitmap.getHeight(), pixels); } private static byte[] getPixels(final Bitmap pBitmap) { if (pBitmap != null) { - final byte[] pixels = new byte[pBitmap.getWidth() * pBitmap.getHeight() * 4]; + final byte[] pixels = new byte[pBitmap.getWidth() + * pBitmap.getHeight() * 4]; final ByteBuffer buf = ByteBuffer.wrap(pixels); buf.order(ByteOrder.nativeOrder()); pBitmap.copyPixelsToBuffer(buf); @@ -386,7 +484,8 @@ public class Cocos2dxBitmap { return incr_text_size; } - private static String getStringWithEllipsis(String pString, float width, float fontSize) { + private static String getStringWithEllipsis(String pString, float width, + float fontSize) { if (TextUtils.isEmpty(pString)) { return ""; } @@ -395,7 +494,8 @@ public class Cocos2dxBitmap { paint.setTypeface(Typeface.DEFAULT); paint.setTextSize(fontSize); - return TextUtils.ellipsize(pString, paint, width, TextUtils.TruncateAt.END).toString(); + return TextUtils.ellipsize(pString, paint, width, + TextUtils.TruncateAt.END).toString(); } // =========================================================== @@ -410,7 +510,8 @@ public class Cocos2dxBitmap { private final int mHeightPerLine; private final String[] mLines; - TextProperty(final int pMaxWidth, final int pHeightPerLine, final String[] pLines) { + TextProperty(final int pMaxWidth, final int pHeightPerLine, + final String[] pLines) { this.mMaxWidth = pMaxWidth; this.mHeightPerLine = pHeightPerLine; this.mTotalHeight = pHeightPerLine * pLines.length; diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxETCLoader.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxETCLoader.java new file mode 100644 index 0000000000..a21cd23af2 --- /dev/null +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxETCLoader.java @@ -0,0 +1,104 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + ****************************************************************************/ +package org.cocos2dx.lib; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import android.content.Context; +import android.content.res.AssetManager; +import android.opengl.ETC1Util; +import android.util.Log; + +public class Cocos2dxETCLoader { + private static final String ASSETS_PATH = "assets/"; + private static Context context; + + public static boolean loadTexture(String filePath) { + if (! ETC1Util.isETC1Supported()) { + return false; + } + + if (filePath.length() == 0) { + return false; + } + + // Create ETC1Texture + InputStream inputStream = null; + ETC1Util.ETC1Texture texture = null; + AssetManager assetManager = null; + try { + if (filePath.charAt(0) == '/') { + // absolute path + inputStream = new FileInputStream(filePath); + } else { + // remove prefix: "assets/" + if (filePath.startsWith(ASSETS_PATH)) { + filePath = filePath.substring(ASSETS_PATH.length()); + } + assetManager = context.getAssets(); + inputStream = assetManager.open(filePath); + } + + texture = ETC1Util.createTexture(inputStream); + inputStream.close(); + assetManager.close(); + } catch (Exception e) { + Log.d("Cocos2dx", "Unable to create texture for " + filePath); + + texture = null; + } + + if (texture != null) { + try { + int width = texture.getWidth(); + int height = texture.getHeight(); + + final byte[] data = new byte[width * height * 3]; + final ByteBuffer buf = ByteBuffer.wrap(data); + buf.order(ByteOrder.nativeOrder()); + buf.put(texture.getData()); + + nativeSetTextureInfo(width, + height, + data); + } catch (Exception e) + { + Log.d("invoke native function error", e.toString()); + } + + return true; + } else { + return false; + } + } + + public static void setContext(Context context) { + Cocos2dxETCLoader.context = context; + } + + private static native void nativeSetTextureInfo(final int width, final int height, final byte[] data); +} diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java index 3451975868..731f7e3289 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java @@ -176,7 +176,7 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView { } }); - super.onPause(); + //super.onPause(); } @Override diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java index 14cad86662..f4459f5e44 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -75,6 +75,7 @@ public class Cocos2dxHelper { Cocos2dxHelper.sCocos2dSound = new Cocos2dxSound(pContext); Cocos2dxHelper.sAssetManager = pContext.getAssets(); Cocos2dxBitmap.setContext(pContext); + Cocos2dxETCLoader.setContext(pContext); } // =========================================================== diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxTypefaces.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxTypefaces.java index 901b38153b..b7495fba90 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxTypefaces.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxTypefaces.java @@ -57,7 +57,15 @@ public class Cocos2dxTypefaces { public static synchronized Typeface get(final Context pContext, final String pAssetName) { if (!Cocos2dxTypefaces.sTypefaceCache.containsKey(pAssetName)) { - final Typeface typeface = Typeface.createFromAsset(pContext.getAssets(), pAssetName); + Typeface typeface = null; + if (pAssetName.startsWith("/")) + { + typeface = Typeface.createFromFile(pAssetName); + } + else + { + typeface = Typeface.createFromAsset(pContext.getAssets(), pAssetName); + } Cocos2dxTypefaces.sTypefaceCache.put(pAssetName, typeface); } diff --git a/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index 15106a226f..2aef591747 100644 --- a/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -165,7 +165,7 @@ void enableAccelerometerJNI() { void setAccelerometerIntervalJNI(float interval) { JniMethodInfo t; - if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setAccelerometerInterval", "(I)V")) { + if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setAccelerometerInterval", "(F)V")) { t.env->CallStaticVoidMethod(t.classID, t.methodID, interval); t.env->DeleteLocalRef(t.classID); } diff --git a/cocos2dx/platform/android/jni/TouchesJni.cpp b/cocos2dx/platform/android/jni/TouchesJni.cpp index 056d21c1b6..357da6f8d1 100644 --- a/cocos2dx/platform/android/jni/TouchesJni.cpp +++ b/cocos2dx/platform/android/jni/TouchesJni.cpp @@ -34,15 +34,15 @@ THE SOFTWARE. using namespace cocos2d; extern "C" { - void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) { + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) { cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y); } - void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) { + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) { cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y); } - void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { int size = env->GetArrayLength(ids); jint id[size]; jfloat x[size]; @@ -55,7 +55,7 @@ extern "C" { cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesMove(size, id, x, y); } - void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) { int size = env->GetArrayLength(ids); jint id[size]; jfloat x[size]; @@ -71,7 +71,7 @@ extern "C" { #define KEYCODE_BACK 0x04 #define KEYCODE_MENU 0x52 - jboolean Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown(JNIEnv * env, jobject thiz, jint keyCode) { + JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown(JNIEnv * env, jobject thiz, jint keyCode) { CCDirector* pDirector = CCDirector::sharedDirector(); switch (keyCode) { case KEYCODE_BACK: diff --git a/cocos2dx/platform/blackberry/CCCommon.cpp b/cocos2dx/platform/blackberry/CCCommon.cpp index 9d0a7d30ee..ca439911eb 100644 --- a/cocos2dx/platform/blackberry/CCCommon.cpp +++ b/cocos2dx/platform/blackberry/CCCommon.cpp @@ -30,20 +30,28 @@ NS_CC_BEGIN void CCLog(const char * pszFormat, ...) { - char buf[MAX_LEN]; + char szBuf[MAX_LEN]; va_list args; - va_start(args, pszFormat); - vsnprintf(buf, MAX_LEN, pszFormat, args); + va_start(args, pszFormat); + vsnprintf(szBuf, MAX_LEN, pszFormat, args); va_end(args); - - fprintf(stderr, "cocos2d-x debug info %s\n", buf); + + // Strip any trailing newlines from log message. + size_t len = strlen(szBuf); + while (len && szBuf[len-1] == '\n') + { + szBuf[len-1] = '\0'; + len--; + } + + fprintf(stderr, "cocos2d-x debug info %s\n", szBuf); } void CCMessageBox(const char * pszMsg, const char * pszTitle) { -// MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); - CCLog(pszMsg); + //MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); + CCLog("%s", pszMsg); } void CCLuaLog(const char * pszFormat) @@ -52,4 +60,3 @@ void CCLuaLog(const char * pszFormat) } NS_CC_END - diff --git a/cocos2dx/platform/blackberry/CCFileUtilsBlackberry.cpp b/cocos2dx/platform/blackberry/CCFileUtilsBlackberry.cpp index 9589f561ef..04770ec350 100644 --- a/cocos2dx/platform/blackberry/CCFileUtilsBlackberry.cpp +++ b/cocos2dx/platform/blackberry/CCFileUtilsBlackberry.cpp @@ -53,6 +53,11 @@ bool CCFileUtilsBlackberry::isAbsolutePath(const std::string& strPath) bool CCFileUtilsBlackberry::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + std::string strPath = strFilePath; if (strPath[0] != '/') { // Not absolute path, add the default root path at the beginning. diff --git a/cocos2dx/platform/blackberry/CCImage.cpp b/cocos2dx/platform/blackberry/CCImage.cpp index ce7d662d09..3137f89a49 100755 --- a/cocos2dx/platform/blackberry/CCImage.cpp +++ b/cocos2dx/platform/blackberry/CCImage.cpp @@ -259,12 +259,12 @@ public: return false; } do { - //CCLog("\n\n ---- FT_New_Face with pFontName = %s\n", pFontName); + //CCLog(" ---- FT_New_Face with pFontName = %s", pFontName); iError = FT_New_Face( library, pFontName, 0, &face ); if (iError) { //no valid font found use default - //CCLog("\n\n ---- no valid font, use default %s\n", pFontName); + //CCLog(" ---- no valid font, use default %s", pFontName); iError = FT_New_Face( library, "/usr/fonts/font_repository/monotype/arial.ttf", 0, &face ); } CC_BREAK_IF(iError); @@ -418,7 +418,7 @@ bool CCImage::initWithString( //CCLog("-----pText=%s and Font File is %s nWidth= %d,nHeight=%d",pText,fullFontName.c_str(),nWidth,nHeight); CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, fullFontName.c_str(), nSize)); - //CCLog("---- dc.getBitmap is Succesfull... \n"); + //CCLog("---- dc.getBitmap is Succesfull..."); // assign the dc.m_pData to m_pData in order to save time m_pData = dc.m_pData; diff --git a/cocos2dx/platform/emscripten/CCAccelerometer.h b/cocos2dx/platform/emscripten/CCAccelerometer.h new file mode 100644 index 0000000000..0a738fc5de --- /dev/null +++ b/cocos2dx/platform/emscripten/CCAccelerometer.h @@ -0,0 +1,31 @@ +/* + * CCAccelerometer.h + * + * Created on: Aug 9, 2011 + * Author: laschweinski + */ + +#ifndef CCACCELEROMETER_H_ +#define CCACCELEROMETER_H_ + +#include "platform/CCAccelerometerDelegate.h" + +namespace cocos2d { + +class CCAccelerometer +{ +public: + CCAccelerometer(){} + ~CCAccelerometer(){} + + static CCAccelerometer* sharedAccelerometer() { return NULL; }; + + void removeDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void addDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void setDelegate(CCAccelerometerDelegate* pDelegate) {CC_UNUSED_PARAM(pDelegate);}; + void setAccelerometerInterval(float interval) {CC_UNUSED_PARAM(interval);}; +}; + +}//namespace cocos2d + +#endif /* CCACCELEROMETER_H_ */ diff --git a/cocos2dx/platform/emscripten/CCApplication.cpp b/cocos2dx/platform/emscripten/CCApplication.cpp new file mode 100644 index 0000000000..0e59fc5bdb --- /dev/null +++ b/cocos2dx/platform/emscripten/CCApplication.cpp @@ -0,0 +1,107 @@ +#include "CCApplication.h" +#include "platform/CCFileUtils.h" +#include "CCDirector.h" +#include "CCEGLView.h" +#include +#include +#include + +#include + +#define LOGD(...) fprintf(stderr, __VA_ARGS__) + +NS_CC_BEGIN; + +// sharedApplication pointer +CCApplication * CCApplication::sm_pSharedApplication = 0; +long CCApplication::m_animationInterval = 1000; + +// convert the timespec into milliseconds +static long time2millis(struct timespec *times) +{ + return times->tv_sec*1000 + times->tv_nsec/1000000; +} + +CCApplication::CCApplication() +{ + CC_ASSERT(! sm_pSharedApplication); + sm_pSharedApplication = this; +} + +CCApplication::~CCApplication() +{ + CC_ASSERT(this == sm_pSharedApplication); + sm_pSharedApplication = NULL; +} + + +extern "C" void mainLoopIter(void) +{ + CCEGLView::sharedOpenGLView()->handleEvents(); + CCDirector::sharedDirector()->mainLoop(); +} + +int CCApplication::run() +{ + struct timespec time_struct; + long update_time; + + // Initialize instance and cocos2d. + if (!applicationDidFinishLaunching()) + { + return 0; + } + + clock_gettime(CLOCK_REALTIME, &time_struct); + update_time = time2millis(&time_struct); + + // XXX: Set to 1FPS while debugging + emscripten_set_main_loop(&mainLoopIter, 0, 1); + + return -1; +} + +void CCApplication::setAnimationInterval(double interval) +{ + // interval in milliseconds + m_animationInterval = (long)(interval * 1000); +} + +void CCApplication::setResourceRootPath(const std::string& rootResDir) +{ + m_resourceRootPath = rootResDir; + if (m_resourceRootPath[m_resourceRootPath.length() - 1] != '/') + { + m_resourceRootPath += '/'; + } + CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils(); + std::vector searchPaths = pFileUtils->getSearchPaths(); + searchPaths.insert(searchPaths.begin(), m_resourceRootPath); + pFileUtils->setSearchPaths(searchPaths); +} + +const std::string& CCApplication::getResourceRootPath(void) +{ + return m_resourceRootPath; +} + +TargetPlatform CCApplication::getTargetPlatform() +{ + return kTargetEmscripten; +} + +////////////////////////////////////////////////////////////////////////// +// static member function +////////////////////////////////////////////////////////////////////////// +CCApplication* CCApplication::sharedApplication() +{ + CC_ASSERT(sm_pSharedApplication); + return sm_pSharedApplication; +} + +ccLanguageType CCApplication::getCurrentLanguage() +{ + return kLanguageEnglish; +} + +NS_CC_END; diff --git a/cocos2dx/platform/emscripten/CCApplication.h b/cocos2dx/platform/emscripten/CCApplication.h new file mode 100644 index 0000000000..9994fccfe9 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCApplication.h @@ -0,0 +1,68 @@ +#ifndef __CC_APPLICATION_BLACKBERRY_H__ +#define __CC_APPLICATION_BLACKBERRY_H__ + +#include "platform/CCCommon.h" +#include "platform/CCApplicationProtocol.h" +#include +NS_CC_BEGIN; + +class CCRect; + +class CC_DLL CCApplication : public CCApplicationProtocol +{ +public: + CCApplication(); + virtual ~CCApplication(); + + /** + @brief Callback by CCDirector for limit FPS. + @interval The time, which expressed in second in second, between current frame and next. + */ + void setAnimationInterval(double interval); + + /** + @brief Run the message loop. + */ + int run(); + + /** + @brief Get current applicaiton instance. + @return Current application instance pointer. + */ + static CCApplication* sharedApplication(); + + /** + @brief Get current language config + @return Current language config + */ + virtual ccLanguageType getCurrentLanguage(); + + /** + @brief Get target platform + */ + virtual TargetPlatform getTargetPlatform(); + + + /** + * Sets the Resource root path. + * @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead. + */ + CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir); + + /** + * Gets the Resource root path. + * @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead. + */ + CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); + + + +protected: + static CCApplication * sm_pSharedApplication; + std::string m_resourceRootPath; + static long m_animationInterval; +}; + +NS_CC_END + +#endif // __CC_APPLICATION_BLACKBERRY_H__ diff --git a/cocos2dx/platform/emscripten/CCCommon.cpp b/cocos2dx/platform/emscripten/CCCommon.cpp new file mode 100644 index 0000000000..9d0a7d30ee --- /dev/null +++ b/cocos2dx/platform/emscripten/CCCommon.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "platform/CCCommon.h" +#include "CCStdC.h" + +NS_CC_BEGIN + +#define MAX_LEN (cocos2d::kMaxLogLen + 1) + +void CCLog(const char * pszFormat, ...) +{ + char buf[MAX_LEN]; + + va_list args; + va_start(args, pszFormat); + vsnprintf(buf, MAX_LEN, pszFormat, args); + va_end(args); + + fprintf(stderr, "cocos2d-x debug info %s\n", buf); +} + +void CCMessageBox(const char * pszMsg, const char * pszTitle) +{ +// MessageBoxA(NULL, pszMsg, pszTitle, MB_OK); + CCLog(pszMsg); +} + +void CCLuaLog(const char * pszFormat) +{ + puts(pszFormat); +} + +NS_CC_END + diff --git a/cocos2dx/platform/emscripten/CCDevice.cpp b/cocos2dx/platform/emscripten/CCDevice.cpp new file mode 100644 index 0000000000..f43aab59f3 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCDevice.cpp @@ -0,0 +1,10 @@ +#include "platform/CCDevice.h" + +NS_CC_BEGIN + +int CCDevice::getDPI() +{ + return 160; +} + +NS_CC_END diff --git a/cocos2dx/platform/emscripten/CCEGLView.cpp b/cocos2dx/platform/emscripten/CCEGLView.cpp new file mode 100644 index 0000000000..892fd8f372 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCEGLView.cpp @@ -0,0 +1,383 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCEGLView.h" +#include "cocoa/CCSet.h" +#include "CCDirector.h" +#include "ccMacros.h" +#include "touch_dispatcher/CCTouch.h" +#include "touch_dispatcher/CCTouchDispatcher.h" +#include "text_input_node/CCIMEDispatcher.h" +#include "keypad_dispatcher/CCKeypadDispatcher.h" +#include "CCGL.h" +#include "CCAccelerometer.h" +#include "CCApplication.h" + +#include +#include +#include + +#include + +#include + +extern "C" { +void glutInit(int *argcp, char **argv); +void glutMouseFunc(void (*func)(int button, int state, int x, int y)); +void glutMotionFunc(void (*func)(int x, int y)); +void glutPassiveMotionFunc(void (*func)(int x, int y)); +} + +// Constants for mouse events (inferred from experiment) +static const int glutLeftButton = 0; +static const int glutMouseDown = 0; +static const int glutMouseUp = 1; + +NS_CC_BEGIN + +bool CCEGLView::m_initializedFunctions = false; +const GLubyte *CCEGLView::m_extensions = 0; + +enum Orientation +{ + PORTRAIT, + LANDSCAPE, + AUTO +}; + +static Orientation orientation = LANDSCAPE; + +#define MAX_TOUCHES 4 +static CCEGLView* s_pInstance = NULL; + +static bool buttonDepressed = false; +extern "C" void mouseCB(int button, int state, int x, int y) +{ + float fx = x; + float fy = y; + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + int id = 0; + + if(button != glutLeftButton) return; + + if(state == glutMouseDown) + { + pEGLView->handleTouchesBegin(1, &id, &fx, &fy); + buttonDepressed = true; + } + else if(state == glutMouseUp) + { + pEGLView->handleTouchesEnd(1, &id, &fx, &fy); + buttonDepressed = false; + } +} + +extern "C" void motionCB(int x, int y) +{ + float fx = x; + float fy = y; + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + int id = 0; + + if(buttonDepressed) + { + pEGLView->handleTouchesMove(1, &id, &fx, &fy); + } +} + +CCEGLView::CCEGLView() +{ + m_eglDisplay = EGL_NO_DISPLAY; + m_eglContext = EGL_NO_CONTEXT; + m_eglSurface = EGL_NO_SURFACE; + + strcpy(m_windowGroupID, ""); + snprintf(m_windowGroupID, sizeof(m_windowGroupID), "%d", 1); + + m_isGLInitialized = initGL(); + + if (m_isGLInitialized) + initEGLFunctions(); + + // Initialize SDL: used for font rendering, sprite loading and audio + // playing. + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO); + + // Emscripten ignores all these values. + Mix_OpenAudio(0, 0, 0, 0); + TTF_Init(); + + char *arg1 = (char*)malloc(1); + char **dummyArgv = (char**)malloc(sizeof(char*)); + dummyArgv[0] = arg1; + glutInit(0, dummyArgv); + free(dummyArgv[0]); + free(dummyArgv); + + glutMouseFunc(&mouseCB); + glutMotionFunc(&motionCB); + glutPassiveMotionFunc(&motionCB); +} + +CCEGLView::~CCEGLView() +{ +} + +const char* CCEGLView::getWindowGroupId() const +{ + return m_windowGroupID; +} + +void CCEGLView::release() +{ + if (m_eglDisplay != EGL_NO_DISPLAY) + { + eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + } + + if (m_eglSurface != EGL_NO_SURFACE) + { + eglDestroySurface(m_eglDisplay, m_eglSurface); + m_eglSurface = EGL_NO_SURFACE; + } + + if (m_eglContext != EGL_NO_CONTEXT) + { + eglDestroyContext(m_eglDisplay, m_eglContext); + m_eglContext = EGL_NO_CONTEXT; + } + + if (m_eglDisplay != EGL_NO_DISPLAY) + { + eglTerminate(m_eglDisplay); + m_eglDisplay = EGL_NO_DISPLAY; + } + + m_isGLInitialized = false; + + exit(0); +} + +void CCEGLView::initEGLFunctions() +{ + m_extensions = glGetString(GL_EXTENSIONS); + m_initializedFunctions = true; +} + +bool CCEGLView::isOpenGLReady() +{ + return (m_isGLInitialized && m_obScreenSize.height != 0 && m_obScreenSize.width != 0); +} + +void CCEGLView::end() +{ + release(); +} + +void CCEGLView::swapBuffers() +{ + eglSwapBuffers(m_eglDisplay, m_eglSurface); +} + +CCEGLView* CCEGLView::sharedOpenGLView() +{ + if (!s_pInstance) + { + s_pInstance = new CCEGLView(); + } + + CCAssert(s_pInstance != NULL, "CCEGLView wasn't constructed yet"); + return s_pInstance; +} + +void CCEGLView::showKeyboard() +{ +} + +void CCEGLView::hideKeyboard() +{ +} + +void CCEGLView::setIMEKeyboardState(bool bOpen) +{ +} + +bool CCEGLView::isGLExtension(const char *searchName) const +{ + const GLubyte *start; + GLubyte *where, *terminator; + + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = m_extensions; + for (;;) + { + where = (GLubyte *) strstr((const char *) start, searchName); + if (!where) + break; + + terminator = where + strlen(searchName); + if (where == start || *(where - 1) == ' ') + if (*terminator == ' ' || *terminator == '\0') + return true; + + start = terminator; + } + + return false; +} + + +static EGLenum checkErrorEGL(const char* msg) +{ + assert(msg); + static const char* errmsg[] = + { + "EGL function succeeded", + "EGL is not initialized, or could not be initialized, for the specified display", + "EGL cannot access a requested resource", + "EGL failed to allocate resources for the requested operation", + "EGL fail to access an unrecognized attribute or attribute value was passed in an attribute list", + "EGLConfig argument does not name a valid EGLConfig", + "EGLContext argument does not name a valid EGLContext", + "EGL current surface of the calling thread is no longer valid", + "EGLDisplay argument does not name a valid EGLDisplay", + "EGL arguments are inconsistent", + "EGLNativePixmapType argument does not refer to a valid native pixmap", + "EGLNativeWindowType argument does not refer to a valid native window", + "EGL one or more argument values are invalid", + "EGLSurface argument does not name a valid surface configured for rendering", + "EGL power management event has occurred", + }; + EGLenum error = eglGetError(); + fprintf(stderr, "%s: %s\n", msg, errmsg[error - EGL_SUCCESS]); + return error; +} + +bool CCEGLView::initGL() +{ + EGLint eglConfigCount; + EGLConfig config; + + // Hard-coded to 32-bit/OpenGL ES 2.0. + const EGLint eglConfigAttrs[] = + { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 24, + EGL_STENCIL_SIZE, 8, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE + }; + + const EGLint eglContextAttrs[] = + { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + const EGLint eglSurfaceAttrs[] = + { + EGL_RENDER_BUFFER, EGL_BACK_BUFFER, + EGL_NONE + }; + + // Get the EGL display and initialize. + m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (m_eglDisplay == EGL_NO_DISPLAY) + { + perror("eglGetDisplay"); + return false; + } + + if (eglInitialize(m_eglDisplay, NULL, NULL) != EGL_TRUE) + { + perror("eglInitialize"); + return false; + } + + if (eglChooseConfig(m_eglDisplay, eglConfigAttrs, &config, 1, &eglConfigCount) != EGL_TRUE || eglConfigCount == 0) + { + checkErrorEGL("eglChooseConfig"); + return false; + } + + m_eglContext = eglCreateContext(m_eglDisplay, config, EGL_NO_CONTEXT, eglContextAttrs); + if (m_eglContext == EGL_NO_CONTEXT) + { + checkErrorEGL("eglCreateContext"); + return false; + } + + m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, NULL, eglSurfaceAttrs); + if (m_eglSurface == EGL_NO_SURFACE) + { + checkErrorEGL("eglCreateWindowSurface"); + return false; + } + + if (eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext) != EGL_TRUE) + { + checkErrorEGL("eglMakeCurrent"); + return false; + } + + // FIXME: Get the actual canvas size somehow. + EGLint width; + EGLint height; + + if ((m_eglDisplay == EGL_NO_DISPLAY) || (m_eglSurface == EGL_NO_SURFACE) ) + return EXIT_FAILURE; + + eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_WIDTH, &width); + eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &height); + + m_obScreenSize.width = width; + m_obScreenSize.height = height; + + glViewport(0, 0, width, height); + + // Default the frame size to be the whole canvas. In general we want to be + // setting the size of the viewport by adjusting the canvas size (so + // there's no weird letterboxing). + setFrameSize(width, height); + + return true; +} + +static long time2millis(struct timespec *times) +{ + return times->tv_sec*1000 + times->tv_nsec/1000000; +} + +bool CCEGLView::handleEvents() +{ + return true; +} + +NS_CC_END diff --git a/cocos2dx/platform/emscripten/CCEGLView.h b/cocos2dx/platform/emscripten/CCEGLView.h new file mode 100644 index 0000000000..5d8302f4d3 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCEGLView.h @@ -0,0 +1,83 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CC_EGLVIEW_BLACKBERRY_H__ +#define __CC_EGLVIEW_BLACKBERRY_H__ + +#include "cocoa/CCGeometry.h" +#include "platform/CCEGLViewProtocol.h" +#include "platform/CCPlatformMacros.h" + +//#include + +NS_CC_BEGIN + +class CC_DLL CCEGLView : public CCEGLViewProtocol +{ +public: + CCEGLView(); + virtual ~CCEGLView(); + + bool isOpenGLReady(); + + const char* getWindowGroupId() const; + + // keep compatible + void end(); + void swapBuffers(); + void setIMEKeyboardState(bool bOpen); + + // static function + /** + @brief get the shared main open gl window + */ + static CCEGLView* sharedOpenGLView(); + + bool handleEvents(); + +private: + void release(); + + bool initGL(); + void initEGLFunctions(); + bool isGLExtension(const char *searchName) const; + bool initDriver(); + void showKeyboard(); + void hideKeyboard(); + + static bool m_initializedFunctions; + static const GLubyte *m_extensions; + + bool m_isGLInitialized; + bool m_isWindowActive; + + EGLDisplay m_eglDisplay; + EGLContext m_eglContext; + EGLSurface m_eglSurface; + char m_windowGroupID[16]; +}; + +NS_CC_END + +#endif // end of __CC_EGLVIEW_QNX_H__ diff --git a/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.cpp b/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.cpp new file mode 100644 index 0000000000..6d0efb830b --- /dev/null +++ b/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.cpp @@ -0,0 +1,68 @@ +#include "CCFileUtilsEmscripten.h" +#include "platform/CCCommon.h" +#include "ccMacros.h" +#include "CCApplication.h" +#include "cocoa/CCString.h" +#include + +using namespace std; + +NS_CC_BEGIN + +CCFileUtils* CCFileUtils::sharedFileUtils() +{ + if (s_sharedFileUtils == NULL) + { + s_sharedFileUtils = new CCFileUtilsEmscripten(); + s_sharedFileUtils->init(); + } + return s_sharedFileUtils; +} + +CCFileUtilsEmscripten::CCFileUtilsEmscripten() +{} + +bool CCFileUtilsEmscripten::init() +{ + m_strDefaultResRootPath = "app/native/Resources/"; + return CCFileUtils::init(); +} + +string CCFileUtilsEmscripten::getWritablePath() +{ + // Let's write it in the current working directory's data folder + char cwd[FILENAME_MAX] = {0}; + + getcwd(cwd, FILENAME_MAX - 1); + cwd[FILENAME_MAX-1] = '\0'; + + std::string path = cwd; + path += "/data/"; + + return path; +} + +bool CCFileUtilsEmscripten::isAbsolutePath(const std::string& strPath) +{ + if (strPath[0] == '/' || strPath.find(m_strDefaultResRootPath) == 0) + { + return true; + } + return false; +} + +bool CCFileUtilsEmscripten::isFileExist(const std::string& strFilePath) +{ + std::string strPath = strFilePath; + if (strPath[0] != '/') + { // Not absolute path, add the default root path at the beginning. + if (strPath.find(m_strDefaultResRootPath) != 0) + {// Didn't find "assets/" at the beginning of the path, adding it. + strPath.insert(0, m_strDefaultResRootPath); + } + } + + return access(strPath.c_str(), F_OK) != -1 ? true : false; +} + +NS_CC_END diff --git a/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.h b/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.h new file mode 100644 index 0000000000..7f2eca3b7f --- /dev/null +++ b/cocos2dx/platform/emscripten/CCFileUtilsEmscripten.h @@ -0,0 +1,60 @@ +/**************************************************************************** + Copyright (c) 2010-2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#ifndef __CC_FILEUTILS_BLACKBERRY_H__ +#define __CC_FILEUTILS_BLACKBERRY_H__ + +#include "platform/CCFileUtils.h" +#include "platform/CCPlatformMacros.h" +#include "ccTypes.h" +#include "ccTypeInfo.h" +#include +#include + +NS_CC_BEGIN + +/** + * @addtogroup platform + * @{ + */ + +//! @brief Helper class to handle file operations +class CC_DLL CCFileUtilsEmscripten : public CCFileUtils +{ + friend class CCFileUtils; + CCFileUtilsEmscripten(); +public: + /* override funtions */ + bool init(); + virtual std::string getWritablePath(); + virtual bool isFileExist(const std::string& strFilePath); + virtual bool isAbsolutePath(const std::string& strPath); +}; + +// end of platform group +/// @} + +NS_CC_END + +#endif // __CC_FILEUTILS_BLACKBERRY_H__ + diff --git a/cocos2dx/platform/emscripten/CCGL.h b/cocos2dx/platform/emscripten/CCGL.h new file mode 100644 index 0000000000..ce553db8d1 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCGL.h @@ -0,0 +1,49 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCGL_H__ +#define __CCGL_H__ + +#define glClearDepth glClearDepthf +#define GL_BGRA GL_BGRA_EXT + +#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES +#define GL_WRITE_ONLY GL_WRITE_ONLY_OES + +#include +//#include + +// normal process +#include +#include + +//declare here while define in CCEGLView.cpp +extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays; +extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray; +extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; +extern PFNGLMAPBUFFEROESPROC glMapBuffer; +extern PFNGLUNMAPBUFFEROESPROC glUnmapBuffer; +extern PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointerv; + +#endif // __CCGL_H__ diff --git a/cocos2dx/platform/emscripten/CCImage.cpp b/cocos2dx/platform/emscripten/CCImage.cpp new file mode 100644 index 0000000000..029e46963f --- /dev/null +++ b/cocos2dx/platform/emscripten/CCImage.cpp @@ -0,0 +1,306 @@ +/**************************************************************************** + Copyright (c) 2010 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#define __CC_PLATFORM_IMAGE_CPP__ +#include "platform/CCImageCommon_cpp.h" + +#include +#include +#include +#include +#include +#include "platform/CCImage.h" +#include "platform/CCFileUtils.h" +#include "platform/CCCommon.h" +#include "CCStdC.h" +#include +#include +#include +#include + +#define szFont_kenning 2 + +#define RSHIFT6(num) ((num)>>6) + +using namespace std; + +struct TextLine { + std::string sLineStr; + int iLineWidth; +}; + +NS_CC_BEGIN + +class BitmapDC +{ +public: + BitmapDC() + { + iInterval = szFont_kenning; + m_pData = NULL; + reset(); + } + + ~BitmapDC(void) + { + } + + void reset() { + iMaxLineWidth = 0; + iMaxLineHeight = 0; + vLines.clear(); + } + + void buildLine(std::stringstream& ss, TTF_Font *face) + { + TextLine oTempLine; + ss << '\0'; + oTempLine.sLineStr = ss.str(); + + int w, h; + TTF_SizeText(face, oTempLine.sLineStr.c_str(), &w, &h); + + oTempLine.iLineWidth = w; + + iMaxLineWidth = MAX(iMaxLineWidth, oTempLine.iLineWidth); + ss.clear(); + ss.str(""); + vLines.push_back(oTempLine); + } + + bool divideString(TTF_Font *face, const char* sText, int iMaxWidth, int iMaxHeight) { + const char* pText = sText; + + //init stringstream + std::stringstream ss; + int w, h; + + while (*pText != '\0') { + if (*pText == '\n') { + buildLine(ss, face); + + pText++; + continue; + } + + //check its width + //divide it when exceeding + std::string s = ss.str(); + s.push_back(*pText); + TTF_SizeText(face, s.c_str(), &w, &h); + + if (iMaxWidth > 0 && (w > iMaxWidth)) { + buildLine(ss, face); + } + + ss << *pText; + pText++; + + } + + buildLine(ss, face); + + return true; + } + + /** + * compute the start pos of every line + * + * return >0 represent the start x pos of the line + * while -1 means fail + * + */ + int computeLineStart(TTF_Font *face, CCImage::ETextAlign eAlignMask, char cText, + int iLineIndex) { + return 0; + /* + int iRet; + int iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, cText), + FT_LOAD_DEFAULT); + if (iError) { + return -1; + } + + if (eAlignMask == CCImage::kAlignCenter) { + iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth) / 2 + - RSHIFT6(face->glyph->metrics.horiBearingX ); + + } else if (eAlignMask == CCImage::kAlignRight) { + iRet = (iMaxLineWidth - vLines[iLineIndex].iLineWidth) + - RSHIFT6(face->glyph->metrics.horiBearingX ); + } else { + // left or other situation + iRet = -RSHIFT6(face->glyph->metrics.horiBearingX ); + } + return iRet; + */ + } + + int computeLineStartY( TTF_Font *face, CCImage::ETextAlign eAlignMask, int txtHeight, int borderHeight ){ + return 0; + /* + int iRet; + if (eAlignMask == CCImage::kAlignCenter || eAlignMask == CCImage::kAlignLeft || + eAlignMask == CCImage::kAlignRight ) { + //vertical center + iRet = (borderHeight - txtHeight)/2 + RSHIFT6(face->size->metrics.ascender); + + } else if (eAlignMask == CCImage::kAlignBottomRight || + eAlignMask == CCImage::kAlignBottom || + eAlignMask == CCImage::kAlignBottomLeft ) { + //vertical bottom + iRet = borderHeight - txtHeight + RSHIFT6(face->size->metrics.ascender); + } else { + // left or other situation + iRet = RSHIFT6(face->size->metrics.ascender); + } + return iRet; + */ + } + + bool getBitmap(const char *text, int nWidth, int nHeight, CCImage::ETextAlign eAlignMask, const char * pFontName, float fontSize) { + const char* pText = text; + // No need to release m_pData here as it is destroyed by CCImage. + + int iCurXCursor; + + TTF_Font *face = TTF_OpenFont(pFontName, fontSize); + if(!face) + { + return false; + } + + divideString(face, text, nWidth, nHeight); + + //compute the final line width + iMaxLineWidth = MAX(iMaxLineWidth, nWidth); + + iMaxLineHeight = (int)fontSize; + iMaxLineHeight *= vLines.size(); + + //compute the final line height + iMaxLineHeight = MAX(iMaxLineHeight, nHeight); + + uint bitmapSize = iMaxLineWidth * iMaxLineHeight * 4; + + m_pData = new unsigned char[bitmapSize]; + memset(m_pData, 0, bitmapSize); + + // XXX: Can this be optimized by inserting newlines into the string and + // making a single TTF_RenderText_Solid call? Could conceivably just + // pass back SDL's buffer then, though would need additional logic to + // call SDL_FreeSurface appropriately. + for (size_t l = 0; l < vLines.size(); l++) { + pText = vLines[l].sLineStr.c_str(); + //initialize the origin cursor + iCurXCursor = computeLineStart(face, eAlignMask, *pText, l); + + SDL_Color color = { 0xff, 0xff, 0xff, 0xff }; + SDL_Surface *tSurf = TTF_RenderText_Solid(face, pText, color); + SDL_LockSurface(tSurf); + SDL_UnlockSurface(tSurf); + + // We treat pixels as 32-bit words, since both source and target + // are rendered as such. + int *pixels = (int*) tSurf->pixels; + int *out = (int*)m_pData; + + for(int i = 0; i < tSurf->h; ++i) + { + for(int j = 0; j < tSurf->w; ++j) + { + int targetOffset = (l * iMaxLineHeight + i) * iMaxLineWidth + j; + int sourceOffset = i * tSurf->w + j; + + // HTML5 canvas is non-pre-alpha-multiplied, so alpha-multiply here. + unsigned char *p = (unsigned char*) &pixels[sourceOffset]; + out[targetOffset] = CC_RGB_PREMULTIPLY_ALPHA( p[0], p[1], p[2], p[3] ); + } + } + SDL_FreeSurface(tSurf); + } + + //clear all lines + vLines.clear(); + + TTF_CloseFont(face); + + return true; + } + +public: + unsigned char *m_pData; + int libError; + vector vLines; + int iInterval; + int iMaxLineWidth; + int iMaxLineHeight; +}; + +static BitmapDC& sharedBitmapDC() +{ + static BitmapDC s_BmpDC; + return s_BmpDC; +} + +bool CCImage::initWithString( + const char * pText, + int nWidth/* = 0*/, + int nHeight/* = 0*/, + ETextAlign eAlignMask/* = kAlignCenter*/, + const char * pFontName/* = nil*/, + int nSize/* = 0*/) +{ + bool bRet = false; + do + { + CC_BREAK_IF(! pText); + BitmapDC &dc = sharedBitmapDC(); + + std::string fullFontName = pFontName; + std::string lowerCasePath = fullFontName; + std::transform(lowerCasePath.begin(), lowerCasePath.end(), lowerCasePath.begin(), ::tolower); + + CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, fullFontName.c_str(), nSize)); + + // assign the dc.m_pData to m_pData in order to save time + m_pData = dc.m_pData; + CC_BREAK_IF(! m_pData); + + m_nWidth = (short)dc.iMaxLineWidth; + m_nHeight = (short)dc.iMaxLineHeight; + m_bHasAlpha = true; + m_bPreMulti = true; + m_nBitsPerComponent = 8; + + bRet = true; + + dc.reset(); + + } while (0); + + return bRet; +} + +NS_CC_END + diff --git a/cocos2dx/platform/emscripten/CCPlatformDefine.h b/cocos2dx/platform/emscripten/CCPlatformDefine.h new file mode 100644 index 0000000000..789ea77e08 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCPlatformDefine.h @@ -0,0 +1,24 @@ +#ifndef __CCPLATFORMDEFINE_H__ +#define __CCPLATFORMDEFINE_H__ + +#include + +#define CC_DLL + +#define CC_ASSERT(cond) assert(cond) + + +#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam + +/* Define NULL pointer value */ +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + + + +#endif /* __CCPLATFORMDEFINE_H__*/ diff --git a/cocos2dx/platform/emscripten/CCStdC.h b/cocos2dx/platform/emscripten/CCStdC.h new file mode 100644 index 0000000000..abcb9bd923 --- /dev/null +++ b/cocos2dx/platform/emscripten/CCStdC.h @@ -0,0 +1,48 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CC_STD_C_H__ +#define __CC_STD_C_H__ + +#include "platform/CCPlatformMacros.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef MIN +#define MIN(x,y) (((x) > (y)) ? (y) : (x)) +#endif // MIN + +#ifndef MAX +#define MAX(x,y) (((x) < (y)) ? (y) : (x)) +#endif // MAX + +#endif // __CC_STD_C_H__ + diff --git a/cocos2dx/platform/ios/CCCommon.mm b/cocos2dx/platform/ios/CCCommon.mm index 750b11fe2e..312ae78a08 100644 --- a/cocos2dx/platform/ios/CCCommon.mm +++ b/cocos2dx/platform/ios/CCCommon.mm @@ -34,8 +34,7 @@ NS_CC_BEGIN void CCLog(const char * pszFormat, ...) { printf("Cocos2d: "); - char szBuf[kMaxLogLen]; - + char szBuf[kMaxLogLen+1] = {0}; va_list ap; va_start(ap, pszFormat); vsnprintf(szBuf, kMaxLogLen, pszFormat, ap); diff --git a/cocos2dx/platform/ios/CCFileUtilsIOS.h b/cocos2dx/platform/ios/CCFileUtilsIOS.h index 5dddf56ce5..2e8204dc22 100644 --- a/cocos2dx/platform/ios/CCFileUtilsIOS.h +++ b/cocos2dx/platform/ios/CCFileUtilsIOS.h @@ -49,6 +49,8 @@ public: virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename); virtual CCDictionary* createCCDictionaryWithContentsOfFile(const std::string& filename); + virtual bool writeToFile(CCDictionary *dict, const std::string& fullPath); + virtual CCArray* createCCArrayWithContentsOfFile(const std::string& filename); }; diff --git a/cocos2dx/platform/ios/CCFileUtilsIOS.mm b/cocos2dx/platform/ios/CCFileUtilsIOS.mm index 62e566d89d..ff643af139 100644 --- a/cocos2dx/platform/ios/CCFileUtilsIOS.mm +++ b/cocos2dx/platform/ios/CCFileUtilsIOS.mm @@ -39,6 +39,7 @@ THE SOFTWARE. NS_CC_BEGIN static void addValueToCCDict(id key, id value, CCDictionary* pDict); +static void addCCObjectToNSDict(const char*key, CCObject* object, NSMutableDictionary *dict); static void addItemToCCArray(id item, CCArray *pArray) { @@ -86,6 +87,40 @@ static void addItemToCCArray(id item, CCArray *pArray) } } +static void addCCObjectToNSArray(CCObject *object, NSMutableArray *array) +{ + // add string into array + if (CCString *ccString = dynamic_cast(object)) { + NSString *strElement = [NSString stringWithCString:ccString->getCString() encoding:NSUTF8StringEncoding]; + [array addObject:strElement]; + return; + } + + // add array into array + if (CCArray *ccArray = dynamic_cast(object)) { + NSMutableArray *arrElement = [NSMutableArray array]; + CCObject *element = NULL; + CCARRAY_FOREACH(ccArray, element) + { + addCCObjectToNSArray(element, arrElement); + } + [array addObject:arrElement]; + return; + } + + // add dictionary value into array + if (CCDictionary *ccDict = dynamic_cast(object)) { + NSMutableDictionary *dictElement = [NSMutableDictionary dictionary]; + CCDictElement *element = NULL; + CCDICT_FOREACH(ccDict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), dictElement); + } + [array addObject:dictElement]; + } + +} + static void addValueToCCDict(id key, id value, CCDictionary* pDict) { // the key must be a string @@ -136,6 +171,43 @@ static void addValueToCCDict(id key, id value, CCDictionary* pDict) } } +static void addCCObjectToNSDict(const char * key, CCObject* object, NSMutableDictionary *dict) +{ + NSString *NSkey = [NSString stringWithCString:key encoding:NSUTF8StringEncoding]; + + // the object is a CCDictionary + if (CCDictionary *ccDict = dynamic_cast(object)) { + NSMutableDictionary *dictElement = [NSMutableDictionary dictionary]; + CCDictElement *element = NULL; + CCDICT_FOREACH(ccDict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), dictElement); + } + + [dict setObject:dictElement forKey:NSkey]; + return; + } + + // the object is a CCString + if (CCString *element = dynamic_cast(object)) { + NSString *strElement = [NSString stringWithCString:element->getCString() encoding:NSUTF8StringEncoding]; + [dict setObject:strElement forKey:NSkey]; + return; + } + + // the object is a CCArray + if (CCArray *ccArray = dynamic_cast(object)) { + NSMutableArray *arrElement = [NSMutableArray array]; + CCObject *element = NULL; + CCARRAY_FOREACH(ccArray, element) + { + addCCObjectToNSArray(element, arrElement); + } + [dict setObject:arrElement forKey:NSkey]; + return; + } +} + CCFileUtils* CCFileUtils::sharedFileUtils() { if (s_sharedFileUtils == NULL) @@ -161,23 +233,33 @@ std::string CCFileUtilsIOS::getWritablePath() bool CCFileUtilsIOS::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + bool bRet = false; if (strFilePath[0] != '/') { - std::string path = strFilePath; + std::string path; std::string file; - size_t pos = path.find_last_of("/"); + size_t pos = strFilePath.find_last_of("/"); if (pos != std::string::npos) { - file = path.substr(pos+1); - path = path.substr(0, pos+1); - NSString* fullpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:file.c_str()] - ofType:nil - inDirectory:[NSString stringWithUTF8String:path.c_str()]]; - if (fullpath != nil) { - bRet = true; - } + file = strFilePath.substr(pos+1); + path = strFilePath.substr(0, pos+1); + } + else + { + file = strFilePath; + } + + NSString* fullpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:file.c_str()] + ofType:nil + inDirectory:[NSString stringWithUTF8String:path.c_str()]]; + if (fullpath != nil) { + bRet = true; } } else @@ -234,6 +316,24 @@ CCDictionary* CCFileUtilsIOS::createCCDictionaryWithContentsOfFile(const std::st return pRet; } +bool CCFileUtilsIOS::writeToFile(CCDictionary *dict, const std::string &fullPath) +{ + //CCLOG("iOS||Mac CCDictionary %d write to file %s", dict->m_uID, fullPath.c_str()); + NSMutableDictionary *nsDict = [NSMutableDictionary dictionary]; + + CCDictElement *element = NULL; + CCDICT_FOREACH(dict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), nsDict); + } + + NSString *file = [NSString stringWithUTF8String:fullPath.c_str()]; + // do it atomically + [nsDict writeToFile:file atomically:YES]; + + return true; +} + CCArray* CCFileUtilsIOS::createCCArrayWithContentsOfFile(const std::string& filename) { // NSString* pPath = [NSString stringWithUTF8String:pFileName]; diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index 0138202ffc..471f31cc28 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -29,14 +29,31 @@ THE SOFTWARE. #import #import +#include + + typedef struct { unsigned int height; unsigned int width; - int bitsPerComponent; - bool hasAlpha; - bool isPremultipliedAlpha; + int bitsPerComponent; + bool hasAlpha; + bool isPremultipliedAlpha; + bool hasShadow; + CGSize shadowOffset; + float shadowBlur; + float shadowOpacity; + bool hasStroke; + float strokeColorR; + float strokeColorG; + float strokeColorB; + float strokeSize; + float tintColorR; + float tintColorG; + float tintColorB; + unsigned char* data; + } tImageInfo; static bool _initWithImage(CGImageRef cgImage, tImageInfo *pImageinfo) @@ -57,6 +74,13 @@ static bool _initWithImage(CGImageRef cgImage, tImageInfo *pImageinfo) || (info == kCGImageAlphaLast) || (info == kCGImageAlphaFirst); + // If OS version < 5.x, add condition to support jpg + float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue]; + if(systemVersion < 5.0f) + { + pImageinfo->hasAlpha = (pImageinfo->hasAlpha || (info == kCGImageAlphaNoneSkipLast)); + } + CGColorSpaceRef colorSpace = CGImageGetColorSpace(cgImage); if (colorSpace) { @@ -178,11 +202,13 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl { CC_BREAK_IF(! pText || ! pInfo); - NSString * str = [NSString stringWithUTF8String:pText]; - NSString * fntName = [NSString stringWithUTF8String:pFontName]; + NSString * str = [NSString stringWithUTF8String:pText]; + NSString * fntName = [NSString stringWithUTF8String:pFontName]; + CGSize dim, constrainSize; - constrainSize.width = pInfo->width; - constrainSize.height = pInfo->height; + + constrainSize.width = pInfo->width; + constrainSize.height = pInfo->height; // On iOS custom fonts must be listed beforehand in the App info.plist (in order to be usable) and referenced only the by the font family name itself when // calling [UIFont fontWithName]. Therefore even if the developer adds 'SomeFont.ttf' or 'fonts/SomeFont.ttf' to the App .plist, the font must @@ -243,23 +269,56 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl dim.height = constrainSize.height; } + + // compute the padding needed by shadow and stroke + float shadowStrokePaddingX = 0.0f; + float shadowStrokePaddingY = 0.0f; + + if ( pInfo->hasStroke ) + { + shadowStrokePaddingX = ceilf(pInfo->strokeSize); + shadowStrokePaddingY = ceilf(pInfo->strokeSize); + } + + if ( pInfo->hasShadow ) + { + shadowStrokePaddingX = std::max(shadowStrokePaddingX, (float)abs(pInfo->shadowOffset.width)); + shadowStrokePaddingY = std::max(shadowStrokePaddingY, (float)abs(pInfo->shadowOffset.height)); + } + + // add the padding (this could be 0 if no shadow and no stroke) + dim.width += shadowStrokePaddingX; + dim.height += shadowStrokePaddingY; + + unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)]; memset(data, 0, (int)(dim.width * dim.height * 4)); // draw text - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(data, dim.width, dim.height, 8, dim.width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(data, + dim.width, + dim.height, + 8, + dim.width * 4, + colorSpace, + kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); + CGColorSpaceRelease(colorSpace); - if (! context) + if (!context) { delete[] data; break; } - - CGContextSetRGBFillColor(context, 1, 1, 1, 1); - CGContextTranslateCTM(context, 0.0f, dim.height); + + // text color + CGContextSetRGBFillColor(context, pInfo->tintColorR, pInfo->tintColorG, pInfo->tintColorB, 1); + // move Y rendering to the top of the image + CGContextTranslateCTM(context, 0.0f, (dim.height - shadowStrokePaddingY) ); CGContextScaleCTM(context, 1.0f, -1.0f); //NOTE: NSString draws in UIKit referential i.e. renders upside-down compared to CGBitmapContext referential + + // store the current context UIGraphicsPushContext(context); // measure text size with specified font and determine the rectangle to draw text in @@ -267,32 +326,87 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl UITextAlignment align = (UITextAlignment)((2 == uHoriFlag) ? UITextAlignmentRight : (3 == uHoriFlag) ? UITextAlignmentCenter : UITextAlignmentLeft); + + + // take care of stroke if needed + if ( pInfo->hasStroke ) + { + CGContextSetTextDrawingMode(context, kCGTextFillStroke); + CGContextSetRGBStrokeColor(context, pInfo->strokeColorR, pInfo->strokeColorG, pInfo->strokeColorB, 1); + CGContextSetLineWidth(context, pInfo->strokeSize); + } + + // take care of shadow if needed + if ( pInfo->hasShadow ) + { + CGSize offset; + offset.height = pInfo->shadowOffset.height; + offset.width = pInfo->shadowOffset.width; + CGContextSetShadow(context, offset, pInfo->shadowBlur); + } + + // normal fonts - /* - if( [font isKindOfClass:[UIFont class] ] ) - { - [str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap alignment:align]; - } - else // ZFont class - { - [FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap alignment:align]; - } - */ - [str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap alignment:align]; + //if( [font isKindOfClass:[UIFont class] ] ) + //{ + // [str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap alignment:align]; + //} + //else // ZFont class + //{ + // [FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap + ////alignment:align]; + //} + + + // compute the rect used for rendering the text + // based on wether shadows or stroke are enabled + + float textOriginX = 0.0; + float textOrigingY = 0.0; + + float textWidth = dim.width - shadowStrokePaddingX; + float textHeight = dim.height - shadowStrokePaddingY; + + + if ( pInfo->shadowOffset.width < 0 ) + { + textOriginX = shadowStrokePaddingX; + } + else + { + textOriginX = 0.0; + } + + if (pInfo->shadowOffset.height > 0) + { + textOrigingY = startH; + } + else + { + textOrigingY = startH - shadowStrokePaddingY; + } + + + // actually draw the text in the context + [str drawInRect:CGRectMake(textOriginX, textOrigingY, textWidth, textHeight) withFont:font lineBreakMode:(UILineBreakMode)UILineBreakModeWordWrap alignment:align]; + + // pop the context UIGraphicsPopContext(); + // release the context CGContextRelease(context); // output params - pInfo->data = data; - pInfo->hasAlpha = true; + pInfo->data = data; + pInfo->hasAlpha = true; pInfo->isPremultipliedAlpha = true; - pInfo->bitsPerComponent = 8; - pInfo->width = dim.width; - pInfo->height = dim.height; - bRet = true; + pInfo->bitsPerComponent = 8; + pInfo->width = dim.width; + pInfo->height = dim.height; + bRet = true; + } while (0); return bRet; @@ -358,12 +472,16 @@ bool CCImage::initWithImageData(void * pData, { bool bRet = false; tImageInfo info = {0}; + + info.hasShadow = false; + info.hasStroke = false; + do { CC_BREAK_IF(! pData || nDataLen <= 0); if (eFmt == kFmtRawData) { - bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent); + bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent, false); } else if (eFmt == kFmtWebp) { @@ -387,7 +505,7 @@ bool CCImage::initWithImageData(void * pData, return bRet; } -bool CCImage::_initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent) +bool CCImage::_initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent, bool bPreMulti) { bool bRet = false; do @@ -436,17 +554,58 @@ bool CCImage::_saveImageToJPG(const char *pszFilePath) } bool CCImage::initWithString( - const char * pText, - int nWidth /* = 0 */, - int nHeight /* = 0 */, - ETextAlign eAlignMask /* = kAlignCenter */, - const char * pFontName /* = nil */, - int nSize /* = 0 */) + const char * pText, + int nWidth /* = 0 */, + int nHeight /* = 0 */, + ETextAlign eAlignMask /* = kAlignCenter */, + const char * pFontName /* = nil */, + int nSize /* = 0 */) { + return initWithStringShadowStroke(pText, nWidth, nHeight, eAlignMask , pFontName, nSize); +} + +bool CCImage::initWithStringShadowStroke( + const char * pText, + int nWidth , + int nHeight , + ETextAlign eAlignMask , + const char * pFontName , + int nSize , + float textTintR, + float textTintG, + float textTintB, + bool shadow, + float shadowOffsetX, + float shadowOffsetY, + float shadowOpacity, + float shadowBlur, + bool stroke, + float strokeR, + float strokeG, + float strokeB, + float strokeSize) +{ + + + tImageInfo info = {0}; - info.width = nWidth; - info.height = nHeight; - + info.width = nWidth; + info.height = nHeight; + info.hasShadow = shadow; + info.shadowOffset.width = shadowOffsetX; + info.shadowOffset.height = shadowOffsetY; + info.shadowBlur = shadowBlur; + info.shadowOpacity = shadowOpacity; + info.hasStroke = stroke; + info.strokeColorR = strokeR; + info.strokeColorG = strokeG; + info.strokeColorB = strokeB; + info.strokeSize = strokeSize; + info.tintColorR = textTintR; + info.tintColorG = textTintG; + info.tintColorB = textTintB; + + if (! _initWithString(pText, eAlignMask, pFontName, nSize, &info)) { return false; @@ -457,10 +616,11 @@ bool CCImage::initWithString( m_bHasAlpha = info.hasAlpha; m_bPreMulti = info.isPremultipliedAlpha; m_pData = info.data; - + return true; } + bool CCImage::saveToFile(const char *pszFilePath, bool bIsToRGB) { bool saveToPNG = false; diff --git a/cocos2dx/platform/ios/EAGLView.mm b/cocos2dx/platform/ios/EAGLView.mm old mode 100755 new mode 100644 index 47eb9ff862..239a84ff83 --- a/cocos2dx/platform/ios/EAGLView.mm +++ b/cocos2dx/platform/ios/EAGLView.mm @@ -718,6 +718,12 @@ static EAGLView *view = 0; return nil; } +- (NSArray *)selectionRectsForRange:(UITextRange *)range +{ + CCLOG("selectionRectsForRange"); + return nil; +} + #pragma mark - #pragma mark UIKeyboard notification diff --git a/cocos2dx/platform/linux/CCCommon.cpp b/cocos2dx/platform/linux/CCCommon.cpp index 822f33a76d..44c4989caf 100644 --- a/cocos2dx/platform/linux/CCCommon.cpp +++ b/cocos2dx/platform/linux/CCCommon.cpp @@ -34,15 +34,23 @@ void CCLog(const char * pszFormat, ...) va_list ap; va_start(ap, pszFormat); - vsnprintf( szBuf, MAX_LEN, pszFormat, ap); + vsnprintf(szBuf, MAX_LEN, pszFormat, ap); va_end(ap); - fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); + // Strip any trailing newlines from log message. + size_t len = strlen(szBuf); + while (len && szBuf[len-1] == '\n') + { + szBuf[len-1] = '\0'; + len--; + } + + fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); } void CCMessageBox(const char * pszMsg, const char * pszTitle) { - CCLog("%s: %s", pszTitle, pszMsg); + CCLog("%s: %s", pszTitle, pszMsg); } void CCLuaLog(const char * pszFormat) @@ -51,4 +59,3 @@ void CCLuaLog(const char * pszFormat) } NS_CC_END - diff --git a/cocos2dx/platform/linux/CCEGLView.cpp b/cocos2dx/platform/linux/CCEGLView.cpp index 75ca2e83cd..0599eb53b7 100644 --- a/cocos2dx/platform/linux/CCEGLView.cpp +++ b/cocos2dx/platform/linux/CCEGLView.cpp @@ -305,20 +305,20 @@ bool CCEGLView::initGL() if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader) { - CCLog("Ready for GLSL\n"); + CCLog("Ready for GLSL"); } else { - CCLog("Not totally ready :( \n"); + CCLog("Not totally ready :("); } if (glewIsSupported("GL_VERSION_2_0")) { - CCLog("Ready for OpenGL 2.0\n"); + CCLog("Ready for OpenGL 2.0"); } else { - CCLog("OpenGL 2.0 not supported\n"); + CCLog("OpenGL 2.0 not supported"); } // Enable point size by default on linux. diff --git a/cocos2dx/platform/linux/CCFileUtilsLinux.cpp b/cocos2dx/platform/linux/CCFileUtilsLinux.cpp index f6b4532671..fb055d1b3f 100644 --- a/cocos2dx/platform/linux/CCFileUtilsLinux.cpp +++ b/cocos2dx/platform/linux/CCFileUtilsLinux.cpp @@ -34,27 +34,52 @@ CCFileUtilsLinux::CCFileUtilsLinux() bool CCFileUtilsLinux::init() { // get application path - int length = 0; char fullpath[256] = {0}; - length = readlink("/proc/self/exe", fullpath, sizeof(fullpath)); - fullpath[length] = '\0'; + ssize_t length = readlink("/proc/self/exe", fullpath, sizeof(fullpath)-1); - std::string resourcePath = fullpath; - resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); - resourcePath += "/../../../Resources/"; - m_strDefaultResRootPath = resourcePath; + if (length <= 0) { + return false; + } + + fullpath[length] = '\0'; + std::string appPath = fullpath; + m_strDefaultResRootPath = appPath.substr(0, appPath.find_last_of("/")); + m_strDefaultResRootPath += "/../../../Resources/"; + + // Set writable path to $XDG_CONFIG_HOME or ~/.config// if $XDG_CONFIG_HOME not exists. + const char* xdg_config_path = getenv("XDG_CONFIG_HOME"); + std::string xdgConfigPath; + if (xdg_config_path == NULL) { + xdgConfigPath = getenv("HOME"); + xdgConfigPath += "/.config"; + } else { + xdgConfigPath = xdg_config_path; + } + m_writablePath = xdgConfigPath; + m_writablePath += appPath.substr(appPath.find_last_of("/")); + m_writablePath += "/"; return CCFileUtils::init(); } string CCFileUtilsLinux::getWritablePath() { - //return current resource path - return m_strDefaultResRootPath; + struct stat st; + stat(m_writablePath.c_str(), &st); + if (!S_ISDIR(st.st_mode)) { + mkdir(m_writablePath.c_str(), 0744); + } + + return m_writablePath; } bool CCFileUtilsLinux::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + std::string strPath = strFilePath; if (!isAbsolutePath(strPath)) { // Not absolute path, add the default root path at the beginning. diff --git a/cocos2dx/platform/linux/CCFileUtilsLinux.h b/cocos2dx/platform/linux/CCFileUtilsLinux.h index 8be0675643..f952a95f55 100644 --- a/cocos2dx/platform/linux/CCFileUtilsLinux.h +++ b/cocos2dx/platform/linux/CCFileUtilsLinux.h @@ -43,6 +43,7 @@ class CC_DLL CCFileUtilsLinux : public CCFileUtils { friend class CCFileUtils; CCFileUtilsLinux(); + std::string m_writablePath; public: /* override funtions */ bool init(); diff --git a/cocos2dx/platform/linux/CCImage.cpp b/cocos2dx/platform/linux/CCImage.cpp index 998c74d955..6c59bf5a46 100644 --- a/cocos2dx/platform/linux/CCImage.cpp +++ b/cocos2dx/platform/linux/CCImage.cpp @@ -377,22 +377,25 @@ public: int xoffset = iCurXCursor + glyph.paintPosition; for (int y = 0; y < bitmap.rows; ++y) { + int iY = yoffset + y; + if (iY>=iMaxLineHeight) { + //exceed the height truncate + break; + } + iY *= iMaxLineWidth; + + int bitmap_y = y * bitmap.width; + for (int x = 0; x < bitmap.width; ++x) { - unsigned char cTemp = bitmap.buffer[y * bitmap.width + x]; + unsigned char cTemp = bitmap.buffer[bitmap_y + x]; if (cTemp == 0) { continue; } - int iY = yoffset + y; int iX = xoffset + x; - if (iY>=iMaxLineHeight) { - //exceed the height truncate - break; - } - int iTemp = cTemp << 24 | cTemp << 16 | cTemp << 8 | cTemp; - *(int*) &m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] = iTemp; + *(int*) &m_pData[(iY + iX) * 4 + 0] = iTemp; } } } diff --git a/cocos2dx/platform/mac/CCFileUtilsMac.h b/cocos2dx/platform/mac/CCFileUtilsMac.h index 6bd15e3493..735fe811b8 100644 --- a/cocos2dx/platform/mac/CCFileUtilsMac.h +++ b/cocos2dx/platform/mac/CCFileUtilsMac.h @@ -48,6 +48,8 @@ public: virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename); virtual CCDictionary* createCCDictionaryWithContentsOfFile(const std::string& filename); + virtual bool writeToFile(CCDictionary *dict, const std::string& fullPath); + virtual CCArray* createCCArrayWithContentsOfFile(const std::string& filename); }; diff --git a/cocos2dx/platform/mac/CCFileUtilsMac.mm b/cocos2dx/platform/mac/CCFileUtilsMac.mm index 2bedb5db0b..1e36989de2 100644 --- a/cocos2dx/platform/mac/CCFileUtilsMac.mm +++ b/cocos2dx/platform/mac/CCFileUtilsMac.mm @@ -36,6 +36,7 @@ THE SOFTWARE. NS_CC_BEGIN static void addValueToCCDict(id key, id value, CCDictionary* pDict); +static void addCCObjectToNSDict(const char*key, CCObject* object, NSMutableDictionary *dict); static void addItemToCCArray(id item, CCArray *pArray) { @@ -83,6 +84,40 @@ static void addItemToCCArray(id item, CCArray *pArray) } } +static void addCCObjectToNSArray(CCObject *object, NSMutableArray *array) +{ + // add string into array + if (CCString *ccString = dynamic_cast(object)) { + NSString *strElement = [NSString stringWithCString:ccString->getCString() encoding:NSUTF8StringEncoding]; + [array addObject:strElement]; + return; + } + + // add array into array + if (CCArray *ccArray = dynamic_cast(object)) { + NSMutableArray *arrElement = [NSMutableArray array]; + CCObject *element = NULL; + CCARRAY_FOREACH(ccArray, element) + { + addCCObjectToNSArray(element, arrElement); + } + [array addObject:arrElement]; + return; + } + + // add dictionary value into array + if (CCDictionary *ccDict = dynamic_cast(object)) { + NSMutableDictionary *dictElement = [NSMutableDictionary dictionary]; + CCDictElement *element = NULL; + CCDICT_FOREACH(ccDict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), dictElement); + } + [array addObject:dictElement]; + } + +} + static void addValueToCCDict(id key, id value, CCDictionary* pDict) { // the key must be a string @@ -133,6 +168,43 @@ static void addValueToCCDict(id key, id value, CCDictionary* pDict) } } +static void addCCObjectToNSDict(const char * key, CCObject* object, NSMutableDictionary *dict) +{ + NSString *NSkey = [NSString stringWithCString:key encoding:NSUTF8StringEncoding]; + + // the object is a CCDictionary + if (CCDictionary *ccDict = dynamic_cast(object)) { + NSMutableDictionary *dictElement = [NSMutableDictionary dictionary]; + CCDictElement *element = NULL; + CCDICT_FOREACH(ccDict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), dictElement); + } + + [dict setObject:dictElement forKey:NSkey]; + return; + } + + // the object is a CCString + if (CCString *element = dynamic_cast(object)) { + NSString *strElement = [NSString stringWithCString:element->getCString() encoding:NSUTF8StringEncoding]; + [dict setObject:strElement forKey:NSkey]; + return; + } + + // the object is a CCArray + if (CCArray *ccArray = dynamic_cast(object)) { + NSMutableArray *arrElement = [NSMutableArray array]; + CCObject *element = NULL; + CCARRAY_FOREACH(ccArray, element) + { + addCCObjectToNSArray(element, arrElement); + } + [dict setObject:arrElement forKey:NSkey]; + return; + } +} + CCFileUtils* CCFileUtils::sharedFileUtils() { if (s_sharedFileUtils == NULL) @@ -158,6 +230,11 @@ std::string CCFileUtilsMac::getWritablePath() bool CCFileUtilsMac::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + bool bRet = false; if (strFilePath[0] != '/') @@ -231,6 +308,22 @@ CCDictionary* CCFileUtilsMac::createCCDictionaryWithContentsOfFile(const std::st return pRet; } +bool CCFileUtilsMac::writeToFile(CCDictionary *dict, const std::string &fullPath) +{ + CCLOG("iOS||Mac CCDictionary %d write to file %s", dict->m_uID, fullPath.c_str()); + NSMutableDictionary *nsDict = [NSMutableDictionary dictionary]; + + CCDictElement *element = NULL; + CCDICT_FOREACH(dict, element) + { + addCCObjectToNSDict(element->getStrKey(), element->getObject(), nsDict); + } + + NSString *file = [NSString stringWithUTF8String:fullPath.c_str()]; + // do it atomically + return [nsDict writeToFile:file atomically:YES]; +} + CCArray* CCFileUtilsMac::createCCArrayWithContentsOfFile(const std::string& filename) { // NSString* pPath = [NSString stringWithUTF8String:pFileName]; diff --git a/cocos2dx/platform/mac/CCImage.mm b/cocos2dx/platform/mac/CCImage.mm index 96a802382b..4f46521b2b 100755 --- a/cocos2dx/platform/mac/CCImage.mm +++ b/cocos2dx/platform/mac/CCImage.mm @@ -345,7 +345,6 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl do { NSString * string = [NSString stringWithUTF8String:pText]; - //string = [NSString stringWithFormat:@"d\r\nhello world hello kitty Hello what %@", string]; // font NSFont *font = [[NSFontManager sharedFontManager] @@ -397,12 +396,15 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl NSUInteger length = [string length]; NSRange range = NSMakeRange(0, 1); NSUInteger width = 0; + NSUInteger lastBreakLocation = 0; for (NSUInteger i = 0; i < length; i++) { range.location = i; - [lineBreak appendString:[string substringWithRange:range]]; + NSString *character = [string substringWithRange:range]; + [lineBreak appendString:character]; + if ([@"!?.,-= " rangeOfString:character].location != NSNotFound) { lastBreakLocation = i; } width = [lineBreak sizeWithAttributes:tokenAttributesDict].width; if (width > pInfo->width) { - [lineBreak insertString:@"\r\n" atIndex:[lineBreak length] - 1]; + [lineBreak insertString:@"\r\n" atIndex:(lastBreakLocation > 0) ? lastBreakLocation : [lineBreak length] - 1]; } } string = lineBreak; diff --git a/cocos2dx/platform/marmalade/CCAccelerometer.cpp b/cocos2dx/platform/marmalade/CCAccelerometer.cpp index aaa29b1b4b..25a3b12f9e 100644 --- a/cocos2dx/platform/marmalade/CCAccelerometer.cpp +++ b/cocos2dx/platform/marmalade/CCAccelerometer.cpp @@ -61,7 +61,7 @@ void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) { if (s3eAccelerometerStart() != S3E_RESULT_SUCCESS) { - CCLog("s3eAccelerometerStart() - ERROR\n"); + CCLog("s3eAccelerometerStart() - ERROR"); } } else diff --git a/cocos2dx/platform/marmalade/CCCommon.cpp b/cocos2dx/platform/marmalade/CCCommon.cpp index abb99bd78c..6a54176ad6 100644 --- a/cocos2dx/platform/marmalade/CCCommon.cpp +++ b/cocos2dx/platform/marmalade/CCCommon.cpp @@ -38,12 +38,20 @@ void CCLog(const char * pszFormat, ...) vsnprintf( szBuf, MAX_LEN, pszFormat, ap); va_end(ap); - fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); + // Strip any trailing newlines from log message. + size_t len = strlen(szBuf); + while (len && szBuf[len-1] == '\n') + { + szBuf[len-1] = '\0'; + len--; + } + + fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); } void CCMessageBox(const char * pszMsg, const char * pszTitle) { - CCLog("%s: %s", pszTitle, pszMsg); + CCLog("%s: %s", pszTitle, pszMsg); } void CCLuaLog(const char * pszFormat) @@ -52,4 +60,3 @@ void CCLuaLog(const char * pszFormat) } NS_CC_END - diff --git a/cocos2dx/platform/marmalade/CCFileUtilsMarmalade.cpp b/cocos2dx/platform/marmalade/CCFileUtilsMarmalade.cpp index 15c58183af..e0fc348e1b 100644 --- a/cocos2dx/platform/marmalade/CCFileUtilsMarmalade.cpp +++ b/cocos2dx/platform/marmalade/CCFileUtilsMarmalade.cpp @@ -30,6 +30,11 @@ string CCFileUtilsMarmalade::getWritablePath() bool CCFileUtilsMarmalade::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + return s3eFileCheckExists(strFilePath.c_str()) == S3E_TRUE ? true : false; } diff --git a/cocos2dx/platform/marmalade/CCImage.cpp b/cocos2dx/platform/marmalade/CCImage.cpp index 401be9ed92..96e6da535d 100644 --- a/cocos2dx/platform/marmalade/CCImage.cpp +++ b/cocos2dx/platform/marmalade/CCImage.cpp @@ -383,7 +383,7 @@ bool BitmapDC::getBitmap( const char *text, int nWidth, int nHeight, CCImage::ET if (iError) { //no valid font found, try to use default fName = "fonts/Marker Felt.ttf" ; - //CCLog("No valid font, use default %s\n", fName.c_str()); + //CCLog("No valid font, use default %s", fName.c_str()); iError = openFont( fName, fontSize ); } } diff --git a/cocos2dx/platform/nacl/CCCommon.cpp b/cocos2dx/platform/nacl/CCCommon.cpp index e8eaabac9e..ee272dea95 100644 --- a/cocos2dx/platform/nacl/CCCommon.cpp +++ b/cocos2dx/platform/nacl/CCCommon.cpp @@ -38,6 +38,14 @@ void CCLog(const char * pszFormat, ...) vsnprintf( szBuf, MAX_LEN, pszFormat, ap); va_end(ap); + // Strip any trailing newlines from log message. + size_t len = strlen(szBuf); + while (len && szBuf[len-1] == '\n') + { + szBuf[len-1] = '\0'; + len--; + } + fprintf(stderr, "cocos2d-x debug info [%s]\n", szBuf); } @@ -48,7 +56,7 @@ void CCMessageBox(const char * pszMsg, const char * pszTitle) void CCLuaLog(const char * pszFormat) { - CCLog(pszFormat); + CCLog("%s", pszFormat); } NS_CC_END diff --git a/cocos2dx/platform/nacl/CCEGLView.cpp b/cocos2dx/platform/nacl/CCEGLView.cpp index 1177f40fd4..954dd5751b 100644 --- a/cocos2dx/platform/nacl/CCEGLView.cpp +++ b/cocos2dx/platform/nacl/CCEGLView.cpp @@ -108,7 +108,7 @@ bool OpenGLContext::MakeContextCurrent() return false; } - CCLOG("glSetCurrentContextPPAPI: %p", m_graphics3d.pp_resource()); + CCLOG("glSetCurrentContextPPAPI: %p", (void*)m_graphics3d.pp_resource()); glSetCurrentContextPPAPI(m_graphics3d.pp_resource()); return true; } diff --git a/cocos2dx/platform/nacl/CCFileUtilsNaCl.cpp b/cocos2dx/platform/nacl/CCFileUtilsNaCl.cpp index c432cd7d3e..38517069e9 100644 --- a/cocos2dx/platform/nacl/CCFileUtilsNaCl.cpp +++ b/cocos2dx/platform/nacl/CCFileUtilsNaCl.cpp @@ -48,6 +48,11 @@ std::string CCFileUtilsNaCl::getWritablePath() bool CCFileUtilsNaCl::isFileExist(const std::string& strFilePath) { + if (0 == strFilePath.length()) + { + return false; + } + std::string strPath = strFilePath; if (!isAbsolutePath(strPath)) { // Not absolute path, add the default root path at the beginning. diff --git a/cocos2dx/platform/nacl/CCInstance.cpp b/cocos2dx/platform/nacl/CCInstance.cpp index 4d997ee328..44ef996c0f 100644 --- a/cocos2dx/platform/nacl/CCInstance.cpp +++ b/cocos2dx/platform/nacl/CCInstance.cpp @@ -82,7 +82,7 @@ bool CocosPepperInstance::Init(uint32_t argc, const char* argn[], const char* ar #ifdef OLD_NACL_MOUNTS m_runner = new MainThreadRunner(this); #else - CCLOG("%p %p", pp_instance(), pp::Module::Get()->get_browser_interface()); + CCLOG("%p %p", (void*)pp_instance(), (void*)pp::Module::Get()->get_browser_interface()); nacl_io_init_ppapi(pp_instance(), pp::Module::Get()->get_browser_interface()); CCLOG("done nacl_mounts_init_ppapi"); diff --git a/cocos2dx/platform/platform.h b/cocos2dx/platform/platform.h index 29a74f2bde..6a77ef454f 100644 --- a/cocos2dx/platform/platform.h +++ b/cocos2dx/platform/platform.h @@ -42,7 +42,7 @@ struct CC_DLL cc_timeval #else long tv_sec; // seconds #endif - long tv_usec; // microSeconds + int tv_usec; // microSeconds }; class CC_DLL CCTime diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/x86/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/x86/libcurl.a.REMOVED.git-id index 89909631bc..db23a29155 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/x86/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/x86/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -0de0ed5b57ac94be1b1cd70f6ef1b8cf8b1fd83b \ No newline at end of file +445f2725cd3af681c6b88dfe13d671b4aa3cdab9 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/DOCBparser.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/DOCBparser.h deleted file mode 100644 index 461d4ee802..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/DOCBparser.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Summary: old DocBook SGML parser - * Description: interface for a DocBook SGML non-verifying parser - * This code is DEPRECATED, and should not be used anymore. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __DOCB_PARSER_H__ -#define __DOCB_PARSER_H__ -#include - -#ifdef LIBXML_DOCB_ENABLED - -#include -#include - -#ifndef IN_LIBXML -#ifdef __GNUC__ -#warning "The DOCBparser module has been deprecated in libxml2-2.6.0" -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Most of the back-end structures from XML and SGML are shared. - */ -typedef xmlParserCtxt docbParserCtxt; -typedef xmlParserCtxtPtr docbParserCtxtPtr; -typedef xmlSAXHandler docbSAXHandler; -typedef xmlSAXHandlerPtr docbSAXHandlerPtr; -typedef xmlParserInput docbParserInput; -typedef xmlParserInputPtr docbParserInputPtr; -typedef xmlDocPtr docbDocPtr; - -/* - * There is only few public functions. - */ -XMLPUBFUN int XMLCALL - docbEncodeEntities(unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen, int quoteChar); - -XMLPUBFUN docbDocPtr XMLCALL - docbSAXParseDoc (xmlChar *cur, - const char *encoding, - docbSAXHandlerPtr sax, - void *userData); -XMLPUBFUN docbDocPtr XMLCALL - docbParseDoc (xmlChar *cur, - const char *encoding); -XMLPUBFUN docbDocPtr XMLCALL - docbSAXParseFile (const char *filename, - const char *encoding, - docbSAXHandlerPtr sax, - void *userData); -XMLPUBFUN docbDocPtr XMLCALL - docbParseFile (const char *filename, - const char *encoding); - -/** - * Interfaces for the Push mode. - */ -XMLPUBFUN void XMLCALL - docbFreeParserCtxt (docbParserCtxtPtr ctxt); -XMLPUBFUN docbParserCtxtPtr XMLCALL - docbCreatePushParserCtxt(docbSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - docbParseChunk (docbParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -XMLPUBFUN docbParserCtxtPtr XMLCALL - docbCreateFileParserCtxt(const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - docbParseDocument (docbParserCtxtPtr ctxt); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_DOCB_ENABLED */ - -#endif /* __DOCB_PARSER_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLparser.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLparser.h deleted file mode 100644 index 05905e4b64..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLparser.h +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Summary: interface for an HTML 4.0 non-verifying parser - * Description: this module implements an HTML 4.0 non-verifying parser - * with API compatible with the XML parser ones. It should - * be able to parse "real world" HTML, even if severely - * broken from a specification point of view. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __HTML_PARSER_H__ -#define __HTML_PARSER_H__ -#include -#include - -#ifdef LIBXML_HTML_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Most of the back-end structures from XML and HTML are shared. - */ -typedef xmlParserCtxt htmlParserCtxt; -typedef xmlParserCtxtPtr htmlParserCtxtPtr; -typedef xmlParserNodeInfo htmlParserNodeInfo; -typedef xmlSAXHandler htmlSAXHandler; -typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; -typedef xmlParserInput htmlParserInput; -typedef xmlParserInputPtr htmlParserInputPtr; -typedef xmlDocPtr htmlDocPtr; -typedef xmlNodePtr htmlNodePtr; - -/* - * Internal description of an HTML element, representing HTML 4.01 - * and XHTML 1.0 (which share the same structure). - */ -typedef struct _htmlElemDesc htmlElemDesc; -typedef htmlElemDesc *htmlElemDescPtr; -struct _htmlElemDesc { - const char *name; /* The tag name */ - char startTag; /* Whether the start tag can be implied */ - char endTag; /* Whether the end tag can be implied */ - char saveEndTag; /* Whether the end tag should be saved */ - char empty; /* Is this an empty element ? */ - char depr; /* Is this a deprecated element ? */ - char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ - char isinline; /* is this a block 0 or inline 1 element */ - const char *desc; /* the description */ - -/* NRK Jan.2003 - * New fields encapsulating HTML structure - * - * Bugs: - * This is a very limited representation. It fails to tell us when - * an element *requires* subelements (we only have whether they're - * allowed or not), and it doesn't tell us where CDATA and PCDATA - * are allowed. Some element relationships are not fully represented: - * these are flagged with the word MODIFIER - */ - const char** subelts; /* allowed sub-elements of this element */ - const char* defaultsubelt; /* subelement for suggested auto-repair - if necessary or NULL */ - const char** attrs_opt; /* Optional Attributes */ - const char** attrs_depr; /* Additional deprecated attributes */ - const char** attrs_req; /* Required attributes */ -}; - -/* - * Internal description of an HTML entity. - */ -typedef struct _htmlEntityDesc htmlEntityDesc; -typedef htmlEntityDesc *htmlEntityDescPtr; -struct _htmlEntityDesc { - unsigned int value; /* the UNICODE value for the character */ - const char *name; /* The entity name */ - const char *desc; /* the description */ -}; - -/* - * There is only few public functions. - */ -XMLPUBFUN const htmlElemDesc * XMLCALL - htmlTagLookup (const xmlChar *tag); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityLookup(const xmlChar *name); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityValueLookup(unsigned int value); - -XMLPUBFUN int XMLCALL - htmlIsAutoClosed(htmlDocPtr doc, - htmlNodePtr elem); -XMLPUBFUN int XMLCALL - htmlAutoCloseTag(htmlDocPtr doc, - const xmlChar *name, - htmlNodePtr elem); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlParseEntityRef(htmlParserCtxtPtr ctxt, - const xmlChar **str); -XMLPUBFUN int XMLCALL - htmlParseCharRef(htmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - htmlParseElement(htmlParserCtxtPtr ctxt); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlNewParserCtxt(void); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreateMemoryParserCtxt(const char *buffer, - int size); - -XMLPUBFUN int XMLCALL - htmlParseDocument(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseDoc (xmlChar *cur, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseDoc (xmlChar *cur, - const char *encoding); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseFile(const char *filename, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseFile (const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - UTF8ToHtml (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -XMLPUBFUN int XMLCALL - htmlEncodeEntities(unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen, int quoteChar); -XMLPUBFUN int XMLCALL - htmlIsScriptAttribute(const xmlChar *name); -XMLPUBFUN int XMLCALL - htmlHandleOmittedElem(int val); - -#ifdef LIBXML_PUSH_ENABLED -/** - * Interfaces for the Push mode. - */ -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - htmlParseChunk (htmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -XMLPUBFUN void XMLCALL - htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ - HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ - HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - HTML_PARSE_NONET = 1<<11,/* Forbid network access */ - HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ -} htmlParserOption; - -XMLPUBFUN void XMLCALL - htmlCtxtReset (htmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* NRK/Jan2003: further knowledge of HTML structure - */ -typedef enum { - HTML_NA = 0 , /* something we don't check at all */ - HTML_INVALID = 0x1 , - HTML_DEPRECATED = 0x2 , - HTML_VALID = 0x4 , - HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ -} htmlStatus ; - -/* Using htmlElemDesc rather than name here, to emphasise the fact - that otherwise there's a lookup overhead -*/ -XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; -XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; -XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; -XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; -/** - * htmlDefaultSubelement: - * @elt: HTML element - * - * Returns the default subelement for this element - */ -#define htmlDefaultSubelement(elt) elt->defaultsubelt -/** - * htmlElementAllowedHereDesc: - * @parent: HTML parent element - * @elt: HTML element - * - * Checks whether an HTML element description may be a - * direct child of the specified element. - * - * Returns 1 if allowed; 0 otherwise. - */ -#define htmlElementAllowedHereDesc(parent,elt) \ - htmlElementAllowedHere((parent), (elt)->name) -/** - * htmlRequiredAttrs: - * @elt: HTML element - * - * Returns the attributes required for the specified element. - */ -#define htmlRequiredAttrs(elt) (elt)->attrs_req - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTML_ENABLED */ -#endif /* __HTML_PARSER_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX.h deleted file mode 100644 index 0ca161b608..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Summary: Old SAX version 1 handler, deprecated - * Description: DEPRECATED set of SAX version 1 interfaces used to - * build the DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX_H__ -#define __XML_SAX_H__ - -#include -#include -#include -#include -#include - -#ifdef LIBXML_LEGACY_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - getPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - getSystemId (void *ctx); -XMLPUBFUN void XMLCALL - setDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - getLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - getColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - isStandalone (void *ctx); -XMLPUBFUN int XMLCALL - hasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - hasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - internalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - externalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - getEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - getParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - resolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - entityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - attributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - elementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - notationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - unparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - startDocument (void *ctx); -XMLPUBFUN void XMLCALL - endDocument (void *ctx); -XMLPUBFUN void XMLCALL - attribute (void *ctx, - const xmlChar *fullname, - const xmlChar *value); -XMLPUBFUN void XMLCALL - startElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - endElement (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - ignorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - processingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - globalNamespace (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - setNamespace (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlNsPtr XMLCALL - getNamespace (void *ctx); -XMLPUBFUN int XMLCALL - checkNamespace (void *ctx, - xmlChar *nameSpace); -XMLPUBFUN void XMLCALL - namespaceDecl (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - cdataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_LEGACY_ENABLED */ - -#endif /* __XML_SAX_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX2.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX2.h deleted file mode 100644 index 8d2db02d85..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/SAX2.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Summary: SAX2 parser interface used to build the DOM tree - * Description: those are the default SAX2 interfaces used by - * the library when building DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX2_H__ -#define __XML_SAX2_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2SetDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2GetColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - xmlSAX2InternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - xmlSAX2ExternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlSAX2ResolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - xmlSAX2EntityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - xmlSAX2AttributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - xmlSAX2ElementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlSAX2NotationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - xmlSAX2UnparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2EndDocument (void *ctx); -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -XMLPUBFUN void XMLCALL - xmlSAX2StartElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - xmlSAX2EndElement (void *ctx, - const xmlChar *name); -#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ -XMLPUBFUN void XMLCALL - xmlSAX2StartElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); -XMLPUBFUN void XMLCALL - xmlSAX2EndElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); -XMLPUBFUN void XMLCALL - xmlSAX2Reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSAX2Characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2IgnorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2ProcessingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - xmlSAX2Comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlSAX2CDataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXDefaultVersion (int version); -#endif /* LIBXML_SAX1_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlSAXVersion (xmlSAXHandler *hdlr, - int version); -XMLPUBFUN void XMLCALL - xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - htmlDefaultSAXHandlerInit (void); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - docbDefaultSAXHandlerInit (void); -#endif -XMLPUBFUN void XMLCALL - xmlDefaultSAXHandlerInit (void); -#ifdef __cplusplus -} -#endif -#endif /* __XML_SAX2_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/c14n.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/c14n.h deleted file mode 100644 index a8aa737e11..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/c14n.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Summary: Provide Canonical XML and Exclusive XML Canonicalization - * Description: the c14n modules provides a - * - * "Canonical XML" implementation - * http://www.w3.org/TR/xml-c14n - * - * and an - * - * "Exclusive XML Canonicalization" implementation - * http://www.w3.org/TR/xml-exc-c14n - - * Copy: See Copyright for the status of this software. - * - * Author: Aleksey Sanin - */ -#ifndef __XML_C14N_H__ -#define __XML_C14N_H__ -#ifdef LIBXML_C14N_ENABLED -#ifdef LIBXML_OUTPUT_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include -#include - -/* - * XML Canonicazation - * http://www.w3.org/TR/xml-c14n - * - * Exclusive XML Canonicazation - * http://www.w3.org/TR/xml-exc-c14n - * - * Canonical form of an XML document could be created if and only if - * a) default attributes (if any) are added to all nodes - * b) all character and parsed entity references are resolved - * In order to achive this in libxml2 the document MUST be loaded with - * following global setings: - * - * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * xmlSubstituteEntitiesDefault(1); - * - * or corresponding parser context setting: - * xmlParserCtxtPtr ctxt; - * - * ... - * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * ctxt->replaceEntities = 1; - * ... - */ - - -XMLPUBFUN int XMLCALL - xmlC14NDocSaveTo (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -XMLPUBFUN int XMLCALL - xmlC14NDocDumpMemory (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlChar **doc_txt_ptr); - -XMLPUBFUN int XMLCALL - xmlC14NDocSave (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - const char* filename, - int compression); - - -/** - * This is the core C14N function - */ -/** - * xmlC14NIsVisibleCallback: - * @user_data: user data - * @node: the curent node - * @parent: the parent node - * - * Signature for a C14N callback on visible nodes - * - * Returns 1 if the node should be included - */ -typedef int (*xmlC14NIsVisibleCallback) (void* user_data, - xmlNodePtr node, - xmlNodePtr parent); - -XMLPUBFUN int XMLCALL - xmlC14NExecute (xmlDocPtr doc, - xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, - int exclusive, - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* LIBXML_OUTPUT_ENABLED */ -#endif /* LIBXML_C14N_ENABLED */ -#endif /* __XML_C14N_H__ */ - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/debugXML.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/debugXML.h deleted file mode 100644 index 5a9d20bcf5..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/debugXML.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Summary: Tree debugging APIs - * Description: Interfaces to a set of routines used for debugging the tree - * produced by the XML parser. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __DEBUG_XML__ -#define __DEBUG_XML__ -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The standard Dump routines. - */ -XMLPUBFUN void XMLCALL - xmlDebugDumpString (FILE *output, - const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttr (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttrList (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpOneNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNodeList (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocumentHead(FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocument (FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDTD (FILE *output, - xmlDtdPtr dtd); -XMLPUBFUN void XMLCALL - xmlDebugDumpEntities (FILE *output, - xmlDocPtr doc); - -/**************************************************************** - * * - * Checking routines * - * * - ****************************************************************/ - -XMLPUBFUN int XMLCALL - xmlDebugCheckDocument (FILE * output, - xmlDocPtr doc); - -/**************************************************************** - * * - * XML shell helpers * - * * - ****************************************************************/ - -XMLPUBFUN void XMLCALL - xmlLsOneNode (FILE *output, xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlLsCountNode (xmlNodePtr node); - -XMLPUBFUN const char * XMLCALL - xmlBoolToText (int boolval); - -/**************************************************************** - * * - * The XML shell related structures and functions * - * * - ****************************************************************/ - -#ifdef LIBXML_XPATH_ENABLED -/** - * xmlShellReadlineFunc: - * @prompt: a string prompt - * - * This is a generic signature for the XML shell input function. - * - * Returns a string which will be freed by the Shell. - */ -typedef char * (* xmlShellReadlineFunc)(char *prompt); - -/** - * xmlShellCtxt: - * - * A debugging shell context. - * TODO: add the defined function tables. - */ -typedef struct _xmlShellCtxt xmlShellCtxt; -typedef xmlShellCtxt *xmlShellCtxtPtr; -struct _xmlShellCtxt { - char *filename; - xmlDocPtr doc; - xmlNodePtr node; - xmlXPathContextPtr pctxt; - int loaded; - FILE *output; - xmlShellReadlineFunc input; -}; - -/** - * xmlShellCmd: - * @ctxt: a shell context - * @arg: a string argument - * @node: a first node - * @node2: a second node - * - * This is a generic signature for the XML shell functions. - * - * Returns an int, negative returns indicating errors. - */ -typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); - -XMLPUBFUN void XMLCALL - xmlShellPrintXPathError (int errorType, - const char *arg); -XMLPUBFUN void XMLCALL - xmlShellPrintXPathResult(xmlXPathObjectPtr list); -XMLPUBFUN int XMLCALL - xmlShellList (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellBase (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellDir (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellLoad (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlShellPrintNode (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlShellCat (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellWrite (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellSave (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL - xmlShellValidate (xmlShellCtxtPtr ctxt, - char *dtd, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_VALID_ENABLED */ -XMLPUBFUN int XMLCALL - xmlShellDu (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr tree, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellPwd (xmlShellCtxtPtr ctxt, - char *buffer, - xmlNodePtr node, - xmlNodePtr node2); - -/* - * The Shell interface. - */ -XMLPUBFUN void XMLCALL - xmlShell (xmlDocPtr doc, - char *filename, - xmlShellReadlineFunc input, - FILE *output); - -#endif /* LIBXML_XPATH_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_DEBUG_ENABLED */ -#endif /* __DEBUG_XML__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/encoding.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/encoding.h deleted file mode 100644 index c74b25f3cb..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/encoding.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Summary: interface for the encoding conversion functions - * Description: interface for the encoding conversion functions needed for - * XML basic encoding and iconv() support. - * - * Related specs are - * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies - * [ISO-10646] UTF-8 and UTF-16 in Annexes - * [ISO-8859-1] ISO Latin-1 characters codes. - * [UNICODE] The Unicode Consortium, "The Unicode Standard -- - * Worldwide Character Encoding -- Version 1.0", Addison- - * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is - * described in Unicode Technical Report #4. - * [US-ASCII] Coded Character Set--7-bit American Standard Code for - * Information Interchange, ANSI X3.4-1986. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CHAR_ENCODING_H__ -#define __XML_CHAR_ENCODING_H__ - -#include - -#ifdef LIBXML_ICONV_ENABLED -#include -#endif -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlCharEncoding: - * - * Predefined values for some standard encodings. - * Libxml does not do beforehand translation on UTF8 and ISOLatinX. - * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. - * - * Anything else would have to be translated to UTF8 before being - * given to the parser itself. The BOM for UTF16 and the encoding - * declaration are looked at and a converter is looked for at that - * point. If not found the parser stops here as asked by the XML REC. A - * converter can be registered by the user using xmlRegisterCharEncodingHandler - * but the current form doesn't allow stateful transcoding (a serious - * problem agreed !). If iconv has been found it will be used - * automatically and allow stateful transcoding, the simplest is then - * to be sure to enable iconv and to provide iconv libs for the encoding - * support needed. - * - * Note that the generic "UTF-16" is not a predefined value. Instead, only - * the specific UTF-16LE and UTF-16BE are present. - */ -typedef enum { - XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ - XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ - XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ - XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ - XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ - XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ - XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ - XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ - XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ - XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ - XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ - XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ - XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ - XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ - XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ - XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ - XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ - XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ - XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ - XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ - XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ - XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ -} xmlCharEncoding; - -/** - * xmlCharEncodingInputFunc: - * @out: a pointer to an array of bytes to store the UTF-8 result - * @outlen: the length of @out - * @in: a pointer to an array of chars in the original encoding - * @inlen: the length of @in - * - * Take a block of chars in the original encoding and try to convert - * it to an UTF-8 block of chars out. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets consumed. - */ -typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/** - * xmlCharEncodingOutputFunc: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * - * Take a block of UTF-8 chars in and try to convert it to another - * encoding. - * Note: a first call designed to produce heading info is called with - * in = NULL. If stateful this should also initialize the encoder state. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets produced. - */ -typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/* - * Block defining the handlers for non UTF-8 encodings. - * If iconv is supported, there are two extra fields. - */ - -typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; -typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; -struct _xmlCharEncodingHandler { - char *name; - xmlCharEncodingInputFunc input; - xmlCharEncodingOutputFunc output; -#ifdef LIBXML_ICONV_ENABLED - iconv_t iconv_in; - iconv_t iconv_out; -#endif /* LIBXML_ICONV_ENABLED */ -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Interfaces for encoding handlers. - */ -XMLPUBFUN void XMLCALL - xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlGetCharEncodingHandler (xmlCharEncoding enc); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlFindCharEncodingHandler (const char *name); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); - -/* - * Interfaces for encoding names and aliases. - */ -XMLPUBFUN int XMLCALL - xmlAddEncodingAlias (const char *name, - const char *alias); -XMLPUBFUN int XMLCALL - xmlDelEncodingAlias (const char *alias); -XMLPUBFUN const char * XMLCALL - xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL - xmlCleanupEncodingAliases (void); -XMLPUBFUN xmlCharEncoding XMLCALL - xmlParseCharEncoding (const char *name); -XMLPUBFUN const char * XMLCALL - xmlGetCharEncodingName (xmlCharEncoding enc); - -/* - * Interfaces directly used by the parsers. - */ -XMLPUBFUN xmlCharEncoding XMLCALL - xmlDetectCharEncoding (const unsigned char *in, - int len); - -XMLPUBFUN int XMLCALL - xmlCharEncOutFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); - -XMLPUBFUN int XMLCALL - xmlCharEncInFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncFirstLine (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); - -/* - * Export a few useful functions - */ -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL - UTF8Toisolat1 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - isolat1ToUTF8 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#ifdef __cplusplus -} -#endif - -#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/entities.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/entities.h deleted file mode 100644 index cefb97f780..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/entities.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Summary: interface for the XML entities handling - * Description: this module provides some of the entity API needed - * for the parser and applications. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_ENTITIES_H__ -#define __XML_ENTITIES_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The different valid entity types. - */ -typedef enum { - XML_INTERNAL_GENERAL_ENTITY = 1, - XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, - XML_INTERNAL_PARAMETER_ENTITY = 4, - XML_EXTERNAL_PARAMETER_ENTITY = 5, - XML_INTERNAL_PREDEFINED_ENTITY = 6 -} xmlEntityType; - -/* - * An unit of storage for an entity, contains the string, the value - * and the linkind data needed for the linking in the hash table. - */ - -struct _xmlEntity { - void *_private; /* application data */ - xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ - const xmlChar *name; /* Entity name */ - struct _xmlNode *children; /* First child link */ - struct _xmlNode *last; /* Last child link */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlChar *orig; /* content without ref substitution */ - xmlChar *content; /* content or ndata if unparsed */ - int length; /* the content length */ - xmlEntityType etype; /* The entity type */ - const xmlChar *ExternalID; /* External identifier for PUBLIC */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ - - struct _xmlEntity *nexte; /* unused */ - const xmlChar *URI; /* the full URI as computed */ - int owner; /* does the entity own the childrens */ - int checked; /* was the entity content checked */ - /* this is also used to count entites - * references done from that entity */ -}; - -/* - * All entities are stored in an hash table. - * There is 2 separate hash tables for global and parameter entities. - */ - -typedef struct _xmlHashTable xmlEntitiesTable; -typedef xmlEntitiesTable *xmlEntitiesTablePtr; - -/* - * External functions: - */ - -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlInitializePredefinedEntities (void); -#endif /* LIBXML_LEGACY_ENABLED */ - -XMLPUBFUN xmlEntityPtr XMLCALL - xmlNewEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDocEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDtdEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDocEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDtdEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetParameterEntity (xmlDocPtr doc, - const xmlChar *name); -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlEncodeEntities (xmlDocPtr doc, - const xmlChar *input); -#endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeEntitiesReentrant(xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeSpecialChars (xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCreateEntitiesTable (void); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCopyEntitiesTable (xmlEntitiesTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeEntitiesTable (xmlEntitiesTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpEntitiesTable (xmlBufferPtr buf, - xmlEntitiesTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpEntityDecl (xmlBufferPtr buf, - xmlEntityPtr ent); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlCleanupPredefinedEntities(void); -#endif /* LIBXML_LEGACY_ENABLED */ - - -#ifdef __cplusplus -} -#endif - -# endif /* __XML_ENTITIES_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/globals.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/globals.h deleted file mode 100644 index 57e25fa514..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/globals.h +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Summary: interface for all global variables of the library - * Description: all the global variables and thread handling for - * those variables is handled by this module. - * - * The bottom of this file is automatically generated by build_glob.py - * based on the description file global.data - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington , Daniel Veillard - */ - -#ifndef __XML_GLOBALS_H -#define __XML_GLOBALS_H - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitGlobals(void); -XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); - -/** - * xmlParserInputBufferCreateFilenameFunc: - * @URI: the URI to read from - * @enc: the requested source encoding - * - * Signature for the function doing the lookup for a suitable input method - * corresponding to an URI. - * - * Returns the new xmlParserInputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc); - -/** - * xmlOutputBufferCreateFilenameFunc: - * @URI: the URI to write to - * @enc: the requested target encoding - * - * Signature for the function doing the lookup for a suitable output method - * corresponding to an URI. - * - * Returns the new xmlOutputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc -XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc -XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); - -/* - * Externally global symbols which need to be protected for backwards - * compatibility support. - */ - -#undef docbDefaultSAXHandler -#undef htmlDefaultSAXHandler -#undef oldXMLWDcompatibility -#undef xmlBufferAllocScheme -#undef xmlDefaultBufferSize -#undef xmlDefaultSAXHandler -#undef xmlDefaultSAXLocator -#undef xmlDoValidityCheckingDefaultValue -#undef xmlFree -#undef xmlGenericError -#undef xmlStructuredError -#undef xmlGenericErrorContext -#undef xmlGetWarningsDefaultValue -#undef xmlIndentTreeOutput -#undef xmlTreeIndentString -#undef xmlKeepBlanksDefaultValue -#undef xmlLineNumbersDefaultValue -#undef xmlLoadExtDtdDefaultValue -#undef xmlMalloc -#undef xmlMallocAtomic -#undef xmlMemStrdup -#undef xmlParserDebugEntities -#undef xmlParserVersion -#undef xmlPedanticParserDefaultValue -#undef xmlRealloc -#undef xmlSaveNoEmptyTags -#undef xmlSubstituteEntitiesDefaultValue -#undef xmlRegisterNodeDefaultValue -#undef xmlDeregisterNodeDefaultValue -#undef xmlLastError -#undef xmlParserInputBufferCreateFilenameValue -#undef xmlOutputBufferCreateFilenameValue - -/** - * xmlRegisterNodeFunc: - * @node: the current node - * - * Signature for the registration callback of a created node - */ -typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); -/** - * xmlDeregisterNodeFunc: - * @node: the current node - * - * Signature for the deregistration callback of a discarded node - */ -typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); - -typedef struct _xmlGlobalState xmlGlobalState; -typedef xmlGlobalState *xmlGlobalStatePtr; -struct _xmlGlobalState -{ - const char *xmlParserVersion; - - xmlSAXLocator xmlDefaultSAXLocator; - xmlSAXHandlerV1 xmlDefaultSAXHandler; - xmlSAXHandlerV1 docbDefaultSAXHandler; - xmlSAXHandlerV1 htmlDefaultSAXHandler; - - xmlFreeFunc xmlFree; - xmlMallocFunc xmlMalloc; - xmlStrdupFunc xmlMemStrdup; - xmlReallocFunc xmlRealloc; - - xmlGenericErrorFunc xmlGenericError; - xmlStructuredErrorFunc xmlStructuredError; - void *xmlGenericErrorContext; - - int oldXMLWDcompatibility; - - xmlBufferAllocationScheme xmlBufferAllocScheme; - int xmlDefaultBufferSize; - - int xmlSubstituteEntitiesDefaultValue; - int xmlDoValidityCheckingDefaultValue; - int xmlGetWarningsDefaultValue; - int xmlKeepBlanksDefaultValue; - int xmlLineNumbersDefaultValue; - int xmlLoadExtDtdDefaultValue; - int xmlParserDebugEntities; - int xmlPedanticParserDefaultValue; - - int xmlSaveNoEmptyTags; - int xmlIndentTreeOutput; - const char *xmlTreeIndentString; - - xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; - - xmlMallocFunc xmlMallocAtomic; - xmlError xmlLastError; - - xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; - xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); - -XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); - -XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); - -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL - xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL - xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func); - -/** DOC_DISABLE */ -/* - * In general the memory allocation entry points are not kept - * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED - * - xmlMalloc - * - xmlMallocAtomic - * - xmlRealloc - * - xmlMemStrdup - * - xmlFree - */ - -#ifdef LIBXML_THREAD_ALLOC_ENABLED -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); -#define xmlMalloc \ -(*(__xmlMalloc())) -#else -XMLPUBVAR xmlMallocFunc xmlMalloc; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); -#define xmlMallocAtomic \ -(*(__xmlMallocAtomic())) -#else -XMLPUBVAR xmlMallocFunc xmlMallocAtomic; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); -#define xmlRealloc \ -(*(__xmlRealloc())) -#else -XMLPUBVAR xmlReallocFunc xmlRealloc; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); -#define xmlFree \ -(*(__xmlFree())) -#else -XMLPUBVAR xmlFreeFunc xmlFree; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); -#define xmlMemStrdup \ -(*(__xmlMemStrdup())) -#else -XMLPUBVAR xmlStrdupFunc xmlMemStrdup; -#endif - -#else /* !LIBXML_THREAD_ALLOC_ENABLED */ -XMLPUBVAR xmlMallocFunc xmlMalloc; -XMLPUBVAR xmlMallocFunc xmlMallocAtomic; -XMLPUBVAR xmlReallocFunc xmlRealloc; -XMLPUBVAR xmlFreeFunc xmlFree; -XMLPUBVAR xmlStrdupFunc xmlMemStrdup; -#endif /* LIBXML_THREAD_ALLOC_ENABLED */ - -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define docbDefaultSAXHandler \ -(*(__docbDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; -#endif -#endif - -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define htmlDefaultSAXHandler \ -(*(__htmlDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; -#endif -#endif - -XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLastError \ -(*(__xmlLastError())) -#else -XMLPUBVAR xmlError xmlLastError; -#endif - -/* - * Everything starting from the line below is - * Automatically generated by build_glob.py. - * Do not modify the previous line. - */ - - -XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); -#ifdef LIBXML_THREAD_ENABLED -#define oldXMLWDcompatibility \ -(*(__oldXMLWDcompatibility())) -#else -XMLPUBVAR int oldXMLWDcompatibility; -#endif - -XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlBufferAllocScheme \ -(*(__xmlBufferAllocScheme())) -#else -XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; -#endif -XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); - -XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultBufferSize \ -(*(__xmlDefaultBufferSize())) -#else -XMLPUBVAR int xmlDefaultBufferSize; -#endif -XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); - -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultSAXHandler \ -(*(__xmlDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; -#endif - -XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultSAXLocator \ -(*(__xmlDefaultSAXLocator())) -#else -XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; -#endif - -XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDoValidityCheckingDefaultValue \ -(*(__xmlDoValidityCheckingDefaultValue())) -#else -XMLPUBVAR int xmlDoValidityCheckingDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); - -XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGenericError \ -(*(__xmlGenericError())) -#else -XMLPUBVAR xmlGenericErrorFunc xmlGenericError; -#endif - -XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlStructuredError \ -(*(__xmlStructuredError())) -#else -XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; -#endif - -XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGenericErrorContext \ -(*(__xmlGenericErrorContext())) -#else -XMLPUBVAR void * xmlGenericErrorContext; -#endif - -XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGetWarningsDefaultValue \ -(*(__xmlGetWarningsDefaultValue())) -#else -XMLPUBVAR int xmlGetWarningsDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlIndentTreeOutput \ -(*(__xmlIndentTreeOutput())) -#else -XMLPUBVAR int xmlIndentTreeOutput; -#endif -XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); - -XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlTreeIndentString \ -(*(__xmlTreeIndentString())) -#else -XMLPUBVAR const char * xmlTreeIndentString; -#endif -XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); - -XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlKeepBlanksDefaultValue \ -(*(__xmlKeepBlanksDefaultValue())) -#else -XMLPUBVAR int xmlKeepBlanksDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLineNumbersDefaultValue \ -(*(__xmlLineNumbersDefaultValue())) -#else -XMLPUBVAR int xmlLineNumbersDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLoadExtDtdDefaultValue \ -(*(__xmlLoadExtDtdDefaultValue())) -#else -XMLPUBVAR int xmlLoadExtDtdDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserDebugEntities \ -(*(__xmlParserDebugEntities())) -#else -XMLPUBVAR int xmlParserDebugEntities; -#endif -XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); - -XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserVersion \ -(*(__xmlParserVersion())) -#else -XMLPUBVAR const char * xmlParserVersion; -#endif - -XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlPedanticParserDefaultValue \ -(*(__xmlPedanticParserDefaultValue())) -#else -XMLPUBVAR int xmlPedanticParserDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlSaveNoEmptyTags \ -(*(__xmlSaveNoEmptyTags())) -#else -XMLPUBVAR int xmlSaveNoEmptyTags; -#endif -XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); - -XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlSubstituteEntitiesDefaultValue \ -(*(__xmlSubstituteEntitiesDefaultValue())) -#else -XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); - -XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlRegisterNodeDefaultValue \ -(*(__xmlRegisterNodeDefaultValue())) -#else -XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; -#endif - -XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDeregisterNodeDefaultValue \ -(*(__xmlDeregisterNodeDefaultValue())) -#else -XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; -#endif - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserInputBufferCreateFilenameValue \ -(*(__xmlParserInputBufferCreateFilenameValue())) -#else -XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; -#endif - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlOutputBufferCreateFilenameValue \ -(*(__xmlOutputBufferCreateFilenameValue())) -#else -XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_GLOBALS_H */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/hash.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/hash.h deleted file mode 100644 index 7fe4be754c..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/hash.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Bjorn Reese - */ - -#ifndef __XML_HASH_H__ -#define __XML_HASH_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The hash table. - */ -typedef struct _xmlHashTable xmlHashTable; -typedef xmlHashTable *xmlHashTablePtr; - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Recent version of gcc produce a warning when a function pointer is assigned - * to an object pointer, or vice versa. The following macro is a dirty hack - * to allow suppression of the warning. If your architecture has function - * pointers which are a different size than a void pointer, there may be some - * serious trouble within the library. - */ -/** - * XML_CAST_FPTR: - * @fptr: pointer to a function - * - * Macro to do a casting from an object pointer to a - * function pointer without encountering a warning from - * gcc - * - * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) - * This macro violated ISO C aliasing rules (gcc4 on s390 broke) - * so it is disabled now - */ - -#define XML_CAST_FPTR(fptr) fptr - - -/* - * function types: - */ -/** - * xmlHashDeallocator: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to free data from a hash. - */ -typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); -/** - * xmlHashCopier: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to copy data from a hash. - * - * Returns a copy of the data or NULL in case of error. - */ -typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); -/** - * xmlHashScanner: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * - * Callback when scanning data in a hash with the simple scanner. - */ -typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); -/** - * xmlHashScannerFull: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * @name2: the second name associated - * @name3: the third name associated - * - * Callback when scanning data in a hash with the full scanner. - */ -typedef void (*xmlHashScannerFull)(void *payload, void *data, - const xmlChar *name, const xmlChar *name2, - const xmlChar *name3); - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreate (int size); -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreateDict(int size, - xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlHashFree (xmlHashTablePtr table, - xmlHashDeallocator f); - -/* - * Add a new entry to the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashAddEntry (xmlHashTablePtr table, - const xmlChar *name, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry(xmlHashTablePtr table, - const xmlChar *name, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata, - xmlHashDeallocator f); - -/* - * Remove an entry from the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashDeallocator f); - -/* - * Retrieve the userdata. - */ -XMLPUBFUN void * XMLCALL - xmlHashLookup (xmlHashTablePtr table, - const xmlChar *name); -XMLPUBFUN void * XMLCALL - xmlHashLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2); -XMLPUBFUN void * XMLCALL - xmlHashLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3); -XMLPUBFUN void * XMLCALL - xmlHashQLookup (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN void * XMLCALL - xmlHashQLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL - xmlHashQLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2, - const xmlChar *name3, - const xmlChar *prefix3); - -/* - * Helpers. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCopy (xmlHashTablePtr table, - xmlHashCopier f); -XMLPUBFUN int XMLCALL - xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL - xmlHashScan (xmlHashTablePtr table, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScan3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull (xmlHashTablePtr table, - xmlHashScannerFull f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScannerFull f, - void *data); -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_HASH_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/list.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/list.h deleted file mode 100644 index 1d83482430..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/list.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Summary: lists interfaces - * Description: this module implement the list support used in - * various place in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington - */ - -#ifndef __XML_LINK_INCLUDE__ -#define __XML_LINK_INCLUDE__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlLink xmlLink; -typedef xmlLink *xmlLinkPtr; - -typedef struct _xmlList xmlList; -typedef xmlList *xmlListPtr; - -/** - * xmlListDeallocator: - * @lk: the data to deallocate - * - * Callback function used to free data from a list. - */ -typedef void (*xmlListDeallocator) (xmlLinkPtr lk); -/** - * xmlListDataCompare: - * @data0: the first data - * @data1: the second data - * - * Callback function used to compare 2 data. - * - * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. - */ -typedef int (*xmlListDataCompare) (const void *data0, const void *data1); -/** - * xmlListWalker: - * @data: the data found in the list - * @user: extra user provided data to the walker - * - * Callback function used when walking a list with xmlListWalk(). - * - * Returns 0 to stop walking the list, 1 otherwise. - */ -typedef int (*xmlListWalker) (const void *data, const void *user); - -/* Creation/Deletion */ -XMLPUBFUN xmlListPtr XMLCALL - xmlListCreate (xmlListDeallocator deallocator, - xmlListDataCompare compare); -XMLPUBFUN void XMLCALL - xmlListDelete (xmlListPtr l); - -/* Basic Operators */ -XMLPUBFUN void * XMLCALL - xmlListSearch (xmlListPtr l, - void *data); -XMLPUBFUN void * XMLCALL - xmlListReverseSearch (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListInsert (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListAppend (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListRemoveFirst (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveLast (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveAll (xmlListPtr l, - void *data); -XMLPUBFUN void XMLCALL - xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListSize (xmlListPtr l); - -XMLPUBFUN void XMLCALL - xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListPushFront (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListPushBack (xmlListPtr l, - void *data); - -/* Advanced Operators */ -XMLPUBFUN void XMLCALL - xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListReverseWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListMerge (xmlListPtr l1, - xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL - xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL - xmlListCopy (xmlListPtr cur, - const xmlListPtr old); -/* Link operators */ -XMLPUBFUN void * XMLCALL - xmlLinkGetData (xmlLinkPtr lk); - -/* xmlListUnique() */ -/* xmlListSwap */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_LINK_INCLUDE__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanoftp.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanoftp.h deleted file mode 100644 index e3c28a0142..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanoftp.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Summary: minimal FTP implementation - * Description: minimal FTP implementation allowing to fetch resources - * like external subset. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __NANO_FTP_H__ -#define __NANO_FTP_H__ - -#include - -#ifdef LIBXML_FTP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * ftpListCallback: - * @userData: user provided data for the callback - * @filename: the file name (including "->" when links are shown) - * @attrib: the attribute string - * @owner: the owner string - * @group: the group string - * @size: the file size - * @links: the link count - * @year: the year - * @month: the month - * @day: the day - * @hour: the hour - * @minute: the minute - * - * A callback for the xmlNanoFTPList command. - * Note that only one of year and day:minute are specified. - */ -typedef void (*ftpListCallback) (void *userData, - const char *filename, const char *attrib, - const char *owner, const char *group, - unsigned long size, int links, int year, - const char *month, int day, int hour, - int minute); -/** - * ftpDataCallback: - * @userData: the user provided context - * @data: the data received - * @len: its size in bytes - * - * A callback for the xmlNanoFTPGet command. - */ -typedef void (*ftpDataCallback) (void *userData, - const char *data, - int len); - -/* - * Init - */ -XMLPUBFUN void XMLCALL - xmlNanoFTPInit (void); -XMLPUBFUN void XMLCALL - xmlNanoFTPCleanup (void); - -/* - * Creating/freeing contexts. - */ -XMLPUBFUN void * XMLCALL - xmlNanoFTPNewCtxt (const char *URL); -XMLPUBFUN void XMLCALL - xmlNanoFTPFreeCtxt (void * ctx); -XMLPUBFUN void * XMLCALL - xmlNanoFTPConnectTo (const char *server, - int port); -/* - * Opening/closing session connections. - */ -XMLPUBFUN void * XMLCALL - xmlNanoFTPOpen (const char *URL); -XMLPUBFUN int XMLCALL - xmlNanoFTPConnect (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPClose (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPQuit (void *ctx); -XMLPUBFUN void XMLCALL - xmlNanoFTPScanProxy (const char *URL); -XMLPUBFUN void XMLCALL - xmlNanoFTPProxy (const char *host, - int port, - const char *user, - const char *passwd, - int type); -XMLPUBFUN int XMLCALL - xmlNanoFTPUpdateURL (void *ctx, - const char *URL); - -/* - * Rather internal commands. - */ -XMLPUBFUN int XMLCALL - xmlNanoFTPGetResponse (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPCheckResponse (void *ctx); - -/* - * CD/DIR/GET handlers. - */ -XMLPUBFUN int XMLCALL - xmlNanoFTPCwd (void *ctx, - const char *directory); -XMLPUBFUN int XMLCALL - xmlNanoFTPDele (void *ctx, - const char *file); - -XMLPUBFUN int XMLCALL - xmlNanoFTPGetConnection (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPCloseConnection(void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPList (void *ctx, - ftpListCallback callback, - void *userData, - const char *filename); -XMLPUBFUN int XMLCALL - xmlNanoFTPGetSocket (void *ctx, - const char *filename); -XMLPUBFUN int XMLCALL - xmlNanoFTPGet (void *ctx, - ftpDataCallback callback, - void *userData, - const char *filename); -XMLPUBFUN int XMLCALL - xmlNanoFTPRead (void *ctx, - void *dest, - int len); - -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_FTP_ENABLED */ -#endif /* __NANO_FTP_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parser.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parser.h deleted file mode 100644 index 567addbaa4..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parser.h +++ /dev/null @@ -1,1226 +0,0 @@ -/* - * Summary: the core parser module - * Description: Interfaces, constants and types related to the XML parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_H__ -#define __XML_PARSER_H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_DEFAULT_VERSION: - * - * The default version of XML used: 1.0 - */ -#define XML_DEFAULT_VERSION "1.0" - -/** - * xmlParserInput: - * - * An xmlParserInput is an input flow for the XML processor. - * Each entity parsed is associated an xmlParserInput (except the - * few predefined ones). This is the case both for internal entities - * - in which case the flow is already completely in memory - or - * external entities - in which case we use the buf structure for - * progressive reading and I18N conversions to the internal UTF-8 format. - */ - -/** - * xmlParserInputDeallocate: - * @str: the string to deallocate - * - * Callback for freeing some parser input allocations. - */ -typedef void (* xmlParserInputDeallocate)(xmlChar *str); - -struct _xmlParserInput { - /* Input buffer */ - xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ - - const char *filename; /* The file analyzed, if any */ - const char *directory; /* the directory/base of the file */ - const xmlChar *base; /* Base of the array to parse */ - const xmlChar *cur; /* Current char being parsed */ - const xmlChar *end; /* end of the array to parse */ - int length; /* length if known */ - int line; /* Current line */ - int col; /* Current column */ - /* - * NOTE: consumed is only tested for equality in the parser code, - * so even if there is an overflow this should not give troubles - * for parsing very large instances. - */ - unsigned long consumed; /* How many xmlChars already consumed */ - xmlParserInputDeallocate free; /* function to deallocate the base */ - const xmlChar *encoding; /* the encoding string for entity */ - const xmlChar *version; /* the version string for entity */ - int standalone; /* Was that entity marked standalone */ - int id; /* an unique identifier for the entity */ -}; - -/** - * xmlParserNodeInfo: - * - * The parser can be asked to collect Node informations, i.e. at what - * place in the file they were detected. - * NOTE: This is off by default and not very well tested. - */ -typedef struct _xmlParserNodeInfo xmlParserNodeInfo; -typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; - -struct _xmlParserNodeInfo { - const struct _xmlNode* node; - /* Position & line # that text that created the node begins & ends on */ - unsigned long begin_pos; - unsigned long begin_line; - unsigned long end_pos; - unsigned long end_line; -}; - -typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; -typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; -struct _xmlParserNodeInfoSeq { - unsigned long maximum; - unsigned long length; - xmlParserNodeInfo* buffer; -}; - -/** - * xmlParserInputState: - * - * The parser is now working also as a state based parser. - * The recursive one use the state info for entities processing. - */ -typedef enum { - XML_PARSER_EOF = -1, /* nothing is to be parsed */ - XML_PARSER_START = 0, /* nothing has been parsed */ - XML_PARSER_MISC, /* Misc* before int subset */ - XML_PARSER_PI, /* Within a processing instruction */ - XML_PARSER_DTD, /* within some DTD content */ - XML_PARSER_PROLOG, /* Misc* after internal subset */ - XML_PARSER_COMMENT, /* within a comment */ - XML_PARSER_START_TAG, /* within a start tag */ - XML_PARSER_CONTENT, /* within the content */ - XML_PARSER_CDATA_SECTION, /* within a CDATA section */ - XML_PARSER_END_TAG, /* within a closing tag */ - XML_PARSER_ENTITY_DECL, /* within an entity declaration */ - XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ - XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ - XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG, /* the Misc* after the last end tag */ - XML_PARSER_IGNORE, /* within an IGNORED section */ - XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ -} xmlParserInputState; - -/** - * XML_DETECT_IDS: - * - * Bit in the loadsubset context field to tell to do ID/REFs lookups. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_DETECT_IDS 2 - -/** - * XML_COMPLETE_ATTRS: - * - * Bit in the loadsubset context field to tell to do complete the - * elements attributes lists with the ones defaulted from the DTDs. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_COMPLETE_ATTRS 4 - -/** - * XML_SKIP_IDS: - * - * Bit in the loadsubset context field to tell to not do ID/REFs registration. - * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. - */ -#define XML_SKIP_IDS 8 - -/** - * xmlParserMode: - * - * A parser can operate in various modes - */ -typedef enum { - XML_PARSE_UNKNOWN = 0, - XML_PARSE_DOM = 1, - XML_PARSE_SAX = 2, - XML_PARSE_PUSH_DOM = 3, - XML_PARSE_PUSH_SAX = 4, - XML_PARSE_READER = 5 -} xmlParserMode; - -/** - * xmlParserCtxt: - * - * The parser context. - * NOTE This doesn't completely define the parser state, the (current ?) - * design of the parser uses recursive function calls since this allow - * and easy mapping from the production rules of the specification - * to the actual code. The drawback is that the actual function call - * also reflect the parser state. However most of the parsing routines - * takes as the only argument the parser context pointer, so migrating - * to a state based parser for progressive parsing shouldn't be too hard. - */ -struct _xmlParserCtxt { - struct _xmlSAXHandler *sax; /* The SAX handler */ - void *userData; /* For SAX interface only, used by DOM build */ - xmlDocPtr myDoc; /* the document being built */ - int wellFormed; /* is the document well formed */ - int replaceEntities; /* shall we replace entities ? */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* the declared encoding, if any */ - int standalone; /* standalone document */ - int html; /* an HTML(1)/Docbook(2) document */ - - /* Input stream stack */ - xmlParserInputPtr input; /* Current input stream */ - int inputNr; /* Number of current input streams */ - int inputMax; /* Max number of input streams */ - xmlParserInputPtr *inputTab; /* stack of inputs */ - - /* Node analysis stack only used for DOM building */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - int record_info; /* Whether node info should be kept */ - xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ - - int errNo; /* error code */ - - int hasExternalSubset; /* reference and external subset */ - int hasPErefs; /* the internal subset has PE refs */ - int external; /* are we parsing an external entity */ - - int valid; /* is the document valid */ - int validate; /* shall we try to validate ? */ - xmlValidCtxt vctxt; /* The validity context */ - - xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ - - char *directory; /* the data directory */ - - /* Node name stack */ - const xmlChar *name; /* Current parsed Node */ - int nameNr; /* Depth of the parsing stack */ - int nameMax; /* Max depth of the parsing stack */ - const xmlChar * *nameTab; /* array of nodes */ - - long nbChars; /* number of xmlChar processed */ - long checkIndex; /* used by progressive parsing lookup */ - int keepBlanks; /* ugly but ... */ - int disableSAX; /* SAX callbacks are disabled */ - int inSubset; /* Parsing is in int 1/ext 2 subset */ - const xmlChar * intSubName; /* name of subset */ - xmlChar * extSubURI; /* URI of external subset */ - xmlChar * extSubSystem; /* SYSTEM ID of external subset */ - - /* xml:space values */ - int * space; /* Should the parser preserve spaces */ - int spaceNr; /* Depth of the parsing stack */ - int spaceMax; /* Max depth of the parsing stack */ - int * spaceTab; /* array of space infos */ - - int depth; /* to prevent entity substitution loops */ - xmlParserInputPtr entity; /* used to check entities boundaries */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - int nodelen; /* Those two fields are there to */ - int nodemem; /* Speed up large node parsing */ - int pedantic; /* signal pedantic warnings */ - void *_private; /* For user data, libxml won't touch it */ - - int loadsubset; /* should the external subset be loaded */ - int linenumbers; /* set line number in element content */ - void *catalogs; /* document's own catalog */ - int recovery; /* run in recovery mode */ - int progressive; /* is this a progressive parsing */ - xmlDictPtr dict; /* dictionnary for the parser */ - const xmlChar * *atts; /* array for the attributes callbacks */ - int maxatts; /* the size of the array */ - int docdict; /* use strings from dict to build tree */ - - /* - * pre-interned strings - */ - const xmlChar *str_xml; - const xmlChar *str_xmlns; - const xmlChar *str_xml_ns; - - /* - * Everything below is used only by the new SAX mode - */ - int sax2; /* operating in the new SAX mode */ - int nsNr; /* the number of inherited namespaces */ - int nsMax; /* the size of the arrays */ - const xmlChar * *nsTab; /* the array of prefix/namespace name */ - int *attallocs; /* which attribute were allocated */ - void * *pushTab; /* array of data for push */ - xmlHashTablePtr attsDefault; /* defaulted attributes if any */ - xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ - int nsWellFormed; /* is the document XML Nanespace okay */ - int options; /* Extra options */ - - /* - * Those fields are needed only for treaming parsing so far - */ - int dictNames; /* Use dictionary names for the tree */ - int freeElemsNr; /* number of freed element nodes */ - xmlNodePtr freeElems; /* List of freed element nodes */ - int freeAttrsNr; /* number of freed attributes nodes */ - xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ - - /* - * the complete error informations for the last error. - */ - xmlError lastError; - xmlParserMode parseMode; /* the parser mode */ - unsigned long nbentities; /* number of entities references */ - unsigned long sizeentities; /* size of parsed entities */ -}; - -/** - * xmlSAXLocator: - * - * A SAX Locator. - */ -struct _xmlSAXLocator { - const xmlChar *(*getPublicId)(void *ctx); - const xmlChar *(*getSystemId)(void *ctx); - int (*getLineNumber)(void *ctx); - int (*getColumnNumber)(void *ctx); -}; - -/** - * xmlSAXHandler: - * - * A SAX handler is bunch of callbacks called by the parser when processing - * of the input generate data or structure informations. - */ - -/** - * resolveEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Callback: - * The entity loader, to control the loading of external entities, - * the application can either: - * - override this resolveEntity() callback in the SAX block - * - or better use the xmlSetExternalEntityLoader() function to - * set up it's own entity resolution routine - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * internalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on internal subset declaration. - */ -typedef void (*internalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * externalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on external subset declaration. - */ -typedef void (*externalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * getEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get an entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * getParameterEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get a parameter entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * entityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed. - */ -typedef void (*entityDeclSAXFunc) (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -/** - * notationDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -typedef void (*notationDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * attributeDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type - * @def: the type of default value - * @defaultValue: the attribute default value - * @tree: the tree of enumerated value set - * - * An attribute definition has been parsed. - */ -typedef void (*attributeDeclSAXFunc)(void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -/** - * elementDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type - * @content: the element value tree - * - * An element definition has been parsed. - */ -typedef void (*elementDeclSAXFunc)(void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -/** - * unparsedEntityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed. - */ -typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); -/** - * setDocumentLocatorSAXFunc: - * @ctx: the user data (XML parser context) - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator. - * Everything is available on the context, so this is useless in our case. - */ -typedef void (*setDocumentLocatorSAXFunc) (void *ctx, - xmlSAXLocatorPtr loc); -/** - * startDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document start being processed. - */ -typedef void (*startDocumentSAXFunc) (void *ctx); -/** - * endDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document end has been detected. - */ -typedef void (*endDocumentSAXFunc) (void *ctx); -/** - * startElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name, including namespace prefix - * @atts: An array of name/value attributes pairs, NULL terminated - * - * Called when an opening tag has been processed. - */ -typedef void (*startElementSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar **atts); -/** - * endElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name - * - * Called when the end of an element has been detected. - */ -typedef void (*endElementSAXFunc) (void *ctx, - const xmlChar *name); -/** - * attributeSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The attribute name, including namespace prefix - * @value: The attribute value - * - * Handle an attribute that has been read by the parser. - * The default handling is to convert the attribute into an - * DOM subtree and past it in a new xmlAttr element added to - * the element. - */ -typedef void (*attributeSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *value); -/** - * referenceSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Called when an entity reference is detected. - */ -typedef void (*referenceSAXFunc) (void *ctx, - const xmlChar *name); -/** - * charactersSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some chars from the parser. - */ -typedef void (*charactersSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * ignorableWhitespaceSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some ignorable whitespaces from the parser. - * UNUSED: by default the DOM building will use characters. - */ -typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * processingInstructionSAXFunc: - * @ctx: the user data (XML parser context) - * @target: the target name - * @data: the PI data's - * - * A processing instruction has been parsed. - */ -typedef void (*processingInstructionSAXFunc) (void *ctx, - const xmlChar *target, - const xmlChar *data); -/** - * commentSAXFunc: - * @ctx: the user data (XML parser context) - * @value: the comment content - * - * A comment has been parsed. - */ -typedef void (*commentSAXFunc) (void *ctx, - const xmlChar *value); -/** - * cdataBlockSAXFunc: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * Called when a pcdata block has been parsed. - */ -typedef void (*cdataBlockSAXFunc) ( - void *ctx, - const xmlChar *value, - int len); -/** - * warningSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, callback. - */ -typedef void (XMLCDECL *warningSAXFunc) (void *ctx, - const char *msg, ...) ATTRIBUTE_PRINTF(2,3); -/** - * errorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, callback. - */ -typedef void (XMLCDECL *errorSAXFunc) (void *ctx, - const char *msg, ...) ATTRIBUTE_PRINTF(2,3); -/** - * fatalErrorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format fatal error messages, callback. - * Note: so far fatalError() SAX callbacks are not used, error() - * get all the callbacks for errors. - */ -typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, - const char *msg, ...) ATTRIBUTE_PRINTF(2,3); -/** - * isStandaloneSAXFunc: - * @ctx: the user data (XML parser context) - * - * Is this document tagged standalone? - * - * Returns 1 if true - */ -typedef int (*isStandaloneSAXFunc) (void *ctx); -/** - * hasInternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an internal subset. - * - * Returns 1 if true - */ -typedef int (*hasInternalSubsetSAXFunc) (void *ctx); - -/** - * hasExternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an external subset? - * - * Returns 1 if true - */ -typedef int (*hasExternalSubsetSAXFunc) (void *ctx); - -/************************************************************************ - * * - * The SAX version 2 API extensions * - * * - ************************************************************************/ -/** - * XML_SAX2_MAGIC: - * - * Special constant found in SAX2 blocks initialized fields - */ -#define XML_SAX2_MAGIC 0xDEEDBEAF - -/** - * startElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * @nb_defaulted: the number of defaulted attributes. The defaulted - * ones are at the end of the array - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as - * the new namespace declarations on the element. - */ - -typedef void (*startElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); - -/** - * endElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. - */ - -typedef void (*endElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); - - -struct _xmlSAXHandler { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; - /* The following fields are extensions available only on version 2 */ - void *_private; - startElementNsSAX2Func startElementNs; - endElementNsSAX2Func endElementNs; - xmlStructuredErrorFunc serror; -}; - -/* - * SAX Version 1 - */ -typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; -typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; -struct _xmlSAXHandlerV1 { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; -}; - - -/** - * xmlExternalEntityLoader: - * @URL: The System ID of the resource requested - * @ID: The Public ID of the resource requested - * @context: the XML parser context - * - * External entity loaders types. - * - * Returns the entity input parser. - */ -typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, - const char *ID, - xmlParserCtxtPtr context); - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Init/Cleanup - */ -XMLPUBFUN void XMLCALL - xmlInitParser (void); -XMLPUBFUN void XMLCALL - xmlCleanupParser (void); - -/* - * Input functions - */ -XMLPUBFUN int XMLCALL - xmlParserInputRead (xmlParserInputPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputGrow (xmlParserInputPtr in, - int len); - -/* - * Basic parsing Interfaces - */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseFile (const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseMemory (const char *buffer, - int size); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlSubstituteEntitiesDefault(int val); -XMLPUBFUN int XMLCALL - xmlKeepBlanksDefault (int val); -XMLPUBFUN void XMLCALL - xmlStopParser (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlPedanticParserDefault(int val); -XMLPUBFUN int XMLCALL - xmlLineNumbersDefault (int val); - -#ifdef LIBXML_SAX1_ENABLED -/* - * Recovery mode - */ -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverDoc (xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverMemory (const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverFile (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -/* - * Less common routines and SAX interfaces - */ -XMLPUBFUN int XMLCALL - xmlParseDocument (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXUserParseFile (xmlSAXHandlerPtr sax, - void *user_data, - const char *filename); -XMLPUBFUN int XMLCALL - xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, - void *user_data, - const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseDoc (xmlSAXHandlerPtr sax, - const xmlChar *cur, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemory (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFile (xmlSAXHandlerPtr sax, - const char *filename, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, - const char *filename, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseEntity (xmlSAXHandlerPtr sax, - const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseEntity (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlSAXParseDTD (xmlSAXHandlerPtr sax, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlParseDTD (const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlIOParseDTD (xmlSAXHandlerPtr sax, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); -#endif /* LIBXML_VALID_ENABLE */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemory(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserErrors XMLCALL - xmlParseInNodeContext (xmlNodePtr node, - const char *data, - int datalen, - int options, - xmlNodePtr *lst); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst, - int recover); -XMLPUBFUN int XMLCALL - xmlParseExternalEntity (xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); - -/* - * Parser contexts handling. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlNewParserCtxt (void); -XMLPUBFUN int XMLCALL - xmlInitParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlClearParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, - const xmlChar* buffer, - const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateDocParserCtxt (const xmlChar *cur); - -#ifdef LIBXML_LEGACY_ENABLED -/* - * Reading/setting optional parsing features. - */ -XMLPUBFUN int XMLCALL - xmlGetFeaturesList (int *len, - const char **result); -XMLPUBFUN int XMLCALL - xmlGetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *result); -XMLPUBFUN int XMLCALL - xmlSetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *value); -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef LIBXML_PUSH_ENABLED -/* - * Interfaces for the Push mode. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename); -XMLPUBFUN int XMLCALL - xmlParseChunk (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -/* - * Special I/O mode. - */ - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, - void *user_data, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewIOInputStream (xmlParserCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); - -/* - * Node infos. - */ -XMLPUBFUN const xmlParserNodeInfo* XMLCALL - xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN void XMLCALL - xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN unsigned long XMLCALL - xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, - const xmlParserNodeInfoPtr info); - -/* - * External entities handling actually implemented in xmlIO. - */ - -XMLPUBFUN void XMLCALL - xmlSetExternalEntityLoader(xmlExternalEntityLoader f); -XMLPUBFUN xmlExternalEntityLoader XMLCALL - xmlGetExternalEntityLoader(void); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlLoadExternalEntity (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * Index lookup, actually implemented in the encoding module - */ -XMLPUBFUN long XMLCALL - xmlByteConsumed (xmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - XML_PARSE_RECOVER = 1<<0, /* recover on errors */ - XML_PARSE_NOENT = 1<<1, /* substitute entities */ - XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ - XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ - XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ - XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ - XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ - XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ - XML_PARSE_NONET = 1<<11,/* Forbid network access */ - XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ - XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ - XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ - XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of - the tree allowed afterwards (will possibly - crash if you try to modify the tree) */ - XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ - XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ - XML_PARSE_HUGE = 1<<19, /* relax any hardcoded limit from the parser */ - XML_PARSE_OLDSAX = 1<<20 /* parse using SAX2 interface from before 2.7.0 */ -} xmlParserOption; - -XMLPUBFUN void XMLCALL - xmlCtxtReset (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlCtxtResetPush (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* - * Library wide options - */ -/** - * xmlFeature: - * - * Used to examine the existance of features that can be enabled - * or disabled at compile-time. - * They used to be called XML_FEATURE_xxx but this clashed with Expat - */ -typedef enum { - XML_WITH_THREAD = 1, - XML_WITH_TREE = 2, - XML_WITH_OUTPUT = 3, - XML_WITH_PUSH = 4, - XML_WITH_READER = 5, - XML_WITH_PATTERN = 6, - XML_WITH_WRITER = 7, - XML_WITH_SAX1 = 8, - XML_WITH_FTP = 9, - XML_WITH_HTTP = 10, - XML_WITH_VALID = 11, - XML_WITH_HTML = 12, - XML_WITH_LEGACY = 13, - XML_WITH_C14N = 14, - XML_WITH_CATALOG = 15, - XML_WITH_XPATH = 16, - XML_WITH_XPTR = 17, - XML_WITH_XINCLUDE = 18, - XML_WITH_ICONV = 19, - XML_WITH_ISO8859X = 20, - XML_WITH_UNICODE = 21, - XML_WITH_REGEXP = 22, - XML_WITH_AUTOMATA = 23, - XML_WITH_EXPR = 24, - XML_WITH_SCHEMAS = 25, - XML_WITH_SCHEMATRON = 26, - XML_WITH_MODULES = 27, - XML_WITH_DEBUG = 28, - XML_WITH_DEBUG_MEM = 29, - XML_WITH_DEBUG_RUN = 30, - XML_WITH_ZLIB = 31, - XML_WITH_NONE = 99999 /* just to be sure of allocation size */ -} xmlFeature; - -XMLPUBFUN int XMLCALL - xmlHasFeature (xmlFeature feature); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_H__ */ - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parserInternals.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parserInternals.h deleted file mode 100644 index a5e75b5e38..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/parserInternals.h +++ /dev/null @@ -1,611 +0,0 @@ -/* - * Summary: internals routines exported by the parser. - * Description: this module exports a number of internal parsing routines - * they are not really all intended for applications but - * can prove useful doing low level processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_INTERNALS_H__ -#define __XML_PARSER_INTERNALS_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserMaxDepth: - * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature, use XML_PARSE_HUGE option to override it. - */ -XMLPUBVAR unsigned int xmlParserMaxDepth; - -/** - * XML_MAX_TEXT_LENGTH: - * - * Maximum size allowed for a single text node when building a tree. - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - */ -#define XML_MAX_TEXT_LENGTH 10000000 - -/** - * XML_MAX_NAMELEN: - * - * Identifiers can be longer, but this will be more costly - * at runtime. - */ -#define XML_MAX_NAMELEN 100 - -/** - * INPUT_CHUNK: - * - * The parser tries to always have that amount of input ready. - * One of the point is providing context when reporting errors. - */ -#define INPUT_CHUNK 250 - -/************************************************************************ - * * - * UNICODE version of the macros. * - * * - ************************************************************************/ -/** - * IS_BYTE_CHAR: - * @c: an byte value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20...] - * any byte character in the accepted range - */ -#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) - -/** - * IS_CHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] - * | [#x10000-#x10FFFF] - * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. - */ -#define IS_CHAR(c) xmlIsCharQ(c) - -/** - * IS_CHAR_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Behaves like IS_CHAR on single-byte value - */ -#define IS_CHAR_CH(c) xmlIsChar_ch(c) - -/** - * IS_BLANK: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [3] S ::= (#x20 | #x9 | #xD | #xA)+ - */ -#define IS_BLANK(c) xmlIsBlankQ(c) - -/** - * IS_BLANK_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Behaviour same as IS_BLANK - */ -#define IS_BLANK_CH(c) xmlIsBlank_ch(c) - -/** - * IS_BASECHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [85] BaseChar ::= ... long list see REC ... - */ -#define IS_BASECHAR(c) xmlIsBaseCharQ(c) - -/** - * IS_DIGIT: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [88] Digit ::= ... long list see REC ... - */ -#define IS_DIGIT(c) xmlIsDigitQ(c) - -/** - * IS_DIGIT_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_DIGIT but with a single byte argument - */ -#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) - -/** - * IS_COMBINING: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [87] CombiningChar ::= ... long list see REC ... - */ -#define IS_COMBINING(c) xmlIsCombiningQ(c) - -/** - * IS_COMBINING_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Always false (all combining chars > 0xff) - */ -#define IS_COMBINING_CH(c) 0 - -/** - * IS_EXTENDER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | - * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | - * [#x309D-#x309E] | [#x30FC-#x30FE] - */ -#define IS_EXTENDER(c) xmlIsExtenderQ(c) - -/** - * IS_EXTENDER_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_EXTENDER but with a single-byte argument - */ -#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) - -/** - * IS_IDEOGRAPHIC: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) - -/** - * IS_LETTER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [84] Letter ::= BaseChar | Ideographic - */ -#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) - -/** - * IS_LETTER_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Macro behaves like IS_LETTER, but only check base chars - * - */ -#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) - -/** - * IS_ASCII_LETTER: - * @c: an xmlChar value - * - * Macro to check [a-zA-Z] - * - */ -#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a))) - -/** - * IS_ASCII_DIGIT: - * @c: an xmlChar value - * - * Macro to check [0-9] - * - */ -#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) - -/** - * IS_PUBIDCHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - */ -#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) - -/** - * IS_PUBIDCHAR_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Same as IS_PUBIDCHAR but for single-byte value - */ -#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) - -/** - * SKIP_EOL: - * @p: and UTF8 string pointer - * - * Skips the end of line chars. - */ -#define SKIP_EOL(p) \ - if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ - if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } - -/** - * MOVETO_ENDTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '>' char. - */ -#define MOVETO_ENDTAG(p) \ - while ((*p) && (*(p) != '>')) (p)++ - -/** - * MOVETO_STARTTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '<' char. - */ -#define MOVETO_STARTTAG(p) \ - while ((*p) && (*(p) != '<')) (p)++ - -/** - * Global variables used for predefined strings. - */ -XMLPUBVAR const xmlChar xmlStringText[]; -XMLPUBVAR const xmlChar xmlStringTextNoenc[]; -XMLPUBVAR const xmlChar xmlStringComment[]; - -/* - * Function to finish the work of the macros where needed. - */ -XMLPUBFUN int XMLCALL xmlIsLetter (int c); - -/** - * Parser context. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateFileParserCtxt (const char *filename); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateURLParserCtxt (const char *filename, - int options); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateMemoryParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateEntityParserCtxt(const xmlChar *URL, - const xmlChar *ID, - const xmlChar *base); -XMLPUBFUN int XMLCALL - xmlSwitchEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncodingHandlerPtr handler); -XMLPUBFUN int XMLCALL - xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input, - xmlCharEncodingHandlerPtr handler); - -#ifdef IN_LIBXML -/* internal error reporting */ -XMLPUBFUN void XMLCALL - __xmlErrEncoding (xmlParserCtxtPtr ctxt, - xmlParserErrors xmlerr, - const char *msg, - const xmlChar * str1, - const xmlChar * str2); -#endif - -/** - * Input Streams. - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewStringInputStream (xmlParserCtxtPtr ctxt, - const xmlChar *buffer); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); -XMLPUBFUN int XMLCALL - xmlPushInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input); -XMLPUBFUN xmlChar XMLCALL - xmlPopInput (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeInputStream (xmlParserInputPtr input); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputFromFile (xmlParserCtxtPtr ctxt, - const char *filename); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputStream (xmlParserCtxtPtr ctxt); - -/** - * Namespaces. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName (xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlChar **prefix); - -/** - * Generic production rules. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlParseName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseNmtoken (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEntityValue (xmlParserCtxtPtr ctxt, - xmlChar **orig); -XMLPUBFUN xmlChar * XMLCALL - xmlParseAttValue (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseCharData (xmlParserCtxtPtr ctxt, - int cdata); -XMLPUBFUN xmlChar * XMLCALL - xmlParseExternalID (xmlParserCtxtPtr ctxt, - xmlChar **publicID, - int strict); -XMLPUBFUN void XMLCALL - xmlParseComment (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParsePITarget (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePI (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseNotationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN int XMLCALL - xmlParseAttributeType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN void XMLCALL - xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementMixedContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementChildrenContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN int XMLCALL - xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlElementContentPtr *result); -XMLPUBFUN int XMLCALL - xmlParseElementDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseCharRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlParseEntityRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePEReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlParseAttribute (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseStartTag (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEndTag (xmlParserCtxtPtr ctxt); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN void XMLCALL - xmlParseCDSect (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseContent (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseElement (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionNum (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEncName (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseSDDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseTextDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMisc (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseExternalSubset (xmlParserCtxtPtr ctxt, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * XML_SUBSTITUTE_NONE: - * - * If no entities need to be substituted. - */ -#define XML_SUBSTITUTE_NONE 0 -/** - * XML_SUBSTITUTE_REF: - * - * Whether general entities need to be substituted. - */ -#define XML_SUBSTITUTE_REF 1 -/** - * XML_SUBSTITUTE_PEREF: - * - * Whether parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_PEREF 2 -/** - * XML_SUBSTITUTE_BOTH: - * - * Both general and parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_BOTH 3 - -XMLPUBFUN xmlChar * XMLCALL - xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN xmlChar * XMLCALL - xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, - xmlNodePtr value); -XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, - xmlParserInputPtr value); -XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, - const xmlChar *value); - -/* - * other commodities shared between parser.c and parserInternals. - */ -XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - int *len); -XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); - -/* - * Really core function shared with HTML parser. - */ -XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, - int *len); -XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, - int val); -XMLPUBFUN int XMLCALL xmlCopyChar (int len, - xmlChar *out, - int val); -XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); - -#ifdef LIBXML_HTML_ENABLED -/* - * Actually comes from the HTML parser but launched from the init stuff. - */ -XMLPUBFUN void XMLCALL htmlInitAutoClose (void); -XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, - const char *encoding); -#endif - -/* - * Specific function to keep track of entities references - * and used by the XSLT debugger. - */ -#ifdef LIBXML_LEGACY_ENABLED -/** - * xmlEntityReferenceFunc: - * @ent: the entity - * @firstNode: the fist node in the chunk - * @lastNode: the last nod in the chunk - * - * Callback function used when one needs to be able to track back the - * provenance of a chunk of nodes inherited from an entity replacement. - */ -typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, - xmlNodePtr firstNode, - xmlNodePtr lastNode); - -XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); - -XMLPUBFUN xmlChar * XMLCALL - xmlParseQuotedString (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNamespace (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlScanName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, - xmlChar **prefix); -/** - * Entities - */ -XMLPUBFUN xmlChar * XMLCALL - xmlDecodeEntities (xmlParserCtxtPtr ctxt, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN void XMLCALL - xmlHandleEntity (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); - -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef IN_LIBXML -/* - * internal only - */ -XMLPUBFUN void XMLCALL - xmlErrMemory (xmlParserCtxtPtr ctxt, - const char *extra); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/relaxng.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/relaxng.h deleted file mode 100644 index d3e39e00e9..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/relaxng.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Summary: implementation of the Relax-NG validation - * Description: implementation of the Relax-NG validation - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_RELAX_NG__ -#define __XML_RELAX_NG__ - -#include -#include -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlRelaxNG xmlRelaxNG; -typedef xmlRelaxNG *xmlRelaxNGPtr; - - -/** - * xmlRelaxNGValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from a Relax-NG validation - */ -typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3); - -/** - * xmlRelaxNGValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from a Relax-NG validation - */ -typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3); - -/** - * A schemas validation context - */ -typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; -typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; - -typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; -typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; - -/* - * xmlRelaxNGValidErr: - * - * List of possible Relax NG validation errors - */ -typedef enum { - XML_RELAXNG_OK = 0, - XML_RELAXNG_ERR_MEMORY, - XML_RELAXNG_ERR_TYPE, - XML_RELAXNG_ERR_TYPEVAL, - XML_RELAXNG_ERR_DUPID, - XML_RELAXNG_ERR_TYPECMP, - XML_RELAXNG_ERR_NOSTATE, - XML_RELAXNG_ERR_NODEFINE, - XML_RELAXNG_ERR_LISTEXTRA, - XML_RELAXNG_ERR_LISTEMPTY, - XML_RELAXNG_ERR_INTERNODATA, - XML_RELAXNG_ERR_INTERSEQ, - XML_RELAXNG_ERR_INTEREXTRA, - XML_RELAXNG_ERR_ELEMNAME, - XML_RELAXNG_ERR_ATTRNAME, - XML_RELAXNG_ERR_ELEMNONS, - XML_RELAXNG_ERR_ATTRNONS, - XML_RELAXNG_ERR_ELEMWRONGNS, - XML_RELAXNG_ERR_ATTRWRONGNS, - XML_RELAXNG_ERR_ELEMEXTRANS, - XML_RELAXNG_ERR_ATTREXTRANS, - XML_RELAXNG_ERR_ELEMNOTEMPTY, - XML_RELAXNG_ERR_NOELEM, - XML_RELAXNG_ERR_NOTELEM, - XML_RELAXNG_ERR_ATTRVALID, - XML_RELAXNG_ERR_CONTENTVALID, - XML_RELAXNG_ERR_EXTRACONTENT, - XML_RELAXNG_ERR_INVALIDATTR, - XML_RELAXNG_ERR_DATAELEM, - XML_RELAXNG_ERR_VALELEM, - XML_RELAXNG_ERR_LISTELEM, - XML_RELAXNG_ERR_DATATYPE, - XML_RELAXNG_ERR_VALUE, - XML_RELAXNG_ERR_LIST, - XML_RELAXNG_ERR_NOGRAMMAR, - XML_RELAXNG_ERR_EXTRADATA, - XML_RELAXNG_ERR_LACKDATA, - XML_RELAXNG_ERR_INTERNAL, - XML_RELAXNG_ERR_ELEMWRONG, - XML_RELAXNG_ERR_TEXTWRONG -} xmlRelaxNGValidErr; - -/* - * xmlRelaxNGParserFlags: - * - * List of possible Relax NG Parser flags - */ -typedef enum { - XML_RELAXNGP_NONE = 0, - XML_RELAXNGP_FREE_DOC = 1, - XML_RELAXNGP_CRNG = 2 -} xmlRelaxNGParserFlag; - -XMLPUBFUN int XMLCALL - xmlRelaxNGInitTypes (void); -XMLPUBFUN void XMLCALL - xmlRelaxNGCleanupTypes (void); - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewParserCtxt (const char *URL); -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewMemParserCtxt (const char *buffer, - int size); -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); - -XMLPUBFUN int XMLCALL - xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, - int flag); - -XMLPUBFUN void XMLCALL - xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc err, - xmlRelaxNGValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc *err, - xmlRelaxNGValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetParserStructuredErrors( - xmlRelaxNGParserCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN xmlRelaxNGPtr XMLCALL - xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlRelaxNGFree (xmlRelaxNGPtr schema); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlRelaxNGDump (FILE *output, - xmlRelaxNGPtr schema); -XMLPUBFUN void XMLCALL - xmlRelaxNGDumpTree (FILE * output, - xmlRelaxNGPtr schema); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc err, - xmlRelaxNGValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc *err, - xmlRelaxNGValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, void *ctx); -XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL - xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); -XMLPUBFUN void XMLCALL - xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc); -/* - * Interfaces for progressive validation when possible - */ -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, - const xmlChar *data, - int len); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ - -#endif /* __XML_RELAX_NG__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schemasInternals.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schemasInternals.h deleted file mode 100644 index b68a6e1285..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schemasInternals.h +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Summary: internal interfaces for XML Schemas - * Description: internal interfaces for the XML Schemas handling - * and schema validity checking - * The Schemas development is a Work In Progress. - * Some of those interfaces are not garanteed to be API or ABI stable ! - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_INTERNALS_H__ -#define __XML_SCHEMA_INTERNALS_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMAS_UNKNOWN = 0, - XML_SCHEMAS_STRING, - XML_SCHEMAS_NORMSTRING, - XML_SCHEMAS_DECIMAL, - XML_SCHEMAS_TIME, - XML_SCHEMAS_GDAY, - XML_SCHEMAS_GMONTH, - XML_SCHEMAS_GMONTHDAY, - XML_SCHEMAS_GYEAR, - XML_SCHEMAS_GYEARMONTH, - XML_SCHEMAS_DATE, - XML_SCHEMAS_DATETIME, - XML_SCHEMAS_DURATION, - XML_SCHEMAS_FLOAT, - XML_SCHEMAS_DOUBLE, - XML_SCHEMAS_BOOLEAN, - XML_SCHEMAS_TOKEN, - XML_SCHEMAS_LANGUAGE, - XML_SCHEMAS_NMTOKEN, - XML_SCHEMAS_NMTOKENS, - XML_SCHEMAS_NAME, - XML_SCHEMAS_QNAME, - XML_SCHEMAS_NCNAME, - XML_SCHEMAS_ID, - XML_SCHEMAS_IDREF, - XML_SCHEMAS_IDREFS, - XML_SCHEMAS_ENTITY, - XML_SCHEMAS_ENTITIES, - XML_SCHEMAS_NOTATION, - XML_SCHEMAS_ANYURI, - XML_SCHEMAS_INTEGER, - XML_SCHEMAS_NPINTEGER, - XML_SCHEMAS_NINTEGER, - XML_SCHEMAS_NNINTEGER, - XML_SCHEMAS_PINTEGER, - XML_SCHEMAS_INT, - XML_SCHEMAS_UINT, - XML_SCHEMAS_LONG, - XML_SCHEMAS_ULONG, - XML_SCHEMAS_SHORT, - XML_SCHEMAS_USHORT, - XML_SCHEMAS_BYTE, - XML_SCHEMAS_UBYTE, - XML_SCHEMAS_HEXBINARY, - XML_SCHEMAS_BASE64BINARY, - XML_SCHEMAS_ANYTYPE, - XML_SCHEMAS_ANYSIMPLETYPE -} xmlSchemaValType; - -/* - * XML Schemas defines multiple type of types. - */ -typedef enum { - XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ - XML_SCHEMA_TYPE_ANY, - XML_SCHEMA_TYPE_FACET, - XML_SCHEMA_TYPE_SIMPLE, - XML_SCHEMA_TYPE_COMPLEX, - XML_SCHEMA_TYPE_SEQUENCE = 6, - XML_SCHEMA_TYPE_CHOICE, - XML_SCHEMA_TYPE_ALL, - XML_SCHEMA_TYPE_SIMPLE_CONTENT, - XML_SCHEMA_TYPE_COMPLEX_CONTENT, - XML_SCHEMA_TYPE_UR, - XML_SCHEMA_TYPE_RESTRICTION, - XML_SCHEMA_TYPE_EXTENSION, - XML_SCHEMA_TYPE_ELEMENT, - XML_SCHEMA_TYPE_ATTRIBUTE, - XML_SCHEMA_TYPE_ATTRIBUTEGROUP, - XML_SCHEMA_TYPE_GROUP, - XML_SCHEMA_TYPE_NOTATION, - XML_SCHEMA_TYPE_LIST, - XML_SCHEMA_TYPE_UNION, - XML_SCHEMA_TYPE_ANY_ATTRIBUTE, - XML_SCHEMA_TYPE_IDC_UNIQUE, - XML_SCHEMA_TYPE_IDC_KEY, - XML_SCHEMA_TYPE_IDC_KEYREF, - XML_SCHEMA_TYPE_PARTICLE = 25, - XML_SCHEMA_TYPE_ATTRIBUTE_USE, - XML_SCHEMA_FACET_MININCLUSIVE = 1000, - XML_SCHEMA_FACET_MINEXCLUSIVE, - XML_SCHEMA_FACET_MAXINCLUSIVE, - XML_SCHEMA_FACET_MAXEXCLUSIVE, - XML_SCHEMA_FACET_TOTALDIGITS, - XML_SCHEMA_FACET_FRACTIONDIGITS, - XML_SCHEMA_FACET_PATTERN, - XML_SCHEMA_FACET_ENUMERATION, - XML_SCHEMA_FACET_WHITESPACE, - XML_SCHEMA_FACET_LENGTH, - XML_SCHEMA_FACET_MAXLENGTH, - XML_SCHEMA_FACET_MINLENGTH, - XML_SCHEMA_EXTRA_QNAMEREF = 2000, - XML_SCHEMA_EXTRA_ATTR_USE_PROHIB -} xmlSchemaTypeType; - -typedef enum { - XML_SCHEMA_CONTENT_UNKNOWN = 0, - XML_SCHEMA_CONTENT_EMPTY = 1, - XML_SCHEMA_CONTENT_ELEMENTS, - XML_SCHEMA_CONTENT_MIXED, - XML_SCHEMA_CONTENT_SIMPLE, - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ - XML_SCHEMA_CONTENT_BASIC, - XML_SCHEMA_CONTENT_ANY -} xmlSchemaContentType; - -typedef struct _xmlSchemaVal xmlSchemaVal; -typedef xmlSchemaVal *xmlSchemaValPtr; - -typedef struct _xmlSchemaType xmlSchemaType; -typedef xmlSchemaType *xmlSchemaTypePtr; - -typedef struct _xmlSchemaFacet xmlSchemaFacet; -typedef xmlSchemaFacet *xmlSchemaFacetPtr; - -/** - * Annotation - */ -typedef struct _xmlSchemaAnnot xmlSchemaAnnot; -typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; -struct _xmlSchemaAnnot { - struct _xmlSchemaAnnot *next; - xmlNodePtr content; /* the annotation */ -}; - -/** - * XML_SCHEMAS_ANYATTR_SKIP: - * - * Skip unknown attribute from validation - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_SKIP 1 -/** - * XML_SCHEMAS_ANYATTR_LAX: - * - * Ignore validation non definition on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_LAX 2 -/** - * XML_SCHEMAS_ANYATTR_STRICT: - * - * Apply strict validation rules on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_STRICT 3 -/** - * XML_SCHEMAS_ANY_SKIP: - * - * Skip unknown attribute from validation - */ -#define XML_SCHEMAS_ANY_SKIP 1 -/** - * XML_SCHEMAS_ANY_LAX: - * - * Used by wildcards. - * Validate if type found, don't worry if not found - */ -#define XML_SCHEMAS_ANY_LAX 2 -/** - * XML_SCHEMAS_ANY_STRICT: - * - * Used by wildcards. - * Apply strict validation rules - */ -#define XML_SCHEMAS_ANY_STRICT 3 -/** - * XML_SCHEMAS_ATTR_USE_PROHIBITED: - * - * Used by wildcards. - * The attribute is prohibited. - */ -#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 -/** - * XML_SCHEMAS_ATTR_USE_REQUIRED: - * - * The attribute is required. - */ -#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 -/** - * XML_SCHEMAS_ATTR_USE_OPTIONAL: - * - * The attribute is optional. - */ -#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 -/** - * XML_SCHEMAS_ATTR_GLOBAL: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 -/** - * XML_SCHEMAS_ATTR_NSDEFAULT: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: - * - * this is set when the "type" and "ref" references - * have been resolved. - */ -#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 -/** - * XML_SCHEMAS_ATTR_FIXED: - * - * the attribute has a fixed value - */ -#define XML_SCHEMAS_ATTR_FIXED 1 << 9 - -/** - * xmlSchemaAttribute: - * An attribute definition. - */ - -typedef struct _xmlSchemaAttribute xmlSchemaAttribute; -typedef xmlSchemaAttribute *xmlSchemaAttributePtr; -struct _xmlSchemaAttribute { - xmlSchemaTypeType type; - struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ - const xmlChar *name; /* the name of the declaration */ - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - const xmlChar *typeName; /* the local name of the type definition */ - const xmlChar *typeNs; /* the ns URI of the type definition */ - xmlSchemaAnnotPtr annot; - - xmlSchemaTypePtr base; /* Deprecated; not used */ - int occurs; /* Deprecated; not used */ - const xmlChar *defValue; /* The initial value of the value constraint */ - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlNodePtr node; - const xmlChar *targetNamespace; - int flags; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value constraint */ - xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ -}; - -/** - * xmlSchemaAttributeLink: - * Used to build a list of attribute uses on complexType definitions. - * WARNING: Deprecated; not used. - */ -typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; -typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; -struct _xmlSchemaAttributeLink { - struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ - struct _xmlSchemaAttribute *attr;/* the linked attribute */ -}; - -/** - * XML_SCHEMAS_WILDCARD_COMPLETE: - * - * If the wildcard is complete. - */ -#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 - -/** - * xmlSchemaCharValueLink: - * Used to build a list of namespaces on wildcards. - */ -typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; -typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; -struct _xmlSchemaWildcardNs { - struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ - const xmlChar *value;/* the value */ -}; - -/** - * xmlSchemaWildcard. - * A wildcard. - */ -typedef struct _xmlSchemaWildcard xmlSchemaWildcard; -typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; -struct _xmlSchemaWildcard { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *id; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - int processContents; - int any; /* Indicates if the ns constraint is of ##any */ - xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ - xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ - int flags; -}; - -/** - * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 -/** - * XML_SCHEMAS_ATTRGROUP_GLOBAL: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ATTRGROUP_MARKED: - * - * Marks the attr group as marked; used for circular checks. - */ -#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 - -/** - * XML_SCHEMAS_ATTRGROUP_REDEFINED: - * - * The attr group was redefined. - */ -#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 -/** - * XML_SCHEMAS_ATTRGROUP_HAS_REFS: - * - * Whether this attr. group contains attr. group references. - */ -#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 - -/** - * An attribute group definition. - * - * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures - * must be kept similar - */ -typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; -typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; -struct _xmlSchemaAttributeGroup { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ - const xmlChar *name; - const xmlChar *id; - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int flags; - xmlSchemaWildcardPtr attributeWildcard; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/** - * xmlSchemaTypeLink: - * Used to build a list of types (e.g. member types of - * simpleType with variety "union"). - */ -typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; -typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; -struct _xmlSchemaTypeLink { - struct _xmlSchemaTypeLink *next;/* the next type link ... */ - xmlSchemaTypePtr type;/* the linked type */ -}; - -/** - * xmlSchemaFacetLink: - * Used to build a list of facets. - */ -typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; -typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; -struct _xmlSchemaFacetLink { - struct _xmlSchemaFacetLink *next;/* the next facet link ... */ - xmlSchemaFacetPtr facet;/* the linked facet */ -}; - -/** - * XML_SCHEMAS_TYPE_MIXED: - * - * the element content type is mixed - */ -#define XML_SCHEMAS_TYPE_MIXED 1 << 0 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: - * - * the simple or complex type has a derivation method of "extension". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: - * - * the simple or complex type has a derivation method of "restriction". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 -/** - * XML_SCHEMAS_TYPE_GLOBAL: - * - * the type is global - */ -#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 -/** - * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: - * - * the complexType owns an attribute wildcard, i.e. - * it can be freed by the complexType - */ -#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ -/** - * XML_SCHEMAS_TYPE_VARIETY_ABSENT: - * - * the simpleType has a variety of "absent". - * TODO: Actually not necessary :-/, since if - * none of the variety flags occur then it's - * automatically absent. - */ -#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 -/** - * XML_SCHEMAS_TYPE_VARIETY_LIST: - * - * the simpleType has a variety of "list". - */ -#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 -/** - * XML_SCHEMAS_TYPE_VARIETY_UNION: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 -/** - * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 -/** - * XML_SCHEMAS_TYPE_FINAL_EXTENSION: - * - * the complexType has a final of "extension". - */ -#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 -/** - * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: - * - * the simpleType/complexType has a final of "restriction". - */ -#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 -/** - * XML_SCHEMAS_TYPE_FINAL_LIST: - * - * the simpleType has a final of "list". - */ -#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 -/** - * XML_SCHEMAS_TYPE_FINAL_UNION: - * - * the simpleType has a final of "union". - */ -#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 -/** - * XML_SCHEMAS_TYPE_FINAL_DEFAULT: - * - * the simpleType has a final of "default". - */ -#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 -/** - * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: - * - * Marks the item as a builtin primitive. - */ -#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 -/** - * XML_SCHEMAS_TYPE_MARKED: - * - * Marks the item as marked; used for circular checks. - */ -#define XML_SCHEMAS_TYPE_MARKED 1 << 16 -/** - * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: - * - * the complexType did not specify 'block' so use the default of the - * item. - */ -#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 -/** - * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: - * - * the complexType has a 'block' of "extension". - */ -#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 -/** - * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: - * - * the complexType has a 'block' of "restriction". - */ -#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 -/** - * XML_SCHEMAS_TYPE_ABSTRACT: - * - * the simple/complexType is abstract. - */ -#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 -/** - * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: - * - * indicates if the facets need a computed value - */ -#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 -/** - * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: - * - * indicates that the type was typefixed - */ -#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 -/** - * XML_SCHEMAS_TYPE_INTERNAL_INVALID: - * - * indicates that the type is invalid - */ -#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: - * - * a whitespace-facet value of "preserve" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: - * - * a whitespace-facet value of "replace" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: - * - * a whitespace-facet value of "collapse" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 -/** - * XML_SCHEMAS_TYPE_HAS_FACETS: - * - * has facets - */ -#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 -/** - * XML_SCHEMAS_TYPE_NORMVALUENEEDED: - * - * indicates if the facets (pattern) need a normalized value - */ -#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 - -/** - * XML_SCHEMAS_TYPE_FIXUP_1: - * - * First stage of fixup was done. - */ -#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 - -/** - * XML_SCHEMAS_TYPE_REDEFINED: - * - * The type was redefined. - */ -#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 -/** - * XML_SCHEMAS_TYPE_REDEFINING: - * - * The type redefines an other type. - */ -/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ - -/** - * _xmlSchemaType: - * - * Schemas type definition. - */ -struct _xmlSchemaType { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* the next type if in a sequence ... */ - const xmlChar *name; - const xmlChar *id ; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - xmlSchemaContentType contentType; - const xmlChar *base; /* Base type's local name */ - const xmlChar *baseNs; /* Base type's target namespace */ - xmlSchemaTypePtr baseType; /* The base type component */ - xmlSchemaFacetPtr facets; /* Local facets */ - struct _xmlSchemaType *redef; /* Deprecated; not used */ - int recurse; /* Obsolete */ - xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ - xmlSchemaWildcardPtr attributeWildcard; - int builtInType; /* Type of built-in types. */ - xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ - xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. - Could we use @subtypes for this? */ - xmlRegexpPtr contModel; /* Holds the automaton of the content model */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/* - * xmlSchemaElement: - * An element definition. - * - * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of - * structures must be kept similar - */ -/** - * XML_SCHEMAS_ELEM_NILLABLE: - * - * the element is nillable - */ -#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 -/** - * XML_SCHEMAS_ELEM_GLOBAL: - * - * the element is global - */ -#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ELEM_DEFAULT: - * - * the element has a default value - */ -#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 -/** - * XML_SCHEMAS_ELEM_FIXED: - * - * the element has a fixed value - */ -#define XML_SCHEMAS_ELEM_FIXED 1 << 3 -/** - * XML_SCHEMAS_ELEM_ABSTRACT: - * - * the element is abstract - */ -#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 -/** - * XML_SCHEMAS_ELEM_TOPLEVEL: - * - * the element is top level - * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead - */ -#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 -/** - * XML_SCHEMAS_ELEM_REF: - * - * the element is a reference to a type - */ -#define XML_SCHEMAS_ELEM_REF 1 << 6 -/** - * XML_SCHEMAS_ELEM_NSDEFAULT: - * - * allow elements in no namespace - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: - * - * this is set when "type", "ref", "substitutionGroup" - * references have been resolved. - */ -#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 - /** - * XML_SCHEMAS_ELEM_CIRCULAR: - * - * a helper flag for the search of circular references. - */ -#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 -/** - * XML_SCHEMAS_ELEM_BLOCK_ABSENT: - * - * the "block" attribute is absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 -/** - * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: - * - * disallowed substitutions are absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 -/** - * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: - * - * disallowed substitutions: "restriction" - */ -#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 -/** - * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: - * - * disallowed substitutions: "substituion" - */ -#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 -/** - * XML_SCHEMAS_ELEM_FINAL_ABSENT: - * - * substitution group exclusions are absent - */ -#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 -/** - * XML_SCHEMAS_ELEM_FINAL_EXTENSION: - * - * substitution group exclusions: "extension" - */ -#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 -/** - * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: - * - * substitution group exclusions: "restriction" - */ -#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 -/** - * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: - * - * the declaration is a substitution group head - */ -#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 -/** - * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: - * - * this is set when the elem decl has been checked against - * all constraints - */ -#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 - -typedef struct _xmlSchemaElement xmlSchemaElement; -typedef xmlSchemaElement *xmlSchemaElementPtr; -struct _xmlSchemaElement { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* Not used? */ - const xmlChar *name; - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlSchemaAttributePtr attributes; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - const xmlChar *targetNamespace; - const xmlChar *namedType; - const xmlChar *namedTypeNs; - const xmlChar *substGroup; - const xmlChar *substGroupNs; - const xmlChar *scope; - const xmlChar *value; /* The original value of the value constraint. */ - struct _xmlSchemaElement *refDecl; /* This will now be used for the - substitution group affiliation */ - xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ - xmlSchemaContentType contentType; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value contraint. */ - void *idcs; /* The identity-constraint defs */ -}; - -/* - * XML_SCHEMAS_FACET_UNKNOWN: - * - * unknown facet handling - */ -#define XML_SCHEMAS_FACET_UNKNOWN 0 -/* - * XML_SCHEMAS_FACET_PRESERVE: - * - * preserve the type of the facet - */ -#define XML_SCHEMAS_FACET_PRESERVE 1 -/* - * XML_SCHEMAS_FACET_REPLACE: - * - * replace the type of the facet - */ -#define XML_SCHEMAS_FACET_REPLACE 2 -/* - * XML_SCHEMAS_FACET_COLLAPSE: - * - * collapse the types of the facet - */ -#define XML_SCHEMAS_FACET_COLLAPSE 3 -/** - * A facet definition. - */ -struct _xmlSchemaFacet { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ - const xmlChar *value; /* The original value */ - const xmlChar *id; /* Obsolete */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ - int whitespace; - xmlSchemaValPtr val; /* The compiled value */ - xmlRegexpPtr regexp; /* The regex for patterns */ -}; - -/** - * A notation definition. - */ -typedef struct _xmlSchemaNotation xmlSchemaNotation; -typedef xmlSchemaNotation *xmlSchemaNotationPtr; -struct _xmlSchemaNotation { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *name; - xmlSchemaAnnotPtr annot; - const xmlChar *identifier; - const xmlChar *targetNamespace; -}; - -/* -* TODO: Actually all those flags used for the schema should sit -* on the schema parser context, since they are used only -* during parsing an XML schema document, and not available -* on the component level as per spec. -*/ -/** - * XML_SCHEMAS_QUALIF_ELEM: - * - * Reflects elementFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 -/** - * XML_SCHEMAS_QUALIF_ATTR: - * - * Reflects attributeFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 -/** - * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 -/** - * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 -/** - * XML_SCHEMAS_FINAL_DEFAULT_LIST: - * - * the cshema has "list" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 -/** - * XML_SCHEMAS_FINAL_DEFAULT_UNION: - * - * the schema has "union" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: - * - * the schema has "substitution" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 -/** - * XML_SCHEMAS_INCLUDING_CONVERT_NS: - * - * the schema is currently including an other schema with - * no target namespace. - */ -#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 -/** - * _xmlSchema: - * - * A Schemas definition - */ -struct _xmlSchema { - const xmlChar *name; /* schema name */ - const xmlChar *targetNamespace; /* the target namespace */ - const xmlChar *version; - const xmlChar *id; /* Obsolete */ - xmlDocPtr doc; - xmlSchemaAnnotPtr annot; - int flags; - - xmlHashTablePtr typeDecl; - xmlHashTablePtr attrDecl; - xmlHashTablePtr attrgrpDecl; - xmlHashTablePtr elemDecl; - xmlHashTablePtr notaDecl; - - xmlHashTablePtr schemasImports; - - void *_private; /* unused by the library for users or bindings */ - xmlHashTablePtr groupDecl; - xmlDictPtr dict; - void *includes; /* the includes, this is opaque for now */ - int preserve; /* whether to free the document */ - int counter; /* used to give ononymous components unique names */ - xmlHashTablePtr idcDef; /* All identity-constraint defs. */ - void *volatiles; /* Obsolete */ -}; - -XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); -XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_INTERNALS_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/tree.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/tree.h deleted file mode 100644 index b733589bc8..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/tree.h +++ /dev/null @@ -1,1252 +0,0 @@ -/* - * Summary: interfaces for tree manipulation - * Description: this module describes the structures found in an tree resulting - * from an XML or HTML parsing, as well as the API provided for - * various processing on that tree - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_TREE_H__ -#define __XML_TREE_H__ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Some of the basic types pointer to structures: - */ -/* xmlIO.h */ -typedef struct _xmlParserInputBuffer xmlParserInputBuffer; -typedef xmlParserInputBuffer *xmlParserInputBufferPtr; - -typedef struct _xmlOutputBuffer xmlOutputBuffer; -typedef xmlOutputBuffer *xmlOutputBufferPtr; - -/* parser.h */ -typedef struct _xmlParserInput xmlParserInput; -typedef xmlParserInput *xmlParserInputPtr; - -typedef struct _xmlParserCtxt xmlParserCtxt; -typedef xmlParserCtxt *xmlParserCtxtPtr; - -typedef struct _xmlSAXLocator xmlSAXLocator; -typedef xmlSAXLocator *xmlSAXLocatorPtr; - -typedef struct _xmlSAXHandler xmlSAXHandler; -typedef xmlSAXHandler *xmlSAXHandlerPtr; - -/* entities.h */ -typedef struct _xmlEntity xmlEntity; -typedef xmlEntity *xmlEntityPtr; - -/** - * BASE_BUFFER_SIZE: - * - * default buffer size 4000. - */ -#define BASE_BUFFER_SIZE 4096 - -/** - * LIBXML_NAMESPACE_DICT: - * - * Defines experimental behaviour: - * 1) xmlNs gets an additional field @context (a xmlDoc) - * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. - */ -/* #define LIBXML_NAMESPACE_DICT */ - -/** - * xmlBufferAllocationScheme: - * - * A buffer allocation scheme can be defined to either match exactly the - * need or double it's allocated size each time it is found too small. - */ - -typedef enum { - XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ - XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ - XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ - XML_BUFFER_ALLOC_IO /* special allocation scheme used for I/O */ -} xmlBufferAllocationScheme; - -/** - * xmlBuffer: - * - * A buffer structure. - */ -typedef struct _xmlBuffer xmlBuffer; -typedef xmlBuffer *xmlBufferPtr; -struct _xmlBuffer { - xmlChar *content; /* The buffer content UTF8 */ - unsigned int use; /* The buffer size used */ - unsigned int size; /* The buffer size */ - xmlBufferAllocationScheme alloc; /* The realloc method */ - xmlChar *contentIO; /* in IO mode we may have a different base */ -}; - -/** - * XML_XML_NAMESPACE: - * - * This is the namespace for the special xml: prefix predefined in the - * XML Namespace specification. - */ -#define XML_XML_NAMESPACE \ - (const xmlChar *) "http://www.w3.org/XML/1998/namespace" - -/** - * XML_XML_ID: - * - * This is the name for the special xml:id attribute - */ -#define XML_XML_ID (const xmlChar *) "xml:id" - -/* - * The different element types carried by an XML tree. - * - * NOTE: This is synchronized with DOM Level1 values - * See http://www.w3.org/TR/REC-DOM-Level-1/ - * - * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should - * be deprecated to use an XML_DTD_NODE. - */ -typedef enum { - XML_ELEMENT_NODE= 1, - XML_ATTRIBUTE_NODE= 2, - XML_TEXT_NODE= 3, - XML_CDATA_SECTION_NODE= 4, - XML_ENTITY_REF_NODE= 5, - XML_ENTITY_NODE= 6, - XML_PI_NODE= 7, - XML_COMMENT_NODE= 8, - XML_DOCUMENT_NODE= 9, - XML_DOCUMENT_TYPE_NODE= 10, - XML_DOCUMENT_FRAG_NODE= 11, - XML_NOTATION_NODE= 12, - XML_HTML_DOCUMENT_NODE= 13, - XML_DTD_NODE= 14, - XML_ELEMENT_DECL= 15, - XML_ATTRIBUTE_DECL= 16, - XML_ENTITY_DECL= 17, - XML_NAMESPACE_DECL= 18, - XML_XINCLUDE_START= 19, - XML_XINCLUDE_END= 20 -#ifdef LIBXML_DOCB_ENABLED - ,XML_DOCB_DOCUMENT_NODE= 21 -#endif -} xmlElementType; - - -/** - * xmlNotation: - * - * A DTD Notation definition. - */ - -typedef struct _xmlNotation xmlNotation; -typedef xmlNotation *xmlNotationPtr; -struct _xmlNotation { - const xmlChar *name; /* Notation name */ - const xmlChar *PublicID; /* Public identifier, if any */ - const xmlChar *SystemID; /* System identifier, if any */ -}; - -/** - * xmlAttributeType: - * - * A DTD Attribute type definition. - */ - -typedef enum { - XML_ATTRIBUTE_CDATA = 1, - XML_ATTRIBUTE_ID, - XML_ATTRIBUTE_IDREF , - XML_ATTRIBUTE_IDREFS, - XML_ATTRIBUTE_ENTITY, - XML_ATTRIBUTE_ENTITIES, - XML_ATTRIBUTE_NMTOKEN, - XML_ATTRIBUTE_NMTOKENS, - XML_ATTRIBUTE_ENUMERATION, - XML_ATTRIBUTE_NOTATION -} xmlAttributeType; - -/** - * xmlAttributeDefault: - * - * A DTD Attribute default definition. - */ - -typedef enum { - XML_ATTRIBUTE_NONE = 1, - XML_ATTRIBUTE_REQUIRED, - XML_ATTRIBUTE_IMPLIED, - XML_ATTRIBUTE_FIXED -} xmlAttributeDefault; - -/** - * xmlEnumeration: - * - * List structure used when there is an enumeration in DTDs. - */ - -typedef struct _xmlEnumeration xmlEnumeration; -typedef xmlEnumeration *xmlEnumerationPtr; -struct _xmlEnumeration { - struct _xmlEnumeration *next; /* next one */ - const xmlChar *name; /* Enumeration name */ -}; - -/** - * xmlAttribute: - * - * An Attribute declaration in a DTD. - */ - -typedef struct _xmlAttribute xmlAttribute; -typedef xmlAttribute *xmlAttributePtr; -struct _xmlAttribute { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ - const xmlChar *name; /* Attribute name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - struct _xmlAttribute *nexth; /* next in hash table */ - xmlAttributeType atype; /* The attribute type */ - xmlAttributeDefault def; /* the default */ - const xmlChar *defaultValue; /* or the default value */ - xmlEnumerationPtr tree; /* or the enumeration tree if any */ - const xmlChar *prefix; /* the namespace prefix if any */ - const xmlChar *elem; /* Element holding the attribute */ -}; - -/** - * xmlElementContentType: - * - * Possible definitions of element content types. - */ -typedef enum { - XML_ELEMENT_CONTENT_PCDATA = 1, - XML_ELEMENT_CONTENT_ELEMENT, - XML_ELEMENT_CONTENT_SEQ, - XML_ELEMENT_CONTENT_OR -} xmlElementContentType; - -/** - * xmlElementContentOccur: - * - * Possible definitions of element content occurrences. - */ -typedef enum { - XML_ELEMENT_CONTENT_ONCE = 1, - XML_ELEMENT_CONTENT_OPT, - XML_ELEMENT_CONTENT_MULT, - XML_ELEMENT_CONTENT_PLUS -} xmlElementContentOccur; - -/** - * xmlElementContent: - * - * An XML Element content as stored after parsing an element definition - * in a DTD. - */ - -typedef struct _xmlElementContent xmlElementContent; -typedef xmlElementContent *xmlElementContentPtr; -struct _xmlElementContent { - xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ - xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ - const xmlChar *name; /* Element name */ - struct _xmlElementContent *c1; /* first child */ - struct _xmlElementContent *c2; /* second child */ - struct _xmlElementContent *parent; /* parent */ - const xmlChar *prefix; /* Namespace prefix */ -}; - -/** - * xmlElementTypeVal: - * - * The different possibilities for an element content type. - */ - -typedef enum { - XML_ELEMENT_TYPE_UNDEFINED = 0, - XML_ELEMENT_TYPE_EMPTY = 1, - XML_ELEMENT_TYPE_ANY, - XML_ELEMENT_TYPE_MIXED, - XML_ELEMENT_TYPE_ELEMENT -} xmlElementTypeVal; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlElement: - * - * An XML Element declaration from a DTD. - */ - -typedef struct _xmlElement xmlElement; -typedef xmlElement *xmlElementPtr; -struct _xmlElement { - void *_private; /* application data */ - xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ - const xmlChar *name; /* Element name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlElementTypeVal etype; /* The type */ - xmlElementContentPtr content; /* the allowed element content */ - xmlAttributePtr attributes; /* List of the declared attributes */ - const xmlChar *prefix; /* the namespace prefix if any */ -#ifdef LIBXML_REGEXP_ENABLED - xmlRegexpPtr contModel; /* the validating regexp */ -#else - void *contModel; -#endif -}; - - -/** - * XML_LOCAL_NAMESPACE: - * - * A namespace declaration node. - */ -#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL -typedef xmlElementType xmlNsType; - -/** - * xmlNs: - * - * An XML namespace. - * Note that prefix == NULL is valid, it defines the default namespace - * within the subtree (until overridden). - * - * xmlNsType is unified with xmlElementType. - */ - -typedef struct _xmlNs xmlNs; -typedef xmlNs *xmlNsPtr; -struct _xmlNs { - struct _xmlNs *next; /* next Ns link for this node */ - xmlNsType type; /* global or local */ - const xmlChar *href; /* URL for the namespace */ - const xmlChar *prefix; /* prefix for the namespace */ - void *_private; /* application data */ - struct _xmlDoc *context; /* normally an xmlDoc */ -}; - -/** - * xmlDtd: - * - * An XML DTD, as defined by parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - void *notations; /* Hash table for notations if any */ - void *elements; /* Hash table for elements if any */ - void *attributes; /* Hash table for attributes if any */ - void *entities; /* Hash table for entities if any */ - const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ - void *pentities; /* Hash table for param entities if any */ -}; - -/** - * xmlAttr: - * - * An attribute on an XML node. - */ -typedef struct _xmlAttr xmlAttr; -typedef xmlAttr *xmlAttrPtr; -struct _xmlAttr { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ - const xmlChar *name; /* the name of the property */ - struct _xmlNode *children; /* the value of the property */ - struct _xmlNode *last; /* NULL */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlAttr *next; /* next sibling link */ - struct _xmlAttr *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlAttributeType atype; /* the attribute type if validating */ - void *psvi; /* for type/PSVI informations */ -}; - -/** - * xmlID: - * - * An XML ID instance. - */ - -typedef struct _xmlID xmlID; -typedef xmlID *xmlIDPtr; -struct _xmlID { - struct _xmlID *next; /* next ID */ - const xmlChar *value; /* The ID name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ - struct _xmlDoc *doc; /* The document holding the ID */ -}; - -/** - * xmlRef: - * - * An XML IDREF instance. - */ - -typedef struct _xmlRef xmlRef; -typedef xmlRef *xmlRefPtr; -struct _xmlRef { - struct _xmlRef *next; /* next Ref */ - const xmlChar *value; /* The Ref name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ -}; - -/** - * xmlNode: - * - * A node in an XML tree. - */ -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; -struct _xmlNode { - void *_private; /* application data */ - xmlElementType type; /* type number, must be second ! */ - const xmlChar *name; /* the name of the node, or the entity */ - struct _xmlNode *children; /* parent->childs link */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlChar *content; /* the content */ - struct _xmlAttr *properties;/* properties list */ - xmlNs *nsDef; /* namespace definitions on this node */ - void *psvi; /* for type/PSVI informations */ - unsigned short line; /* line number */ - unsigned short extra; /* extra data for XPath/XSLT */ -}; - -/** - * XML_GET_CONTENT: - * - * Macro to extract the content pointer of a node. - */ -#define XML_GET_CONTENT(n) \ - ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) - -/** - * XML_GET_LINE: - * - * Macro to extract the line number of an element node. - */ -#define XML_GET_LINE(n) \ - (xmlGetLineNo(n)) - -/** - * xmlDocProperty - * - * Set of properties of the document as found by the parser - * Some of them are linked to similary named xmlParserOption - */ -typedef enum { - XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ - XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ - XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ - XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ - XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ - XML_DOC_USERBUILT = 1<<5, /* Document was built using the API - and not by parsing an instance */ - XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ - XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ -} xmlDocProperties; - -/** - * xmlDoc: - * - * An XML document. - */ -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; -struct _xmlDoc { - void *_private; /* application data */ - xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ - char *name; /* name/filename/URI of the document */ - struct _xmlNode *children; /* the document tree */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* autoreference to itself */ - - /* End of common part */ - int compression;/* level of zlib compression */ - int standalone; /* standalone document (no external refs) - 1 if standalone="yes" - 0 if standalone="no" - -1 if there is no XML declaration - -2 if there is an XML declaration, but no - standalone attribute was specified */ - struct _xmlDtd *intSubset; /* the document internal subset */ - struct _xmlDtd *extSubset; /* the document external subset */ - struct _xmlNs *oldNs; /* Global namespace, the old way */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* external initial encoding, if any */ - void *ids; /* Hash table for ID attributes if any */ - void *refs; /* Hash table for IDREFs attributes if any */ - const xmlChar *URL; /* The URI for that document */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - struct _xmlDict *dict; /* dict used to allocate names or NULL */ - void *psvi; /* for type/PSVI informations */ - int parseFlags; /* set of xmlParserOption used to parse the - document */ - int properties; /* set of xmlDocProperties for this document - set at the end of parsing */ -}; - - -typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; -typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; - -/** - * xmlDOMWrapAcquireNsFunction: - * @ctxt: a DOM wrapper context - * @node: the context node (element or attribute) - * @nsName: the requested namespace name - * @nsPrefix: the requested namespace prefix - * - * A function called to acquire namespaces (xmlNs) from the wrapper. - * - * Returns an xmlNsPtr or NULL in case of an error. - */ -typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr node, - const xmlChar *nsName, - const xmlChar *nsPrefix); - -/** - * xmlDOMWrapCtxt: - * - * Context for DOM wrapper-operations. - */ -struct _xmlDOMWrapCtxt { - void * _private; - /* - * The type of this context, just in case we need specialized - * contexts in the future. - */ - int type; - /* - * Internal namespace map used for various operations. - */ - void * namespaceMap; - /* - * Use this one to acquire an xmlNsPtr intended for node->ns. - * (Note that this is not intended for elem->nsDef). - */ - xmlDOMWrapAcquireNsFunction getNsForNodeFunc; -}; - -/** - * xmlChildrenNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children." - */ -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#endif - -/** - * xmlRootNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children". - */ -#ifndef xmlRootNode -#define xmlRootNode children -#endif - -/* - * Variables. - */ - -/* - * Some helper functions - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNCName (const xmlChar *value, - int space); -#endif - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateQName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateNMToken (const xmlChar *value, - int space); -#endif - -XMLPUBFUN xmlChar * XMLCALL - xmlBuildQName (const xmlChar *ncname, - const xmlChar *prefix, - xmlChar *memory, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName2 (const xmlChar *name, - xmlChar **prefix); -XMLPUBFUN const xmlChar * XMLCALL - xmlSplitQName3 (const xmlChar *name, - int *len); - -/* - * Handling Buffers. - */ - -XMLPUBFUN void XMLCALL - xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); -XMLPUBFUN xmlBufferAllocationScheme XMLCALL - xmlGetBufferAllocationScheme(void); - -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreate (void); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateSize (size_t size); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateStatic (void *mem, - size_t size); -XMLPUBFUN int XMLCALL - xmlBufferResize (xmlBufferPtr buf, - unsigned int size); -XMLPUBFUN void XMLCALL - xmlBufferFree (xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferDump (FILE *file, - xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferAdd (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferAddHead (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferCat (xmlBufferPtr buf, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlBufferCCat (xmlBufferPtr buf, - const char *str); -XMLPUBFUN int XMLCALL - xmlBufferShrink (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN int XMLCALL - xmlBufferGrow (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN void XMLCALL - xmlBufferEmpty (xmlBufferPtr buf); -XMLPUBFUN const xmlChar* XMLCALL - xmlBufferContent (const xmlBufferPtr buf); -XMLPUBFUN void XMLCALL - xmlBufferSetAllocationScheme(xmlBufferPtr buf, - xmlBufferAllocationScheme scheme); -XMLPUBFUN int XMLCALL - xmlBufferLength (const xmlBufferPtr buf); - -/* - * Creating/freeing new structures. - */ -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCreateIntSubset (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlNewDtd (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlGetIntSubset (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlFreeDtd (xmlDtdPtr cur); -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN xmlNsPtr XMLCALL - xmlNewGlobalNs (xmlDocPtr doc, - const xmlChar *href, - const xmlChar *prefix); -#endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlNsPtr XMLCALL - xmlNewNs (xmlNodePtr node, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - xmlFreeNs (xmlNsPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNsList (xmlNsPtr cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlNewDoc (const xmlChar *version); -XMLPUBFUN void XMLCALL - xmlFreeDoc (xmlDocPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewDocProp (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *value); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -#endif -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsPropEatName (xmlNodePtr node, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlFreePropList (xmlAttrPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeProp (xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyProp (xmlNodePtr target, - xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyPropList (xmlNodePtr target, - xmlAttrPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCopyDtd (xmlDtdPtr dtd); -#endif /* LIBXML_TREE_ENABLED */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlDocPtr XMLCALL - xmlCopyDoc (xmlDocPtr doc, - int recursive); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -/* - * Creating new nodes. - */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNodeEatName (xmlDocPtr doc, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNode (xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNodeEatName (xmlNsPtr ns, - xmlChar *name); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -#endif -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocText (xmlDocPtr doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewText (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocPI (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewPI (const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocTextLen (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextLen (const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocComment (xmlDocPtr doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewComment (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCDataBlock (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCharRef (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewReference (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNode (const xmlNodePtr node, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNode (const xmlNodePtr node, - xmlDocPtr doc, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNodeList (xmlDocPtr doc, - const xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNodeList (const xmlNodePtr node); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocRawNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocFragment (xmlDocPtr doc); -#endif /* LIBXML_TREE_ENABLED */ - -/* - * Navigating. - */ -XMLPUBFUN long XMLCALL - xmlGetLineNo (xmlNodePtr node); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) -XMLPUBFUN xmlChar * XMLCALL - xmlGetNodePath (xmlNodePtr node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocGetRootElement (xmlDocPtr doc); -XMLPUBFUN xmlNodePtr XMLCALL - xmlGetLastChild (xmlNodePtr parent); -XMLPUBFUN int XMLCALL - xmlNodeIsText (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlIsBlankNode (xmlNodePtr node); - -/* - * Changing the structure. - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocSetRootElement (xmlDocPtr doc, - xmlNodePtr root); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetName (xmlNodePtr cur, - const xmlChar *name); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChild (xmlNodePtr parent, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChildList (xmlNodePtr parent, - xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlReplaceNode (xmlNodePtr old, - xmlNodePtr cur); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddPrevSibling (xmlNodePtr cur, - xmlNodePtr elem); -#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddNextSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN void XMLCALL - xmlUnlinkNode (xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextMerge (xmlNodePtr first, - xmlNodePtr second); -XMLPUBFUN int XMLCALL - xmlTextConcat (xmlNodePtr node, - const xmlChar *content, - int len); -XMLPUBFUN void XMLCALL - xmlFreeNodeList (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNode (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlSetTreeDoc (xmlNodePtr tree, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSetListDoc (xmlNodePtr list, - xmlDocPtr doc); -/* - * Namespaces. - */ -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNs (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *nameSpace); -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNsByHref (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNsPtr * XMLCALL - xmlGetNsList (xmlDocPtr doc, - xmlNodePtr node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ - -XMLPUBFUN void XMLCALL - xmlSetNs (xmlNodePtr node, - xmlNsPtr ns); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespace (xmlNsPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespaceList (xmlNsPtr cur); - -/* - * Changing the content. - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -XMLPUBFUN xmlChar * XMLCALL - xmlGetNoNsProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlGetProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasNsProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlChar * XMLCALL - xmlGetNsProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringGetNodeList (xmlDocPtr doc, - const xmlChar *value); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringLenGetNodeList (xmlDocPtr doc, - const xmlChar *value, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetString (xmlDocPtr doc, - xmlNodePtr list, - int inLine); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetRawString (xmlDocPtr doc, - xmlNodePtr list, - int inLine); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeSetContent (xmlNodePtr cur, - const xmlChar *content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeAddContent (xmlNodePtr cur, - const xmlChar *content); -XMLPUBFUN void XMLCALL - xmlNodeAddContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetContent (xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlNodeBufGetContent (xmlBufferPtr buffer, - xmlNodePtr cur); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetLang (xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlNodeGetSpacePreserve (xmlNodePtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetLang (xmlNodePtr cur, - const xmlChar *lang); -XMLPUBFUN void XMLCALL - xmlNodeSetSpacePreserve (xmlNodePtr cur, - int val); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetBase (xmlDocPtr doc, - xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -XMLPUBFUN void XMLCALL - xmlNodeSetBase (xmlNodePtr cur, - const xmlChar *uri); -#endif - -/* - * Removing content. - */ -XMLPUBFUN int XMLCALL - xmlRemoveProp (xmlAttrPtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlUnsetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlUnsetProp (xmlNodePtr node, - const xmlChar *name); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ - -/* - * Internal, don't use. - */ -XMLPUBFUN void XMLCALL - xmlBufferWriteCHAR (xmlBufferPtr buf, - const xmlChar *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteChar (xmlBufferPtr buf, - const char *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteQuotedString(xmlBufferPtr buf, - const xmlChar *string); - -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, - xmlDocPtr doc, - xmlAttrPtr attr, - const xmlChar *string); -#endif /* LIBXML_OUTPUT_ENABLED */ - -#ifdef LIBXML_TREE_ENABLED -/* - * Namespace handling. - */ -XMLPUBFUN int XMLCALL - xmlReconciliateNs (xmlDocPtr doc, - xmlNodePtr tree); -#endif - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Saving. - */ -XMLPUBFUN void XMLCALL - xmlDocDumpFormatMemory (xmlDocPtr cur, - xmlChar **mem, - int *size, - int format); -XMLPUBFUN void XMLCALL - xmlDocDumpMemory (xmlDocPtr cur, - xmlChar **mem, - int *size); -XMLPUBFUN void XMLCALL - xmlDocDumpMemoryEnc (xmlDocPtr out_doc, - xmlChar **doc_txt_ptr, - int * doc_txt_len, - const char *txt_encoding); -XMLPUBFUN void XMLCALL - xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, - xmlChar **doc_txt_ptr, - int * doc_txt_len, - const char *txt_encoding, - int format); -XMLPUBFUN int XMLCALL - xmlDocFormatDump (FILE *f, - xmlDocPtr cur, - int format); -XMLPUBFUN int XMLCALL - xmlDocDump (FILE *f, - xmlDocPtr cur); -XMLPUBFUN void XMLCALL - xmlElemDump (FILE *f, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlSaveFile (const char *filename, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - xmlSaveFormatFile (const char *filename, - xmlDocPtr cur, - int format); -XMLPUBFUN int XMLCALL - xmlNodeDump (xmlBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - int level, - int format); - -XMLPUBFUN int XMLCALL - xmlSaveFileTo (xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlSaveFormatFileTo (xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - xmlNodeDumpOutput (xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - int level, - int format, - const char *encoding); - -XMLPUBFUN int XMLCALL - xmlSaveFormatFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding, - int format); - -XMLPUBFUN int XMLCALL - xmlSaveFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding); - -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * XHTML - */ -XMLPUBFUN int XMLCALL - xmlIsXHTML (const xmlChar *systemID, - const xmlChar *publicID); - -/* - * Compression. - */ -XMLPUBFUN int XMLCALL - xmlGetDocCompressMode (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSetDocCompressMode (xmlDocPtr doc, - int mode); -XMLPUBFUN int XMLCALL - xmlGetCompressMode (void); -XMLPUBFUN void XMLCALL - xmlSetCompressMode (int mode); - -/* -* DOM-wrapper helper functions. -*/ -XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL - xmlDOMWrapNewCtxt (void); -XMLPUBFUN void XMLCALL - xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr elem, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr node, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlNodePtr *clonedNode, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int deep, - int options); - -#ifdef LIBXML_TREE_ENABLED -/* - * 5 interfaces from DOM ElementTraversal, but different in entities - * traversal. - */ -XMLPUBFUN unsigned long XMLCALL - xmlChildElementCount (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNextElementSibling (xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlFirstElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlLastElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlPreviousElementSibling (xmlNodePtr node); -#endif -#ifdef __cplusplus -} -#endif -#ifndef __XML_PARSER_H__ -#include -#endif - -#endif /* __XML_TREE_H__ */ - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/valid.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/valid.h deleted file mode 100644 index f1892b0e29..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/valid.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Summary: The DTD validation - * Description: API for the DTD handling and the validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_VALID_H__ -#define __XML_VALID_H__ - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Validation state added for non-determinist content model. - */ -typedef struct _xmlValidState xmlValidState; -typedef xmlValidState *xmlValidStatePtr; - -/** - * xmlValidityErrorFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity error is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); - -/** - * xmlValidityWarningFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity warning is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); - -#ifdef IN_LIBXML -/** - * XML_CTXT_FINISH_DTD_0: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_0 0xabcd1234 -/** - * XML_CTXT_FINISH_DTD_1: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_1 0xabcd1235 -#endif - -/* - * xmlValidCtxt: - * An xmlValidCtxt is used for error reporting when validating. - */ -typedef struct _xmlValidCtxt xmlValidCtxt; -typedef xmlValidCtxt *xmlValidCtxtPtr; -struct _xmlValidCtxt { - void *userData; /* user specific data block */ - xmlValidityErrorFunc error; /* the callback in case of errors */ - xmlValidityWarningFunc warning; /* the callback in case of warning */ - - /* Node analysis stack used when validating within entities */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - unsigned int finishDtd; /* finished validating the Dtd ? */ - xmlDocPtr doc; /* the document */ - int valid; /* temporary validity check result */ - - /* state state used for non-determinist content validation */ - xmlValidState *vstate; /* current state */ - int vstateNr; /* Depth of the validation stack */ - int vstateMax; /* Max depth of the validation stack */ - xmlValidState *vstateTab; /* array of validation states */ - -#ifdef LIBXML_REGEXP_ENABLED - xmlAutomataPtr am; /* the automata */ - xmlAutomataStatePtr state; /* used to build the automata */ -#else - void *am; - void *state; -#endif -}; - -/* - * ALL notation declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlNotationTable; -typedef xmlNotationTable *xmlNotationTablePtr; - -/* - * ALL element declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlElementTable; -typedef xmlElementTable *xmlElementTablePtr; - -/* - * ALL attribute declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlAttributeTable; -typedef xmlAttributeTable *xmlAttributeTablePtr; - -/* - * ALL IDs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlIDTable; -typedef xmlIDTable *xmlIDTablePtr; - -/* - * ALL Refs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlRefTable; -typedef xmlRefTable *xmlRefTablePtr; - -/* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL - xmlAddNotationDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *PublicID, - const xmlChar *SystemID); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL - xmlCopyNotationTable (xmlNotationTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeNotationTable (xmlNotationTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpNotationDecl (xmlBufferPtr buf, - xmlNotationPtr nota); -XMLPUBFUN void XMLCALL - xmlDumpNotationTable (xmlBufferPtr buf, - xmlNotationTablePtr table); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Element Content */ -/* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewElementContent (const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeElementContent (xmlElementContentPtr cur); -/* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewDocElementContent (xmlDocPtr doc, - const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyDocElementContent(xmlDocPtr doc, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeDocElementContent(xmlDocPtr doc, - xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL - xmlSnprintfElementContent(char *buf, - int size, - xmlElementContentPtr content, - int englob); -#ifdef LIBXML_OUTPUT_ENABLED -/* DEPRECATED */ -XMLPUBFUN void XMLCALL - xmlSprintfElementContent(char *buf, - xmlElementContentPtr content, - int englob); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* DEPRECATED */ - -/* Element */ -XMLPUBFUN xmlElementPtr XMLCALL - xmlAddElementDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - xmlElementTypeVal type, - xmlElementContentPtr content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL - xmlCopyElementTable (xmlElementTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeElementTable (xmlElementTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpElementTable (xmlBufferPtr buf, - xmlElementTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpElementDecl (xmlBufferPtr buf, - xmlElementPtr elem); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlFreeEnumeration (xmlEnumerationPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCopyEnumeration (xmlEnumerationPtr cur); -#endif /* LIBXML_TREE_ENABLED */ - -/* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL - xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *ns, - xmlAttributeType type, - xmlAttributeDefault def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL - xmlCopyAttributeTable (xmlAttributeTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeAttributeTable (xmlAttributeTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpAttributeTable (xmlBufferPtr buf, - xmlAttributeTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpAttributeDecl (xmlBufferPtr buf, - xmlAttributePtr attr); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL - xmlAddID (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlGetID (xmlDocPtr doc, - const xmlChar *ID); -XMLPUBFUN int XMLCALL - xmlIsID (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, - xmlAttrPtr attr); - -/* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL - xmlAddRef (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL - xmlIsRef (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, - xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL - xmlGetRefs (xmlDocPtr doc, - const xmlChar *ID); - -/** - * The public function calls related to validity checking. - */ -#ifdef LIBXML_VALID_ENABLED -/* Allocate/Release Validation Contexts */ -XMLPUBFUN xmlValidCtxtPtr XMLCALL - xmlNewValidCtxt(void); -XMLPUBFUN void XMLCALL - xmlFreeValidCtxt(xmlValidCtxtPtr); - -XMLPUBFUN int XMLCALL - xmlValidateRoot (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElementDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlElementPtr elem); -XMLPUBFUN xmlChar * XMLCALL - xmlValidNormalizeAttributeValue(xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlAttributePtr attr); -XMLPUBFUN int XMLCALL - xmlValidateAttributeValue(xmlAttributeType type, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNotationPtr nota); -XMLPUBFUN int XMLCALL - xmlValidateDtd (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlDtdPtr dtd); -XMLPUBFUN int XMLCALL - xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateDocument (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *prefix, - xmlNsPtr ns, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -#endif /* LIBXML_VALID_ENABLED */ - -#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNotationUse (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *notationName); -#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlIsMixedElement (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdQAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL - xmlGetDtdNotationDesc (xmlDtdPtr dtd, - const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdQElementDesc (xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdElementDesc (xmlDtdPtr dtd, - const xmlChar *name); - -#ifdef LIBXML_VALID_ENABLED - -XMLPUBFUN int XMLCALL - xmlValidGetPotentialChildren(xmlElementContent *ctree, - const xmlChar **names, - int *len, - int max); - -XMLPUBFUN int XMLCALL - xmlValidGetValidElements(xmlNode *prev, - xmlNode *next, - const xmlChar **names, - int max); -XMLPUBFUN int XMLCALL - xmlValidateNameValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNamesValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokenValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokensValue(const xmlChar *value); - -#ifdef LIBXML_REGEXP_ENABLED -/* - * Validation based on the regexp support - */ -XMLPUBFUN int XMLCALL - xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, - xmlElementPtr elem); - -XMLPUBFUN int XMLCALL - xmlValidatePushElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -XMLPUBFUN int XMLCALL - xmlValidatePushCData (xmlValidCtxtPtr ctxt, - const xmlChar *data, - int len); -XMLPUBFUN int XMLCALL - xmlValidatePopElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -#endif /* LIBXML_REGEXP_ENABLED */ -#endif /* LIBXML_VALID_ENABLED */ -#ifdef __cplusplus -} -#endif -#endif /* __XML_VALID_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xinclude.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xinclude.h deleted file mode 100644 index ba9c9b596e..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xinclude.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Summary: implementation of XInclude - * Description: API to handle XInclude processing, - * implements the - * World Wide Web Consortium Last Call Working Draft 10 November 2003 - * http://www.w3.org/TR/2003/WD-xinclude-20031110 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XINCLUDE_H__ -#define __XML_XINCLUDE_H__ - -#include -#include - -#ifdef LIBXML_XINCLUDE_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XINCLUDE_NS: - * - * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude - */ -#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" -/** - * XINCLUDE_OLD_NS: - * - * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude - */ -#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" -/** - * XINCLUDE_NODE: - * - * Macro defining "include" - */ -#define XINCLUDE_NODE (const xmlChar *) "include" -/** - * XINCLUDE_FALLBACK: - * - * Macro defining "fallback" - */ -#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" -/** - * XINCLUDE_HREF: - * - * Macro defining "href" - */ -#define XINCLUDE_HREF (const xmlChar *) "href" -/** - * XINCLUDE_PARSE: - * - * Macro defining "parse" - */ -#define XINCLUDE_PARSE (const xmlChar *) "parse" -/** - * XINCLUDE_PARSE_XML: - * - * Macro defining "xml" - */ -#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" -/** - * XINCLUDE_PARSE_TEXT: - * - * Macro defining "text" - */ -#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" -/** - * XINCLUDE_PARSE_ENCODING: - * - * Macro defining "encoding" - */ -#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" -/** - * XINCLUDE_PARSE_XPOINTER: - * - * Macro defining "xpointer" - */ -#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" - -typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; -typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; - -/* - * standalone processing - */ -XMLPUBFUN int XMLCALL - xmlXIncludeProcess (xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessFlags (xmlDocPtr doc, - int flags); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessFlagsData(xmlDocPtr doc, - int flags, - void *data); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessTree (xmlNodePtr tree); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessTreeFlags(xmlNodePtr tree, - int flags); -/* - * contextual processing - */ -XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL - xmlXIncludeNewContext (xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, - int flags); -XMLPUBFUN void XMLCALL - xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, - xmlNodePtr tree); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XINCLUDE_ENABLED */ - -#endif /* __XML_XINCLUDE_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xlink.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xlink.h deleted file mode 100644 index 083c7eda40..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xlink.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Summary: unfinished XLink detection module - * Description: unfinished XLink detection module - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XLINK_H__ -#define __XML_XLINK_H__ - -#include -#include - -#ifdef LIBXML_XPTR_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Various defines for the various Link properties. - * - * NOTE: the link detection layer will try to resolve QName expansion - * of namespaces. If "foo" is the prefix for "http://foo.com/" - * then the link detection layer will expand role="foo:myrole" - * to "http://foo.com/:myrole". - * NOTE: the link detection layer will expand URI-Refences found on - * href attributes by using the base mechanism if found. - */ -typedef xmlChar *xlinkHRef; -typedef xmlChar *xlinkRole; -typedef xmlChar *xlinkTitle; - -typedef enum { - XLINK_TYPE_NONE = 0, - XLINK_TYPE_SIMPLE, - XLINK_TYPE_EXTENDED, - XLINK_TYPE_EXTENDED_SET -} xlinkType; - -typedef enum { - XLINK_SHOW_NONE = 0, - XLINK_SHOW_NEW, - XLINK_SHOW_EMBED, - XLINK_SHOW_REPLACE -} xlinkShow; - -typedef enum { - XLINK_ACTUATE_NONE = 0, - XLINK_ACTUATE_AUTO, - XLINK_ACTUATE_ONREQUEST -} xlinkActuate; - -/** - * xlinkNodeDetectFunc: - * @ctx: user data pointer - * @node: the node to check - * - * This is the prototype for the link detection routine. - * It calls the default link detection callbacks upon link detection. - */ -typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); - -/* - * The link detection module interact with the upper layers using - * a set of callback registered at parsing time. - */ - -/** - * xlinkSimpleLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @href: the target of the link - * @role: the role string - * @title: the link title - * - * This is the prototype for a simple link detection callback. - */ -typedef void -(*xlinkSimpleLinkFunk) (void *ctx, - xmlNodePtr node, - const xlinkHRef href, - const xlinkRole role, - const xlinkTitle title); - -/** - * xlinkExtendedLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbArcs: the number of arcs detected on the link - * @from: pointer to the array of source roles found on the arcs - * @to: pointer to the array of target roles found on the arcs - * @show: array of values for the show attributes found on the arcs - * @actuate: array of values for the actuate attributes found on the arcs - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link detection callback. - */ -typedef void -(*xlinkExtendedLinkFunk)(void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbArcs, - const xlinkRole *from, - const xlinkRole *to, - xlinkShow *show, - xlinkActuate *actuate, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * xlinkExtendedLinkSetFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link set detection callback. - */ -typedef void -(*xlinkExtendedLinkSetFunk) (void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * This is the structure containing a set of Links detection callbacks. - * - * There is no default xlink callbacks, if one want to get link - * recognition activated, those call backs must be provided before parsing. - */ -typedef struct _xlinkHandler xlinkHandler; -typedef xlinkHandler *xlinkHandlerPtr; -struct _xlinkHandler { - xlinkSimpleLinkFunk simple; - xlinkExtendedLinkFunk extended; - xlinkExtendedLinkSetFunk set; -}; - -/* - * The default detection routine, can be overridden, they call the default - * detection callbacks. - */ - -XMLPUBFUN xlinkNodeDetectFunc XMLCALL - xlinkGetDefaultDetect (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultDetect (xlinkNodeDetectFunc func); - -/* - * Routines to set/get the default handlers. - */ -XMLPUBFUN xlinkHandlerPtr XMLCALL - xlinkGetDefaultHandler (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultHandler (xlinkHandlerPtr handler); - -/* - * Link detection module itself. - */ -XMLPUBFUN xlinkType XMLCALL - xlinkIsLink (xmlDocPtr doc, - xmlNodePtr node); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ - -#endif /* __XML_XLINK_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlerror.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlerror.h deleted file mode 100644 index 7cce9c34a4..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlerror.h +++ /dev/null @@ -1,944 +0,0 @@ -/* - * Summary: error handling - * Description: the API used to report errors - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#include - -#ifndef __XML_ERROR_H__ -#define __XML_ERROR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlErrorLevel: - * - * Indicates the level of an error - */ -typedef enum { - XML_ERR_NONE = 0, - XML_ERR_WARNING = 1, /* A simple warning */ - XML_ERR_ERROR = 2, /* A recoverable error */ - XML_ERR_FATAL = 3 /* A fatal error */ -} xmlErrorLevel; - -/** - * xmlErrorDomain: - * - * Indicates where an error may have come from - */ -typedef enum { - XML_FROM_NONE = 0, - XML_FROM_PARSER, /* The XML parser */ - XML_FROM_TREE, /* The tree module */ - XML_FROM_NAMESPACE, /* The XML Namespace module */ - XML_FROM_DTD, /* The XML DTD validation with parser context*/ - XML_FROM_HTML, /* The HTML parser */ - XML_FROM_MEMORY, /* The memory allocator */ - XML_FROM_OUTPUT, /* The serialization code */ - XML_FROM_IO, /* The Input/Output stack */ - XML_FROM_FTP, /* The FTP module */ - XML_FROM_HTTP, /* The HTTP module */ - XML_FROM_XINCLUDE, /* The XInclude processing */ - XML_FROM_XPATH, /* The XPath module */ - XML_FROM_XPOINTER, /* The XPointer module */ - XML_FROM_REGEXP, /* The regular expressions module */ - XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ - XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ - XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ - XML_FROM_RELAXNGP, /* The Relax-NG parser module */ - XML_FROM_RELAXNGV, /* The Relax-NG validator module */ - XML_FROM_CATALOG, /* The Catalog module */ - XML_FROM_C14N, /* The Canonicalization module */ - XML_FROM_XSLT, /* The XSLT engine from libxslt */ - XML_FROM_VALID, /* The XML DTD validation with valid context */ - XML_FROM_CHECK, /* The error checking module */ - XML_FROM_WRITER, /* The xmlwriter module */ - XML_FROM_MODULE, /* The dynamically loaded module module*/ - XML_FROM_I18N, /* The module handling character conversion */ - XML_FROM_SCHEMATRONV /* The Schematron validator module */ -} xmlErrorDomain; - -/** - * xmlError: - * - * An XML Error instance. - */ - -typedef struct _xmlError xmlError; -typedef xmlError *xmlErrorPtr; -struct _xmlError { - int domain; /* What part of the library raised this error */ - int code; /* The error code, e.g. an xmlParserError */ - char *message;/* human-readable informative error message */ - xmlErrorLevel level;/* how consequent is the error */ - char *file; /* the filename */ - int line; /* the line number if available */ - char *str1; /* extra string information */ - char *str2; /* extra string information */ - char *str3; /* extra string information */ - int int1; /* extra number information */ - int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */ - void *ctxt; /* the parser context if available */ - void *node; /* the node in the tree */ -}; - -/** - * xmlParserError: - * - * This is an error that the XML (or HTML) parser can generate - */ -typedef enum { - XML_ERR_OK = 0, - XML_ERR_INTERNAL_ERROR, /* 1 */ - XML_ERR_NO_MEMORY, /* 2 */ - XML_ERR_DOCUMENT_START, /* 3 */ - XML_ERR_DOCUMENT_EMPTY, /* 4 */ - XML_ERR_DOCUMENT_END, /* 5 */ - XML_ERR_INVALID_HEX_CHARREF, /* 6 */ - XML_ERR_INVALID_DEC_CHARREF, /* 7 */ - XML_ERR_INVALID_CHARREF, /* 8 */ - XML_ERR_INVALID_CHAR, /* 9 */ - XML_ERR_CHARREF_AT_EOF, /* 10 */ - XML_ERR_CHARREF_IN_PROLOG, /* 11 */ - XML_ERR_CHARREF_IN_EPILOG, /* 12 */ - XML_ERR_CHARREF_IN_DTD, /* 13 */ - XML_ERR_ENTITYREF_AT_EOF, /* 14 */ - XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ - XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ - XML_ERR_ENTITYREF_IN_DTD, /* 17 */ - XML_ERR_PEREF_AT_EOF, /* 18 */ - XML_ERR_PEREF_IN_PROLOG, /* 19 */ - XML_ERR_PEREF_IN_EPILOG, /* 20 */ - XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ - XML_ERR_ENTITYREF_NO_NAME, /* 22 */ - XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ - XML_ERR_PEREF_NO_NAME, /* 24 */ - XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ - XML_ERR_UNDECLARED_ENTITY, /* 26 */ - XML_WAR_UNDECLARED_ENTITY, /* 27 */ - XML_ERR_UNPARSED_ENTITY, /* 28 */ - XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ - XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ - XML_ERR_UNKNOWN_ENCODING, /* 31 */ - XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ - XML_ERR_STRING_NOT_STARTED, /* 33 */ - XML_ERR_STRING_NOT_CLOSED, /* 34 */ - XML_ERR_NS_DECL_ERROR, /* 35 */ - XML_ERR_ENTITY_NOT_STARTED, /* 36 */ - XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ - XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ - XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ - XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ - XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ - XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ - XML_ERR_LITERAL_NOT_STARTED, /* 43 */ - XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ - XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ - XML_ERR_PI_NOT_STARTED, /* 46 */ - XML_ERR_PI_NOT_FINISHED, /* 47 */ - XML_ERR_NOTATION_NOT_STARTED, /* 48 */ - XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ - XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ - XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ - XML_ERR_MIXED_NOT_STARTED, /* 52 */ - XML_ERR_MIXED_NOT_FINISHED, /* 53 */ - XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ - XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ - XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ - XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ - XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ - XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ - XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ - XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ - XML_ERR_MISPLACED_CDATA_END, /* 62 */ - XML_ERR_CDATA_NOT_FINISHED, /* 63 */ - XML_ERR_RESERVED_XML_NAME, /* 64 */ - XML_ERR_SPACE_REQUIRED, /* 65 */ - XML_ERR_SEPARATOR_REQUIRED, /* 66 */ - XML_ERR_NMTOKEN_REQUIRED, /* 67 */ - XML_ERR_NAME_REQUIRED, /* 68 */ - XML_ERR_PCDATA_REQUIRED, /* 69 */ - XML_ERR_URI_REQUIRED, /* 70 */ - XML_ERR_PUBID_REQUIRED, /* 71 */ - XML_ERR_LT_REQUIRED, /* 72 */ - XML_ERR_GT_REQUIRED, /* 73 */ - XML_ERR_LTSLASH_REQUIRED, /* 74 */ - XML_ERR_EQUAL_REQUIRED, /* 75 */ - XML_ERR_TAG_NAME_MISMATCH, /* 76 */ - XML_ERR_TAG_NOT_FINISHED, /* 77 */ - XML_ERR_STANDALONE_VALUE, /* 78 */ - XML_ERR_ENCODING_NAME, /* 79 */ - XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ - XML_ERR_INVALID_ENCODING, /* 81 */ - XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ - XML_ERR_CONDSEC_INVALID, /* 83 */ - XML_ERR_VALUE_REQUIRED, /* 84 */ - XML_ERR_NOT_WELL_BALANCED, /* 85 */ - XML_ERR_EXTRA_CONTENT, /* 86 */ - XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ - XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ - XML_ERR_ENTITY_LOOP, /* 89 */ - XML_ERR_ENTITY_BOUNDARY, /* 90 */ - XML_ERR_INVALID_URI, /* 91 */ - XML_ERR_URI_FRAGMENT, /* 92 */ - XML_WAR_CATALOG_PI, /* 93 */ - XML_ERR_NO_DTD, /* 94 */ - XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ - XML_ERR_VERSION_MISSING, /* 96 */ - XML_WAR_UNKNOWN_VERSION, /* 97 */ - XML_WAR_LANG_VALUE, /* 98 */ - XML_WAR_NS_URI, /* 99 */ - XML_WAR_NS_URI_RELATIVE, /* 100 */ - XML_ERR_MISSING_ENCODING, /* 101 */ - XML_WAR_SPACE_VALUE, /* 102 */ - XML_ERR_NOT_STANDALONE, /* 103 */ - XML_ERR_ENTITY_PROCESSING, /* 104 */ - XML_ERR_NOTATION_PROCESSING, /* 105 */ - XML_WAR_NS_COLUMN, /* 106 */ - XML_WAR_ENTITY_REDEFINED, /* 107 */ - XML_ERR_UNKNOWN_VERSION, /* 108 */ - XML_ERR_VERSION_MISMATCH, /* 109 */ - XML_NS_ERR_XML_NAMESPACE = 200, - XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ - XML_NS_ERR_QNAME, /* 202 */ - XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ - XML_NS_ERR_EMPTY, /* 204 */ - XML_NS_ERR_COLON, /* 205 */ - XML_DTD_ATTRIBUTE_DEFAULT = 500, - XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ - XML_DTD_ATTRIBUTE_VALUE, /* 502 */ - XML_DTD_CONTENT_ERROR, /* 503 */ - XML_DTD_CONTENT_MODEL, /* 504 */ - XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ - XML_DTD_DIFFERENT_PREFIX, /* 506 */ - XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ - XML_DTD_ELEM_NAMESPACE, /* 508 */ - XML_DTD_ELEM_REDEFINED, /* 509 */ - XML_DTD_EMPTY_NOTATION, /* 510 */ - XML_DTD_ENTITY_TYPE, /* 511 */ - XML_DTD_ID_FIXED, /* 512 */ - XML_DTD_ID_REDEFINED, /* 513 */ - XML_DTD_ID_SUBSET, /* 514 */ - XML_DTD_INVALID_CHILD, /* 515 */ - XML_DTD_INVALID_DEFAULT, /* 516 */ - XML_DTD_LOAD_ERROR, /* 517 */ - XML_DTD_MISSING_ATTRIBUTE, /* 518 */ - XML_DTD_MIXED_CORRUPT, /* 519 */ - XML_DTD_MULTIPLE_ID, /* 520 */ - XML_DTD_NO_DOC, /* 521 */ - XML_DTD_NO_DTD, /* 522 */ - XML_DTD_NO_ELEM_NAME, /* 523 */ - XML_DTD_NO_PREFIX, /* 524 */ - XML_DTD_NO_ROOT, /* 525 */ - XML_DTD_NOTATION_REDEFINED, /* 526 */ - XML_DTD_NOTATION_VALUE, /* 527 */ - XML_DTD_NOT_EMPTY, /* 528 */ - XML_DTD_NOT_PCDATA, /* 529 */ - XML_DTD_NOT_STANDALONE, /* 530 */ - XML_DTD_ROOT_NAME, /* 531 */ - XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ - XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ - XML_DTD_UNKNOWN_ELEM, /* 534 */ - XML_DTD_UNKNOWN_ENTITY, /* 535 */ - XML_DTD_UNKNOWN_ID, /* 536 */ - XML_DTD_UNKNOWN_NOTATION, /* 537 */ - XML_DTD_STANDALONE_DEFAULTED, /* 538 */ - XML_DTD_XMLID_VALUE, /* 539 */ - XML_DTD_XMLID_TYPE, /* 540 */ - XML_DTD_DUP_TOKEN, /* 541 */ - XML_HTML_STRUCURE_ERROR = 800, - XML_HTML_UNKNOWN_TAG, /* 801 */ - XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, - XML_RNGP_ATTR_CONFLICT, /* 1001 */ - XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ - XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ - XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ - XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ - XML_RNGP_CHOICE_CONTENT, /* 1006 */ - XML_RNGP_CHOICE_EMPTY, /* 1007 */ - XML_RNGP_CREATE_FAILURE, /* 1008 */ - XML_RNGP_DATA_CONTENT, /* 1009 */ - XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ - XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ - XML_RNGP_DEFINE_EMPTY, /* 1012 */ - XML_RNGP_DEFINE_MISSING, /* 1013 */ - XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ - XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ - XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ - XML_RNGP_ELEMENT_EMPTY, /* 1017 */ - XML_RNGP_ELEMENT_CONTENT, /* 1018 */ - XML_RNGP_ELEMENT_NAME, /* 1019 */ - XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ - XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ - XML_RNGP_EMPTY, /* 1022 */ - XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ - XML_RNGP_EMPTY_CONTENT, /* 1024 */ - XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ - XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ - XML_RNGP_EXCEPT_EMPTY, /* 1027 */ - XML_RNGP_EXCEPT_MISSING, /* 1028 */ - XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ - XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ - XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ - XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ - XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ - XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ - XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ - XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ - XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ - XML_RNGP_GRAMMAR_MISSING, /* 1038 */ - XML_RNGP_GRAMMAR_NO_START, /* 1039 */ - XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ - XML_RNGP_HREF_ERROR, /* 1041 */ - XML_RNGP_INCLUDE_EMPTY, /* 1042 */ - XML_RNGP_INCLUDE_FAILURE, /* 1043 */ - XML_RNGP_INCLUDE_RECURSE, /* 1044 */ - XML_RNGP_INTERLEAVE_ADD, /* 1045 */ - XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ - XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ - XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ - XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ - XML_RNGP_INVALID_URI, /* 1050 */ - XML_RNGP_INVALID_VALUE, /* 1051 */ - XML_RNGP_MISSING_HREF, /* 1052 */ - XML_RNGP_NAME_MISSING, /* 1053 */ - XML_RNGP_NEED_COMBINE, /* 1054 */ - XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ - XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ - XML_RNGP_NSNAME_NO_NS, /* 1057 */ - XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ - XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ - XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ - XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ - XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ - XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ - XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ - XML_RNGP_PARSE_ERROR, /* 1065 */ - XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ - XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ - XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ - XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ - XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ - XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ - XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ - XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ - XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ - XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ - XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ - XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ - XML_RNGP_PAT_LIST_ATTR, /* 1078 */ - XML_RNGP_PAT_LIST_ELEM, /* 1079 */ - XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ - XML_RNGP_PAT_LIST_LIST, /* 1081 */ - XML_RNGP_PAT_LIST_REF, /* 1082 */ - XML_RNGP_PAT_LIST_TEXT, /* 1083 */ - XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ - XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ - XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ - XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ - XML_RNGP_PAT_START_ATTR, /* 1088 */ - XML_RNGP_PAT_START_DATA, /* 1089 */ - XML_RNGP_PAT_START_EMPTY, /* 1090 */ - XML_RNGP_PAT_START_GROUP, /* 1091 */ - XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ - XML_RNGP_PAT_START_LIST, /* 1093 */ - XML_RNGP_PAT_START_ONEMORE, /* 1094 */ - XML_RNGP_PAT_START_TEXT, /* 1095 */ - XML_RNGP_PAT_START_VALUE, /* 1096 */ - XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ - XML_RNGP_REF_CREATE_FAILED, /* 1098 */ - XML_RNGP_REF_CYCLE, /* 1099 */ - XML_RNGP_REF_NAME_INVALID, /* 1100 */ - XML_RNGP_REF_NO_DEF, /* 1101 */ - XML_RNGP_REF_NO_NAME, /* 1102 */ - XML_RNGP_REF_NOT_EMPTY, /* 1103 */ - XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ - XML_RNGP_START_CONTENT, /* 1105 */ - XML_RNGP_START_EMPTY, /* 1106 */ - XML_RNGP_START_MISSING, /* 1107 */ - XML_RNGP_TEXT_EXPECTED, /* 1108 */ - XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ - XML_RNGP_TYPE_MISSING, /* 1110 */ - XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ - XML_RNGP_TYPE_VALUE, /* 1112 */ - XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ - XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ - XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ - XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ - XML_RNGP_URI_FRAGMENT, /* 1117 */ - XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ - XML_RNGP_VALUE_EMPTY, /* 1119 */ - XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ - XML_RNGP_XMLNS_NAME, /* 1121 */ - XML_RNGP_XML_NS, /* 1122 */ - XML_XPATH_EXPRESSION_OK = 1200, - XML_XPATH_NUMBER_ERROR, /* 1201 */ - XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ - XML_XPATH_START_LITERAL_ERROR, /* 1203 */ - XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ - XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ - XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ - XML_XPATH_EXPR_ERROR, /* 1207 */ - XML_XPATH_UNCLOSED_ERROR, /* 1208 */ - XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ - XML_XPATH_INVALID_OPERAND, /* 1210 */ - XML_XPATH_INVALID_TYPE, /* 1211 */ - XML_XPATH_INVALID_ARITY, /* 1212 */ - XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ - XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ - XML_XPATH_MEMORY_ERROR, /* 1215 */ - XML_XPTR_SYNTAX_ERROR, /* 1216 */ - XML_XPTR_RESOURCE_ERROR, /* 1217 */ - XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ - XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ - XML_XPATH_ENCODING_ERROR, /* 1220 */ - XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ - XML_TREE_INVALID_HEX = 1300, - XML_TREE_INVALID_DEC, /* 1301 */ - XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ - XML_TREE_NOT_UTF8, /* 1303 */ - XML_SAVE_NOT_UTF8 = 1400, - XML_SAVE_CHAR_INVALID, /* 1401 */ - XML_SAVE_NO_DOCTYPE, /* 1402 */ - XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ - XML_REGEXP_COMPILE_ERROR = 1450, - XML_IO_UNKNOWN = 1500, - XML_IO_EACCES, /* 1501 */ - XML_IO_EAGAIN, /* 1502 */ - XML_IO_EBADF, /* 1503 */ - XML_IO_EBADMSG, /* 1504 */ - XML_IO_EBUSY, /* 1505 */ - XML_IO_ECANCELED, /* 1506 */ - XML_IO_ECHILD, /* 1507 */ - XML_IO_EDEADLK, /* 1508 */ - XML_IO_EDOM, /* 1509 */ - XML_IO_EEXIST, /* 1510 */ - XML_IO_EFAULT, /* 1511 */ - XML_IO_EFBIG, /* 1512 */ - XML_IO_EINPROGRESS, /* 1513 */ - XML_IO_EINTR, /* 1514 */ - XML_IO_EINVAL, /* 1515 */ - XML_IO_EIO, /* 1516 */ - XML_IO_EISDIR, /* 1517 */ - XML_IO_EMFILE, /* 1518 */ - XML_IO_EMLINK, /* 1519 */ - XML_IO_EMSGSIZE, /* 1520 */ - XML_IO_ENAMETOOLONG, /* 1521 */ - XML_IO_ENFILE, /* 1522 */ - XML_IO_ENODEV, /* 1523 */ - XML_IO_ENOENT, /* 1524 */ - XML_IO_ENOEXEC, /* 1525 */ - XML_IO_ENOLCK, /* 1526 */ - XML_IO_ENOMEM, /* 1527 */ - XML_IO_ENOSPC, /* 1528 */ - XML_IO_ENOSYS, /* 1529 */ - XML_IO_ENOTDIR, /* 1530 */ - XML_IO_ENOTEMPTY, /* 1531 */ - XML_IO_ENOTSUP, /* 1532 */ - XML_IO_ENOTTY, /* 1533 */ - XML_IO_ENXIO, /* 1534 */ - XML_IO_EPERM, /* 1535 */ - XML_IO_EPIPE, /* 1536 */ - XML_IO_ERANGE, /* 1537 */ - XML_IO_EROFS, /* 1538 */ - XML_IO_ESPIPE, /* 1539 */ - XML_IO_ESRCH, /* 1540 */ - XML_IO_ETIMEDOUT, /* 1541 */ - XML_IO_EXDEV, /* 1542 */ - XML_IO_NETWORK_ATTEMPT, /* 1543 */ - XML_IO_ENCODER, /* 1544 */ - XML_IO_FLUSH, /* 1545 */ - XML_IO_WRITE, /* 1546 */ - XML_IO_NO_INPUT, /* 1547 */ - XML_IO_BUFFER_FULL, /* 1548 */ - XML_IO_LOAD_ERROR, /* 1549 */ - XML_IO_ENOTSOCK, /* 1550 */ - XML_IO_EISCONN, /* 1551 */ - XML_IO_ECONNREFUSED, /* 1552 */ - XML_IO_ENETUNREACH, /* 1553 */ - XML_IO_EADDRINUSE, /* 1554 */ - XML_IO_EALREADY, /* 1555 */ - XML_IO_EAFNOSUPPORT, /* 1556 */ - XML_XINCLUDE_RECURSION=1600, - XML_XINCLUDE_PARSE_VALUE, /* 1601 */ - XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ - XML_XINCLUDE_NO_HREF, /* 1603 */ - XML_XINCLUDE_NO_FALLBACK, /* 1604 */ - XML_XINCLUDE_HREF_URI, /* 1605 */ - XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ - XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ - XML_XINCLUDE_INVALID_CHAR, /* 1608 */ - XML_XINCLUDE_BUILD_FAILED, /* 1609 */ - XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ - XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ - XML_XINCLUDE_XPTR_FAILED, /* 1612 */ - XML_XINCLUDE_XPTR_RESULT, /* 1613 */ - XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ - XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ - XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ - XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ - XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ - XML_CATALOG_MISSING_ATTR = 1650, - XML_CATALOG_ENTRY_BROKEN, /* 1651 */ - XML_CATALOG_PREFER_VALUE, /* 1652 */ - XML_CATALOG_NOT_CATALOG, /* 1653 */ - XML_CATALOG_RECURSION, /* 1654 */ - XML_SCHEMAP_PREFIX_UNDEFINED = 1700, - XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ - XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ - XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ - XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ - XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ - XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ - XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ - XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ - XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ - XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ - XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ - XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ - XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ - XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ - XML_SCHEMAP_INVALID_ENUM, /* 1715 */ - XML_SCHEMAP_INVALID_FACET, /* 1716 */ - XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ - XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ - XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ - XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ - XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ - XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ - XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ - XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ - XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ - XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ - XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ - XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ - XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ - XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ - XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ - XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ - XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ - XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ - XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ - XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ - XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ - XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ - XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ - XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ - XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ - XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ - XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ - XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ - XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ - XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ - XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ - XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ - XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ - XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ - XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ - XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ - XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ - XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ - XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ - XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ - XML_SCHEMAP_FAILED_LOAD, /* 1757 */ - XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ - XML_SCHEMAP_NOROOT, /* 1759 */ - XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ - XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ - XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ - XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ - XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ - XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ - XML_SCHEMAP_FAILED_PARSE, /* 1766 */ - XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ - XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ - XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ - XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ - XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ - XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ - XML_SCHEMAP_RECURSIVE, /* 1775 */ - XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ - XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ - XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ - XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ - XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ - XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ - XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ - XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ - XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ - XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ - XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ - XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ - XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ - XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ - XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ - XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ - XML_SCHEMAV_NOROOT = 1801, - XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ - XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ - XML_SCHEMAV_MISSING, /* 1804 */ - XML_SCHEMAV_WRONGELEM, /* 1805 */ - XML_SCHEMAV_NOTYPE, /* 1806 */ - XML_SCHEMAV_NOROLLBACK, /* 1807 */ - XML_SCHEMAV_ISABSTRACT, /* 1808 */ - XML_SCHEMAV_NOTEMPTY, /* 1809 */ - XML_SCHEMAV_ELEMCONT, /* 1810 */ - XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ - XML_SCHEMAV_NOTNILLABLE, /* 1812 */ - XML_SCHEMAV_EXTRACONTENT, /* 1813 */ - XML_SCHEMAV_INVALIDATTR, /* 1814 */ - XML_SCHEMAV_INVALIDELEM, /* 1815 */ - XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ - XML_SCHEMAV_CONSTRUCT, /* 1817 */ - XML_SCHEMAV_INTERNAL, /* 1818 */ - XML_SCHEMAV_NOTSIMPLE, /* 1819 */ - XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ - XML_SCHEMAV_ATTRINVALID, /* 1821 */ - XML_SCHEMAV_VALUE, /* 1822 */ - XML_SCHEMAV_FACET, /* 1823 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ - XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ - XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ - XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ - XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ - XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ - XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ - XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ - XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ - XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ - XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ - XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ - XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ - XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ - XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ - XML_SCHEMAV_CVC_ELT_1, /* 1845 */ - XML_SCHEMAV_CVC_ELT_2, /* 1846 */ - XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ - XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ - XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ - XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ - XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ - XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ - XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ - XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ - XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ - XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ - XML_SCHEMAV_CVC_ELT_6, /* 1859 */ - XML_SCHEMAV_CVC_ELT_7, /* 1860 */ - XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ - XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ - XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ - XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ - XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ - XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ - XML_SCHEMAV_CVC_AU, /* 1874 */ - XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ - XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ - XML_SCHEMAV_CVC_IDC, /* 1877 */ - XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ - XML_SCHEMAV_MISC, /* 1879 */ - XML_XPTR_UNKNOWN_SCHEME = 1900, - XML_XPTR_CHILDSEQ_START, /* 1901 */ - XML_XPTR_EVAL_FAILED, /* 1902 */ - XML_XPTR_EXTRA_OBJECTS, /* 1903 */ - XML_C14N_CREATE_CTXT = 1950, - XML_C14N_REQUIRES_UTF8, /* 1951 */ - XML_C14N_CREATE_STACK, /* 1952 */ - XML_C14N_INVALID_NODE, /* 1953 */ - XML_C14N_UNKNOW_NODE, /* 1954 */ - XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ - XML_FTP_PASV_ANSWER = 2000, - XML_FTP_EPSV_ANSWER, /* 2001 */ - XML_FTP_ACCNT, /* 2002 */ - XML_FTP_URL_SYNTAX, /* 2003 */ - XML_HTTP_URL_SYNTAX = 2020, - XML_HTTP_USE_IP, /* 2021 */ - XML_HTTP_UNKNOWN_HOST, /* 2022 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, - XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ - XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ - XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ - XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ - XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ - XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ - XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ - XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ - XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ - XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ - XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ - XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ - XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ - XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ - XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ - XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ - XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ - XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ - XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ - XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ - XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ - XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ - XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ - XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ - XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ - XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ - XML_SCHEMAP_NO_XMLNS, /* 3056 */ - XML_SCHEMAP_NO_XSI, /* 3057 */ - XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ - XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ - XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ - XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ - XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ - XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ - XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ - XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ - XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ - XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ - XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ - XML_SCHEMAP_SRC_CT_1, /* 3076 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ - XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ - XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ - XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ - XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ - XML_SCHEMAP_SRC_IMPORT, /* 3082 */ - XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ - XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ - XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ - XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ - XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ - XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ - XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ - XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ - XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ - XML_SCHEMATRONV_REPORT, - XML_MODULE_OPEN = 4900, /* 4900 */ - XML_MODULE_CLOSE, /* 4901 */ - XML_CHECK_FOUND_ELEMENT = 5000, - XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ - XML_CHECK_FOUND_TEXT, /* 5002 */ - XML_CHECK_FOUND_CDATA, /* 5003 */ - XML_CHECK_FOUND_ENTITYREF, /* 5004 */ - XML_CHECK_FOUND_ENTITY, /* 5005 */ - XML_CHECK_FOUND_PI, /* 5006 */ - XML_CHECK_FOUND_COMMENT, /* 5007 */ - XML_CHECK_FOUND_DOCTYPE, /* 5008 */ - XML_CHECK_FOUND_FRAGMENT, /* 5009 */ - XML_CHECK_FOUND_NOTATION, /* 5010 */ - XML_CHECK_UNKNOWN_NODE, /* 5011 */ - XML_CHECK_ENTITY_TYPE, /* 5012 */ - XML_CHECK_NO_PARENT, /* 5013 */ - XML_CHECK_NO_DOC, /* 5014 */ - XML_CHECK_NO_NAME, /* 5015 */ - XML_CHECK_NO_ELEM, /* 5016 */ - XML_CHECK_WRONG_DOC, /* 5017 */ - XML_CHECK_NO_PREV, /* 5018 */ - XML_CHECK_WRONG_PREV, /* 5019 */ - XML_CHECK_NO_NEXT, /* 5020 */ - XML_CHECK_WRONG_NEXT, /* 5021 */ - XML_CHECK_NOT_DTD, /* 5022 */ - XML_CHECK_NOT_ATTR, /* 5023 */ - XML_CHECK_NOT_ATTR_DECL, /* 5024 */ - XML_CHECK_NOT_ELEM_DECL, /* 5025 */ - XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ - XML_CHECK_NOT_NS_DECL, /* 5027 */ - XML_CHECK_NO_HREF, /* 5028 */ - XML_CHECK_WRONG_PARENT,/* 5029 */ - XML_CHECK_NS_SCOPE, /* 5030 */ - XML_CHECK_NS_ANCESTOR, /* 5031 */ - XML_CHECK_NOT_UTF8, /* 5032 */ - XML_CHECK_NO_DICT, /* 5033 */ - XML_CHECK_NOT_NCNAME, /* 5034 */ - XML_CHECK_OUTSIDE_DICT, /* 5035 */ - XML_CHECK_WRONG_NAME, /* 5036 */ - XML_CHECK_NAME_NOT_NULL, /* 5037 */ - XML_I18N_NO_NAME = 6000, - XML_I18N_NO_HANDLER, /* 6001 */ - XML_I18N_EXCESS_HANDLER, /* 6002 */ - XML_I18N_CONV_FAILED, /* 6003 */ - XML_I18N_NO_OUTPUT /* 6004 */ -#if 0 - XML_CHECK_, /* 5033 */ - XML_CHECK_X /* 503 */ -#endif -} xmlParserErrors; - -/** - * xmlGenericErrorFunc: - * @ctx: a parsing context - * @msg: the message - * @...: the extra arguments of the varags to format the message - * - * Signature of the function to use when there is an error and - * no parsing or validity context available . - */ -typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); -/** - * xmlStructuredErrorFunc: - * @userData: user provided data for the error callback - * @error: the error being raised. - * - * Signature of the function to use when there is an error and - * the module handles the new error reporting mechanism. - */ -typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); - -/* - * Use the following function to reset the two global variables - * xmlGenericError and xmlGenericErrorContext. - */ -XMLPUBFUN void XMLCALL - xmlSetGenericErrorFunc (void *ctx, - xmlGenericErrorFunc handler); -XMLPUBFUN void XMLCALL - initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); - -XMLPUBFUN void XMLCALL - xmlSetStructuredErrorFunc (void *ctx, - xmlStructuredErrorFunc handler); -/* - * Default message routines used by SAX and Valid context for error - * and warning reporting. - */ -XMLPUBFUN void XMLCDECL - xmlParserError (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); -XMLPUBFUN void XMLCDECL - xmlParserWarning (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityError (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityWarning (void *ctx, - const char *msg, - ...) ATTRIBUTE_PRINTF(2,3); -XMLPUBFUN void XMLCALL - xmlParserPrintFileInfo (xmlParserInputPtr input); -XMLPUBFUN void XMLCALL - xmlParserPrintFileContext (xmlParserInputPtr input); - -/* - * Extended error information routines - */ -XMLPUBFUN xmlErrorPtr XMLCALL - xmlGetLastError (void); -XMLPUBFUN void XMLCALL - xmlResetLastError (void); -XMLPUBFUN xmlErrorPtr XMLCALL - xmlCtxtGetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlCtxtResetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlResetError (xmlErrorPtr err); -XMLPUBFUN int XMLCALL - xmlCopyError (xmlErrorPtr from, - xmlErrorPtr to); - -#ifdef IN_LIBXML -/* - * Internal callback reporting routine - */ -XMLPUBFUN void XMLCALL - __xmlRaiseError (xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, - void *data, - void *ctx, - void *node, - int domain, - int code, - xmlErrorLevel level, - const char *file, - int line, - const char *str1, - const char *str2, - const char *str3, - int int1, - int col, - const char *msg, - ...) ATTRIBUTE_PRINTF(16,17); -XMLPUBFUN void XMLCALL - __xmlSimpleError (int domain, - int code, - xmlNodePtr node, - const char *msg, - const char *extra); -#endif -#ifdef __cplusplus -} -#endif -#endif /* __XML_ERROR_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlexports.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlexports.h deleted file mode 100644 index 29a6f54f77..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlexports.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Summary: macros for marking symbols as exportable/importable. - * Description: macros for marking symbols as exportable/importable. - * - * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatovic - */ - -#ifndef __XML_EXPORTS_H__ -#define __XML_EXPORTS_H__ - -/** - * XMLPUBFUN, XMLPUBVAR, XMLCALL - * - * Macros which declare an exportable function, an exportable variable and - * the calling convention used for functions. - * - * Please use an extra block for every platform/compiler combination when - * modifying this, rather than overlong #ifdef lines. This helps - * readability as well as the fact that different compilers on the same - * platform might need different definitions. - */ - -/** - * XMLPUBFUN: - * - * Macros which declare an exportable function - */ -#define XMLPUBFUN -/** - * XMLPUBVAR: - * - * Macros which declare an exportable variable - */ -#define XMLPUBVAR extern -/** - * XMLCALL: - * - * Macros which declare the called convention for exported functions - */ -#define XMLCALL -/** - * XMLCDECL: - * - * Macro which declares the calling convention for exported functions that - * use '...'. - */ -#define XMLCDECL - -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #if defined(LIBXML_FASTCALL) - #define XMLCALL __fastcall - #else - #define XMLCALL __cdecl - #endif - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform, GNU compiler */ -#if defined(_WIN32) && defined(__CYGWIN__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif - -/* Compatibility */ -#if !defined(LIBXML_DLL_IMPORT) -#define LIBXML_DLL_IMPORT XMLPUBVAR -#endif - -#endif /* __XML_EXPORTS_H__ */ - - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmemory.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmemory.h deleted file mode 100644 index 8f3b109151..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmemory.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Summary: interface for the memory allocator - * Description: provides interfaces for the memory allocator, - * including debugging capabilities. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __DEBUG_MEMORY_ALLOC__ -#define __DEBUG_MEMORY_ALLOC__ - -#include -#include - -/** - * DEBUG_MEMORY: - * - * DEBUG_MEMORY replaces the allocator with a collect and debug - * shell to the libc allocator. - * DEBUG_MEMORY should only be activated when debugging - * libxml i.e. if libxml has been configured with --with-debug-mem too. - */ -/* #define DEBUG_MEMORY_FREED */ -/* #define DEBUG_MEMORY_LOCATION */ - -#ifdef DEBUG -#ifndef DEBUG_MEMORY -#define DEBUG_MEMORY -#endif -#endif - -/** - * DEBUG_MEMORY_LOCATION: - * - * DEBUG_MEMORY_LOCATION should be activated only when debugging - * libxml i.e. if libxml has been configured with --with-debug-mem too. - */ -#ifdef DEBUG_MEMORY_LOCATION -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The XML memory wrapper support 4 basic overloadable functions. - */ -/** - * xmlFreeFunc: - * @mem: an already allocated block of memory - * - * Signature for a free() implementation. - */ -typedef void (XMLCALL *xmlFreeFunc)(void *mem); -/** - * xmlMallocFunc: - * @size: the size requested in bytes - * - * Signature for a malloc() implementation. - * - * Returns a pointer to the newly allocated block or NULL in case of error. - */ -typedef void *(ATTRIBUTE_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); - -/** - * xmlReallocFunc: - * @mem: an already allocated block of memory - * @size: the new size requested in bytes - * - * Signature for a realloc() implementation. - * - * Returns a pointer to the newly reallocated block or NULL in case of error. - */ -typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); - -/** - * xmlStrdupFunc: - * @str: a zero terminated string - * - * Signature for an strdup() implementation. - * - * Returns the copy of the string or NULL in case of error. - */ -typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); - -/* - * The 4 interfaces used for all memory handling within libxml. -LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree; -LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc; -LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic; -LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc; -LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup; - */ - -/* - * The way to overload the existing functions. - * The xmlGc function have an extra entry for atomic block - * allocations useful for garbage collected memory allocators - */ -XMLPUBFUN int XMLCALL - xmlMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlMallocFunc mallocAtomicFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlMallocFunc *mallocAtomicFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); - -/* - * Initialization of the memory layer. - */ -XMLPUBFUN int XMLCALL - xmlInitMemory (void); - -/* - * Cleanup of the memory layer. - */ -XMLPUBFUN void XMLCALL - xmlCleanupMemory (void); -/* - * These are specific to the XML debug memory wrapper. - */ -XMLPUBFUN int XMLCALL - xmlMemUsed (void); -XMLPUBFUN int XMLCALL - xmlMemBlocks (void); -XMLPUBFUN void XMLCALL - xmlMemDisplay (FILE *fp); -XMLPUBFUN void XMLCALL - xmlMemDisplayLast(FILE *fp, long nbBytes); -XMLPUBFUN void XMLCALL - xmlMemShow (FILE *fp, int nr); -XMLPUBFUN void XMLCALL - xmlMemoryDump (void); -XMLPUBFUN void * XMLCALL - xmlMemMalloc (size_t size) ATTRIBUTE_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlMemRealloc (void *ptr,size_t size); -XMLPUBFUN void XMLCALL - xmlMemFree (void *ptr); -XMLPUBFUN char * XMLCALL - xmlMemoryStrdup (const char *str); -XMLPUBFUN void * XMLCALL - xmlMallocLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlReallocLoc (void *ptr, size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL - xmlMallocAtomicLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1); -XMLPUBFUN char * XMLCALL - xmlMemStrdupLoc (const char *str, const char *file, int line); - - -#ifdef DEBUG_MEMORY_LOCATION -/** - * xmlMalloc: - * @size: number of bytes to allocate - * - * Wrapper for the malloc() function used in the XML library. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) -/** - * xmlMallocAtomic: - * @size: number of bytes to allocate - * - * Wrapper for the malloc() function used in the XML library for allocation - * of block not containing pointers to other areas. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) -/** - * xmlRealloc: - * @ptr: pointer to the existing allocated area - * @size: number of bytes to allocate - * - * Wrapper for the realloc() function used in the XML library. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) -/** - * xmlMemStrdup: - * @str: pointer to the existing string - * - * Wrapper for the strdup() function, xmlStrdup() is usually preferred. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) - -#endif /* DEBUG_MEMORY_LOCATION */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#ifndef __XML_GLOBALS_H -#ifndef __XML_THREADS_H__ -#include -#include -#endif -#endif - -#endif /* __DEBUG_MEMORY_ALLOC__ */ - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmodule.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmodule.h deleted file mode 100644 index 8f4a56035b..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlmodule.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Summary: dynamic module loading - * Description: basic API for dynamic module loading, used by - * libexslt added in 2.6.17 - * - * Copy: See Copyright for the status of this software. - * - * Author: Joel W. Reed - */ - -#ifndef __XML_MODULE_H__ -#define __XML_MODULE_H__ - -#include - -#ifdef LIBXML_MODULES_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlModulePtr: - * - * A handle to a dynamically loaded module - */ -typedef struct _xmlModule xmlModule; -typedef xmlModule *xmlModulePtr; - -/** - * xmlModuleOption: - * - * enumeration of options that can be passed down to xmlModuleOpen() - */ -typedef enum { - XML_MODULE_LAZY = 1, /* lazy binding */ - XML_MODULE_LOCAL= 2 /* local binding */ -} xmlModuleOption; - -XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, - int options); - -XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, - const char* name, - void **result); - -XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); - -XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_MODULES_ENABLED */ - -#endif /*__XML_MODULE_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlreader.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlreader.h deleted file mode 100644 index 696448258b..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlreader.h +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Summary: the XMLReader implementation - * Description: API of the XML streaming API based on C# interfaces. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLREADER_H__ -#define __XML_XMLREADER_H__ - -#include -#include -#include -#ifdef LIBXML_SCHEMAS_ENABLED -#include -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserSeverities: - * - * How severe an error callback is when the per-reader error callback API - * is used. - */ -typedef enum { - XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, - XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, - XML_PARSER_SEVERITY_WARNING = 3, - XML_PARSER_SEVERITY_ERROR = 4 -} xmlParserSeverities; - -#ifdef LIBXML_READER_ENABLED - -/** - * xmlTextReaderMode: - * - * Internal state values for the reader. - */ -typedef enum { - XML_TEXTREADER_MODE_INITIAL = 0, - XML_TEXTREADER_MODE_INTERACTIVE = 1, - XML_TEXTREADER_MODE_ERROR = 2, - XML_TEXTREADER_MODE_EOF =3, - XML_TEXTREADER_MODE_CLOSED = 4, - XML_TEXTREADER_MODE_READING = 5 -} xmlTextReaderMode; - -/** - * xmlParserProperties: - * - * Some common options to use with xmlTextReaderSetParserProp, but it - * is better to use xmlParserOption and the xmlReaderNewxxx and - * xmlReaderForxxx APIs now. - */ -typedef enum { - XML_PARSER_LOADDTD = 1, - XML_PARSER_DEFAULTATTRS = 2, - XML_PARSER_VALIDATE = 3, - XML_PARSER_SUBST_ENTITIES = 4 -} xmlParserProperties; - -/** - * xmlReaderTypes: - * - * Predefined constants for the different types of nodes. - */ -typedef enum { - XML_READER_TYPE_NONE = 0, - XML_READER_TYPE_ELEMENT = 1, - XML_READER_TYPE_ATTRIBUTE = 2, - XML_READER_TYPE_TEXT = 3, - XML_READER_TYPE_CDATA = 4, - XML_READER_TYPE_ENTITY_REFERENCE = 5, - XML_READER_TYPE_ENTITY = 6, - XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, - XML_READER_TYPE_COMMENT = 8, - XML_READER_TYPE_DOCUMENT = 9, - XML_READER_TYPE_DOCUMENT_TYPE = 10, - XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, - XML_READER_TYPE_NOTATION = 12, - XML_READER_TYPE_WHITESPACE = 13, - XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, - XML_READER_TYPE_END_ELEMENT = 15, - XML_READER_TYPE_END_ENTITY = 16, - XML_READER_TYPE_XML_DECLARATION = 17 -} xmlReaderTypes; - -/** - * xmlTextReader: - * - * Structure for an xmlReader context. - */ -typedef struct _xmlTextReader xmlTextReader; - -/** - * xmlTextReaderPtr: - * - * Pointer to an xmlReader context. - */ -typedef xmlTextReader *xmlTextReaderPtr; - -/* - * Constructors & Destructor - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReader (xmlParserInputBufferPtr input, - const char *URI); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReaderFilename(const char *URI); - -XMLPUBFUN void XMLCALL - xmlFreeTextReader (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderSetup(xmlTextReaderPtr reader, - xmlParserInputBufferPtr input, const char *URL, - const char *encoding, int options); - -/* - * Iterators - */ -XMLPUBFUN int XMLCALL - xmlTextReaderRead (xmlTextReaderPtr reader); - -#ifdef LIBXML_WRITER_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); -#endif - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadString (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); - -/* - * Attributes of the node - */ -XMLPUBFUN int XMLCALL - xmlTextReaderAttributeCount(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderDepth (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasAttributes(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasValue(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsDefault (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNodeType (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderQuoteChar (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadState (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); - -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstLocalName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstPrefix (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstString (xmlTextReaderPtr reader, - const xmlChar *str); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstValue (xmlTextReaderPtr reader); - -/* - * use the Const version of the routine for - * better performance and simpler code - */ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocalName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderPrefix (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderValue (xmlTextReaderPtr reader); - -/* - * Methods of the XmlTextReader - */ -XMLPUBFUN int XMLCALL - xmlTextReaderClose (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, - int no); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttribute (xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlTextReaderGetRemainder (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, - const xmlChar *prefix); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, - int no); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToElement (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNormalization (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstEncoding (xmlTextReaderPtr reader); - -/* - * Extensions - */ -XMLPUBFUN int XMLCALL - xmlTextReaderSetParserProp (xmlTextReaderPtr reader, - int prop, - int value); -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserProp (xmlTextReaderPtr reader, - int prop); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderCurrentNode (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); - -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderPreserve (xmlTextReaderPtr reader); -#ifdef LIBXML_PATTERN_ENABLED -XMLPUBFUN int XMLCALL - xmlTextReaderPreservePattern(xmlTextReaderPtr reader, - const xmlChar *pattern, - const xmlChar **namespaces); -#endif /* LIBXML_PATTERN_ENABLED */ -XMLPUBFUN xmlDocPtr XMLCALL - xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderExpand (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNext (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNextSibling (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsValid (xmlTextReaderPtr reader); -#ifdef LIBXML_SCHEMAS_ENABLED -XMLPUBFUN int XMLCALL - xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, - const char *rng); -XMLPUBFUN int XMLCALL - xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, - xmlRelaxNGPtr schema); -XMLPUBFUN int XMLCALL - xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, - const char *xsd); -XMLPUBFUN int XMLCALL - xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, - xmlSchemaValidCtxtPtr ctxt, - int options); -XMLPUBFUN int XMLCALL - xmlTextReaderSetSchema (xmlTextReaderPtr reader, - xmlSchemaPtr schema); -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderStandalone (xmlTextReaderPtr reader); - - -/* - * Index lookup - */ -XMLPUBFUN long XMLCALL - xmlTextReaderByteConsumed (xmlTextReaderPtr reader); - -/* - * New more complete APIs for simpler creation and reuse of readers - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderWalker (xmlDocPtr doc); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForDoc (const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFile (const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -XMLPUBFUN int XMLCALL - xmlReaderNewWalker (xmlTextReaderPtr reader, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlReaderNewDoc (xmlTextReaderPtr reader, - const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFile (xmlTextReaderPtr reader, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewMemory (xmlTextReaderPtr reader, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFd (xmlTextReaderPtr reader, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewIO (xmlTextReaderPtr reader, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -/* - * Error handling extensions - */ -typedef void * xmlTextReaderLocatorPtr; - -/** - * xmlTextReaderErrorFunc: - * @arg: the user argument - * @msg: the message - * @severity: the severity of the error - * @locator: a locator indicating where the error occured - * - * Signature of an error callback from a reader parser - */ -typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, - const char *msg, - xmlParserSeverities severity, - xmlTextReaderLocatorPtr locator); -XMLPUBFUN int XMLCALL - xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); -/*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); -XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg); - -#endif /* LIBXML_READER_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_XMLREADER_H__ */ - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlsave.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlsave.h deleted file mode 100644 index 4201b4d13d..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlsave.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Summary: the XML document serializer - * Description: API to save document or subtree of document - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLSAVE_H__ -#define __XML_XMLSAVE_H__ - -#include -#include -#include -#include - -#ifdef LIBXML_OUTPUT_ENABLED -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlSaveOption: - * - * This is the set of XML save options that can be passed down - * to the xmlSaveToFd() and similar calls. - */ -typedef enum { - XML_SAVE_FORMAT = 1<<0, /* format save output */ - XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ - XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ - XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ - XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ - XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ - XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */ -} xmlSaveOption; - - -typedef struct _xmlSaveCtxt xmlSaveCtxt; -typedef xmlSaveCtxt *xmlSaveCtxtPtr; - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToFd (int fd, - const char *encoding, - int options); -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToFilename (const char *filename, - const char *encoding, - int options); - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToBuffer (xmlBufferPtr buffer, - const char *encoding, - int options); - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToIO (xmlOutputWriteCallback iowrite, - xmlOutputCloseCallback ioclose, - void *ioctx, - const char *encoding, - int options); - -XMLPUBFUN long XMLCALL - xmlSaveDoc (xmlSaveCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN long XMLCALL - xmlSaveTree (xmlSaveCtxtPtr ctxt, - xmlNodePtr node); - -XMLPUBFUN int XMLCALL - xmlSaveFlush (xmlSaveCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSaveClose (xmlSaveCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, - xmlCharEncodingOutputFunc escape); -XMLPUBFUN int XMLCALL - xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, - xmlCharEncodingOutputFunc escape); -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_OUTPUT_ENABLED */ -#endif /* __XML_XMLSAVE_H__ */ - - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemas.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemas.h deleted file mode 100644 index ebef3a7b15..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemas.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Summary: incomplete XML Schemas structure implementation - * Description: interface to the XML Schemas handling and schema validity - * checking, it is incomplete right now. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_H__ -#define __XML_SCHEMA_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This error codes are obsolete; not used any more. - */ -typedef enum { - XML_SCHEMAS_ERR_OK = 0, - XML_SCHEMAS_ERR_NOROOT = 1, - XML_SCHEMAS_ERR_UNDECLAREDELEM, - XML_SCHEMAS_ERR_NOTTOPLEVEL, - XML_SCHEMAS_ERR_MISSING, - XML_SCHEMAS_ERR_WRONGELEM, - XML_SCHEMAS_ERR_NOTYPE, - XML_SCHEMAS_ERR_NOROLLBACK, - XML_SCHEMAS_ERR_ISABSTRACT, - XML_SCHEMAS_ERR_NOTEMPTY, - XML_SCHEMAS_ERR_ELEMCONT, - XML_SCHEMAS_ERR_HAVEDEFAULT, - XML_SCHEMAS_ERR_NOTNILLABLE, - XML_SCHEMAS_ERR_EXTRACONTENT, - XML_SCHEMAS_ERR_INVALIDATTR, - XML_SCHEMAS_ERR_INVALIDELEM, - XML_SCHEMAS_ERR_NOTDETERMINIST, - XML_SCHEMAS_ERR_CONSTRUCT, - XML_SCHEMAS_ERR_INTERNAL, - XML_SCHEMAS_ERR_NOTSIMPLE, - XML_SCHEMAS_ERR_ATTRUNKNOWN, - XML_SCHEMAS_ERR_ATTRINVALID, - XML_SCHEMAS_ERR_VALUE, - XML_SCHEMAS_ERR_FACET, - XML_SCHEMAS_ERR_, - XML_SCHEMAS_ERR_XXX -} xmlSchemaValidError; - -/* -* ATTENTION: Change xmlSchemaSetValidOptions's check -* for invalid values, if adding to the validation -* options below. -*/ -/** - * xmlSchemaValidOption: - * - * This is the set of XML Schema validation options. - */ -typedef enum { - XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 - /* Default/fixed: create an attribute node - * or an element's text node on the instance. - */ -} xmlSchemaValidOption; - -/* - XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, - * assemble schemata using - * xsi:schemaLocation and - * xsi:noNamespaceSchemaLocation -*/ - -/** - * The schemas related types are kept internal - */ -typedef struct _xmlSchema xmlSchema; -typedef xmlSchema *xmlSchemaPtr; - -/** - * xmlSchemaValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from an XSD validation - */ -typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3); - -/** - * xmlSchemaValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from an XSD validation - */ -typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3); - -/** - * A schemas validation context - */ -typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; -typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; - -typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; -typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewMemParserCtxt (const char *buffer, - int size); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewDocParserCtxt (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -XMLPUBFUN void XMLCALL - xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc * err, - xmlSchemaValidityWarningFunc * warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); - -XMLPUBFUN xmlSchemaPtr XMLCALL - xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchemaFree (xmlSchemaPtr schema); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlSchemaDump (FILE *output, - xmlSchemaPtr schema); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -XMLPUBFUN void XMLCALL - xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc *err, - xmlSchemaValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, - int options); -XMLPUBFUN int XMLCALL - xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); - -XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL - xmlSchemaNewValidCtxt (xmlSchemaPtr schema); -XMLPUBFUN void XMLCALL - xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, - xmlDocPtr instance); -XMLPUBFUN int XMLCALL - xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc, - xmlSAXHandlerPtr sax, - void *user_data); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, - const char * filename, - int options); - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); - -/* - * Interface to insert Schemas SAX validation in a SAX stream - */ -typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; -typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; - -XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL - xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, - xmlSAXHandlerPtr *sax, - void **user_data); -XMLPUBFUN int XMLCALL - xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemastypes.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemastypes.h deleted file mode 100644 index 9a3a7a175e..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlschemastypes.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Summary: implementation of XML Schema Datatypes - * Description: module providing the XML Schema Datatypes implementation - * both definition and validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_TYPES_H__ -#define __XML_SCHEMA_TYPES_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMA_WHITESPACE_UNKNOWN = 0, - XML_SCHEMA_WHITESPACE_PRESERVE = 1, - XML_SCHEMA_WHITESPACE_REPLACE = 2, - XML_SCHEMA_WHITESPACE_COLLAPSE = 3 -} xmlSchemaWhitespaceValueType; - -XMLPUBFUN void XMLCALL - xmlSchemaInitTypes (void); -XMLPUBFUN void XMLCALL - xmlSchemaCleanupTypes (void); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetPredefinedType (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacet (xmlSchemaTypePtr base, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, - xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN void XMLCALL - xmlSchemaFreeValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaFacetPtr XMLCALL - xmlSchemaNewFacet (void); -XMLPUBFUN int XMLCALL - xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, - xmlSchemaTypePtr typeDecl, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValues (xmlSchemaValPtr x, - xmlSchemaValPtr y); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); -XMLPUBFUN int XMLCALL - xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, - const xmlChar *value, - unsigned long actualLen, - unsigned long *expectedLen); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInType (xmlSchemaValType type); -XMLPUBFUN int XMLCALL - xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, - int facetType); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaCollapseString (const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaWhiteSpaceReplace (const xmlChar *value); -XMLPUBFUN unsigned long XMLCALL - xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValue (xmlSchemaValPtr val, - const xmlChar **retValue); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, - const xmlChar **retValue, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValueAppend (xmlSchemaValPtr prev, - xmlSchemaValPtr cur); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaValueGetNext (xmlSchemaValPtr cur); -XMLPUBFUN const xmlChar * XMLCALL - xmlSchemaValueGetAsString (xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewStringValue (xmlSchemaValType type, - const xmlChar *value); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewNOTATIONValue (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewQNameValue (const xmlChar *namespaceName, - const xmlChar *localName); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, - xmlSchemaWhitespaceValueType xws, - xmlSchemaValPtr y, - xmlSchemaWhitespaceValueType yws); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaCopyValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValType XMLCALL - xmlSchemaGetValType (xmlSchemaValPtr val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlstring.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlstring.h deleted file mode 100644 index 1dfc5ea091..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlstring.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Summary: set of routines to process strings - * Description: type and interfaces needed for the internal string handling - * of the library, especially UTF8 processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_STRING_H__ -#define __XML_STRING_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlChar: - * - * This is a basic byte in an UTF-8 encoded string. - * It's unsigned allowing to pinpoint case where char * are assigned - * to xmlChar * (possibly making serialization back impossible). - */ -typedef unsigned char xmlChar; - -/** - * BAD_CAST: - * - * Macro to cast a string to an xmlChar * when one know its safe. - */ -#define BAD_CAST (xmlChar *) - -/* - * xmlChar handling - */ -XMLPUBFUN xmlChar * XMLCALL - xmlStrdup (const xmlChar *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrndup (const xmlChar *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrndup (const char *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrdup (const char *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrsub (const xmlChar *str, - int start, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrchr (const xmlChar *str, - xmlChar val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrstr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrcasestr (const xmlChar *str, - xmlChar *val); -XMLPUBFUN int XMLCALL - xmlStrcmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrcasecmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncasecmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrEqual (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrQEqual (const xmlChar *pref, - const xmlChar *name, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlStrlen (const xmlChar *str); -XMLPUBFUN xmlChar * XMLCALL - xmlStrcat (xmlChar *cur, - const xmlChar *add); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncat (xmlChar *cur, - const xmlChar *add, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncatNew (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - ...); -XMLPUBFUN int XMLCALL - xmlStrVPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - va_list ap); - -XMLPUBFUN int XMLCALL - xmlGetUTF8Char (const unsigned char *utf, - int *len); -XMLPUBFUN int XMLCALL - xmlCheckUTF8 (const unsigned char *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Strsize (const xmlChar *utf, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strndup (const xmlChar *utf, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlUTF8Strpos (const xmlChar *utf, - int pos); -XMLPUBFUN int XMLCALL - xmlUTF8Strloc (const xmlChar *utf, - const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strsub (const xmlChar *utf, - int start, - int len); -XMLPUBFUN int XMLCALL - xmlUTF8Strlen (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Size (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Charcmp (const xmlChar *utf1, - const xmlChar *utf2); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_STRING_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlversion.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlversion.h deleted file mode 100644 index a98e00c27e..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlversion.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_VERSION_H__ -#define __XML_VERSION_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * use those to be sure nothing nasty will happen if - * your library and includes mismatch - */ -#ifndef LIBXML2_COMPILING_MSCCDEF -XMLPUBFUN void XMLCALL xmlCheckVersion(int version); -#endif /* LIBXML2_COMPILING_MSCCDEF */ - -/** - * LIBXML_DOTTED_VERSION: - * - * the version string like "1.2.3" - */ -#define LIBXML_DOTTED_VERSION "2.7.3" - -/** - * LIBXML_VERSION: - * - * the version number: 1.2.3 value is 10203 - */ -#define LIBXML_VERSION 20703 - -/** - * LIBXML_VERSION_STRING: - * - * the version number string, 1.2.3 value is "10203" - */ -#define LIBXML_VERSION_STRING "20703" - -/** - * LIBXML_VERSION_EXTRA: - * - * extra version information, used to show a CVS compilation - */ -#define LIBXML_VERSION_EXTRA "" - -/** - * LIBXML_TEST_VERSION: - * - * Macro to check that the libxml version in use is compatible with - * the version the software has been compiled against - */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20703); - -#ifndef VMS -#if 0 -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO -#else -/** - * WITHOUT_TRIO: - * - * defined if the trio support should not be configured in - */ -#define WITHOUT_TRIO -#endif -#else /* VMS */ -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO 1 -#endif /* VMS */ - -/** - * LIBXML_THREAD_ENABLED: - * - * Whether the thread support is configured in - */ -#if 0 -#if defined(_REENTRANT) || defined(__MT__) || \ - (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) -#define LIBXML_THREAD_ENABLED -#endif -#endif - -/** - * LIBXML_TREE_ENABLED: - * - * Whether the DOM like tree manipulation API support is configured in - */ -#if 0 -#define LIBXML_TREE_ENABLED -#endif - -/** - * LIBXML_OUTPUT_ENABLED: - * - * Whether the serialization/saving support is configured in - */ -#if 1 -#define LIBXML_OUTPUT_ENABLED -#endif - -/** - * LIBXML_PUSH_ENABLED: - * - * Whether the push parsing interfaces are configured in - */ -#if 1 -#define LIBXML_PUSH_ENABLED -#endif - -/** - * LIBXML_READER_ENABLED: - * - * Whether the xmlReader parsing interface is configured in - */ -#if 1 -#define LIBXML_READER_ENABLED -#endif - -/** - * LIBXML_PATTERN_ENABLED: - * - * Whether the xmlPattern node selection interface is configured in - */ -#if 0 -#define LIBXML_PATTERN_ENABLED -#endif - -/** - * LIBXML_WRITER_ENABLED: - * - * Whether the xmlWriter saving interface is configured in - */ -#if 1 -#define LIBXML_WRITER_ENABLED -#endif - -/** - * LIBXML_SAX1_ENABLED: - * - * Whether the older SAX1 interface is configured in - */ -#if 1 -#define LIBXML_SAX1_ENABLED -#endif - -/** - * LIBXML_FTP_ENABLED: - * - * Whether the FTP support is configured in - */ -#if 0 -#define LIBXML_FTP_ENABLED -#endif - -/** - * LIBXML_HTTP_ENABLED: - * - * Whether the HTTP support is configured in - */ -#if 0 -#define LIBXML_HTTP_ENABLED -#endif - -/** - * LIBXML_VALID_ENABLED: - * - * Whether the DTD validation support is configured in - */ -#if 0 -#define LIBXML_VALID_ENABLED -#endif - -/** - * LIBXML_HTML_ENABLED: - * - * Whether the HTML support is configured in - */ -#if 1 -#define LIBXML_HTML_ENABLED -#endif - -/** - * LIBXML_LEGACY_ENABLED: - * - * Whether the deprecated APIs are compiled in for compatibility - */ -#if 0 -#define LIBXML_LEGACY_ENABLED -#endif - -/** - * LIBXML_C14N_ENABLED: - * - * Whether the Canonicalization support is configured in - */ -#if 0 -#define LIBXML_C14N_ENABLED -#endif - -/** - * LIBXML_CATALOG_ENABLED: - * - * Whether the Catalog support is configured in - */ -#if 0 -#define LIBXML_CATALOG_ENABLED -#endif - -/** - * LIBXML_DOCB_ENABLED: - * - * Whether the SGML Docbook support is configured in - */ -#if 0 -#define LIBXML_DOCB_ENABLED -#endif - -/** - * LIBXML_XPATH_ENABLED: - * - * Whether XPath is configured in - */ -#if 0 -#define LIBXML_XPATH_ENABLED -#endif - -/** - * LIBXML_XPTR_ENABLED: - * - * Whether XPointer is configured in - */ -#if 0 -#define LIBXML_XPTR_ENABLED -#endif - -/** - * LIBXML_XINCLUDE_ENABLED: - * - * Whether XInclude is configured in - */ -#if 0 -#define LIBXML_XINCLUDE_ENABLED -#endif - -/** - * LIBXML_ICONV_ENABLED: - * - * Whether iconv support is available - */ -#if 0 -#define LIBXML_ICONV_ENABLED -#endif - -/** - * LIBXML_ISO8859X_ENABLED: - * - * Whether ISO-8859-* support is made available in case iconv is not - */ -#if 1 -#define LIBXML_ISO8859X_ENABLED -#endif - -/** - * LIBXML_DEBUG_ENABLED: - * - * Whether Debugging module is configured in - */ -#if 0 -#define LIBXML_DEBUG_ENABLED -#endif - -/** - * DEBUG_MEMORY_LOCATION: - * - * Whether the memory debugging is configured in - */ -#if 0 -#define DEBUG_MEMORY_LOCATION -#endif - -/** - * LIBXML_DEBUG_RUNTIME: - * - * Whether the runtime debugging is configured in - */ -#if 0 -#define LIBXML_DEBUG_RUNTIME -#endif - -/** - * LIBXML_UNICODE_ENABLED: - * - * Whether the Unicode related interfaces are compiled in - */ -#if 0 -#define LIBXML_UNICODE_ENABLED -#endif - -/** - * LIBXML_REGEXP_ENABLED: - * - * Whether the regular expressions interfaces are compiled in - */ -#if 0 -#define LIBXML_REGEXP_ENABLED -#endif - -/** - * LIBXML_AUTOMATA_ENABLED: - * - * Whether the automata interfaces are compiled in - */ -#if 0 -#define LIBXML_AUTOMATA_ENABLED -#endif - -/** - * LIBXML_EXPR_ENABLED: - * - * Whether the formal expressions interfaces are compiled in - */ -#if 0 -#define LIBXML_EXPR_ENABLED -#endif - -/** - * LIBXML_SCHEMAS_ENABLED: - * - * Whether the Schemas validation interfaces are compiled in - */ -#if 0 -#define LIBXML_SCHEMAS_ENABLED -#endif - -/** - * LIBXML_SCHEMATRON_ENABLED: - * - * Whether the Schematron validation interfaces are compiled in - */ -#if 0 -#define LIBXML_SCHEMATRON_ENABLED -#endif - -/** - * LIBXML_MODULES_ENABLED: - * - * Whether the module interfaces are compiled in - */ -#if 0 -#define LIBXML_MODULES_ENABLED -/** - * LIBXML_MODULE_EXTENSION: - * - * the string suffix used by dynamic modules (usually shared libraries) - */ -#define LIBXML_MODULE_EXTENSION "" -#endif - -/** - * LIBXML_ZLIB_ENABLED: - * - * Whether the Zlib support is compiled in - */ -#if 0 -#define LIBXML_ZLIB_ENABLED -#endif - -#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include -#endif - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ - -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -/** - * ATTRIBUTE_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - -#ifndef ATTRIBUTE_ALLOC_SIZE -# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) -# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x))) -# else -# define ATTRIBUTE_ALLOC_SIZE(x) -# endif -#else -# define ATTRIBUTE_ALLOC_SIZE(x) -#endif - -/** - * ATTRIBUTE_PRINTF: - * - * Macro used to indicate to GCC the parameter are printf like - */ - -#ifndef ATTRIBUTE_PRINTF -# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) -# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args))) -# else -# define ATTRIBUTE_PRINTF(fmt,args) -# endif -#else -# define ATTRIBUTE_PRINTF(fmt,args) -#endif - -#else /* ! __GNUC__ */ -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ -#define ATTRIBUTE_UNUSED -/** - * ATTRIBUTE_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ -#define ATTRIBUTE_ALLOC_SIZE(x) -/** - * ATTRIBUTE_PRINTF: - * - * Macro used to indicate to GCC the parameter are printf like - */ -#define ATTRIBUTE_PRINTF(fmt,args) -#endif /* __GNUC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif - - diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlwriter.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlwriter.h deleted file mode 100644 index df4509dac4..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlwriter.h +++ /dev/null @@ -1,485 +0,0 @@ - -/* - * Summary: text writing API for XML - * Description: text writing API for XML - * - * Copy: See Copyright for the status of this software. - * - * Author: Alfred Mickautsch - */ - -#ifndef __XML_XMLWRITER_H__ -#define __XML_XMLWRITER_H__ - -#include - -#ifdef LIBXML_WRITER_ENABLED - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct _xmlTextWriter xmlTextWriter; - typedef xmlTextWriter *xmlTextWriterPtr; - -/* - * Constructors & Destructor - */ - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriter(xmlOutputBufferPtr out); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterFilename(const char *uri, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, - int compression); - XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); - -/* - * Functions - */ - - -/* - * Document - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDocument(xmlTextWriterPtr writer, - const char *version, - const char *encoding, - const char *standalone); - XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr - writer); - -/* - * Comments - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr - writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, - const char *format, ...) - ATTRIBUTE_PRINTF(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr - writer, - const xmlChar * - content); - -/* - * Elements - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr - writer); - -/* - * Elements conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - ATTRIBUTE_PRINTF(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - ATTRIBUTE_PRINTF(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * Text - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, - const char *format, ...) - ATTRIBUTE_PRINTF(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, - const char *format, va_list argptr) - ATTRIBUTE_PRINTF(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, - const xmlChar * content, int len); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRaw(xmlTextWriterPtr writer, - const xmlChar * content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr - writer, - const char - *format, ...) - ATTRIBUTE_PRINTF(2,3); - XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr - writer, - const char - *format, - va_list argptr) - ATTRIBUTE_PRINTF(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, - const xmlChar * - content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, - const char *data, - int start, int len); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, - const char *data, - int start, int len); - -/* - * Attributes - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartAttribute(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr - writer); - -/* - * Attributes conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - ATTRIBUTE_PRINTF(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - ATTRIBUTE_PRINTF(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * PI's - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartPI(xmlTextWriterPtr writer, - const xmlChar * target); - XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); - -/* - * PI conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, ...) - ATTRIBUTE_PRINTF(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, va_list argptr) - ATTRIBUTE_PRINTF(3,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWritePI(xmlTextWriterPtr writer, - const xmlChar * target, - const xmlChar * content); - -/** - * xmlTextWriterWriteProcessingInstruction: - * - * This macro maps to xmlTextWriterWritePI - */ -#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI - -/* - * CDATA - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); - -/* - * CDATA conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, - const char *format, ...) - ATTRIBUTE_PRINTF(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, - const char *format, va_list argptr) - ATTRIBUTE_PRINTF(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, - const xmlChar * content); - -/* - * DTD - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); - -/* - * DTD conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, ...) - ATTRIBUTE_PRINTF(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, va_list argptr) - ATTRIBUTE_PRINTF(5,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * subset); - -/** - * xmlTextWriterWriteDocType: - * - * this macro maps to xmlTextWriterWriteDTD - */ -#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD - -/* - * DTD element definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr - writer); - -/* - * DTD element definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - ATTRIBUTE_PRINTF(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD attribute list definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr - writer); - -/* - * DTD attribute list definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - ATTRIBUTE_PRINTF(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD entity definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, - int pe, const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr - writer); - -/* - * DTD entity definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, ...) - ATTRIBUTE_PRINTF(4,5); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, - va_list argptr) - ATTRIBUTE_PRINTF(4,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * ndataid); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr - writer, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * - ndataid); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr - writer, int pe, - const xmlChar * name, - const xmlChar * - pubid, - const xmlChar * - sysid, - const xmlChar * - ndataid, - const xmlChar * - content); - -/* - * DTD notation definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - -/* - * Indentation - */ - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndentString(xmlTextWriterPtr writer, - const xmlChar * str); - -/* - * misc - */ - XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_WRITER_ENABLED */ - -#endif /* __XML_XMLWRITER_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpath.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpath.h deleted file mode 100644 index 1a9e30eba1..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpath.h +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Summary: XML Path Language implementation - * Description: API for the XML Path Language implementation - * - * XML Path Language implementation - * XPath is a language for addressing parts of an XML document, - * designed to be used by both XSLT and XPointer - * http://www.w3.org/TR/xpath - * - * Implements - * W3C Recommendation 16 November 1999 - * http://www.w3.org/TR/1999/REC-xpath-19991116 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPATH_H__ -#define __XML_XPATH_H__ - -#include - -#ifdef LIBXML_XPATH_ENABLED - -#include -#include -#include -#endif /* LIBXML_XPATH_ENABLED */ - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef __cplusplus -extern "C" { -#endif -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -#ifdef LIBXML_XPATH_ENABLED - -typedef struct _xmlXPathContext xmlXPathContext; -typedef xmlXPathContext *xmlXPathContextPtr; -typedef struct _xmlXPathParserContext xmlXPathParserContext; -typedef xmlXPathParserContext *xmlXPathParserContextPtr; - -/** - * The set of XPath error codes. - */ - -typedef enum { - XPATH_EXPRESSION_OK = 0, - XPATH_NUMBER_ERROR, - XPATH_UNFINISHED_LITERAL_ERROR, - XPATH_START_LITERAL_ERROR, - XPATH_VARIABLE_REF_ERROR, - XPATH_UNDEF_VARIABLE_ERROR, - XPATH_INVALID_PREDICATE_ERROR, - XPATH_EXPR_ERROR, - XPATH_UNCLOSED_ERROR, - XPATH_UNKNOWN_FUNC_ERROR, - XPATH_INVALID_OPERAND, - XPATH_INVALID_TYPE, - XPATH_INVALID_ARITY, - XPATH_INVALID_CTXT_SIZE, - XPATH_INVALID_CTXT_POSITION, - XPATH_MEMORY_ERROR, - XPTR_SYNTAX_ERROR, - XPTR_RESOURCE_ERROR, - XPTR_SUB_RESOURCE_ERROR, - XPATH_UNDEF_PREFIX_ERROR, - XPATH_ENCODING_ERROR, - XPATH_INVALID_CHAR_ERROR, - XPATH_INVALID_CTXT -} xmlXPathError; - -/* - * A node-set (an unordered collection of nodes without duplicates). - */ -typedef struct _xmlNodeSet xmlNodeSet; -typedef xmlNodeSet *xmlNodeSetPtr; -struct _xmlNodeSet { - int nodeNr; /* number of nodes in the set */ - int nodeMax; /* size of the array as allocated */ - xmlNodePtr *nodeTab; /* array of nodes in no particular order */ - /* @@ with_ns to check wether namespace nodes should be looked at @@ */ -}; - -/* - * An expression is evaluated to yield an object, which - * has one of the following four basic types: - * - node-set - * - boolean - * - number - * - string - * - * @@ XPointer will add more types ! - */ - -typedef enum { - XPATH_UNDEFINED = 0, - XPATH_NODESET = 1, - XPATH_BOOLEAN = 2, - XPATH_NUMBER = 3, - XPATH_STRING = 4, - XPATH_POINT = 5, - XPATH_RANGE = 6, - XPATH_LOCATIONSET = 7, - XPATH_USERS = 8, - XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ -} xmlXPathObjectType; - -typedef struct _xmlXPathObject xmlXPathObject; -typedef xmlXPathObject *xmlXPathObjectPtr; -struct _xmlXPathObject { - xmlXPathObjectType type; - xmlNodeSetPtr nodesetval; - int boolval; - double floatval; - xmlChar *stringval; - void *user; - int index; - void *user2; - int index2; -}; - -/** - * xmlXPathConvertFunc: - * @obj: an XPath object - * @type: the number of the target type - * - * A conversion function is associated to a type and used to cast - * the new type to primitive values. - * - * Returns -1 in case of error, 0 otherwise - */ -typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); - -/* - * Extra type: a name and a conversion function. - */ - -typedef struct _xmlXPathType xmlXPathType; -typedef xmlXPathType *xmlXPathTypePtr; -struct _xmlXPathType { - const xmlChar *name; /* the type name */ - xmlXPathConvertFunc func; /* the conversion function */ -}; - -/* - * Extra variable: a name and a value. - */ - -typedef struct _xmlXPathVariable xmlXPathVariable; -typedef xmlXPathVariable *xmlXPathVariablePtr; -struct _xmlXPathVariable { - const xmlChar *name; /* the variable name */ - xmlXPathObjectPtr value; /* the value */ -}; - -/** - * xmlXPathEvalFunc: - * @ctxt: an XPath parser context - * @nargs: the number of arguments passed to the function - * - * An XPath evaluation function, the parameters are on the XPath context stack. - */ - -typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, - int nargs); - -/* - * Extra function: a name and a evaluation function. - */ - -typedef struct _xmlXPathFunct xmlXPathFunct; -typedef xmlXPathFunct *xmlXPathFuncPtr; -struct _xmlXPathFunct { - const xmlChar *name; /* the function name */ - xmlXPathEvalFunc func; /* the evaluation function */ -}; - -/** - * xmlXPathAxisFunc: - * @ctxt: the XPath interpreter context - * @cur: the previous node being explored on that axis - * - * An axis traversal function. To traverse an axis, the engine calls - * the first time with cur == NULL and repeat until the function returns - * NULL indicating the end of the axis traversal. - * - * Returns the next node in that axis or NULL if at the end of the axis. - */ - -typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr cur); - -/* - * Extra axis: a name and an axis function. - */ - -typedef struct _xmlXPathAxis xmlXPathAxis; -typedef xmlXPathAxis *xmlXPathAxisPtr; -struct _xmlXPathAxis { - const xmlChar *name; /* the axis name */ - xmlXPathAxisFunc func; /* the search function */ -}; - -/** - * xmlXPathFunction: - * @ctxt: the XPath interprestation context - * @nargs: the number of arguments - * - * An XPath function. - * The arguments (if any) are popped out from the context stack - * and the result is pushed on the stack. - */ - -typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); - -/* - * Function and Variable Lookup. - */ - -/** - * xmlXPathVariableLookupFunc: - * @ctxt: an XPath context - * @name: name of the variable - * @ns_uri: the namespace name hosting this variable - * - * Prototype for callbacks used to plug variable lookup in the XPath - * engine. - * - * Returns the XPath object value or NULL if not found. - */ -typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFuncLookupFunc: - * @ctxt: an XPath context - * @name: name of the function - * @ns_uri: the namespace name hosting this function - * - * Prototype for callbacks used to plug function lookup in the XPath - * engine. - * - * Returns the XPath function or NULL if not found. - */ -typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFlags: - * Flags for XPath engine compilation and runtime - */ -/** - * XML_XPATH_CHECKNS: - * - * check namespaces at compilation - */ -#define XML_XPATH_CHECKNS (1<<0) -/** - * XML_XPATH_NOVAR: - * - * forbid variables in expression - */ -#define XML_XPATH_NOVAR (1<<1) - -/** - * xmlXPathContext: - * - * Expression evaluation occurs with respect to a context. - * he context consists of: - * - a node (the context node) - * - a node list (the context node list) - * - a set of variable bindings - * - a function library - * - the set of namespace declarations in scope for the expression - * Following the switch to hash tables, this need to be trimmed up at - * the next binary incompatible release. - * The node may be modified when the context is passed to libxml2 - * for an XPath evaluation so you may need to initialize it again - * before the next call. - */ - -struct _xmlXPathContext { - xmlDocPtr doc; /* The current document */ - xmlNodePtr node; /* The current node */ - - int nb_variables_unused; /* unused (hash table) */ - int max_variables_unused; /* unused (hash table) */ - xmlHashTablePtr varHash; /* Hash table of defined variables */ - - int nb_types; /* number of defined types */ - int max_types; /* max number of types */ - xmlXPathTypePtr types; /* Array of defined types */ - - int nb_funcs_unused; /* unused (hash table) */ - int max_funcs_unused; /* unused (hash table) */ - xmlHashTablePtr funcHash; /* Hash table of defined funcs */ - - int nb_axis; /* number of defined axis */ - int max_axis; /* max number of axis */ - xmlXPathAxisPtr axis; /* Array of defined axis */ - - /* the namespace nodes of the context node */ - xmlNsPtr *namespaces; /* Array of namespaces */ - int nsNr; /* number of namespace in scope */ - void *user; /* function to free */ - - /* extra variables */ - int contextSize; /* the context size */ - int proximityPosition; /* the proximity position */ - - /* extra stuff for XPointer */ - int xptr; /* is this an XPointer context? */ - xmlNodePtr here; /* for here() */ - xmlNodePtr origin; /* for origin() */ - - /* the set of namespace declarations in scope for the expression */ - xmlHashTablePtr nsHash; /* The namespaces hash table */ - xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ - void *varLookupData; /* variable lookup data */ - - /* Possibility to link in an extra item */ - void *extra; /* needed for XSLT */ - - /* The function name and URI when calling a function */ - const xmlChar *function; - const xmlChar *functionURI; - - /* function lookup function and data */ - xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ - void *funcLookupData; /* function lookup data */ - - /* temporary namespace lists kept for walking the namespace axis */ - xmlNsPtr *tmpNsList; /* Array of namespaces */ - int tmpNsNr; /* number of namespaces in scope */ - - /* error reporting mechanism */ - void *userData; /* user specific data block */ - xmlStructuredErrorFunc error; /* the callback in case of errors */ - xmlError lastError; /* the last error */ - xmlNodePtr debugNode; /* the source node XSLT */ - - /* dictionary */ - xmlDictPtr dict; /* dictionary if any */ - - int flags; /* flags to control compilation */ - - /* Cache for reusal of XPath objects */ - void *cache; -}; - -/* - * The structure of a compiled expression form is not public. - */ - -typedef struct _xmlXPathCompExpr xmlXPathCompExpr; -typedef xmlXPathCompExpr *xmlXPathCompExprPtr; - -/** - * xmlXPathParserContext: - * - * An XPath parser context. It contains pure parsing informations, - * an xmlXPathContext, and the stack of objects. - */ -struct _xmlXPathParserContext { - const xmlChar *cur; /* the current char being parsed */ - const xmlChar *base; /* the full expression */ - - int error; /* error code */ - - xmlXPathContextPtr context; /* the evaluation context */ - xmlXPathObjectPtr value; /* the current value */ - int valueNr; /* number of values stacked */ - int valueMax; /* max number of values stacked */ - xmlXPathObjectPtr *valueTab; /* stack of values */ - - xmlXPathCompExprPtr comp; /* the precompiled expression */ - int xptr; /* it this an XPointer expression */ - xmlNodePtr ancestor; /* used for walking preceding axis */ -}; - -/************************************************************************ - * * - * Public API * - * * - ************************************************************************/ - -/** - * Objects and Nodesets handling - */ - -XMLPUBVAR double xmlXPathNAN; -XMLPUBVAR double xmlXPathPINF; -XMLPUBVAR double xmlXPathNINF; - -/* These macros may later turn into functions */ -/** - * xmlXPathNodeSetGetLength: - * @ns: a node-set - * - * Implement a functionality similar to the DOM NodeList.length. - * - * Returns the number of nodes in the node-set. - */ -#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) -/** - * xmlXPathNodeSetItem: - * @ns: a node-set - * @index: index of a node in the set - * - * Implements a functionality similar to the DOM NodeList.item(). - * - * Returns the xmlNodePtr at the given @index in @ns or NULL if - * @index is out of range (0 to length-1) - */ -#define xmlXPathNodeSetItem(ns, index) \ - ((((ns) != NULL) && \ - ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ - (ns)->nodeTab[(index)] \ - : NULL) -/** - * xmlXPathNodeSetIsEmpty: - * @ns: a node-set - * - * Checks whether @ns is empty or not. - * - * Returns %TRUE if @ns is an empty node-set. - */ -#define xmlXPathNodeSetIsEmpty(ns) \ - (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) - - -XMLPUBFUN void XMLCALL - xmlXPathFreeObject (xmlXPathObjectPtr obj); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetCreate (xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSet (xmlNodeSetPtr obj); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathObjectCopy (xmlXPathObjectPtr val); -XMLPUBFUN int XMLCALL - xmlXPathCmpNodes (xmlNodePtr node1, - xmlNodePtr node2); -/** - * Conversion functions to basic types. - */ -XMLPUBFUN int XMLCALL - xmlXPathCastNumberToBoolean (double val); -XMLPUBFUN int XMLCALL - xmlXPathCastStringToBoolean (const xmlChar * val); -XMLPUBFUN int XMLCALL - xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); -XMLPUBFUN int XMLCALL - xmlXPathCastToBoolean (xmlXPathObjectPtr val); - -XMLPUBFUN double XMLCALL - xmlXPathCastBooleanToNumber (int val); -XMLPUBFUN double XMLCALL - xmlXPathCastStringToNumber (const xmlChar * val); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeToNumber (xmlNodePtr node); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); -XMLPUBFUN double XMLCALL - xmlXPathCastToNumber (xmlXPathObjectPtr val); - -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastBooleanToString (int val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNumberToString (double val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeToString (xmlNodePtr node); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastToString (xmlXPathObjectPtr val); - -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertBoolean (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertString (xmlXPathObjectPtr val); - -/** - * Context handling. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPathNewContext (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlXPathFreeContext (xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathContextSetCache(xmlXPathContextPtr ctxt, - int active, - int value, - int options); -/** - * Evaluation functions. - */ -XMLPUBFUN long XMLCALL - xmlXPathOrderDocElems (xmlDocPtr doc); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEvalExpression (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, - xmlXPathObjectPtr res); -/** - * Separate compilation/evaluation entry points. - */ -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCompile (const xmlChar *str); -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, - const xmlChar *str); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathCompiledEval (xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctx); -XMLPUBFUN int XMLCALL - xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); -#endif /* LIBXML_XPATH_ENABLED */ -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN void XMLCALL - xmlXPathInit (void); -XMLPUBFUN int XMLCALL - xmlXPathIsNaN (double val); -XMLPUBFUN int XMLCALL - xmlXPathIsInf (double val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ -#endif /* ! __XML_XPATH_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpathInternals.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpathInternals.h deleted file mode 100644 index dcd524343e..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpathInternals.h +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Summary: internal interfaces for XML Path Language implementation - * Description: internal interfaces for XML Path Language implementation - * used to build new modules on top of XPath like XPointer and - * XSLT - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPATH_INTERNALS_H__ -#define __XML_XPATH_INTERNALS_H__ - -#include -#include - -#ifdef LIBXML_XPATH_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/************************************************************************ - * * - * Helpers * - * * - ************************************************************************/ - -/* - * Many of these macros may later turn into functions. They - * shouldn't be used in #ifdef's preprocessor instructions. - */ -/** - * xmlXPathSetError: - * @ctxt: an XPath parser context - * @err: an xmlXPathError code - * - * Raises an error. - */ -#define xmlXPathSetError(ctxt, err) \ - { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ - if ((ctxt) != NULL) (ctxt)->error = (err); } - -/** - * xmlXPathSetArityError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_ARITY error. - */ -#define xmlXPathSetArityError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) - -/** - * xmlXPathSetTypeError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_TYPE error. - */ -#define xmlXPathSetTypeError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) - -/** - * xmlXPathGetError: - * @ctxt: an XPath parser context - * - * Get the error code of an XPath context. - * - * Returns the context error. - */ -#define xmlXPathGetError(ctxt) ((ctxt)->error) - -/** - * xmlXPathCheckError: - * @ctxt: an XPath parser context - * - * Check if an XPath error was raised. - * - * Returns true if an error has been raised, false otherwise. - */ -#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) - -/** - * xmlXPathGetDocument: - * @ctxt: an XPath parser context - * - * Get the document of an XPath context. - * - * Returns the context document. - */ -#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) - -/** - * xmlXPathGetContextNode: - * @ctxt: an XPath parser context - * - * Get the context node of an XPath context. - * - * Returns the context node. - */ -#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) - -XMLPUBFUN int XMLCALL - xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); -XMLPUBFUN double XMLCALL - xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathPopString (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void * XMLCALL - xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); - -/** - * xmlXPathReturnBoolean: - * @ctxt: an XPath parser context - * @val: a boolean - * - * Pushes the boolean @val on the context stack. - */ -#define xmlXPathReturnBoolean(ctxt, val) \ - valuePush((ctxt), xmlXPathNewBoolean(val)) - -/** - * xmlXPathReturnTrue: - * @ctxt: an XPath parser context - * - * Pushes true on the context stack. - */ -#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) - -/** - * xmlXPathReturnFalse: - * @ctxt: an XPath parser context - * - * Pushes false on the context stack. - */ -#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) - -/** - * xmlXPathReturnNumber: - * @ctxt: an XPath parser context - * @val: a double - * - * Pushes the double @val on the context stack. - */ -#define xmlXPathReturnNumber(ctxt, val) \ - valuePush((ctxt), xmlXPathNewFloat(val)) - -/** - * xmlXPathReturnString: - * @ctxt: an XPath parser context - * @str: a string - * - * Pushes the string @str on the context stack. - */ -#define xmlXPathReturnString(ctxt, str) \ - valuePush((ctxt), xmlXPathWrapString(str)) - -/** - * xmlXPathReturnEmptyString: - * @ctxt: an XPath parser context - * - * Pushes an empty string on the stack. - */ -#define xmlXPathReturnEmptyString(ctxt) \ - valuePush((ctxt), xmlXPathNewCString("")) - -/** - * xmlXPathReturnNodeSet: - * @ctxt: an XPath parser context - * @ns: a node-set - * - * Pushes the node-set @ns on the context stack. - */ -#define xmlXPathReturnNodeSet(ctxt, ns) \ - valuePush((ctxt), xmlXPathWrapNodeSet(ns)) - -/** - * xmlXPathReturnEmptyNodeSet: - * @ctxt: an XPath parser context - * - * Pushes an empty node-set on the context stack. - */ -#define xmlXPathReturnEmptyNodeSet(ctxt) \ - valuePush((ctxt), xmlXPathNewNodeSet(NULL)) - -/** - * xmlXPathReturnExternal: - * @ctxt: an XPath parser context - * @val: user data - * - * Pushes user data on the context stack. - */ -#define xmlXPathReturnExternal(ctxt, val) \ - valuePush((ctxt), xmlXPathWrapExternal(val)) - -/** - * xmlXPathStackIsNodeSet: - * @ctxt: an XPath parser context - * - * Check if the current value on the XPath stack is a node set or - * an XSLT value tree. - * - * Returns true if the current object on the stack is a node-set. - */ -#define xmlXPathStackIsNodeSet(ctxt) \ - (((ctxt)->value != NULL) \ - && (((ctxt)->value->type == XPATH_NODESET) \ - || ((ctxt)->value->type == XPATH_XSLT_TREE))) - -/** - * xmlXPathStackIsExternal: - * @ctxt: an XPath parser context - * - * Checks if the current value on the XPath stack is an external - * object. - * - * Returns true if the current object on the stack is an external - * object. - */ -#define xmlXPathStackIsExternal(ctxt) \ - ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) - -/** - * xmlXPathEmptyNodeSet: - * @ns: a node-set - * - * Empties a node-set. - */ -#define xmlXPathEmptyNodeSet(ns) \ - { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } - -/** - * CHECK_ERROR: - * - * Macro to return from the function if an XPath error was detected. - */ -#define CHECK_ERROR \ - if (ctxt->error != XPATH_EXPRESSION_OK) return - -/** - * CHECK_ERROR0: - * - * Macro to return 0 from the function if an XPath error was detected. - */ -#define CHECK_ERROR0 \ - if (ctxt->error != XPATH_EXPRESSION_OK) return(0) - -/** - * XP_ERROR: - * @X: the error code - * - * Macro to raise an XPath error and return. - */ -#define XP_ERROR(X) \ - { xmlXPathErr(ctxt, X); return; } - -/** - * XP_ERROR0: - * @X: the error code - * - * Macro to raise an XPath error and return 0. - */ -#define XP_ERROR0(X) \ - { xmlXPathErr(ctxt, X); return(0); } - -/** - * CHECK_TYPE: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. - */ -#define CHECK_TYPE(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR(XPATH_INVALID_TYPE) - -/** - * CHECK_TYPE0: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. Return(0) in case of failure - */ -#define CHECK_TYPE0(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR0(XPATH_INVALID_TYPE) - -/** - * CHECK_ARITY: - * @x: the number of expected args - * - * Macro to check that the number of args passed to an XPath function matches. - */ -#define CHECK_ARITY(x) \ - if (ctxt == NULL) return; \ - if (nargs != (x)) \ - XP_ERROR(XPATH_INVALID_ARITY); - -/** - * CAST_TO_STRING: - * - * Macro to try to cast the value on the top of the XPath stack to a string. - */ -#define CAST_TO_STRING \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ - xmlXPathStringFunction(ctxt, 1); - -/** - * CAST_TO_NUMBER: - * - * Macro to try to cast the value on the top of the XPath stack to a number. - */ -#define CAST_TO_NUMBER \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ - xmlXPathNumberFunction(ctxt, 1); - -/** - * CAST_TO_BOOLEAN: - * - * Macro to try to cast the value on the top of the XPath stack to a boolean. - */ -#define CAST_TO_BOOLEAN \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ - xmlXPathBooleanFunction(ctxt, 1); - -/* - * Variable Lookup forwarding. - */ - -XMLPUBFUN void XMLCALL - xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, - xmlXPathVariableLookupFunc f, - void *data); - -/* - * Function Lookup forwarding. - */ - -XMLPUBFUN void XMLCALL - xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, - xmlXPathFuncLookupFunc f, - void *funcCtxt); - -/* - * Error reporting. - */ -XMLPUBFUN void XMLCALL - xmlXPatherror (xmlXPathParserContextPtr ctxt, - const char *file, - int line, - int no); - -XMLPUBFUN void XMLCALL - xmlXPathErr (xmlXPathParserContextPtr ctxt, - int error); - -#ifdef LIBXML_DEBUG_ENABLED -XMLPUBFUN void XMLCALL - xmlXPathDebugDumpObject (FILE *output, - xmlXPathObjectPtr cur, - int depth); -XMLPUBFUN void XMLCALL - xmlXPathDebugDumpCompExpr(FILE *output, - xmlXPathCompExprPtr comp, - int depth); -#endif -/** - * NodeSet handling. - */ -XMLPUBFUN int XMLCALL - xmlXPathNodeSetContains (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDifference (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathIntersection (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDistinctSorted (xmlNodeSetPtr nodes); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDistinct (xmlNodeSetPtr nodes); - -XMLPUBFUN int XMLCALL - xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeLeading (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathLeading (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeTrailing (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathTrailing (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - - -/** - * Extending a context. - */ - -XMLPUBFUN int XMLCALL - xmlXPathRegisterNs (xmlXPathContextPtr ctxt, - const xmlChar *prefix, - const xmlChar *ns_uri); -XMLPUBFUN const xmlChar * XMLCALL - xmlXPathNsLookup (xmlXPathContextPtr ctxt, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); - -XMLPUBFUN int XMLCALL - xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathFunction f); -XMLPUBFUN int XMLCALL - xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathFunction f); -XMLPUBFUN int XMLCALL - xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathObjectPtr value); -XMLPUBFUN int XMLCALL - xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathFunction XMLCALL - xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -XMLPUBFUN xmlXPathFunction XMLCALL - xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathVariableLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); - -/** - * Utilities to extend XPath. - */ -XMLPUBFUN xmlXPathParserContextPtr XMLCALL - xmlXPathNewParserContext (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); - -/* TODO: remap to xmlXPathValuePop and Push. */ -XMLPUBFUN xmlXPathObjectPtr XMLCALL - valuePop (xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL - valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); - -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewString (const xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewCString (const char *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapString (xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapCString (char * val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewFloat (double val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewBoolean (int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewNodeSet (xmlNodePtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewValueTree (xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetAdd (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, - xmlNodePtr node, - xmlNsPtr ns); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetSort (xmlNodeSetPtr set); - -XMLPUBFUN void XMLCALL - xmlXPathRoot (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathParseName (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); - -/* - * Existing functions. - */ -XMLPUBFUN double XMLCALL - xmlXPathStringEvalNumber (const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr res); -XMLPUBFUN void XMLCALL - xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetMerge (xmlNodeSetPtr val1, - xmlNodeSetPtr val2); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetDel (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetRemove (xmlNodeSetPtr cur, - int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewNodeSetList (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapNodeSet (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapExternal (void *val); - -XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); -XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); - -XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); - -/* - * Some of the axis navigation routines. - */ -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -/* - * The official core of XPath functions. - */ -XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); - -/** - * Really internal functions - */ -XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPATH_ENABLED */ -#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpointer.h b/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpointer.h deleted file mode 100644 index dde1dfb3d1..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xpointer.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Summary: API to handle XML Pointers - * Description: API to handle XML Pointers - * Base implementation was made accordingly to - * W3C Candidate Recommendation 7 June 2000 - * http://www.w3.org/TR/2000/CR-xptr-20000607 - * - * Added support for the element() scheme described in: - * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPTR_H__ -#define __XML_XPTR_H__ - -#include - -#ifdef LIBXML_XPTR_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * A Location Set - */ -typedef struct _xmlLocationSet xmlLocationSet; -typedef xmlLocationSet *xmlLocationSetPtr; -struct _xmlLocationSet { - int locNr; /* number of locations in the set */ - int locMax; /* size of the array as allocated */ - xmlXPathObjectPtr *locTab;/* array of locations */ -}; - -/* - * Handling of location sets. - */ - -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, - xmlLocationSetPtr val2); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRange (xmlNodePtr start, - int startindex, - xmlNodePtr end, - int endindex); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePoints (xmlXPathObjectPtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodePoint (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodeObject (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewCollapsedRange (xmlNodePtr start); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetDel (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, - int val); - -/* - * Functions. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPtrNewContext (xmlDocPtr doc, - xmlNodePtr here, - xmlNodePtr origin); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN void XMLCALL - xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -XMLPUBFUN xmlNodePtr XMLCALL - xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ -#endif /* __XML_XPTR_H__ */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi-v7a/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi-v7a/libxml2.a.REMOVED.git-id deleted file mode 100644 index 38c23edc1f..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi-v7a/libxml2.a.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -813164629a16c93ebc3ff20a39072f2cae2aee3a \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi/libxml2.a.REMOVED.git-id deleted file mode 100644 index 4275730ad2..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/armeabi/libxml2.a.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f2063d0cb885da76b53ff7278eb34635c460d09e \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/x86/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/x86/libxml2.a.REMOVED.git-id deleted file mode 100644 index 79dd036f57..0000000000 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/libs/x86/libxml2.a.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -22740a73cdc408d9a8557d0f462f0a49bd29e26e \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libjpeg/jconfig.h b/cocos2dx/platform/third_party/emscripten/libjpeg/jconfig.h new file mode 100644 index 0000000000..966b1d5149 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libjpeg/jconfig.h @@ -0,0 +1,54 @@ +/* jconfig.h. Generated from jconfig.cfg by configure. */ +/* jconfig.cfg --- source file edited by configure script */ +/* see jconfig.txt for explanations */ + +#define HAVE_PROTOTYPES 1 +#define HAVE_UNSIGNED_CHAR 1 +#define HAVE_UNSIGNED_SHORT 1 +/* #undef void */ +/* #undef const */ +/* #undef CHAR_IS_UNSIGNED */ +#define HAVE_STDDEF_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_LOCALE_H 1 +/* #undef NEED_BSD_STRINGS */ +/* #undef NEED_SYS_TYPES_H */ +/* #undef NEED_FAR_POINTERS */ +/* #undef NEED_SHORT_EXTERNAL_NAMES */ +/* Define this if you get warnings about undefined structures. */ +/* #undef INCOMPLETE_TYPES_BROKEN */ + +/* Define "boolean" as unsigned char, not int, on Windows systems. */ +#ifdef _WIN32 +#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ +typedef unsigned char boolean; +#endif +#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ +#endif + +#ifdef JPEG_INTERNALS + +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ +#define INLINE __inline__ +/* These are for configuring the JPEG memory manager. */ +/* #undef DEFAULT_MAX_MEM */ +/* #undef NO_MKTEMP */ + +#endif /* JPEG_INTERNALS */ + +#ifdef JPEG_CJPEG_DJPEG + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +/* #undef RLE_SUPPORTED */ +#define TARGA_SUPPORTED /* Targa image file format */ + +/* #undef TWO_FILE_COMMANDLINE */ +/* #undef NEED_SIGNAL_CATCHER */ +/* #undef DONT_USE_B_MODE */ + +/* Define this if you want percent-done progress reports from cjpeg/djpeg. */ +/* #undef PROGRESS_REPORT */ + +#endif /* JPEG_CJPEG_DJPEG */ diff --git a/cocos2dx/platform/third_party/emscripten/libjpeg/jerror.h b/cocos2dx/platform/third_party/emscripten/libjpeg/jerror.h new file mode 100644 index 0000000000..a4b661f716 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libjpeg/jerror.h @@ -0,0 +1,304 @@ +/* + * jerror.h + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * Modified 1997-2012 by Guido Vollbeding. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the error and message codes for the JPEG library. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + * A set of error-reporting macros are defined too. Some applications using + * the JPEG library may wish to include this file to get the error codes + * and/or the macros. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef JERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code,string) +#endif /* JERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code,string) code , + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ + +/* For maintenance convenience, list is alphabetical by message code name */ +JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") +JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") +JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") +JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") +JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported") +JMESSAGE(JERR_BAD_DROP_SAMPLING, + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") +JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") +JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") +JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") +JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") +JMESSAGE(JERR_BAD_LIB_VERSION, + "Wrong JPEG library version: library is %d, caller expects %d") +JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") +JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") +JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") +JMESSAGE(JERR_BAD_PROGRESSION, + "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") +JMESSAGE(JERR_BAD_PROG_SCRIPT, + "Invalid progressive parameters at scan script entry %d") +JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") +JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") +JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") +JMESSAGE(JERR_BAD_STRUCT_SIZE, + "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") +JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") +JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") +JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") +JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") +JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") +JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") +JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") +JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") +JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") +JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") +JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") +JMESSAGE(JERR_EMS_READ, "Read from EMS failed") +JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") +JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") +JMESSAGE(JERR_FILE_READ, "Input file read error") +JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") +JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") +JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") +JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") +JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") +JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") +JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") +JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, + "Cannot transcode due to multiple use of quantization table %d") +JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") +JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") +JMESSAGE(JERR_NOTIMPL, "Not implemented yet") +JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") +JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") +JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") +JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") +JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") +JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") +JMESSAGE(JERR_QUANT_COMPONENTS, + "Cannot quantize more than %d color components") +JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") +JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") +JMESSAGE(JERR_SOF_BEFORE, "Invalid JPEG file structure: %s before SOF") +JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") +JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") +JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") +JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") +JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") +JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") +JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") +JMESSAGE(JERR_TFILE_WRITE, + "Write failed on temporary file --- out of disk space?") +JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") +JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") +JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") +JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") +JMESSAGE(JERR_XMS_READ, "Read from XMS failed") +JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") +JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT) +JMESSAGE(JMSG_VERSION, JVERSION) +JMESSAGE(JTRC_16BIT_TABLES, + "Caution: quantization tables are too coarse for baseline JPEG") +JMESSAGE(JTRC_ADOBE, + "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") +JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") +JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") +JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") +JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") +JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") +JMESSAGE(JTRC_DRI, "Define Restart Interval %u") +JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") +JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") +JMESSAGE(JTRC_EOI, "End Of Image") +JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") +JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") +JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, + "Warning: thumbnail image size does not match data length %u") +JMESSAGE(JTRC_JFIF_EXTENSION, + "JFIF extension marker: type 0x%02x, length %u") +JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") +JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") +JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") +JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") +JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") +JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") +JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") +JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") +JMESSAGE(JTRC_RST, "RST%d") +JMESSAGE(JTRC_SMOOTH_NOTIMPL, + "Smoothing not supported with nonstandard sampling ratios") +JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") +JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") +JMESSAGE(JTRC_SOI, "Start of Image") +JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") +JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") +JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") +JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") +JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") +JMESSAGE(JTRC_THUMB_JPEG, + "JFIF extension marker: JPEG-compressed thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_PALETTE, + "JFIF extension marker: palette thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_RGB, + "JFIF extension marker: RGB thumbnail image, length %u") +JMESSAGE(JTRC_UNKNOWN_IDS, + "Unrecognized component IDs %d %d %d, assuming YCbCr") +JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") +JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") +JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +JMESSAGE(JWRN_BOGUS_PROGRESSION, + "Inconsistent progression sequence for component %d coefficient %d") +JMESSAGE(JWRN_EXTRANEOUS_DATA, + "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") +JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") +JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") +JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") +JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") +JMESSAGE(JWRN_MUST_RESYNC, + "Corrupt JPEG data: found marker 0x%02x instead of RST%d") +JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") +JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTMSGCODE +} J_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE + + +#ifndef JERROR_H +#define JERROR_H + +/* Macros to simplify using the error and trace message stuff */ +/* The first parameter is either type of cinfo pointer */ + +/* Fatal errors (print message and exit) */ +#define ERREXIT(cinfo,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT1(cinfo,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT2(cinfo,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT3(cinfo,code,p1,p2,p3) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT4(cinfo,code,p1,p2,p3,p4) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (cinfo)->err->msg_parm.i[4] = (p5), \ + (cinfo)->err->msg_parm.i[5] = (p6), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) +#define ERREXITS(cinfo,code,str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo))) + +#define MAKESTMT(stuff) do { stuff } while (0) + +/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ +#define WARNMS(cinfo,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) +#define WARNMS1(cinfo,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) +#define WARNMS2(cinfo,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), -1)) + +/* Informational/debugging messages */ +#define TRACEMS(cinfo,lvl,code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS1(cinfo,lvl,code,p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS2(cinfo,lvl,code,p1,p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) +#define TRACEMS3(cinfo,lvl,code,p1,p2,p3) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS4(cinfo,lvl,code,p1,p2,p3,p4) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS5(cinfo,lvl,code,p1,p2,p3,p4,p5) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMS8(cinfo,lvl,code,p1,p2,p3,p4,p5,p6,p7,p8) \ + MAKESTMT(int * _mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl)); ) +#define TRACEMSS(cinfo,lvl,code,str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->emit_message) ((j_common_ptr) (cinfo), (lvl))) + +#endif /* JERROR_H */ diff --git a/cocos2dx/platform/third_party/emscripten/libjpeg/jmorecfg.h b/cocos2dx/platform/third_party/emscripten/libjpeg/jmorecfg.h new file mode 100644 index 0000000000..2407edbef8 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libjpeg/jmorecfg.h @@ -0,0 +1,390 @@ +/* + * jmorecfg.h + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 1997-2012 by Guido Vollbeding. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains additional configuration options that customize the + * JPEG software for special applications or support machine-dependent + * optimizations. Most users will not need to touch this file. + */ + + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + + +/* + * Maximum number of components (color channels) allowed in JPEG image. + * To meet the letter of the JPEG spec, set this to 255. However, darn + * few applications need more than 4 channels (maybe 5 for CMYK + alpha + * mask). We recommend 10 as a reasonable compromise; use 4 if you are + * really short on memory. (Each allowed component costs a hundred or so + * bytes of storage, whether actually used in an image or not.) + */ + +#define MAX_COMPONENTS 10 /* maximum number of image components */ + + +/* + * Basic data types. + * You may need to change these if you have a machine with unusual data + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* Representation of a single sample (pixel element value). + * We frequently allocate large arrays of these, so it's important to keep + * them small. But if you have memory to burn and access to char or short + * arrays is very slow on your hardware, you might want to change these. + */ + +#if BITS_IN_JSAMPLE == 8 +/* JSAMPLE should be the smallest type that will hold the values 0..255. + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JSAMPLE; +#ifdef CHAR_IS_UNSIGNED +#define GETJSAMPLE(value) ((int) (value)) +#else +#define GETJSAMPLE(value) ((int) (value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* BITS_IN_JSAMPLE == 8 */ + + +#if BITS_IN_JSAMPLE == 12 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. + * On nearly all machines "short" will do nicely. + */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) ((int) (value)) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* BITS_IN_JSAMPLE == 12 */ + + +/* Representation of a DCT frequency coefficient. + * This should be a signed value of at least 16 bits; "short" is usually OK. + * Again, we allocate large arrays of these, but you can change to int + * if you have memory to burn and "short" is really slow. + */ + +typedef short JCOEF; + + +/* Compressed datastreams are represented as arrays of JOCTET. + * These must be EXACTLY 8 bits wide, at least once they are written to + * external storage. Note that when using the stdio data source/destination + * managers, this is also the data type passed to fread/fwrite. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JOCTET; +#define GETJOCTET(value) (value) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JOCTET; +#ifdef CHAR_IS_UNSIGNED +#define GETJOCTET(value) (value) +#else +#define GETJOCTET(value) ((value) & 0xFF) +#endif /* CHAR_IS_UNSIGNED */ + +#endif /* HAVE_UNSIGNED_CHAR */ + + +/* These typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char UINT8; +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef CHAR_IS_UNSIGNED +typedef char UINT8; +#else /* not CHAR_IS_UNSIGNED */ +typedef short UINT8; +#endif /* CHAR_IS_UNSIGNED */ +#endif /* HAVE_UNSIGNED_CHAR */ + +/* UINT16 must hold at least the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT +typedef unsigned short UINT16; +#else /* not HAVE_UNSIGNED_SHORT */ +typedef unsigned int UINT16; +#endif /* HAVE_UNSIGNED_SHORT */ + +/* INT16 must hold at least the values -32768..32767. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +typedef short INT16; +#endif + +/* INT32 must hold at least signed 32-bit values. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ +#ifndef _BASETSD_H /* MinGW is slightly different */ +#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ +typedef long INT32; +#endif +#endif +#endif +#endif + +/* Datatype used for image dimensions. The JPEG standard only supports + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore + * "unsigned int" is sufficient on all machines. However, if you need to + * handle larger images and you don't mind deviating from the spec, you + * can change this datatype. + */ + +typedef unsigned int JDIMENSION; + +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ + + +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. + * Another application is to make all functions global for use with debuggers + * or code profilers that require it. + */ + +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* This macro is used to declare a "method", that is, a function pointer. + * We want to supply prototype parameters if the compiler can cope. + * Note that the arglist parameter must be parenthesized! + * Again, you can customize this if you need special linkage keywords. + */ + +#ifdef HAVE_PROTOTYPES +#define JMETHOD(type,methodname,arglist) type (*methodname) arglist +#else +#define JMETHOD(type,methodname,arglist) type (*methodname) () +#endif + + +/* The noreturn type identifier is used to declare functions + * which cannot return. + * Compilers can thus create more optimized code and perform + * better checks for warnings and errors. + * Static analyzer tools can make improved inferences about + * execution paths and are prevented from giving false alerts. + * + * Unfortunately, the proposed specifications of corresponding + * extensions in the Dec 2011 ISO C standard revision (C11), + * GCC, MSVC, etc. are not viable. + * Thus we introduce a user defined type to declare noreturn + * functions at least for clarity. A proper compiler would + * have a suitable noreturn type to match in place of void. + */ + +#ifndef HAVE_NORETURN_T +typedef void noreturn_t; +#endif + + +/* Here is the pseudo-keyword for declaring pointers that must be "far" + * on 80x86 machines. Most of the specialized coding for 80x86 is handled + * by just saying "FAR *" where such a pointer is needed. In a few places + * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol. + */ + +#ifndef FAR +#ifdef NEED_FAR_POINTERS +#define FAR far +#else +#define FAR +#endif +#endif + + +/* + * On a few systems, type boolean and/or its values FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. + */ + +#ifdef HAVE_BOOLEAN +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif +#else +typedef enum { FALSE = 0, TRUE = 1 } boolean; +#endif + + +/* + * The remaining options affect code selection within the JPEG library, + * but they don't need to be visible to most applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. + */ + +#ifdef JPEG_INTERNALS +#define JPEG_INTERNAL_OPTIONS +#endif + +#ifdef JPEG_INTERNAL_OPTIONS + + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * library. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Capability options common to encoder and decoder: */ + +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ + +/* Encoder capability options: */ + +#define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +/* Note: if you selected 12-bit data precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. + * The exact same statements apply for progressive JPEG: the default tables + * don't work for progressive mode. (This may get fixed, however.) + */ +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ + +/* Decoder capability options: */ + +#define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ + +/* more capability options later, no doubt */ + + +/* + * Ordering of RGB data in scanlines passed to or from the application. + * If your application wants to deal with data in the order B,G,R, just + * change these macros. You can also deal with formats such as R,G,B,X + * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing + * the offsets will also change the order in which colormap data is organized. + * RESTRICTIONS: + * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. + * 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE + * is not 3 (they don't understand about dummy color components!). So you + * can't use color quantization if you change that value. + */ + +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ + + +/* Definitions for speed-related optimizations. */ + + +/* If your compiler supports inline functions, define INLINE + * as the inline keyword; otherwise define it as empty. + */ + +#ifndef INLINE +#ifdef __GNUC__ /* for instance, GNU C knows about inline */ +#define INLINE __inline__ +#endif +#ifndef INLINE +#define INLINE /* default is to define it as empty */ +#endif +#endif + + +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. + */ + +#ifndef MULTIPLIER +#define MULTIPLIER int /* type for fastest integer multiply */ +#endif + + +/* FAST_FLOAT should be either float or double, whichever is done faster + * by your compiler. (Note that this type is only used in the floating point + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) + * Typically, float is faster in ANSI C compilers, while double is faster in + * pre-ANSI compilers (because they insist on converting to double anyway). + * The code below therefore chooses float if we have ANSI-style prototypes. + */ + +#ifndef FAST_FLOAT +#ifdef HAVE_PROTOTYPES +#define FAST_FLOAT float +#else +#define FAST_FLOAT double +#endif +#endif + +#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/cocos2dx/platform/third_party/emscripten/libjpeg/jpeglib.h b/cocos2dx/platform/third_party/emscripten/libjpeg/jpeglib.h new file mode 100644 index 0000000000..0a6dac44c3 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libjpeg/jpeglib.h @@ -0,0 +1,1173 @@ +/* + * jpeglib.h + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * Modified 2002-2012 by Guido Vollbeding. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the application interface for the JPEG library. + * Most applications using the library need only include this file, + * and perhaps jerror.h if they want to know the exact error codes. + */ + +#ifndef JPEGLIB_H +#define JPEGLIB_H + +/* + * First we include the configuration files that record how this + * installation of the JPEG library is set up. jconfig.h can be + * generated automatically for many systems. jmorecfg.h contains + * manual configuration options that most people need not worry about. + */ + +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ +#endif +#include "jmorecfg.h" /* seldom changed options */ + + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +extern "C" { +#endif +#endif + +/* Version IDs for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 90". + */ + +#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ +#define JPEG_LIB_VERSION_MAJOR 9 +#define JPEG_LIB_VERSION_MINOR 0 + + +/* Various constants determining the sizes of things. + * All of these are specified by the JPEG standard, so don't change them + * if you want to be compatible. + */ + +#define DCTSIZE 8 /* The basic DCT block is 8x8 coefficients */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; + * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. + * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU + * to handle it. We even let you do this from the jconfig.h file. However, + * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe + * sometimes emits noncompliant files doesn't mean you should too. + */ +#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ +#ifndef D_MAX_BLOCKS_IN_MCU +#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ +#endif + + +/* Data structures for images (arrays of samples and of DCT coefficients). + * On 80x86 machines, the image arrays are too big for near pointers, + * but the pointer arrays can fit in near memory. + */ + +typedef JSAMPLE FAR *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK FAR *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF FAR *JCOEFPTR; /* useful in a couple of places */ + + +/* Types for JPEG compression parameters and working tables. */ + + +/* DCT coefficient quantization tables. */ + +typedef struct { + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. + */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JQUANT_TBL; + + +/* Huffman coding tables. */ + +typedef struct { + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JHUFF_TBL; + + +/* Basic info about one component (color channel). */ + +typedef struct { + /* These values are fixed over the whole image. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOF marker. */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOS marker. */ + /* The decompressor output side may not use these variables. */ + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + + /* Remaining fields should be treated as private by applications. */ + + /* These values are computed during compression or decompression startup: */ + /* Component's size in DCT blocks. + * Any dummy blocks added to complete an MCU are not counted; therefore + * these values do not depend on whether a scan is interleaved or not. + */ + JDIMENSION width_in_blocks; + JDIMENSION height_in_blocks; + /* Size of a DCT block in samples, + * reflecting any scaling we choose to apply during the DCT step. + * Values from 1 to 16 are supported. + * Note that different components may receive different DCT scalings. + */ + int DCT_h_scaled_size; + int DCT_v_scaled_size; + /* The downsampled dimensions are the component's actual, unpadded number + * of samples at the main buffer (preprocessing/compression interface); + * DCT scaling is included, so + * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE) + * and similarly for height. + */ + JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_height; /* actual height in samples */ + /* This flag is used only for decompression. In cases where some of the + * components will be ignored (eg grayscale output from YCbCr image), + * we can skip most computations for the unused components. + */ + boolean component_needed; /* do we need the value of this component? */ + + /* These values are computed before starting a scan of the component. */ + /* The decompressor output side may not use these variables. */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples: MCU_width * DCT_h_scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ + + /* Saved quantization table for component; NULL if none yet saved. + * See jdinput.c comments about the need for this information. + * This field is currently used only for decompression. + */ + JQUANT_TBL * quant_table; + + /* Private per-component storage for DCT or IDCT subsystem. */ + void * dct_table; +} jpeg_component_info; + + +/* The script for encoding a multiple-scan file is an array of these: */ + +typedef struct { + int comps_in_scan; /* number of components encoded in this scan */ + int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ +} jpeg_scan_info; + +/* The decompressor can save APPn and COM markers in a list of these: */ + +typedef struct jpeg_marker_struct FAR * jpeg_saved_marker_ptr; + +struct jpeg_marker_struct { + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET FAR * data; /* the data contained in the marker */ + /* the marker length word is not counted in data_length or original_length */ +}; + +/* Known color spaces. */ + +typedef enum { + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK /* Y/Cb/Cr/K */ +} J_COLOR_SPACE; + +/* Supported color transforms. */ + +typedef enum { + JCT_NONE = 0, + JCT_SUBTRACT_GREEN = 1 +} J_COLOR_TRANSFORM; + +/* DCT/IDCT algorithm options. */ + +typedef enum { + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ +} J_DCT_METHOD; + +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#define JDCT_DEFAULT JDCT_ISLOW +#endif +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#define JDCT_FASTEST JDCT_IFAST +#endif + +/* Dithering options for decompression. */ + +typedef enum { + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ +} J_DITHER_MODE; + + +/* Common fields between JPEG compression and decompression master structs. */ + +#define jpeg_common_fields \ + struct jpeg_error_mgr * err; /* Error handler module */\ + struct jpeg_memory_mgr * mem; /* Memory manager module */\ + struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\ + void * client_data; /* Available for use by application */\ + boolean is_decompressor; /* So common code can tell which is which */\ + int global_state /* For checking call sequence validity */ + +/* Routines that are to be used by both halves of the library are declared + * to receive a pointer to this structure. There are no actual instances of + * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. + */ +struct jpeg_common_struct { + jpeg_common_fields; /* Fields common to both master struct types */ + /* Additional fields follow in an actual jpeg_compress_struct or + * jpeg_decompress_struct. All three structs must agree on these + * initial fields! (This would be a lot cleaner in C++.) + */ +}; + +typedef struct jpeg_common_struct * j_common_ptr; +typedef struct jpeg_compress_struct * j_compress_ptr; +typedef struct jpeg_decompress_struct * j_decompress_ptr; + + +/* Master record for a compression instance */ + +struct jpeg_compress_struct { + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + + /* Destination for compressed data */ + struct jpeg_destination_mgr * dest; + + /* Description of source image --- these fields must be filled in by + * outer application before starting compression. in_color_space must + * be correct before you can even call jpeg_set_defaults(). + */ + + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ + + double input_gamma; /* image gamma of input image */ + + /* Compression parameters --- these fields must be set before calling + * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to + * initialize everything to reasonable defaults, then changing anything + * the application specifically wants to change. That way you won't get + * burnt when new parameters are added. Also note that there are several + * helper routines to simplify changing parameters. + */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + JDIMENSION jpeg_width; /* scaled JPEG image width */ + JDIMENSION jpeg_height; /* scaled JPEG image height */ + /* Dimensions of actual JPEG image that will be written to file, + * derived from input dimensions by scaling factors above. + * These fields are computed by jpeg_start_compress(). + * You can also use jpeg_calc_jpeg_dimensions() to determine these values + * in advance of calling jpeg_start_compress(). + */ + + int data_precision; /* bits of precision in image data */ + + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + int q_scale_factor[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined, + * and corresponding scale factors (percentage, initialized 100). + */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + int num_scans; /* # of entries in scan_info array */ + const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ + /* The default value of scan_info is NULL, which causes a single-scan + * sequential JPEG file to be emitted. To create a multi-scan file, + * set num_scans and scan_info to point to an array of scan definitions. + */ + + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ + + /* The restart interval can be specified in absolute MCUs by setting + * restart_interval, or in MCU rows by setting restart_in_rows + * (in which case the correct restart_interval will be figured + * for each scan). + */ + unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ + + /* Parameters controlling emission of special markers. */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + UINT8 JFIF_minor_version; + /* These three values are not used by the JPEG code, merely copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + + J_COLOR_TRANSFORM color_transform; + /* Color transform identifier, writes LSE marker if nonzero */ + + /* State variable: index of next scanline to be written to + * jpeg_write_scanlines(). Application may use this to control its + * processing loop, e.g., "while (next_scanline < image_height)". + */ + + JDIMENSION next_scanline; /* 0 .. image_height-1 */ + + /* Remaining fields are known throughout compressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during compression startup + */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + /* The coefficient controller receives data in units of MCU rows as defined + * for fully interleaved scans (whether the JPEG file is interleaved or not). + * There are v_samp_factor * DCTSIZE sample rows of each component in an + * "iMCU" (interleaved MCU) row. + */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[C_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + int block_size; /* the basic DCT block size: 1..16 */ + const int * natural_order; /* natural-order position array */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) */ + + /* + * Links to compression subobjects (methods and private variables of modules) + */ + struct jpeg_comp_master * master; + struct jpeg_c_main_controller * main; + struct jpeg_c_prep_controller * prep; + struct jpeg_c_coef_controller * coef; + struct jpeg_marker_writer * marker; + struct jpeg_color_converter * cconvert; + struct jpeg_downsampler * downsample; + struct jpeg_forward_dct * fdct; + struct jpeg_entropy_encoder * entropy; + jpeg_scan_info * script_space; /* workspace for jpeg_simple_progression */ + int script_space_size; +}; + + +/* Master record for a decompression instance */ + +struct jpeg_decompress_struct { + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + + /* Source of compressed data */ + struct jpeg_source_mgr * src; + + /* Basic description of image --- filled in by jpeg_read_header(). */ + /* Application may inspect these values to decide how to process image. */ + + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + /* Decompression processing parameters --- these fields must be set before + * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes + * them to default values. + */ + + J_COLOR_SPACE out_color_space; /* colorspace for output */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + double output_gamma; /* image gamma wanted in output */ + + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ + + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + + boolean quantize_colors; /* TRUE=colormapped output wanted */ + /* the following are ignored if not quantize_colors: */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ + /* these are significant only in buffered-image mode: */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_external_quant;/* enable future use of external colormap */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + + /* Description of actual output image that will be returned to application. + * These fields are computed by jpeg_start_decompress(). + * You can also use jpeg_calc_output_dimensions() to determine these values + * in advance of calling jpeg_start_decompress(). + */ + + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ + /* output_components is 1 (a colormap index) when quantizing colors; + * otherwise it equals out_color_components. + */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ + /* If the buffer passed to jpeg_read_scanlines() is less than this many rows + * high, space and time will be wasted due to unnecessary data copying. + * Usually rec_outbuf_height will be 1 or 2, at most 4. + */ + + /* When quantizing colors, the output colormap is described by these fields. + * The application can supply a colormap by setting colormap non-NULL before + * calling jpeg_start_decompress; otherwise a colormap is created during + * jpeg_start_decompress or jpeg_start_output. + * The map has out_color_components rows and actual_number_of_colors columns. + */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + + /* State variables: these variables indicate the progress of decompression. + * The application may examine these but must not modify them. + */ + + /* Row index of next scanline to be read from jpeg_read_scanlines(). + * Application may use this to control its processing loop, e.g., + * "while (output_scanline < output_height)". + */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ + + /* Current input scan number and number of iMCU rows completed in scan. + * These indicate the progress of the decompressor input side. + */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + + /* The "output scan number" is the notional scan being displayed by the + * output side. The decompressor will not allow output scan/row number + * to get ahead of input scan/row, but it can fall arbitrarily far behind. + */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + + /* Current progression status. coef_bits[c][i] indicates the precision + * with which component c's DCT coefficient i (in zigzag order) is known. + * It is -1 when no data has yet been received, otherwise it is the point + * transform (shift) value for the most recent scan of the coefficient + * (thus, 0 at completion of the progression). + * This pointer is NULL when reading a non-progressive file. + */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + + /* Internal JPEG parameters --- the application usually need not look at + * these fields. Note that the decompressor output side may not use + * any parameters that can change between scans. + */ + + /* Quantization and Huffman tables are carried forward across input + * datastreams when processing abbreviated JPEG datastreams. + */ + + JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + /* These parameters are never carried across datastreams, since they + * are given in SOF/SOS markers or defined to be reset by SOI. + */ + + int data_precision; /* bits of precision in image data */ + + jpeg_component_info * comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ + + /* These fields record data obtained from optional markers recognized by + * the JPEG library. + */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ + UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_minor_version; + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + + J_COLOR_TRANSFORM color_transform; + /* Color transform identifier derived from LSE marker, otherwise zero */ + + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + /* Aside from the specific data retained from APPn markers known to the + * library, the uninterpreted contents of any or all APPn and COM markers + * can be saved in a list for examination by the application. + */ + jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ + + /* Remaining fields are known throughout decompressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during decompression startup + */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ + + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + /* The coefficient controller's input and output progress is measured in + * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows + * in fully interleaved JPEG scans, but are used whether the scan is + * interleaved or not. We define an iMCU row as v_samp_factor DCT block + * rows of each component. Therefore, the IDCT output contains + * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row. + */ + + JSAMPLE * sample_range_limit; /* table for fast range-limiting */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + * Note that the decompressor output side must not use these fields. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[D_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + + /* These fields are derived from Se of first SOS marker. + */ + int block_size; /* the basic DCT block size: 1..16 */ + const int * natural_order; /* natural-order position array for entropy decode */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ + + /* This field is shared between entropy decoder and marker parser. + * It is either zero or the code of a JPEG marker that has been + * read from the data source, but has not yet been processed. + */ + int unread_marker; + + /* + * Links to decompression subobjects (methods, private variables of modules) + */ + struct jpeg_decomp_master * master; + struct jpeg_d_main_controller * main; + struct jpeg_d_coef_controller * coef; + struct jpeg_d_post_controller * post; + struct jpeg_input_controller * inputctl; + struct jpeg_marker_reader * marker; + struct jpeg_entropy_decoder * entropy; + struct jpeg_inverse_dct * idct; + struct jpeg_upsampler * upsample; + struct jpeg_color_deconverter * cconvert; + struct jpeg_color_quantizer * cquantize; +}; + + +/* "Object" declarations for JPEG modules that may be supplied or called + * directly by the surrounding application. + * As with all objects in the JPEG library, these structs only define the + * publicly visible methods and state variables of a module. Additional + * private fields may exist after the public ones. + */ + + +/* Error handler object */ + +struct jpeg_error_mgr { + /* Error exit handler: does not return to caller */ + JMETHOD(noreturn_t, error_exit, (j_common_ptr cinfo)); + /* Conditionally emit a trace or warning message */ + JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level)); + /* Routine that actually outputs a trace or error message */ + JMETHOD(void, output_message, (j_common_ptr cinfo)); + /* Format a message string for the most recent JPEG error or message */ + JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer)); +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ + /* Reset error state variables at start of a new image */ + JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo)); + + /* The message ID code and any parameters are saved here. + * A message can have one string parameter or up to 8 int parameters. + */ + int msg_code; +#define JMSG_STR_PARM_MAX 80 + union { + int i[8]; + char s[JMSG_STR_PARM_MAX]; + } msg_parm; + + /* Standard state variables for error facility */ + + int trace_level; /* max msg_level that will be displayed */ + + /* For recoverable corrupt-data errors, we emit a warning message, + * but keep going unless emit_message chooses to abort. emit_message + * should count warnings in num_warnings. The surrounding application + * can check for bad data by seeing if num_warnings is nonzero at the + * end of processing. + */ + long num_warnings; /* number of corrupt-data warnings */ + + /* These fields point to the table(s) of error message strings. + * An application can change the table pointer to switch to a different + * message list (typically, to change the language in which errors are + * reported). Some applications may wish to add additional error codes + * that will be handled by the JPEG library error mechanism; the second + * table pointer is used for this purpose. + * + * First table includes all errors generated by JPEG library itself. + * Error code 0 is reserved for a "no such error string" message. + */ + const char * const * jpeg_message_table; /* Library errors */ + int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ + /* Second table can be added by application (see cjpeg/djpeg for example). + * It contains strings numbered first_addon_message..last_addon_message. + */ + const char * const * addon_message_table; /* Non-library errors */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ +}; + + +/* Progress monitor object */ + +struct jpeg_progress_mgr { + JMETHOD(void, progress_monitor, (j_common_ptr cinfo)); + + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ +}; + + +/* Data destination object for compression */ + +struct jpeg_destination_mgr { + JOCTET * next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + + JMETHOD(void, init_destination, (j_compress_ptr cinfo)); + JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo)); + JMETHOD(void, term_destination, (j_compress_ptr cinfo)); +}; + + +/* Data source object for decompression */ + +struct jpeg_source_mgr { + const JOCTET * next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + + JMETHOD(void, init_source, (j_decompress_ptr cinfo)); + JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo)); + JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes)); + JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired)); + JMETHOD(void, term_source, (j_decompress_ptr cinfo)); +}; + + +/* Memory manager object. + * Allocates "small" objects (a few K total), "large" objects (tens of K), + * and "really big" objects (virtual arrays with backing store if needed). + * The memory manager does not allow individual objects to be freed; rather, + * each created object is assigned to a pool, and whole pools can be freed + * at once. This is faster and more convenient than remembering exactly what + * to free, especially where malloc()/free() are not too speedy. + * NB: alloc routines never return NULL. They exit to error_exit if not + * successful. + */ + +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 + +typedef struct jvirt_sarray_control * jvirt_sarray_ptr; +typedef struct jvirt_barray_control * jvirt_barray_ptr; + + +struct jpeg_memory_mgr { + /* Method pointers */ + JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, + size_t sizeofobject)); + JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, + JDIMENSION numrows)); + JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, + JDIMENSION numrows)); + JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, + int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess)); + JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo)); + JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo, + jvirt_sarray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo, + jvirt_barray_ptr ptr, + JDIMENSION start_row, + JDIMENSION num_rows, + boolean writable)); + JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id)); + JMETHOD(void, self_destruct, (j_common_ptr cinfo)); + + /* Limit on memory allocation for this JPEG object. (Note that this is + * merely advisory, not a guaranteed maximum; it only affects the space + * used for virtual-array buffers.) May be changed by outer application + * after creating the JPEG object. + */ + long max_memory_to_use; + + /* Maximum allocation request accepted by alloc_large. */ + long max_alloc_chunk; +}; + + +/* Routine signature for application-supplied marker processing methods. + * Need not pass marker code since it is stored in cinfo->unread_marker. + */ +typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo)); + + +/* Declarations for routines called by application. + * The JPP macro hides prototype parameters from compilers that can't cope. + * Note JPP requires double parentheses. + */ + +#ifdef HAVE_PROTOTYPES +#define JPP(arglist) arglist +#else +#define JPP(arglist) () +#endif + + +/* Short forms of external names for systems with brain-damaged linkers. + * We shorten external names to be unique in the first six letters, which + * is good enough for all known systems. + * (If your compiler itself needs names to be unique in less than 15 + * characters, you are out of luck. Get a better compiler.) + */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jpeg_std_error jStdError +#define jpeg_CreateCompress jCreaCompress +#define jpeg_CreateDecompress jCreaDecompress +#define jpeg_destroy_compress jDestCompress +#define jpeg_destroy_decompress jDestDecompress +#define jpeg_stdio_dest jStdDest +#define jpeg_stdio_src jStdSrc +#define jpeg_mem_dest jMemDest +#define jpeg_mem_src jMemSrc +#define jpeg_set_defaults jSetDefaults +#define jpeg_set_colorspace jSetColorspace +#define jpeg_default_colorspace jDefColorspace +#define jpeg_set_quality jSetQuality +#define jpeg_set_linear_quality jSetLQuality +#define jpeg_default_qtables jDefQTables +#define jpeg_add_quant_table jAddQuantTable +#define jpeg_quality_scaling jQualityScaling +#define jpeg_simple_progression jSimProgress +#define jpeg_suppress_tables jSuppressTables +#define jpeg_alloc_quant_table jAlcQTable +#define jpeg_alloc_huff_table jAlcHTable +#define jpeg_start_compress jStrtCompress +#define jpeg_write_scanlines jWrtScanlines +#define jpeg_finish_compress jFinCompress +#define jpeg_calc_jpeg_dimensions jCjpegDimensions +#define jpeg_write_raw_data jWrtRawData +#define jpeg_write_marker jWrtMarker +#define jpeg_write_m_header jWrtMHeader +#define jpeg_write_m_byte jWrtMByte +#define jpeg_write_tables jWrtTables +#define jpeg_read_header jReadHeader +#define jpeg_start_decompress jStrtDecompress +#define jpeg_read_scanlines jReadScanlines +#define jpeg_finish_decompress jFinDecompress +#define jpeg_read_raw_data jReadRawData +#define jpeg_has_multiple_scans jHasMultScn +#define jpeg_start_output jStrtOutput +#define jpeg_finish_output jFinOutput +#define jpeg_input_complete jInComplete +#define jpeg_new_colormap jNewCMap +#define jpeg_consume_input jConsumeInput +#define jpeg_core_output_dimensions jCoreDimensions +#define jpeg_calc_output_dimensions jCalcDimensions +#define jpeg_save_markers jSaveMarkers +#define jpeg_set_marker_processor jSetMarker +#define jpeg_read_coefficients jReadCoefs +#define jpeg_write_coefficients jWrtCoefs +#define jpeg_copy_critical_parameters jCopyCrit +#define jpeg_abort_compress jAbrtCompress +#define jpeg_abort_decompress jAbrtDecompress +#define jpeg_abort jAbort +#define jpeg_destroy jDestroy +#define jpeg_resync_to_restart jResyncRestart +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + + +/* Default error-management setup */ +EXTERN(struct jpeg_error_mgr *) jpeg_std_error + JPP((struct jpeg_error_mgr * err)); + +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t) sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo, + int version, size_t structsize)); +EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo, + int version, size_t structsize)); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); + +/* Standard data source and destination managers: stdio streams. */ +/* Caller is responsible for opening the file before and closing after. */ +EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); +EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); + +/* Data source and destination managers: memory buffers. */ +EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, + unsigned char ** outbuffer, + unsigned long * outsize)); +EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, + unsigned char * inbuffer, + unsigned long insize)); + +/* Default parameter setup for compression */ +EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); +/* Compression parameter setup aids */ +EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, + J_COLOR_SPACE colorspace)); +EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, + boolean force_baseline)); +EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, + int scale_factor, + boolean force_baseline)); +EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, + boolean force_baseline)); +EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, + boolean force_baseline)); +EXTERN(int) jpeg_quality_scaling JPP((int quality)); +EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, + boolean suppress)); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); + +/* Main entry points for compression */ +EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, + boolean write_all_tables)); +EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines)); +EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); + +/* Precalculate JPEG dimensions for current compression parameters. */ +EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); + +/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION num_lines)); + +/* Write a special marker. See libjpeg.txt concerning safe usage. */ +EXTERN(void) jpeg_write_marker + JPP((j_compress_ptr cinfo, int marker, + const JOCTET * dataptr, unsigned int datalen)); +/* Same, but piecemeal. */ +EXTERN(void) jpeg_write_m_header + JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); +EXTERN(void) jpeg_write_m_byte + JPP((j_compress_ptr cinfo, int val)); + +/* Alternate compression function: just write an abbreviated table file */ +EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); + +/* Decompression startup: read start of JPEG datastream to see what's there */ +EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, + boolean require_image)); +/* Return value is one of: */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +/* If you pass require_image = TRUE (normal case), you need not check for + * a TABLES_ONLY return code; an abbreviated file will cause an error exit. + * JPEG_SUSPENDED is only possible if you use a data source module that can + * give a suspension return (the stdio source module doesn't). + */ + +/* Main entry points for decompression */ +EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); +EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines)); +EXTERN(boolean) jpeg_finish_decompress JPP((j_decompress_ptr cinfo)); + +/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_read_raw_data JPP((j_decompress_ptr cinfo, + JSAMPIMAGE data, + JDIMENSION max_lines)); + +/* Additional entry points for buffered-image mode. */ +EXTERN(boolean) jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_start_output JPP((j_decompress_ptr cinfo, + int scan_number)); +EXTERN(boolean) jpeg_finish_output JPP((j_decompress_ptr cinfo)); +EXTERN(boolean) jpeg_input_complete JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); +EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); +/* Return value is one of: */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ + +/* Precalculate output dimensions for current decompression parameters. */ +EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); + +/* Control saving of COM and APPn markers into marker_list. */ +EXTERN(void) jpeg_save_markers + JPP((j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit)); + +/* Install a special processing method for COM or APPn markers. */ +EXTERN(void) jpeg_set_marker_processor + JPP((j_decompress_ptr cinfo, int marker_code, + jpeg_marker_parser_method routine)); + +/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo)); +EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo, + jvirt_barray_ptr * coef_arrays)); +EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo, + j_compress_ptr dstinfo)); + +/* If you choose to abort compression or decompression before completing + * jpeg_finish_(de)compress, then you need to clean up to release memory, + * temporary files, etc. You can just call jpeg_destroy_(de)compress + * if you're done with the JPEG object, but if you want to clean it up and + * reuse it, call this: + */ +EXTERN(void) jpeg_abort_compress JPP((j_compress_ptr cinfo)); +EXTERN(void) jpeg_abort_decompress JPP((j_decompress_ptr cinfo)); + +/* Generic versions of jpeg_abort and jpeg_destroy that work on either + * flavor of JPEG object. These may be more convenient in some places. + */ +EXTERN(void) jpeg_abort JPP((j_common_ptr cinfo)); +EXTERN(void) jpeg_destroy JPP((j_common_ptr cinfo)); + +/* Default restart-marker-resync procedure for use by data source modules */ +EXTERN(boolean) jpeg_resync_to_restart JPP((j_decompress_ptr cinfo, + int desired)); + + +/* These marker codes are exported since applications and data source modules + * are likely to want to use them. + */ + +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ + + +/* If we have a brain-damaged compiler that emits warnings (or worse, errors) + * for structure definitions that are never filled in, keep it quiet by + * supplying dummy definitions for the various substructures. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +struct jpeg_comp_master { long dummy; }; +struct jpeg_c_main_controller { long dummy; }; +struct jpeg_c_prep_controller { long dummy; }; +struct jpeg_c_coef_controller { long dummy; }; +struct jpeg_marker_writer { long dummy; }; +struct jpeg_color_converter { long dummy; }; +struct jpeg_downsampler { long dummy; }; +struct jpeg_forward_dct { long dummy; }; +struct jpeg_entropy_encoder { long dummy; }; +struct jpeg_decomp_master { long dummy; }; +struct jpeg_d_main_controller { long dummy; }; +struct jpeg_d_coef_controller { long dummy; }; +struct jpeg_d_post_controller { long dummy; }; +struct jpeg_input_controller { long dummy; }; +struct jpeg_marker_reader { long dummy; }; +struct jpeg_entropy_decoder { long dummy; }; +struct jpeg_inverse_dct { long dummy; }; +struct jpeg_upsampler { long dummy; }; +struct jpeg_color_deconverter { long dummy; }; +struct jpeg_color_quantizer { long dummy; }; +#endif /* JPEG_INTERNALS */ +#endif /* INCOMPLETE_TYPES_BROKEN */ + + +/* + * The JPEG library modules define JPEG_INTERNALS before including this file. + * The internal structure declarations are read only when that is true. + * Applications using the library should not include jpegint.h, but may wish + * to include jerror.h. + */ + +#ifdef JPEG_INTERNALS +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ +#endif + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +} +#endif +#endif + +#endif /* JPEGLIB_H */ diff --git a/cocos2dx/platform/third_party/emscripten/libpng/png.h.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libpng/png.h.REMOVED.git-id new file mode 100644 index 0000000000..0c3c1c5571 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libpng/png.h.REMOVED.git-id @@ -0,0 +1 @@ +9eada7d4389ece59576d53cff090fe5d9fc910e0 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libpng/pngconf.h b/cocos2dx/platform/third_party/emscripten/libpng/pngconf.h new file mode 100644 index 0000000000..6d1378f5f3 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libpng/pngconf.h @@ -0,0 +1,1552 @@ + +/* pngconf.h - machine configurable file for libpng + * + * libpng version 1.4.12 - July 10, 2012 + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) + * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * + * This code is released under the libpng license. + * For conditions of distribution and use, see the disclaimer + * and license in png.h + * + */ + +/* Any machine specific code is near the front of this file, so if you + * are configuring libpng for a machine, you may want to read the section + * starting here down to where it starts to typedef png_color, png_text, + * and png_info. + */ + +#ifndef PNGCONF_H +#define PNGCONF_H + +#ifndef PNG_NO_LIMITS_H +# include +#endif + +/* Added at libpng-1.2.9 */ + +/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" + * script. + */ +#ifdef PNG_CONFIGURE_LIBPNG +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif +#endif + +/* + * Added at libpng-1.2.8 + * + * PNG_USER_CONFIG has to be defined on the compiler command line. This + * includes the resource compiler for Windows DLL configurations. + */ +#ifdef PNG_USER_CONFIG +# include "pngusr.h" +# ifndef PNG_USER_PRIVATEBUILD +# define PNG_USER_PRIVATEBUILD +# endif +#endif + +/* + * If you create a private DLL you should define in "pngusr.h" the following: + * #define PNG_USER_PRIVATEBUILD + * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." + * #define PNG_USER_DLLFNAME_POSTFIX + * e.g. // private DLL "libpng14gx.dll" + * #define PNG_USER_DLLFNAME_POSTFIX "gx" + * + * The following macros are also at your disposal if you want to complete the + * DLL VERSIONINFO structure. + * - PNG_USER_VERSIONINFO_COMMENTS + * - PNG_USER_VERSIONINFO_COMPANYNAME + * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS + */ + +#ifdef __STDC__ +# ifdef SPECIALBUILD +# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ + are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") +# endif + +# ifdef PRIVATEBUILD +# pragma message("PRIVATEBUILD is deprecated.\ + Use PNG_USER_PRIVATEBUILD instead.") +# define PNG_USER_PRIVATEBUILD PRIVATEBUILD +# endif +#endif /* __STDC__ */ + +/* End of material added to libpng-1.2.8 */ + +/* Added at libpng-1.4.6 */ +#ifndef PNG_UNUSED +/* Unused formal parameter warnings are silenced using the following macro + * which is expected to have no bad effects on performance (optimizing + * compilers will probably remove it entirely). Note that if you replace + * it with something other than whitespace, you must include the terminating + * semicolon. + */ +# define PNG_UNUSED(param) (void)param; +#endif +/* End of material added to libpng-1.4.6 */ + +#ifndef PNG_VERSION_INFO_ONLY + +/* This is the size of the compression buffer, and thus the size of + * an IDAT chunk. Make this whatever size you feel is best for your + * machine. One of these will be allocated per png_struct. When this + * is full, it writes the data to the disk, and does some other + * calculations. Making this an extremely small size will slow + * the library down, but you may want to experiment to determine + * where it becomes significant, if you are concerned with memory + * usage. Note that zlib allocates at least 32Kb also. For readers, + * this describes the size of the buffer available to read the data in. + * Unless this gets smaller than the size of a row (compressed), + * it should not make much difference how big this is. + */ + +#ifndef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 8192 +#endif + +/* Enable if you want a write-only libpng */ + +#ifndef PNG_NO_READ_SUPPORTED +# define PNG_READ_SUPPORTED +#endif + +/* Enable if you want a read-only libpng */ + +#ifndef PNG_NO_WRITE_SUPPORTED +# define PNG_WRITE_SUPPORTED +#endif + +/* Enabled in 1.4.0. */ +#ifdef PNG_ALLOW_BENIGN_ERRORS +# define png_benign_error png_warning +# define png_chunk_benign_error png_chunk_warning +#else +# ifndef PNG_BENIGN_ERRORS_SUPPORTED +# define png_benign_error png_error +# define png_chunk_benign_error png_chunk_error +# endif +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED) +# define PNG_WARNINGS_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED) +# define PNG_ERROR_TEXT_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED) +# define PNG_CHECK_cHRM_SUPPORTED +#endif + +/* Added at libpng version 1.4.0 */ +#if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED) +# define PNG_ALIGNED_MEMORY_SUPPORTED +#endif + +/* Enabled by default in 1.2.0. You can disable this if you don't need to + support PNGs that are embedded in MNG datastreams */ +#ifndef PNG_NO_MNG_FEATURES +# ifndef PNG_MNG_FEATURES_SUPPORTED +# define PNG_MNG_FEATURES_SUPPORTED +# endif +#endif + +/* Added at libpng version 1.4.0 */ +#ifndef PNG_NO_FLOATING_POINT_SUPPORTED +# ifndef PNG_FLOATING_POINT_SUPPORTED +# define PNG_FLOATING_POINT_SUPPORTED +# endif +#endif + +/* Added at libpng-1.4.0beta49 for testing (this test is no longer used + in libpng and png_calloc() is always present) + */ +#define PNG_CALLOC_SUPPORTED + +/* If you are running on a machine where you cannot allocate more + * than 64K of memory at once, uncomment this. While libpng will not + * normally need that much memory in a chunk (unless you load up a very + * large file), zlib needs to know how big of a chunk it can use, and + * libpng thus makes sure to check any memory allocation to verify it + * will fit into memory. +#define PNG_MAX_MALLOC_64K + */ +#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) +# define PNG_MAX_MALLOC_64K +#endif + +/* Special munging to support doing things the 'cygwin' way: + * 'Normal' png-on-win32 defines/defaults: + * PNG_BUILD_DLL -- building dll + * PNG_USE_DLL -- building an application, linking to dll + * (no define) -- building static library, or building an + * application and linking to the static lib + * 'Cygwin' defines/defaults: + * PNG_BUILD_DLL -- (ignored) building the dll + * (no define) -- (ignored) building an application, linking to the dll + * PNG_STATIC -- (ignored) building the static lib, or building an + * application that links to the static lib. + * ALL_STATIC -- (ignored) building various static libs, or building an + * application that links to the static libs. + * Thus, + * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and + * this bit of #ifdefs will define the 'correct' config variables based on + * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but + * unnecessary. + * + * Also, the precedence order is: + * ALL_STATIC (since we can't #undef something outside our namespace) + * PNG_BUILD_DLL + * PNG_STATIC + * (nothing) == PNG_USE_DLL + * + * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent + * of auto-import in binutils, we no longer need to worry about + * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, + * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes + * to __declspec() stuff. However, we DO need to worry about + * PNG_BUILD_DLL and PNG_STATIC because those change some defaults + * such as CONSOLE_IO. + */ +#ifdef __CYGWIN__ +# ifdef ALL_STATIC +# ifdef PNG_BUILD_DLL +# undef PNG_BUILD_DLL +# endif +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifdef PNG_DLL +# undef PNG_DLL +# endif +# ifndef PNG_STATIC +# define PNG_STATIC +# endif +# else +# ifdef PNG_BUILD_DLL +# ifdef PNG_STATIC +# undef PNG_STATIC +# endif +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifndef PNG_DLL +# define PNG_DLL +# endif +# else +# ifdef PNG_STATIC +# ifdef PNG_USE_DLL +# undef PNG_USE_DLL +# endif +# ifdef PNG_DLL +# undef PNG_DLL +# endif +# else +# ifndef PNG_USE_DLL +# define PNG_USE_DLL +# endif +# ifndef PNG_DLL +# define PNG_DLL +# endif +# endif +# endif +# endif +#endif + +/* This protects us against compilers that run on a windowing system + * and thus don't have or would rather us not use the stdio types: + * stdin, stdout, and stderr. The only one currently used is stderr + * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will + * prevent these from being compiled and used. #defining PNG_NO_STDIO + * will also prevent these, plus will prevent the entire set of stdio + * macros and functions (FILE *, printf, etc.) from being compiled and used, + * unless (PNG_DEBUG > 0) has been #defined. + * + * #define PNG_NO_CONSOLE_IO + * #define PNG_NO_STDIO + */ + +#ifdef _WIN32_WCE +# define PNG_NO_CONSOLE_IO +# define PNG_NO_STDIO +# define PNG_NO_TIME_RFC1123 +# ifdef PNG_DEBUG +# undef PNG_DEBUG +# endif +#endif + +#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED) +# define PNG_STDIO_SUPPORTED +#endif + +#ifdef PNG_BUILD_DLL +# if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO) +# define PNG_NO_CONSOLE_IO +# endif +#endif + +# ifdef PNG_NO_STDIO +# ifndef PNG_NO_CONSOLE_IO +# define PNG_NO_CONSOLE_IO +# endif +# ifdef PNG_DEBUG +# if (PNG_DEBUG > 0) +# include +# endif +# endif +# else +# include +# endif + +#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED) +# define PNG_CONSOLE_IO_SUPPORTED +#endif + +/* This macro protects us against machines that don't have function + * prototypes (ie K&R style headers). If your compiler does not handle + * function prototypes, define this macro and use the included ansi2knr. + * I've always been able to use _NO_PROTO as the indicator, but you may + * need to drag the empty declaration out in front of here, or change the + * ifdef to suit your own needs. + */ +#ifndef PNGARG + +#ifdef OF /* zlib prototype munger */ +# define PNGARG(arglist) OF(arglist) +#else + +#ifdef _NO_PROTO +# define PNGARG(arglist) () +#else +# define PNGARG(arglist) arglist +#endif /* _NO_PROTO */ + +#endif /* OF */ + +#endif /* PNGARG */ + +/* Try to determine if we are compiling on a Mac. Note that testing for + * just __MWERKS__ is not good enough, because the Codewarrior is now used + * on non-Mac platforms. + */ +#ifndef MACOS +# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ + defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) +# define MACOS +# endif +#endif + +/* Enough people need this for various reasons to include it here */ +#if !defined(MACOS) && !defined(RISCOS) +# include +#endif + +/* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */ +#if !defined(PNG_NO_SETJMP) && \ + !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) +# define PNG_SETJMP_SUPPORTED +#endif + +#ifdef PNG_SETJMP_SUPPORTED +/* This is an attempt to force a single setjmp behaviour on Linux. If + * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. + * + * You can bypass this test if you know that your application uses exactly + * the same setjmp.h that was included when libpng was built. Only define + * PNG_SKIP_SETJMP_CHECK while building your application, prior to the + * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK + * while building a separate libpng library for general use. + */ + +# ifndef PNG_SKIP_SETJMP_CHECK +# ifdef __linux__ +# ifdef _BSD_SOURCE +# define PNG_SAVE_BSD_SOURCE +# undef _BSD_SOURCE +# endif +# ifdef _SETJMP_H + /* If you encounter a compiler error here, see the explanation + * near the end of INSTALL. + */ + __pngconf.h__ in libpng already includes setjmp.h; + __dont__ include it again.; +# endif +# endif /* __linux__ */ +# endif /* PNG_SKIP_SETJMP_CHECK */ + + /* Include setjmp.h for error handling */ +# include + +# ifdef __linux__ +# ifdef PNG_SAVE_BSD_SOURCE +# ifdef _BSD_SOURCE +# undef _BSD_SOURCE +# endif +# define _BSD_SOURCE +# undef PNG_SAVE_BSD_SOURCE +# endif +# endif /* __linux__ */ +#endif /* PNG_SETJMP_SUPPORTED */ + +#ifdef BSD +# include +#else +# include +#endif + +/* Other defines for things like memory and the like can go here. */ + +/* This controls how fine the quantizing gets. As this allocates + * a largish chunk of memory (32K), those who are not as concerned + * with quantizing quality can decrease some or all of these. + */ + +/* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS + * These migration aids will be removed from libpng-1.5.0. + */ +#ifdef PNG_DITHER_RED_BITS +# define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS +#endif +#ifdef PNG_DITHER_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS +#endif +#ifdef PNG_DITHER_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS +#endif + +#ifndef PNG_QUANTIZE_RED_BITS +# define PNG_QUANTIZE_RED_BITS 5 +#endif +#ifndef PNG_QUANTIZE_GREEN_BITS +# define PNG_QUANTIZE_GREEN_BITS 5 +#endif +#ifndef PNG_QUANTIZE_BLUE_BITS +# define PNG_QUANTIZE_BLUE_BITS 5 +#endif + +/* This controls how fine the gamma correction becomes when you + * are only interested in 8 bits anyway. Increasing this value + * results in more memory being used, and more pow() functions + * being called to fill in the gamma tables. Don't set this value + * less then 8, and even that may not work (I haven't tested it). + */ + +#ifndef PNG_MAX_GAMMA_8 +# define PNG_MAX_GAMMA_8 11 +#endif + +/* This controls how much a difference in gamma we can tolerate before + * we actually start doing gamma conversion. + */ +#ifndef PNG_GAMMA_THRESHOLD +# define PNG_GAMMA_THRESHOLD 0.05 +#endif + +/* The following uses const char * instead of char * for error + * and warning message functions, so some compilers won't complain. + * If you do not want to use const, define PNG_NO_CONST. + */ + +#ifndef PNG_CONST +# ifndef PNG_NO_CONST +# define PNG_CONST const +# else +# define PNG_CONST +# endif +#endif + +/* The following defines give you the ability to remove code from the + * library that you will not be using. I wish I could figure out how to + * automate this, but I can't do that without making it seriously hard + * on the users. So if you are not using an ability, change the #define + * to an #undef, or pass in PNG_NO_feature and that part of the library + * will not be compiled. + + * If your linker can't find a function, you may want to make sure the + * ability is defined here. Some of these depend upon some others being + * defined. I haven't figured out all the interactions here, so you may + * have to experiment awhile to get everything to compile. If you are + * creating or using a shared library, you probably shouldn't touch this, + * as it will affect the size of the structures, and this will cause bad + * things to happen if the library and/or application ever change. + */ + +/* Any features you will not be using can be undef'ed here */ + +/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user + * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line, + * then pick and choose which ones to define without having to edit this + * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS + * if you only want to have a png-compliant reader/writer but don't need + * any of the extra transformations. This saves about 80 kbytes in a + * typical installation of the library. (PNG_NO_* form added in version + * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in + * 1.4.0) + */ + +/* Ignore attempt to turn off both floating and fixed point support */ +#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ + !defined(PNG_NO_FIXED_POINT_SUPPORTED) +# define PNG_FIXED_POINT_SUPPORTED +#endif + +#ifdef PNG_READ_SUPPORTED + +/* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_TRANSFORMS) +# define PNG_READ_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_READ_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_READ_EXPAND +# define PNG_READ_EXPAND_SUPPORTED +# endif +# ifndef PNG_NO_READ_SHIFT +# define PNG_READ_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACK +# define PNG_READ_PACK_SUPPORTED +# endif +# ifndef PNG_NO_READ_BGR +# define PNG_READ_BGR_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP +# define PNG_READ_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_PACKSWAP +# define PNG_READ_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT +# define PNG_READ_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_READ_QUANTIZE + /* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */ +# ifndef PNG_NO_READ_DITHER /* This migration aid will be removed */ +# define PNG_READ_QUANTIZE_SUPPORTED +# endif +# endif +# ifndef PNG_NO_READ_BACKGROUND +# define PNG_READ_BACKGROUND_SUPPORTED +# endif +# ifndef PNG_NO_READ_16_TO_8 +# define PNG_READ_16_TO_8_SUPPORTED +# endif +# ifndef PNG_NO_READ_FILLER +# define PNG_READ_FILLER_SUPPORTED +# endif +# ifndef PNG_NO_READ_GAMMA +# define PNG_READ_GAMMA_SUPPORTED +# endif +# ifndef PNG_NO_READ_GRAY_TO_RGB +# define PNG_READ_GRAY_TO_RGB_SUPPORTED +# endif +# ifndef PNG_NO_READ_SWAP_ALPHA +# define PNG_READ_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_INVERT_ALPHA +# define PNG_READ_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_STRIP_ALPHA +# define PNG_READ_STRIP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_READ_USER_TRANSFORM +# define PNG_READ_USER_TRANSFORM_SUPPORTED +# endif +# ifndef PNG_NO_READ_RGB_TO_GRAY +# define PNG_READ_RGB_TO_GRAY_SUPPORTED +# endif +#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ + +/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_NO_PROGRESSIVE_READ) && \ + !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ +# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ +#endif /* about interlacing capability! You'll */ + /* still have interlacing unless you change the following define: */ + +#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ + +/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */ +#if !defined(PNG_NO_SEQUENTIAL_READ) && \ + !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \ + !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED) +# define PNG_SEQUENTIAL_READ_SUPPORTED +#endif + +#ifndef PNG_NO_READ_COMPOSITE_NODIV +# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ +# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ +# endif +#endif + +#if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \ + defined(PNG_READ_pCAL_SUPPORTED) +# ifndef PNG_GET_INT_32_SUPPORTED +# define PNG_GET_INT_32_SUPPORTED +# endif +#endif + +#endif /* PNG_READ_SUPPORTED */ + +#ifdef PNG_WRITE_SUPPORTED + +/* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */ +#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_TRANSFORMS) +# define PNG_WRITE_TRANSFORMS_SUPPORTED +#endif + +#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED +# ifndef PNG_NO_WRITE_SHIFT +# define PNG_WRITE_SHIFT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACK +# define PNG_WRITE_PACK_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_BGR +# define PNG_WRITE_BGR_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_SWAP +# define PNG_WRITE_SWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_PACKSWAP +# define PNG_WRITE_PACKSWAP_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT +# define PNG_WRITE_INVERT_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_FILLER +# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ +# endif +# ifndef PNG_NO_WRITE_SWAP_ALPHA +# define PNG_WRITE_SWAP_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_INVERT_ALPHA +# define PNG_WRITE_INVERT_ALPHA_SUPPORTED +# endif +# ifndef PNG_NO_WRITE_USER_TRANSFORM +# define PNG_WRITE_USER_TRANSFORM_SUPPORTED +# endif +#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ + +#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ + !defined(PNG_WRITE_INTERLACING_SUPPORTED) + /* This is not required for PNG-compliant encoders, but can cause + * trouble if left undefined + */ +# define PNG_WRITE_INTERLACING_SUPPORTED +#endif + +#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ + !defined(PNG_WRITE_WEIGHTED_FILTER) && \ + defined(PNG_FLOATING_POINT_SUPPORTED) +# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED +#endif + +#ifndef PNG_NO_WRITE_FLUSH +# define PNG_WRITE_FLUSH_SUPPORTED +#endif + +#if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \ + defined(PNG_WRITE_pCAL_SUPPORTED) +# ifndef PNG_SAVE_INT_32_SUPPORTED +# define PNG_SAVE_INT_32_SUPPORTED +# endif +#endif + +#endif /* PNG_WRITE_SUPPORTED */ + +#define PNG_NO_ERROR_NUMBERS + +#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ + defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) +# ifndef PNG_NO_USER_TRANSFORM_PTR +# define PNG_USER_TRANSFORM_PTR_SUPPORTED +# endif +#endif + +#if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED) +# define PNG_TIME_RFC1123_SUPPORTED +#endif + +/* This adds extra functions in pngget.c for accessing data from the + * info pointer (added in version 0.99) + * png_get_image_width() + * png_get_image_height() + * png_get_bit_depth() + * png_get_color_type() + * png_get_compression_type() + * png_get_filter_type() + * png_get_interlace_type() + * png_get_pixel_aspect_ratio() + * png_get_pixels_per_meter() + * png_get_x_offset_pixels() + * png_get_y_offset_pixels() + * png_get_x_offset_microns() + * png_get_y_offset_microns() + */ +#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) +# define PNG_EASY_ACCESS_SUPPORTED +#endif + +/* Added at libpng-1.2.0 */ +#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) +# define PNG_USER_MEM_SUPPORTED +#endif + +/* Added at libpng-1.2.6 */ +#ifndef PNG_NO_SET_USER_LIMITS +# ifndef PNG_SET_USER_LIMITS_SUPPORTED +# define PNG_SET_USER_LIMITS_SUPPORTED +# endif + /* Feature added at libpng-1.4.0, this flag added at 1.4.1 */ +# ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +# define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED +# endif + /* Feature added at libpng-1.4.1, this flag added at 1.4.1 */ +# ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +# define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED +# endif +#endif + +/* Added at libpng-1.2.43 */ +#ifndef PNG_USER_LIMITS_SUPPORTED +# ifndef PNG_NO_USER_LIMITS +# define PNG_USER_LIMITS_SUPPORTED +# endif +#endif + +/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter + * how large, set these two limits to 0x7fffffffL + */ +#ifndef PNG_USER_WIDTH_MAX +# define PNG_USER_WIDTH_MAX 1000000L +#endif +#ifndef PNG_USER_HEIGHT_MAX +# define PNG_USER_HEIGHT_MAX 1000000L +#endif + +/* Added at libpng-1.2.43. To accept all valid PNGs no matter + * how large, set these two limits to 0. + */ +#ifndef PNG_USER_CHUNK_CACHE_MAX +# define PNG_USER_CHUNK_CACHE_MAX 0 +#endif + +/* Added at libpng-1.2.43 */ +#ifndef PNG_USER_CHUNK_MALLOC_MAX +# define PNG_USER_CHUNK_MALLOC_MAX 0 +#endif + +/* Added at libpng-1.4.0 */ +#if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED) +# define PNG_IO_STATE_SUPPORTED +#endif + +#ifndef PNG_LITERAL_SHARP +# define PNG_LITERAL_SHARP 0x23 +#endif +#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET +# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b +#endif +#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET +# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d +#endif +#ifndef PNG_STRING_NEWLINE +#define PNG_STRING_NEWLINE "\n" +#endif + +/* These are currently experimental features, define them if you want */ + +/* Very little testing */ +/* +#ifdef PNG_READ_SUPPORTED +# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED +# endif +#endif +*/ + +/* This is only for PowerPC big-endian and 680x0 systems */ +/* some testing */ +/* +#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED +# define PNG_READ_BIG_ENDIAN_SUPPORTED +#endif +*/ + +#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) +# define PNG_USE_READ_MACROS +#endif + +/* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */ + +#if !defined(PNG_NO_POINTER_INDEXING) && \ + !defined(PNG_POINTER_INDEXING_SUPPORTED) +# define PNG_POINTER_INDEXING_SUPPORTED +#endif + + +/* Any chunks you are not interested in, you can undef here. The + * ones that allocate memory may be expecially important (hIST, + * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info + * a bit smaller. + */ + +/* The size of the png_text structure changed in libpng-1.0.6 when + * iTXt support was added. iTXt support was turned off by default through + * libpng-1.2.x, to support old apps that malloc the png_text structure + * instead of calling png_set_text() and letting libpng malloc it. It + * was turned on by default in libpng-1.4.0. + */ + +/* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ +#if defined(PNG_READ_SUPPORTED) && \ + !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_READ_ANCILLARY_CHUNKS) +# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED +#endif + +/* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ +#if defined(PNG_WRITE_SUPPORTED) && \ + !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ + !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) +# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED +#endif + +#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_READ_TEXT +# define PNG_NO_READ_iTXt +# define PNG_NO_READ_tEXt +# define PNG_NO_READ_zTXt +#endif + +#ifndef PNG_NO_READ_bKGD +# define PNG_READ_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +#endif +#ifndef PNG_NO_READ_cHRM +# define PNG_READ_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +#endif +#ifndef PNG_NO_READ_gAMA +# define PNG_READ_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +#endif +#ifndef PNG_NO_READ_hIST +# define PNG_READ_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +#endif +#ifndef PNG_NO_READ_iCCP +# define PNG_READ_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +#endif +#ifndef PNG_NO_READ_iTXt +# ifndef PNG_READ_iTXt_SUPPORTED +# define PNG_READ_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_oFFs +# define PNG_READ_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +#endif +#ifndef PNG_NO_READ_pCAL +# define PNG_READ_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_sCAL +# define PNG_READ_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +#endif +#ifndef PNG_NO_READ_pHYs +# define PNG_READ_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +#endif +#ifndef PNG_NO_READ_sBIT +# define PNG_READ_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sPLT +# define PNG_READ_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +#endif +#ifndef PNG_NO_READ_sRGB +# define PNG_READ_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +#endif +#ifndef PNG_NO_READ_tEXt +# define PNG_READ_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_tIME +# define PNG_READ_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +#endif +#ifndef PNG_NO_READ_tRNS +# define PNG_READ_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +#endif +#ifndef PNG_NO_READ_zTXt +# define PNG_READ_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +#endif +#ifndef PNG_NO_READ_OPT_PLTE +# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ +#endif /* optional PLTE chunk in RGB and RGBA images */ +#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ + defined(PNG_READ_zTXt_SUPPORTED) +# define PNG_READ_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +#endif + +#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifndef PNG_NO_READ_UNKNOWN_CHUNKS +# ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +# ifndef PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_READ_USER_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_READ_USER_CHUNKS +# ifndef PNG_READ_USER_CHUNKS_SUPPORTED +# define PNG_READ_USER_CHUNKS_SUPPORTED +# endif +# ifndef PNG_USER_CHUNKS_SUPPORTED +# define PNG_USER_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif + +#ifdef PNG_WRITE_SUPPORTED +#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED + +#ifdef PNG_NO_WRITE_TEXT +# define PNG_NO_WRITE_iTXt +# define PNG_NO_WRITE_tEXt +# define PNG_NO_WRITE_zTXt +#endif +#ifndef PNG_NO_WRITE_bKGD +# define PNG_WRITE_bKGD_SUPPORTED +# ifndef PNG_bKGD_SUPPORTED +# define PNG_bKGD_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_cHRM +# define PNG_WRITE_cHRM_SUPPORTED +# ifndef PNG_cHRM_SUPPORTED +# define PNG_cHRM_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_gAMA +# define PNG_WRITE_gAMA_SUPPORTED +# ifndef PNG_gAMA_SUPPORTED +# define PNG_gAMA_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_hIST +# define PNG_WRITE_hIST_SUPPORTED +# ifndef PNG_hIST_SUPPORTED +# define PNG_hIST_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iCCP +# define PNG_WRITE_iCCP_SUPPORTED +# ifndef PNG_iCCP_SUPPORTED +# define PNG_iCCP_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_iTXt +# ifndef PNG_WRITE_iTXt_SUPPORTED +# define PNG_WRITE_iTXt_SUPPORTED +# endif +# ifndef PNG_iTXt_SUPPORTED +# define PNG_iTXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_oFFs +# define PNG_WRITE_oFFs_SUPPORTED +# ifndef PNG_oFFs_SUPPORTED +# define PNG_oFFs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pCAL +# define PNG_WRITE_pCAL_SUPPORTED +# ifndef PNG_pCAL_SUPPORTED +# define PNG_pCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sCAL +# define PNG_WRITE_sCAL_SUPPORTED +# ifndef PNG_sCAL_SUPPORTED +# define PNG_sCAL_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_pHYs +# define PNG_WRITE_pHYs_SUPPORTED +# ifndef PNG_pHYs_SUPPORTED +# define PNG_pHYs_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sBIT +# define PNG_WRITE_sBIT_SUPPORTED +# ifndef PNG_sBIT_SUPPORTED +# define PNG_sBIT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sPLT +# define PNG_WRITE_sPLT_SUPPORTED +# ifndef PNG_sPLT_SUPPORTED +# define PNG_sPLT_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_sRGB +# define PNG_WRITE_sRGB_SUPPORTED +# ifndef PNG_sRGB_SUPPORTED +# define PNG_sRGB_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tEXt +# define PNG_WRITE_tEXt_SUPPORTED +# ifndef PNG_tEXt_SUPPORTED +# define PNG_tEXt_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tIME +# define PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_tIME_SUPPORTED +# define PNG_tIME_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_tRNS +# define PNG_WRITE_tRNS_SUPPORTED +# ifndef PNG_tRNS_SUPPORTED +# define PNG_tRNS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_WRITE_zTXt +# define PNG_WRITE_zTXt_SUPPORTED +# ifndef PNG_zTXt_SUPPORTED +# define PNG_zTXt_SUPPORTED +# endif +#endif +#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ + defined(PNG_WRITE_zTXt_SUPPORTED) +# define PNG_WRITE_TEXT_SUPPORTED +# ifndef PNG_TEXT_SUPPORTED +# define PNG_TEXT_SUPPORTED +# endif +#endif + +#ifdef PNG_WRITE_tIME_SUPPORTED +# ifndef PNG_NO_CONVERT_tIME +# ifndef _WIN32_WCE +/* The "tm" structure is not supported on WindowsCE */ +# ifndef PNG_CONVERT_tIME_SUPPORTED +# define PNG_CONVERT_tIME_SUPPORTED +# endif +# endif +# endif +#endif + +#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ + +#ifndef PNG_NO_WRITE_FILTER +# ifndef PNG_WRITE_FILTER_SUPPORTED +# define PNG_WRITE_FILTER_SUPPORTED +# endif +#endif + +#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS +# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED +# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED +# define PNG_UNKNOWN_CHUNKS_SUPPORTED +# endif +#endif +#ifndef PNG_NO_HANDLE_AS_UNKNOWN +# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED +# endif +#endif +#endif /* PNG_WRITE_SUPPORTED */ + +/* Turn this off to disable png_read_png() and + * png_write_png() and leave the row_pointers member + * out of the info structure. + */ +#ifndef PNG_NO_INFO_IMAGE +# define PNG_INFO_IMAGE_SUPPORTED +#endif + +/* Need the time information for converting tIME chunks */ +#ifdef PNG_CONVERT_tIME_SUPPORTED + /* "time.h" functions are not supported on WindowsCE */ +# include +#endif + +/* Some typedefs to get us started. These should be safe on most of the + * common platforms. The typedefs should be at least as large as the + * numbers suggest (a png_uint_32 must be at least 32 bits long), but they + * don't have to be exactly that size. Some compilers dislike passing + * unsigned shorts as function parameters, so you may be better off using + * unsigned int for png_uint_16. + */ + +#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL) +typedef unsigned int png_uint_32; +typedef int png_int_32; +#else +typedef unsigned long png_uint_32; +typedef long png_int_32; +#endif +typedef unsigned short png_uint_16; +typedef short png_int_16; +typedef unsigned char png_byte; + +#ifdef PNG_NO_SIZE_T + typedef unsigned int png_size_t; +#else + typedef size_t png_size_t; +#endif +#define png_sizeof(x) (sizeof (x)) + +/* The following is needed for medium model support. It cannot be in the + * pngpriv.h header. Needs modification for other compilers besides + * MSC. Model independent support declares all arrays and pointers to be + * large using the far keyword. The zlib version used must also support + * model independent data. As of version zlib 1.0.4, the necessary changes + * have been made in zlib. The USE_FAR_KEYWORD define triggers other + * changes that are needed. (Tim Wegner) + */ + +/* Separate compiler dependencies (problem here is that zlib.h always + * defines FAR. (SJT) + */ +#ifdef __BORLANDC__ +# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) +# define LDATA 1 +# else +# define LDATA 0 +# endif + /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ +# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) +# define PNG_MAX_MALLOC_64K +# if (LDATA != 1) +# ifndef FAR +# define FAR __far +# endif +# define USE_FAR_KEYWORD +# endif /* LDATA != 1 */ + /* Possibly useful for moving data out of default segment. + * Uncomment it if you want. Could also define FARDATA as + * const if your compiler supports it. (SJT) +# define FARDATA FAR + */ +# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ +#endif /* __BORLANDC__ */ + + +/* Suggest testing for specific compiler first before testing for + * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, + * making reliance oncertain keywords suspect. (SJT) + */ + +/* MSC Medium model */ +#ifdef FAR +# ifdef M_I86MM +# define USE_FAR_KEYWORD +# define FARDATA FAR +# include +# endif +#endif + +/* SJT: default case */ +#ifndef FAR +# define FAR +#endif + +/* At this point FAR is always defined */ +#ifndef FARDATA +# define FARDATA +#endif + +/* Typedef for floating-point numbers that are converted + to fixed-point with a multiple of 100,000, e.g., int_gamma */ +typedef png_int_32 png_fixed_point; + +/* Add typedefs for pointers */ +typedef void FAR * png_voidp; +typedef png_byte FAR * png_bytep; +typedef png_uint_32 FAR * png_uint_32p; +typedef png_int_32 FAR * png_int_32p; +typedef png_uint_16 FAR * png_uint_16p; +typedef png_int_16 FAR * png_int_16p; +typedef PNG_CONST char FAR * png_const_charp; +typedef char FAR * png_charp; +typedef png_fixed_point FAR * png_fixed_point_p; + +#ifndef PNG_NO_STDIO +typedef FILE * png_FILE_p; +#endif + +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * png_doublep; +#endif + +/* Pointers to pointers; i.e. arrays */ +typedef png_byte FAR * FAR * png_bytepp; +typedef png_uint_32 FAR * FAR * png_uint_32pp; +typedef png_int_32 FAR * FAR * png_int_32pp; +typedef png_uint_16 FAR * FAR * png_uint_16pp; +typedef png_int_16 FAR * FAR * png_int_16pp; +typedef PNG_CONST char FAR * FAR * png_const_charpp; +typedef char FAR * FAR * png_charpp; +typedef png_fixed_point FAR * FAR * png_fixed_point_pp; +#ifdef PNG_FLOATING_POINT_SUPPORTED +typedef double FAR * FAR * png_doublepp; +#endif + +/* Pointers to pointers to pointers; i.e., pointer to array */ +typedef char FAR * FAR * FAR * png_charppp; + +/* Define PNG_BUILD_DLL if the module being built is a Windows + * LIBPNG DLL. + * + * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. + * It is equivalent to Microsoft predefined macro _DLL that is + * automatically defined when you compile using the share + * version of the CRT (C Run-Time library) + * + * The cygwin mods make this behavior a little different: + * Define PNG_BUILD_DLL if you are building a dll for use with cygwin + * Define PNG_STATIC if you are building a static library for use with cygwin, + * -or- if you are building an application that you want to link to the + * static library. + * PNG_USE_DLL is defined by default (no user action needed) unless one of + * the other flags is defined. + */ + +#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) +# define PNG_DLL +#endif + +/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", + * you may get warnings regarding the linkage of png_zalloc and png_zfree. + * Don't ignore those warnings; you must also reset the default calling + * convention in your compiler to match your PNGAPI, and you must build + * zlib and your applications the same way you build libpng. + */ + +#ifdef __CYGWIN__ +# undef PNGAPI +# define PNGAPI __cdecl +# undef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifdef __WATCOMC__ +# ifndef PNGAPI +# define PNGAPI +# endif +#endif + +#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) +# ifndef PNG_NO_MODULEDEF +# define PNG_NO_MODULEDEF +# endif +#endif + +#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) +# define PNG_IMPEXP +#endif + +#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ + (( defined(_Windows) || defined(_WINDOWS) || \ + defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) + +# ifndef PNGAPI +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# define PNGAPI __cdecl +# else +# define PNGAPI _cdecl +# endif +# endif + +# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ + 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) +# define PNG_IMPEXP +# endif + +# ifndef PNG_IMPEXP + +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol + + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif + +# ifndef PNG_IMPEXP +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif +# endif /* PNG_IMPEXP */ +#else /* !(DLL || non-cygwin WINDOWS) */ +# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) +# ifndef PNGAPI +# define PNGAPI _System +# endif +# else +# if 0 /* ... other platforms, with other meanings */ +# endif +# endif +#endif + +#ifndef PNGAPI +# define PNGAPI +#endif +#ifndef PNG_IMPEXP +# define PNG_IMPEXP +#endif + +#ifdef PNG_BUILDSYMS +# ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END +# endif +#endif + +#ifndef PNG_EXPORT +# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol +#endif + +#define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */ + +/* Support for compiler specific function attributes. These are used + * so that where compiler support is available incorrect use of API + * functions in png.h will generate compiler warnings. + * + * Added at libpng-1.2.41. + */ + +#ifndef PNG_NO_PEDANTIC_WARNINGS +# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED +# define PNG_PEDANTIC_WARNINGS_SUPPORTED +# endif +#endif + +#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED +/* Support for compiler specific function attributes. These are used + * so that where compiler support is available incorrect use of API + * functions in png.h will generate compiler warnings. Added at libpng + * version 1.2.41. + */ +# ifdef __GNUC__ +# ifndef PNG_USE_RESULT +# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) +# endif +# ifndef PNG_NORETURN +# define PNG_NORETURN __attribute__((__noreturn__)) +# endif +# ifndef PNG_ALLOCATED +# define PNG_ALLOCATED __attribute__((__malloc__)) +# endif +# ifndef PNG_DEPRECATED +# define PNG_DEPRECATED __attribute__((__deprecated__)) +# endif + + /* This specifically protects structure members that should only be + * accessed from within the library, therefore should be empty during + * a library build. + */ +# ifndef PNG_DEPSTRUCT +# define PNG_DEPSTRUCT __attribute__((__deprecated__)) +# endif +# ifndef PNG_PRIVATE +# if 0 /* Doesn't work so we use deprecated instead*/ +# define PNG_PRIVATE \ + __attribute__((warning("This function is not exported by libpng."))) +# else +# define PNG_PRIVATE \ + __attribute__((__deprecated__)) +# endif +# endif /* PNG_PRIVATE */ +# endif /* __GNUC__ */ +#endif /* PNG_PEDANTIC_WARNINGS */ + +#ifndef PNG_DEPRECATED +# define PNG_DEPRECATED /* Use of this function is deprecated */ +#endif +#ifndef PNG_USE_RESULT +# define PNG_USE_RESULT /* The result of this function must be checked */ +#endif +#ifndef PNG_NORETURN +# define PNG_NORETURN /* This function does not return */ +#endif +#ifndef PNG_ALLOCATED +# define PNG_ALLOCATED /* The result of the function is new memory */ +#endif +#ifndef PNG_DEPSTRUCT +# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */ +#endif +#ifndef PNG_PRIVATE +# define PNG_PRIVATE /* This is a private libpng function */ +#endif + +/* Users may want to use these so they are not private. Any library + * functions that are passed far data must be model-independent. + */ + +/* memory model/platform independent fns */ +#ifndef PNG_ABORT +# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) +# define PNG_ABORT() ExitProcess(0) +# else +# define PNG_ABORT() abort() +# endif +#endif + +#ifdef USE_FAR_KEYWORD +/* Use this to make far-to-near assignments */ +# define CHECK 1 +# define NOCHECK 0 +# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) +# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) +# define png_strcpy _fstrcpy +# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ +# define png_strlen _fstrlen +# define png_memcmp _fmemcmp /* SJT: added */ +# define png_memcpy _fmemcpy +# define png_memset _fmemset +# define png_sprintf sprintf +#else +# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) +# /* Favor Windows over C runtime fns */ +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy lstrcpyA +# define png_strncpy lstrcpynA +# define png_strlen lstrlenA +# define png_memcmp memcmp +# define png_memcpy CopyMemory +# define png_memset memset +# define png_sprintf wsprintfA +# else +# define CVT_PTR(ptr) (ptr) +# define CVT_PTR_NOCHECK(ptr) (ptr) +# define png_strcpy strcpy +# define png_strncpy strncpy /* Added to v 1.2.6 */ +# define png_strlen strlen +# define png_memcmp memcmp /* SJT: added */ +# define png_memcpy memcpy +# define png_memset memset +# define png_sprintf sprintf +# endif +#endif + +#ifndef PNG_NO_SNPRINTF +# ifdef _MSC_VER +# define png_snprintf _snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 _snprintf +# define png_snprintf6 _snprintf +# else +# define png_snprintf snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 snprintf +# define png_snprintf6 snprintf +# endif +#else + /* You don't have or don't want to use snprintf(). Caution: Using + * sprintf instead of snprintf exposes your application to accidental + * or malevolent buffer overflows. If you don't have snprintf() + * as a general rule you should provide one (you can get one from + * Portable OpenSSH). + */ +# define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1) +# define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2) +# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ + png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) +#endif + +/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, + * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 + * to png_alloc_size_t are not necessary; in fact, it is recommended + * not to use them at all so that the compiler can complain when something + * turns out to be problematic. + * Casts in the other direction (from png_alloc_size_t to png_size_t or + * png_uint_32) should be explicitly applied; however, we do not expect + * to encounter practical situations that require such conversions. + */ +#if defined(__TURBOC__) && !defined(__FLAT__) + typedef unsigned long png_alloc_size_t; +#else +# if defined(_MSC_VER) && defined(MAXSEG_64K) + typedef unsigned long png_alloc_size_t; +# else + /* This is an attempt to detect an old Windows system where (int) is + * actually 16 bits, in that case png_malloc must have an argument with a + * bigger size to accomodate the requirements of the library. + */ +# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \ + (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) + typedef DWORD png_alloc_size_t; +# else + typedef png_size_t png_alloc_size_t; +# endif +# endif +#endif +/* End of memory model/platform independent support */ + +/* Just a little check that someone hasn't tried to define something + * contradictory. + */ +#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) +# undef PNG_ZBUF_SIZE +# define PNG_ZBUF_SIZE 65536L +#endif + + +/* Added at libpng-1.2.8 */ +#endif /* PNG_VERSION_INFO_ONLY */ + +#endif /* PNGCONF_H */ diff --git a/cocos2dx/platform/third_party/emscripten/libraries/README b/cocos2dx/platform/third_party/emscripten/libraries/README new file mode 100644 index 0000000000..502af2435b --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/README @@ -0,0 +1,7 @@ +libfreetype.a from http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz -- configure flags: ./configure --enable-static --prefix=`pwd`/../build +libpng.a from https://github.com/hachque-Emscripten/libpng-1.2.49.git +libz.a from http://zlib.net/zlib-1.2.8.tar.gz -- configure flags: ./configure --prefix=`pwd`/../build --static +libwebp.a from https://code.google.com/p/webp/downloads/detail?name=libwebp-0.3.0.tar.gz -- configure with ./configure --disable-threading --prefix=/tmp/libwebp +libtiff.a from ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz -- configure flags: ./configure --enable-static --prefix=`pwd`/../build CFLAGS=-DNDEBUG +libjpeg.a from http://www.ijg.org/files/jpegsrc.v9.tar.gz -- configure flags: ./configure --enable-static --prefix=`pwd`/../build +libxml2.a from ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz -- configure flags: ./configure --with-http=no --with-ftp=no --prefix=`pwd`/../build --with-python=no --with-threads=no --enable-static diff --git a/cocos2dx/platform/third_party/emscripten/libraries/build.sh b/cocos2dx/platform/third_party/emscripten/libraries/build.sh new file mode 100755 index 0000000000..faba556b83 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/build.sh @@ -0,0 +1,69 @@ +#!/bin/sh -x + +# Hacky script to re-compile all of Cocos2D-X's dependencies with Emscripten. +# TODO: paramaterize directories, download source code and run without user intervention. + +EMSCRIPTEN=~/emscripten +TMP=`mktemp -d /tmp/cc-deps.XXXXXXX` + +# Libtiff, from ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz +cd tiff-4.0.3 +$EMSCRIPTEN/emconfigure ./configure --enable-static --prefix=`pwd`/../build CFLAGS=-DNDEBUG +$EMSCRIPTEN/emmake make clean +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install +cd .. + +# Freetype. Build once natively, then again with Emscripten, so as to satisfy build time deps +# From http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz +cd freetype-2.4.12 +./configure --enable-static +make clean +make +# Copy build-time targets to /tmp +cp -v objs/apinames $TMP/apinames +$EMSCRIPTEN/emconfigure ./configure --enable-static --prefix=`pwd`/../build +$EMSCRIPTEN/emmake make clean +# Copy them back +cp -v $TMP/apinames objs/apinames +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install + +# libpng, from http://sourceforge.net/projects/libpng/files/libpng14/1.4.12/libpng-1.4.12.tar.gz/download +cd libpng-1.4.12 +$EMSCRIPTEN/emconfigure ./configure --enable-static --prefix=`pwd`/../build +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install +cd .. + +# libjpeg, from http://www.ijg.org/files/jpegsrc.v9.tar.gz +cd jpeg-9 +$EMSCRIPTEN/emconfigure ./configure --enable-static --prefix=`pwd`/../build +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install +cd .. + +# libwebp, from https://webp.googlecode.com/files/libwebp-0.3.0.tar.gz +cd libwebp-0.3.0 +# Generated autotools files don't work on my Mac. Re-build them here. Otherwise build fails. +./autogen.sh +$EMSCRIPTEN/emconfigure ./configure --disable-threading --prefix=`pwd`/../build --enable-static --disable-shared +$EMSCRIPTEN/emmake make clean +$EMSCRIPTEN/emmake make V=1 +$EMSCRIPTEN/emmake make install +cd .. + +# libz, from http://zlib.net/zlib-1.2.8.tar.gz +cd zlib-1.2.8 +$EMSCRIPTEN/emconfigure ./configure --prefix=`pwd`/../build --static +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install +cd .. + +# libxml2, from ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz +cd libxml2-2.9.1 +$EMSCRIPTEN/emconfigure ./configure --with-http=no --with-ftp=no --prefix=`pwd`/../build --with-python=no --with-threads=no --enable-static +$EMSCRIPTEN/emmake make +$EMSCRIPTEN/emmake make install +cd .. + diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libjpeg.a.REMOVED.git-id new file mode 100644 index 0000000000..735e79c280 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libjpeg.a.REMOVED.git-id @@ -0,0 +1 @@ +02dbd713423f0bf57067a40e5a954957a031a617 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libpng.a.REMOVED.git-id new file mode 100644 index 0000000000..28dc98b41e --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libpng.a.REMOVED.git-id @@ -0,0 +1 @@ +dc996fbca0e179cc8c7635b4ffd924060aa9a934 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libtiff.a.REMOVED.git-id new file mode 100644 index 0000000000..87ae1e683d --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libtiff.a.REMOVED.git-id @@ -0,0 +1 @@ +d804fdb860e9fbdd50167fa40990d844d321c3f7 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libtiffxx.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libtiffxx.a.REMOVED.git-id new file mode 100644 index 0000000000..02eef02fd5 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libtiffxx.a.REMOVED.git-id @@ -0,0 +1 @@ +fd6d69587bc3222ceea24ff11e14a42127ac031b \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libwebp.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libwebp.a.REMOVED.git-id new file mode 100644 index 0000000000..459f6721bb --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libwebp.a.REMOVED.git-id @@ -0,0 +1 @@ +9b419a33d2c14b37fc5c5037c99826cff1b1d217 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libxml2.a.REMOVED.git-id new file mode 100644 index 0000000000..581ab63b5f --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libxml2.a.REMOVED.git-id @@ -0,0 +1 @@ +80a796ba46316f8e74e961468bb970664bda0543 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libraries/libz.a.REMOVED.git-id b/cocos2dx/platform/third_party/emscripten/libraries/libz.a.REMOVED.git-id new file mode 100644 index 0000000000..7255d070d6 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libraries/libz.a.REMOVED.git-id @@ -0,0 +1 @@ +a42146a3b7d81362b0804abadef75738311ab5a3 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/emscripten/libtiff/include/tiff.h b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiff.h new file mode 100644 index 0000000000..19b4e7976d --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiff.h @@ -0,0 +1,678 @@ +/* $Id: tiff.h,v 1.68 2012-08-19 16:56:35 bfriesen Exp $ */ + +/* + * Copyright (c) 1988-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _TIFF_ +#define _TIFF_ + +#include "tiffconf.h" + +/* + * Tag Image File Format (TIFF) + * + * Based on Rev 6.0 from: + * Developer's Desk + * Aldus Corporation + * 411 First Ave. South + * Suite 200 + * Seattle, WA 98104 + * 206-622-5500 + * + * (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf) + * + * For BigTIFF design notes see the following links + * http://www.remotesensing.org/libtiff/bigtiffdesign.html + * http://www.awaresystems.be/imaging/tiff/bigtiff.html + */ + +#define TIFF_VERSION_CLASSIC 42 +#define TIFF_VERSION_BIG 43 + +#define TIFF_BIGENDIAN 0x4d4d +#define TIFF_LITTLEENDIAN 0x4949 +#define MDI_LITTLEENDIAN 0x5045 +#define MDI_BIGENDIAN 0x4550 + +/* + * Intrinsic data types required by the file format: + * + * 8-bit quantities int8/uint8 + * 16-bit quantities int16/uint16 + * 32-bit quantities int32/uint32 + * 64-bit quantities int64/uint64 + * strings unsigned char* + */ + +typedef TIFF_INT8_T int8; +typedef TIFF_UINT8_T uint8; + +typedef TIFF_INT16_T int16; +typedef TIFF_UINT16_T uint16; + +typedef TIFF_INT32_T int32; +typedef TIFF_UINT32_T uint32; + +typedef TIFF_INT64_T int64; +typedef TIFF_UINT64_T uint64; + +/* + * Some types as promoted in a variable argument list + * We use uint16_vap rather then directly using int, because this way + * we document the type we actually want to pass through, conceptually, + * rather then confusing the issue by merely stating the type it gets + * promoted to + */ + +typedef int uint16_vap; + +/* + * TIFF header. + */ +typedef struct { + uint16 tiff_magic; /* magic number (defines byte order) */ + uint16 tiff_version; /* TIFF version number */ +} TIFFHeaderCommon; +typedef struct { + uint16 tiff_magic; /* magic number (defines byte order) */ + uint16 tiff_version; /* TIFF version number */ + uint32 tiff_diroff; /* byte offset to first directory */ +} TIFFHeaderClassic; +typedef struct { + uint16 tiff_magic; /* magic number (defines byte order) */ + uint16 tiff_version; /* TIFF version number */ + uint16 tiff_offsetsize; /* size of offsets, should be 8 */ + uint16 tiff_unused; /* unused word, should be 0 */ + uint64 tiff_diroff; /* byte offset to first directory */ +} TIFFHeaderBig; + + +/* + * NB: In the comments below, + * - items marked with a + are obsoleted by revision 5.0, + * - items marked with a ! are introduced in revision 6.0. + * - items marked with a % are introduced post revision 6.0. + * - items marked with a $ are obsoleted by revision 6.0. + * - items marked with a & are introduced by Adobe DNG specification. + */ + +/* + * Tag data type information. + * + * Note: RATIONALs are the ratio of two 32-bit integer values. + */ +typedef enum { + TIFF_NOTYPE = 0, /* placeholder */ + TIFF_BYTE = 1, /* 8-bit unsigned integer */ + TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ + TIFF_SHORT = 3, /* 16-bit unsigned integer */ + TIFF_LONG = 4, /* 32-bit unsigned integer */ + TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ + TIFF_SBYTE = 6, /* !8-bit signed integer */ + TIFF_UNDEFINED = 7, /* !8-bit untyped data */ + TIFF_SSHORT = 8, /* !16-bit signed integer */ + TIFF_SLONG = 9, /* !32-bit signed integer */ + TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ + TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ + TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */ + TIFF_IFD = 13, /* %32-bit unsigned integer (offset) */ + TIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */ + TIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */ + TIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */ +} TIFFDataType; + +/* + * TIFF Tag Definitions. + */ +#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ +#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ +#define FILETYPE_PAGE 0x2 /* one page of many */ +#define FILETYPE_MASK 0x4 /* transparency mask */ +#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ +#define OFILETYPE_IMAGE 1 /* full resolution image data */ +#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ +#define OFILETYPE_PAGE 3 /* one page of many */ +#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ +#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ +#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ +#define TIFFTAG_COMPRESSION 259 /* data compression technique */ +#define COMPRESSION_NONE 1 /* dump mode */ +#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ +#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ +#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */ +#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ +#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */ +#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ +#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */ +#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ +#define COMPRESSION_T85 9 /* !TIFF/FX T.85 JBIG compression */ +#define COMPRESSION_T43 10 /* !TIFF/FX T.43 colour by layered JBIG compression */ +#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ +#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ +#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ +#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ +/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT */ +#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */ +#define COMPRESSION_JBIG 34661 /* ISO JBIG */ +#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ +#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ +#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ +#define COMPRESSION_LZMA 34925 /* LZMA2 */ +#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ +#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ +#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ +#define PHOTOMETRIC_RGB 2 /* RGB color model */ +#define PHOTOMETRIC_PALETTE 3 /* color map indexed */ +#define PHOTOMETRIC_MASK 4 /* $holdout mask */ +#define PHOTOMETRIC_SEPARATED 5 /* !color separations */ +#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ +#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ +#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ +#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ +#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ +#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ +#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ +#define THRESHHOLD_BILEVEL 1 /* b&w art scan */ +#define THRESHHOLD_HALFTONE 2 /* or dithered scan */ +#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ +#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ +#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ +#define TIFFTAG_FILLORDER 266 /* data order within a byte */ +#define FILLORDER_MSB2LSB 1 /* most significant -> least */ +#define FILLORDER_LSB2MSB 2 /* least significant -> most */ +#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ +#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ +#define TIFFTAG_MAKE 271 /* scanner manufacturer name */ +#define TIFFTAG_MODEL 272 /* scanner model name/number */ +#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ +#define TIFFTAG_ORIENTATION 274 /* +image orientation */ +#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ +#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ +#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ +#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ +#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ +#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ +#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ +#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ +#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ +#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ +#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ +#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ +#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ +#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ +#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ +#define TIFFTAG_PLANARCONFIG 284 /* storage organization */ +#define PLANARCONFIG_CONTIG 1 /* single image plane */ +#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ +#define TIFFTAG_PAGENAME 285 /* page name image is from */ +#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ +#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ +#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ +#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ +#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ +#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ +#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ +#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ +#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ +#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ +#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ +#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ +#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */ +#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ +#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ +#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ +#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ +#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */ +#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ +#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ +#define RESUNIT_NONE 1 /* no meaningful units */ +#define RESUNIT_INCH 2 /* english */ +#define RESUNIT_CENTIMETER 3 /* metric */ +#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ +#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ +#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ +#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ +#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ +#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ +#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ +#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ +#define TIFFTAG_SOFTWARE 305 /* name & release */ +#define TIFFTAG_DATETIME 306 /* creation date and time */ +#define TIFFTAG_ARTIST 315 /* creator of image */ +#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ +#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ +#define PREDICTOR_NONE 1 /* no prediction scheme used */ +#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */ +#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */ +#define TIFFTAG_WHITEPOINT 318 /* image white point */ +#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ +#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ +#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ +#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */ +#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */ +#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ +#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ +#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ +#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ +#define CLEANFAXDATA_CLEAN 0 /* no errors detected */ +#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ +#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ +#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ +#define TIFFTAG_SUBIFD 330 /* subimage descriptors */ +#define TIFFTAG_INKSET 332 /* !inks in separated image */ +#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */ +#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */ +#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ +#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */ +#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ +#define TIFFTAG_TARGETPRINTER 337 /* !separation target */ +#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ +#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ +#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ +#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ +#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ +#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ +#define SAMPLEFORMAT_INT 2 /* !signed integer data */ +#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ +#define SAMPLEFORMAT_VOID 4 /* !untyped data */ +#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */ +#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */ +#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ +#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ +#define TIFFTAG_CLIPPATH 343 /* %ClipPath + [Adobe TIFF technote 2] */ +#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits + [Adobe TIFF technote 2] */ +#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits + [Adobe TIFF technote 2] */ +#define TIFFTAG_INDEXED 346 /* %Indexed + [Adobe TIFF Technote 3] */ +#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ +#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ +/* Tags 400-435 are from the TIFF/FX spec */ +#define TIFFTAG_GLOBALPARAMETERSIFD 400 /* ! */ +#define TIFFTAG_PROFILETYPE 401 /* ! */ +#define PROFILETYPE_UNSPECIFIED 0 /* ! */ +#define PROFILETYPE_G3_FAX 1 /* ! */ +#define TIFFTAG_FAXPROFILE 402 /* ! */ +#define FAXPROFILE_S 1 /* !TIFF/FX FAX profile S */ +#define FAXPROFILE_F 2 /* !TIFF/FX FAX profile F */ +#define FAXPROFILE_J 3 /* !TIFF/FX FAX profile J */ +#define FAXPROFILE_C 4 /* !TIFF/FX FAX profile C */ +#define FAXPROFILE_L 5 /* !TIFF/FX FAX profile L */ +#define FAXPROFILE_M 6 /* !TIFF/FX FAX profile LM */ +#define TIFFTAG_CODINGMETHODS 403 /* !TIFF/FX coding methods */ +#define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */ +#define CODINGMETHODS_T4_2D (1 << 2) /* !T.4 2D */ +#define CODINGMETHODS_T6 (1 << 3) /* !T.6 */ +#define CODINGMETHODS_T85 (1 << 4) /* !T.85 JBIG */ +#define CODINGMETHODS_T42 (1 << 5) /* !T.42 JPEG */ +#define CODINGMETHODS_T43 (1 << 6) /* !T.43 colour by layered JBIG */ +#define TIFFTAG_VERSIONYEAR 404 /* !TIFF/FX version year */ +#define TIFFTAG_MODENUMBER 405 /* !TIFF/FX mode number */ +#define TIFFTAG_DECODE 433 /* !TIFF/FX decode */ +#define TIFFTAG_IMAGEBASECOLOR 434 /* !TIFF/FX image base colour */ +#define TIFFTAG_T82OPTIONS 435 /* !TIFF/FX T.82 options */ +/* + * Tags 512-521 are obsoleted by Technical Note #2 which specifies a + * revised JPEG-in-TIFF scheme. + */ +#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ +#define JPEGPROC_BASELINE 1 /* !baseline sequential */ +#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ +#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ +#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ +#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ +#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ +#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ +#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ +#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ +#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ +#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ +#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ +#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ +#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ +#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ +#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ +#define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */ +#define TIFFTAG_XMLPACKET 700 /* %XML packet + [Adobe XMP Specification, + January 2004 */ +#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID + [Adobe TIFF technote] */ +/* tags 32952-32956 are private tags registered to Island Graphics */ +#define TIFFTAG_REFPTS 32953 /* image reference points */ +#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ +#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ +#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ +/* tags 32995-32999 are private tags registered to SGI */ +#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ +#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ +#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ +#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ +/* tags 33300-33309 are private tags registered to Pixar */ +/* + * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH + * are set when an image has been cropped out of a larger image. + * They reflect the size of the original uncropped image. + * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used + * to determine the position of the smaller image in the larger one. + */ +#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */ +#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */ + /* Tags 33302-33306 are used to identify special image modes and data + * used by Pixar's texture formats. + */ +#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */ +#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */ +#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */ +#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305 +#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 +/* tag 33405 is a private tag registered to Eastman Kodak */ +#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ +/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ +#define TIFFTAG_COPYRIGHT 33432 /* copyright string */ +/* IPTC TAG from RichTIFF specifications */ +#define TIFFTAG_RICHTIFFIPTC 33723 +/* 34016-34029 are reserved for ANSI IT8 TIFF/IT */ +#define TIFFTAG_STONITS 37439 /* Sample value to Nits */ +/* tag 34929 is a private tag registered to FedEx */ +#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ +#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ +/* Adobe Digital Negative (DNG) format tags */ +#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ +#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ +#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */ +#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model + name */ +#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space + mapping */ +#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */ +#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */ +#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for + the BlackLevel tag */ +#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */ +#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level + differences (columns) */ +#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level + differences (rows) */ +#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding + level */ +#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */ +#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image + area */ +#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image + area */ +#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space + transformation matrix 1 */ +#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space + transformation matrix 2 */ +#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */ +#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */ +#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction + matrix 1 */ +#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction + matrix 2 */ +#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw + values*/ +#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in + linear reference space */ +#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in + x-y chromaticity + coordinates */ +#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero + point */ +#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */ +#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of + sharpening */ +#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of + the green pixels in the + blue/green rows track the + values of the green pixels + in the red/green rows */ +#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */ +#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */ +#define TIFFTAG_LENSINFO 50736 /* info about the lens */ +#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */ +#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the + camera's anti-alias filter */ +#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */ +#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */ +#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote + tag is safe to preserve + along with the rest of the + EXIF data */ +#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */ +#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */ +#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */ +#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for + the raw image data */ +#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original + raw file */ +#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original + raw file */ +#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels + of the sensor */ +#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates + of fully masked pixels */ +#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */ +#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space + into ICC profile space */ +#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */ +#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */ +/* tag 65535 is an undefined tag used by Eastman Kodak */ +#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */ + +/* + * The following are ``pseudo tags'' that can be used to control + * codec-specific functionality. These tags are not written to file. + * Note that these values start at 0xffff+1 so that they'll never + * collide with Aldus-assigned tags. + * + * If you want your private pseudo tags ``registered'' (i.e. added to + * this file), please post a bug report via the tracking system at + * http://www.remotesensing.org/libtiff/bugs.html with the appropriate + * C definitions to add. + */ +#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */ +#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */ +#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */ +#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */ +#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */ +#define FAXMODE_WORDALIGN 0x0008 /* word align row */ +#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */ +#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */ +/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */ +#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */ +#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */ +#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */ +#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */ +#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */ +#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */ +/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */ +#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */ +#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ +#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ +#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ +#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ +#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ +#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ +#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ +/* 65550-65556 are allocated to Oceana Matrix */ +#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */ +#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */ +#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */ +#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */ +#define DCSIMAGERFILTER_IR 0 /* infrared filter */ +#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */ +#define DCSIMAGERFILTER_CFA 2 /* color filter array */ +#define DCSIMAGERFILTER_OTHER 3 /* other filter */ +#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */ +#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */ +#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */ +#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */ +#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */ +#define TIFFTAG_DCSGAMMA 65554 /* gamma value */ +#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */ +#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ +/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ +#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ +#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ +/* 65559 is allocated to Oceana Matrix */ +#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */ +#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */ +#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */ +#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */ +#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */ +#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */ +#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/ +#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/ +#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */ +#define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */ +#define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */ +#define PERSAMPLE_MERGED 0 /* present as a single value */ +#define PERSAMPLE_MULTI 1 /* present as multiple values */ + +/* + * EXIF tags + */ +#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */ +#define EXIFTAG_FNUMBER 33437 /* F number */ +#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */ +#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */ +#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */ +#define EXIFTAG_OECF 34856 /* Optoelectric conversion + factor */ +#define EXIFTAG_EXIFVERSION 36864 /* Exif version */ +#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original + data generation */ +#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital + data generation */ +#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */ +#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */ +#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */ +#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */ +#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */ +#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */ +#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */ +#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */ +#define EXIFTAG_METERINGMODE 37383 /* Metering mode */ +#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */ +#define EXIFTAG_FLASH 37385 /* Flash */ +#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */ +#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */ +#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */ +#define EXIFTAG_USERCOMMENT 37510 /* User comments */ +#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */ +#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */ +#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */ +#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */ +#define EXIFTAG_COLORSPACE 40961 /* Color space information */ +#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */ +#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */ +#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */ +#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */ +#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */ +#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */ +#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */ +#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */ +#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */ +#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */ +#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */ +#define EXIFTAG_FILESOURCE 41728 /* File source */ +#define EXIFTAG_SCENETYPE 41729 /* Scene type */ +#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */ +#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */ +#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */ +#define EXIFTAG_WHITEBALANCE 41987 /* White balance */ +#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */ +#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */ +#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */ +#define EXIFTAG_GAINCONTROL 41991 /* Gain control */ +#define EXIFTAG_CONTRAST 41992 /* Contrast */ +#define EXIFTAG_SATURATION 41993 /* Saturation */ +#define EXIFTAG_SHARPNESS 41994 /* Sharpness */ +#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */ +#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */ +#define EXIFTAG_GAINCONTROL 41991 /* Gain control */ +#define EXIFTAG_GAINCONTROL 41991 /* Gain control */ +#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */ + +#endif /* _TIFF_ */ + +/* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffconf.h b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffconf.h new file mode 100644 index 0000000000..56f4589dcb --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffconf.h @@ -0,0 +1,128 @@ +/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */ +/* + Configuration defines for installed libtiff. + This file maintained for backward compatibility. Do not use definitions + from this file in your programs. +*/ + +#ifndef _TIFFCONF_ +#define _TIFFCONF_ + +/* Signed 16-bit type */ +#define TIFF_INT16_T signed short + +/* Signed 32-bit type */ +#define TIFF_INT32_T signed int + +/* Signed 64-bit type */ +#define TIFF_INT64_T signed long + +/* Signed 8-bit type */ +#define TIFF_INT8_T signed char + +/* Unsigned 16-bit type */ +#define TIFF_UINT16_T unsigned short + +/* Unsigned 32-bit type */ +#define TIFF_UINT32_T unsigned int + +/* Unsigned 64-bit type */ +#define TIFF_UINT64_T unsigned long + +/* Unsigned 8-bit type */ +#define TIFF_UINT8_T unsigned char + +/* Signed size type */ +#define TIFF_SSIZE_T signed long + +/* Pointer difference type */ +#define TIFF_PTRDIFF_T ptrdiff_t + +/* Define to 1 if the system has the type `int16'. */ +/* #undef HAVE_INT16 */ + +/* Define to 1 if the system has the type `int32'. */ +/* #undef HAVE_INT32 */ + +/* Define to 1 if the system has the type `int8'. */ +/* #undef HAVE_INT8 */ + +/* Compatibility stuff. */ + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#define HAVE_IEEEFP 1 + +/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ +#define HOST_FILLORDER FILLORDER_LSB2MSB + +/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian + (Intel) */ +#define HOST_BIGENDIAN 0 + +/* Support CCITT Group 3 & 4 algorithms */ +#define CCITT_SUPPORT 1 + +/* Support JPEG compression (requires IJG JPEG library) */ +/* #undef JPEG_SUPPORT */ + +/* Support JBIG compression (requires JBIG-KIT library) */ +/* #undef JBIG_SUPPORT */ + +/* Support LogLuv high dynamic range encoding */ +#define LOGLUV_SUPPORT 1 + +/* Support LZW algorithm */ +#define LZW_SUPPORT 1 + +/* Support NeXT 2-bit RLE algorithm */ +#define NEXT_SUPPORT 1 + +/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation + fails with unpatched IJG JPEG library) */ +/* #undef OJPEG_SUPPORT */ + +/* Support Macintosh PackBits algorithm */ +#define PACKBITS_SUPPORT 1 + +/* Support Pixar log-format algorithm (requires Zlib) */ +#define PIXARLOG_SUPPORT 1 + +/* Support ThunderScan 4-bit RLE algorithm */ +#define THUNDER_SUPPORT 1 + +/* Support Deflate compression */ +#define ZIP_SUPPORT 1 + +/* Support strip chopping (whether or not to convert single-strip uncompressed + images to mutiple strips of ~8Kb to reduce memory usage) */ +#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP + +/* Enable SubIFD tag (330) support */ +#define SUBIFD_SUPPORT 1 + +/* Treat extra sample as alpha (default enabled). The RGBA interface will + treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many + packages produce RGBA files but don't mark the alpha properly. */ +#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 + +/* Pick up YCbCr subsampling info from the JPEG data stream to support files + lacking the tag (default enabled). */ +#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 + +/* Support MS MDI magic number files as TIFF */ +#define MDI_SUPPORT 1 + +/* + * Feature support definitions. + * XXX: These macros are obsoleted. Don't use them in your apps! + * Macros stays here for backward compatibility and should be always defined. + */ +#define COLORIMETRY_SUPPORT +#define YCBCR_SUPPORT +#define CMYK_SUPPORT +#define ICC_SUPPORT +#define PHOTOSHOP_SUPPORT +#define IPTC_SUPPORT + +#endif /* _TIFFCONF_ */ diff --git a/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.h b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.h new file mode 100644 index 0000000000..038b67013f --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.h @@ -0,0 +1,557 @@ +/* $Id: tiffio.h,v 1.91 2012-07-29 15:45:29 tgl Exp $ */ + +/* + * Copyright (c) 1988-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _TIFFIO_ +#define _TIFFIO_ + +/* + * TIFF I/O Library Definitions. + */ +#include "tiff.h" +#include "tiffvers.h" + +/* + * TIFF is defined as an incomplete type to hide the + * library's internal data structures from clients. + */ +typedef struct tiff TIFF; + +/* + * The following typedefs define the intrinsic size of + * data types used in the *exported* interfaces. These + * definitions depend on the proper definition of types + * in tiff.h. Note also that the varargs interface used + * to pass tag types and values uses the types defined in + * tiff.h directly. + * + * NB: ttag_t is unsigned int and not unsigned short because + * ANSI C requires that the type before the ellipsis be a + * promoted type (i.e. one of int, unsigned int, pointer, + * or double) and because we defined pseudo-tags that are + * outside the range of legal Aldus-assigned tags. + * NB: tsize_t is int32 and not uint32 because some functions + * return -1. + * NB: toff_t is not off_t for many reasons; TIFFs max out at + * 32-bit file offsets, and BigTIFF maxes out at 64-bit + * offsets being the most important, and to ensure use of + * a consistently unsigned type across architectures. + * Prior to libtiff 4.0, this was an unsigned 32 bit type. + */ +/* + * this is the machine addressing size type, only it's signed, so make it + * int32 on 32bit machines, int64 on 64bit machines + */ +typedef TIFF_SSIZE_T tmsize_t; +typedef uint64 toff_t; /* file offset */ +/* the following are deprecated and should be replaced by their defining + counterparts */ +typedef uint32 ttag_t; /* directory tag */ +typedef uint16 tdir_t; /* directory index */ +typedef uint16 tsample_t; /* sample number */ +typedef uint32 tstrile_t; /* strip or tile number */ +typedef tstrile_t tstrip_t; /* strip number */ +typedef tstrile_t ttile_t; /* tile number */ +typedef tmsize_t tsize_t; /* i/o size in bytes */ +typedef void* tdata_t; /* image data ref */ + +#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32)) +#define __WIN32__ +#endif + +/* + * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c + * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c). + * + * By default tif_unix.c is assumed. + */ + +#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) +# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO) +# define AVOID_WIN32_FILEIO +# endif +#endif + +#if defined(USE_WIN32_FILEIO) +# define VC_EXTRALEAN +# include +# ifdef __WIN32__ +DECLARE_HANDLE(thandle_t); /* Win32 file handle */ +# else +typedef HFILE thandle_t; /* client data handle */ +# endif /* __WIN32__ */ +#else +typedef void* thandle_t; /* client data handle */ +#endif /* USE_WIN32_FILEIO */ + +/* + * Flags to pass to TIFFPrintDirectory to control + * printing of data structures that are potentially + * very large. Bit-or these flags to enable printing + * multiple items. + */ +#define TIFFPRINT_NONE 0x0 /* no extra info */ +#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */ +#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */ +#define TIFFPRINT_COLORMAP 0x4 /* colormap */ +#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */ +#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */ +#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */ + +/* + * Colour conversion stuff + */ + +/* reference white */ +#define D65_X0 (95.0470F) +#define D65_Y0 (100.0F) +#define D65_Z0 (108.8827F) + +#define D50_X0 (96.4250F) +#define D50_Y0 (100.0F) +#define D50_Z0 (82.4680F) + +/* Structure for holding information about a display device. */ + +typedef unsigned char TIFFRGBValue; /* 8-bit samples */ + +typedef struct { + float d_mat[3][3]; /* XYZ -> luminance matrix */ + float d_YCR; /* Light o/p for reference white */ + float d_YCG; + float d_YCB; + uint32 d_Vrwr; /* Pixel values for ref. white */ + uint32 d_Vrwg; + uint32 d_Vrwb; + float d_Y0R; /* Residual light for black pixel */ + float d_Y0G; + float d_Y0B; + float d_gammaR; /* Gamma values for the three guns */ + float d_gammaG; + float d_gammaB; +} TIFFDisplay; + +typedef struct { /* YCbCr->RGB support */ + TIFFRGBValue* clamptab; /* range clamping table */ + int* Cr_r_tab; + int* Cb_b_tab; + int32* Cr_g_tab; + int32* Cb_g_tab; + int32* Y_tab; +} TIFFYCbCrToRGB; + +typedef struct { /* CIE Lab 1976->RGB support */ + int range; /* Size of conversion table */ +#define CIELABTORGB_TABLE_RANGE 1500 + float rstep, gstep, bstep; + float X0, Y0, Z0; /* Reference white point */ + TIFFDisplay display; + float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */ + float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */ + float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */ +} TIFFCIELabToRGB; + +/* + * RGBA-style image support. + */ +typedef struct _TIFFRGBAImage TIFFRGBAImage; +/* + * The image reading and conversion routines invoke + * ``put routines'' to copy/image/whatever tiles of + * raw image data. A default set of routines are + * provided to convert/copy raw image data to 8-bit + * packed ABGR format rasters. Applications can supply + * alternate routines that unpack the data into a + * different format or, for example, unpack the data + * and draw the unpacked raster on the display. + */ +typedef void (*tileContigRoutine) + (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, + unsigned char*); +typedef void (*tileSeparateRoutine) + (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32, + unsigned char*, unsigned char*, unsigned char*, unsigned char*); +/* + * RGBA-reader state. + */ +struct _TIFFRGBAImage { + TIFF* tif; /* image handle */ + int stoponerr; /* stop on read error */ + int isContig; /* data is packed/separate */ + int alpha; /* type of alpha data present */ + uint32 width; /* image width */ + uint32 height; /* image height */ + uint16 bitspersample; /* image bits/sample */ + uint16 samplesperpixel; /* image samples/pixel */ + uint16 orientation; /* image orientation */ + uint16 req_orientation; /* requested orientation */ + uint16 photometric; /* image photometric interp */ + uint16* redcmap; /* colormap pallete */ + uint16* greencmap; + uint16* bluecmap; + /* get image data routine */ + int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32); + /* put decoded strip/tile */ + union { + void (*any)(TIFFRGBAImage*); + tileContigRoutine contig; + tileSeparateRoutine separate; + } put; + TIFFRGBValue* Map; /* sample mapping array */ + uint32** BWmap; /* black&white map */ + uint32** PALmap; /* palette image map */ + TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */ + TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */ + + uint8* UaToAa; /* Unassociated alpha to associated alpha convertion LUT */ + uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */ + + int row_offset; + int col_offset; +}; + +/* + * Macros for extracting components from the + * packed ABGR form returned by TIFFReadRGBAImage. + */ +#define TIFFGetR(abgr) ((abgr) & 0xff) +#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff) +#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff) +#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff) + +/* + * A CODEC is a software package that implements decoding, + * encoding, or decoding+encoding of a compression algorithm. + * The library provides a collection of builtin codecs. + * More codecs may be registered through calls to the library + * and/or the builtin implementations may be overridden. + */ +typedef int (*TIFFInitMethod)(TIFF*, int); +typedef struct { + char* name; + uint16 scheme; + TIFFInitMethod init; +} TIFFCodec; + +#include +#include + +/* share internal LogLuv conversion routines? */ +#ifndef LOGLUV_PUBLIC +#define LOGLUV_PUBLIC 1 +#endif + +#if !defined(__GNUC__) && !defined(__attribute__) +# define __attribute__(x) /*nothing*/ +#endif + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif +typedef void (*TIFFErrorHandler)(const char*, const char*, va_list); +typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list); +typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t); +typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int); +typedef int (*TIFFCloseProc)(thandle_t); +typedef toff_t (*TIFFSizeProc)(thandle_t); +typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size); +typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size); +typedef void (*TIFFExtendProc)(TIFF*); + +extern const char* TIFFGetVersion(void); + +extern const TIFFCodec* TIFFFindCODEC(uint16); +extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); +extern void TIFFUnRegisterCODEC(TIFFCodec*); +extern int TIFFIsCODECConfigured(uint16); +extern TIFFCodec* TIFFGetConfiguredCODECs(void); + +/* + * Auxiliary functions. + */ + +extern void* _TIFFmalloc(tmsize_t s); +extern void* _TIFFrealloc(void* p, tmsize_t s); +extern void _TIFFmemset(void* p, int v, tmsize_t c); +extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); +extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c); +extern void _TIFFfree(void* p); + +/* +** Stuff, related to tag handling and creating custom tags. +*/ +extern int TIFFGetTagListCount( TIFF * ); +extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); + +#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ +#define TIFF_VARIABLE -1 /* marker for variable length tags */ +#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */ +#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */ + +#define FIELD_CUSTOM 65 + +typedef struct _TIFFField TIFFField; +typedef struct _TIFFFieldArray TIFFFieldArray; + +extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); +extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); +extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); + +extern uint32 TIFFFieldTag(const TIFFField*); +extern const char* TIFFFieldName(const TIFFField*); +extern TIFFDataType TIFFFieldDataType(const TIFFField*); +extern int TIFFFieldPassCount(const TIFFField*); +extern int TIFFFieldReadCount(const TIFFField*); +extern int TIFFFieldWriteCount(const TIFFField*); + +typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); +typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); +typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long); + +typedef struct { + TIFFVSetMethod vsetfield; /* tag set routine */ + TIFFVGetMethod vgetfield; /* tag get routine */ + TIFFPrintMethod printdir; /* directory print routine */ +} TIFFTagMethods; + +extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); +extern void *TIFFGetClientInfo(TIFF *, const char *); +extern void TIFFSetClientInfo(TIFF *, void *, const char *); + +extern void TIFFCleanup(TIFF* tif); +extern void TIFFClose(TIFF* tif); +extern int TIFFFlush(TIFF* tif); +extern int TIFFFlushData(TIFF* tif); +extern int TIFFGetField(TIFF* tif, uint32 tag, ...); +extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); +extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); +extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); +extern int TIFFReadDirectory(TIFF* tif); +extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); +extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff); +extern uint64 TIFFScanlineSize64(TIFF* tif); +extern tmsize_t TIFFScanlineSize(TIFF* tif); +extern uint64 TIFFRasterScanlineSize64(TIFF* tif); +extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); +extern uint64 TIFFStripSize64(TIFF* tif); +extern tmsize_t TIFFStripSize(TIFF* tif); +extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); +extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); +extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); +extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); +extern uint64 TIFFTileRowSize64(TIFF* tif); +extern tmsize_t TIFFTileRowSize(TIFF* tif); +extern uint64 TIFFTileSize64(TIFF* tif); +extern tmsize_t TIFFTileSize(TIFF* tif); +extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); +extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); +extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); +extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); +extern int TIFFFileno(TIFF*); +extern int TIFFSetFileno(TIFF*, int); +extern thandle_t TIFFClientdata(TIFF*); +extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); +extern int TIFFGetMode(TIFF*); +extern int TIFFSetMode(TIFF*, int); +extern int TIFFIsTiled(TIFF*); +extern int TIFFIsByteSwapped(TIFF*); +extern int TIFFIsUpSampled(TIFF*); +extern int TIFFIsMSB2LSB(TIFF*); +extern int TIFFIsBigEndian(TIFF*); +extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); +extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); +extern TIFFSeekProc TIFFGetSeekProc(TIFF*); +extern TIFFCloseProc TIFFGetCloseProc(TIFF*); +extern TIFFSizeProc TIFFGetSizeProc(TIFF*); +extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); +extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); +extern uint32 TIFFCurrentRow(TIFF*); +extern uint16 TIFFCurrentDirectory(TIFF*); +extern uint16 TIFFNumberOfDirectories(TIFF*); +extern uint64 TIFFCurrentDirOffset(TIFF*); +extern uint32 TIFFCurrentStrip(TIFF*); +extern uint32 TIFFCurrentTile(TIFF* tif); +extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size); +extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size); +extern int TIFFSetupStrips(TIFF *); +extern int TIFFWriteCheck(TIFF*, int, const char *); +extern void TIFFFreeDirectory(TIFF*); +extern int TIFFCreateDirectory(TIFF*); +extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*); +extern int TIFFCreateEXIFDirectory(TIFF*); +extern int TIFFLastDirectory(TIFF*); +extern int TIFFSetDirectory(TIFF*, uint16); +extern int TIFFSetSubDirectory(TIFF*, uint64); +extern int TIFFUnlinkDirectory(TIFF*, uint16); +extern int TIFFSetField(TIFF*, uint32, ...); +extern int TIFFVSetField(TIFF*, uint32, va_list); +extern int TIFFUnsetField(TIFF*, uint32); +extern int TIFFWriteDirectory(TIFF *); +extern int TIFFWriteCustomDirectory(TIFF *, uint64 *); +extern int TIFFCheckpointDirectory(TIFF *); +extern int TIFFRewriteDirectory(TIFF *); + +#if defined(c_plusplus) || defined(__cplusplus) +extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); +extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); +extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); +extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); +extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, + int = ORIENTATION_BOTLEFT, int = 0); +#else +extern void TIFFPrintDirectory(TIFF*, FILE*, long); +extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); +extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); +extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); +extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); +#endif + +extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); +extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); +extern int TIFFRGBAImageOK(TIFF*, char [1024]); +extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); +extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); +extern void TIFFRGBAImageEnd(TIFFRGBAImage*); +extern TIFF* TIFFOpen(const char*, const char*); +# ifdef __WIN32__ +extern TIFF* TIFFOpenW(const wchar_t*, const char*); +# endif /* __WIN32__ */ +extern TIFF* TIFFFdOpen(int, const char*, const char*); +extern TIFF* TIFFClientOpen(const char*, const char*, + thandle_t, + TIFFReadWriteProc, TIFFReadWriteProc, + TIFFSeekProc, TIFFCloseProc, + TIFFSizeProc, + TIFFMapFileProc, TIFFUnmapFileProc); +extern const char* TIFFFileName(TIFF*); +extern const char* TIFFSetFileName(TIFF*, const char *); +extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); +extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); +extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); +extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); +extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); +extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); +extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); +extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); +extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); +extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); +extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); +extern uint32 TIFFNumberOfTiles(TIFF*); +extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); +extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); +extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); +extern uint32 TIFFNumberOfStrips(TIFF*); +extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); +extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); +extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); +extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); +extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); +extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); +extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); +extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); +extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ +extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); +extern void TIFFSwabShort(uint16*); +extern void TIFFSwabLong(uint32*); +extern void TIFFSwabLong8(uint64*); +extern void TIFFSwabFloat(float*); +extern void TIFFSwabDouble(double*); +extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); +extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); +extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); +extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); +extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n); +extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n); +extern void TIFFReverseBits(uint8* cp, tmsize_t n); +extern const unsigned char* TIFFGetBitRevTable(int); + +#ifdef LOGLUV_PUBLIC +#define U_NEU 0.210526316 +#define V_NEU 0.473684211 +#define UVSCALE 410. +extern double LogL16toY(int); +extern double LogL10toY(int); +extern void XYZtoRGB24(float*, uint8*); +extern int uv_decode(double*, double*, int); +extern void LogLuv24toXYZ(uint32, float*); +extern void LogLuv32toXYZ(uint32, float*); +#if defined(c_plusplus) || defined(__cplusplus) +extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); +extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); +extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); +extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); +extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); +#else +extern int LogL16fromY(double, int); +extern int LogL10fromY(double, int); +extern int uv_encode(double, double, int); +extern uint32 LogLuv24fromXYZ(float*, int); +extern uint32 LogLuv32fromXYZ(float*, int); +#endif +#endif /* LOGLUV_PUBLIC */ + +extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); +extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, + float *, float *, float *); +extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, + uint32 *, uint32 *, uint32 *); + +extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); +extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, + uint32 *, uint32 *, uint32 *); + +/**************************************************************************** + * O B S O L E T E D I N T E R F A C E S + * + * Don't use this stuff in your applications, it may be removed in the future + * libtiff versions. + ****************************************************************************/ +typedef struct { + ttag_t field_tag; /* field's tag */ + short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */ + short field_writecount; /* write count/TIFF_VARIABLE */ + TIFFDataType field_type; /* type of associated data */ + unsigned short field_bit; /* bit in fieldsset bit vector */ + unsigned char field_oktochange; /* if true, can change while writing */ + unsigned char field_passcount; /* if true, pass dir count on set */ + char *field_name; /* ASCII name */ +} TIFFFieldInfo; + +extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif /* _TIFFIO_ */ + +/* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.hxx b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.hxx new file mode 100644 index 0000000000..ed994f1156 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffio.hxx @@ -0,0 +1,49 @@ +/* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */ + +/* + * Copyright (c) 1988-1997 Sam Leffler + * Copyright (c) 1991-1997 Silicon Graphics, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation for any purpose is hereby granted without fee, provided + * that (i) the above copyright notices and this permission notice appear in + * all copies of the software and related documentation, and (ii) the names of + * Sam Leffler and Silicon Graphics may not be used in any advertising or + * publicity relating to the software without the specific, prior written + * permission of Sam Leffler and Silicon Graphics. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR + * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _TIFFIO_HXX_ +#define _TIFFIO_HXX_ + +/* + * TIFF I/O library definitions which provide C++ streams API. + */ + +#include +#include "tiff.h" + +extern TIFF* TIFFStreamOpen(const char*, std::ostream *); +extern TIFF* TIFFStreamOpen(const char*, std::istream *); + +#endif /* _TIFFIO_HXX_ */ + +/* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c++ + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ diff --git a/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffvers.h b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffvers.h new file mode 100644 index 0000000000..40edc813d5 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libtiff/include/tiffvers.h @@ -0,0 +1,9 @@ +#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.3\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc." +/* + * This define can be used in code that requires + * compilation-related definitions specific to a + * version or versions of the library. Runtime + * version checking should be done based on the + * string returned by TIFFGetVersion. + */ +#define TIFFLIB_VERSION 20120922 diff --git a/cocos2dx/platform/third_party/emscripten/libwebp/webp/decode.h b/cocos2dx/platform/third_party/emscripten/libwebp/webp/decode.h new file mode 100644 index 0000000000..181eb18605 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libwebp/webp/decode.h @@ -0,0 +1,482 @@ +// Copyright 2010 Google Inc. All Rights Reserved. +// +// This code is licensed under the same terms as WebM: +// Software License Agreement: http://www.webmproject.org/license/software/ +// Additional IP Rights Grant: http://www.webmproject.org/license/additional/ +// ----------------------------------------------------------------------------- +// +// Main decoding functions for WebP images. +// +// Author: Skal (pascal.massimino@gmail.com) + +#ifndef WEBP_WEBP_DECODE_H_ +#define WEBP_WEBP_DECODE_H_ + +#include "./types.h" + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#define WEBP_DECODER_ABI_VERSION 0x0201 // MAJOR(8b) + MINOR(8b) + +typedef struct WebPRGBABuffer WebPRGBABuffer; +typedef struct WebPYUVABuffer WebPYUVABuffer; +typedef struct WebPDecBuffer WebPDecBuffer; +#if !(defined(__cplusplus) || defined(c_plusplus)) +typedef enum VP8StatusCode VP8StatusCode; +typedef enum WEBP_CSP_MODE WEBP_CSP_MODE; +#endif +typedef struct WebPIDecoder WebPIDecoder; +typedef struct WebPBitstreamFeatures WebPBitstreamFeatures; +typedef struct WebPDecoderOptions WebPDecoderOptions; +typedef struct WebPDecoderConfig WebPDecoderConfig; + +// Return the decoder's version number, packed in hexadecimal using 8bits for +// each of major/minor/revision. E.g: v2.5.7 is 0x020507. +WEBP_EXTERN(int) WebPGetDecoderVersion(void); + +// Retrieve basic header information: width, height. +// This function will also validate the header and return 0 in +// case of formatting error. +// Pointers 'width' and 'height' can be passed NULL if deemed irrelevant. +WEBP_EXTERN(int) WebPGetInfo(const uint8_t* data, size_t data_size, + int* width, int* height); + +// Decodes WebP images pointed to by 'data' and returns RGBA samples, along +// with the dimensions in *width and *height. The ordering of samples in +// memory is R, G, B, A, R, G, B, A... in scan order (endian-independent). +// The returned pointer should be deleted calling free(). +// Returns NULL in case of error. +WEBP_EXTERN(uint8_t*) WebPDecodeRGBA(const uint8_t* data, size_t data_size, + int* width, int* height); + +// Same as WebPDecodeRGBA, but returning A, R, G, B, A, R, G, B... ordered data. +WEBP_EXTERN(uint8_t*) WebPDecodeARGB(const uint8_t* data, size_t data_size, + int* width, int* height); + +// Same as WebPDecodeRGBA, but returning B, G, R, A, B, G, R, A... ordered data. +WEBP_EXTERN(uint8_t*) WebPDecodeBGRA(const uint8_t* data, size_t data_size, + int* width, int* height); + +// Same as WebPDecodeRGBA, but returning R, G, B, R, G, B... ordered data. +// If the bitstream contains transparency, it is ignored. +WEBP_EXTERN(uint8_t*) WebPDecodeRGB(const uint8_t* data, size_t data_size, + int* width, int* height); + +// Same as WebPDecodeRGB, but returning B, G, R, B, G, R... ordered data. +WEBP_EXTERN(uint8_t*) WebPDecodeBGR(const uint8_t* data, size_t data_size, + int* width, int* height); + + +// Decode WebP images pointed to by 'data' to Y'UV format(*). The pointer +// returned is the Y samples buffer. Upon return, *u and *v will point to +// the U and V chroma data. These U and V buffers need NOT be free()'d, +// unlike the returned Y luma one. The dimension of the U and V planes +// are both (*width + 1) / 2 and (*height + 1)/ 2. +// Upon return, the Y buffer has a stride returned as '*stride', while U and V +// have a common stride returned as '*uv_stride'. +// Return NULL in case of error. +// (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr +WEBP_EXTERN(uint8_t*) WebPDecodeYUV(const uint8_t* data, size_t data_size, + int* width, int* height, + uint8_t** u, uint8_t** v, + int* stride, int* uv_stride); + +// These five functions are variants of the above ones, that decode the image +// directly into a pre-allocated buffer 'output_buffer'. The maximum storage +// available in this buffer is indicated by 'output_buffer_size'. If this +// storage is not sufficient (or an error occurred), NULL is returned. +// Otherwise, output_buffer is returned, for convenience. +// The parameter 'output_stride' specifies the distance (in bytes) +// between scanlines. Hence, output_buffer_size is expected to be at least +// output_stride x picture-height. +WEBP_EXTERN(uint8_t*) WebPDecodeRGBAInto( + const uint8_t* data, size_t data_size, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); +WEBP_EXTERN(uint8_t*) WebPDecodeARGBInto( + const uint8_t* data, size_t data_size, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); +WEBP_EXTERN(uint8_t*) WebPDecodeBGRAInto( + const uint8_t* data, size_t data_size, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); + +// RGB and BGR variants. Here too the transparency information, if present, +// will be dropped and ignored. +WEBP_EXTERN(uint8_t*) WebPDecodeRGBInto( + const uint8_t* data, size_t data_size, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); +WEBP_EXTERN(uint8_t*) WebPDecodeBGRInto( + const uint8_t* data, size_t data_size, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); + +// WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly +// into pre-allocated luma/chroma plane buffers. This function requires the +// strides to be passed: one for the luma plane and one for each of the +// chroma ones. The size of each plane buffer is passed as 'luma_size', +// 'u_size' and 'v_size' respectively. +// Pointer to the luma plane ('*luma') is returned or NULL if an error occurred +// during decoding (or because some buffers were found to be too small). +WEBP_EXTERN(uint8_t*) WebPDecodeYUVInto( + const uint8_t* data, size_t data_size, + uint8_t* luma, size_t luma_size, int luma_stride, + uint8_t* u, size_t u_size, int u_stride, + uint8_t* v, size_t v_size, int v_stride); + +//------------------------------------------------------------------------------ +// Output colorspaces and buffer + +// Colorspaces +// Note: the naming describes the byte-ordering of packed samples in memory. +// For instance, MODE_BGRA relates to samples ordered as B,G,R,A,B,G,R,A,... +// Non-capital names (e.g.:MODE_Argb) relates to pre-multiplied RGB channels. +// RGBA-4444 and RGB-565 colorspaces are represented by following byte-order: +// RGBA-4444: [r3 r2 r1 r0 g3 g2 g1 g0], [b3 b2 b1 b0 a3 a2 a1 a0], ... +// RGB-565: [r4 r3 r2 r1 r0 g5 g4 g3], [g2 g1 g0 b4 b3 b2 b1 b0], ... +// In the case WEBP_SWAP_16BITS_CSP is defined, the bytes are swapped for +// these two modes: +// RGBA-4444: [b3 b2 b1 b0 a3 a2 a1 a0], [r3 r2 r1 r0 g3 g2 g1 g0], ... +// RGB-565: [g2 g1 g0 b4 b3 b2 b1 b0], [r4 r3 r2 r1 r0 g5 g4 g3], ... + +enum WEBP_CSP_MODE { + MODE_RGB = 0, MODE_RGBA = 1, + MODE_BGR = 2, MODE_BGRA = 3, + MODE_ARGB = 4, MODE_RGBA_4444 = 5, + MODE_RGB_565 = 6, + // RGB-premultiplied transparent modes (alpha value is preserved) + MODE_rgbA = 7, + MODE_bgrA = 8, + MODE_Argb = 9, + MODE_rgbA_4444 = 10, + // YUV modes must come after RGB ones. + MODE_YUV = 11, MODE_YUVA = 12, // yuv 4:2:0 + MODE_LAST = 13 +}; + +// Some useful macros: +static WEBP_INLINE int WebPIsPremultipliedMode(WEBP_CSP_MODE mode) { + return (mode == MODE_rgbA || mode == MODE_bgrA || mode == MODE_Argb || + mode == MODE_rgbA_4444); +} + +static WEBP_INLINE int WebPIsAlphaMode(WEBP_CSP_MODE mode) { + return (mode == MODE_RGBA || mode == MODE_BGRA || mode == MODE_ARGB || + mode == MODE_RGBA_4444 || mode == MODE_YUVA || + WebPIsPremultipliedMode(mode)); +} + +static WEBP_INLINE int WebPIsRGBMode(WEBP_CSP_MODE mode) { + return (mode < MODE_YUV); +} + +//------------------------------------------------------------------------------ +// WebPDecBuffer: Generic structure for describing the output sample buffer. + +struct WebPRGBABuffer { // view as RGBA + uint8_t* rgba; // pointer to RGBA samples + int stride; // stride in bytes from one scanline to the next. + size_t size; // total size of the *rgba buffer. +}; + +struct WebPYUVABuffer { // view as YUVA + uint8_t* y, *u, *v, *a; // pointer to luma, chroma U/V, alpha samples + int y_stride; // luma stride + int u_stride, v_stride; // chroma strides + int a_stride; // alpha stride + size_t y_size; // luma plane size + size_t u_size, v_size; // chroma planes size + size_t a_size; // alpha-plane size +}; + +// Output buffer +struct WebPDecBuffer { + WEBP_CSP_MODE colorspace; // Colorspace. + int width, height; // Dimensions. + int is_external_memory; // If true, 'internal_memory' pointer is not used. + union { + WebPRGBABuffer RGBA; + WebPYUVABuffer YUVA; + } u; // Nameless union of buffer parameters. + uint32_t pad[4]; // padding for later use + + uint8_t* private_memory; // Internally allocated memory (only when + // is_external_memory is false). Should not be used + // externally, but accessed via the buffer union. +}; + +// Internal, version-checked, entry point +WEBP_EXTERN(int) WebPInitDecBufferInternal(WebPDecBuffer*, int); + +// Initialize the structure as empty. Must be called before any other use. +// Returns false in case of version mismatch +static WEBP_INLINE int WebPInitDecBuffer(WebPDecBuffer* buffer) { + return WebPInitDecBufferInternal(buffer, WEBP_DECODER_ABI_VERSION); +} + +// Free any memory associated with the buffer. Must always be called last. +// Note: doesn't free the 'buffer' structure itself. +WEBP_EXTERN(void) WebPFreeDecBuffer(WebPDecBuffer* buffer); + +//------------------------------------------------------------------------------ +// Enumeration of the status codes + +enum VP8StatusCode { + VP8_STATUS_OK = 0, + VP8_STATUS_OUT_OF_MEMORY, + VP8_STATUS_INVALID_PARAM, + VP8_STATUS_BITSTREAM_ERROR, + VP8_STATUS_UNSUPPORTED_FEATURE, + VP8_STATUS_SUSPENDED, + VP8_STATUS_USER_ABORT, + VP8_STATUS_NOT_ENOUGH_DATA +}; + +//------------------------------------------------------------------------------ +// Incremental decoding +// +// This API allows streamlined decoding of partial data. +// Picture can be incrementally decoded as data become available thanks to the +// WebPIDecoder object. This object can be left in a SUSPENDED state if the +// picture is only partially decoded, pending additional input. +// Code example: +// +// WebPInitDecBuffer(&buffer); +// buffer.colorspace = mode; +// ... +// WebPIDecoder* idec = WebPINewDecoder(&buffer); +// while (has_more_data) { +// // ... (get additional data) +// status = WebPIAppend(idec, new_data, new_data_size); +// if (status != VP8_STATUS_SUSPENDED || +// break; +// } +// +// // The above call decodes the current available buffer. +// // Part of the image can now be refreshed by calling to +// // WebPIDecGetRGB()/WebPIDecGetYUVA() etc. +// } +// WebPIDelete(idec); + +// Creates a new incremental decoder with the supplied buffer parameter. +// This output_buffer can be passed NULL, in which case a default output buffer +// is used (with MODE_RGB). Otherwise, an internal reference to 'output_buffer' +// is kept, which means that the lifespan of 'output_buffer' must be larger than +// that of the returned WebPIDecoder object. +// Returns NULL if the allocation failed. +WEBP_EXTERN(WebPIDecoder*) WebPINewDecoder(WebPDecBuffer* output_buffer); + +// This function allocates and initializes an incremental-decoder object, which +// will output the RGB/A samples specified by 'csp' into a preallocated +// buffer 'output_buffer'. The size of this buffer is at least +// 'output_buffer_size' and the stride (distance in bytes between two scanlines) +// is specified by 'output_stride'. +// Additionally, output_buffer can be passed NULL in which case the output +// buffer will be allocated automatically when the decoding starts. The +// colorspace 'csp' is taken into account for allocating this buffer. All other +// parameters are ignored. +// Returns NULL if the allocation failed, or if some parameters are invalid. +WEBP_EXTERN(WebPIDecoder*) WebPINewRGB( + WEBP_CSP_MODE csp, + uint8_t* output_buffer, size_t output_buffer_size, int output_stride); + +// This function allocates and initializes an incremental-decoder object, which +// will output the raw luma/chroma samples into a preallocated planes if +// supplied. The luma plane is specified by its pointer 'luma', its size +// 'luma_size' and its stride 'luma_stride'. Similarly, the chroma-u plane +// is specified by the 'u', 'u_size' and 'u_stride' parameters, and the chroma-v +// plane by 'v' and 'v_size'. And same for the alpha-plane. The 'a' pointer +// can be pass NULL in case one is not interested in the transparency plane. +// Conversely, 'luma' can be passed NULL if no preallocated planes are supplied. +// In this case, the output buffer will be automatically allocated (using +// MODE_YUVA) when decoding starts. All parameters are then ignored. +// Returns NULL if the allocation failed or if a parameter is invalid. +WEBP_EXTERN(WebPIDecoder*) WebPINewYUVA( + uint8_t* luma, size_t luma_size, int luma_stride, + uint8_t* u, size_t u_size, int u_stride, + uint8_t* v, size_t v_size, int v_stride, + uint8_t* a, size_t a_size, int a_stride); + +// Deprecated version of the above, without the alpha plane. +// Kept for backward compatibility. +WEBP_EXTERN(WebPIDecoder*) WebPINewYUV( + uint8_t* luma, size_t luma_size, int luma_stride, + uint8_t* u, size_t u_size, int u_stride, + uint8_t* v, size_t v_size, int v_stride); + +// Deletes the WebPIDecoder object and associated memory. Must always be called +// if WebPINewDecoder, WebPINewRGB or WebPINewYUV succeeded. +WEBP_EXTERN(void) WebPIDelete(WebPIDecoder* idec); + +// Copies and decodes the next available data. Returns VP8_STATUS_OK when +// the image is successfully decoded. Returns VP8_STATUS_SUSPENDED when more +// data is expected. Returns error in other cases. +WEBP_EXTERN(VP8StatusCode) WebPIAppend( + WebPIDecoder* idec, const uint8_t* data, size_t data_size); + +// A variant of the above function to be used when data buffer contains +// partial data from the beginning. In this case data buffer is not copied +// to the internal memory. +// Note that the value of the 'data' pointer can change between calls to +// WebPIUpdate, for instance when the data buffer is resized to fit larger data. +WEBP_EXTERN(VP8StatusCode) WebPIUpdate( + WebPIDecoder* idec, const uint8_t* data, size_t data_size); + +// Returns the RGB/A image decoded so far. Returns NULL if output params +// are not initialized yet. The RGB/A output type corresponds to the colorspace +// specified during call to WebPINewDecoder() or WebPINewRGB(). +// *last_y is the index of last decoded row in raster scan order. Some pointers +// (*last_y, *width etc.) can be NULL if corresponding information is not +// needed. +WEBP_EXTERN(uint8_t*) WebPIDecGetRGB( + const WebPIDecoder* idec, int* last_y, + int* width, int* height, int* stride); + +// Same as above function to get a YUVA image. Returns pointer to the luma +// plane or NULL in case of error. If there is no alpha information +// the alpha pointer '*a' will be returned NULL. +WEBP_EXTERN(uint8_t*) WebPIDecGetYUVA( + const WebPIDecoder* idec, int* last_y, + uint8_t** u, uint8_t** v, uint8_t** a, + int* width, int* height, int* stride, int* uv_stride, int* a_stride); + +// Deprecated alpha-less version of WebPIDecGetYUVA(): it will ignore the +// alpha information (if present). Kept for backward compatibility. +static WEBP_INLINE uint8_t* WebPIDecGetYUV( + const WebPIDecoder* idec, int* last_y, uint8_t** u, uint8_t** v, + int* width, int* height, int* stride, int* uv_stride) { + return WebPIDecGetYUVA(idec, last_y, u, v, NULL, width, height, + stride, uv_stride, NULL); +} + +// Generic call to retrieve information about the displayable area. +// If non NULL, the left/right/width/height pointers are filled with the visible +// rectangular area so far. +// Returns NULL in case the incremental decoder object is in an invalid state. +// Otherwise returns the pointer to the internal representation. This structure +// is read-only, tied to WebPIDecoder's lifespan and should not be modified. +WEBP_EXTERN(const WebPDecBuffer*) WebPIDecodedArea( + const WebPIDecoder* idec, int* left, int* top, int* width, int* height); + +//------------------------------------------------------------------------------ +// Advanced decoding parametrization +// +// Code sample for using the advanced decoding API +/* + // A) Init a configuration object + WebPDecoderConfig config; + CHECK(WebPInitDecoderConfig(&config)); + + // B) optional: retrieve the bitstream's features. + CHECK(WebPGetFeatures(data, data_size, &config.input) == VP8_STATUS_OK); + + // C) Adjust 'config', if needed + config.no_fancy_upsampling = 1; + config.output.colorspace = MODE_BGRA; + // etc. + + // Note that you can also make config.output point to an externally + // supplied memory buffer, provided it's big enough to store the decoded + // picture. Otherwise, config.output will just be used to allocate memory + // and store the decoded picture. + + // D) Decode! + CHECK(WebPDecode(data, data_size, &config) == VP8_STATUS_OK); + + // E) Decoded image is now in config.output (and config.output.u.RGBA) + + // F) Reclaim memory allocated in config's object. It's safe to call + // this function even if the memory is external and wasn't allocated + // by WebPDecode(). + WebPFreeDecBuffer(&config.output); +*/ + +// Features gathered from the bitstream +struct WebPBitstreamFeatures { + int width; // Width in pixels, as read from the bitstream. + int height; // Height in pixels, as read from the bitstream. + int has_alpha; // True if the bitstream contains an alpha channel. + int has_animation; // True if the bitstream is an animation. + + // Unused for now: + int bitstream_version; // should be 0 for now. TODO(later) + int no_incremental_decoding; // if true, using incremental decoding is not + // recommended. + int rotate; // TODO(later) + int uv_sampling; // should be 0 for now. TODO(later) + uint32_t pad[2]; // padding for later use +}; + +// Internal, version-checked, entry point +WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal( + const uint8_t*, size_t, WebPBitstreamFeatures*, int); + +// Retrieve features from the bitstream. The *features structure is filled +// with information gathered from the bitstream. +// Returns VP8_STATUS_OK when the features are successfully retrieved. Returns +// VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieve the +// features from headers. Returns error in other cases. +static WEBP_INLINE VP8StatusCode WebPGetFeatures( + const uint8_t* data, size_t data_size, + WebPBitstreamFeatures* features) { + return WebPGetFeaturesInternal(data, data_size, features, + WEBP_DECODER_ABI_VERSION); +} + +// Decoding options +struct WebPDecoderOptions { + int bypass_filtering; // if true, skip the in-loop filtering + int no_fancy_upsampling; // if true, use faster pointwise upsampler + int use_cropping; // if true, cropping is applied _first_ + int crop_left, crop_top; // top-left position for cropping. + // Will be snapped to even values. + int crop_width, crop_height; // dimension of the cropping area + int use_scaling; // if true, scaling is applied _afterward_ + int scaled_width, scaled_height; // final resolution + int use_threads; // if true, use multi-threaded decoding + + // Unused for now: + int force_rotation; // forced rotation (to be applied _last_) + int no_enhancement; // if true, discard enhancement layer + uint32_t pad[6]; // padding for later use +}; + +// Main object storing the configuration for advanced decoding. +struct WebPDecoderConfig { + WebPBitstreamFeatures input; // Immutable bitstream features (optional) + WebPDecBuffer output; // Output buffer (can point to external mem) + WebPDecoderOptions options; // Decoding options +}; + +// Internal, version-checked, entry point +WEBP_EXTERN(int) WebPInitDecoderConfigInternal(WebPDecoderConfig*, int); + +// Initialize the configuration as empty. This function must always be +// called first, unless WebPGetFeatures() is to be called. +// Returns false in case of mismatched version. +static WEBP_INLINE int WebPInitDecoderConfig(WebPDecoderConfig* config) { + return WebPInitDecoderConfigInternal(config, WEBP_DECODER_ABI_VERSION); +} + +// Instantiate a new incremental decoder object with the requested +// configuration. The bitstream can be passed using 'data' and 'data_size' +// parameter, in which case the features will be parsed and stored into +// config->input. Otherwise, 'data' can be NULL and no parsing will occur. +// Note that 'config' can be NULL too, in which case a default configuration +// is used. +// The return WebPIDecoder object must always be deleted calling WebPIDelete(). +// Returns NULL in case of error (and config->status will then reflect +// the error condition). +WEBP_EXTERN(WebPIDecoder*) WebPIDecode(const uint8_t* data, size_t data_size, + WebPDecoderConfig* config); + +// Non-incremental version. This version decodes the full data at once, taking +// 'config' into account. Returns decoding status (which should be VP8_STATUS_OK +// if the decoding was successful). +WEBP_EXTERN(VP8StatusCode) WebPDecode(const uint8_t* data, size_t data_size, + WebPDecoderConfig* config); + +#if defined(__cplusplus) || defined(c_plusplus) +} // extern "C" +#endif + +#endif /* WEBP_WEBP_DECODE_H_ */ diff --git a/cocos2dx/platform/third_party/emscripten/libwebp/webp/encode.h b/cocos2dx/platform/third_party/emscripten/libwebp/webp/encode.h new file mode 100644 index 0000000000..fea8ee428d --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libwebp/webp/encode.h @@ -0,0 +1,480 @@ +// Copyright 2011 Google Inc. All Rights Reserved. +// +// This code is licensed under the same terms as WebM: +// Software License Agreement: http://www.webmproject.org/license/software/ +// Additional IP Rights Grant: http://www.webmproject.org/license/additional/ +// ----------------------------------------------------------------------------- +// +// WebP encoder: main interface +// +// Author: Skal (pascal.massimino@gmail.com) + +#ifndef WEBP_WEBP_ENCODE_H_ +#define WEBP_WEBP_ENCODE_H_ + +#include "./types.h" + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#define WEBP_ENCODER_ABI_VERSION 0x0201 // MAJOR(8b) + MINOR(8b) + +#if !(defined(__cplusplus) || defined(c_plusplus)) +typedef enum WebPImageHint WebPImageHint; +typedef enum WebPEncCSP WebPEncCSP; +typedef enum WebPPreset WebPPreset; +typedef enum WebPEncodingError WebPEncodingError; +#endif +typedef struct WebPConfig WebPConfig; +typedef struct WebPPicture WebPPicture; // main structure for I/O +typedef struct WebPAuxStats WebPAuxStats; +typedef struct WebPMemoryWriter WebPMemoryWriter; + +// Return the encoder's version number, packed in hexadecimal using 8bits for +// each of major/minor/revision. E.g: v2.5.7 is 0x020507. +WEBP_EXTERN(int) WebPGetEncoderVersion(void); + +//------------------------------------------------------------------------------ +// One-stop-shop call! No questions asked: + +// Returns the size of the compressed data (pointed to by *output), or 0 if +// an error occurred. The compressed data must be released by the caller +// using the call 'free(*output)'. +// These functions compress using the lossy format, and the quality_factor +// can go from 0 (smaller output, lower quality) to 100 (best quality, +// larger output). +WEBP_EXTERN(size_t) WebPEncodeRGB(const uint8_t* rgb, + int width, int height, int stride, + float quality_factor, uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeBGR(const uint8_t* bgr, + int width, int height, int stride, + float quality_factor, uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeRGBA(const uint8_t* rgba, + int width, int height, int stride, + float quality_factor, uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeBGRA(const uint8_t* bgra, + int width, int height, int stride, + float quality_factor, uint8_t** output); + +// These functions are the equivalent of the above, but compressing in a +// lossless manner. Files are usually larger than lossy format, but will +// not suffer any compression loss. +WEBP_EXTERN(size_t) WebPEncodeLosslessRGB(const uint8_t* rgb, + int width, int height, int stride, + uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeLosslessBGR(const uint8_t* bgr, + int width, int height, int stride, + uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeLosslessRGBA(const uint8_t* rgba, + int width, int height, int stride, + uint8_t** output); +WEBP_EXTERN(size_t) WebPEncodeLosslessBGRA(const uint8_t* bgra, + int width, int height, int stride, + uint8_t** output); + +//------------------------------------------------------------------------------ +// Coding parameters + +// Image characteristics hint for the underlying encoder. +enum WebPImageHint { + WEBP_HINT_DEFAULT = 0, // default preset. + WEBP_HINT_PICTURE, // digital picture, like portrait, inner shot + WEBP_HINT_PHOTO, // outdoor photograph, with natural lighting + WEBP_HINT_GRAPH, // Discrete tone image (graph, map-tile etc). + WEBP_HINT_LAST +}; + +// Compression parameters. +struct WebPConfig { + int lossless; // Lossless encoding (0=lossy(default), 1=lossless). + float quality; // between 0 (smallest file) and 100 (biggest) + int method; // quality/speed trade-off (0=fast, 6=slower-better) + + WebPImageHint image_hint; // Hint for image type (lossless only for now). + + // Parameters related to lossy compression only: + int target_size; // if non-zero, set the desired target size in bytes. + // Takes precedence over the 'compression' parameter. + float target_PSNR; // if non-zero, specifies the minimal distortion to + // try to achieve. Takes precedence over target_size. + int segments; // maximum number of segments to use, in [1..4] + int sns_strength; // Spatial Noise Shaping. 0=off, 100=maximum. + int filter_strength; // range: [0 = off .. 100 = strongest] + int filter_sharpness; // range: [0 = off .. 7 = least sharp] + int filter_type; // filtering type: 0 = simple, 1 = strong (only used + // if filter_strength > 0 or autofilter > 0) + int autofilter; // Auto adjust filter's strength [0 = off, 1 = on] + int alpha_compression; // Algorithm for encoding the alpha plane (0 = none, + // 1 = compressed with WebP lossless). Default is 1. + int alpha_filtering; // Predictive filtering method for alpha plane. + // 0: none, 1: fast, 2: best. Default if 1. + int alpha_quality; // Between 0 (smallest size) and 100 (lossless). + // Default is 100. + int pass; // number of entropy-analysis passes (in [1..10]). + + int show_compressed; // if true, export the compressed picture back. + // In-loop filtering is not applied. + int preprocessing; // preprocessing filter (0=none, 1=segment-smooth) + int partitions; // log2(number of token partitions) in [0..3]. Default + // is set to 0 for easier progressive decoding. + int partition_limit; // quality degradation allowed to fit the 512k limit + // on prediction modes coding (0: no degradation, + // 100: maximum possible degradation). + int emulate_jpeg_size; // If true, compression parameters will be remapped + // to better match the expected output size from + // JPEG compression. Generally, the output size will + // be similar but the degradation will be lower. + int thread_level; // If non-zero, try and use multi-threaded encoding. + int low_memory; // If set, reduce memory usage (but increase CPU use). + + uint32_t pad[5]; // padding for later use +}; + +// Enumerate some predefined settings for WebPConfig, depending on the type +// of source picture. These presets are used when calling WebPConfigPreset(). +enum WebPPreset { + WEBP_PRESET_DEFAULT = 0, // default preset. + WEBP_PRESET_PICTURE, // digital picture, like portrait, inner shot + WEBP_PRESET_PHOTO, // outdoor photograph, with natural lighting + WEBP_PRESET_DRAWING, // hand or line drawing, with high-contrast details + WEBP_PRESET_ICON, // small-sized colorful images + WEBP_PRESET_TEXT // text-like +}; + +// Internal, version-checked, entry point +WEBP_EXTERN(int) WebPConfigInitInternal(WebPConfig*, WebPPreset, float, int); + +// Should always be called, to initialize a fresh WebPConfig structure before +// modification. Returns false in case of version mismatch. WebPConfigInit() +// must have succeeded before using the 'config' object. +// Note that the default values are lossless=0 and quality=75. +static WEBP_INLINE int WebPConfigInit(WebPConfig* config) { + return WebPConfigInitInternal(config, WEBP_PRESET_DEFAULT, 75.f, + WEBP_ENCODER_ABI_VERSION); +} + +// This function will initialize the configuration according to a predefined +// set of parameters (referred to by 'preset') and a given quality factor. +// This function can be called as a replacement to WebPConfigInit(). Will +// return false in case of error. +static WEBP_INLINE int WebPConfigPreset(WebPConfig* config, + WebPPreset preset, float quality) { + return WebPConfigInitInternal(config, preset, quality, + WEBP_ENCODER_ABI_VERSION); +} + +// Returns true if 'config' is non-NULL and all configuration parameters are +// within their valid ranges. +WEBP_EXTERN(int) WebPValidateConfig(const WebPConfig* config); + +//------------------------------------------------------------------------------ +// Input / Output +// Structure for storing auxiliary statistics (mostly for lossy encoding). + +struct WebPAuxStats { + int coded_size; // final size + + float PSNR[5]; // peak-signal-to-noise ratio for Y/U/V/All/Alpha + int block_count[3]; // number of intra4/intra16/skipped macroblocks + int header_bytes[2]; // approximate number of bytes spent for header + // and mode-partition #0 + int residual_bytes[3][4]; // approximate number of bytes spent for + // DC/AC/uv coefficients for each (0..3) segments. + int segment_size[4]; // number of macroblocks in each segments + int segment_quant[4]; // quantizer values for each segments + int segment_level[4]; // filtering strength for each segments [0..63] + + int alpha_data_size; // size of the transparency data + int layer_data_size; // size of the enhancement layer data + + // lossless encoder statistics + uint32_t lossless_features; // bit0:predictor bit1:cross-color transform + // bit2:subtract-green bit3:color indexing + int histogram_bits; // number of precision bits of histogram + int transform_bits; // precision bits for transform + int cache_bits; // number of bits for color cache lookup + int palette_size; // number of color in palette, if used + int lossless_size; // final lossless size + + uint32_t pad[4]; // padding for later use +}; + +// Signature for output function. Should return true if writing was successful. +// data/data_size is the segment of data to write, and 'picture' is for +// reference (and so one can make use of picture->custom_ptr). +typedef int (*WebPWriterFunction)(const uint8_t* data, size_t data_size, + const WebPPicture* picture); + +// WebPMemoryWrite: a special WebPWriterFunction that writes to memory using +// the following WebPMemoryWriter object (to be set as a custom_ptr). +struct WebPMemoryWriter { + uint8_t* mem; // final buffer (of size 'max_size', larger than 'size'). + size_t size; // final size + size_t max_size; // total capacity + uint32_t pad[1]; // padding for later use +}; + +// The following must be called first before any use. +WEBP_EXTERN(void) WebPMemoryWriterInit(WebPMemoryWriter* writer); + +// The custom writer to be used with WebPMemoryWriter as custom_ptr. Upon +// completion, writer.mem and writer.size will hold the coded data. +// writer.mem must be freed using the call 'free(writer.mem)'. +WEBP_EXTERN(int) WebPMemoryWrite(const uint8_t* data, size_t data_size, + const WebPPicture* picture); + +// Progress hook, called from time to time to report progress. It can return +// false to request an abort of the encoding process, or true otherwise if +// everything is OK. +typedef int (*WebPProgressHook)(int percent, const WebPPicture* picture); + +// Color spaces. +enum WebPEncCSP { + // chroma sampling + WEBP_YUV420 = 0, // 4:2:0 + WEBP_YUV422 = 1, // 4:2:2 + WEBP_YUV444 = 2, // 4:4:4 + WEBP_YUV400 = 3, // grayscale + WEBP_CSP_UV_MASK = 3, // bit-mask to get the UV sampling factors + // alpha channel variants + WEBP_YUV420A = 4, + WEBP_YUV422A = 5, + WEBP_YUV444A = 6, + WEBP_YUV400A = 7, // grayscale + alpha + WEBP_CSP_ALPHA_BIT = 4 // bit that is set if alpha is present +}; + +// Encoding error conditions. +enum WebPEncodingError { + VP8_ENC_OK = 0, + VP8_ENC_ERROR_OUT_OF_MEMORY, // memory error allocating objects + VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY, // memory error while flushing bits + VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL + VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid + VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height + VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k + VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M + VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes + VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G + VP8_ENC_ERROR_USER_ABORT, // abort request by user + VP8_ENC_ERROR_LAST // list terminator. always last. +}; + +// maximum width/height allowed (inclusive), in pixels +#define WEBP_MAX_DIMENSION 16383 + +// Main exchange structure (input samples, output bytes, statistics) +struct WebPPicture { + // INPUT + ////////////// + // Main flag for encoder selecting between ARGB or YUV input. + // It is recommended to use ARGB input (*argb, argb_stride) for lossless + // compression, and YUV input (*y, *u, *v, etc.) for lossy compression + // since these are the respective native colorspace for these formats. + int use_argb; + + // YUV input (mostly used for input to lossy compression) + WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr). + int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION) + uint8_t *y, *u, *v; // pointers to luma/chroma planes. + int y_stride, uv_stride; // luma/chroma strides. + uint8_t* a; // pointer to the alpha plane + int a_stride; // stride of the alpha plane + uint32_t pad1[2]; // padding for later use + + // ARGB input (mostly used for input to lossless compression) + uint32_t* argb; // Pointer to argb (32 bit) plane. + int argb_stride; // This is stride in pixels units, not bytes. + uint32_t pad2[3]; // padding for later use + + // OUTPUT + /////////////// + // Byte-emission hook, to store compressed bytes as they are ready. + WebPWriterFunction writer; // can be NULL + void* custom_ptr; // can be used by the writer. + + // map for extra information (only for lossy compression mode) + int extra_info_type; // 1: intra type, 2: segment, 3: quant + // 4: intra-16 prediction mode, + // 5: chroma prediction mode, + // 6: bit cost, 7: distortion + uint8_t* extra_info; // if not NULL, points to an array of size + // ((width + 15) / 16) * ((height + 15) / 16) that + // will be filled with a macroblock map, depending + // on extra_info_type. + + // STATS AND REPORTS + /////////////////////////// + // Pointer to side statistics (updated only if not NULL) + WebPAuxStats* stats; + + // Error code for the latest error encountered during encoding + WebPEncodingError error_code; + + // If not NULL, report progress during encoding. + WebPProgressHook progress_hook; + + void* user_data; // this field is free to be set to any value and + // used during callbacks (like progress-report e.g.). + + uint32_t pad3[3]; // padding for later use + + // Unused for now: original samples (for non-YUV420 modes) + uint8_t *u0, *v0; + int uv0_stride; + + uint32_t pad4[7]; // padding for later use + + // PRIVATE FIELDS + //////////////////// + void* memory_; // row chunk of memory for yuva planes + void* memory_argb_; // and for argb too. + void* pad5[2]; // padding for later use +}; + +// Internal, version-checked, entry point +WEBP_EXTERN(int) WebPPictureInitInternal(WebPPicture*, int); + +// Should always be called, to initialize the structure. Returns false in case +// of version mismatch. WebPPictureInit() must have succeeded before using the +// 'picture' object. +// Note that, by default, use_argb is false and colorspace is WEBP_YUV420. +static WEBP_INLINE int WebPPictureInit(WebPPicture* picture) { + return WebPPictureInitInternal(picture, WEBP_ENCODER_ABI_VERSION); +} + +//------------------------------------------------------------------------------ +// WebPPicture utils + +// Convenience allocation / deallocation based on picture->width/height: +// Allocate y/u/v buffers as per colorspace/width/height specification. +// Note! This function will free the previous buffer if needed. +// Returns false in case of memory error. +WEBP_EXTERN(int) WebPPictureAlloc(WebPPicture* picture); + +// Release the memory allocated by WebPPictureAlloc() or WebPPictureImport*(). +// Note that this function does _not_ free the memory used by the 'picture' +// object itself. +// Besides memory (which is reclaimed) all other fields of 'picture' are +// preserved. +WEBP_EXTERN(void) WebPPictureFree(WebPPicture* picture); + +// Copy the pixels of *src into *dst, using WebPPictureAlloc. Upon return, +// *dst will fully own the copied pixels (this is not a view). +// Returns false in case of memory allocation error. +WEBP_EXTERN(int) WebPPictureCopy(const WebPPicture* src, WebPPicture* dst); + +// Compute PSNR, SSIM or LSIM distortion metric between two pictures. +// Result is in dB, stores in result[] in the Y/U/V/Alpha/All order. +// Returns false in case of error (src and ref don't have same dimension, ...) +// Warning: this function is rather CPU-intensive. +WEBP_EXTERN(int) WebPPictureDistortion( + const WebPPicture* src, const WebPPicture* ref, + int metric_type, // 0 = PSNR, 1 = SSIM, 2 = LSIM + float result[5]); + +// self-crops a picture to the rectangle defined by top/left/width/height. +// Returns false in case of memory allocation error, or if the rectangle is +// outside of the source picture. +// The rectangle for the view is defined by the top-left corner pixel +// coordinates (left, top) as well as its width and height. This rectangle +// must be fully be comprised inside the 'src' source picture. If the source +// picture uses the YUV420 colorspace, the top and left coordinates will be +// snapped to even values. +WEBP_EXTERN(int) WebPPictureCrop(WebPPicture* picture, + int left, int top, int width, int height); + +// Extracts a view from 'src' picture into 'dst'. The rectangle for the view +// is defined by the top-left corner pixel coordinates (left, top) as well +// as its width and height. This rectangle must be fully be comprised inside +// the 'src' source picture. If the source picture uses the YUV420 colorspace, +// the top and left coordinates will be snapped to even values. +// Picture 'src' must out-live 'dst' picture. Self-extraction of view is allowed +// ('src' equal to 'dst') as a mean of fast-cropping (but note that doing so, +// the original dimension will be lost). +// Returns false in case of memory allocation error or invalid parameters. +WEBP_EXTERN(int) WebPPictureView(const WebPPicture* src, + int left, int top, int width, int height, + WebPPicture* dst); + +// Returns true if the 'picture' is actually a view and therefore does +// not own the memory for pixels. +WEBP_EXTERN(int) WebPPictureIsView(const WebPPicture* picture); + +// Rescale a picture to new dimension width x height. +// Now gamma correction is applied. +// Returns false in case of error (invalid parameter or insufficient memory). +WEBP_EXTERN(int) WebPPictureRescale(WebPPicture* pic, int width, int height); + +// Colorspace conversion function to import RGB samples. +// Previous buffer will be free'd, if any. +// *rgb buffer should have a size of at least height * rgb_stride. +// Returns false in case of memory error. +WEBP_EXTERN(int) WebPPictureImportRGB( + WebPPicture* picture, const uint8_t* rgb, int rgb_stride); +// Same, but for RGBA buffer. +WEBP_EXTERN(int) WebPPictureImportRGBA( + WebPPicture* picture, const uint8_t* rgba, int rgba_stride); +// Same, but for RGBA buffer. Imports the RGB direct from the 32-bit format +// input buffer ignoring the alpha channel. Avoids needing to copy the data +// to a temporary 24-bit RGB buffer to import the RGB only. +WEBP_EXTERN(int) WebPPictureImportRGBX( + WebPPicture* picture, const uint8_t* rgbx, int rgbx_stride); + +// Variants of the above, but taking BGR(A|X) input. +WEBP_EXTERN(int) WebPPictureImportBGR( + WebPPicture* picture, const uint8_t* bgr, int bgr_stride); +WEBP_EXTERN(int) WebPPictureImportBGRA( + WebPPicture* picture, const uint8_t* bgra, int bgra_stride); +WEBP_EXTERN(int) WebPPictureImportBGRX( + WebPPicture* picture, const uint8_t* bgrx, int bgrx_stride); + +// Converts picture->argb data to the YUVA format specified by 'colorspace'. +// Upon return, picture->use_argb is set to false. The presence of real +// non-opaque transparent values is detected, and 'colorspace' will be +// adjusted accordingly. Note that this method is lossy. +// Returns false in case of error. +WEBP_EXTERN(int) WebPPictureARGBToYUVA(WebPPicture* picture, + WebPEncCSP colorspace); + +// Converts picture->yuv to picture->argb and sets picture->use_argb to true. +// The input format must be YUV_420 or YUV_420A. +// Note that the use of this method is discouraged if one has access to the +// raw ARGB samples, since using YUV420 is comparatively lossy. Also, the +// conversion from YUV420 to ARGB incurs a small loss too. +// Returns false in case of error. +WEBP_EXTERN(int) WebPPictureYUVAToARGB(WebPPicture* picture); + +// Helper function: given a width x height plane of YUV(A) samples +// (with stride 'stride'), clean-up the YUV samples under fully transparent +// area, to help compressibility (no guarantee, though). +WEBP_EXTERN(void) WebPCleanupTransparentArea(WebPPicture* picture); + +// Scan the picture 'picture' for the presence of non fully opaque alpha values. +// Returns true in such case. Otherwise returns false (indicating that the +// alpha plane can be ignored altogether e.g.). +WEBP_EXTERN(int) WebPPictureHasTransparency(const WebPPicture* picture); + +//------------------------------------------------------------------------------ +// Main call + +// Main encoding call, after config and picture have been initialized. +// 'picture' must be less than 16384x16384 in dimension (cf WEBP_MAX_DIMENSION), +// and the 'config' object must be a valid one. +// Returns false in case of error, true otherwise. +// In case of error, picture->error_code is updated accordingly. +// 'picture' can hold the source samples in both YUV(A) or ARGB input, depending +// on the value of 'picture->use_argb'. It is highly recommended to use +// the former for lossy encoding, and the latter for lossless encoding +// (when config.lossless is true). Automatic conversion from one format to +// another is provided but they both incur some loss. +WEBP_EXTERN(int) WebPEncode(const WebPConfig* config, WebPPicture* picture); + +//------------------------------------------------------------------------------ + +#if defined(__cplusplus) || defined(c_plusplus) +} // extern "C" +#endif + +#endif /* WEBP_WEBP_ENCODE_H_ */ diff --git a/cocos2dx/platform/third_party/emscripten/libwebp/webp/types.h b/cocos2dx/platform/third_party/emscripten/libwebp/webp/types.h new file mode 100644 index 0000000000..3e27190bef --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libwebp/webp/types.h @@ -0,0 +1,45 @@ +// Copyright 2010 Google Inc. All Rights Reserved. +// +// This code is licensed under the same terms as WebM: +// Software License Agreement: http://www.webmproject.org/license/software/ +// Additional IP Rights Grant: http://www.webmproject.org/license/additional/ +// ----------------------------------------------------------------------------- +// +// Common types +// +// Author: Skal (pascal.massimino@gmail.com) + +#ifndef WEBP_WEBP_TYPES_H_ +#define WEBP_WEBP_TYPES_H_ + +#include // for size_t + +#ifndef _MSC_VER +#include +#ifdef __STRICT_ANSI__ +#define WEBP_INLINE +#else /* __STRICT_ANSI__ */ +#define WEBP_INLINE inline +#endif +#else +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; +typedef long long int int64_t; +#define WEBP_INLINE __forceinline +#endif /* _MSC_VER */ + +#ifndef WEBP_EXTERN +// This explicitly marks library functions and allows for changing the +// signature for e.g., Windows DLL builds. +#define WEBP_EXTERN(type) extern type +#endif /* WEBP_EXTERN */ + +// Macro to check ABI compatibility (same major revision number) +#define WEBP_ABI_IS_INCOMPATIBLE(a, b) (((a) >> 8) != ((b) >> 8)) + +#endif /* WEBP_WEBP_TYPES_H_ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/DOCBparser.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/DOCBparser.h similarity index 88% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/DOCBparser.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/DOCBparser.h index 461d4ee802..9394fa71bd 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/DOCBparser.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/DOCBparser.h @@ -47,44 +47,44 @@ XMLPUBFUN int XMLCALL const unsigned char *in, int *inlen, int quoteChar); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbSAXParseDoc (xmlChar *cur, const char *encoding, docbSAXHandlerPtr sax, void *userData); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbParseDoc (xmlChar *cur, const char *encoding); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbSAXParseFile (const char *filename, const char *encoding, docbSAXHandlerPtr sax, void *userData); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbParseFile (const char *filename, const char *encoding); /** * Interfaces for the Push mode. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL docbFreeParserCtxt (docbParserCtxtPtr ctxt); -XMLPUBFUN docbParserCtxtPtr XMLCALL +XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreatePushParserCtxt(docbSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL docbParseChunk (docbParserCtxtPtr ctxt, const char *chunk, int size, int terminate); -XMLPUBFUN docbParserCtxtPtr XMLCALL +XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreateFileParserCtxt(const char *filename, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL docbParseDocument (docbParserCtxtPtr ctxt); #ifdef __cplusplus diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/HTMLparser.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLparser.h similarity index 92% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/HTMLparser.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLparser.h index 10a3d654f3..551186cb0c 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/HTMLparser.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLparser.h @@ -83,87 +83,87 @@ struct _htmlEntityDesc { /* * There is only few public functions. */ -XMLPUBFUN const htmlElemDesc * XMLCALL +XMLPUBFUN const htmlElemDesc * XMLCALL htmlTagLookup (const xmlChar *tag); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityLookup(const xmlChar *name); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityValueLookup(unsigned int value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseCharRef(htmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlParseElement(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlNewParserCtxt(void); -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateMemoryParserCtxt(const char *buffer, int size); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseDocument(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseDoc (xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlParseDoc (xmlChar *cur, const char *encoding); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, void *userData); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlParseFile (const char *filename, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL UTF8ToHtml (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlEncodeEntities(unsigned char *out, int *outlen, const unsigned char *in, int *inlen, int quoteChar); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsScriptAttribute(const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlHandleOmittedElem(int val); #ifdef LIBXML_PUSH_ENABLED /** * Interfaces for the Push mode. */ -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseChunk (htmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate); #endif /* LIBXML_PUSH_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); /* diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLtree.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLtree.h similarity index 86% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLtree.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLtree.h index 6ea8207895..c0e110330c 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/HTMLtree.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/HTMLtree.h @@ -62,78 +62,78 @@ extern "C" { XMLPUBFUN htmlDocPtr XMLCALL htmlNewDoc (const xmlChar *URI, const xmlChar *ExternalID); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlNewDocNoDtD (const xmlChar *URI, const xmlChar *ExternalID); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL htmlGetMetaEncoding (htmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSetMetaEncoding (htmlDocPtr doc, const xmlChar *encoding); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocDumpMemoryFormat (xmlDocPtr cur, xmlChar **mem, int *size, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlDocDump (FILE *f, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFile (const char *filename, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlNodeDumpFile (FILE *out, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlNodeDumpFileFormat (FILE *out, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFileFormat (const char *filename, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL - htmlNodeDumpOutput (xmlOutputBufferPtr buf, +XMLPUBFUN void XMLCALL + htmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, - xmlNodePtr cur, + xmlNodePtr cur, const char *encoding); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsBooleanAttr (const xmlChar *name); diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX.h similarity index 78% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX.h index 0ca161b608..20093ceb68 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX.h @@ -25,53 +25,53 @@ extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL getPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL getSystemId (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL setDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL + +XMLPUBFUN int XMLCALL getLineNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL getColumnNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL isStandalone (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL hasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL hasExternalSubset (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL internalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL externalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL getEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL getParameterEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL resolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL entityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL attributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, @@ -79,87 +79,87 @@ XMLPUBFUN void XMLCALL int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL elementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL notationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL unparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL startDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL endDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL attribute (void *ctx, const xmlChar *fullname, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL startElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL endElement (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL reference (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL characters (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL ignorableWhitespace (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL processingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL globalNamespace (void *ctx, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL setNamespace (void *ctx, const xmlChar *name); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL getNamespace (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL checkNamespace (void *ctx, xmlChar *nameSpace); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL namespaceDecl (void *ctx, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL comment (void *ctx, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL cdataBlock (void *ctx, const xmlChar *value, int len); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #endif /* LIBXML_SAX1_ENABLED */ diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX2.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX2.h similarity index 82% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX2.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX2.h index 8d2db02d85..daafd17eff 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/SAX2.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/SAX2.h @@ -23,53 +23,53 @@ extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL + +XMLPUBFUN int XMLCALL xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2GetColumnNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EntityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, @@ -77,33 +77,33 @@ XMLPUBFUN void XMLCALL int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ElementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2NotationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EndDocument (void *ctx); #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2StartElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EndElement (void *ctx, const xmlChar *name); #endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ @@ -122,25 +122,25 @@ XMLPUBFUN void XMLCALL const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Reference (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Characters (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Comment (void *ctx, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2CDataBlock (void *ctx, const xmlChar *value, int len); @@ -153,22 +153,22 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSAXVersion (xmlSAXHandler *hdlr, int version); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDefaultSAXHandlerInit (void); #endif #ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL docbDefaultSAXHandlerInit (void); #endif -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit (void); #ifdef __cplusplus } diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/c14n.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/c14n.h similarity index 99% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/c14n.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/c14n.h index 3011af79eb..b8971d9204 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/c14n.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/c14n.h @@ -54,7 +54,7 @@ extern "C" { /* * xmlC14NMode: - * + * * Predefined values for C14N modes * */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/catalog.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/catalog.h similarity index 80% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/catalog.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/catalog.h index b4441370fc..5a13f51b6c 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/catalog.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/catalog.h @@ -68,111 +68,111 @@ typedef xmlCatalog *xmlCatalogPtr; */ XMLPUBFUN xmlCatalogPtr XMLCALL xmlNewCatalog (int sgml); -XMLPUBFUN xmlCatalogPtr XMLCALL +XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadACatalog (const char *filename); -XMLPUBFUN xmlCatalogPtr XMLCALL +XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadSGMLSuperCatalog (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlConvertSGMLCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlACatalogAdd (xmlCatalogPtr catal, const xmlChar *type, const xmlChar *orig, const xmlChar *replace); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlACatalogRemove (xmlCatalogPtr catal, const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolve (xmlCatalogPtr catal, const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveSystem(xmlCatalogPtr catal, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolvePublic(xmlCatalogPtr catal, const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveURI (xmlCatalogPtr catal, const xmlChar *URI); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlACatalogDump (xmlCatalogPtr catal, FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogIsEmpty (xmlCatalogPtr catal); /* * Global operations. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitializeCatalog (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlLoadCatalog (const char *filename); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlLoadCatalogs (const char *paths); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogCleanup (void); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogDump (FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolve (const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveSystem (const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolvePublic (const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveURI (const xmlChar *URI); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogAdd (const xmlChar *type, const xmlChar *orig, const xmlChar *replace); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogRemove (const xmlChar *value); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseCatalogFile (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogConvert (void); /* * Strictly minimal interfaces for per-document catalogs used * by the parser. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogFreeLocal (void *catalogs); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlCatalogAddLocal (void *catalogs, const xmlChar *URL); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolve (void *catalogs, const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI); /* * Preference settings. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogSetDebug (int level); -XMLPUBFUN xmlCatalogPrefer XMLCALL +XMLPUBFUN xmlCatalogPrefer XMLCALL xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogSetDefaults (xmlCatalogAllow allow); -XMLPUBFUN xmlCatalogAllow XMLCALL +XMLPUBFUN xmlCatalogAllow XMLCALL xmlCatalogGetDefaults (void); /* DEPRECATED interfaces */ -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetSystem (const xmlChar *sysID); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetPublic (const xmlChar *pubID); #ifdef __cplusplus diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/chvalid.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/chvalid.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/chvalid.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/chvalid.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/debugXML.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/debugXML.h similarity index 88% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/debugXML.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/debugXML.h index 5a9d20bcf5..5b3be13d85 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/debugXML.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/debugXML.h @@ -25,18 +25,18 @@ extern "C" { /* * The standard Dump routines. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpString (FILE *output, const xmlChar *str); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpAttr (FILE *output, xmlAttrPtr attr, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpAttrList (FILE *output, xmlAttrPtr attr, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpOneNode (FILE *output, xmlNodePtr node, int depth); @@ -54,16 +54,16 @@ XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL xmlDebugDumpDocument (FILE *output, xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpDTD (FILE *output, xmlDtdPtr dtd); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpEntities (FILE *output, xmlDocPtr doc); /**************************************************************** * * - * Checking routines * + * Checking routines * * * ****************************************************************/ @@ -73,16 +73,16 @@ XMLPUBFUN int XMLCALL /**************************************************************** * * - * XML shell helpers * + * XML shell helpers * * * ****************************************************************/ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlLsOneNode (FILE *output, xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlLsCountNode (xmlNodePtr node); -XMLPUBFUN const char * XMLCALL +XMLPUBFUN const char * XMLCALL xmlBoolToText (int boolval); /**************************************************************** @@ -136,63 +136,63 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintXPathError (int errorType, const char *arg); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintXPathResult(xmlXPathObjectPtr list); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellList (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellBase (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellDir (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellLoad (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintNode (xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellCat (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellWrite (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellSave (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellValidate (xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_VALID_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellDu (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellPwd (xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node, @@ -201,12 +201,12 @@ XMLPUBFUN int XMLCALL /* * The Shell interface. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShell (xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, FILE *output); - + #endif /* LIBXML_XPATH_ENABLED */ #ifdef __cplusplus diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/dict.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/dict.h similarity index 77% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/dict.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/dict.h index abb8339cb8..7022ec8bee 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/dict.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/dict.h @@ -11,6 +11,7 @@ #ifndef __XML_DICT_H__ #define __XML_DICT_H__ +#include #include #include @@ -24,37 +25,47 @@ extern "C" { typedef struct _xmlDict xmlDict; typedef xmlDict *xmlDictPtr; +/* + * Initializer + */ +XMLPUBFUN int XMLCALL xmlInitializeDict(void); + /* * Constructor and destructor. */ XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate (void); +XMLPUBFUN size_t XMLCALL + xmlDictSetLimit (xmlDictPtr dict, + size_t limit); +XMLPUBFUN size_t XMLCALL + xmlDictGetUsage (xmlDictPtr dict); XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreateSub(xmlDictPtr sub); XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDictFree (xmlDictPtr dict); /* * Lookup of entry in the dictionnary. */ -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictLookup (xmlDictPtr dict, const xmlChar *name, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictExists (xmlDictPtr dict, const xmlChar *name, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictQLookup (xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name); XMLPUBFUN int XMLCALL xmlDictOwns (xmlDictPtr dict, const xmlChar *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDictSize (xmlDictPtr dict); /* diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/encoding.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/encoding.h similarity index 94% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/encoding.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/encoding.h index 3a3b9b2d82..7967cc66a9 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/encoding.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/encoding.h @@ -163,32 +163,32 @@ extern "C" { /* * Interfaces for encoding handlers. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlGetCharEncodingHandler (xmlCharEncoding enc); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler (const char *name); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); /* * Interfaces for encoding names and aliases. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAddEncodingAlias (const char *name, const char *alias); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDelEncodingAlias (const char *alias); XMLPUBFUN const char * XMLCALL xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupEncodingAliases (void); XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding (const char *name); @@ -202,12 +202,12 @@ XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding (const unsigned char *in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncOutFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncInFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); @@ -215,20 +215,20 @@ XMLPUBFUN int XMLCALL xmlCharEncFirstLine (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); /* * Export a few useful functions */ #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL UTF8Toisolat1 (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL isolat1ToUTF8 (unsigned char *out, int *outlen, const unsigned char *in, diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/entities.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/entities.h similarity index 98% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/entities.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/entities.h index cefb97f780..1e9118975d 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/entities.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/entities.h @@ -58,7 +58,8 @@ struct _xmlEntity { int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ /* this is also used to count entites - * references done from that entity */ + * references done from that entity + * and if it contains '<' */ }; /* diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/globals.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/globals.h similarity index 100% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/globals.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/globals.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/hash.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/hash.h similarity index 90% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/hash.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/hash.h index 7fe4be754c..dc8ab7ec52 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/hash.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/hash.h @@ -1,7 +1,7 @@ /* * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. + * Description: This module implements the hash table support used in + * various places in the library. * * Copy: See Copyright for the status of this software. * @@ -108,40 +108,40 @@ XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashFree (xmlHashTablePtr table, xmlHashDeallocator f); /* * Add a new entry to the hash table. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry (xmlHashTablePtr table, const xmlChar *name, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, @@ -152,13 +152,13 @@ XMLPUBFUN int XMLCALL /* * Remove an entry from the hash table. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f); @@ -166,29 +166,29 @@ XMLPUBFUN int XMLCALL /* * Retrieve the userdata. */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup (xmlHashTablePtr table, const xmlChar *name); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, const xmlChar *name2, const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, @@ -200,27 +200,27 @@ XMLPUBFUN void * XMLCALL /* * Helpers. */ -XMLPUBFUN xmlHashTablePtr XMLCALL +XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCopy (xmlHashTablePtr table, xmlHashCopier f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScan (xmlHashTablePtr table, xmlHashScanner f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScan3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScanFull (xmlHashTablePtr table, xmlHashScannerFull f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/list.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/list.h similarity index 79% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/list.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/list.h index 1d83482430..0504e0cff4 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/list.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/list.h @@ -1,6 +1,6 @@ /* * Summary: lists interfaces - * Description: this module implement the list support used in + * Description: this module implement the list support used in * various place in the library. * * Copy: See Copyright for the status of this software. @@ -55,76 +55,76 @@ typedef int (*xmlListWalker) (const void *data, const void *user); XMLPUBFUN xmlListPtr XMLCALL xmlListCreate (xmlListDeallocator deallocator, xmlListDataCompare compare); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListDelete (xmlListPtr l); /* Basic Operators */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlListSearch (xmlListPtr l, void *data); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlListReverseSearch (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListInsert (xmlListPtr l, void *data) ; -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListAppend (xmlListPtr l, void *data) ; -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveFirst (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveLast (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveAll (xmlListPtr l, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL +XMLPUBFUN xmlLinkPtr XMLCALL xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL +XMLPUBFUN xmlLinkPtr XMLCALL xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListSize (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListPushFront (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListPushBack (xmlListPtr l, void *data); /* Advanced Operators */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListWalk (xmlListPtr l, xmlListWalker walker, const void *user); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListReverseWalk (xmlListPtr l, xmlListWalker walker, const void *user); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListMerge (xmlListPtr l1, xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL +XMLPUBFUN xmlListPtr XMLCALL xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListCopy (xmlListPtr cur, const xmlListPtr old); /* Link operators */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlLinkGetData (xmlLinkPtr lk); /* xmlListUnique() */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/nanoftp.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanoftp.h similarity index 99% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/nanoftp.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanoftp.h index 397bbba74f..abb4bf7142 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/nanoftp.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanoftp.h @@ -31,6 +31,7 @@ * macro used to provide portability of code to windows sockets * the value to be used when the socket is not valid */ +#undef INVALID_SOCKET #define INVALID_SOCKET (-1) #endif diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanohttp.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanohttp.h similarity index 85% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanohttp.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanohttp.h index 1d8ac24b2a..22b8fb4338 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/nanohttp.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/nanohttp.h @@ -7,7 +7,7 @@ * * Author: Daniel Veillard */ - + #ifndef __NANO_HTTP_H__ #define __NANO_HTTP_H__ @@ -20,22 +20,22 @@ extern "C" { #endif XMLPUBFUN void XMLCALL xmlNanoHTTPInit (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPCleanup (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPScanProxy (const char *URL); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPFetch (const char *URL, const char *filename, char **contentType); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPMethod (const char *URL, const char *method, const char *input, char **contentType, const char *headers, int ilen); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPMethodRedir (const char *URL, const char *method, const char *input, @@ -43,16 +43,16 @@ XMLPUBFUN void * XMLCALL char **redir, const char *headers, int ilen); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPOpen (const char *URL, char **contentType); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPOpenRedir (const char *URL, char **contentType, char **redir); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPReturnCode (void *ctx); -XMLPUBFUN const char * XMLCALL +XMLPUBFUN const char * XMLCALL xmlNanoHTTPAuthHeader (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPRedir (void *ctx); @@ -62,16 +62,16 @@ XMLPUBFUN const char * XMLCALL xmlNanoHTTPEncoding (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPMimeType (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPRead (void *ctx, void *dest, int len); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPSave (void *ctxt, const char *filename); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPClose (void *ctx); #ifdef __cplusplus } diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parser.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/parser.h similarity index 94% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parser.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/parser.h index aabb96cfb5..3f5730dc61 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parser.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/parser.h @@ -80,7 +80,7 @@ struct _xmlParserInput { * xmlParserNodeInfo: * * The parser can be asked to collect Node informations, i.e. at what - * place in the file they were detected. + * place in the file they were detected. * NOTE: This is off by default and not very well tested. */ typedef struct _xmlParserNodeInfo xmlParserNodeInfo; @@ -125,9 +125,9 @@ typedef enum { XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ XML_PARSER_IGNORE, /* within an IGNORED section */ - XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ + XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ } xmlParserInputState; /** @@ -221,7 +221,7 @@ struct _xmlParserCtxt { xmlValidCtxt vctxt; /* The validity context */ xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ + int token; /* next char look-ahead */ char *directory; /* the data directory */ @@ -308,6 +308,9 @@ struct _xmlParserCtxt { int nodeInfoNr; /* Depth of the parsing stack */ int nodeInfoMax; /* Max depth of the parsing stack */ xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ + + int input_id; /* we need to label inputs */ + unsigned long sizeentcopy; /* volume of entity copy */ }; /** @@ -398,8 +401,8 @@ typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, /** * entityDeclSAXFunc: * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type + * @name: the entity name + * @type: the entity type * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @content: the entity value (without processing). @@ -429,8 +432,8 @@ typedef void (*notationDeclSAXFunc)(void *ctx, * attributeDeclSAXFunc: * @ctx: the user data (XML parser context) * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type + * @fullname: the attribute name + * @type: the attribute type * @def: the type of default value * @defaultValue: the attribute default value * @tree: the tree of enumerated value set @@ -447,8 +450,8 @@ typedef void (*attributeDeclSAXFunc)(void *ctx, /** * elementDeclSAXFunc: * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type + * @name: the element name + * @type: the element type * @content: the element value tree * * An element definition has been parsed. @@ -535,7 +538,7 @@ typedef void (*attributeSAXFunc) (void *ctx, * @ctx: the user data (XML parser context) * @name: The entity name * - * Called when an entity reference is detected. + * Called when an entity reference is detected. */ typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name); @@ -599,7 +602,7 @@ typedef void (*cdataBlockSAXFunc) ( * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format a warning messages, callback. */ typedef void (XMLCDECL *warningSAXFunc) (void *ctx, @@ -609,7 +612,7 @@ typedef void (XMLCDECL *warningSAXFunc) (void *ctx, * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format an error messages, callback. */ typedef void (XMLCDECL *errorSAXFunc) (void *ctx, @@ -619,7 +622,7 @@ typedef void (XMLCDECL *errorSAXFunc) (void *ctx, * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format fatal error messages, callback. * Note: so far fatalError() SAX callbacks are not used, error() * get all the callbacks for errors. @@ -695,7 +698,7 @@ typedef void (*startElementNsSAX2Func) (void *ctx, int nb_attributes, int nb_defaulted, const xmlChar **attributes); - + /** * endElementNsSAX2Func: * @ctx: the user data (XML parser context) @@ -790,7 +793,7 @@ struct _xmlSAXHandlerV1 { * xmlExternalEntityLoader: * @URL: The System ID of the resource requested * @ID: The Public ID of the resource requested - * @context: the XML parser context + * @context: the XML parser context * * External entity loaders types. * @@ -816,18 +819,18 @@ extern "C" { /* * Init/Cleanup */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitParser (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupParser (void); /* * Input functions */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputRead (xmlParserInputPtr in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputGrow (xmlParserInputPtr in, int len); @@ -835,101 +838,101 @@ XMLPUBFUN int XMLCALL * Basic parsing Interfaces */ #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseFile (const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseMemory (const char *buffer, int size); #endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSubstituteEntitiesDefault(int val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlKeepBlanksDefault (int val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlStopParser (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlPedanticParserDefault(int val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlLineNumbersDefault (int val); #ifdef LIBXML_SAX1_ENABLED /* - * Recovery mode + * Recovery mode */ -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverMemory (const char *buffer, int size); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlRecoverFile (const char *filename); #endif /* LIBXML_SAX1_ENABLED */ /* * Less common routines and SAX interfaces */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseDocument (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAXUserParseFile (xmlSAXHandlerPtr sax, void *user_data, const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, void *user_data, const char *buffer, int size); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseDoc (xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseMemory (xmlSAXHandlerPtr sax, const char *buffer, - int size, + int size, int recovery); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, const char *buffer, - int size, + int size, int recovery, void *data); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseFile (xmlSAXHandlerPtr sax, const char *filename, int recovery); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, const char *filename, int recovery, void *data); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlSAXParseEntity (xmlSAXHandlerPtr sax, const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseEntity (const char *filename); #endif /* LIBXML_SAX1_ENABLED */ #ifdef LIBXML_VALID_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlSAXParseDTD (xmlSAXHandlerPtr sax, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlParseDTD (const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlIOParseDTD (xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, xmlCharEncoding enc); #endif /* LIBXML_VALID_ENABLE */ #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, @@ -944,7 +947,7 @@ XMLPUBFUN xmlParserErrors XMLCALL int options, xmlNodePtr *lst); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, @@ -952,7 +955,7 @@ XMLPUBFUN int XMLCALL const xmlChar *string, xmlNodePtr *lst, int recover); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseExternalEntity (xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data, @@ -961,7 +964,7 @@ XMLPUBFUN int XMLCALL const xmlChar *ID, xmlNodePtr *lst); #endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, const xmlChar *ID, @@ -970,35 +973,35 @@ XMLPUBFUN int XMLCALL /* * Parser contexts handling. */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlNewParserCtxt (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlInitParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlClearParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, const xmlChar* buffer, const char *filename); #endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateDocParserCtxt (const xmlChar *cur); #ifdef LIBXML_LEGACY_ENABLED /* * Reading/setting optional parsing features. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetFeaturesList (int *len, const char **result); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetFeature (xmlParserCtxtPtr ctxt, const char *name, void *result); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSetFeature (xmlParserCtxtPtr ctxt, const char *name, void *value); @@ -1008,13 +1011,13 @@ XMLPUBFUN int XMLCALL /* * Interfaces for the Push mode. */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseChunk (xmlParserCtxtPtr ctxt, const char *chunk, int size, @@ -1025,7 +1028,7 @@ XMLPUBFUN int XMLCALL * Special I/O mode. */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, void *user_data, xmlInputReadCallback ioread, @@ -1033,7 +1036,7 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL void *ioctx, xmlCharEncoding enc); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewIOInputStream (xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc); @@ -1044,14 +1047,14 @@ XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN const xmlParserNodeInfo* XMLCALL xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, const xmlNodePtr node); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN unsigned long XMLCALL +XMLPUBFUN unsigned long XMLCALL xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, const xmlNodePtr node); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, const xmlParserNodeInfoPtr info); @@ -1059,7 +1062,7 @@ XMLPUBFUN void XMLCALL * External entities handling actually implemented in xmlIO. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetExternalEntityLoader(xmlExternalEntityLoader f); XMLPUBFUN xmlExternalEntityLoader XMLCALL xmlGetExternalEntityLoader(void); @@ -1107,7 +1110,8 @@ typedef enum { XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ - XML_PARSE_IGNORE_ENC= 1<<21 /* ignore internal document encoding hint */ + XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ + XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ } xmlParserOption; XMLPUBFUN void XMLCALL @@ -1224,6 +1228,7 @@ typedef enum { XML_WITH_DEBUG_RUN = 30, XML_WITH_ZLIB = 31, XML_WITH_ICU = 32, + XML_WITH_LZMA = 33, XML_WITH_NONE = 99999 /* just to be sure of allocation size */ } xmlFeature; diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parserInternals.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/parserInternals.h similarity index 82% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parserInternals.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/parserInternals.h index a5e75b5e38..6065320eb1 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/parserInternals.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/parserInternals.h @@ -1,5 +1,5 @@ /* - * Summary: internals routines exported by the parser. + * Summary: internals routines and limits exported by the parser. * Description: this module exports a number of internal parsing routines * they are not really all intended for applications but * can prove useful doing low level processing. @@ -36,9 +36,42 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * Maximum size allowed for a single text node when building a tree. * This is not a limitation of the parser but a safety boundary feature, * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 */ #define XML_MAX_TEXT_LENGTH 10000000 +/** + * XML_MAX_NAME_LENGTH: + * + * Maximum size allowed for a markup identitier + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Note that with the use of parsing dictionaries overriding the limit + * may result in more runtime memory usage in face of "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_NAME_LENGTH 50000 + +/** + * XML_MAX_DICTIONARY_LIMIT: + * + * Maximum size allowed by the parser for a dictionary by default + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 + */ +#define XML_MAX_DICTIONARY_LIMIT 10000000 + +/** + * XML_MAX_LOOKUP_LIMIT: + * + * Maximum size allowed by the parser for ahead lookup + * This is an upper boundary enforced by the parser to avoid bad + * behaviour on "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_LOOKUP_LIMIT 10000000 + /** * XML_MAX_NAMELEN: * @@ -57,7 +90,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; /************************************************************************ * * - * UNICODE version of the macros. * + * UNICODE version of the macros. * * * ************************************************************************/ /** @@ -153,7 +186,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * Always false (all combining chars > 0xff) */ -#define IS_COMBINING_CH(c) 0 +#define IS_COMBINING_CH(c) 0 /** * IS_EXTENDER: @@ -194,7 +227,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * Macro to check the following production in the XML spec: * * - * [84] Letter ::= BaseChar | Ideographic + * [84] Letter ::= BaseChar | Ideographic */ #define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) @@ -251,7 +284,7 @@ XMLPUBVAR unsigned int xmlParserMaxDepth; * * Skips the end of line chars. */ -#define SKIP_EOL(p) \ +#define SKIP_EOL(p) \ if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } @@ -288,25 +321,25 @@ XMLPUBFUN int XMLCALL xmlIsLetter (int c); /** * Parser context. */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateFileParserCtxt (const char *filename); -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateURLParserCtxt (const char *filename, int options); -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateMemoryParserCtxt(const char *buffer, int size); -XMLPUBFUN xmlParserCtxtPtr XMLCALL +XMLPUBFUN xmlParserCtxtPtr XMLCALL xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, const xmlChar *base); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSwitchEncoding (xmlParserCtxtPtr ctxt, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, xmlParserInputPtr input, xmlCharEncodingHandlerPtr handler); @@ -324,29 +357,29 @@ XMLPUBFUN void XMLCALL /** * Input Streams. */ -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewStringInputStream (xmlParserCtxtPtr ctxt, const xmlChar *buffer); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlPushInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr input); -XMLPUBFUN xmlChar XMLCALL +XMLPUBFUN xmlChar XMLCALL xmlPopInput (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeInputStream (xmlParserInputPtr input); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputFromFile (xmlParserCtxtPtr ctxt, const char *filename); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewInputStream (xmlParserCtxtPtr ctxt); /** * Namespaces. */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlSplitQName (xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix); @@ -354,112 +387,112 @@ XMLPUBFUN xmlChar * XMLCALL /** * Generic production rules. */ -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlParseName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseNmtoken (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseEntityValue (xmlParserCtxtPtr ctxt, xmlChar **orig); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseAttValue (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseCharData (xmlParserCtxtPtr ctxt, int cdata); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseExternalID (xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseComment (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlParsePITarget (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParsePI (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, xmlChar **value); -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlParseNotationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseAttributeType (xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlParseElementMixedContentDecl (xmlParserCtxtPtr ctxt, int inputchk); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseElementDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseCharRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlParseEntityRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParsePEReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlParseAttribute (xmlParserCtxtPtr ctxt, xmlChar **value); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlParseStartTag (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseEndTag (xmlParserCtxtPtr ctxt); #endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseCDSect (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseContent (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseElement (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseVersionNum (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseEncName (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseSDDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseTextDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseMisc (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParseExternalSubset (xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, - const xmlChar *SystemID); + const xmlChar *SystemID); /** * XML_SUBSTITUTE_NONE: * @@ -483,7 +516,7 @@ XMLPUBFUN void XMLCALL * * Both general and parameter entities need to be substituted. */ -#define XML_SUBSTITUTE_BOTH 3 +#define XML_SUBSTITUTE_BOTH 3 XMLPUBFUN xmlChar * XMLCALL xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, @@ -563,21 +596,21 @@ XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filenam typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, xmlNodePtr firstNode, xmlNodePtr lastNode); - + XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlParseQuotedString (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParseNamespace (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlScanName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, xmlChar **prefix); /** @@ -590,7 +623,7 @@ XMLPUBFUN xmlChar * XMLCALL xmlChar end, xmlChar end2, xmlChar end3); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHandleEntity (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/pattern.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/pattern.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/pattern.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/pattern.h diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/relaxng.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/relaxng.h similarity index 100% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/relaxng.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/relaxng.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/schemasInternals.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/schemasInternals.h similarity index 99% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/schemasInternals.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/schemasInternals.h index b68a6e1285..4f0ca9a1fd 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/schemasInternals.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/schemasInternals.h @@ -104,8 +104,8 @@ typedef enum { XML_SCHEMA_TYPE_IDC_UNIQUE, XML_SCHEMA_TYPE_IDC_KEY, XML_SCHEMA_TYPE_IDC_KEYREF, - XML_SCHEMA_TYPE_PARTICLE = 25, - XML_SCHEMA_TYPE_ATTRIBUTE_USE, + XML_SCHEMA_TYPE_PARTICLE = 25, + XML_SCHEMA_TYPE_ATTRIBUTE_USE, XML_SCHEMA_FACET_MININCLUSIVE = 1000, XML_SCHEMA_FACET_MINEXCLUSIVE, XML_SCHEMA_FACET_MAXINCLUSIVE, diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schematron.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/schematron.h similarity index 92% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schematron.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/schematron.h index f442826ccd..364eaecde6 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/schematron.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/schematron.h @@ -69,17 +69,17 @@ typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; /* * Interfaces for parsing. */ -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewMemParserCtxt(const char *buffer, int size); XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL xmlSchematronNewDocParserCtxt(xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); /***** -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, xmlSchematronValidityErrorFunc err, xmlSchematronValidityWarningFunc warn, @@ -92,9 +92,9 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); *****/ -XMLPUBFUN xmlSchematronPtr XMLCALL +XMLPUBFUN xmlSchematronPtr XMLCALL xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchematronFree (xmlSchematronPtr schema); /* * Interfaces for validating @@ -105,7 +105,7 @@ XMLPUBFUN void XMLCALL xmlStructuredErrorFunc serror, void *ctx); /****** -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidityErrorFunc err, xmlSchematronValidityWarningFunc warn, @@ -125,12 +125,12 @@ XMLPUBFUN int XMLCALL xmlNodePtr elem); *******/ -XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL +XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL xmlSchematronNewValidCtxt (xmlSchematronPtr schema, - int options); -XMLPUBFUN void XMLCALL + int options); +XMLPUBFUN void XMLCALL xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance); diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/threads.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/threads.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/threads.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/threads.h diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/tree.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/tree.h similarity index 85% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/tree.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/tree.h index b733589bc8..7e06686af3 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/tree.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/tree.h @@ -13,6 +13,7 @@ #define __XML_TREE_H__ #include +#include #include #include @@ -74,13 +75,15 @@ typedef enum { XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ - XML_BUFFER_ALLOC_IO /* special allocation scheme used for I/O */ + XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ + XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */ } xmlBufferAllocationScheme; /** * xmlBuffer: * - * A buffer structure. + * A buffer structure, this old construct is limited to 2GB and + * is being deprecated, use API with xmlBuf instead */ typedef struct _xmlBuffer xmlBuffer; typedef xmlBuffer *xmlBufferPtr; @@ -92,6 +95,41 @@ struct _xmlBuffer { xmlChar *contentIO; /* in IO mode we may have a different base */ }; +/** + * xmlBuf: + * + * A buffer structure, new one, the actual structure internals are not public + */ + +typedef struct _xmlBuf xmlBuf; + +/** + * xmlBufPtr: + * + * A pointer to a buffer structure, the actual structure internals are not + * public + */ + +typedef xmlBuf *xmlBufPtr; + +/* + * A few public routines for xmlBuf. As those are expected to be used + * mostly internally the bulk of the routines are internal in buf.h + */ +XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf); +XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); + +/* + * LIBXML2_NEW_BUFFER: + * + * Macro used to express that the API use the new buffers for + * xmlParserInputBuffer and xmlOutputBuffer. The change was + * introduced in 2.9.0. + */ +#define LIBXML2_NEW_BUFFER + /** * XML_XML_NAMESPACE: * @@ -479,7 +517,7 @@ struct _xmlNode { /** * XML_GET_LINE: * - * Macro to extract the line number of an element node. + * Macro to extract the line number of an element node. */ #define XML_GET_LINE(n) \ (xmlGetLineNo(n)) @@ -522,7 +560,7 @@ struct _xmlDoc { /* End of common part */ int compression;/* level of zlib compression */ - int standalone; /* standalone document (no external refs) + int standalone; /* standalone document (no external refs) 1 if standalone="yes" 0 if standalone="no" -1 if there is no XML declaration @@ -553,9 +591,9 @@ typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; /** * xmlDOMWrapAcquireNsFunction: * @ctxt: a DOM wrapper context - * @node: the context node (element or attribute) + * @node: the context node (element or attribute) * @nsName: the requested namespace name - * @nsPrefix: the requested namespace prefix + * @nsPrefix: the requested namespace prefix * * A function called to acquire namespaces (xmlNs) from the wrapper. * @@ -602,7 +640,7 @@ struct _xmlDOMWrapCtxt { /** * xmlRootNode: * - * Macro for compatibility naming layer with libxml1. Maps + * Macro for compatibility naming layer with libxml1. Maps * to "children". */ #ifndef xmlRootNode @@ -623,429 +661,436 @@ XMLPUBFUN int XMLCALL #endif #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateQName (const xmlChar *value, int space); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateName (const xmlChar *value, int space); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNMToken (const xmlChar *value, int space); #endif -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlBuildQName (const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlSplitQName2 (const xmlChar *name, xmlChar **prefix); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlSplitQName3 (const xmlChar *name, int *len); /* - * Handling Buffers. + * Handling Buffers, the old ones see @xmlBuf for the new ones. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); -XMLPUBFUN xmlBufferAllocationScheme XMLCALL +XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlGetBufferAllocationScheme(void); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate (void); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateSize (size_t size); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateStatic (void *mem, size_t size); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferResize (xmlBufferPtr buf, unsigned int size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferFree (xmlBufferPtr buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferDump (FILE *file, xmlBufferPtr buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferAdd (xmlBufferPtr buf, const xmlChar *str, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferAddHead (xmlBufferPtr buf, const xmlChar *str, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferCat (xmlBufferPtr buf, const xmlChar *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferCCat (xmlBufferPtr buf, const char *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferShrink (xmlBufferPtr buf, unsigned int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferGrow (xmlBufferPtr buf, unsigned int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferEmpty (xmlBufferPtr buf); -XMLPUBFUN const xmlChar* XMLCALL +XMLPUBFUN const xmlChar* XMLCALL xmlBufferContent (const xmlBufferPtr buf); -XMLPUBFUN void XMLCALL +XMLPUBFUN xmlChar* XMLCALL + xmlBufferDetach (xmlBufferPtr buf); +XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferLength (const xmlBufferPtr buf); /* * Creating/freeing new structures. */ -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlCreateIntSubset (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlNewDtd (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlGetIntSubset (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeDtd (xmlDtdPtr cur); #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlNewGlobalNs (xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix); #endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs (xmlNodePtr node, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNs (xmlNsPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNsList (xmlNsPtr cur); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc (const xmlChar *version); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeDoc (xmlDocPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, const xmlChar *value); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); #endif -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsPropEatName (xmlNodePtr node, xmlNsPtr ns, xmlChar *name, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreePropList (xmlAttrPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeProp (xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyProp (xmlNodePtr target, xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyPropList (xmlNodePtr target, xmlAttrPtr cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlCopyDtd (xmlDtdPtr dtd); #endif /* LIBXML_TREE_ENABLED */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlCopyDoc (xmlDocPtr doc, int recursive); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Creating new nodes. */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNodeEatName (xmlDocPtr doc, xmlNsPtr ns, xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewNode (xmlNsPtr ns, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewNodeEatName (xmlNsPtr ns, xmlChar *name); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); #endif -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocText (xmlDocPtr doc, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewText (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocPI (xmlDocPtr doc, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewPI (const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocTextLen (xmlDocPtr doc, const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextLen (const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocComment (xmlDocPtr doc, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewCDataBlock (xmlDocPtr doc, const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewCharRef (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewReference (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlCopyNode (const xmlNodePtr node, int recursive); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNode (const xmlNodePtr node, xmlDocPtr doc, int recursive); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNodeList (xmlDocPtr doc, const xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlCopyNodeList (const xmlNodePtr node); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocRawNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocFragment (xmlDocPtr doc); #endif /* LIBXML_TREE_ENABLED */ /* * Navigating. */ -XMLPUBFUN long XMLCALL +XMLPUBFUN long XMLCALL xmlGetLineNo (xmlNodePtr node); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlGetNodePath (xmlNodePtr node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocGetRootElement (xmlDocPtr doc); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlGetLastChild (xmlNodePtr parent); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNodeIsText (xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsBlankNode (xmlNodePtr node); /* * Changing the structure. */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetName (xmlNodePtr cur, const xmlChar *name); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild (xmlNodePtr parent, xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddChildList (xmlNodePtr parent, xmlNodePtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlReplaceNode (xmlNodePtr old, xmlNodePtr cur); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem); #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddNextSibling (xmlNodePtr cur, xmlNodePtr elem); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlUnlinkNode (xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextMerge (xmlNodePtr first, xmlNodePtr second); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextConcat (xmlNodePtr node, const xmlChar *content, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNodeList (xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNode (xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetTreeDoc (xmlNodePtr tree, xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetListDoc (xmlNodePtr list, xmlDocPtr doc); /* * Namespaces. */ -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs (xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNsByHref (xmlDocPtr doc, xmlNodePtr node, const xmlChar *href); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNsPtr * XMLCALL +XMLPUBFUN xmlNsPtr * XMLCALL xmlGetNsList (xmlDocPtr doc, xmlNodePtr node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetNs (xmlNodePtr node, xmlNsPtr ns); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespace (xmlNsPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespaceList (xmlNsPtr cur); /* * Changing the content. */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlSetProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlSetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlGetNoNsProp (xmlNodePtr node, const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlGetProp (xmlNodePtr node, const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlHasProp (xmlNodePtr node, const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlHasNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlGetNsProp (xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlStringGetNodeList (xmlDocPtr doc, const xmlChar *value); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlStringLenGetNodeList (xmlDocPtr doc, const xmlChar *value, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNodeListGetString (xmlDocPtr doc, xmlNodePtr list, int inLine); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNodeListGetRawString (xmlDocPtr doc, xmlNodePtr list, int inLine); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetContent (xmlNodePtr cur, const xmlChar *content); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetContentLen (xmlNodePtr cur, const xmlChar *content, int len); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeAddContent (xmlNodePtr cur, const xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeAddContentLen (xmlNodePtr cur, const xmlChar *content, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNodeGetContent (xmlNodePtr cur); + XMLPUBFUN int XMLCALL xmlNodeBufGetContent (xmlBufferPtr buffer, xmlNodePtr cur); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN int XMLCALL + xmlBufGetNodeContent (xmlBufPtr buf, + xmlNodePtr cur); + +XMLPUBFUN xmlChar * XMLCALL xmlNodeGetLang (xmlNodePtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNodeGetSpacePreserve (xmlNodePtr cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetSpacePreserve (xmlNodePtr cur, int val); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNodeGetBase (xmlDocPtr doc, xmlNodePtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetBase (xmlNodePtr cur, const xmlChar *uri); #endif @@ -1053,14 +1098,14 @@ XMLPUBFUN void XMLCALL /* * Removing content. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRemoveProp (xmlAttrPtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlUnsetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlUnsetProp (xmlNodePtr node, const xmlChar *name); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ @@ -1068,13 +1113,13 @@ XMLPUBFUN int XMLCALL /* * Internal, don't use. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteCHAR (xmlBufferPtr buf, const xmlChar *string); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteChar (xmlBufferPtr buf, const char *string); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string); @@ -1089,7 +1134,7 @@ XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, /* * Namespace handling. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlReconciliateNs (xmlDocPtr doc, xmlNodePtr tree); #endif @@ -1098,61 +1143,67 @@ XMLPUBFUN int XMLCALL /* * Saving. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpFormatMemory (xmlDocPtr cur, xmlChar **mem, int *size, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpMemoryEnc (xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDocFormatDump (FILE *f, xmlDocPtr cur, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDocDump (FILE *f, xmlDocPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlElemDump (FILE *f, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFile (const char *filename, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFile (const char *filename, xmlDocPtr cur, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN size_t XMLCALL + xmlBufNodeDump (xmlBufPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); +XMLPUBFUN int XMLCALL xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, @@ -1160,13 +1211,13 @@ XMLPUBFUN void XMLCALL int format, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFileEnc (const char *filename, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); @@ -1175,21 +1226,21 @@ XMLPUBFUN int XMLCALL /* * XHTML */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsXHTML (const xmlChar *systemID, const xmlChar *publicID); /* * Compression. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetDocCompressMode (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetDocCompressMode (xmlDocPtr doc, int mode); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetCompressMode (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetCompressMode (int mode); /* @@ -1207,7 +1258,7 @@ XMLPUBFUN int XMLCALL xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, - xmlDocPtr destDoc, + xmlDocPtr destDoc, xmlNodePtr destParent, int options); XMLPUBFUN int XMLCALL diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/uri.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/uri.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/uri.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/uri.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/valid.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/valid.h similarity index 84% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/valid.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/valid.h index a2307f1212..2bc7b380c1 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/valid.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/valid.h @@ -150,55 +150,55 @@ typedef struct _xmlHashTable xmlRefTable; typedef xmlRefTable *xmlRefTablePtr; /* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL +XMLPUBFUN xmlNotationPtr XMLCALL xmlAddNotationDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL +XMLPUBFUN xmlNotationTablePtr XMLCALL xmlCopyNotationTable (xmlNotationTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNotationTable (xmlNotationTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpNotationDecl (xmlBufferPtr buf, xmlNotationPtr nota); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpNotationTable (xmlBufferPtr buf, xmlNotationTablePtr table); #endif /* LIBXML_OUTPUT_ENABLED */ /* Element Content */ /* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewElementContent (const xmlChar *name, xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeElementContent (xmlElementContentPtr cur); /* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewDocElementContent (xmlDocPtr doc, const xmlChar *name, xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int englob); #ifdef LIBXML_OUTPUT_ENABLED /* DEPRECATED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSprintfElementContent(char *buf, xmlElementContentPtr content, int englob); @@ -206,39 +206,39 @@ XMLPUBFUN void XMLCALL /* DEPRECATED */ /* Element */ -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlAddElementDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL +XMLPUBFUN xmlElementTablePtr XMLCALL xmlCopyElementTable (xmlElementTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeElementTable (xmlElementTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpElementTable (xmlBufferPtr buf, xmlElementTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpElementDecl (xmlBufferPtr buf, xmlElementPtr elem); #endif /* LIBXML_OUTPUT_ENABLED */ /* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeEnumeration (xmlEnumerationPtr cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCopyEnumeration (xmlEnumerationPtr cur); #endif /* LIBXML_TREE_ENABLED */ /* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem, @@ -249,55 +249,55 @@ XMLPUBFUN xmlAttributePtr XMLCALL const xmlChar *defaultValue, xmlEnumerationPtr tree); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL +XMLPUBFUN xmlAttributeTablePtr XMLCALL xmlCopyAttributeTable (xmlAttributeTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeAttributeTable (xmlAttributeTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpAttributeTable (xmlBufferPtr buf, xmlAttributeTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpAttributeDecl (xmlBufferPtr buf, xmlAttributePtr attr); #endif /* LIBXML_OUTPUT_ENABLED */ /* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL +XMLPUBFUN xmlIDPtr XMLCALL xmlAddID (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlGetID (xmlDocPtr doc, const xmlChar *ID); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsID (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, +XMLPUBFUN int XMLCALL + xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr); /* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL +XMLPUBFUN xmlRefPtr XMLCALL xmlAddRef (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsRef (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, +XMLPUBFUN int XMLCALL + xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL +XMLPUBFUN xmlListPtr XMLCALL xmlGetRefs (xmlDocPtr doc, const xmlChar *ID); @@ -306,146 +306,146 @@ XMLPUBFUN xmlListPtr XMLCALL */ #ifdef LIBXML_VALID_ENABLED /* Allocate/Release Validation Contexts */ -XMLPUBFUN xmlValidCtxtPtr XMLCALL +XMLPUBFUN xmlValidCtxtPtr XMLCALL xmlNewValidCtxt(void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeValidCtxt(xmlValidCtxtPtr); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateRoot (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateElementDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr elem); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlAttributePtr attr); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNotationPtr nota); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDtd (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDocument (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc); #endif /* LIBXML_VALID_ENABLED */ #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNotationUse (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *notationName); #endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsMixedElement (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdQAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL +XMLPUBFUN xmlNotationPtr XMLCALL xmlGetDtdNotationDesc (xmlDtdPtr dtd, const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdQElementDesc (xmlDtdPtr dtd, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdElementDesc (xmlDtdPtr dtd, const xmlChar *name); #ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **names, int *len, int max); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, int max); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNameValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNamesValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNmtokenValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNmtokensValue(const xmlChar *value); #ifdef LIBXML_REGEXP_ENABLED /* * Validation based on the regexp support */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePushElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *qname); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePushCData (xmlValidCtxtPtr ctxt, const xmlChar *data, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePopElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xinclude.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xinclude.h similarity index 100% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xinclude.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xinclude.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xlink.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xlink.h similarity index 96% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xlink.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xlink.h index 083c7eda40..a209a9976d 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xlink.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xlink.h @@ -57,7 +57,7 @@ typedef enum { * xlinkNodeDetectFunc: * @ctx: user data pointer * @node: the node to check - * + * * This is the prototype for the link detection routine. * It calls the default link detection callbacks upon link detection. */ @@ -157,26 +157,26 @@ struct _xlinkHandler { /* * The default detection routine, can be overridden, they call the default - * detection callbacks. + * detection callbacks. */ -XMLPUBFUN xlinkNodeDetectFunc XMLCALL +XMLPUBFUN xlinkNodeDetectFunc XMLCALL xlinkGetDefaultDetect (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xlinkSetDefaultDetect (xlinkNodeDetectFunc func); /* * Routines to set/get the default handlers. */ -XMLPUBFUN xlinkHandlerPtr XMLCALL +XMLPUBFUN xlinkHandlerPtr XMLCALL xlinkGetDefaultHandler (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xlinkSetDefaultHandler (xlinkHandlerPtr handler); /* * Link detection module itself. */ -XMLPUBFUN xlinkType XMLCALL +XMLPUBFUN xlinkType XMLCALL xlinkIsLink (xmlDocPtr doc, xmlNodePtr node); diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlIO.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlIO.h similarity index 80% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlIO.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlIO.h index eea9ed6c03..6c241a8dde 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlIO.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlIO.h @@ -26,7 +26,7 @@ extern "C" { * xmlInputMatchCallback: * @filename: the filename or URI * - * Callback used in the I/O Input API to detect if the current handler + * Callback used in the I/O Input API to detect if the current handler * can provide input fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Input module should be used @@ -72,7 +72,7 @@ typedef int (XMLCALL *xmlInputCloseCallback) (void * context); * xmlOutputMatchCallback: * @filename: the filename or URI * - * Callback used in the I/O Output API to detect if the current handler + * Callback used in the I/O Output API to detect if the current handler * can provide output fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Output module should be used @@ -126,11 +126,11 @@ struct _xmlParserInputBuffer { void* context; xmlInputReadCallback readcallback; xmlInputCloseCallback closecallback; - + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ - xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ + xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ int error; unsigned long rawconsumed;/* amount consumed from raw */ @@ -142,11 +142,11 @@ struct _xmlOutputBuffer { void* context; xmlOutputWriteCallback writecallback; xmlOutputCloseCallback closecallback; - + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ - xmlBufferPtr conv; /* if encoder != NULL buffer for output */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBufPtr conv; /* if encoder != NULL buffer for output */ int written; /* total number of byte written */ int error; }; @@ -155,13 +155,13 @@ struct _xmlOutputBuffer { /* * Interfaces for input */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks (void); XMLPUBFUN int XMLCALL xmlPopInputCallbacks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks (void); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer (xmlCharEncoding enc); @@ -186,22 +186,22 @@ XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferRead (xmlParserInputBufferPtr in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferGrow (xmlParserInputBufferPtr in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferPush (xmlParserInputBufferPtr in, int len, const char *buf); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); -XMLPUBFUN char * XMLCALL +XMLPUBFUN char * XMLCALL xmlParserGetDirectory (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc, @@ -215,9 +215,9 @@ xmlParserInputBufferPtr /* * Interfaces for output */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupOutputCallbacks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterDefaultOutputCallbacks(void); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); @@ -245,24 +245,30 @@ XMLPUBFUN xmlOutputBufferPtr XMLCALL void *ioctx, xmlCharEncodingHandlerPtr encoder); -XMLPUBFUN int XMLCALL +/* Couple of APIs to get the output without digging into the buffers */ +XMLPUBFUN const xmlChar * XMLCALL + xmlOutputBufferGetContent (xmlOutputBufferPtr out); +XMLPUBFUN size_t XMLCALL + xmlOutputBufferGetSize (xmlOutputBufferPtr out); + +XMLPUBFUN int XMLCALL xmlOutputBufferWrite (xmlOutputBufferPtr out, int len, const char *buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferWriteString (xmlOutputBufferPtr out, const char *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, const xmlChar *str, xmlCharEncodingOutputFunc escaping); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferFlush (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferClose (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc, @@ -275,10 +281,10 @@ xmlOutputBufferPtr #ifdef LIBXML_HTTP_ENABLED /* This function only exists if HTTP support built into the library */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterHTTPPostCallbacks (void ); #endif /* LIBXML_HTTP_ENABLED */ - + #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN xmlParserInputPtr XMLCALL @@ -288,69 +294,69 @@ XMLPUBFUN xmlParserInputPtr XMLCALL /* * A predefined entity loader disabling network accesses */ -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNoNetExternalEntityLoader (const char *URL, const char *ID, xmlParserCtxtPtr ctxt); -/* - * xmlNormalizeWindowsPath is obsolete, don't use it. +/* + * xmlNormalizeWindowsPath is obsolete, don't use it. * Check xmlCanonicPath in uri.h for a better alternative. */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNormalizeWindowsPath (const xmlChar *path); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCheckFilename (const char *path); /** - * Default 'file://' protocol callbacks + * Default 'file://' protocol callbacks */ -XMLPUBFUN int XMLCALL - xmlFileMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlFileOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlFileRead (void * context, - char * buffer, +XMLPUBFUN int XMLCALL + xmlFileMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlFileOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlFileRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlFileClose (void * context); +XMLPUBFUN int XMLCALL + xmlFileClose (void * context); /** - * Default 'http://' protocol callbacks + * Default 'http://' protocol callbacks */ #ifdef LIBXML_HTTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOHTTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOHTTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpen (const char *filename); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlIOHTTPOpenW (const char * post_uri, int compression ); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - xmlIOHTTPRead (void * context, - char * buffer, +XMLPUBFUN int XMLCALL + xmlIOHTTPRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlIOHTTPClose (void * context); +XMLPUBFUN int XMLCALL + xmlIOHTTPClose (void * context); #endif /* LIBXML_HTTP_ENABLED */ /** - * Default 'ftp://' protocol callbacks + * Default 'ftp://' protocol callbacks */ -#ifdef LIBXML_FTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOFTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOFTPOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlIOFTPRead (void * context, - char * buffer, +#ifdef LIBXML_FTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOFTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOFTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOFTPRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlIOFTPClose (void * context); +XMLPUBFUN int XMLCALL + xmlIOFTPClose (void * context); #endif /* LIBXML_FTP_ENABLED */ #ifdef __cplusplus diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlautomata.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlautomata.h similarity index 81% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlautomata.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlautomata.h index f98b55e2b8..bf1b131c65 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlautomata.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlautomata.h @@ -40,25 +40,25 @@ typedef xmlAutomataState *xmlAutomataStatePtr; /* * Building API */ -XMLPUBFUN xmlAutomataPtr XMLCALL +XMLPUBFUN xmlAutomataPtr XMLCALL xmlNewAutomata (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeAutomata (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataGetInitState (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataSetFinalState (xmlAutomataPtr am, xmlAutomataStatePtr state); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewState (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -73,7 +73,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL const xmlChar *token2, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -81,7 +81,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int min, int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -90,7 +90,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int min, int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewOnceTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -99,46 +99,46 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, + xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, - xmlAutomataStatePtr to, + xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, - int min, - int max, + int min, + int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewAllTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int lax); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewEpsilon (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountedTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCounterTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataNewCounter (xmlAutomataPtr am, int min, int max); -XMLPUBFUN xmlRegexpPtr XMLCALL +XMLPUBFUN xmlRegexpPtr XMLCALL xmlAutomataCompile (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataIsDeterminist (xmlAutomataPtr am); #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_AUTOMATA_ENABLED */ #endif /* LIBXML_REGEXP_ENABLED */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlerror.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlerror.h similarity index 99% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlerror.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlerror.h index e924211235..537a396c6d 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlerror.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlerror.h @@ -62,7 +62,9 @@ typedef enum { XML_FROM_WRITER, /* The xmlwriter module */ XML_FROM_MODULE, /* The dynamically loaded module module*/ XML_FROM_I18N, /* The module handling character conversion */ - XML_FROM_SCHEMATRONV /* The Schematron validator module */ + XML_FROM_SCHEMATRONV,/* The Schematron validator module */ + XML_FROM_BUFFER, /* The buffers module */ + XML_FROM_URI /* The URI module */ } xmlErrorDomain; /** @@ -205,6 +207,8 @@ typedef enum { XML_WAR_ENTITY_REDEFINED, /* 107 */ XML_ERR_UNKNOWN_VERSION, /* 108 */ XML_ERR_VERSION_MISMATCH, /* 109 */ + XML_ERR_NAME_TOO_LONG, /* 110 */ + XML_ERR_USER_STOP, /* 111 */ XML_NS_ERR_XML_NAMESPACE = 200, XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ XML_NS_ERR_QNAME, /* 202 */ @@ -825,11 +829,8 @@ typedef enum { XML_I18N_NO_HANDLER, /* 6001 */ XML_I18N_EXCESS_HANDLER, /* 6002 */ XML_I18N_CONV_FAILED, /* 6003 */ - XML_I18N_NO_OUTPUT /* 6004 */ -#if 0 - XML_CHECK_, /* 5033 */ - XML_CHECK_X /* 503 */ -#endif + XML_I18N_NO_OUTPUT, /* 6004 */ + XML_BUF_OVERFLOW = 7000 } xmlParserErrors; /** diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlexports.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlexports.h similarity index 98% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlexports.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlexports.h index 9c6790c80f..2c79f814b4 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlexports.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlexports.h @@ -43,7 +43,7 @@ /** * XMLCDECL: * - * Macro which declares the calling convention for exported functions that + * Macro which declares the calling convention for exported functions that * use '...'. */ #define XMLCDECL @@ -115,7 +115,7 @@ */ #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) extern #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlmemory.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlmemory.h similarity index 100% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlmemory.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlmemory.h diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlmodule.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlmodule.h similarity index 99% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlmodule.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlmodule.h index 8f4a56035b..9667820070 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlmodule.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlmodule.h @@ -50,7 +50,7 @@ XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_MODULES_ENABLED */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlreader.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlreader.h similarity index 91% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlreader.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlreader.h index 696448258b..2c99e3a765 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlreader.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlreader.h @@ -130,16 +130,16 @@ XMLPUBFUN int XMLCALL #ifdef LIBXML_WRITER_ENABLED XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); + xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); + xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); #endif XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadString (xmlTextReaderPtr reader); + xmlTextReaderReadString (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL - xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); + xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); /* * Attributes of the node @@ -284,6 +284,11 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng); +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, + xmlRelaxNGValidCtxtPtr ctxt, + int options); + XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema); @@ -392,27 +397,26 @@ typedef void * xmlTextReaderLocatorPtr; * * Signature of an error callback from a reader parser */ -typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, - const char *msg, - xmlParserSeverities severity, - xmlTextReaderLocatorPtr locator); +typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, + const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator); XMLPUBFUN int XMLCALL - xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); -/*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ + xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); + xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg); + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, + void *arg); XMLPUBFUN void XMLCALL - xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg); + xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, + void *arg); XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg); + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, + void **arg); #endif /* LIBXML_READER_ENABLED */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlregexp.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlregexp.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlregexp.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlregexp.h diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlsave.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlsave.h similarity index 100% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlsave.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlsave.h diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemas.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemas.h similarity index 84% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemas.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemas.h index 752bc3ad79..97930c7c3f 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemas.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemas.h @@ -92,7 +92,8 @@ typedef xmlSchema *xmlSchemaPtr; * * Signature of an error callback from an XSD validation */ -typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlSchemaValidityWarningFunc: @@ -102,7 +103,8 @@ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, * * Signature of a warning callback from an XSD validation */ -typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); /** * A schemas validation context @@ -113,6 +115,22 @@ typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; +/** + * xmlSchemaValidityLocatorFunc: + * @ctx: user provided context + * @file: returned file information + * @line: returned line information + * + * A schemas validation locator, a callback called by the validator. + * This is used when file or node informations are not available + * to find out what file and line number are affected + * + * Returns: 0 in case of success and -1 in case of error + */ + +typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, + const char **file, unsigned long *line); + /* * Interfaces for parsing. */ @@ -171,6 +189,9 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, int options); +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, + const char *filename); XMLPUBFUN int XMLCALL xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); @@ -210,6 +231,13 @@ XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL void **user_data); XMLPUBFUN int XMLCALL xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); + + +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, + xmlSchemaValidityLocatorFunc f, + void *ctxt); + #ifdef __cplusplus } #endif diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlschemastypes.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemastypes.h similarity index 85% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlschemastypes.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemastypes.h index 9a3a7a175e..35d48d414b 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlschemastypes.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlschemastypes.h @@ -30,23 +30,23 @@ typedef enum { XML_SCHEMA_WHITESPACE_COLLAPSE = 3 } xmlSchemaWhitespaceValueType; -XMLPUBFUN void XMLCALL - xmlSchemaInitTypes (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL + xmlSchemaInitTypes (void); +XMLPUBFUN void XMLCALL xmlSchemaCleanupTypes (void); -XMLPUBFUN xmlSchemaTypePtr XMLCALL +XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetPredefinedType (const xmlChar *name, const xmlChar *ns); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidateFacet (xmlSchemaTypePtr base, xmlSchemaFacetPtr facet, const xmlChar *value, @@ -54,25 +54,25 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, + xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaFacetPtr XMLCALL +XMLPUBFUN xmlSchemaFacetPtr XMLCALL xmlSchemaNewFacet (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, xmlSchemaTypePtr typeDecl, xmlSchemaParserCtxtPtr ctxt, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaCompareValues (xmlSchemaValPtr x, xmlSchemaValPtr y); -XMLPUBFUN xmlSchemaTypePtr XMLCALL +XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); XMLPUBFUN int XMLCALL xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, @@ -82,7 +82,7 @@ XMLPUBFUN int XMLCALL XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInType (xmlSchemaValType type); XMLPUBFUN int XMLCALL - xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, + xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, int facetType); XMLPUBFUN xmlChar * XMLCALL xmlSchemaCollapseString (const xmlChar *value); @@ -91,7 +91,7 @@ XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN unsigned long XMLCALL xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, + xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val, @@ -100,19 +100,19 @@ XMLPUBFUN int XMLCALL xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaValType valType, const xmlChar *value, - xmlSchemaValPtr val, + xmlSchemaValPtr val, unsigned long *length, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, + xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, const xmlChar *value, - xmlSchemaValPtr *val, + xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlSchemaGetCanonValue (xmlSchemaValPtr val, const xmlChar **retValue); XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, + xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, const xmlChar **retValue, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlstring.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlstring.h similarity index 98% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlstring.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlstring.h index 0bc6888865..2036236582 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlstring.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlstring.h @@ -113,16 +113,16 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlUTF8Strsize (const xmlChar *utf, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strndup (const xmlChar *utf, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlUTF8Strpos (const xmlChar *utf, int pos); XMLPUBFUN int XMLCALL xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strsub (const xmlChar *utf, int start, int len); diff --git a/cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlunicode.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlunicode.h similarity index 100% rename from cocos2dx/platform/third_party/android/prebuilt/libxml2/include/libxml/xmlunicode.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlunicode.h diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlversion.h similarity index 92% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlversion.h index c6d96e9e5d..1128218a06 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlversion.h @@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.7.8" +#define LIBXML_DOTTED_VERSION "2.9.1" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20708 +#define LIBXML_VERSION 20901 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20708" +#define LIBXML_VERSION_STRING "20901" /** * LIBXML_VERSION_EXTRA: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20708); +#define LIBXML_TEST_VERSION xmlCheckVersion(20901); #ifndef VMS #if 0 @@ -90,13 +90,22 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the thread support is configured in */ -#if 1 +#if 0 #if defined(_REENTRANT) || defined(__MT__) || \ (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if 0 +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + /** * LIBXML_TREE_ENABLED: * @@ -165,7 +174,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the FTP support is configured in */ -#if 1 +#if 0 #define LIBXML_FTP_ENABLED #endif @@ -174,7 +183,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether the HTTP support is configured in */ -#if 1 +#if 0 #define LIBXML_HTTP_ENABLED #endif @@ -391,6 +400,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #define LIBXML_ZLIB_ENABLED #endif +/** + * LIBXML_LZMA_ENABLED: + * + * Whether the Lzma support is compiled in + */ +#if 0 +#define LIBXML_LZMA_ENABLED +#endif + #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include @@ -403,7 +421,11 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); */ #ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) +# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) +# define ATTRIBUTE_UNUSED __attribute__((unused)) +# else +# define ATTRIBUTE_UNUSED +# endif #endif /** diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlwriter.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlwriter.h similarity index 99% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlwriter.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlwriter.h index 91e683c88c..dd5add3416 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xmlwriter.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xmlwriter.h @@ -1,4 +1,3 @@ - /* * Summary: text writing API for XML * Description: text writing API for XML @@ -471,6 +470,10 @@ extern "C" { xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str); + XMLPUBFUN int XMLCALL + xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); + + /* * misc */ diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpath.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpath.h similarity index 91% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpath.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpath.h index ddd9dd82b5..d96776c518 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpath.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpath.h @@ -33,7 +33,7 @@ extern "C" { #endif #endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ - + #ifdef LIBXML_XPATH_ENABLED typedef struct _xmlXPathContext xmlXPathContext; @@ -69,7 +69,8 @@ typedef enum { XPATH_ENCODING_ERROR, XPATH_INVALID_CHAR_ERROR, XPATH_INVALID_CTXT, - XPATH_STACK_ERROR + XPATH_STACK_ERROR, + XPATH_FORBID_VARIABLE_ERROR } xmlXPathError; /* @@ -272,11 +273,11 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, * * Expression evaluation occurs with respect to a context. * he context consists of: - * - a node (the context node) - * - a node list (the context node list) - * - a set of variable bindings - * - a function library - * - the set of namespace declarations in scope for the expression + * - a node (the context node) + * - a node list (the context node list) + * - a set of variable bindings + * - a function library + * - the set of namespace declarations in scope for the expression * Following the switch to hash tables, this need to be trimmed up at * the next binary incompatible release. * The node may be modified when the context is passed to libxml2 @@ -420,7 +421,7 @@ XMLPUBVAR double xmlXPathNINF; * @index is out of range (0 to length-1) */ #define xmlXPathNodeSetItem(ns, index) \ - ((((ns) != NULL) && \ + ((((ns) != NULL) && \ ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ (ns)->nodeTab[(index)] \ : NULL) @@ -436,64 +437,64 @@ XMLPUBVAR double xmlXPathNINF; (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeObject (xmlXPathObjectPtr obj); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeSetCreate (xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeNodeSet (xmlNodeSetPtr obj); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathObjectCopy (xmlXPathObjectPtr val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCmpNodes (xmlNodePtr node1, xmlNodePtr node2); /** * Conversion functions to basic types. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastNumberToBoolean (double val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastStringToBoolean (const xmlChar * val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastToBoolean (xmlXPathObjectPtr val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastBooleanToNumber (int val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastStringToNumber (const xmlChar * val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastNodeToNumber (xmlNodePtr node); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastToNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastBooleanToString (int val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNumberToString (double val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeToString (xmlNodePtr node); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastToString (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertBoolean (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertString (xmlXPathObjectPtr val); /** * Context handling. */ -XMLPUBFUN xmlXPathContextPtr XMLCALL +XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPathNewContext (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlXPathFreeContext (xmlXPathContextPtr ctxt); @@ -505,36 +506,43 @@ XMLPUBFUN int XMLCALL /** * Evaluation functions. */ -XMLPUBFUN long XMLCALL +XMLPUBFUN long XMLCALL xmlXPathOrderDocElems (xmlDocPtr doc); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN int XMLCALL + xmlXPathSetContextNode (xmlNodePtr node, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNodeEval (xmlNodePtr node, + const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEval (const xmlChar *str, xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEvalExpression (const xmlChar *str, xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, xmlXPathObjectPtr res); /** * Separate compilation/evaluation entry points. */ -XMLPUBFUN xmlXPathCompExprPtr XMLCALL +XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCompile (const xmlChar *str); -XMLPUBFUN xmlXPathCompExprPtr XMLCALL +XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, - const xmlChar *str); -XMLPUBFUN xmlXPathObjectPtr XMLCALL + const xmlChar *str); +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathCompiledEval (xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); #endif /* LIBXML_XPATH_ENABLED */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathInit (void); XMLPUBFUN int XMLCALL xmlXPathIsNaN (double val); diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpathInternals.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpathInternals.h similarity index 86% rename from cocos2dx/platform/third_party/linux/libxml2/libxml/xpathInternals.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpathInternals.h index dcd524343e..70c9db96f1 100644 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpathInternals.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpathInternals.h @@ -100,16 +100,16 @@ extern "C" { */ #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); -XMLPUBFUN double XMLCALL - xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathPopString (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void * XMLCALL - xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); +XMLPUBFUN double XMLCALL + xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathPopString (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void * XMLCALL + xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); /** * xmlXPathReturnBoolean: @@ -296,7 +296,9 @@ XMLPUBFUN void * XMLCALL #define CHECK_ARITY(x) \ if (ctxt == NULL) return; \ if (nargs != (x)) \ - XP_ERROR(XPATH_INVALID_ARITY); + XP_ERROR(XPATH_INVALID_ARITY); \ + if (ctxt->valueNr < ctxt->valueFrame + (x)) \ + XP_ERROR(XPATH_STACK_ERROR); /** * CAST_TO_STRING: @@ -329,7 +331,7 @@ XMLPUBFUN void * XMLCALL * Variable Lookup forwarding. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, xmlXPathVariableLookupFunc f, void *data); @@ -338,7 +340,7 @@ XMLPUBFUN void XMLCALL * Function Lookup forwarding. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, xmlXPathFuncLookupFunc f, void *funcCtxt); @@ -346,7 +348,7 @@ XMLPUBFUN void XMLCALL /* * Error reporting. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPatherror (xmlXPathParserContextPtr ctxt, const char *file, int line, @@ -357,11 +359,11 @@ XMLPUBFUN void XMLCALL int error); #ifdef LIBXML_DEBUG_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathDebugDumpObject (FILE *output, xmlXPathObjectPtr cur, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp, int depth); @@ -369,48 +371,48 @@ XMLPUBFUN void XMLCALL /** * NodeSet handling. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinctSorted (xmlNodeSetPtr nodes); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinct (xmlNodeSetPtr nodes); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); @@ -419,51 +421,51 @@ XMLPUBFUN xmlNodeSetPtr XMLCALL * Extending a context. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterNs (xmlXPathContextPtr ctxt, const xmlChar *prefix, const xmlChar *ns_uri); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlXPathNsLookup (xmlXPathContextPtr ctxt, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathFunction f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathFunction f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathObjectPtr value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathFunction XMLCALL +XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, const xmlChar *name); -XMLPUBFUN xmlXPathFunction XMLCALL +XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookup (xmlXPathContextPtr ctxt, const xmlChar *name); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); /** @@ -471,79 +473,79 @@ XMLPUBFUN void XMLCALL */ XMLPUBFUN xmlXPathParserContextPtr XMLCALL xmlXPathNewParserContext (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL + xmlXPathContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); /* TODO: remap to xmlXPathValuePop and Push. */ -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL valuePop (xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); + xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewString (const xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewCString (const char *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapString (xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapCString (char * val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewFloat (double val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewBoolean (int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSet (xmlNodePtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewValueTree (xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetAdd (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, - xmlNodePtr node, +XMLPUBFUN int XMLCALL + xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, + xmlNodePtr node, xmlNsPtr ns); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathNodeSetSort (xmlNodeSetPtr set); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRoot (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathParseName (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); /* * Existing functions. */ -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathStringEvalNumber (const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, +XMLPUBFUN int XMLCALL + xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetMerge (xmlNodeSetPtr val1, +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetMerge (xmlNodeSetPtr val1, xmlNodeSetPtr val2); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetDel (xmlNodeSetPtr cur, +XMLPUBFUN void XMLCALL + xmlXPathNodeSetDel (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetRemove (xmlNodeSetPtr cur, +XMLPUBFUN void XMLCALL + xmlXPathNodeSetRemove (xmlNodeSetPtr cur, int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSetList (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapNodeSet (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapExternal (void *val); XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); @@ -621,7 +623,7 @@ XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, in * Really internal functions */ XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); - + #ifdef __cplusplus } #endif diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpointer.h b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpointer.h similarity index 76% rename from cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpointer.h rename to cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpointer.h index dde1dfb3d1..b99112b87a 100644 --- a/cocos2dx/platform/third_party/marmalade/libxml2/include/libxml/xpointer.h +++ b/cocos2dx/platform/third_party/emscripten/libxml2/libxml/xpointer.h @@ -7,7 +7,7 @@ * * Added support for the element() scheme described in: * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ * * Copy: See Copyright for the status of this software. * @@ -43,68 +43,68 @@ struct _xmlLocationSet { * Handling of location sets. */ -XMLPUBFUN xmlLocationSetPtr XMLCALL +XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -XMLPUBFUN xmlLocationSetPtr XMLCALL +XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, xmlLocationSetPtr val2); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRange (xmlNodePtr start, int startindex, xmlNodePtr end, int endindex); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePoints (xmlXPathObjectPtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodePoint (xmlNodePtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodes (xmlNodePtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodes (xmlNodePtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodeObject (xmlNodePtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewCollapsedRange (xmlNodePtr start); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetDel (xmlLocationSetPtr cur, xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, int val); /* * Functions. */ -XMLPUBFUN xmlXPathContextPtr XMLCALL +XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPtrNewContext (xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -XMLPUBFUN xmlNodePtr XMLCALL + int nargs); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); #ifdef __cplusplus } diff --git a/cocos2dx/platform/third_party/emscripten/libz/zconf.h b/cocos2dx/platform/third_party/emscripten/libz/zconf.h new file mode 100644 index 0000000000..996fff2921 --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libz/zconf.h @@ -0,0 +1,511 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2013 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetHeader z_inflateGetHeader +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateResetKeep z_inflateResetKeep +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#if 1 /* was set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#if 1 /* was set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/cocos2dx/platform/third_party/emscripten/libz/zlib.h b/cocos2dx/platform/third_party/emscripten/libz/zlib.h new file mode 100644 index 0000000000..3e0c7672ac --- /dev/null +++ b/cocos2dx/platform/third_party/emscripten/libz/zlib.h @@ -0,0 +1,1768 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.8, April 28th, 2013 + + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.8" +#define ZLIB_VERNUM 0x1280 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 8 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). Then deflate is guaranteed to + return Z_STREAM_END. If not enough output space is provided, deflate will + not return Z_STREAM_END, and it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + producted so far. The CRC-32 is checked against the gzip trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/cocos2dx/platform/third_party/linux/libraries/lib64/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/linux/libraries/lib64/libxml2.a.REMOVED.git-id deleted file mode 100644 index d4818a8baa..0000000000 --- a/cocos2dx/platform/third_party/linux/libraries/lib64/libxml2.a.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f4d59c12129476e3e34083f0b6dc9953821da854 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/linux/libraries/libxml2.a.REMOVED.git-id b/cocos2dx/platform/third_party/linux/libraries/libxml2.a.REMOVED.git-id deleted file mode 100644 index 86bce72972..0000000000 --- a/cocos2dx/platform/third_party/linux/libraries/libxml2.a.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b9a6f83bf492025195f7bea57d25a1e45bff9d5e \ No newline at end of file diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLparser.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLparser.h deleted file mode 100644 index fbcc811e0e..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLparser.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Summary: interface for an HTML 4.0 non-verifying parser - * Description: this module implements an HTML 4.0 non-verifying parser - * with API compatible with the XML parser ones. It should - * be able to parse "real world" HTML, even if severely - * broken from a specification point of view. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __HTML_PARSER_H__ -#define __HTML_PARSER_H__ -#include -#include - -#ifdef LIBXML_HTML_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Most of the back-end structures from XML and HTML are shared. - */ -typedef xmlParserCtxt htmlParserCtxt; -typedef xmlParserCtxtPtr htmlParserCtxtPtr; -typedef xmlParserNodeInfo htmlParserNodeInfo; -typedef xmlSAXHandler htmlSAXHandler; -typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; -typedef xmlParserInput htmlParserInput; -typedef xmlParserInputPtr htmlParserInputPtr; -typedef xmlDocPtr htmlDocPtr; -typedef xmlNodePtr htmlNodePtr; - -/* - * Internal description of an HTML element, representing HTML 4.01 - * and XHTML 1.0 (which share the same structure). - */ -typedef struct _htmlElemDesc htmlElemDesc; -typedef htmlElemDesc *htmlElemDescPtr; -struct _htmlElemDesc { - const char *name; /* The tag name */ - char startTag; /* Whether the start tag can be implied */ - char endTag; /* Whether the end tag can be implied */ - char saveEndTag; /* Whether the end tag should be saved */ - char empty; /* Is this an empty element ? */ - char depr; /* Is this a deprecated element ? */ - char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ - char isinline; /* is this a block 0 or inline 1 element */ - const char *desc; /* the description */ - -/* NRK Jan.2003 - * New fields encapsulating HTML structure - * - * Bugs: - * This is a very limited representation. It fails to tell us when - * an element *requires* subelements (we only have whether they're - * allowed or not), and it doesn't tell us where CDATA and PCDATA - * are allowed. Some element relationships are not fully represented: - * these are flagged with the word MODIFIER - */ - const char** subelts; /* allowed sub-elements of this element */ - const char* defaultsubelt; /* subelement for suggested auto-repair - if necessary or NULL */ - const char** attrs_opt; /* Optional Attributes */ - const char** attrs_depr; /* Additional deprecated attributes */ - const char** attrs_req; /* Required attributes */ -}; - -/* - * Internal description of an HTML entity. - */ -typedef struct _htmlEntityDesc htmlEntityDesc; -typedef htmlEntityDesc *htmlEntityDescPtr; -struct _htmlEntityDesc { - unsigned int value; /* the UNICODE value for the character */ - const char *name; /* The entity name */ - const char *desc; /* the description */ -}; - -/* - * There is only few public functions. - */ -XMLPUBFUN const htmlElemDesc * XMLCALL - htmlTagLookup (const xmlChar *tag); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityLookup(const xmlChar *name); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityValueLookup(unsigned int value); - -XMLPUBFUN int XMLCALL - htmlIsAutoClosed(htmlDocPtr doc, - htmlNodePtr elem); -XMLPUBFUN int XMLCALL - htmlAutoCloseTag(htmlDocPtr doc, - const xmlChar *name, - htmlNodePtr elem); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlParseEntityRef(htmlParserCtxtPtr ctxt, - const xmlChar **str); -XMLPUBFUN int XMLCALL - htmlParseCharRef(htmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - htmlParseElement(htmlParserCtxtPtr ctxt); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlNewParserCtxt(void); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreateMemoryParserCtxt(const char *buffer, - int size); - -XMLPUBFUN int XMLCALL - htmlParseDocument(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseDoc (xmlChar *cur, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseDoc (xmlChar *cur, - const char *encoding); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseFile(const char *filename, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseFile (const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - UTF8ToHtml (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -XMLPUBFUN int XMLCALL - htmlEncodeEntities(unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen, int quoteChar); -XMLPUBFUN int XMLCALL - htmlIsScriptAttribute(const xmlChar *name); -XMLPUBFUN int XMLCALL - htmlHandleOmittedElem(int val); - -#ifdef LIBXML_PUSH_ENABLED -/** - * Interfaces for the Push mode. - */ -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - htmlParseChunk (htmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -XMLPUBFUN void XMLCALL - htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ - HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ - HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ - HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - HTML_PARSE_NONET = 1<<11,/* Forbid network access */ - HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ - HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ -} htmlParserOption; - -XMLPUBFUN void XMLCALL - htmlCtxtReset (htmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* NRK/Jan2003: further knowledge of HTML structure - */ -typedef enum { - HTML_NA = 0 , /* something we don't check at all */ - HTML_INVALID = 0x1 , - HTML_DEPRECATED = 0x2 , - HTML_VALID = 0x4 , - HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ -} htmlStatus ; - -/* Using htmlElemDesc rather than name here, to emphasise the fact - that otherwise there's a lookup overhead -*/ -XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; -XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; -XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; -XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; -/** - * htmlDefaultSubelement: - * @elt: HTML element - * - * Returns the default subelement for this element - */ -#define htmlDefaultSubelement(elt) elt->defaultsubelt -/** - * htmlElementAllowedHereDesc: - * @parent: HTML parent element - * @elt: HTML element - * - * Checks whether an HTML element description may be a - * direct child of the specified element. - * - * Returns 1 if allowed; 0 otherwise. - */ -#define htmlElementAllowedHereDesc(parent,elt) \ - htmlElementAllowedHere((parent), (elt)->name) -/** - * htmlRequiredAttrs: - * @elt: HTML element - * - * Returns the attributes required for the specified element. - */ -#define htmlRequiredAttrs(elt) (elt)->attrs_req - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTML_ENABLED */ -#endif /* __HTML_PARSER_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLtree.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLtree.h deleted file mode 100644 index 6ea8207895..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/HTMLtree.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Summary: specific APIs to process HTML tree, especially serialization - * Description: this module implements a few function needed to process - * tree in an HTML specific way. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __HTML_TREE_H__ -#define __HTML_TREE_H__ - -#include -#include -#include -#include - -#ifdef LIBXML_HTML_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * HTML_TEXT_NODE: - * - * Macro. A text node in a HTML document is really implemented - * the same way as a text node in an XML document. - */ -#define HTML_TEXT_NODE XML_TEXT_NODE -/** - * HTML_ENTITY_REF_NODE: - * - * Macro. An entity reference in a HTML document is really implemented - * the same way as an entity reference in an XML document. - */ -#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE -/** - * HTML_COMMENT_NODE: - * - * Macro. A comment in a HTML document is really implemented - * the same way as a comment in an XML document. - */ -#define HTML_COMMENT_NODE XML_COMMENT_NODE -/** - * HTML_PRESERVE_NODE: - * - * Macro. A preserved node in a HTML document is really implemented - * the same way as a CDATA section in an XML document. - */ -#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE -/** - * HTML_PI_NODE: - * - * Macro. A processing instruction in a HTML document is really implemented - * the same way as a processing instruction in an XML document. - */ -#define HTML_PI_NODE XML_PI_NODE - -XMLPUBFUN htmlDocPtr XMLCALL - htmlNewDoc (const xmlChar *URI, - const xmlChar *ExternalID); -XMLPUBFUN htmlDocPtr XMLCALL - htmlNewDocNoDtD (const xmlChar *URI, - const xmlChar *ExternalID); -XMLPUBFUN const xmlChar * XMLCALL - htmlGetMetaEncoding (htmlDocPtr doc); -XMLPUBFUN int XMLCALL - htmlSetMetaEncoding (htmlDocPtr doc, - const xmlChar *encoding); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - htmlDocDumpMemory (xmlDocPtr cur, - xmlChar **mem, - int *size); -XMLPUBFUN void XMLCALL - htmlDocDumpMemoryFormat (xmlDocPtr cur, - xmlChar **mem, - int *size, - int format); -XMLPUBFUN int XMLCALL - htmlDocDump (FILE *f, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - htmlSaveFile (const char *filename, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - htmlNodeDump (xmlBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN void XMLCALL - htmlNodeDumpFile (FILE *out, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN int XMLCALL - htmlNodeDumpFileFormat (FILE *out, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding, - int format); -XMLPUBFUN int XMLCALL - htmlSaveFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN int XMLCALL - htmlSaveFileFormat (const char *filename, - xmlDocPtr cur, - const char *encoding, - int format); - -XMLPUBFUN void XMLCALL - htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - htmlDocContentDumpOutput(xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN void XMLCALL - htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - htmlNodeDumpOutput (xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding); - -#endif /* LIBXML_OUTPUT_ENABLED */ - -XMLPUBFUN int XMLCALL - htmlIsBooleanAttr (const xmlChar *name); - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTML_ENABLED */ - -#endif /* __HTML_TREE_H__ */ - diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile b/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile deleted file mode 100644 index d259852ee1..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile +++ /dev/null @@ -1,612 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# include/libxml/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - - -pkgdatadir = $(datadir)/libxml2 -pkgincludedir = $(includedir)/libxml2 -pkglibdir = $(libdir)/libxml2 -pkglibexecdir = $(libexecdir)/libxml2 -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -subdir = include/libxml -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/xmlversion.h.in $(xmlinc_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = xmlversion.h -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(xmlincdir)" -HEADERS = $(xmlinc_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run aclocal-1.11 -AMTAR = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run tar -AR = ar -AS = as -AUTOCONF = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run autoconf -AUTOHEADER = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run autoheader -AUTOMAKE = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run automake-1.11 -AWK = gawk -BASE_THREAD_LIBS = -lpthread -C14N_OBJ = c14n.c -CATALOG_OBJ = catalog.o -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -CPP = gcc -E -CPPFLAGS = -CYGPATH_W = echo -CYGWIN_EXTRA_LDFLAGS = -CYGWIN_EXTRA_PYTHON_LIBADD = -DEBUG_OBJ = debugXML.o -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -DLLTOOL = dlltool -DOCB_OBJ = DOCBparser.o -DSYMUTIL = -DUMPBIN = -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -FGREP = /bin/grep -F -FTP_OBJ = nanoftp.o -GREP = /bin/grep -HAVE_ISINF = -HAVE_ISNAN = -HTML_DIR = $(datadir)/doc/$(PACKAGE)-$(VERSION)/html -HTML_OBJ = HTMLparser.o HTMLtree.o -HTTP_OBJ = nanohttp.o -ICONV_LIBS = -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LD = /usr/bin/ld -LDFLAGS = -LIBOBJS = -LIBS = -LIBTOOL = $(SHELL) $(top_builddir)/libtool -LIBXML_MAJOR_VERSION = 2 -LIBXML_MICRO_VERSION = 8 -LIBXML_MINOR_VERSION = 7 -LIBXML_VERSION = 2.7.8 -LIBXML_VERSION_EXTRA = -LIBXML_VERSION_INFO = 9:8:7 -LIBXML_VERSION_NUMBER = 20708 -LIPO = -LN_S = ln -s -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/missing --run makeinfo -MKDIR_P = /bin/mkdir -p -MODULE_EXTENSION = .so -MODULE_PLATFORM_LIBS = -ldl -MV = /bin/mv -M_LIBS = -lm -NM = /usr/bin/nm -B -NMEDIT = -OBJDUMP = objdump -OBJEXT = o -OTOOL = -OTOOL64 = -PACKAGE = libxml2 -PACKAGE_BUGREPORT = -PACKAGE_NAME = -PACKAGE_STRING = -PACKAGE_TARNAME = -PACKAGE_URL = -PACKAGE_VERSION = -PATH_SEPARATOR = : -PERL = /usr/bin/perl -PYTHON = /usr/bin/python -PYTHON_INCLUDES = -PYTHON_LIBS = -PYTHON_SITE_PACKAGES = /usr/lib/python2.6/dist-packages -PYTHON_SUBDIR = -PYTHON_TESTS = -PYTHON_VERSION = 2.6 -RANLIB = ranlib -RDL_LIBS = -READER_TEST = Readertests -RELDATE = Thu Aug 25 2011 -RM = /bin/rm -SED = /bin/sed -SET_MAKE = -SHELL = /bin/sh -STATIC_BINARIES = -STRIP = strip -TAR = /bin/tar -TEST_C14N = C14Ntests -TEST_CATALOG = Catatests -TEST_DEBUG = Scripttests -TEST_HTML = HTMLtests -TEST_MODULES = ModuleTests -TEST_PATTERN = Patterntests -TEST_PHTML = HTMLPushtests -TEST_PUSH = XMLPushtests -TEST_REGEXPS = Regexptests Automatatests -TEST_SAX = SAXtests -TEST_SCHEMAS = Schemastests Relaxtests -TEST_SCHEMATRON = Schematrontests -TEST_THREADS = Threadtests -TEST_VALID = Validtests -TEST_VTIME = VTimingtests -TEST_XINCLUDE = XIncludetests -TEST_XPATH = XPathtests -TEST_XPTR = XPtrtests -THREADS_W32 = -THREAD_CFLAGS = -D_REENTRANT -THREAD_LIBS = -U = -VERSION = 2.7.8 -VERSION_SCRIPT_FLAGS = -Wl,--version-script= -WGET = /usr/bin/wget -WIN32_EXTRA_LDFLAGS = -WIN32_EXTRA_LIBADD = -WIN32_EXTRA_PYTHON_LIBADD = -WITH_C14N = 1 -WITH_CATALOG = 1 -WITH_DEBUG = 1 -WITH_DOCB = 1 -WITH_FTP = 1 -WITH_HTML = 1 -WITH_HTTP = 1 -WITH_ICONV = 1 -WITH_ICU = 0 -WITH_ISO8859X = 1 -WITH_LEGACY = 1 -WITH_MEM_DEBUG = 0 -WITH_MODULES = 1 -WITH_OUTPUT = 1 -WITH_PATTERN = 1 -WITH_PUSH = 1 -WITH_READER = 1 -WITH_REGEXPS = 1 -WITH_RUN_DEBUG = 0 -WITH_SAX1 = 1 -WITH_SCHEMAS = 1 -WITH_SCHEMATRON = 1 -WITH_THREADS = 1 -WITH_TREE = 1 -WITH_TRIO = 0 -WITH_VALID = 1 -WITH_WRITER = 1 -WITH_XINCLUDE = 1 -WITH_XPATH = 1 -WITH_XPTR = 1 -WITH_ZLIB = 1 -XINCLUDE_OBJ = xinclude.o -XMLLINT = /usr/bin/xmllint -XML_CFLAGS = -XML_INCLUDEDIR = -I${includedir}/libxml2 -XML_LIBDIR = -L${libdir} -XML_LIBS = -lxml2 -lz -lm -XML_LIBTOOLLIBS = libxml2.la -XPATH_OBJ = xpath.o -XPTR_OBJ = xpointer.o -XSLTPROC = /usr/bin/xsltproc -Z_CFLAGS = -Z_LIBS = -lz -abs_builddir = /home/laschweinski/source/libxml2-2.7.8/include/libxml -abs_srcdir = /home/laschweinski/source/libxml2-2.7.8/include/libxml -abs_top_builddir = /home/laschweinski/source/libxml2-2.7.8 -abs_top_srcdir = /home/laschweinski/source/libxml2-2.7.8 -ac_ct_CC = gcc -ac_ct_DUMPBIN = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/laschweinski/source/libxml2-2.7.8/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = /bin/mkdir -p -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -pythondir = $(libdir)/python$(PYTHON_VERSION)/site-packages -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = ../../ -top_builddir = ../.. -top_srcdir = ../.. -xmlincdir = $(includedir)/libxml2/libxml -xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xmlerror.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - list.h \ - hash.h \ - xpath.h \ - xpathInternals.h \ - xpointer.h \ - xinclude.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h \ - DOCBparser.h \ - catalog.h \ - threads.h \ - globals.h \ - c14n.h \ - xmlautomata.h \ - xmlregexp.h \ - xmlmodule.h \ - xmlschemas.h \ - schemasInternals.h \ - xmlschemastypes.h \ - xmlstring.h \ - xmlunicode.h \ - xmlreader.h \ - relaxng.h \ - dict.h \ - SAX2.h \ - xmlexports.h \ - xmlwriter.h \ - chvalid.h \ - pattern.h \ - xmlsave.h \ - schematron.h - -EXTRA_DIST = xmlversion.h.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/libxml/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/libxml/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -xmlversion.h: $(top_builddir)/config.status $(srcdir)/xmlversion.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-xmlincHEADERS: $(xmlinc_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)" - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xmlincdir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(xmlincdir)" || exit $$?; \ - done - -uninstall-xmlincHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(xmlincdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(xmlincdir)" && rm -f $$files - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(xmlincdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-xmlincHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-xmlincHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip install-xmlincHEADERS \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-xmlincHEADERS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.am b/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.am deleted file mode 100644 index cf9297aad6..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -## Process this file with automake to produce Makefile.in - -xmlincdir = $(includedir)/libxml2/libxml - -xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xmlerror.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - list.h \ - hash.h \ - xpath.h \ - xpathInternals.h \ - xpointer.h \ - xinclude.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h \ - DOCBparser.h \ - catalog.h \ - threads.h \ - globals.h \ - c14n.h \ - xmlautomata.h \ - xmlregexp.h \ - xmlmodule.h \ - xmlschemas.h \ - schemasInternals.h \ - xmlschemastypes.h \ - xmlstring.h \ - xmlunicode.h \ - xmlreader.h \ - relaxng.h \ - dict.h \ - SAX2.h \ - xmlexports.h \ - xmlwriter.h \ - chvalid.h \ - pattern.h \ - xmlsave.h \ - schematron.h - -EXTRA_DIST = xmlversion.h.in diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.in b/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.in deleted file mode 100644 index 4ce011c511..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/Makefile.in +++ /dev/null @@ -1,612 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = include/libxml -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/xmlversion.h.in $(xmlinc_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = xmlversion.h -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(xmlincdir)" -HEADERS = $(xmlinc_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASE_THREAD_LIBS = @BASE_THREAD_LIBS@ -C14N_OBJ = @C14N_OBJ@ -CATALOG_OBJ = @CATALOG_OBJ@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -CYGWIN_EXTRA_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ -CYGWIN_EXTRA_PYTHON_LIBADD = @CYGWIN_EXTRA_PYTHON_LIBADD@ -DEBUG_OBJ = @DEBUG_OBJ@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOCB_OBJ = @DOCB_OBJ@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -FTP_OBJ = @FTP_OBJ@ -GREP = @GREP@ -HAVE_ISINF = @HAVE_ISINF@ -HAVE_ISNAN = @HAVE_ISNAN@ -HTML_DIR = @HTML_DIR@ -HTML_OBJ = @HTML_OBJ@ -HTTP_OBJ = @HTTP_OBJ@ -ICONV_LIBS = @ICONV_LIBS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_MAJOR_VERSION = @LIBXML_MAJOR_VERSION@ -LIBXML_MICRO_VERSION = @LIBXML_MICRO_VERSION@ -LIBXML_MINOR_VERSION = @LIBXML_MINOR_VERSION@ -LIBXML_VERSION = @LIBXML_VERSION@ -LIBXML_VERSION_EXTRA = @LIBXML_VERSION_EXTRA@ -LIBXML_VERSION_INFO = @LIBXML_VERSION_INFO@ -LIBXML_VERSION_NUMBER = @LIBXML_VERSION_NUMBER@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MODULE_EXTENSION = @MODULE_EXTENSION@ -MODULE_PLATFORM_LIBS = @MODULE_PLATFORM_LIBS@ -MV = @MV@ -M_LIBS = @M_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PYTHON = @PYTHON@ -PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ -PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@ -PYTHON_SUBDIR = @PYTHON_SUBDIR@ -PYTHON_TESTS = @PYTHON_TESTS@ -PYTHON_VERSION = @PYTHON_VERSION@ -RANLIB = @RANLIB@ -RDL_LIBS = @RDL_LIBS@ -READER_TEST = @READER_TEST@ -RELDATE = @RELDATE@ -RM = @RM@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATIC_BINARIES = @STATIC_BINARIES@ -STRIP = @STRIP@ -TAR = @TAR@ -TEST_C14N = @TEST_C14N@ -TEST_CATALOG = @TEST_CATALOG@ -TEST_DEBUG = @TEST_DEBUG@ -TEST_HTML = @TEST_HTML@ -TEST_MODULES = @TEST_MODULES@ -TEST_PATTERN = @TEST_PATTERN@ -TEST_PHTML = @TEST_PHTML@ -TEST_PUSH = @TEST_PUSH@ -TEST_REGEXPS = @TEST_REGEXPS@ -TEST_SAX = @TEST_SAX@ -TEST_SCHEMAS = @TEST_SCHEMAS@ -TEST_SCHEMATRON = @TEST_SCHEMATRON@ -TEST_THREADS = @TEST_THREADS@ -TEST_VALID = @TEST_VALID@ -TEST_VTIME = @TEST_VTIME@ -TEST_XINCLUDE = @TEST_XINCLUDE@ -TEST_XPATH = @TEST_XPATH@ -TEST_XPTR = @TEST_XPTR@ -THREADS_W32 = @THREADS_W32@ -THREAD_CFLAGS = @THREAD_CFLAGS@ -THREAD_LIBS = @THREAD_LIBS@ -U = @U@ -VERSION = @VERSION@ -VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ -WGET = @WGET@ -WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ -WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ -WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@ -WITH_C14N = @WITH_C14N@ -WITH_CATALOG = @WITH_CATALOG@ -WITH_DEBUG = @WITH_DEBUG@ -WITH_DOCB = @WITH_DOCB@ -WITH_FTP = @WITH_FTP@ -WITH_HTML = @WITH_HTML@ -WITH_HTTP = @WITH_HTTP@ -WITH_ICONV = @WITH_ICONV@ -WITH_ICU = @WITH_ICU@ -WITH_ISO8859X = @WITH_ISO8859X@ -WITH_LEGACY = @WITH_LEGACY@ -WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ -WITH_MODULES = @WITH_MODULES@ -WITH_OUTPUT = @WITH_OUTPUT@ -WITH_PATTERN = @WITH_PATTERN@ -WITH_PUSH = @WITH_PUSH@ -WITH_READER = @WITH_READER@ -WITH_REGEXPS = @WITH_REGEXPS@ -WITH_RUN_DEBUG = @WITH_RUN_DEBUG@ -WITH_SAX1 = @WITH_SAX1@ -WITH_SCHEMAS = @WITH_SCHEMAS@ -WITH_SCHEMATRON = @WITH_SCHEMATRON@ -WITH_THREADS = @WITH_THREADS@ -WITH_TREE = @WITH_TREE@ -WITH_TRIO = @WITH_TRIO@ -WITH_VALID = @WITH_VALID@ -WITH_WRITER = @WITH_WRITER@ -WITH_XINCLUDE = @WITH_XINCLUDE@ -WITH_XPATH = @WITH_XPATH@ -WITH_XPTR = @WITH_XPTR@ -WITH_ZLIB = @WITH_ZLIB@ -XINCLUDE_OBJ = @XINCLUDE_OBJ@ -XMLLINT = @XMLLINT@ -XML_CFLAGS = @XML_CFLAGS@ -XML_INCLUDEDIR = @XML_INCLUDEDIR@ -XML_LIBDIR = @XML_LIBDIR@ -XML_LIBS = @XML_LIBS@ -XML_LIBTOOLLIBS = @XML_LIBTOOLLIBS@ -XPATH_OBJ = @XPATH_OBJ@ -XPTR_OBJ = @XPTR_OBJ@ -XSLTPROC = @XSLTPROC@ -Z_CFLAGS = @Z_CFLAGS@ -Z_LIBS = @Z_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythondir = @pythondir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -xmlincdir = $(includedir)/libxml2/libxml -xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xmlerror.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - list.h \ - hash.h \ - xpath.h \ - xpathInternals.h \ - xpointer.h \ - xinclude.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h \ - DOCBparser.h \ - catalog.h \ - threads.h \ - globals.h \ - c14n.h \ - xmlautomata.h \ - xmlregexp.h \ - xmlmodule.h \ - xmlschemas.h \ - schemasInternals.h \ - xmlschemastypes.h \ - xmlstring.h \ - xmlunicode.h \ - xmlreader.h \ - relaxng.h \ - dict.h \ - SAX2.h \ - xmlexports.h \ - xmlwriter.h \ - chvalid.h \ - pattern.h \ - xmlsave.h \ - schematron.h - -EXTRA_DIST = xmlversion.h.in -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/libxml/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/libxml/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -xmlversion.h: $(top_builddir)/config.status $(srcdir)/xmlversion.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-xmlincHEADERS: $(xmlinc_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)" - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xmlincdir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(xmlincdir)" || exit $$?; \ - done - -uninstall-xmlincHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(xmlincdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(xmlincdir)" && rm -f $$files - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(xmlincdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-xmlincHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-xmlincHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip install-xmlincHEADERS \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-xmlincHEADERS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX.h deleted file mode 100644 index 0ca161b608..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Summary: Old SAX version 1 handler, deprecated - * Description: DEPRECATED set of SAX version 1 interfaces used to - * build the DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX_H__ -#define __XML_SAX_H__ - -#include -#include -#include -#include -#include - -#ifdef LIBXML_LEGACY_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - getPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - getSystemId (void *ctx); -XMLPUBFUN void XMLCALL - setDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - getLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - getColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - isStandalone (void *ctx); -XMLPUBFUN int XMLCALL - hasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - hasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - internalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - externalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - getEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - getParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - resolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - entityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - attributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - elementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - notationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - unparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - startDocument (void *ctx); -XMLPUBFUN void XMLCALL - endDocument (void *ctx); -XMLPUBFUN void XMLCALL - attribute (void *ctx, - const xmlChar *fullname, - const xmlChar *value); -XMLPUBFUN void XMLCALL - startElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - endElement (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - ignorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - processingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - globalNamespace (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - setNamespace (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlNsPtr XMLCALL - getNamespace (void *ctx); -XMLPUBFUN int XMLCALL - checkNamespace (void *ctx, - xmlChar *nameSpace); -XMLPUBFUN void XMLCALL - namespaceDecl (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - cdataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_LEGACY_ENABLED */ - -#endif /* __XML_SAX_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX2.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX2.h deleted file mode 100644 index 8d2db02d85..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/SAX2.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Summary: SAX2 parser interface used to build the DOM tree - * Description: those are the default SAX2 interfaces used by - * the library when building DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX2_H__ -#define __XML_SAX2_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2SetDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2GetColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - xmlSAX2InternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - xmlSAX2ExternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlSAX2ResolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - xmlSAX2EntityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - xmlSAX2AttributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - xmlSAX2ElementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlSAX2NotationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - xmlSAX2UnparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2EndDocument (void *ctx); -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -XMLPUBFUN void XMLCALL - xmlSAX2StartElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - xmlSAX2EndElement (void *ctx, - const xmlChar *name); -#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ -XMLPUBFUN void XMLCALL - xmlSAX2StartElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); -XMLPUBFUN void XMLCALL - xmlSAX2EndElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); -XMLPUBFUN void XMLCALL - xmlSAX2Reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSAX2Characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2IgnorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2ProcessingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - xmlSAX2Comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlSAX2CDataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXDefaultVersion (int version); -#endif /* LIBXML_SAX1_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlSAXVersion (xmlSAXHandler *hdlr, - int version); -XMLPUBFUN void XMLCALL - xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - htmlDefaultSAXHandlerInit (void); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - docbDefaultSAXHandlerInit (void); -#endif -XMLPUBFUN void XMLCALL - xmlDefaultSAXHandlerInit (void); -#ifdef __cplusplus -} -#endif -#endif /* __XML_SAX2_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/catalog.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/catalog.h deleted file mode 100644 index b4441370fc..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/catalog.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Summary: interfaces to the Catalog handling system - * Description: the catalog module implements the support for - * XML Catalogs and SGML catalogs - * - * SGML Open Technical Resolution TR9401:1997. - * http://www.jclark.com/sp/catalog.htm - * - * XML Catalogs Working Draft 06 August 2001 - * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CATALOG_H__ -#define __XML_CATALOG_H__ - -#include - -#include -#include -#include - -#ifdef LIBXML_CATALOG_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_CATALOGS_NAMESPACE: - * - * The namespace for the XML Catalogs elements. - */ -#define XML_CATALOGS_NAMESPACE \ - (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" -/** - * XML_CATALOG_PI: - * - * The specific XML Catalog Processing Instuction name. - */ -#define XML_CATALOG_PI \ - (const xmlChar *) "oasis-xml-catalog" - -/* - * The API is voluntarily limited to general cataloging. - */ -typedef enum { - XML_CATA_PREFER_NONE = 0, - XML_CATA_PREFER_PUBLIC = 1, - XML_CATA_PREFER_SYSTEM -} xmlCatalogPrefer; - -typedef enum { - XML_CATA_ALLOW_NONE = 0, - XML_CATA_ALLOW_GLOBAL = 1, - XML_CATA_ALLOW_DOCUMENT = 2, - XML_CATA_ALLOW_ALL = 3 -} xmlCatalogAllow; - -typedef struct _xmlCatalog xmlCatalog; -typedef xmlCatalog *xmlCatalogPtr; - -/* - * Operations on a given catalog. - */ -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlNewCatalog (int sgml); -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlLoadACatalog (const char *filename); -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlLoadSGMLSuperCatalog (const char *filename); -XMLPUBFUN int XMLCALL - xmlConvertSGMLCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL - xmlACatalogAdd (xmlCatalogPtr catal, - const xmlChar *type, - const xmlChar *orig, - const xmlChar *replace); -XMLPUBFUN int XMLCALL - xmlACatalogRemove (xmlCatalogPtr catal, - const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolve (xmlCatalogPtr catal, - const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolveSystem(xmlCatalogPtr catal, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolvePublic(xmlCatalogPtr catal, - const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolveURI (xmlCatalogPtr catal, - const xmlChar *URI); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlACatalogDump (xmlCatalogPtr catal, - FILE *out); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL - xmlCatalogIsEmpty (xmlCatalogPtr catal); - -/* - * Global operations. - */ -XMLPUBFUN void XMLCALL - xmlInitializeCatalog (void); -XMLPUBFUN int XMLCALL - xmlLoadCatalog (const char *filename); -XMLPUBFUN void XMLCALL - xmlLoadCatalogs (const char *paths); -XMLPUBFUN void XMLCALL - xmlCatalogCleanup (void); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlCatalogDump (FILE *out); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolve (const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolveSystem (const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolvePublic (const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolveURI (const xmlChar *URI); -XMLPUBFUN int XMLCALL - xmlCatalogAdd (const xmlChar *type, - const xmlChar *orig, - const xmlChar *replace); -XMLPUBFUN int XMLCALL - xmlCatalogRemove (const xmlChar *value); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseCatalogFile (const char *filename); -XMLPUBFUN int XMLCALL - xmlCatalogConvert (void); - -/* - * Strictly minimal interfaces for per-document catalogs used - * by the parser. - */ -XMLPUBFUN void XMLCALL - xmlCatalogFreeLocal (void *catalogs); -XMLPUBFUN void * XMLCALL - xmlCatalogAddLocal (void *catalogs, - const xmlChar *URL); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogLocalResolve (void *catalogs, - const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogLocalResolveURI(void *catalogs, - const xmlChar *URI); -/* - * Preference settings. - */ -XMLPUBFUN int XMLCALL - xmlCatalogSetDebug (int level); -XMLPUBFUN xmlCatalogPrefer XMLCALL - xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); -XMLPUBFUN void XMLCALL - xmlCatalogSetDefaults (xmlCatalogAllow allow); -XMLPUBFUN xmlCatalogAllow XMLCALL - xmlCatalogGetDefaults (void); - - -/* DEPRECATED interfaces */ -XMLPUBFUN const xmlChar * XMLCALL - xmlCatalogGetSystem (const xmlChar *sysID); -XMLPUBFUN const xmlChar * XMLCALL - xmlCatalogGetPublic (const xmlChar *pubID); - -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_CATALOG_ENABLED */ -#endif /* __XML_CATALOG_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/chvalid.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/chvalid.h deleted file mode 100644 index fb43016982..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/chvalid.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Summary: Unicode character range checking - * Description: this module exports interfaces for the character - * range validation APIs - * - * This file is automatically generated from the cvs source - * definition files using the genChRanges.py Python script - * - * Generation date: Mon Mar 27 11:09:48 2006 - * Sources: chvalid.def - * Author: William Brack - */ - -#ifndef __XML_CHVALID_H__ -#define __XML_CHVALID_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define our typedefs and structures - * - */ -typedef struct _xmlChSRange xmlChSRange; -typedef xmlChSRange *xmlChSRangePtr; -struct _xmlChSRange { - unsigned short low; - unsigned short high; -}; - -typedef struct _xmlChLRange xmlChLRange; -typedef xmlChLRange *xmlChLRangePtr; -struct _xmlChLRange { - unsigned int low; - unsigned int high; -}; - -typedef struct _xmlChRangeGroup xmlChRangeGroup; -typedef xmlChRangeGroup *xmlChRangeGroupPtr; -struct _xmlChRangeGroup { - int nbShortRange; - int nbLongRange; - const xmlChSRange *shortRange; /* points to an array of ranges */ - const xmlChLRange *longRange; -}; - -/** - * Range checking routine - */ -XMLPUBFUN int XMLCALL - xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); - - -/** - * xmlIsBaseChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a)) || \ - ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ - ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ - (0xf8 <= (c))) - -/** - * xmlIsBaseCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ - xmlIsBaseChar_ch((c)) : \ - xmlCharInRange((c), &xmlIsBaseCharGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; - -/** - * xmlIsBlank_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlank_ch(c) (((c) == 0x20) || \ - ((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd)) - -/** - * xmlIsBlankQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlankQ(c) (((c) < 0x100) ? \ - xmlIsBlank_ch((c)) : 0) - - -/** - * xmlIsChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd) || \ - (0x20 <= (c))) - -/** - * xmlIsCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCharQ(c) (((c) < 0x100) ? \ - xmlIsChar_ch((c)) :\ - (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ - ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ - ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; - -/** - * xmlIsCombiningQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ - 0 : \ - xmlCharInRange((c), &xmlIsCombiningGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; - -/** - * xmlIsDigit_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) - -/** - * xmlIsDigitQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigitQ(c) (((c) < 0x100) ? \ - xmlIsDigit_ch((c)) : \ - xmlCharInRange((c), &xmlIsDigitGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; - -/** - * xmlIsExtender_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtender_ch(c) (((c) == 0xb7)) - -/** - * xmlIsExtenderQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ - xmlIsExtender_ch((c)) : \ - xmlCharInRange((c), &xmlIsExtenderGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; - -/** - * xmlIsIdeographicQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ - 0 :\ - (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ - ((c) == 0x3007) || \ - ((0x3021 <= (c)) && ((c) <= 0x3029)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; -XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; - -/** - * xmlIsPubidChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) - -/** - * xmlIsPubidCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ - xmlIsPubidChar_ch((c)) : 0) - -XMLPUBFUN int XMLCALL - xmlIsBaseChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsBlank(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsCombining(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsDigit(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsExtender(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsIdeographic(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsPubidChar(unsigned int ch); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_CHVALID_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/debugXML.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/debugXML.h deleted file mode 100644 index 5a9d20bcf5..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/debugXML.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Summary: Tree debugging APIs - * Description: Interfaces to a set of routines used for debugging the tree - * produced by the XML parser. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __DEBUG_XML__ -#define __DEBUG_XML__ -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The standard Dump routines. - */ -XMLPUBFUN void XMLCALL - xmlDebugDumpString (FILE *output, - const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttr (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttrList (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpOneNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNodeList (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocumentHead(FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocument (FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDTD (FILE *output, - xmlDtdPtr dtd); -XMLPUBFUN void XMLCALL - xmlDebugDumpEntities (FILE *output, - xmlDocPtr doc); - -/**************************************************************** - * * - * Checking routines * - * * - ****************************************************************/ - -XMLPUBFUN int XMLCALL - xmlDebugCheckDocument (FILE * output, - xmlDocPtr doc); - -/**************************************************************** - * * - * XML shell helpers * - * * - ****************************************************************/ - -XMLPUBFUN void XMLCALL - xmlLsOneNode (FILE *output, xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlLsCountNode (xmlNodePtr node); - -XMLPUBFUN const char * XMLCALL - xmlBoolToText (int boolval); - -/**************************************************************** - * * - * The XML shell related structures and functions * - * * - ****************************************************************/ - -#ifdef LIBXML_XPATH_ENABLED -/** - * xmlShellReadlineFunc: - * @prompt: a string prompt - * - * This is a generic signature for the XML shell input function. - * - * Returns a string which will be freed by the Shell. - */ -typedef char * (* xmlShellReadlineFunc)(char *prompt); - -/** - * xmlShellCtxt: - * - * A debugging shell context. - * TODO: add the defined function tables. - */ -typedef struct _xmlShellCtxt xmlShellCtxt; -typedef xmlShellCtxt *xmlShellCtxtPtr; -struct _xmlShellCtxt { - char *filename; - xmlDocPtr doc; - xmlNodePtr node; - xmlXPathContextPtr pctxt; - int loaded; - FILE *output; - xmlShellReadlineFunc input; -}; - -/** - * xmlShellCmd: - * @ctxt: a shell context - * @arg: a string argument - * @node: a first node - * @node2: a second node - * - * This is a generic signature for the XML shell functions. - * - * Returns an int, negative returns indicating errors. - */ -typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); - -XMLPUBFUN void XMLCALL - xmlShellPrintXPathError (int errorType, - const char *arg); -XMLPUBFUN void XMLCALL - xmlShellPrintXPathResult(xmlXPathObjectPtr list); -XMLPUBFUN int XMLCALL - xmlShellList (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellBase (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellDir (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellLoad (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlShellPrintNode (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlShellCat (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellWrite (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellSave (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL - xmlShellValidate (xmlShellCtxtPtr ctxt, - char *dtd, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_VALID_ENABLED */ -XMLPUBFUN int XMLCALL - xmlShellDu (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr tree, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellPwd (xmlShellCtxtPtr ctxt, - char *buffer, - xmlNodePtr node, - xmlNodePtr node2); - -/* - * The Shell interface. - */ -XMLPUBFUN void XMLCALL - xmlShell (xmlDocPtr doc, - char *filename, - xmlShellReadlineFunc input, - FILE *output); - -#endif /* LIBXML_XPATH_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_DEBUG_ENABLED */ -#endif /* __DEBUG_XML__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/dict.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/dict.h deleted file mode 100644 index abb8339cb8..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/dict.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Summary: string dictionnary - * Description: dictionary of reusable strings, just used to avoid allocation - * and freeing operations. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_DICT_H__ -#define __XML_DICT_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The dictionnary. - */ -typedef struct _xmlDict xmlDict; -typedef xmlDict *xmlDictPtr; - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreate (void); -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreateSub(xmlDictPtr sub); -XMLPUBFUN int XMLCALL - xmlDictReference(xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlDictFree (xmlDictPtr dict); - -/* - * Lookup of entry in the dictionnary. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlDictLookup (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictExists (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictQLookup (xmlDictPtr dict, - const xmlChar *prefix, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlDictOwns (xmlDictPtr dict, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlDictSize (xmlDictPtr dict); - -/* - * Cleanup function - */ -XMLPUBFUN void XMLCALL - xmlDictCleanup (void); - -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_DICT_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/encoding.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/encoding.h deleted file mode 100644 index 3a3b9b2d82..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/encoding.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Summary: interface for the encoding conversion functions - * Description: interface for the encoding conversion functions needed for - * XML basic encoding and iconv() support. - * - * Related specs are - * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies - * [ISO-10646] UTF-8 and UTF-16 in Annexes - * [ISO-8859-1] ISO Latin-1 characters codes. - * [UNICODE] The Unicode Consortium, "The Unicode Standard -- - * Worldwide Character Encoding -- Version 1.0", Addison- - * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is - * described in Unicode Technical Report #4. - * [US-ASCII] Coded Character Set--7-bit American Standard Code for - * Information Interchange, ANSI X3.4-1986. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CHAR_ENCODING_H__ -#define __XML_CHAR_ENCODING_H__ - -#include - -#ifdef LIBXML_ICONV_ENABLED -#include -#endif -#ifdef LIBXML_ICU_ENABLED -#include -#endif -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlCharEncoding: - * - * Predefined values for some standard encodings. - * Libxml does not do beforehand translation on UTF8 and ISOLatinX. - * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. - * - * Anything else would have to be translated to UTF8 before being - * given to the parser itself. The BOM for UTF16 and the encoding - * declaration are looked at and a converter is looked for at that - * point. If not found the parser stops here as asked by the XML REC. A - * converter can be registered by the user using xmlRegisterCharEncodingHandler - * but the current form doesn't allow stateful transcoding (a serious - * problem agreed !). If iconv has been found it will be used - * automatically and allow stateful transcoding, the simplest is then - * to be sure to enable iconv and to provide iconv libs for the encoding - * support needed. - * - * Note that the generic "UTF-16" is not a predefined value. Instead, only - * the specific UTF-16LE and UTF-16BE are present. - */ -typedef enum { - XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ - XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ - XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ - XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ - XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ - XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ - XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ - XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ - XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ - XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ - XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ - XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ - XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ - XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ - XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ - XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ - XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ - XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ - XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ - XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ - XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ - XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ -} xmlCharEncoding; - -/** - * xmlCharEncodingInputFunc: - * @out: a pointer to an array of bytes to store the UTF-8 result - * @outlen: the length of @out - * @in: a pointer to an array of chars in the original encoding - * @inlen: the length of @in - * - * Take a block of chars in the original encoding and try to convert - * it to an UTF-8 block of chars out. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets consumed. - */ -typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/** - * xmlCharEncodingOutputFunc: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * - * Take a block of UTF-8 chars in and try to convert it to another - * encoding. - * Note: a first call designed to produce heading info is called with - * in = NULL. If stateful this should also initialize the encoder state. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets produced. - */ -typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/* - * Block defining the handlers for non UTF-8 encodings. - * If iconv is supported, there are two extra fields. - */ -#ifdef LIBXML_ICU_ENABLED -struct _uconv_t { - UConverter *uconv; /* for conversion between an encoding and UTF-16 */ - UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ -}; -typedef struct _uconv_t uconv_t; -#endif - -typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; -typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; -struct _xmlCharEncodingHandler { - char *name; - xmlCharEncodingInputFunc input; - xmlCharEncodingOutputFunc output; -#ifdef LIBXML_ICONV_ENABLED - iconv_t iconv_in; - iconv_t iconv_out; -#endif /* LIBXML_ICONV_ENABLED */ -#ifdef LIBXML_ICU_ENABLED - uconv_t *uconv_in; - uconv_t *uconv_out; -#endif /* LIBXML_ICU_ENABLED */ -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Interfaces for encoding handlers. - */ -XMLPUBFUN void XMLCALL - xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlGetCharEncodingHandler (xmlCharEncoding enc); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlFindCharEncodingHandler (const char *name); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); - -/* - * Interfaces for encoding names and aliases. - */ -XMLPUBFUN int XMLCALL - xmlAddEncodingAlias (const char *name, - const char *alias); -XMLPUBFUN int XMLCALL - xmlDelEncodingAlias (const char *alias); -XMLPUBFUN const char * XMLCALL - xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL - xmlCleanupEncodingAliases (void); -XMLPUBFUN xmlCharEncoding XMLCALL - xmlParseCharEncoding (const char *name); -XMLPUBFUN const char * XMLCALL - xmlGetCharEncodingName (xmlCharEncoding enc); - -/* - * Interfaces directly used by the parsers. - */ -XMLPUBFUN xmlCharEncoding XMLCALL - xmlDetectCharEncoding (const unsigned char *in, - int len); - -XMLPUBFUN int XMLCALL - xmlCharEncOutFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); - -XMLPUBFUN int XMLCALL - xmlCharEncInFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncFirstLine (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); - -/* - * Export a few useful functions - */ -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL - UTF8Toisolat1 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - isolat1ToUTF8 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#ifdef __cplusplus -} -#endif - -#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/entities.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/entities.h deleted file mode 100644 index cefb97f780..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/entities.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Summary: interface for the XML entities handling - * Description: this module provides some of the entity API needed - * for the parser and applications. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_ENTITIES_H__ -#define __XML_ENTITIES_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The different valid entity types. - */ -typedef enum { - XML_INTERNAL_GENERAL_ENTITY = 1, - XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, - XML_INTERNAL_PARAMETER_ENTITY = 4, - XML_EXTERNAL_PARAMETER_ENTITY = 5, - XML_INTERNAL_PREDEFINED_ENTITY = 6 -} xmlEntityType; - -/* - * An unit of storage for an entity, contains the string, the value - * and the linkind data needed for the linking in the hash table. - */ - -struct _xmlEntity { - void *_private; /* application data */ - xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ - const xmlChar *name; /* Entity name */ - struct _xmlNode *children; /* First child link */ - struct _xmlNode *last; /* Last child link */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlChar *orig; /* content without ref substitution */ - xmlChar *content; /* content or ndata if unparsed */ - int length; /* the content length */ - xmlEntityType etype; /* The entity type */ - const xmlChar *ExternalID; /* External identifier for PUBLIC */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ - - struct _xmlEntity *nexte; /* unused */ - const xmlChar *URI; /* the full URI as computed */ - int owner; /* does the entity own the childrens */ - int checked; /* was the entity content checked */ - /* this is also used to count entites - * references done from that entity */ -}; - -/* - * All entities are stored in an hash table. - * There is 2 separate hash tables for global and parameter entities. - */ - -typedef struct _xmlHashTable xmlEntitiesTable; -typedef xmlEntitiesTable *xmlEntitiesTablePtr; - -/* - * External functions: - */ - -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlInitializePredefinedEntities (void); -#endif /* LIBXML_LEGACY_ENABLED */ - -XMLPUBFUN xmlEntityPtr XMLCALL - xmlNewEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDocEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDtdEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDocEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDtdEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetParameterEntity (xmlDocPtr doc, - const xmlChar *name); -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlEncodeEntities (xmlDocPtr doc, - const xmlChar *input); -#endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeEntitiesReentrant(xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeSpecialChars (xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCreateEntitiesTable (void); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCopyEntitiesTable (xmlEntitiesTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeEntitiesTable (xmlEntitiesTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpEntitiesTable (xmlBufferPtr buf, - xmlEntitiesTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpEntityDecl (xmlBufferPtr buf, - xmlEntityPtr ent); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlCleanupPredefinedEntities(void); -#endif /* LIBXML_LEGACY_ENABLED */ - - -#ifdef __cplusplus -} -#endif - -# endif /* __XML_ENTITIES_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/hash.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/hash.h deleted file mode 100644 index 7fe4be754c..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/hash.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Bjorn Reese - */ - -#ifndef __XML_HASH_H__ -#define __XML_HASH_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The hash table. - */ -typedef struct _xmlHashTable xmlHashTable; -typedef xmlHashTable *xmlHashTablePtr; - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Recent version of gcc produce a warning when a function pointer is assigned - * to an object pointer, or vice versa. The following macro is a dirty hack - * to allow suppression of the warning. If your architecture has function - * pointers which are a different size than a void pointer, there may be some - * serious trouble within the library. - */ -/** - * XML_CAST_FPTR: - * @fptr: pointer to a function - * - * Macro to do a casting from an object pointer to a - * function pointer without encountering a warning from - * gcc - * - * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) - * This macro violated ISO C aliasing rules (gcc4 on s390 broke) - * so it is disabled now - */ - -#define XML_CAST_FPTR(fptr) fptr - - -/* - * function types: - */ -/** - * xmlHashDeallocator: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to free data from a hash. - */ -typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); -/** - * xmlHashCopier: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to copy data from a hash. - * - * Returns a copy of the data or NULL in case of error. - */ -typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); -/** - * xmlHashScanner: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * - * Callback when scanning data in a hash with the simple scanner. - */ -typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); -/** - * xmlHashScannerFull: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * @name2: the second name associated - * @name3: the third name associated - * - * Callback when scanning data in a hash with the full scanner. - */ -typedef void (*xmlHashScannerFull)(void *payload, void *data, - const xmlChar *name, const xmlChar *name2, - const xmlChar *name3); - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreate (int size); -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreateDict(int size, - xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlHashFree (xmlHashTablePtr table, - xmlHashDeallocator f); - -/* - * Add a new entry to the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashAddEntry (xmlHashTablePtr table, - const xmlChar *name, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry(xmlHashTablePtr table, - const xmlChar *name, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata, - xmlHashDeallocator f); - -/* - * Remove an entry from the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashDeallocator f); - -/* - * Retrieve the userdata. - */ -XMLPUBFUN void * XMLCALL - xmlHashLookup (xmlHashTablePtr table, - const xmlChar *name); -XMLPUBFUN void * XMLCALL - xmlHashLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2); -XMLPUBFUN void * XMLCALL - xmlHashLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3); -XMLPUBFUN void * XMLCALL - xmlHashQLookup (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN void * XMLCALL - xmlHashQLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL - xmlHashQLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2, - const xmlChar *name3, - const xmlChar *prefix3); - -/* - * Helpers. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCopy (xmlHashTablePtr table, - xmlHashCopier f); -XMLPUBFUN int XMLCALL - xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL - xmlHashScan (xmlHashTablePtr table, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScan3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull (xmlHashTablePtr table, - xmlHashScannerFull f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScannerFull f, - void *data); -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_HASH_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/list.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/list.h deleted file mode 100644 index 1d83482430..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/list.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Summary: lists interfaces - * Description: this module implement the list support used in - * various place in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington - */ - -#ifndef __XML_LINK_INCLUDE__ -#define __XML_LINK_INCLUDE__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlLink xmlLink; -typedef xmlLink *xmlLinkPtr; - -typedef struct _xmlList xmlList; -typedef xmlList *xmlListPtr; - -/** - * xmlListDeallocator: - * @lk: the data to deallocate - * - * Callback function used to free data from a list. - */ -typedef void (*xmlListDeallocator) (xmlLinkPtr lk); -/** - * xmlListDataCompare: - * @data0: the first data - * @data1: the second data - * - * Callback function used to compare 2 data. - * - * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. - */ -typedef int (*xmlListDataCompare) (const void *data0, const void *data1); -/** - * xmlListWalker: - * @data: the data found in the list - * @user: extra user provided data to the walker - * - * Callback function used when walking a list with xmlListWalk(). - * - * Returns 0 to stop walking the list, 1 otherwise. - */ -typedef int (*xmlListWalker) (const void *data, const void *user); - -/* Creation/Deletion */ -XMLPUBFUN xmlListPtr XMLCALL - xmlListCreate (xmlListDeallocator deallocator, - xmlListDataCompare compare); -XMLPUBFUN void XMLCALL - xmlListDelete (xmlListPtr l); - -/* Basic Operators */ -XMLPUBFUN void * XMLCALL - xmlListSearch (xmlListPtr l, - void *data); -XMLPUBFUN void * XMLCALL - xmlListReverseSearch (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListInsert (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListAppend (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListRemoveFirst (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveLast (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveAll (xmlListPtr l, - void *data); -XMLPUBFUN void XMLCALL - xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListSize (xmlListPtr l); - -XMLPUBFUN void XMLCALL - xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListPushFront (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListPushBack (xmlListPtr l, - void *data); - -/* Advanced Operators */ -XMLPUBFUN void XMLCALL - xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListReverseWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListMerge (xmlListPtr l1, - xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL - xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL - xmlListCopy (xmlListPtr cur, - const xmlListPtr old); -/* Link operators */ -XMLPUBFUN void * XMLCALL - xmlLinkGetData (xmlLinkPtr lk); - -/* xmlListUnique() */ -/* xmlListSwap */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_LINK_INCLUDE__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/nanohttp.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/nanohttp.h deleted file mode 100644 index 1d8ac24b2a..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/nanohttp.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Summary: minimal HTTP implementation - * Description: minimal HTTP implementation allowing to fetch resources - * like external subset. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __NANO_HTTP_H__ -#define __NANO_HTTP_H__ - -#include - -#ifdef LIBXML_HTTP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN void XMLCALL - xmlNanoHTTPInit (void); -XMLPUBFUN void XMLCALL - xmlNanoHTTPCleanup (void); -XMLPUBFUN void XMLCALL - xmlNanoHTTPScanProxy (const char *URL); -XMLPUBFUN int XMLCALL - xmlNanoHTTPFetch (const char *URL, - const char *filename, - char **contentType); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPMethod (const char *URL, - const char *method, - const char *input, - char **contentType, - const char *headers, - int ilen); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPMethodRedir (const char *URL, - const char *method, - const char *input, - char **contentType, - char **redir, - const char *headers, - int ilen); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPOpen (const char *URL, - char **contentType); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPOpenRedir (const char *URL, - char **contentType, - char **redir); -XMLPUBFUN int XMLCALL - xmlNanoHTTPReturnCode (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPAuthHeader (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPRedir (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoHTTPContentLength( void * ctx ); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPEncoding (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPMimeType (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoHTTPRead (void *ctx, - void *dest, - int len); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL - xmlNanoHTTPSave (void *ctxt, - const char *filename); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNanoHTTPClose (void *ctx); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTTP_ENABLED */ -#endif /* __NANO_HTTP_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/parser.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/parser.h deleted file mode 100644 index 47b3df1525..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/parser.h +++ /dev/null @@ -1,1235 +0,0 @@ -/* - * Summary: the core parser module - * Description: Interfaces, constants and types related to the XML parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_H__ -#define __XML_PARSER_H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_DEFAULT_VERSION: - * - * The default version of XML used: 1.0 - */ -#define XML_DEFAULT_VERSION "1.0" - -/** - * xmlParserInput: - * - * An xmlParserInput is an input flow for the XML processor. - * Each entity parsed is associated an xmlParserInput (except the - * few predefined ones). This is the case both for internal entities - * - in which case the flow is already completely in memory - or - * external entities - in which case we use the buf structure for - * progressive reading and I18N conversions to the internal UTF-8 format. - */ - -/** - * xmlParserInputDeallocate: - * @str: the string to deallocate - * - * Callback for freeing some parser input allocations. - */ -typedef void (* xmlParserInputDeallocate)(xmlChar *str); - -struct _xmlParserInput { - /* Input buffer */ - xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ - - const char *filename; /* The file analyzed, if any */ - const char *directory; /* the directory/base of the file */ - const xmlChar *base; /* Base of the array to parse */ - const xmlChar *cur; /* Current char being parsed */ - const xmlChar *end; /* end of the array to parse */ - int length; /* length if known */ - int line; /* Current line */ - int col; /* Current column */ - /* - * NOTE: consumed is only tested for equality in the parser code, - * so even if there is an overflow this should not give troubles - * for parsing very large instances. - */ - unsigned long consumed; /* How many xmlChars already consumed */ - xmlParserInputDeallocate free; /* function to deallocate the base */ - const xmlChar *encoding; /* the encoding string for entity */ - const xmlChar *version; /* the version string for entity */ - int standalone; /* Was that entity marked standalone */ - int id; /* an unique identifier for the entity */ -}; - -/** - * xmlParserNodeInfo: - * - * The parser can be asked to collect Node informations, i.e. at what - * place in the file they were detected. - * NOTE: This is off by default and not very well tested. - */ -typedef struct _xmlParserNodeInfo xmlParserNodeInfo; -typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; - -struct _xmlParserNodeInfo { - const struct _xmlNode* node; - /* Position & line # that text that created the node begins & ends on */ - unsigned long begin_pos; - unsigned long begin_line; - unsigned long end_pos; - unsigned long end_line; -}; - -typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; -typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; -struct _xmlParserNodeInfoSeq { - unsigned long maximum; - unsigned long length; - xmlParserNodeInfo* buffer; -}; - -/** - * xmlParserInputState: - * - * The parser is now working also as a state based parser. - * The recursive one use the state info for entities processing. - */ -typedef enum { - XML_PARSER_EOF = -1, /* nothing is to be parsed */ - XML_PARSER_START = 0, /* nothing has been parsed */ - XML_PARSER_MISC, /* Misc* before int subset */ - XML_PARSER_PI, /* Within a processing instruction */ - XML_PARSER_DTD, /* within some DTD content */ - XML_PARSER_PROLOG, /* Misc* after internal subset */ - XML_PARSER_COMMENT, /* within a comment */ - XML_PARSER_START_TAG, /* within a start tag */ - XML_PARSER_CONTENT, /* within the content */ - XML_PARSER_CDATA_SECTION, /* within a CDATA section */ - XML_PARSER_END_TAG, /* within a closing tag */ - XML_PARSER_ENTITY_DECL, /* within an entity declaration */ - XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ - XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ - XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG, /* the Misc* after the last end tag */ - XML_PARSER_IGNORE, /* within an IGNORED section */ - XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ -} xmlParserInputState; - -/** - * XML_DETECT_IDS: - * - * Bit in the loadsubset context field to tell to do ID/REFs lookups. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_DETECT_IDS 2 - -/** - * XML_COMPLETE_ATTRS: - * - * Bit in the loadsubset context field to tell to do complete the - * elements attributes lists with the ones defaulted from the DTDs. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_COMPLETE_ATTRS 4 - -/** - * XML_SKIP_IDS: - * - * Bit in the loadsubset context field to tell to not do ID/REFs registration. - * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. - */ -#define XML_SKIP_IDS 8 - -/** - * xmlParserMode: - * - * A parser can operate in various modes - */ -typedef enum { - XML_PARSE_UNKNOWN = 0, - XML_PARSE_DOM = 1, - XML_PARSE_SAX = 2, - XML_PARSE_PUSH_DOM = 3, - XML_PARSE_PUSH_SAX = 4, - XML_PARSE_READER = 5 -} xmlParserMode; - -/** - * xmlParserCtxt: - * - * The parser context. - * NOTE This doesn't completely define the parser state, the (current ?) - * design of the parser uses recursive function calls since this allow - * and easy mapping from the production rules of the specification - * to the actual code. The drawback is that the actual function call - * also reflect the parser state. However most of the parsing routines - * takes as the only argument the parser context pointer, so migrating - * to a state based parser for progressive parsing shouldn't be too hard. - */ -struct _xmlParserCtxt { - struct _xmlSAXHandler *sax; /* The SAX handler */ - void *userData; /* For SAX interface only, used by DOM build */ - xmlDocPtr myDoc; /* the document being built */ - int wellFormed; /* is the document well formed */ - int replaceEntities; /* shall we replace entities ? */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* the declared encoding, if any */ - int standalone; /* standalone document */ - int html; /* an HTML(1)/Docbook(2) document - * 3 is HTML after - * 10 is HTML after - */ - - /* Input stream stack */ - xmlParserInputPtr input; /* Current input stream */ - int inputNr; /* Number of current input streams */ - int inputMax; /* Max number of input streams */ - xmlParserInputPtr *inputTab; /* stack of inputs */ - - /* Node analysis stack only used for DOM building */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - int record_info; /* Whether node info should be kept */ - xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ - - int errNo; /* error code */ - - int hasExternalSubset; /* reference and external subset */ - int hasPErefs; /* the internal subset has PE refs */ - int external; /* are we parsing an external entity */ - - int valid; /* is the document valid */ - int validate; /* shall we try to validate ? */ - xmlValidCtxt vctxt; /* The validity context */ - - xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ - - char *directory; /* the data directory */ - - /* Node name stack */ - const xmlChar *name; /* Current parsed Node */ - int nameNr; /* Depth of the parsing stack */ - int nameMax; /* Max depth of the parsing stack */ - const xmlChar * *nameTab; /* array of nodes */ - - long nbChars; /* number of xmlChar processed */ - long checkIndex; /* used by progressive parsing lookup */ - int keepBlanks; /* ugly but ... */ - int disableSAX; /* SAX callbacks are disabled */ - int inSubset; /* Parsing is in int 1/ext 2 subset */ - const xmlChar * intSubName; /* name of subset */ - xmlChar * extSubURI; /* URI of external subset */ - xmlChar * extSubSystem; /* SYSTEM ID of external subset */ - - /* xml:space values */ - int * space; /* Should the parser preserve spaces */ - int spaceNr; /* Depth of the parsing stack */ - int spaceMax; /* Max depth of the parsing stack */ - int * spaceTab; /* array of space infos */ - - int depth; /* to prevent entity substitution loops */ - xmlParserInputPtr entity; /* used to check entities boundaries */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - int nodelen; /* Those two fields are there to */ - int nodemem; /* Speed up large node parsing */ - int pedantic; /* signal pedantic warnings */ - void *_private; /* For user data, libxml won't touch it */ - - int loadsubset; /* should the external subset be loaded */ - int linenumbers; /* set line number in element content */ - void *catalogs; /* document's own catalog */ - int recovery; /* run in recovery mode */ - int progressive; /* is this a progressive parsing */ - xmlDictPtr dict; /* dictionnary for the parser */ - const xmlChar * *atts; /* array for the attributes callbacks */ - int maxatts; /* the size of the array */ - int docdict; /* use strings from dict to build tree */ - - /* - * pre-interned strings - */ - const xmlChar *str_xml; - const xmlChar *str_xmlns; - const xmlChar *str_xml_ns; - - /* - * Everything below is used only by the new SAX mode - */ - int sax2; /* operating in the new SAX mode */ - int nsNr; /* the number of inherited namespaces */ - int nsMax; /* the size of the arrays */ - const xmlChar * *nsTab; /* the array of prefix/namespace name */ - int *attallocs; /* which attribute were allocated */ - void * *pushTab; /* array of data for push */ - xmlHashTablePtr attsDefault; /* defaulted attributes if any */ - xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ - int nsWellFormed; /* is the document XML Nanespace okay */ - int options; /* Extra options */ - - /* - * Those fields are needed only for treaming parsing so far - */ - int dictNames; /* Use dictionary names for the tree */ - int freeElemsNr; /* number of freed element nodes */ - xmlNodePtr freeElems; /* List of freed element nodes */ - int freeAttrsNr; /* number of freed attributes nodes */ - xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ - - /* - * the complete error informations for the last error. - */ - xmlError lastError; - xmlParserMode parseMode; /* the parser mode */ - unsigned long nbentities; /* number of entities references */ - unsigned long sizeentities; /* size of parsed entities */ - - /* for use by HTML non-recursive parser */ - xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ - int nodeInfoNr; /* Depth of the parsing stack */ - int nodeInfoMax; /* Max depth of the parsing stack */ - xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ -}; - -/** - * xmlSAXLocator: - * - * A SAX Locator. - */ -struct _xmlSAXLocator { - const xmlChar *(*getPublicId)(void *ctx); - const xmlChar *(*getSystemId)(void *ctx); - int (*getLineNumber)(void *ctx); - int (*getColumnNumber)(void *ctx); -}; - -/** - * xmlSAXHandler: - * - * A SAX handler is bunch of callbacks called by the parser when processing - * of the input generate data or structure informations. - */ - -/** - * resolveEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Callback: - * The entity loader, to control the loading of external entities, - * the application can either: - * - override this resolveEntity() callback in the SAX block - * - or better use the xmlSetExternalEntityLoader() function to - * set up it's own entity resolution routine - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * internalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on internal subset declaration. - */ -typedef void (*internalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * externalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on external subset declaration. - */ -typedef void (*externalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * getEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get an entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * getParameterEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get a parameter entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * entityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed. - */ -typedef void (*entityDeclSAXFunc) (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -/** - * notationDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -typedef void (*notationDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * attributeDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type - * @def: the type of default value - * @defaultValue: the attribute default value - * @tree: the tree of enumerated value set - * - * An attribute definition has been parsed. - */ -typedef void (*attributeDeclSAXFunc)(void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -/** - * elementDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type - * @content: the element value tree - * - * An element definition has been parsed. - */ -typedef void (*elementDeclSAXFunc)(void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -/** - * unparsedEntityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed. - */ -typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); -/** - * setDocumentLocatorSAXFunc: - * @ctx: the user data (XML parser context) - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator. - * Everything is available on the context, so this is useless in our case. - */ -typedef void (*setDocumentLocatorSAXFunc) (void *ctx, - xmlSAXLocatorPtr loc); -/** - * startDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document start being processed. - */ -typedef void (*startDocumentSAXFunc) (void *ctx); -/** - * endDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document end has been detected. - */ -typedef void (*endDocumentSAXFunc) (void *ctx); -/** - * startElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name, including namespace prefix - * @atts: An array of name/value attributes pairs, NULL terminated - * - * Called when an opening tag has been processed. - */ -typedef void (*startElementSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar **atts); -/** - * endElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name - * - * Called when the end of an element has been detected. - */ -typedef void (*endElementSAXFunc) (void *ctx, - const xmlChar *name); -/** - * attributeSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The attribute name, including namespace prefix - * @value: The attribute value - * - * Handle an attribute that has been read by the parser. - * The default handling is to convert the attribute into an - * DOM subtree and past it in a new xmlAttr element added to - * the element. - */ -typedef void (*attributeSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *value); -/** - * referenceSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Called when an entity reference is detected. - */ -typedef void (*referenceSAXFunc) (void *ctx, - const xmlChar *name); -/** - * charactersSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some chars from the parser. - */ -typedef void (*charactersSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * ignorableWhitespaceSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some ignorable whitespaces from the parser. - * UNUSED: by default the DOM building will use characters. - */ -typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * processingInstructionSAXFunc: - * @ctx: the user data (XML parser context) - * @target: the target name - * @data: the PI data's - * - * A processing instruction has been parsed. - */ -typedef void (*processingInstructionSAXFunc) (void *ctx, - const xmlChar *target, - const xmlChar *data); -/** - * commentSAXFunc: - * @ctx: the user data (XML parser context) - * @value: the comment content - * - * A comment has been parsed. - */ -typedef void (*commentSAXFunc) (void *ctx, - const xmlChar *value); -/** - * cdataBlockSAXFunc: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * Called when a pcdata block has been parsed. - */ -typedef void (*cdataBlockSAXFunc) ( - void *ctx, - const xmlChar *value, - int len); -/** - * warningSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, callback. - */ -typedef void (XMLCDECL *warningSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * errorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, callback. - */ -typedef void (XMLCDECL *errorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * fatalErrorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format fatal error messages, callback. - * Note: so far fatalError() SAX callbacks are not used, error() - * get all the callbacks for errors. - */ -typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * isStandaloneSAXFunc: - * @ctx: the user data (XML parser context) - * - * Is this document tagged standalone? - * - * Returns 1 if true - */ -typedef int (*isStandaloneSAXFunc) (void *ctx); -/** - * hasInternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an internal subset. - * - * Returns 1 if true - */ -typedef int (*hasInternalSubsetSAXFunc) (void *ctx); - -/** - * hasExternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an external subset? - * - * Returns 1 if true - */ -typedef int (*hasExternalSubsetSAXFunc) (void *ctx); - -/************************************************************************ - * * - * The SAX version 2 API extensions * - * * - ************************************************************************/ -/** - * XML_SAX2_MAGIC: - * - * Special constant found in SAX2 blocks initialized fields - */ -#define XML_SAX2_MAGIC 0xDEEDBEAF - -/** - * startElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * @nb_defaulted: the number of defaulted attributes. The defaulted - * ones are at the end of the array - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as - * the new namespace declarations on the element. - */ - -typedef void (*startElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); - -/** - * endElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. - */ - -typedef void (*endElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); - - -struct _xmlSAXHandler { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; - /* The following fields are extensions available only on version 2 */ - void *_private; - startElementNsSAX2Func startElementNs; - endElementNsSAX2Func endElementNs; - xmlStructuredErrorFunc serror; -}; - -/* - * SAX Version 1 - */ -typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; -typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; -struct _xmlSAXHandlerV1 { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; -}; - - -/** - * xmlExternalEntityLoader: - * @URL: The System ID of the resource requested - * @ID: The Public ID of the resource requested - * @context: the XML parser context - * - * External entity loaders types. - * - * Returns the entity input parser. - */ -typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, - const char *ID, - xmlParserCtxtPtr context); - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Init/Cleanup - */ -XMLPUBFUN void XMLCALL - xmlInitParser (void); -XMLPUBFUN void XMLCALL - xmlCleanupParser (void); - -/* - * Input functions - */ -XMLPUBFUN int XMLCALL - xmlParserInputRead (xmlParserInputPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputGrow (xmlParserInputPtr in, - int len); - -/* - * Basic parsing Interfaces - */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseFile (const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseMemory (const char *buffer, - int size); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlSubstituteEntitiesDefault(int val); -XMLPUBFUN int XMLCALL - xmlKeepBlanksDefault (int val); -XMLPUBFUN void XMLCALL - xmlStopParser (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlPedanticParserDefault(int val); -XMLPUBFUN int XMLCALL - xmlLineNumbersDefault (int val); - -#ifdef LIBXML_SAX1_ENABLED -/* - * Recovery mode - */ -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverMemory (const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverFile (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -/* - * Less common routines and SAX interfaces - */ -XMLPUBFUN int XMLCALL - xmlParseDocument (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXUserParseFile (xmlSAXHandlerPtr sax, - void *user_data, - const char *filename); -XMLPUBFUN int XMLCALL - xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, - void *user_data, - const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseDoc (xmlSAXHandlerPtr sax, - const xmlChar *cur, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemory (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFile (xmlSAXHandlerPtr sax, - const char *filename, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, - const char *filename, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseEntity (xmlSAXHandlerPtr sax, - const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseEntity (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlSAXParseDTD (xmlSAXHandlerPtr sax, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlParseDTD (const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlIOParseDTD (xmlSAXHandlerPtr sax, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); -#endif /* LIBXML_VALID_ENABLE */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemory(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserErrors XMLCALL - xmlParseInNodeContext (xmlNodePtr node, - const char *data, - int datalen, - int options, - xmlNodePtr *lst); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst, - int recover); -XMLPUBFUN int XMLCALL - xmlParseExternalEntity (xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); - -/* - * Parser contexts handling. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlNewParserCtxt (void); -XMLPUBFUN int XMLCALL - xmlInitParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlClearParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, - const xmlChar* buffer, - const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateDocParserCtxt (const xmlChar *cur); - -#ifdef LIBXML_LEGACY_ENABLED -/* - * Reading/setting optional parsing features. - */ -XMLPUBFUN int XMLCALL - xmlGetFeaturesList (int *len, - const char **result); -XMLPUBFUN int XMLCALL - xmlGetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *result); -XMLPUBFUN int XMLCALL - xmlSetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *value); -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef LIBXML_PUSH_ENABLED -/* - * Interfaces for the Push mode. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename); -XMLPUBFUN int XMLCALL - xmlParseChunk (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -/* - * Special I/O mode. - */ - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, - void *user_data, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewIOInputStream (xmlParserCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); - -/* - * Node infos. - */ -XMLPUBFUN const xmlParserNodeInfo* XMLCALL - xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN void XMLCALL - xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN unsigned long XMLCALL - xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, - const xmlParserNodeInfoPtr info); - -/* - * External entities handling actually implemented in xmlIO. - */ - -XMLPUBFUN void XMLCALL - xmlSetExternalEntityLoader(xmlExternalEntityLoader f); -XMLPUBFUN xmlExternalEntityLoader XMLCALL - xmlGetExternalEntityLoader(void); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlLoadExternalEntity (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * Index lookup, actually implemented in the encoding module - */ -XMLPUBFUN long XMLCALL - xmlByteConsumed (xmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - XML_PARSE_RECOVER = 1<<0, /* recover on errors */ - XML_PARSE_NOENT = 1<<1, /* substitute entities */ - XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ - XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ - XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ - XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ - XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ - XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ - XML_PARSE_NONET = 1<<11,/* Forbid network access */ - XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ - XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ - XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ - XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of - the tree allowed afterwards (will possibly - crash if you try to modify the tree) */ - XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ - XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ - XML_PARSE_HUGE = 1<<19, /* relax any hardcoded limit from the parser */ - XML_PARSE_OLDSAX = 1<<20 /* parse using SAX2 interface from before 2.7.0 */ -} xmlParserOption; - -XMLPUBFUN void XMLCALL - xmlCtxtReset (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlCtxtResetPush (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* - * Library wide options - */ -/** - * xmlFeature: - * - * Used to examine the existance of features that can be enabled - * or disabled at compile-time. - * They used to be called XML_FEATURE_xxx but this clashed with Expat - */ -typedef enum { - XML_WITH_THREAD = 1, - XML_WITH_TREE = 2, - XML_WITH_OUTPUT = 3, - XML_WITH_PUSH = 4, - XML_WITH_READER = 5, - XML_WITH_PATTERN = 6, - XML_WITH_WRITER = 7, - XML_WITH_SAX1 = 8, - XML_WITH_FTP = 9, - XML_WITH_HTTP = 10, - XML_WITH_VALID = 11, - XML_WITH_HTML = 12, - XML_WITH_LEGACY = 13, - XML_WITH_C14N = 14, - XML_WITH_CATALOG = 15, - XML_WITH_XPATH = 16, - XML_WITH_XPTR = 17, - XML_WITH_XINCLUDE = 18, - XML_WITH_ICONV = 19, - XML_WITH_ISO8859X = 20, - XML_WITH_UNICODE = 21, - XML_WITH_REGEXP = 22, - XML_WITH_AUTOMATA = 23, - XML_WITH_EXPR = 24, - XML_WITH_SCHEMAS = 25, - XML_WITH_SCHEMATRON = 26, - XML_WITH_MODULES = 27, - XML_WITH_DEBUG = 28, - XML_WITH_DEBUG_MEM = 29, - XML_WITH_DEBUG_RUN = 30, - XML_WITH_ZLIB = 31, - XML_WITH_ICU = 32, - XML_WITH_NONE = 99999 /* just to be sure of allocation size */ -} xmlFeature; - -XMLPUBFUN int XMLCALL - xmlHasFeature (xmlFeature feature); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/parserInternals.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/parserInternals.h deleted file mode 100644 index a5e75b5e38..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/parserInternals.h +++ /dev/null @@ -1,611 +0,0 @@ -/* - * Summary: internals routines exported by the parser. - * Description: this module exports a number of internal parsing routines - * they are not really all intended for applications but - * can prove useful doing low level processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_INTERNALS_H__ -#define __XML_PARSER_INTERNALS_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserMaxDepth: - * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature, use XML_PARSE_HUGE option to override it. - */ -XMLPUBVAR unsigned int xmlParserMaxDepth; - -/** - * XML_MAX_TEXT_LENGTH: - * - * Maximum size allowed for a single text node when building a tree. - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - */ -#define XML_MAX_TEXT_LENGTH 10000000 - -/** - * XML_MAX_NAMELEN: - * - * Identifiers can be longer, but this will be more costly - * at runtime. - */ -#define XML_MAX_NAMELEN 100 - -/** - * INPUT_CHUNK: - * - * The parser tries to always have that amount of input ready. - * One of the point is providing context when reporting errors. - */ -#define INPUT_CHUNK 250 - -/************************************************************************ - * * - * UNICODE version of the macros. * - * * - ************************************************************************/ -/** - * IS_BYTE_CHAR: - * @c: an byte value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20...] - * any byte character in the accepted range - */ -#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) - -/** - * IS_CHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] - * | [#x10000-#x10FFFF] - * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. - */ -#define IS_CHAR(c) xmlIsCharQ(c) - -/** - * IS_CHAR_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Behaves like IS_CHAR on single-byte value - */ -#define IS_CHAR_CH(c) xmlIsChar_ch(c) - -/** - * IS_BLANK: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [3] S ::= (#x20 | #x9 | #xD | #xA)+ - */ -#define IS_BLANK(c) xmlIsBlankQ(c) - -/** - * IS_BLANK_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Behaviour same as IS_BLANK - */ -#define IS_BLANK_CH(c) xmlIsBlank_ch(c) - -/** - * IS_BASECHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [85] BaseChar ::= ... long list see REC ... - */ -#define IS_BASECHAR(c) xmlIsBaseCharQ(c) - -/** - * IS_DIGIT: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [88] Digit ::= ... long list see REC ... - */ -#define IS_DIGIT(c) xmlIsDigitQ(c) - -/** - * IS_DIGIT_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_DIGIT but with a single byte argument - */ -#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) - -/** - * IS_COMBINING: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [87] CombiningChar ::= ... long list see REC ... - */ -#define IS_COMBINING(c) xmlIsCombiningQ(c) - -/** - * IS_COMBINING_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Always false (all combining chars > 0xff) - */ -#define IS_COMBINING_CH(c) 0 - -/** - * IS_EXTENDER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | - * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | - * [#x309D-#x309E] | [#x30FC-#x30FE] - */ -#define IS_EXTENDER(c) xmlIsExtenderQ(c) - -/** - * IS_EXTENDER_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_EXTENDER but with a single-byte argument - */ -#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) - -/** - * IS_IDEOGRAPHIC: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) - -/** - * IS_LETTER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [84] Letter ::= BaseChar | Ideographic - */ -#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) - -/** - * IS_LETTER_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Macro behaves like IS_LETTER, but only check base chars - * - */ -#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) - -/** - * IS_ASCII_LETTER: - * @c: an xmlChar value - * - * Macro to check [a-zA-Z] - * - */ -#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a))) - -/** - * IS_ASCII_DIGIT: - * @c: an xmlChar value - * - * Macro to check [0-9] - * - */ -#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) - -/** - * IS_PUBIDCHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - */ -#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) - -/** - * IS_PUBIDCHAR_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Same as IS_PUBIDCHAR but for single-byte value - */ -#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) - -/** - * SKIP_EOL: - * @p: and UTF8 string pointer - * - * Skips the end of line chars. - */ -#define SKIP_EOL(p) \ - if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ - if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } - -/** - * MOVETO_ENDTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '>' char. - */ -#define MOVETO_ENDTAG(p) \ - while ((*p) && (*(p) != '>')) (p)++ - -/** - * MOVETO_STARTTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '<' char. - */ -#define MOVETO_STARTTAG(p) \ - while ((*p) && (*(p) != '<')) (p)++ - -/** - * Global variables used for predefined strings. - */ -XMLPUBVAR const xmlChar xmlStringText[]; -XMLPUBVAR const xmlChar xmlStringTextNoenc[]; -XMLPUBVAR const xmlChar xmlStringComment[]; - -/* - * Function to finish the work of the macros where needed. - */ -XMLPUBFUN int XMLCALL xmlIsLetter (int c); - -/** - * Parser context. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateFileParserCtxt (const char *filename); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateURLParserCtxt (const char *filename, - int options); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateMemoryParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateEntityParserCtxt(const xmlChar *URL, - const xmlChar *ID, - const xmlChar *base); -XMLPUBFUN int XMLCALL - xmlSwitchEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncodingHandlerPtr handler); -XMLPUBFUN int XMLCALL - xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input, - xmlCharEncodingHandlerPtr handler); - -#ifdef IN_LIBXML -/* internal error reporting */ -XMLPUBFUN void XMLCALL - __xmlErrEncoding (xmlParserCtxtPtr ctxt, - xmlParserErrors xmlerr, - const char *msg, - const xmlChar * str1, - const xmlChar * str2); -#endif - -/** - * Input Streams. - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewStringInputStream (xmlParserCtxtPtr ctxt, - const xmlChar *buffer); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); -XMLPUBFUN int XMLCALL - xmlPushInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input); -XMLPUBFUN xmlChar XMLCALL - xmlPopInput (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeInputStream (xmlParserInputPtr input); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputFromFile (xmlParserCtxtPtr ctxt, - const char *filename); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputStream (xmlParserCtxtPtr ctxt); - -/** - * Namespaces. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName (xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlChar **prefix); - -/** - * Generic production rules. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlParseName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseNmtoken (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEntityValue (xmlParserCtxtPtr ctxt, - xmlChar **orig); -XMLPUBFUN xmlChar * XMLCALL - xmlParseAttValue (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseCharData (xmlParserCtxtPtr ctxt, - int cdata); -XMLPUBFUN xmlChar * XMLCALL - xmlParseExternalID (xmlParserCtxtPtr ctxt, - xmlChar **publicID, - int strict); -XMLPUBFUN void XMLCALL - xmlParseComment (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParsePITarget (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePI (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseNotationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN int XMLCALL - xmlParseAttributeType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN void XMLCALL - xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementMixedContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementChildrenContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN int XMLCALL - xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlElementContentPtr *result); -XMLPUBFUN int XMLCALL - xmlParseElementDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseCharRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlParseEntityRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePEReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlParseAttribute (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseStartTag (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEndTag (xmlParserCtxtPtr ctxt); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN void XMLCALL - xmlParseCDSect (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseContent (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseElement (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionNum (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEncName (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseSDDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseTextDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMisc (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseExternalSubset (xmlParserCtxtPtr ctxt, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * XML_SUBSTITUTE_NONE: - * - * If no entities need to be substituted. - */ -#define XML_SUBSTITUTE_NONE 0 -/** - * XML_SUBSTITUTE_REF: - * - * Whether general entities need to be substituted. - */ -#define XML_SUBSTITUTE_REF 1 -/** - * XML_SUBSTITUTE_PEREF: - * - * Whether parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_PEREF 2 -/** - * XML_SUBSTITUTE_BOTH: - * - * Both general and parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_BOTH 3 - -XMLPUBFUN xmlChar * XMLCALL - xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN xmlChar * XMLCALL - xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, - xmlNodePtr value); -XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, - xmlParserInputPtr value); -XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, - const xmlChar *value); - -/* - * other commodities shared between parser.c and parserInternals. - */ -XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - int *len); -XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); - -/* - * Really core function shared with HTML parser. - */ -XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, - int *len); -XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, - int val); -XMLPUBFUN int XMLCALL xmlCopyChar (int len, - xmlChar *out, - int val); -XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); - -#ifdef LIBXML_HTML_ENABLED -/* - * Actually comes from the HTML parser but launched from the init stuff. - */ -XMLPUBFUN void XMLCALL htmlInitAutoClose (void); -XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, - const char *encoding); -#endif - -/* - * Specific function to keep track of entities references - * and used by the XSLT debugger. - */ -#ifdef LIBXML_LEGACY_ENABLED -/** - * xmlEntityReferenceFunc: - * @ent: the entity - * @firstNode: the fist node in the chunk - * @lastNode: the last nod in the chunk - * - * Callback function used when one needs to be able to track back the - * provenance of a chunk of nodes inherited from an entity replacement. - */ -typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, - xmlNodePtr firstNode, - xmlNodePtr lastNode); - -XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); - -XMLPUBFUN xmlChar * XMLCALL - xmlParseQuotedString (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNamespace (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlScanName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, - xmlChar **prefix); -/** - * Entities - */ -XMLPUBFUN xmlChar * XMLCALL - xmlDecodeEntities (xmlParserCtxtPtr ctxt, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN void XMLCALL - xmlHandleEntity (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); - -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef IN_LIBXML -/* - * internal only - */ -XMLPUBFUN void XMLCALL - xmlErrMemory (xmlParserCtxtPtr ctxt, - const char *extra); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/pattern.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/pattern.h deleted file mode 100644 index 97d2cd2bc0..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/pattern.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Summary: pattern expression handling - * Description: allows to compile and test pattern expressions for nodes - * either in a tree or based on a parser state. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PATTERN_H__ -#define __XML_PATTERN_H__ - -#include -#include -#include - -#ifdef LIBXML_PATTERN_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlPattern: - * - * A compiled (XPath based) pattern to select nodes - */ -typedef struct _xmlPattern xmlPattern; -typedef xmlPattern *xmlPatternPtr; - -/** - * xmlPatternFlags: - * - * This is the set of options affecting the behaviour of pattern - * matching with this module - * - */ -typedef enum { - XML_PATTERN_DEFAULT = 0, /* simple pattern match */ - XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ - XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ - XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ -} xmlPatternFlags; - -XMLPUBFUN void XMLCALL - xmlFreePattern (xmlPatternPtr comp); - -XMLPUBFUN void XMLCALL - xmlFreePatternList (xmlPatternPtr comp); - -XMLPUBFUN xmlPatternPtr XMLCALL - xmlPatterncompile (const xmlChar *pattern, - xmlDict *dict, - int flags, - const xmlChar **namespaces); -XMLPUBFUN int XMLCALL - xmlPatternMatch (xmlPatternPtr comp, - xmlNodePtr node); - -/* streaming interfaces */ -typedef struct _xmlStreamCtxt xmlStreamCtxt; -typedef xmlStreamCtxt *xmlStreamCtxtPtr; - -XMLPUBFUN int XMLCALL - xmlPatternStreamable (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternMaxDepth (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternMinDepth (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternFromRoot (xmlPatternPtr comp); -XMLPUBFUN xmlStreamCtxtPtr XMLCALL - xmlPatternGetStreamCtxt (xmlPatternPtr comp); -XMLPUBFUN void XMLCALL - xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); -XMLPUBFUN int XMLCALL - xmlStreamPushNode (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns, - int nodeType); -XMLPUBFUN int XMLCALL - xmlStreamPush (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlStreamPushAttr (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlStreamPop (xmlStreamCtxtPtr stream); -XMLPUBFUN int XMLCALL - xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_PATTERN_ENABLED */ - -#endif /* __XML_PATTERN_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/schemasInternals.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/schemasInternals.h deleted file mode 100644 index b68a6e1285..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/schemasInternals.h +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Summary: internal interfaces for XML Schemas - * Description: internal interfaces for the XML Schemas handling - * and schema validity checking - * The Schemas development is a Work In Progress. - * Some of those interfaces are not garanteed to be API or ABI stable ! - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_INTERNALS_H__ -#define __XML_SCHEMA_INTERNALS_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMAS_UNKNOWN = 0, - XML_SCHEMAS_STRING, - XML_SCHEMAS_NORMSTRING, - XML_SCHEMAS_DECIMAL, - XML_SCHEMAS_TIME, - XML_SCHEMAS_GDAY, - XML_SCHEMAS_GMONTH, - XML_SCHEMAS_GMONTHDAY, - XML_SCHEMAS_GYEAR, - XML_SCHEMAS_GYEARMONTH, - XML_SCHEMAS_DATE, - XML_SCHEMAS_DATETIME, - XML_SCHEMAS_DURATION, - XML_SCHEMAS_FLOAT, - XML_SCHEMAS_DOUBLE, - XML_SCHEMAS_BOOLEAN, - XML_SCHEMAS_TOKEN, - XML_SCHEMAS_LANGUAGE, - XML_SCHEMAS_NMTOKEN, - XML_SCHEMAS_NMTOKENS, - XML_SCHEMAS_NAME, - XML_SCHEMAS_QNAME, - XML_SCHEMAS_NCNAME, - XML_SCHEMAS_ID, - XML_SCHEMAS_IDREF, - XML_SCHEMAS_IDREFS, - XML_SCHEMAS_ENTITY, - XML_SCHEMAS_ENTITIES, - XML_SCHEMAS_NOTATION, - XML_SCHEMAS_ANYURI, - XML_SCHEMAS_INTEGER, - XML_SCHEMAS_NPINTEGER, - XML_SCHEMAS_NINTEGER, - XML_SCHEMAS_NNINTEGER, - XML_SCHEMAS_PINTEGER, - XML_SCHEMAS_INT, - XML_SCHEMAS_UINT, - XML_SCHEMAS_LONG, - XML_SCHEMAS_ULONG, - XML_SCHEMAS_SHORT, - XML_SCHEMAS_USHORT, - XML_SCHEMAS_BYTE, - XML_SCHEMAS_UBYTE, - XML_SCHEMAS_HEXBINARY, - XML_SCHEMAS_BASE64BINARY, - XML_SCHEMAS_ANYTYPE, - XML_SCHEMAS_ANYSIMPLETYPE -} xmlSchemaValType; - -/* - * XML Schemas defines multiple type of types. - */ -typedef enum { - XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ - XML_SCHEMA_TYPE_ANY, - XML_SCHEMA_TYPE_FACET, - XML_SCHEMA_TYPE_SIMPLE, - XML_SCHEMA_TYPE_COMPLEX, - XML_SCHEMA_TYPE_SEQUENCE = 6, - XML_SCHEMA_TYPE_CHOICE, - XML_SCHEMA_TYPE_ALL, - XML_SCHEMA_TYPE_SIMPLE_CONTENT, - XML_SCHEMA_TYPE_COMPLEX_CONTENT, - XML_SCHEMA_TYPE_UR, - XML_SCHEMA_TYPE_RESTRICTION, - XML_SCHEMA_TYPE_EXTENSION, - XML_SCHEMA_TYPE_ELEMENT, - XML_SCHEMA_TYPE_ATTRIBUTE, - XML_SCHEMA_TYPE_ATTRIBUTEGROUP, - XML_SCHEMA_TYPE_GROUP, - XML_SCHEMA_TYPE_NOTATION, - XML_SCHEMA_TYPE_LIST, - XML_SCHEMA_TYPE_UNION, - XML_SCHEMA_TYPE_ANY_ATTRIBUTE, - XML_SCHEMA_TYPE_IDC_UNIQUE, - XML_SCHEMA_TYPE_IDC_KEY, - XML_SCHEMA_TYPE_IDC_KEYREF, - XML_SCHEMA_TYPE_PARTICLE = 25, - XML_SCHEMA_TYPE_ATTRIBUTE_USE, - XML_SCHEMA_FACET_MININCLUSIVE = 1000, - XML_SCHEMA_FACET_MINEXCLUSIVE, - XML_SCHEMA_FACET_MAXINCLUSIVE, - XML_SCHEMA_FACET_MAXEXCLUSIVE, - XML_SCHEMA_FACET_TOTALDIGITS, - XML_SCHEMA_FACET_FRACTIONDIGITS, - XML_SCHEMA_FACET_PATTERN, - XML_SCHEMA_FACET_ENUMERATION, - XML_SCHEMA_FACET_WHITESPACE, - XML_SCHEMA_FACET_LENGTH, - XML_SCHEMA_FACET_MAXLENGTH, - XML_SCHEMA_FACET_MINLENGTH, - XML_SCHEMA_EXTRA_QNAMEREF = 2000, - XML_SCHEMA_EXTRA_ATTR_USE_PROHIB -} xmlSchemaTypeType; - -typedef enum { - XML_SCHEMA_CONTENT_UNKNOWN = 0, - XML_SCHEMA_CONTENT_EMPTY = 1, - XML_SCHEMA_CONTENT_ELEMENTS, - XML_SCHEMA_CONTENT_MIXED, - XML_SCHEMA_CONTENT_SIMPLE, - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ - XML_SCHEMA_CONTENT_BASIC, - XML_SCHEMA_CONTENT_ANY -} xmlSchemaContentType; - -typedef struct _xmlSchemaVal xmlSchemaVal; -typedef xmlSchemaVal *xmlSchemaValPtr; - -typedef struct _xmlSchemaType xmlSchemaType; -typedef xmlSchemaType *xmlSchemaTypePtr; - -typedef struct _xmlSchemaFacet xmlSchemaFacet; -typedef xmlSchemaFacet *xmlSchemaFacetPtr; - -/** - * Annotation - */ -typedef struct _xmlSchemaAnnot xmlSchemaAnnot; -typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; -struct _xmlSchemaAnnot { - struct _xmlSchemaAnnot *next; - xmlNodePtr content; /* the annotation */ -}; - -/** - * XML_SCHEMAS_ANYATTR_SKIP: - * - * Skip unknown attribute from validation - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_SKIP 1 -/** - * XML_SCHEMAS_ANYATTR_LAX: - * - * Ignore validation non definition on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_LAX 2 -/** - * XML_SCHEMAS_ANYATTR_STRICT: - * - * Apply strict validation rules on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_STRICT 3 -/** - * XML_SCHEMAS_ANY_SKIP: - * - * Skip unknown attribute from validation - */ -#define XML_SCHEMAS_ANY_SKIP 1 -/** - * XML_SCHEMAS_ANY_LAX: - * - * Used by wildcards. - * Validate if type found, don't worry if not found - */ -#define XML_SCHEMAS_ANY_LAX 2 -/** - * XML_SCHEMAS_ANY_STRICT: - * - * Used by wildcards. - * Apply strict validation rules - */ -#define XML_SCHEMAS_ANY_STRICT 3 -/** - * XML_SCHEMAS_ATTR_USE_PROHIBITED: - * - * Used by wildcards. - * The attribute is prohibited. - */ -#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 -/** - * XML_SCHEMAS_ATTR_USE_REQUIRED: - * - * The attribute is required. - */ -#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 -/** - * XML_SCHEMAS_ATTR_USE_OPTIONAL: - * - * The attribute is optional. - */ -#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 -/** - * XML_SCHEMAS_ATTR_GLOBAL: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 -/** - * XML_SCHEMAS_ATTR_NSDEFAULT: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: - * - * this is set when the "type" and "ref" references - * have been resolved. - */ -#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 -/** - * XML_SCHEMAS_ATTR_FIXED: - * - * the attribute has a fixed value - */ -#define XML_SCHEMAS_ATTR_FIXED 1 << 9 - -/** - * xmlSchemaAttribute: - * An attribute definition. - */ - -typedef struct _xmlSchemaAttribute xmlSchemaAttribute; -typedef xmlSchemaAttribute *xmlSchemaAttributePtr; -struct _xmlSchemaAttribute { - xmlSchemaTypeType type; - struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ - const xmlChar *name; /* the name of the declaration */ - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - const xmlChar *typeName; /* the local name of the type definition */ - const xmlChar *typeNs; /* the ns URI of the type definition */ - xmlSchemaAnnotPtr annot; - - xmlSchemaTypePtr base; /* Deprecated; not used */ - int occurs; /* Deprecated; not used */ - const xmlChar *defValue; /* The initial value of the value constraint */ - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlNodePtr node; - const xmlChar *targetNamespace; - int flags; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value constraint */ - xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ -}; - -/** - * xmlSchemaAttributeLink: - * Used to build a list of attribute uses on complexType definitions. - * WARNING: Deprecated; not used. - */ -typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; -typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; -struct _xmlSchemaAttributeLink { - struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ - struct _xmlSchemaAttribute *attr;/* the linked attribute */ -}; - -/** - * XML_SCHEMAS_WILDCARD_COMPLETE: - * - * If the wildcard is complete. - */ -#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 - -/** - * xmlSchemaCharValueLink: - * Used to build a list of namespaces on wildcards. - */ -typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; -typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; -struct _xmlSchemaWildcardNs { - struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ - const xmlChar *value;/* the value */ -}; - -/** - * xmlSchemaWildcard. - * A wildcard. - */ -typedef struct _xmlSchemaWildcard xmlSchemaWildcard; -typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; -struct _xmlSchemaWildcard { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *id; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - int processContents; - int any; /* Indicates if the ns constraint is of ##any */ - xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ - xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ - int flags; -}; - -/** - * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 -/** - * XML_SCHEMAS_ATTRGROUP_GLOBAL: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ATTRGROUP_MARKED: - * - * Marks the attr group as marked; used for circular checks. - */ -#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 - -/** - * XML_SCHEMAS_ATTRGROUP_REDEFINED: - * - * The attr group was redefined. - */ -#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 -/** - * XML_SCHEMAS_ATTRGROUP_HAS_REFS: - * - * Whether this attr. group contains attr. group references. - */ -#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 - -/** - * An attribute group definition. - * - * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures - * must be kept similar - */ -typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; -typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; -struct _xmlSchemaAttributeGroup { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ - const xmlChar *name; - const xmlChar *id; - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int flags; - xmlSchemaWildcardPtr attributeWildcard; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/** - * xmlSchemaTypeLink: - * Used to build a list of types (e.g. member types of - * simpleType with variety "union"). - */ -typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; -typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; -struct _xmlSchemaTypeLink { - struct _xmlSchemaTypeLink *next;/* the next type link ... */ - xmlSchemaTypePtr type;/* the linked type */ -}; - -/** - * xmlSchemaFacetLink: - * Used to build a list of facets. - */ -typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; -typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; -struct _xmlSchemaFacetLink { - struct _xmlSchemaFacetLink *next;/* the next facet link ... */ - xmlSchemaFacetPtr facet;/* the linked facet */ -}; - -/** - * XML_SCHEMAS_TYPE_MIXED: - * - * the element content type is mixed - */ -#define XML_SCHEMAS_TYPE_MIXED 1 << 0 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: - * - * the simple or complex type has a derivation method of "extension". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: - * - * the simple or complex type has a derivation method of "restriction". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 -/** - * XML_SCHEMAS_TYPE_GLOBAL: - * - * the type is global - */ -#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 -/** - * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: - * - * the complexType owns an attribute wildcard, i.e. - * it can be freed by the complexType - */ -#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ -/** - * XML_SCHEMAS_TYPE_VARIETY_ABSENT: - * - * the simpleType has a variety of "absent". - * TODO: Actually not necessary :-/, since if - * none of the variety flags occur then it's - * automatically absent. - */ -#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 -/** - * XML_SCHEMAS_TYPE_VARIETY_LIST: - * - * the simpleType has a variety of "list". - */ -#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 -/** - * XML_SCHEMAS_TYPE_VARIETY_UNION: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 -/** - * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 -/** - * XML_SCHEMAS_TYPE_FINAL_EXTENSION: - * - * the complexType has a final of "extension". - */ -#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 -/** - * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: - * - * the simpleType/complexType has a final of "restriction". - */ -#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 -/** - * XML_SCHEMAS_TYPE_FINAL_LIST: - * - * the simpleType has a final of "list". - */ -#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 -/** - * XML_SCHEMAS_TYPE_FINAL_UNION: - * - * the simpleType has a final of "union". - */ -#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 -/** - * XML_SCHEMAS_TYPE_FINAL_DEFAULT: - * - * the simpleType has a final of "default". - */ -#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 -/** - * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: - * - * Marks the item as a builtin primitive. - */ -#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 -/** - * XML_SCHEMAS_TYPE_MARKED: - * - * Marks the item as marked; used for circular checks. - */ -#define XML_SCHEMAS_TYPE_MARKED 1 << 16 -/** - * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: - * - * the complexType did not specify 'block' so use the default of the - * item. - */ -#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 -/** - * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: - * - * the complexType has a 'block' of "extension". - */ -#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 -/** - * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: - * - * the complexType has a 'block' of "restriction". - */ -#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 -/** - * XML_SCHEMAS_TYPE_ABSTRACT: - * - * the simple/complexType is abstract. - */ -#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 -/** - * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: - * - * indicates if the facets need a computed value - */ -#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 -/** - * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: - * - * indicates that the type was typefixed - */ -#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 -/** - * XML_SCHEMAS_TYPE_INTERNAL_INVALID: - * - * indicates that the type is invalid - */ -#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: - * - * a whitespace-facet value of "preserve" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: - * - * a whitespace-facet value of "replace" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: - * - * a whitespace-facet value of "collapse" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 -/** - * XML_SCHEMAS_TYPE_HAS_FACETS: - * - * has facets - */ -#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 -/** - * XML_SCHEMAS_TYPE_NORMVALUENEEDED: - * - * indicates if the facets (pattern) need a normalized value - */ -#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 - -/** - * XML_SCHEMAS_TYPE_FIXUP_1: - * - * First stage of fixup was done. - */ -#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 - -/** - * XML_SCHEMAS_TYPE_REDEFINED: - * - * The type was redefined. - */ -#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 -/** - * XML_SCHEMAS_TYPE_REDEFINING: - * - * The type redefines an other type. - */ -/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ - -/** - * _xmlSchemaType: - * - * Schemas type definition. - */ -struct _xmlSchemaType { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* the next type if in a sequence ... */ - const xmlChar *name; - const xmlChar *id ; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - xmlSchemaContentType contentType; - const xmlChar *base; /* Base type's local name */ - const xmlChar *baseNs; /* Base type's target namespace */ - xmlSchemaTypePtr baseType; /* The base type component */ - xmlSchemaFacetPtr facets; /* Local facets */ - struct _xmlSchemaType *redef; /* Deprecated; not used */ - int recurse; /* Obsolete */ - xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ - xmlSchemaWildcardPtr attributeWildcard; - int builtInType; /* Type of built-in types. */ - xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ - xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. - Could we use @subtypes for this? */ - xmlRegexpPtr contModel; /* Holds the automaton of the content model */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/* - * xmlSchemaElement: - * An element definition. - * - * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of - * structures must be kept similar - */ -/** - * XML_SCHEMAS_ELEM_NILLABLE: - * - * the element is nillable - */ -#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 -/** - * XML_SCHEMAS_ELEM_GLOBAL: - * - * the element is global - */ -#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ELEM_DEFAULT: - * - * the element has a default value - */ -#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 -/** - * XML_SCHEMAS_ELEM_FIXED: - * - * the element has a fixed value - */ -#define XML_SCHEMAS_ELEM_FIXED 1 << 3 -/** - * XML_SCHEMAS_ELEM_ABSTRACT: - * - * the element is abstract - */ -#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 -/** - * XML_SCHEMAS_ELEM_TOPLEVEL: - * - * the element is top level - * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead - */ -#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 -/** - * XML_SCHEMAS_ELEM_REF: - * - * the element is a reference to a type - */ -#define XML_SCHEMAS_ELEM_REF 1 << 6 -/** - * XML_SCHEMAS_ELEM_NSDEFAULT: - * - * allow elements in no namespace - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: - * - * this is set when "type", "ref", "substitutionGroup" - * references have been resolved. - */ -#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 - /** - * XML_SCHEMAS_ELEM_CIRCULAR: - * - * a helper flag for the search of circular references. - */ -#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 -/** - * XML_SCHEMAS_ELEM_BLOCK_ABSENT: - * - * the "block" attribute is absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 -/** - * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: - * - * disallowed substitutions are absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 -/** - * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: - * - * disallowed substitutions: "restriction" - */ -#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 -/** - * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: - * - * disallowed substitutions: "substituion" - */ -#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 -/** - * XML_SCHEMAS_ELEM_FINAL_ABSENT: - * - * substitution group exclusions are absent - */ -#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 -/** - * XML_SCHEMAS_ELEM_FINAL_EXTENSION: - * - * substitution group exclusions: "extension" - */ -#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 -/** - * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: - * - * substitution group exclusions: "restriction" - */ -#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 -/** - * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: - * - * the declaration is a substitution group head - */ -#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 -/** - * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: - * - * this is set when the elem decl has been checked against - * all constraints - */ -#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 - -typedef struct _xmlSchemaElement xmlSchemaElement; -typedef xmlSchemaElement *xmlSchemaElementPtr; -struct _xmlSchemaElement { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* Not used? */ - const xmlChar *name; - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlSchemaAttributePtr attributes; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - const xmlChar *targetNamespace; - const xmlChar *namedType; - const xmlChar *namedTypeNs; - const xmlChar *substGroup; - const xmlChar *substGroupNs; - const xmlChar *scope; - const xmlChar *value; /* The original value of the value constraint. */ - struct _xmlSchemaElement *refDecl; /* This will now be used for the - substitution group affiliation */ - xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ - xmlSchemaContentType contentType; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value contraint. */ - void *idcs; /* The identity-constraint defs */ -}; - -/* - * XML_SCHEMAS_FACET_UNKNOWN: - * - * unknown facet handling - */ -#define XML_SCHEMAS_FACET_UNKNOWN 0 -/* - * XML_SCHEMAS_FACET_PRESERVE: - * - * preserve the type of the facet - */ -#define XML_SCHEMAS_FACET_PRESERVE 1 -/* - * XML_SCHEMAS_FACET_REPLACE: - * - * replace the type of the facet - */ -#define XML_SCHEMAS_FACET_REPLACE 2 -/* - * XML_SCHEMAS_FACET_COLLAPSE: - * - * collapse the types of the facet - */ -#define XML_SCHEMAS_FACET_COLLAPSE 3 -/** - * A facet definition. - */ -struct _xmlSchemaFacet { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ - const xmlChar *value; /* The original value */ - const xmlChar *id; /* Obsolete */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ - int whitespace; - xmlSchemaValPtr val; /* The compiled value */ - xmlRegexpPtr regexp; /* The regex for patterns */ -}; - -/** - * A notation definition. - */ -typedef struct _xmlSchemaNotation xmlSchemaNotation; -typedef xmlSchemaNotation *xmlSchemaNotationPtr; -struct _xmlSchemaNotation { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *name; - xmlSchemaAnnotPtr annot; - const xmlChar *identifier; - const xmlChar *targetNamespace; -}; - -/* -* TODO: Actually all those flags used for the schema should sit -* on the schema parser context, since they are used only -* during parsing an XML schema document, and not available -* on the component level as per spec. -*/ -/** - * XML_SCHEMAS_QUALIF_ELEM: - * - * Reflects elementFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 -/** - * XML_SCHEMAS_QUALIF_ATTR: - * - * Reflects attributeFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 -/** - * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 -/** - * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 -/** - * XML_SCHEMAS_FINAL_DEFAULT_LIST: - * - * the cshema has "list" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 -/** - * XML_SCHEMAS_FINAL_DEFAULT_UNION: - * - * the schema has "union" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: - * - * the schema has "substitution" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 -/** - * XML_SCHEMAS_INCLUDING_CONVERT_NS: - * - * the schema is currently including an other schema with - * no target namespace. - */ -#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 -/** - * _xmlSchema: - * - * A Schemas definition - */ -struct _xmlSchema { - const xmlChar *name; /* schema name */ - const xmlChar *targetNamespace; /* the target namespace */ - const xmlChar *version; - const xmlChar *id; /* Obsolete */ - xmlDocPtr doc; - xmlSchemaAnnotPtr annot; - int flags; - - xmlHashTablePtr typeDecl; - xmlHashTablePtr attrDecl; - xmlHashTablePtr attrgrpDecl; - xmlHashTablePtr elemDecl; - xmlHashTablePtr notaDecl; - - xmlHashTablePtr schemasImports; - - void *_private; /* unused by the library for users or bindings */ - xmlHashTablePtr groupDecl; - xmlDictPtr dict; - void *includes; /* the includes, this is opaque for now */ - int preserve; /* whether to free the document */ - int counter; /* used to give ononymous components unique names */ - xmlHashTablePtr idcDef; /* All identity-constraint defs. */ - void *volatiles; /* Obsolete */ -}; - -XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); -XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_INTERNALS_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/schematron.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/schematron.h deleted file mode 100644 index f442826ccd..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/schematron.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Summary: XML Schemastron implementation - * Description: interface to the XML Schematron validity checking. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMATRON_H__ -#define __XML_SCHEMATRON_H__ - -#include - -#ifdef LIBXML_SCHEMATRON_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ - XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ - XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ - XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ - XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ - XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ - XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ -} xmlSchematronValidOptions; - -/** - * The schemas related types are kept internal - */ -typedef struct _xmlSchematron xmlSchematron; -typedef xmlSchematron *xmlSchematronPtr; - -/** - * xmlSchematronValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from a Schematron validation - */ -typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); - -/** - * xmlSchematronValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from a Schematron validation - */ -typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); - -/** - * A schemas validation context - */ -typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; -typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; - -typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; -typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewMemParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewDocParserCtxt(xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); -/***** -XMLPUBFUN void XMLCALL - xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc * err, - xmlSchematronValidityWarningFunc * warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); - *****/ -XMLPUBFUN xmlSchematronPtr XMLCALL - xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchematronFree (xmlSchematronPtr schema); -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlSchematronSetValidStructuredErrors( - xmlSchematronValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -/****** -XMLPUBFUN void XMLCALL - xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc *err, - xmlSchematronValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, - int options); -XMLPUBFUN int XMLCALL - xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, - xmlNodePtr elem); - *******/ - -XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL - xmlSchematronNewValidCtxt (xmlSchematronPtr schema, - int options); -XMLPUBFUN void XMLCALL - xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, - xmlDocPtr instance); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMATRON_ENABLED */ -#endif /* __XML_SCHEMATRON_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/threads.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/threads.h deleted file mode 100644 index d31f16acbd..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/threads.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Summary: interfaces for thread handling - * Description: set of generic threading related routines - * should work with pthreads, Windows native or TLS threads - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_THREADS_H__ -#define __XML_THREADS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlMutex are a simple mutual exception locks. - */ -typedef struct _xmlMutex xmlMutex; -typedef xmlMutex *xmlMutexPtr; - -/* - * xmlRMutex are reentrant mutual exception locks. - */ -typedef struct _xmlRMutex xmlRMutex; -typedef xmlRMutex *xmlRMutexPtr; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN xmlMutexPtr XMLCALL - xmlNewMutex (void); -XMLPUBFUN void XMLCALL - xmlMutexLock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlMutexUnlock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlFreeMutex (xmlMutexPtr tok); - -XMLPUBFUN xmlRMutexPtr XMLCALL - xmlNewRMutex (void); -XMLPUBFUN void XMLCALL - xmlRMutexLock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlRMutexUnlock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlFreeRMutex (xmlRMutexPtr tok); - -/* - * Library wide APIs. - */ -XMLPUBFUN void XMLCALL - xmlInitThreads (void); -XMLPUBFUN void XMLCALL - xmlLockLibrary (void); -XMLPUBFUN void XMLCALL - xmlUnlockLibrary(void); -XMLPUBFUN int XMLCALL - xmlGetThreadId (void); -XMLPUBFUN int XMLCALL - xmlIsMainThread (void); -XMLPUBFUN void XMLCALL - xmlCleanupThreads(void); -XMLPUBFUN xmlGlobalStatePtr XMLCALL - xmlGetGlobalState(void); - -#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) -int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif /* __XML_THREADS_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/uri.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/uri.h deleted file mode 100644 index db48262b13..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/uri.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_URI_H__ -#define __XML_URI_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlURI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - * - * Note: query is a deprecated field which is incorrectly unescaped. - * query_raw takes precedence over query if the former is set. - * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 - */ -typedef struct _xmlURI xmlURI; -typedef xmlURI *xmlURIPtr; -struct _xmlURI { - char *scheme; /* the URI scheme */ - char *opaque; /* opaque part */ - char *authority; /* the authority part */ - char *server; /* the server part */ - char *user; /* the user part */ - int port; /* the port number */ - char *path; /* the path string */ - char *query; /* the query string (deprecated - use with caution) */ - char *fragment; /* the fragment identifier */ - int cleanup; /* parsing potentially unclean URI */ - char *query_raw; /* the query string (as it appears in the URI) */ -}; - -/* - * This function is in tree.h: - * xmlChar * xmlNodeGetBase (xmlDocPtr doc, - * xmlNodePtr cur); - */ -XMLPUBFUN xmlURIPtr XMLCALL - xmlCreateURI (void); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildRelativeURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURI (const char *str); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURIRaw (const char *str, - int raw); -XMLPUBFUN int XMLCALL - xmlParseURIReference (xmlURIPtr uri, - const char *str); -XMLPUBFUN xmlChar * XMLCALL - xmlSaveUri (xmlURIPtr uri); -XMLPUBFUN void XMLCALL - xmlPrintURI (FILE *stream, - xmlURIPtr uri); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -XMLPUBFUN char * XMLCALL - xmlURIUnescapeString (const char *str, - int len, - char *target); -XMLPUBFUN int XMLCALL - xmlNormalizeURIPath (char *path); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscape (const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlFreeURI (xmlURIPtr uri); -XMLPUBFUN xmlChar* XMLCALL - xmlCanonicPath (const xmlChar *path); -XMLPUBFUN xmlChar* XMLCALL - xmlPathToURI (const xmlChar *path); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_URI_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/valid.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/valid.h deleted file mode 100644 index a2307f1212..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/valid.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Summary: The DTD validation - * Description: API for the DTD handling and the validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_VALID_H__ -#define __XML_VALID_H__ - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Validation state added for non-determinist content model. - */ -typedef struct _xmlValidState xmlValidState; -typedef xmlValidState *xmlValidStatePtr; - -/** - * xmlValidityErrorFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity error is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * xmlValidityWarningFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity warning is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -#ifdef IN_LIBXML -/** - * XML_CTXT_FINISH_DTD_0: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_0 0xabcd1234 -/** - * XML_CTXT_FINISH_DTD_1: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_1 0xabcd1235 -#endif - -/* - * xmlValidCtxt: - * An xmlValidCtxt is used for error reporting when validating. - */ -typedef struct _xmlValidCtxt xmlValidCtxt; -typedef xmlValidCtxt *xmlValidCtxtPtr; -struct _xmlValidCtxt { - void *userData; /* user specific data block */ - xmlValidityErrorFunc error; /* the callback in case of errors */ - xmlValidityWarningFunc warning; /* the callback in case of warning */ - - /* Node analysis stack used when validating within entities */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - unsigned int finishDtd; /* finished validating the Dtd ? */ - xmlDocPtr doc; /* the document */ - int valid; /* temporary validity check result */ - - /* state state used for non-determinist content validation */ - xmlValidState *vstate; /* current state */ - int vstateNr; /* Depth of the validation stack */ - int vstateMax; /* Max depth of the validation stack */ - xmlValidState *vstateTab; /* array of validation states */ - -#ifdef LIBXML_REGEXP_ENABLED - xmlAutomataPtr am; /* the automata */ - xmlAutomataStatePtr state; /* used to build the automata */ -#else - void *am; - void *state; -#endif -}; - -/* - * ALL notation declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlNotationTable; -typedef xmlNotationTable *xmlNotationTablePtr; - -/* - * ALL element declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlElementTable; -typedef xmlElementTable *xmlElementTablePtr; - -/* - * ALL attribute declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlAttributeTable; -typedef xmlAttributeTable *xmlAttributeTablePtr; - -/* - * ALL IDs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlIDTable; -typedef xmlIDTable *xmlIDTablePtr; - -/* - * ALL Refs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlRefTable; -typedef xmlRefTable *xmlRefTablePtr; - -/* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL - xmlAddNotationDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *PublicID, - const xmlChar *SystemID); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL - xmlCopyNotationTable (xmlNotationTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeNotationTable (xmlNotationTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpNotationDecl (xmlBufferPtr buf, - xmlNotationPtr nota); -XMLPUBFUN void XMLCALL - xmlDumpNotationTable (xmlBufferPtr buf, - xmlNotationTablePtr table); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Element Content */ -/* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewElementContent (const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeElementContent (xmlElementContentPtr cur); -/* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewDocElementContent (xmlDocPtr doc, - const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyDocElementContent(xmlDocPtr doc, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeDocElementContent(xmlDocPtr doc, - xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL - xmlSnprintfElementContent(char *buf, - int size, - xmlElementContentPtr content, - int englob); -#ifdef LIBXML_OUTPUT_ENABLED -/* DEPRECATED */ -XMLPUBFUN void XMLCALL - xmlSprintfElementContent(char *buf, - xmlElementContentPtr content, - int englob); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* DEPRECATED */ - -/* Element */ -XMLPUBFUN xmlElementPtr XMLCALL - xmlAddElementDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - xmlElementTypeVal type, - xmlElementContentPtr content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL - xmlCopyElementTable (xmlElementTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeElementTable (xmlElementTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpElementTable (xmlBufferPtr buf, - xmlElementTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpElementDecl (xmlBufferPtr buf, - xmlElementPtr elem); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlFreeEnumeration (xmlEnumerationPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCopyEnumeration (xmlEnumerationPtr cur); -#endif /* LIBXML_TREE_ENABLED */ - -/* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL - xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *ns, - xmlAttributeType type, - xmlAttributeDefault def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL - xmlCopyAttributeTable (xmlAttributeTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeAttributeTable (xmlAttributeTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpAttributeTable (xmlBufferPtr buf, - xmlAttributeTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpAttributeDecl (xmlBufferPtr buf, - xmlAttributePtr attr); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL - xmlAddID (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlGetID (xmlDocPtr doc, - const xmlChar *ID); -XMLPUBFUN int XMLCALL - xmlIsID (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, - xmlAttrPtr attr); - -/* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL - xmlAddRef (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL - xmlIsRef (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, - xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL - xmlGetRefs (xmlDocPtr doc, - const xmlChar *ID); - -/** - * The public function calls related to validity checking. - */ -#ifdef LIBXML_VALID_ENABLED -/* Allocate/Release Validation Contexts */ -XMLPUBFUN xmlValidCtxtPtr XMLCALL - xmlNewValidCtxt(void); -XMLPUBFUN void XMLCALL - xmlFreeValidCtxt(xmlValidCtxtPtr); - -XMLPUBFUN int XMLCALL - xmlValidateRoot (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElementDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlElementPtr elem); -XMLPUBFUN xmlChar * XMLCALL - xmlValidNormalizeAttributeValue(xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlAttributePtr attr); -XMLPUBFUN int XMLCALL - xmlValidateAttributeValue(xmlAttributeType type, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNotationPtr nota); -XMLPUBFUN int XMLCALL - xmlValidateDtd (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlDtdPtr dtd); -XMLPUBFUN int XMLCALL - xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateDocument (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *prefix, - xmlNsPtr ns, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -#endif /* LIBXML_VALID_ENABLED */ - -#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNotationUse (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *notationName); -#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlIsMixedElement (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdQAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL - xmlGetDtdNotationDesc (xmlDtdPtr dtd, - const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdQElementDesc (xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdElementDesc (xmlDtdPtr dtd, - const xmlChar *name); - -#ifdef LIBXML_VALID_ENABLED - -XMLPUBFUN int XMLCALL - xmlValidGetPotentialChildren(xmlElementContent *ctree, - const xmlChar **names, - int *len, - int max); - -XMLPUBFUN int XMLCALL - xmlValidGetValidElements(xmlNode *prev, - xmlNode *next, - const xmlChar **names, - int max); -XMLPUBFUN int XMLCALL - xmlValidateNameValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNamesValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokenValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokensValue(const xmlChar *value); - -#ifdef LIBXML_REGEXP_ENABLED -/* - * Validation based on the regexp support - */ -XMLPUBFUN int XMLCALL - xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, - xmlElementPtr elem); - -XMLPUBFUN int XMLCALL - xmlValidatePushElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -XMLPUBFUN int XMLCALL - xmlValidatePushCData (xmlValidCtxtPtr ctxt, - const xmlChar *data, - int len); -XMLPUBFUN int XMLCALL - xmlValidatePopElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -#endif /* LIBXML_REGEXP_ENABLED */ -#endif /* LIBXML_VALID_ENABLED */ -#ifdef __cplusplus -} -#endif -#endif /* __XML_VALID_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xlink.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xlink.h deleted file mode 100644 index 083c7eda40..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xlink.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Summary: unfinished XLink detection module - * Description: unfinished XLink detection module - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XLINK_H__ -#define __XML_XLINK_H__ - -#include -#include - -#ifdef LIBXML_XPTR_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Various defines for the various Link properties. - * - * NOTE: the link detection layer will try to resolve QName expansion - * of namespaces. If "foo" is the prefix for "http://foo.com/" - * then the link detection layer will expand role="foo:myrole" - * to "http://foo.com/:myrole". - * NOTE: the link detection layer will expand URI-Refences found on - * href attributes by using the base mechanism if found. - */ -typedef xmlChar *xlinkHRef; -typedef xmlChar *xlinkRole; -typedef xmlChar *xlinkTitle; - -typedef enum { - XLINK_TYPE_NONE = 0, - XLINK_TYPE_SIMPLE, - XLINK_TYPE_EXTENDED, - XLINK_TYPE_EXTENDED_SET -} xlinkType; - -typedef enum { - XLINK_SHOW_NONE = 0, - XLINK_SHOW_NEW, - XLINK_SHOW_EMBED, - XLINK_SHOW_REPLACE -} xlinkShow; - -typedef enum { - XLINK_ACTUATE_NONE = 0, - XLINK_ACTUATE_AUTO, - XLINK_ACTUATE_ONREQUEST -} xlinkActuate; - -/** - * xlinkNodeDetectFunc: - * @ctx: user data pointer - * @node: the node to check - * - * This is the prototype for the link detection routine. - * It calls the default link detection callbacks upon link detection. - */ -typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); - -/* - * The link detection module interact with the upper layers using - * a set of callback registered at parsing time. - */ - -/** - * xlinkSimpleLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @href: the target of the link - * @role: the role string - * @title: the link title - * - * This is the prototype for a simple link detection callback. - */ -typedef void -(*xlinkSimpleLinkFunk) (void *ctx, - xmlNodePtr node, - const xlinkHRef href, - const xlinkRole role, - const xlinkTitle title); - -/** - * xlinkExtendedLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbArcs: the number of arcs detected on the link - * @from: pointer to the array of source roles found on the arcs - * @to: pointer to the array of target roles found on the arcs - * @show: array of values for the show attributes found on the arcs - * @actuate: array of values for the actuate attributes found on the arcs - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link detection callback. - */ -typedef void -(*xlinkExtendedLinkFunk)(void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbArcs, - const xlinkRole *from, - const xlinkRole *to, - xlinkShow *show, - xlinkActuate *actuate, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * xlinkExtendedLinkSetFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link set detection callback. - */ -typedef void -(*xlinkExtendedLinkSetFunk) (void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * This is the structure containing a set of Links detection callbacks. - * - * There is no default xlink callbacks, if one want to get link - * recognition activated, those call backs must be provided before parsing. - */ -typedef struct _xlinkHandler xlinkHandler; -typedef xlinkHandler *xlinkHandlerPtr; -struct _xlinkHandler { - xlinkSimpleLinkFunk simple; - xlinkExtendedLinkFunk extended; - xlinkExtendedLinkSetFunk set; -}; - -/* - * The default detection routine, can be overridden, they call the default - * detection callbacks. - */ - -XMLPUBFUN xlinkNodeDetectFunc XMLCALL - xlinkGetDefaultDetect (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultDetect (xlinkNodeDetectFunc func); - -/* - * Routines to set/get the default handlers. - */ -XMLPUBFUN xlinkHandlerPtr XMLCALL - xlinkGetDefaultHandler (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultHandler (xlinkHandlerPtr handler); - -/* - * Link detection module itself. - */ -XMLPUBFUN xlinkType XMLCALL - xlinkIsLink (xmlDocPtr doc, - xmlNodePtr node); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ - -#endif /* __XML_XLINK_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlIO.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlIO.h deleted file mode 100644 index eea9ed6c03..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlIO.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Summary: interface for the I/O interfaces used by the parser - * Description: interface for the I/O interfaces used by the parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_IO_H__ -#define __XML_IO_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Those are the functions and datatypes for the parser input - * I/O structures. - */ - -/** - * xmlInputMatchCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to detect if the current handler - * can provide input fonctionnalities for this resource. - * - * Returns 1 if yes and 0 if another Input module should be used - */ -typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); -/** - * xmlInputOpenCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to open the resource - * - * Returns an Input context or NULL in case or error - */ -typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); -/** - * xmlInputReadCallback: - * @context: an Input context - * @buffer: the buffer to store data read - * @len: the length of the buffer in bytes - * - * Callback used in the I/O Input API to read the resource - * - * Returns the number of bytes read or -1 in case of error - */ -typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); -/** - * xmlInputCloseCallback: - * @context: an Input context - * - * Callback used in the I/O Input API to close the resource - * - * Returns 0 or -1 in case of error - */ -typedef int (XMLCALL *xmlInputCloseCallback) (void * context); - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Those are the functions and datatypes for the library output - * I/O structures. - */ - -/** - * xmlOutputMatchCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Output API to detect if the current handler - * can provide output fonctionnalities for this resource. - * - * Returns 1 if yes and 0 if another Output module should be used - */ -typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename); -/** - * xmlOutputOpenCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Output API to open the resource - * - * Returns an Output context or NULL in case or error - */ -typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename); -/** - * xmlOutputWriteCallback: - * @context: an Output context - * @buffer: the buffer of data to write - * @len: the length of the buffer in bytes - * - * Callback used in the I/O Output API to write to the resource - * - * Returns the number of bytes written or -1 in case of error - */ -typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer, - int len); -/** - * xmlOutputCloseCallback: - * @context: an Output context - * - * Callback used in the I/O Output API to close the resource - * - * Returns 0 or -1 in case of error - */ -typedef int (XMLCALL *xmlOutputCloseCallback) (void * context); -#endif /* LIBXML_OUTPUT_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -struct _xmlParserInputBuffer { - void* context; - xmlInputReadCallback readcallback; - xmlInputCloseCallback closecallback; - - xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ - xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */ - int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ - int error; - unsigned long rawconsumed;/* amount consumed from raw */ -}; - - -#ifdef LIBXML_OUTPUT_ENABLED -struct _xmlOutputBuffer { - void* context; - xmlOutputWriteCallback writecallback; - xmlOutputCloseCallback closecallback; - - xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ - xmlBufferPtr conv; /* if encoder != NULL buffer for output */ - int written; /* total number of byte written */ - int error; -}; -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* - * Interfaces for input - */ -XMLPUBFUN void XMLCALL - xmlCleanupInputCallbacks (void); - -XMLPUBFUN int XMLCALL - xmlPopInputCallbacks (void); - -XMLPUBFUN void XMLCALL - xmlRegisterDefaultInputCallbacks (void); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlAllocParserInputBuffer (xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFilename (const char *URI, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFile (FILE *file, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFd (int fd, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateMem (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateStatic (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlParserInputBufferRead (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferGrow (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferPush (xmlParserInputBufferPtr in, - int len, - const char *buf); -XMLPUBFUN void XMLCALL - xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); -XMLPUBFUN char * XMLCALL - xmlParserGetDirectory (const char *filename); - -XMLPUBFUN int XMLCALL - xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, - xmlInputOpenCallback openFunc, - xmlInputReadCallback readFunc, - xmlInputCloseCallback closeFunc); - -xmlParserInputBufferPtr - __xmlParserInputBufferCreateFilename(const char *URI, - xmlCharEncoding enc); - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Interfaces for output - */ -XMLPUBFUN void XMLCALL - xmlCleanupOutputCallbacks (void); -XMLPUBFUN void XMLCALL - xmlRegisterDefaultOutputCallbacks(void); -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFilename (const char *URI, - xmlCharEncodingHandlerPtr encoder, - int compression); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFile (FILE *file, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFd (int fd, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, - xmlOutputCloseCallback ioclose, - void *ioctx, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN int XMLCALL - xmlOutputBufferWrite (xmlOutputBufferPtr out, - int len, - const char *buf); -XMLPUBFUN int XMLCALL - xmlOutputBufferWriteString (xmlOutputBufferPtr out, - const char *str); -XMLPUBFUN int XMLCALL - xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, - const xmlChar *str, - xmlCharEncodingOutputFunc escaping); - -XMLPUBFUN int XMLCALL - xmlOutputBufferFlush (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL - xmlOutputBufferClose (xmlOutputBufferPtr out); - -XMLPUBFUN int XMLCALL - xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, - xmlOutputOpenCallback openFunc, - xmlOutputWriteCallback writeFunc, - xmlOutputCloseCallback closeFunc); - -xmlOutputBufferPtr - __xmlOutputBufferCreateFilename(const char *URI, - xmlCharEncodingHandlerPtr encoder, - int compression); - -#ifdef LIBXML_HTTP_ENABLED -/* This function only exists if HTTP support built into the library */ -XMLPUBFUN void XMLCALL - xmlRegisterHTTPPostCallbacks (void ); -#endif /* LIBXML_HTTP_ENABLED */ - -#endif /* LIBXML_OUTPUT_ENABLED */ - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr ret); - -/* - * A predefined entity loader disabling network accesses - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNoNetExternalEntityLoader (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * xmlNormalizeWindowsPath is obsolete, don't use it. - * Check xmlCanonicPath in uri.h for a better alternative. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlNormalizeWindowsPath (const xmlChar *path); - -XMLPUBFUN int XMLCALL - xmlCheckFilename (const char *path); -/** - * Default 'file://' protocol callbacks - */ -XMLPUBFUN int XMLCALL - xmlFileMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlFileOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlFileRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlFileClose (void * context); - -/** - * Default 'http://' protocol callbacks - */ -#ifdef LIBXML_HTTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOHTTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpen (const char *filename); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpenW (const char * post_uri, - int compression ); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - xmlIOHTTPRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlIOHTTPClose (void * context); -#endif /* LIBXML_HTTP_ENABLED */ - -/** - * Default 'ftp://' protocol callbacks - */ -#ifdef LIBXML_FTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOFTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOFTPOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlIOFTPRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlIOFTPClose (void * context); -#endif /* LIBXML_FTP_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_IO_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlautomata.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlautomata.h deleted file mode 100644 index f98b55e2b8..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlautomata.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Summary: API to build regexp automata - * Description: the API to build regexp automata - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_AUTOMATA_H__ -#define __XML_AUTOMATA_H__ - -#include -#include - -#ifdef LIBXML_REGEXP_ENABLED -#ifdef LIBXML_AUTOMATA_ENABLED -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlAutomataPtr: - * - * A libxml automata description, It can be compiled into a regexp - */ -typedef struct _xmlAutomata xmlAutomata; -typedef xmlAutomata *xmlAutomataPtr; - -/** - * xmlAutomataStatePtr: - * - * A state int the automata description, - */ -typedef struct _xmlAutomataState xmlAutomataState; -typedef xmlAutomataState *xmlAutomataStatePtr; - -/* - * Building API - */ -XMLPUBFUN xmlAutomataPtr XMLCALL - xmlNewAutomata (void); -XMLPUBFUN void XMLCALL - xmlFreeAutomata (xmlAutomataPtr am); - -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataGetInitState (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL - xmlAutomataSetFinalState (xmlAutomataPtr am, - xmlAutomataStatePtr state); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewState (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewTransition (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewTransition2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewNegTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - void *data); - -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountTrans2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewAllTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int lax); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewEpsilon (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountedTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int counter); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCounterTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int counter); -XMLPUBFUN int XMLCALL - xmlAutomataNewCounter (xmlAutomataPtr am, - int min, - int max); - -XMLPUBFUN xmlRegexpPtr XMLCALL - xmlAutomataCompile (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL - xmlAutomataIsDeterminist (xmlAutomataPtr am); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_AUTOMATA_ENABLED */ -#endif /* LIBXML_REGEXP_ENABLED */ - -#endif /* __XML_AUTOMATA_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlexports.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlexports.h deleted file mode 100644 index 9c6790c80f..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlexports.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Summary: macros for marking symbols as exportable/importable. - * Description: macros for marking symbols as exportable/importable. - * - * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatovic - */ - -#ifndef __XML_EXPORTS_H__ -#define __XML_EXPORTS_H__ - -/** - * XMLPUBFUN, XMLPUBVAR, XMLCALL - * - * Macros which declare an exportable function, an exportable variable and - * the calling convention used for functions. - * - * Please use an extra block for every platform/compiler combination when - * modifying this, rather than overlong #ifdef lines. This helps - * readability as well as the fact that different compilers on the same - * platform might need different definitions. - */ - -/** - * XMLPUBFUN: - * - * Macros which declare an exportable function - */ -#define XMLPUBFUN -/** - * XMLPUBVAR: - * - * Macros which declare an exportable variable - */ -#define XMLPUBVAR extern -/** - * XMLCALL: - * - * Macros which declare the called convention for exported functions - */ -#define XMLCALL -/** - * XMLCDECL: - * - * Macro which declares the calling convention for exported functions that - * use '...'. - */ -#define XMLCDECL - -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #if defined(LIBXML_FASTCALL) - #define XMLCALL __fastcall - #else - #define XMLCALL __cdecl - #endif - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - /* - * if defined(IN_LIBXML) this raises problems on mingw with msys - * _imp__xmlFree listed as missing. Try to workaround the problem - * by also making that declaration when compiling client code. - */ - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform, GNU compiler */ -#if defined(_WIN32) && defined(__CYGWIN__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif - -/* Compatibility */ -#if !defined(LIBXML_DLL_IMPORT) -#define LIBXML_DLL_IMPORT XMLPUBVAR -#endif - -#endif /* __XML_EXPORTS_H__ */ - - diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlmodule.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlmodule.h deleted file mode 100644 index 8f4a56035b..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlmodule.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Summary: dynamic module loading - * Description: basic API for dynamic module loading, used by - * libexslt added in 2.6.17 - * - * Copy: See Copyright for the status of this software. - * - * Author: Joel W. Reed - */ - -#ifndef __XML_MODULE_H__ -#define __XML_MODULE_H__ - -#include - -#ifdef LIBXML_MODULES_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlModulePtr: - * - * A handle to a dynamically loaded module - */ -typedef struct _xmlModule xmlModule; -typedef xmlModule *xmlModulePtr; - -/** - * xmlModuleOption: - * - * enumeration of options that can be passed down to xmlModuleOpen() - */ -typedef enum { - XML_MODULE_LAZY = 1, /* lazy binding */ - XML_MODULE_LOCAL= 2 /* local binding */ -} xmlModuleOption; - -XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, - int options); - -XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, - const char* name, - void **result); - -XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); - -XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_MODULES_ENABLED */ - -#endif /*__XML_MODULE_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlregexp.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlregexp.h deleted file mode 100644 index 7009645a92..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlregexp.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Summary: regular expressions handling - * Description: basic API for libxml regular expressions handling used - * for XML Schemas and validation. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_REGEXP_H__ -#define __XML_REGEXP_H__ - -#include - -#ifdef LIBXML_REGEXP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlRegexpPtr: - * - * A libxml regular expression, they can actually be far more complex - * thank the POSIX regex expressions. - */ -typedef struct _xmlRegexp xmlRegexp; -typedef xmlRegexp *xmlRegexpPtr; - -/** - * xmlRegExecCtxtPtr: - * - * A libxml progressive regular expression evaluation context - */ -typedef struct _xmlRegExecCtxt xmlRegExecCtxt; -typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; - -#ifdef __cplusplus -} -#endif -#include -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The POSIX like API - */ -XMLPUBFUN xmlRegexpPtr XMLCALL - xmlRegexpCompile (const xmlChar *regexp); -XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL - xmlRegexpExec (xmlRegexpPtr comp, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlRegexpPrint (FILE *output, - xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL - xmlRegexpIsDeterminist(xmlRegexpPtr comp); - -/** - * xmlRegExecCallbacks: - * @exec: the regular expression context - * @token: the current token string - * @transdata: transition data - * @inputdata: input data - * - * Callback function when doing a transition in the automata - */ -typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, - const xmlChar *token, - void *transdata, - void *inputdata); - -/* - * The progressive API - */ -XMLPUBFUN xmlRegExecCtxtPtr XMLCALL - xmlRegNewExecCtxt (xmlRegexpPtr comp, - xmlRegExecCallbacks callback, - void *data); -XMLPUBFUN void XMLCALL - xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); -XMLPUBFUN int XMLCALL - xmlRegExecPushString(xmlRegExecCtxtPtr exec, - const xmlChar *value, - void *data); -XMLPUBFUN int XMLCALL - xmlRegExecPushString2(xmlRegExecCtxtPtr exec, - const xmlChar *value, - const xmlChar *value2, - void *data); - -XMLPUBFUN int XMLCALL - xmlRegExecNextValues(xmlRegExecCtxtPtr exec, - int *nbval, - int *nbneg, - xmlChar **values, - int *terminal); -XMLPUBFUN int XMLCALL - xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, - const xmlChar **string, - int *nbval, - int *nbneg, - xmlChar **values, - int *terminal); -#ifdef LIBXML_EXPR_ENABLED -/* - * Formal regular expression handling - * Its goal is to do some formal work on content models - */ - -/* expressions are used within a context */ -typedef struct _xmlExpCtxt xmlExpCtxt; -typedef xmlExpCtxt *xmlExpCtxtPtr; - -XMLPUBFUN void XMLCALL - xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); -XMLPUBFUN xmlExpCtxtPtr XMLCALL - xmlExpNewCtxt (int maxNodes, - xmlDictPtr dict); - -XMLPUBFUN int XMLCALL - xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); - -/* Expressions are trees but the tree is opaque */ -typedef struct _xmlExpNode xmlExpNode; -typedef xmlExpNode *xmlExpNodePtr; - -typedef enum { - XML_EXP_EMPTY = 0, - XML_EXP_FORBID = 1, - XML_EXP_ATOM = 2, - XML_EXP_SEQ = 3, - XML_EXP_OR = 4, - XML_EXP_COUNT = 5 -} xmlExpNodeType; - -/* - * 2 core expressions shared by all for the empty language set - * and for the set with just the empty token - */ -XMLPUBVAR xmlExpNodePtr forbiddenExp; -XMLPUBVAR xmlExpNodePtr emptyExp; - -/* - * Expressions are reference counted internally - */ -XMLPUBFUN void XMLCALL - xmlExpFree (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr); -XMLPUBFUN void XMLCALL - xmlExpRef (xmlExpNodePtr expr); - -/* - * constructors can be either manual or from a string - */ -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpParse (xmlExpCtxtPtr ctxt, - const char *expr); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewAtom (xmlExpCtxtPtr ctxt, - const xmlChar *name, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewOr (xmlExpCtxtPtr ctxt, - xmlExpNodePtr left, - xmlExpNodePtr right); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewSeq (xmlExpCtxtPtr ctxt, - xmlExpNodePtr left, - xmlExpNodePtr right); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewRange (xmlExpCtxtPtr ctxt, - xmlExpNodePtr subset, - int min, - int max); -/* - * The really interesting APIs - */ -XMLPUBFUN int XMLCALL - xmlExpIsNillable(xmlExpNodePtr expr); -XMLPUBFUN int XMLCALL - xmlExpMaxToken (xmlExpNodePtr expr); -XMLPUBFUN int XMLCALL - xmlExpGetLanguage(xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar**langList, - int len); -XMLPUBFUN int XMLCALL - xmlExpGetStart (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar**tokList, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpStringDerive(xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar *str, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpExpDerive (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - xmlExpNodePtr sub); -XMLPUBFUN int XMLCALL - xmlExpSubsume (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - xmlExpNodePtr sub); -XMLPUBFUN void XMLCALL - xmlExpDump (xmlBufferPtr buf, - xmlExpNodePtr expr); -#endif /* LIBXML_EXPR_ENABLED */ -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_REGEXP_ENABLED */ - -#endif /*__XML_REGEXP_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemastypes.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemastypes.h deleted file mode 100644 index 9a3a7a175e..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlschemastypes.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Summary: implementation of XML Schema Datatypes - * Description: module providing the XML Schema Datatypes implementation - * both definition and validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_TYPES_H__ -#define __XML_SCHEMA_TYPES_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMA_WHITESPACE_UNKNOWN = 0, - XML_SCHEMA_WHITESPACE_PRESERVE = 1, - XML_SCHEMA_WHITESPACE_REPLACE = 2, - XML_SCHEMA_WHITESPACE_COLLAPSE = 3 -} xmlSchemaWhitespaceValueType; - -XMLPUBFUN void XMLCALL - xmlSchemaInitTypes (void); -XMLPUBFUN void XMLCALL - xmlSchemaCleanupTypes (void); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetPredefinedType (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacet (xmlSchemaTypePtr base, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, - xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN void XMLCALL - xmlSchemaFreeValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaFacetPtr XMLCALL - xmlSchemaNewFacet (void); -XMLPUBFUN int XMLCALL - xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, - xmlSchemaTypePtr typeDecl, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValues (xmlSchemaValPtr x, - xmlSchemaValPtr y); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); -XMLPUBFUN int XMLCALL - xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, - const xmlChar *value, - unsigned long actualLen, - unsigned long *expectedLen); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInType (xmlSchemaValType type); -XMLPUBFUN int XMLCALL - xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, - int facetType); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaCollapseString (const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaWhiteSpaceReplace (const xmlChar *value); -XMLPUBFUN unsigned long XMLCALL - xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValue (xmlSchemaValPtr val, - const xmlChar **retValue); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, - const xmlChar **retValue, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValueAppend (xmlSchemaValPtr prev, - xmlSchemaValPtr cur); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaValueGetNext (xmlSchemaValPtr cur); -XMLPUBFUN const xmlChar * XMLCALL - xmlSchemaValueGetAsString (xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewStringValue (xmlSchemaValType type, - const xmlChar *value); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewNOTATIONValue (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewQNameValue (const xmlChar *namespaceName, - const xmlChar *localName); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, - xmlSchemaWhitespaceValueType xws, - xmlSchemaValPtr y, - xmlSchemaWhitespaceValueType yws); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaCopyValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValType XMLCALL - xmlSchemaGetValType (xmlSchemaValPtr val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlstring.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlstring.h deleted file mode 100644 index 0bc6888865..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlstring.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Summary: set of routines to process strings - * Description: type and interfaces needed for the internal string handling - * of the library, especially UTF8 processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_STRING_H__ -#define __XML_STRING_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlChar: - * - * This is a basic byte in an UTF-8 encoded string. - * It's unsigned allowing to pinpoint case where char * are assigned - * to xmlChar * (possibly making serialization back impossible). - */ -typedef unsigned char xmlChar; - -/** - * BAD_CAST: - * - * Macro to cast a string to an xmlChar * when one know its safe. - */ -#define BAD_CAST (xmlChar *) - -/* - * xmlChar handling - */ -XMLPUBFUN xmlChar * XMLCALL - xmlStrdup (const xmlChar *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrndup (const xmlChar *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrndup (const char *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrdup (const char *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrsub (const xmlChar *str, - int start, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrchr (const xmlChar *str, - xmlChar val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrstr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrcasestr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN int XMLCALL - xmlStrcmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrcasecmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncasecmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrEqual (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrQEqual (const xmlChar *pref, - const xmlChar *name, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlStrlen (const xmlChar *str); -XMLPUBFUN xmlChar * XMLCALL - xmlStrcat (xmlChar *cur, - const xmlChar *add); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncat (xmlChar *cur, - const xmlChar *add, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncatNew (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - ...); -XMLPUBFUN int XMLCALL - xmlStrVPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - va_list ap); - -XMLPUBFUN int XMLCALL - xmlGetUTF8Char (const unsigned char *utf, - int *len); -XMLPUBFUN int XMLCALL - xmlCheckUTF8 (const unsigned char *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Strsize (const xmlChar *utf, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strndup (const xmlChar *utf, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlUTF8Strpos (const xmlChar *utf, - int pos); -XMLPUBFUN int XMLCALL - xmlUTF8Strloc (const xmlChar *utf, - const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strsub (const xmlChar *utf, - int start, - int len); -XMLPUBFUN int XMLCALL - xmlUTF8Strlen (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Size (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Charcmp (const xmlChar *utf1, - const xmlChar *utf2); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_STRING_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlunicode.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlunicode.h deleted file mode 100644 index 01ac8b61f5..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlunicode.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Summary: Unicode character APIs - * Description: API for the Unicode character APIs - * - * This file is automatically generated from the - * UCS description files of the Unicode Character Database - * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html - * using the genUnicode.py Python script. - * - * Generation date: Mon Mar 27 11:09:52 2006 - * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt - * Author: Daniel Veillard - */ - -#ifndef __XML_UNICODE_H__ -#define __XML_UNICODE_H__ - -#include - -#ifdef LIBXML_UNICODE_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); -XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); -XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); -XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); -XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); -XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); -XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); -XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); - -XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); - -XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code); - -XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_UNICODE_ENABLED */ - -#endif /* __XML_UNICODE_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h.in b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h.in deleted file mode 100644 index 9585654161..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlversion.h.in +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_VERSION_H__ -#define __XML_VERSION_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * use those to be sure nothing nasty will happen if - * your library and includes mismatch - */ -#ifndef LIBXML2_COMPILING_MSCCDEF -XMLPUBFUN void XMLCALL xmlCheckVersion(int version); -#endif /* LIBXML2_COMPILING_MSCCDEF */ - -/** - * LIBXML_DOTTED_VERSION: - * - * the version string like "1.2.3" - */ -#define LIBXML_DOTTED_VERSION "@VERSION@" - -/** - * LIBXML_VERSION: - * - * the version number: 1.2.3 value is 10203 - */ -#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@ - -/** - * LIBXML_VERSION_STRING: - * - * the version number string, 1.2.3 value is "10203" - */ -#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@" - -/** - * LIBXML_VERSION_EXTRA: - * - * extra version information, used to show a CVS compilation - */ -#define LIBXML_VERSION_EXTRA "@LIBXML_VERSION_EXTRA@" - -/** - * LIBXML_TEST_VERSION: - * - * Macro to check that the libxml version in use is compatible with - * the version the software has been compiled against - */ -#define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@); - -#ifndef VMS -#if @WITH_TRIO@ -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO -#else -/** - * WITHOUT_TRIO: - * - * defined if the trio support should not be configured in - */ -#define WITHOUT_TRIO -#endif -#else /* VMS */ -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO 1 -#endif /* VMS */ - -/** - * LIBXML_THREAD_ENABLED: - * - * Whether the thread support is configured in - */ -#if @WITH_THREADS@ -#if defined(_REENTRANT) || defined(__MT__) || \ - (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) -#define LIBXML_THREAD_ENABLED -#endif -#endif - -/** - * LIBXML_TREE_ENABLED: - * - * Whether the DOM like tree manipulation API support is configured in - */ -#if @WITH_TREE@ -#define LIBXML_TREE_ENABLED -#endif - -/** - * LIBXML_OUTPUT_ENABLED: - * - * Whether the serialization/saving support is configured in - */ -#if @WITH_OUTPUT@ -#define LIBXML_OUTPUT_ENABLED -#endif - -/** - * LIBXML_PUSH_ENABLED: - * - * Whether the push parsing interfaces are configured in - */ -#if @WITH_PUSH@ -#define LIBXML_PUSH_ENABLED -#endif - -/** - * LIBXML_READER_ENABLED: - * - * Whether the xmlReader parsing interface is configured in - */ -#if @WITH_READER@ -#define LIBXML_READER_ENABLED -#endif - -/** - * LIBXML_PATTERN_ENABLED: - * - * Whether the xmlPattern node selection interface is configured in - */ -#if @WITH_PATTERN@ -#define LIBXML_PATTERN_ENABLED -#endif - -/** - * LIBXML_WRITER_ENABLED: - * - * Whether the xmlWriter saving interface is configured in - */ -#if @WITH_WRITER@ -#define LIBXML_WRITER_ENABLED -#endif - -/** - * LIBXML_SAX1_ENABLED: - * - * Whether the older SAX1 interface is configured in - */ -#if @WITH_SAX1@ -#define LIBXML_SAX1_ENABLED -#endif - -/** - * LIBXML_FTP_ENABLED: - * - * Whether the FTP support is configured in - */ -#if @WITH_FTP@ -#define LIBXML_FTP_ENABLED -#endif - -/** - * LIBXML_HTTP_ENABLED: - * - * Whether the HTTP support is configured in - */ -#if @WITH_HTTP@ -#define LIBXML_HTTP_ENABLED -#endif - -/** - * LIBXML_VALID_ENABLED: - * - * Whether the DTD validation support is configured in - */ -#if @WITH_VALID@ -#define LIBXML_VALID_ENABLED -#endif - -/** - * LIBXML_HTML_ENABLED: - * - * Whether the HTML support is configured in - */ -#if @WITH_HTML@ -#define LIBXML_HTML_ENABLED -#endif - -/** - * LIBXML_LEGACY_ENABLED: - * - * Whether the deprecated APIs are compiled in for compatibility - */ -#if @WITH_LEGACY@ -#define LIBXML_LEGACY_ENABLED -#endif - -/** - * LIBXML_C14N_ENABLED: - * - * Whether the Canonicalization support is configured in - */ -#if @WITH_C14N@ -#define LIBXML_C14N_ENABLED -#endif - -/** - * LIBXML_CATALOG_ENABLED: - * - * Whether the Catalog support is configured in - */ -#if @WITH_CATALOG@ -#define LIBXML_CATALOG_ENABLED -#endif - -/** - * LIBXML_DOCB_ENABLED: - * - * Whether the SGML Docbook support is configured in - */ -#if @WITH_DOCB@ -#define LIBXML_DOCB_ENABLED -#endif - -/** - * LIBXML_XPATH_ENABLED: - * - * Whether XPath is configured in - */ -#if @WITH_XPATH@ -#define LIBXML_XPATH_ENABLED -#endif - -/** - * LIBXML_XPTR_ENABLED: - * - * Whether XPointer is configured in - */ -#if @WITH_XPTR@ -#define LIBXML_XPTR_ENABLED -#endif - -/** - * LIBXML_XINCLUDE_ENABLED: - * - * Whether XInclude is configured in - */ -#if @WITH_XINCLUDE@ -#define LIBXML_XINCLUDE_ENABLED -#endif - -/** - * LIBXML_ICONV_ENABLED: - * - * Whether iconv support is available - */ -#if @WITH_ICONV@ -#define LIBXML_ICONV_ENABLED -#endif - -/** - * LIBXML_ICU_ENABLED: - * - * Whether icu support is available - */ -#if @WITH_ICU@ -#define LIBXML_ICU_ENABLED -#endif - -/** - * LIBXML_ISO8859X_ENABLED: - * - * Whether ISO-8859-* support is made available in case iconv is not - */ -#if @WITH_ISO8859X@ -#define LIBXML_ISO8859X_ENABLED -#endif - -/** - * LIBXML_DEBUG_ENABLED: - * - * Whether Debugging module is configured in - */ -#if @WITH_DEBUG@ -#define LIBXML_DEBUG_ENABLED -#endif - -/** - * DEBUG_MEMORY_LOCATION: - * - * Whether the memory debugging is configured in - */ -#if @WITH_MEM_DEBUG@ -#define DEBUG_MEMORY_LOCATION -#endif - -/** - * LIBXML_DEBUG_RUNTIME: - * - * Whether the runtime debugging is configured in - */ -#if @WITH_RUN_DEBUG@ -#define LIBXML_DEBUG_RUNTIME -#endif - -/** - * LIBXML_UNICODE_ENABLED: - * - * Whether the Unicode related interfaces are compiled in - */ -#if @WITH_REGEXPS@ -#define LIBXML_UNICODE_ENABLED -#endif - -/** - * LIBXML_REGEXP_ENABLED: - * - * Whether the regular expressions interfaces are compiled in - */ -#if @WITH_REGEXPS@ -#define LIBXML_REGEXP_ENABLED -#endif - -/** - * LIBXML_AUTOMATA_ENABLED: - * - * Whether the automata interfaces are compiled in - */ -#if @WITH_REGEXPS@ -#define LIBXML_AUTOMATA_ENABLED -#endif - -/** - * LIBXML_EXPR_ENABLED: - * - * Whether the formal expressions interfaces are compiled in - */ -#if @WITH_SCHEMAS@ -#define LIBXML_EXPR_ENABLED -#endif - -/** - * LIBXML_SCHEMAS_ENABLED: - * - * Whether the Schemas validation interfaces are compiled in - */ -#if @WITH_SCHEMAS@ -#define LIBXML_SCHEMAS_ENABLED -#endif - -/** - * LIBXML_SCHEMATRON_ENABLED: - * - * Whether the Schematron validation interfaces are compiled in - */ -#if @WITH_SCHEMATRON@ -#define LIBXML_SCHEMATRON_ENABLED -#endif - -/** - * LIBXML_MODULES_ENABLED: - * - * Whether the module interfaces are compiled in - */ -#if @WITH_MODULES@ -#define LIBXML_MODULES_ENABLED -/** - * LIBXML_MODULE_EXTENSION: - * - * the string suffix used by dynamic modules (usually shared libraries) - */ -#define LIBXML_MODULE_EXTENSION "@MODULE_EXTENSION@" -#endif - -/** - * LIBXML_ZLIB_ENABLED: - * - * Whether the Zlib support is compiled in - */ -#if @WITH_ZLIB@ -#define LIBXML_ZLIB_ENABLED -#endif - -#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include -#endif - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ - -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - -#ifndef LIBXML_ATTR_ALLOC_SIZE -# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) -# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) -# else -# define LIBXML_ATTR_ALLOC_SIZE(x) -# endif -#else -# define LIBXML_ATTR_ALLOC_SIZE(x) -#endif - -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - -#ifndef LIBXML_ATTR_FORMAT -# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) -# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) -# else -# define LIBXML_ATTR_FORMAT(fmt,args) -# endif -#else -# define LIBXML_ATTR_FORMAT(fmt,args) -#endif - -#else /* ! __GNUC__ */ -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ -#define ATTRIBUTE_UNUSED -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ -#define LIBXML_ATTR_ALLOC_SIZE(x) -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ -#define LIBXML_ATTR_FORMAT(fmt,args) -#endif /* __GNUC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif - - diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlwriter.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlwriter.h deleted file mode 100644 index 91e683c88c..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xmlwriter.h +++ /dev/null @@ -1,485 +0,0 @@ - -/* - * Summary: text writing API for XML - * Description: text writing API for XML - * - * Copy: See Copyright for the status of this software. - * - * Author: Alfred Mickautsch - */ - -#ifndef __XML_XMLWRITER_H__ -#define __XML_XMLWRITER_H__ - -#include - -#ifdef LIBXML_WRITER_ENABLED - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct _xmlTextWriter xmlTextWriter; - typedef xmlTextWriter *xmlTextWriterPtr; - -/* - * Constructors & Destructor - */ - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriter(xmlOutputBufferPtr out); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterFilename(const char *uri, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, - int compression); - XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); - -/* - * Functions - */ - - -/* - * Document - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDocument(xmlTextWriterPtr writer, - const char *version, - const char *encoding, - const char *standalone); - XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr - writer); - -/* - * Comments - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr - writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr - writer, - const xmlChar * - content); - -/* - * Elements - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr - writer); - -/* - * Elements conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * Text - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, - const xmlChar * content, int len); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRaw(xmlTextWriterPtr writer, - const xmlChar * content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr - writer, - const char - *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr - writer, - const char - *format, - va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, - const xmlChar * - content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, - const char *data, - int start, int len); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, - const char *data, - int start, int len); - -/* - * Attributes - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartAttribute(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr - writer); - -/* - * Attributes conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * PI's - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartPI(xmlTextWriterPtr writer, - const xmlChar * target); - XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); - -/* - * PI conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWritePI(xmlTextWriterPtr writer, - const xmlChar * target, - const xmlChar * content); - -/** - * xmlTextWriterWriteProcessingInstruction: - * - * This macro maps to xmlTextWriterWritePI - */ -#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI - -/* - * CDATA - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); - -/* - * CDATA conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, - const xmlChar * content); - -/* - * DTD - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); - -/* - * DTD conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * subset); - -/** - * xmlTextWriterWriteDocType: - * - * this macro maps to xmlTextWriterWriteDTD - */ -#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD - -/* - * DTD element definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr - writer); - -/* - * DTD element definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD attribute list definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr - writer); - -/* - * DTD attribute list definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD entity definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, - int pe, const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr - writer); - -/* - * DTD entity definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(4,5); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(4,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * ndataid); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr - writer, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * - ndataid); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr - writer, int pe, - const xmlChar * name, - const xmlChar * - pubid, - const xmlChar * - sysid, - const xmlChar * - ndataid, - const xmlChar * - content); - -/* - * DTD notation definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - -/* - * Indentation - */ - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndentString(xmlTextWriterPtr writer, - const xmlChar * str); - -/* - * misc - */ - XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_WRITER_ENABLED */ - -#endif /* __XML_XMLWRITER_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpath.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xpath.h deleted file mode 100644 index 1a9e30eba1..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpath.h +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Summary: XML Path Language implementation - * Description: API for the XML Path Language implementation - * - * XML Path Language implementation - * XPath is a language for addressing parts of an XML document, - * designed to be used by both XSLT and XPointer - * http://www.w3.org/TR/xpath - * - * Implements - * W3C Recommendation 16 November 1999 - * http://www.w3.org/TR/1999/REC-xpath-19991116 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPATH_H__ -#define __XML_XPATH_H__ - -#include - -#ifdef LIBXML_XPATH_ENABLED - -#include -#include -#include -#endif /* LIBXML_XPATH_ENABLED */ - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef __cplusplus -extern "C" { -#endif -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -#ifdef LIBXML_XPATH_ENABLED - -typedef struct _xmlXPathContext xmlXPathContext; -typedef xmlXPathContext *xmlXPathContextPtr; -typedef struct _xmlXPathParserContext xmlXPathParserContext; -typedef xmlXPathParserContext *xmlXPathParserContextPtr; - -/** - * The set of XPath error codes. - */ - -typedef enum { - XPATH_EXPRESSION_OK = 0, - XPATH_NUMBER_ERROR, - XPATH_UNFINISHED_LITERAL_ERROR, - XPATH_START_LITERAL_ERROR, - XPATH_VARIABLE_REF_ERROR, - XPATH_UNDEF_VARIABLE_ERROR, - XPATH_INVALID_PREDICATE_ERROR, - XPATH_EXPR_ERROR, - XPATH_UNCLOSED_ERROR, - XPATH_UNKNOWN_FUNC_ERROR, - XPATH_INVALID_OPERAND, - XPATH_INVALID_TYPE, - XPATH_INVALID_ARITY, - XPATH_INVALID_CTXT_SIZE, - XPATH_INVALID_CTXT_POSITION, - XPATH_MEMORY_ERROR, - XPTR_SYNTAX_ERROR, - XPTR_RESOURCE_ERROR, - XPTR_SUB_RESOURCE_ERROR, - XPATH_UNDEF_PREFIX_ERROR, - XPATH_ENCODING_ERROR, - XPATH_INVALID_CHAR_ERROR, - XPATH_INVALID_CTXT -} xmlXPathError; - -/* - * A node-set (an unordered collection of nodes without duplicates). - */ -typedef struct _xmlNodeSet xmlNodeSet; -typedef xmlNodeSet *xmlNodeSetPtr; -struct _xmlNodeSet { - int nodeNr; /* number of nodes in the set */ - int nodeMax; /* size of the array as allocated */ - xmlNodePtr *nodeTab; /* array of nodes in no particular order */ - /* @@ with_ns to check wether namespace nodes should be looked at @@ */ -}; - -/* - * An expression is evaluated to yield an object, which - * has one of the following four basic types: - * - node-set - * - boolean - * - number - * - string - * - * @@ XPointer will add more types ! - */ - -typedef enum { - XPATH_UNDEFINED = 0, - XPATH_NODESET = 1, - XPATH_BOOLEAN = 2, - XPATH_NUMBER = 3, - XPATH_STRING = 4, - XPATH_POINT = 5, - XPATH_RANGE = 6, - XPATH_LOCATIONSET = 7, - XPATH_USERS = 8, - XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ -} xmlXPathObjectType; - -typedef struct _xmlXPathObject xmlXPathObject; -typedef xmlXPathObject *xmlXPathObjectPtr; -struct _xmlXPathObject { - xmlXPathObjectType type; - xmlNodeSetPtr nodesetval; - int boolval; - double floatval; - xmlChar *stringval; - void *user; - int index; - void *user2; - int index2; -}; - -/** - * xmlXPathConvertFunc: - * @obj: an XPath object - * @type: the number of the target type - * - * A conversion function is associated to a type and used to cast - * the new type to primitive values. - * - * Returns -1 in case of error, 0 otherwise - */ -typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); - -/* - * Extra type: a name and a conversion function. - */ - -typedef struct _xmlXPathType xmlXPathType; -typedef xmlXPathType *xmlXPathTypePtr; -struct _xmlXPathType { - const xmlChar *name; /* the type name */ - xmlXPathConvertFunc func; /* the conversion function */ -}; - -/* - * Extra variable: a name and a value. - */ - -typedef struct _xmlXPathVariable xmlXPathVariable; -typedef xmlXPathVariable *xmlXPathVariablePtr; -struct _xmlXPathVariable { - const xmlChar *name; /* the variable name */ - xmlXPathObjectPtr value; /* the value */ -}; - -/** - * xmlXPathEvalFunc: - * @ctxt: an XPath parser context - * @nargs: the number of arguments passed to the function - * - * An XPath evaluation function, the parameters are on the XPath context stack. - */ - -typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, - int nargs); - -/* - * Extra function: a name and a evaluation function. - */ - -typedef struct _xmlXPathFunct xmlXPathFunct; -typedef xmlXPathFunct *xmlXPathFuncPtr; -struct _xmlXPathFunct { - const xmlChar *name; /* the function name */ - xmlXPathEvalFunc func; /* the evaluation function */ -}; - -/** - * xmlXPathAxisFunc: - * @ctxt: the XPath interpreter context - * @cur: the previous node being explored on that axis - * - * An axis traversal function. To traverse an axis, the engine calls - * the first time with cur == NULL and repeat until the function returns - * NULL indicating the end of the axis traversal. - * - * Returns the next node in that axis or NULL if at the end of the axis. - */ - -typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr cur); - -/* - * Extra axis: a name and an axis function. - */ - -typedef struct _xmlXPathAxis xmlXPathAxis; -typedef xmlXPathAxis *xmlXPathAxisPtr; -struct _xmlXPathAxis { - const xmlChar *name; /* the axis name */ - xmlXPathAxisFunc func; /* the search function */ -}; - -/** - * xmlXPathFunction: - * @ctxt: the XPath interprestation context - * @nargs: the number of arguments - * - * An XPath function. - * The arguments (if any) are popped out from the context stack - * and the result is pushed on the stack. - */ - -typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); - -/* - * Function and Variable Lookup. - */ - -/** - * xmlXPathVariableLookupFunc: - * @ctxt: an XPath context - * @name: name of the variable - * @ns_uri: the namespace name hosting this variable - * - * Prototype for callbacks used to plug variable lookup in the XPath - * engine. - * - * Returns the XPath object value or NULL if not found. - */ -typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFuncLookupFunc: - * @ctxt: an XPath context - * @name: name of the function - * @ns_uri: the namespace name hosting this function - * - * Prototype for callbacks used to plug function lookup in the XPath - * engine. - * - * Returns the XPath function or NULL if not found. - */ -typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFlags: - * Flags for XPath engine compilation and runtime - */ -/** - * XML_XPATH_CHECKNS: - * - * check namespaces at compilation - */ -#define XML_XPATH_CHECKNS (1<<0) -/** - * XML_XPATH_NOVAR: - * - * forbid variables in expression - */ -#define XML_XPATH_NOVAR (1<<1) - -/** - * xmlXPathContext: - * - * Expression evaluation occurs with respect to a context. - * he context consists of: - * - a node (the context node) - * - a node list (the context node list) - * - a set of variable bindings - * - a function library - * - the set of namespace declarations in scope for the expression - * Following the switch to hash tables, this need to be trimmed up at - * the next binary incompatible release. - * The node may be modified when the context is passed to libxml2 - * for an XPath evaluation so you may need to initialize it again - * before the next call. - */ - -struct _xmlXPathContext { - xmlDocPtr doc; /* The current document */ - xmlNodePtr node; /* The current node */ - - int nb_variables_unused; /* unused (hash table) */ - int max_variables_unused; /* unused (hash table) */ - xmlHashTablePtr varHash; /* Hash table of defined variables */ - - int nb_types; /* number of defined types */ - int max_types; /* max number of types */ - xmlXPathTypePtr types; /* Array of defined types */ - - int nb_funcs_unused; /* unused (hash table) */ - int max_funcs_unused; /* unused (hash table) */ - xmlHashTablePtr funcHash; /* Hash table of defined funcs */ - - int nb_axis; /* number of defined axis */ - int max_axis; /* max number of axis */ - xmlXPathAxisPtr axis; /* Array of defined axis */ - - /* the namespace nodes of the context node */ - xmlNsPtr *namespaces; /* Array of namespaces */ - int nsNr; /* number of namespace in scope */ - void *user; /* function to free */ - - /* extra variables */ - int contextSize; /* the context size */ - int proximityPosition; /* the proximity position */ - - /* extra stuff for XPointer */ - int xptr; /* is this an XPointer context? */ - xmlNodePtr here; /* for here() */ - xmlNodePtr origin; /* for origin() */ - - /* the set of namespace declarations in scope for the expression */ - xmlHashTablePtr nsHash; /* The namespaces hash table */ - xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ - void *varLookupData; /* variable lookup data */ - - /* Possibility to link in an extra item */ - void *extra; /* needed for XSLT */ - - /* The function name and URI when calling a function */ - const xmlChar *function; - const xmlChar *functionURI; - - /* function lookup function and data */ - xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ - void *funcLookupData; /* function lookup data */ - - /* temporary namespace lists kept for walking the namespace axis */ - xmlNsPtr *tmpNsList; /* Array of namespaces */ - int tmpNsNr; /* number of namespaces in scope */ - - /* error reporting mechanism */ - void *userData; /* user specific data block */ - xmlStructuredErrorFunc error; /* the callback in case of errors */ - xmlError lastError; /* the last error */ - xmlNodePtr debugNode; /* the source node XSLT */ - - /* dictionary */ - xmlDictPtr dict; /* dictionary if any */ - - int flags; /* flags to control compilation */ - - /* Cache for reusal of XPath objects */ - void *cache; -}; - -/* - * The structure of a compiled expression form is not public. - */ - -typedef struct _xmlXPathCompExpr xmlXPathCompExpr; -typedef xmlXPathCompExpr *xmlXPathCompExprPtr; - -/** - * xmlXPathParserContext: - * - * An XPath parser context. It contains pure parsing informations, - * an xmlXPathContext, and the stack of objects. - */ -struct _xmlXPathParserContext { - const xmlChar *cur; /* the current char being parsed */ - const xmlChar *base; /* the full expression */ - - int error; /* error code */ - - xmlXPathContextPtr context; /* the evaluation context */ - xmlXPathObjectPtr value; /* the current value */ - int valueNr; /* number of values stacked */ - int valueMax; /* max number of values stacked */ - xmlXPathObjectPtr *valueTab; /* stack of values */ - - xmlXPathCompExprPtr comp; /* the precompiled expression */ - int xptr; /* it this an XPointer expression */ - xmlNodePtr ancestor; /* used for walking preceding axis */ -}; - -/************************************************************************ - * * - * Public API * - * * - ************************************************************************/ - -/** - * Objects and Nodesets handling - */ - -XMLPUBVAR double xmlXPathNAN; -XMLPUBVAR double xmlXPathPINF; -XMLPUBVAR double xmlXPathNINF; - -/* These macros may later turn into functions */ -/** - * xmlXPathNodeSetGetLength: - * @ns: a node-set - * - * Implement a functionality similar to the DOM NodeList.length. - * - * Returns the number of nodes in the node-set. - */ -#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) -/** - * xmlXPathNodeSetItem: - * @ns: a node-set - * @index: index of a node in the set - * - * Implements a functionality similar to the DOM NodeList.item(). - * - * Returns the xmlNodePtr at the given @index in @ns or NULL if - * @index is out of range (0 to length-1) - */ -#define xmlXPathNodeSetItem(ns, index) \ - ((((ns) != NULL) && \ - ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ - (ns)->nodeTab[(index)] \ - : NULL) -/** - * xmlXPathNodeSetIsEmpty: - * @ns: a node-set - * - * Checks whether @ns is empty or not. - * - * Returns %TRUE if @ns is an empty node-set. - */ -#define xmlXPathNodeSetIsEmpty(ns) \ - (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) - - -XMLPUBFUN void XMLCALL - xmlXPathFreeObject (xmlXPathObjectPtr obj); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetCreate (xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSet (xmlNodeSetPtr obj); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathObjectCopy (xmlXPathObjectPtr val); -XMLPUBFUN int XMLCALL - xmlXPathCmpNodes (xmlNodePtr node1, - xmlNodePtr node2); -/** - * Conversion functions to basic types. - */ -XMLPUBFUN int XMLCALL - xmlXPathCastNumberToBoolean (double val); -XMLPUBFUN int XMLCALL - xmlXPathCastStringToBoolean (const xmlChar * val); -XMLPUBFUN int XMLCALL - xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); -XMLPUBFUN int XMLCALL - xmlXPathCastToBoolean (xmlXPathObjectPtr val); - -XMLPUBFUN double XMLCALL - xmlXPathCastBooleanToNumber (int val); -XMLPUBFUN double XMLCALL - xmlXPathCastStringToNumber (const xmlChar * val); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeToNumber (xmlNodePtr node); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); -XMLPUBFUN double XMLCALL - xmlXPathCastToNumber (xmlXPathObjectPtr val); - -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastBooleanToString (int val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNumberToString (double val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeToString (xmlNodePtr node); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastToString (xmlXPathObjectPtr val); - -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertBoolean (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertString (xmlXPathObjectPtr val); - -/** - * Context handling. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPathNewContext (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlXPathFreeContext (xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathContextSetCache(xmlXPathContextPtr ctxt, - int active, - int value, - int options); -/** - * Evaluation functions. - */ -XMLPUBFUN long XMLCALL - xmlXPathOrderDocElems (xmlDocPtr doc); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEvalExpression (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, - xmlXPathObjectPtr res); -/** - * Separate compilation/evaluation entry points. - */ -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCompile (const xmlChar *str); -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, - const xmlChar *str); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathCompiledEval (xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctx); -XMLPUBFUN int XMLCALL - xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); -#endif /* LIBXML_XPATH_ENABLED */ -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN void XMLCALL - xmlXPathInit (void); -XMLPUBFUN int XMLCALL - xmlXPathIsNaN (double val); -XMLPUBFUN int XMLCALL - xmlXPathIsInf (double val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ -#endif /* ! __XML_XPATH_H__ */ diff --git a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpointer.h b/cocos2dx/platform/third_party/linux/libxml2/libxml/xpointer.h deleted file mode 100644 index dde1dfb3d1..0000000000 --- a/cocos2dx/platform/third_party/linux/libxml2/libxml/xpointer.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Summary: API to handle XML Pointers - * Description: API to handle XML Pointers - * Base implementation was made accordingly to - * W3C Candidate Recommendation 7 June 2000 - * http://www.w3.org/TR/2000/CR-xptr-20000607 - * - * Added support for the element() scheme described in: - * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPTR_H__ -#define __XML_XPTR_H__ - -#include - -#ifdef LIBXML_XPTR_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * A Location Set - */ -typedef struct _xmlLocationSet xmlLocationSet; -typedef xmlLocationSet *xmlLocationSetPtr; -struct _xmlLocationSet { - int locNr; /* number of locations in the set */ - int locMax; /* size of the array as allocated */ - xmlXPathObjectPtr *locTab;/* array of locations */ -}; - -/* - * Handling of location sets. - */ - -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, - xmlLocationSetPtr val2); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRange (xmlNodePtr start, - int startindex, - xmlNodePtr end, - int endindex); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePoints (xmlXPathObjectPtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodePoint (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodeObject (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewCollapsedRange (xmlNodePtr start); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetDel (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, - int val); - -/* - * Functions. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPtrNewContext (xmlDocPtr doc, - xmlNodePtr here, - xmlNodePtr origin); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN void XMLCALL - xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -XMLPUBFUN xmlNodePtr XMLCALL - xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ -#endif /* __XML_XPTR_H__ */ diff --git a/cocos2dx/platform/third_party/marmalade/libxml2.mkf b/cocos2dx/platform/third_party/marmalade/libxml2.mkf deleted file mode 100644 index 635be61a40..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2.mkf +++ /dev/null @@ -1,175 +0,0 @@ -includepath header - -includepaths -{ - libxml2/include - libxml2/marmalade -} - -defines -{ - XMLCDECL=" " - XMLPUBFUN=" " - XMLPUBVAR="extern" - XMLCALL=" " - - "LIBXML_ATTR_ALLOC_SIZE(x)"=" " - "LIBXML_ATTR_FORMAT(fmt,args)"=" " - - TRIO_FPCLASSIFY_HACK - WITHOUT_TRIO - - LIBXML_WRITER_ENABLED - LIBXML_OUTPUT_ENABLED - - LIBXML_HTML_ENABLED - LIBXML_XPATH_ENABLED - LIBXML_XPTR_ENABLED - LIBXML_XINCLUDE_ENABLED - LIBXML_CATALOG_ENABLED - LIBXML_TREE_ENABLED - LIBXML_PUSH_ENABLED - LIBXML_SAX1_ENABLED - - LIBXML_DEBUG_ENABLED - # DEBUG_MEMORY_LOCATION - -} - -undefines -{ - LIBXML_SCHEMAS_ENABLED - LIBXML_REGEXP_ENABLED - LIBXML_THREAD_ENABLED - LIBXML_FTP_ENABLED - LIBXML_HTTP_ENABLED - LIBXML_DOCB_ENABLED - LIBXML_C14N_ENABLED - LIBXML_ICONV_ENABLED - LIBXML_MODULES_ENABLED - - WITH_TRIO -} - -files -{ - (libxml2/include/libxml) - ["common/libxml"] - c14n.h - catalog.h - chvalid.h - debugXML.h - dict.h - DOCBparser.h - encoding.h - entities.h - globals.h - hash.h - HTMLparser.h - HTMLtree.h - list.h - nanoftp.h - nanohttp.h - parser.h - parserInternals.h - pattern.h - # relaxng.h - SAX.h - SAX2.h - schemasInternals.h - schematron.h - threads.h - tree.h - uri.h - valid.h - xinclude.h - xlink.h - xmlautomata.h - xmlerror.h - xmlexports.h - xmlIO.h - xmlmemory.h - xmlmodule.h - xmlreader.h - xmlregexp.h - xmlsave.h - xmlschemas.h - xmlschemastypes.h - xmlstring.h - xmlunicode.h - xmlwriter.h - xpath.h - xpathInternals.h - xpointer.h - - (libxml2/marmalade) - ["marmalade"] - config.h - libxml2_public.defines.txt - - (libxml2/marmalade/libxml) - ["marmalade/libxml"] - xmlversion.h - - (libxml2/sources) - ["sources"] - elfgcchack.h - libxml.h - trio.h - triodef.h - trionan.h - triop.h - triostr.h - - c14n.c - catalog.c - chvalid.c - debugXML.c - dict.c - DOCBparser.c - encoding.c - entities.c - error.c - globals.c - hash.c - HTMLparser.c - HTMLtree.c - legacy.c - list.c - nanoftp.c - nanohttp.c - parser.c - parserInternals.c - pattern.c - # relaxng.c - # rngparser.c - # runsuite.c - # runtest.c - # runxmlconf.c - SAX.c - SAX2.c - schematron.c - threads.c - tree.c - # trio.c - # trionan.c - # triostr.c - uri.c - valid.c - xmlIO.c - xinclude.c - xlink.c - #xmlcatalog.c - xmlmemory.c - xmlmodule.c - xmlreader.c - xmlregexp.c - xmlsave.c - xmlschemas.c - xmlschemastypes.c - xmlstring.c - xmlunicode.c - xmlwriter.c - xpath.c - xpointer.c -} diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/AUTHORS b/cocos2dx/platform/third_party/marmalade/libxml2/AUTHORS deleted file mode 100644 index cf2e9a6fad..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Daniel Veillard -Bjorn Reese -William Brack -Igor Zlatkovic for the Windows port -Aleksey Sanin diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/ChangeLog.REMOVED.git-id b/cocos2dx/platform/third_party/marmalade/libxml2/ChangeLog.REMOVED.git-id deleted file mode 100644 index 8b191b68e6..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/ChangeLog.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -adad4a322eca07e7edcab00566f9dfe1207c7ad6 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/Copyright b/cocos2dx/platform/third_party/marmalade/libxml2/Copyright deleted file mode 100644 index 417e95531f..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/Copyright +++ /dev/null @@ -1,27 +0,0 @@ -Except where otherwise noted in the source code (e.g. the files hash.c, -list.c and the trio files, which are covered by a similar licence but -with different Copyright notices) all the files are: - - Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Daniel Veillard shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from him. - diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/HACKING b/cocos2dx/platform/third_party/marmalade/libxml2/HACKING deleted file mode 100644 index 5d2829479b..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/HACKING +++ /dev/null @@ -1,37 +0,0 @@ -NOTE: - - the head of this module is package libxml-2 . There is incompatibilities - with the old libxml-1 headers. I posted on gnome-hackers a recipe to - change your code to compile with both, check it out ! Also read - http://xmlsoft.org/upgrade.html - - in the meantime the old 1.x code has been tagged with LIB_XML_1_BRANCH - extract this version and drop me a mail if you want me to take care of - the update of your module to libxml-2 - - the 1.x branch has a separate commit policy, please check the HACKING - file for this branch - - Rules for commits on the gnome-xml module - ========================================= - - BEFORE READING FURTHER: DO NOT COMMIT DIRECTLY ! - - In the exceptional case where a serious breakage in this module -prevents other core projects from making progress, then feel free -to patch first and send mail afterward as long as the changes are limited. -Please keep in mind that a large part of my user base is on Windows, so -be careful with potential portability problems there. - -Otherwise, send me (veillard@redhat.com) a mail and if it's a bug -issue, register it at bugzilla.gnome.org (module libxml). I check both -my mail and the bug database on a regular basis. If you don't get an -answer within a week (which is highly unprobable) then commit your changes. -This simply mean that I'm on holliday or on the road. - - thanks in advance for following the rule, - -Daniel - -P.S.: Bjorn Reese, William Brack, Thomas Broyer, Igor Zlatkovic and - Aleksey Sanin get an exception for the send before commit rule - as well as John Fleck for the doc maintenance Send them mail if - I don't answer to request in a timely fashion - diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/MAINTAINERS b/cocos2dx/platform/third_party/marmalade/libxml2/MAINTAINERS deleted file mode 100644 index 0e6806ed07..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/MAINTAINERS +++ /dev/null @@ -1,9 +0,0 @@ -See first http://xmlsoft.org/bugs.html and use the list please. - -Daniel Veillard -E-mail: veillard@redhat.com -Userid: veillard - -Co-maintainer: William Brack -Windows port: Igor Zlatkovic - Rob Richards diff --git a/cocos2dx/platform/third_party/marmalade/libxml2/NEWS b/cocos2dx/platform/third_party/marmalade/libxml2/NEWS deleted file mode 100644 index cdfdda6f8d..0000000000 --- a/cocos2dx/platform/third_party/marmalade/libxml2/NEWS +++ /dev/null @@ -1,2006 +0,0 @@ - - NEWS file for libxml2 - - Note that this is automatically generated from the news webpage at: - http://xmlsoft.org/news.html - -Items not finished and worked on, get in touch with the list if you want -to help those - More testing on RelaxNG - - Finishing up XML - Schemas - -The change log at -ChangeLog.html - describes the recents commits -to the SVN at -http://svn.gnome.org/viewvc/libxml2/trunk/ - code base.Here is the list of public releases: -2.7.6: Oct 6 2009: - - Bug Fixes: - Restore thread support in default configuration (Andrew W. Nosenko), - URI with no path parsing problem (Daniel Veillard), - Minor patch for conditional defines in threads.c (Eric Zurcher) - - - -2.7.5: Sep 24 2009: - - Bug Fixes: - Restore behavior of --with-threads without argument (Andrew W. Nosenko), - Fix memory leak when doc is NULL (Rob Richards), - 595792 fixing a RelaxNG bug introduced in 2.7.4 (Daniel Veillard), - Fix a Relaxng bug raised by libvirt test suite (Daniel Veillard), - Fix a parsing problem with little data at startup (Daniel Veillard), - link python module with python library (Frederic Crozat), - 594874 Forgot an fclose in xmllint (Daniel Veillard) - - - Cleanup: - Adding symbols.xml to EXTRA_DIST (Daniel Veillard) - - - -2.7.4: Sep 10 2009: - - Improvements: - Switch to GIT (GNOME), - Add symbol versioning to libxml2 shared libs (Daniel Veillard) - - - Portability: - 593857 try to work around thread pbm MinGW 4.4 (Daniel Veillard), - 594250 rename ATTRIBUTE_ALLOC_SIZE to avoid clashes (Daniel Veillard), - Fix Windows build * relaxng.c: fix windows build (Rob Richards), - Fix the globals.h to use XMLPUBFUN (Paul Smith), - Problem with extern extern in header (Daniel Veillard), - Add -lnetwork for compiling on Haiku (Scott McCreary), - Runtest portability patch for Solaris (Tim Rice), - Small patch to accomodate the Haiku OS (Scott McCreary), - 584605 package VxWorks folder in the distribution (Daniel Veillard), - 574017 Realloc too expensive on most platform (Daniel Veillard), - Fix windows build (Rob Richards), - 545579 doesn't compile without schema support (Daniel Veillard), - xmllint use xmlGetNodePath when not compiled in (Daniel Veillard), - Try to avoid __imp__xmlFree link trouble on msys (Daniel Veillard), - Allow to select the threading system on Windows (LRN), - Fix Solaris binary links, cleanups (Daniel Veillard), - Bug 571059 – MSVC doesn't work with the bakefile (Intron), - fix ATTRIBUTE_PRINTF header clash (Belgabor and Mike Hommey), - fixes for Borland/CodeGear/Embarcadero compilers (Eric Zurcher) - - - Documentation: - 544910 typo: "renciliateNs" (Leonid Evdokimov), - Add VxWorks to list of OSes (Daniel Veillard), - Regenerate the documentation and update for git (Daniel Veillard), - 560524 ¿ xmlTextReaderLocalName description (Daniel Veillard), - Added sponsoring by AOE media for the server (Daniel Veillard), - updated URLs for GNOME (Vincent Lefevre), - more warnings about xmlCleanupThreads and xmlCleanupParser (Daniel Veillard) - - - Bug fixes: - 594514 memory leaks - duplicate initialization (MOD), - Wrong block opening in htmlNodeDumpOutputInternal (Daniel Veillard), - 492317 Fix Relax-NG validation problems (Daniel Veillard), - 558452 fight with reg test and error report (Daniel Veillard), - 558452 RNG compilation of optional multiple child (Daniel Veillard), - 579746 XSD validation not correct / nilable groups (Daniel Veillard), - 502960 provide namespace stack when parsing entity (Daniel Veillard), - 566012 part 2 fix regresion tests and push mode (Daniel Veillard), - 566012 autodetected encoding and encoding conflict (Daniel Veillard), - 584220 xpointer(/) and xinclude problems (Daniel Veillard), - 587663 Incorrect Attribute-Value Normalization (Daniel Veillard), - 444994 HTML chunked failure for attribute with <> (Daniel Veillard), - Fix end of buffer char being split in XML parser (Daniel Veillard), - Non ASCII character may be split at buffer end (Adiel Mittmann), - 440226 Add xmlXIncludeProcessTreeFlagsData API (Stefan Behnel), - 572129 speed up parsing of large HTML text nodes (Markus Kull), - Fix HTML parsing with 0 character in CDATA (Daniel Veillard), - Fix SetGenericErrorFunc and SetStructured clash (Wang Lam), - 566012 Incomplete EBCDIC parsing support (Martin Kogler), - 541335 HTML avoid creating 2 head or 2 body element (Daniel Veillard), - 541237 error correcting missing end tags in HTML (Daniel Veillard), - 583439 missing line numbers in push mode (Daniel Veillard), - 587867 xmllint --html --xmlout serializing as HTML (Daniel Veillard), - 559501 avoid select and use poll for nanohttp (Raphael Prevost), - 559410 - Regexp bug on (...)? constructs (Daniel Veillard), - Fix a small problem on previous HTML parser patch (Daniel Veillard), - 592430 - HTML parser runs into endless loop (Daniel Veillard), - 447899 potential double free in xmlFreeTextReader (Daniel Veillard), - 446613 small validation bug mixed content with NS (Daniel Veillard), - Fix the problem of revalidating a doc with RNG (Daniel Veillard), - Fix xmlKeepBlanksDefault to not break indent (Nick Wellnhofer), - 512131 refs from externalRef part need to be added (Daniel Veillard), - 512131 crash in xmlRelaxNGValidateFullElement (Daniel Veillard), - 588441 allow '.' in HTML Names even if invalid (Daniel Veillard), - 582913 Fix htmlSetMetaEncoding() to be nicer (Daniel Veillard), - 579317 Try to find the HTML encoding information (Daniel Veillard), - 575875 don't output charset=html (Daniel Veillard), - 571271 fix semantic of xsd:all with minOccurs=0 (Daniel Veillard), - 570702 fix a bug in regexp determinism checking (Daniel Veillard), - 567619 xmlValidateNotationUse missing param test (Daniel Veillard), - 574393 ¿ utf-8 filename magic for compressed files (Hans Breuer), - Fix a couple of problems in the parser (Daniel Veillard), - 585505 ¿ Document ids and refs populated by XSD (Wayne Jensen), - 582906 XSD validating multiple imports of the same schema (Jason Childs), - Bug 582887 ¿ problems validating complex schemas (Jason Childs), - Bug 579729 ¿ fix XSD schemas parsing crash (Miroslav Bajtos), - 576368 ¿ htmlChunkParser with special attributes (Jiri Netolicky), - Bug 565747 ¿ relax anyURI data character checking (Vincent Lefevre), - Preserve attributes of include start on tree copy (Petr Pajas), - Skip silently unrecognized XPointer schemes (Jakub Wilk), - Fix leak on SAX1, xmllint --sax1 option and debug (Daniel Veillard), - potential NULL dereference on non-glibc (Jim Meyering), - Fix an XSD validation crash (Daniel Veillard), - Fix a regression in streaming entities support (Daniel Veillard), - Fix a couple of ABI issues with C14N 1.1 (Aleksey Sanin), - Aleksey Sanin support for c14n 1.1 (Aleksey Sanin), - reader bug fix with entities (Daniel Veillard), - use options from current parser ctxt for external entities (Rob Richards), - 581612 use %s to printf strings (Christian Persch), - 584605 change the threading initialization sequence (Igor Novoseltsev), - 580705 keep line numbers in HTML parser (Aaron Patterson), - 581803 broken HTML table attributes init (Roland Steiner), - do not set error code in xmlNsWarn (Rob Richards), - 564217 fix structured error handling problems, - reuse options from current parser for entities (Rob Richards), - xmlXPathRegisterNs should not allow enpty prefixes (Daniel Veillard), - add a missing check in xmlAddSibling (Kris Breuker), - avoid leaks on errors (Jinmei Tatuya) - - - Cleanup: - Chasing dead assignments reported by clang-scan (Daniel Veillard), - A few more safety cleanup raised by scan (Daniel Veillard), - Fixing assorted potential problems raised by scan (Daniel Veillard), - Potential uninitialized arguments raised by scan (Daniel Veillard), - Fix a bunch of scan 'dead increments' and cleanup (Daniel Veillard), - Remove a pedantic warning (Daniel Veillard), - 555833 always use rm -f in uninstall-local (Daniel Veillard), - 542394 xmlRegisterOutputCallbacks MAX_INPUT_CALLBACK (Daniel Veillard), - Autoregenerate libxml2.syms automated checkings (Daniel Veillard), - Make xmlRecoverDoc const (Martin Trappel) (Daniel Veillard), - Both args of xmlStrcasestr are const (Daniel Veillard), - hide the nbParse* variables used for debugging (Mike Hommey), - 570806 changed include of config.h (William M. Brack), - cleanups and error reports when xmlTextWriterVSprintf fails (Jinmei Tatuya) - - - -2.7.3: Jan 18 2009: - - Build fix: fix build when HTML support is not included. - - Bug fixes: avoid memory overflow in gigantic text nodes, - indentation problem on the writed (Rob Richards), - xmlAddChildList pointer problem (Rob Richards and Kevin Milburn), - xmlAddChild problem with attribute (Rob Richards and Kris Breuker), - avoid a memory leak in an edge case (Daniel Zimmermann), - deallocate some pthread data (Alex Ott). - - Improvements: configure option to avoid rebuilding docs (Adrian Bunk), - limit text nodes to 10MB max by default, add element traversal - APIs, add a parser option to enable pre 2.7 SAX behavior (Rob Richards), - add gcc malloc checking (Marcus Meissner), add gcc printf like functions - parameters checking (Marcus Meissner). - - -2.7.2: Oct 3 2008: - - Portability fix: fix solaris compilation problem, fix compilation - if XPath is not configured in - - Bug fixes: nasty entity bug introduced in 2.7.0, restore old behaviour - when saving an HTML doc with an xml dump function, HTML UTF-8 parsing - bug, fix reader custom error handlers (Riccardo Scussat) - - - Improvement: xmlSave options for more flexibility to save as - XML/HTML/XHTML, handle leading BOM in HTML documents - - -2.7.1: Sep 1 2008: - - Portability fix: Borland C fix (Moritz Both) - - Bug fixes: python serialization wrappers, XPath QName corner - case handking and leaks (Martin) - - Improvement: extend the xmlSave to handle HTML documents and trees - - Cleanup: python serialization wrappers - - -2.7.0: Aug 30 2008: - - Documentation: switch ChangeLog to UTF-8, improve mutithreads and - xmlParserCleanup docs - - Portability fixes: Older Win32 platforms (Rob Richards), MSVC - porting fix (Rob Richards), Mac OS X regression tests (Sven Herzberg), - non GNUCC builds (Rob Richards), compilation on Haiku (Andreas Färber) - - - Bug fixes: various realloc problems (Ashwin), potential double-free - (Ashwin), regexp crash, icrash with invalid whitespace facets (Rob - Richards), pattern fix when streaming (William Brack), various XML - parsing and validation fixes based on the W3C regression tests, reader - tree skipping function fix (Ashwin), Schemas regexps escaping fix - (Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown - when encoder cant serialize characters on output - - Code cleanup: compilation fix without the reader, without the output - (Robert Schwebel), python whitespace (Martin), many space/tabs cleanups, - serious cleanup of the entity handling code - - Improvement: switch parser to XML-1.0 5th edition, add parsing flags - for old versions, switch URI parsing to RFC 3986, - add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), - new hashing functions for dictionnaries (based on Stefan Behnel work), - improve handling of misplaced html/head/body in HTML parser, better - regression test tools and code coverage display, better algorithms - to detect various versions of the billion laughts attacks, make - arbitrary parser limits avoidable as a parser option - - -2.6.32: Apr 8 2008: - - Documentation: returning heap memory to kernel (Wolfram Sang), - trying to clarify xmlCleanupParser() use, xmlXPathContext improvement - (Jack Jansen), improve the *Recover* functions documentation, - XmlNodeType doc link fix (Martijn Arts) - - Bug fixes: internal subset memory leak (Ashwin), avoid problem with - paths starting with // (Petr Sumbera), streaming XSD validation callback - patches (Ashwin), fix redirection on port other than 80 (William Brack), - SAX2 leak (Ashwin), XInclude fragment of own document (Chris Ryan), - regexp bug with '.' (Andrew Tosh), flush the writer at the end of the - document (Alfred Mickautsch), output I/O bug fix (William Brack), - writer CDATA output after a text node (Alex Khesin), UTF-16 encoding - detection (William Brack), fix handling of empty CDATA nodes for Safari - team, python binding problem with namespace nodes, improve HTML parsing - (Arnold Hendriks), regexp automata build bug, memory leak fix (Vasily - Chekalkin), XSD test crash, weird system parameter entity parsing problem, - allow save to file:///X:/ windows paths, various attribute normalisation - problems, externalSubsetSplit fix (Ashwin), attribute redefinition in - the DTD (Ashwin), fix in char ref parsing check (Alex Khesin), many - out of memory handling fixes (Ashwin), XPath out of memory handling fixes - (Alvaro Herrera), various realloc problems (Ashwin), UCS4 encoding - conversion buffer size (Christian Fruth), problems with EatName - functions on memory errors, BOM handling in external parsed entities - (Mark Rowe) - - Code cleanup: fix build under VS 2008 (David Wimsey), remove useless - mutex in xmlDict (Florent Guilian), Mingw32 compilation fix (Carlo - Bramini), Win and MacOS EOL cleanups (Florent Guiliani), iconv need - a const detection (Roumen Petrov), simplify xmlSetProp (Julien Charbon), - cross compilation fixes for Mingw (Roumen Petrov), SCO Openserver build - fix (Florent Guiliani), iconv uses const on Win32 (Rob Richards), - duplicate code removal (Ashwin), missing malloc test and error reports - (Ashwin), VMS makefile fix (Tycho Hilhorst) - - improvements: better plug of schematron in the normal error handling - (Tobias Minich) - - -2.6.31: Jan 11 2008: - - Security fix: missing of checks in UTF-8 parsing - - Bug fixes: regexp bug, dump attribute from XHTML document, fix - xmlFree(NULL) to not crash in debug mode, Schematron parsing crash - (Rob Richards), global lock free on Windows (Marc-Antoine Ruel), - XSD crash due to double free (Rob Richards), indentation fix in - xmlTextWriterFullEndElement (Felipe Pena), error in attribute type - parsing if attribute redeclared, avoid crash in hash list scanner if - deleting elements, column counter bug fix (Christian Schmidt), - HTML embed element saving fix (Stefan Behnel), avoid -L/usr/lib - output from xml2-config (Fred Crozat), avoid an xmllint crash - (Stefan Kost), don't stop HTML parsing on out of range chars. - - - Code cleanup: fix open() call third argument, regexp cut'n paste - copy error, unused variable in __xmlGlobalInitMutexLock (Hannes Eder), - some make distcheck realted fixes (John Carr) - - Improvements: HTTP Header: includes port number (William Brack), - testURI --debug option, - - -2.6.30: Aug 23 2007: - - Portability: Solaris crash on error handling, windows path fixes - (Roland Schwarz and Rob Richards), mingw build (Roland Schwarz) - - Bugfixes: xmlXPathNodeSetSort problem (William Brack), leak when - reusing a writer for a new document (Dodji Seketeli), Schemas - xsi:nil handling patch (Frank Gross), relative URI build problem - (Patrik Fimml), crash in xmlDocFormatDump, invalid char in comment - detection bug, fix disparity with xmlSAXUserParseMemory, automata - generation for complex regexp counts problems, Schemas IDC import - problems (Frank Gross), xpath predicate evailation error handling - (William Brack) - - -2.6.29: Jun 12 2007: - - Portability: patches from Andreas Stricke for WinCEi, - fix compilation warnings (William Brack), avoid warnings on Apple OS/X - (Wendy Doyle and Mark Rowe), Windows compilation and threading - improvements (Rob Richards), compilation against old Python versions, - new GNU tar changes (Ryan Hill) - - Documentation: xmlURIUnescapeString comment, - - Bugfixes: xmlBufferAdd problem (Richard Jones), 'make valgrind' - flag fix (Richard Jones), regexp interpretation of \, - htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in - typo (Bjorn Reese), entity content failure, xmlListAppend() fix - (Georges-André Silber), XPath number serialization (William Brack), - nanohttp gzipped stream fix (William Brack and Alex Cornejo), - xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), - XPath string value of PI nodes (William Brack), XPath node set - sorting bugs (William Brack), avoid outputting namespace decl - dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding - error handling, recustion on next in catalogs, fix a Relax-NG crash, - workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes, - invalid character in attribute detection bug, big comments before - internal subset streaming bug, HTML parsing of attributes with : in - the name, IDness of name in HTML (Dagfinn I. Mannsåker) - - Improvement: keep URI query parts in raw form (Richard Jones), - embed tag support in HTML (Michael Day) - - -2.6.28: Apr 17 2007: - - Documentation: comment fixes (Markus Keim), xpath comments fixes too - (James Dennett) - - Bug fixes: XPath bug (William Brack), HTML parser autoclose stack usage - (Usamah Malik), various regexp bug fixes (DV and William), path conversion - on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath - principal node of axis bug, HTML serialization of some codepoint - (Steven Rainwater), user data propagation in XInclude (Michael Day), - standalone and XML decl detection (Michael Day), Python id ouptut - for some id, fix the big python string memory leak, URI parsing fixes - (Stéphane Bidoul and William), long comments parsing bug (William), - concurrent threads initialization (Ted Phelps), invalid char - in text XInclude (William), XPath memory leak (William), tab in - python problems (Andreas Hanke), XPath node comparison error - (Oleg Paraschenko), cleanup patch for reader (Julien Reichel), - XML Schemas attribute group (William), HTML parsing problem (William), - fix char 0x2d in regexps (William), regexp quantifier range with - min occurs of 0 (William), HTML script/style parsing (Mike Day) - - Improvement: make xmlTextReaderSetup() public - - Compilation and postability: fix a missing include problem (William), - __ss_familly on AIX again (Björn Wiberg), compilation without zlib - (Michael Day), catalog patch for Win32 (Christian Ehrlicher), - Windows CE fixes (Andreas Stricke) - - Various CVS to SVN infrastructure changes - - -2.6.27: Oct 25 2006: - - Portability fixes: file names on windows (Roland Schwingel, - Emelyanov Alexey), windows compile fixup (Rob Richards), - AIX iconv() is apparently case sensitive - - improvements: Python XPath types mapping (Nic Ferrier), XPath optimization - (Kasimier), add xmlXPathCompiledEvalToBoolean (Kasimier), Python node - equality and comparison (Andreas Pakulat), xmlXPathCollectAndTest - improvememt (Kasimier), expose if library was compiled with zlib - support (Andrew Nosenko), cache for xmlSchemaIDCMatcher structs - (Kasimier), xmlTextConcat should work with comments and PIs (Rob - Richards), export htmlNewParserCtxt needed by Michael Day, refactoring - of catalog entity loaders (Michael Day), add XPointer support to - python bindings (Ross Reedstrom, Brian West and Stefan Anca), - try to sort out most file path to URI conversions and xmlPathToUri, - add --html --memory case to xmllint - - building fix: fix --with-minimum (Felipe Contreras), VMS fix, - const'ification of HTML parser structures (Matthias Clasen), - portability fix (Emelyanov Alexey), wget autodetection (Peter - Breitenlohner), remove the build path recorded in the python - shared module, separate library flags for shared and static builds - (Mikhail Zabaluev), fix --with-minimum --with-sax1 builds, fix - --with-minimum --with-schemas builds - - bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and - attribute (Kasimier), crash when using the recover mode, - xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier), - missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes - (Kasimier), warning on entities processing, XHTML script and style - serialization (Kasimier), python generator for long types, bug in - xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate - allocation bug (Marton Illes), error message end of line (Rob Richards), - fix attribute serialization in writer (Rob Richards), PHP4 DTD validation - crasher, parser safety patch (Ben Darnell), _private context propagation - when parsing entities (with Michael Day), fix entities behaviour when - using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity - context, arg error in SAX callback (Mike Hommey), fix mixed-content - autodetect when using --noblanks, fix xmlIOParseDTD error handling, - fix bug in xmlSplitQName on special Names, fix Relax-NG element content - validation bug, fix xmlReconciliateNs bug, fix potential attribute - XML parsing bug, fix line/column accounting in XML parser, chunking bug - in the HTML parser on script, try to detect obviously buggy HTML - meta encoding indications, bugs with encoding BOM and xmlSaveDoc, - HTML entities in attributes parsing, HTML minimized attribute values, - htmlReadDoc and htmlReadIO were broken, error handling bug in - xmlXPathEvalExpression (Olaf Walkowiak), fix a problem in - htmlCtxtUseOptions, xmlNewInputFromFile could leak (Marius Konitzer), - bug on misformed SSD regexps (Christopher Boumenot) - - - documentation: warning about XML_PARSE_COMPACT (Kasimier Buchcik), - fix xmlXPathCastToString documentation, improve man pages for - xmllitn and xmlcatalog (Daniel Leidert), fixed comments of a few - functions - - -2.6.26: Jun 6 2006: - - portability fixes: Python detection (Joseph Sacco), compilation - error(William Brack and Graham Bennett), LynxOS patch (Olli Savia) - - bug fixes: encoding buffer problem, mix of code and data in - xmlIO.c(Kjartan Maraas), entities in XSD validation (Kasimier Buchcik), - variousXSD validation fixes (Kasimier), memory leak in pattern (Rob - Richards andKasimier), attribute with colon in name (Rob Richards), XPath - leak inerror reporting (Aleksey Sanin), XInclude text include of - selfdocument. - - improvements: Xpath optimizations (Kasimier), XPath object - cache(Kasimier) - - -2.6.25: Jun 6 2006:: -Do not use or package 2.6.25 -2.6.24: Apr 28 2006: - - Portability fixes: configure on Windows, testapi compile on windows - (Kasimier Buchcik, venkat naidu), Borland C++ 6 compile (Eric Zurcher), - HP-UX compiler workaround (Rick Jones), xml2-config bugfix, gcc-4.1 - cleanups, Python detection scheme (Joseph Sacco), UTF-8 file paths on - Windows (Roland Schwingel). - - - Improvements: xmlDOMWrapReconcileNamespaces xmlDOMWrapCloneNode (Kasimier - Buchcik), XML catalog debugging (Rick Jones), update to Unicode 4.01. - - Bug fixes: xmlParseChunk() problem in 2.6.23, xmlParseInNodeContext() - on HTML docs, URI behaviour on Windows (Rob Richards), comment streaming - bug, xmlParseComment (with William Brack), regexp bug fixes (DV & - Youri Golovanov), xmlGetNodePath on text/CDATA (Kasimier), - one Relax-NG interleave bug, xmllint --path and --valid, - XSD bugfixes (Kasimier), remove debug - left in Python bindings (Nic Ferrier), xmlCatalogAdd bug (Martin Cole), - xmlSetProp fixes (Rob Richards), HTML IDness (Rob Richards), a large - number of cleanups and small fixes based on Coverity reports, bug - in character ranges, Unicode tables const (Aivars Kalvans), schemas - fix (Stefan Kost), xmlRelaxNGParse error deallocation, - xmlSchemaAddSchemaDoc error deallocation, error handling on unallowed - code point, ixmllint --nonet to never reach the net (Gary Coady), - line break in writer after end PI (Jason Viers). - - Documentation: man pages updates and cleanups (Daniel Leidert). - - New features: Relax NG structure error handlers. - - -2.6.23: Jan 5 2006: - - portability fixes: Windows (Rob Richards), getaddrinfo on Windows - (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas), - --with-minimum compilation fixes (William Brack), error case handling fix - on Solaris (Albert Chin), don't use 'list' as parameter name reported by - Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin), - MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick - Jones), - - code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose - (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring - parsing code (Bjorn Reese) - - bug fixes: xmlBuildRelativeURI and empty path (William Brack), - combinatory explosion and performances in regexp code, leak in - xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo - Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik), - XPath pattern based evaluation bugs (DV & Kasimier), - xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in - xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of - vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF - split problem (William), issues with non-namespaced attributes in - xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), - HTML parsing of script, Python must not output to stdout (Nic Ferrier), - exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype - totalDigits bug (Kasimier Buchcik), error handling when writing to an - xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi - Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix - XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier), - fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml - (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of - runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs - (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), - compilation and build fixes (Michael Day), removed dependancies on - xmlSchemaValidError (Kasimier), bug with , more XPath - pattern based evaluation fixes (Kasimier) - - improvements: XSD Schemas redefinitions/restrictions (Kasimier - Buchcik), node copy checks and fix for attribute (Rob Richards), counted - transition bug in regexps, ctxt->standalone = -2 to indicate no - standalone attribute was found, add xmlSchemaSetParserStructuredErrors() - (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API - (Kasimier), handle gzipped HTTP resources (Gary Coady), add - htmlDocDumpMemoryFormat. (Rob Richards), - - documentation: typo (Michael Day), libxml man page (Albert Chin), save - function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik), - - -2.6.22: Sep 12 2005: - - build fixes: compile without schematron (Stéphane Bidoul) - - bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, - CDATA push parser bug, xmlElemDump problem with XHTML1 doc, - XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some - output formatting for meta element (Rob Richards), script and style - XHTML1 serialization (David Madore), Attribute derivation fixups in XSD - (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik) - - improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add - XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for - derive (Kasimier Buchcik). - - documentation: generation of gtk-doc like docs, integration with - devhelp. - - -2.6.21: Sep 4 2005: - - build fixes: Cygwin portability fixes (Gerrit P. Haase), calling - convention problems on Windows (Marcus Boerger), cleanups based on Linus' - sparse tool, update of win32/configure.js (Rob Richards), remove warnings - on Windows(Marcus Boerger), compilation without SAX1, detection of the - Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko), - compilation/link with threads and old gcc, compile problem by C370 on - Z/OS, - - bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 - bug (Jiri Netolicky), XPath NaN compare bug (William Brack), - htmlParseScript potential bug, Schemas regexp handling of spaces, Base64 - Schemas comparisons NIST passes, automata build error xsd:all, - xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas - foreign namespaces handling, XML Schemas facet comparison (Kupriyanov - Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: - namespace ahndling in Schemas (Kasimier), empty model group in Schemas - (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), - xs:anyType in Schemas (Kasimier), Python resolver emmitting error - messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to - fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob - Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8 - serialization, streaming XPath, Schemas determinism detection problem, - XInclude bug, Schemas context type (Dean Hill), validation fix (Derek - Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas - type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling, - xmlGetLineNo fixes, bug on entities handling, entity name extraction in - error handling with XInclude, text nodes in HTML body tags (Gary Coady), - xml:id and IDness at the treee level fixes, XPath streaming patterns - bugs. - - improvements: structured interfaces for schemas and RNG error reports - (Marcus Boerger), optimization of the char data inner loop parsing - (thanks to Behdad Esfahbod for the idea), schematron validation though - not finished yet, xmlSaveOption to omit XML declaration, keyref match - error reports (Kasimier), formal expression handling code not plugged - yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option - for text nodes allocation. - - documentation: xmllint man page had --nonet duplicated - - -2.6.20: Jul 10 2005: - - build fixes: Windows build (Rob Richards), Mingw compilation (Igor - Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and - andriy@google.com), use gcc weak references to pthread to avoid the - pthread dependancy on Linux, compilation problem (Steve Nairn), compiling - of subset (Morten Welinder), IPv6/ss_family compilation (William Brack), - compilation when disabling parts of the library, standalone test - distribution. - - bug fixes: bug in lang(), memory cleanup on errors (William Brack), - HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer - overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup - (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch - (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup - on XInclude (William), pattern fixes (William), attribute bug in - exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob - Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type - QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug - (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob - Richards), a small RelaxNG leak, HTML parsing in push mode bug (James - Bursa), failure to detect UTF-8 parsing bugs in CDATA sections, - areBlanks() heuristic failure, duplicate attributes in DTD bug - (William). - - improvements: lot of work on Schemas by Kasimier Buchcik both on - conformance and streaming, Schemas validation messages (Kasimier Buchcik, - Matthew Burgess), namespace removal at the python level (Brent - Hendricks), Update to new Schemas regression tests from W3C/Nist - (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of - xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), - standalone test framework and programs, new DOM import APIs - xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and - xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and - Schemas regression tests, xmlStopParser() available in pull mode too, - ienhancement to xmllint --shell namespaces support, Windows port of the - standalone testing tools (Kasimier and William), - xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX - Schemas APIs, Schemas xmlReader support. - - -2.6.19: Apr 02 2005: - - build fixes: drop .la from RPMs, --with-minimum build fix (William - Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX - 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on - Linux/ELF/gcc4 - - bug fixes: schemas type decimal fixups (William Brack), xmmlint return - code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY - Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin), - segfault in Schemas (Kasimier Buchcik), Schemas attribute validation - (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards), - HTML serialization of name attribute on a elements, Python error handlers - leaks and improvement (Brent Hendricks), uninitialized variable in - encoding code, Relax-NG validation bug, potential crash if - gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures, - switched back to assuming UTF-8 in case no encoding is given at - serialization time - - improvements: lot of work on Schemas by Kasimier Buchcik on facets - checking and also mixed handling. - - - - -2.6.18: Mar 13 2005: - - build fixes: warnings (Peter Breitenlohner), testapi.c generation, - Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), - some gcc4 fixes, HP-UX portability fixes (Rick Jones). - - bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and - xmlreader stopping on non-fatal errors, thread support for dictionnaries - reference counting (Gary Coady), internal subset and push problem, URL - saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths - fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix - (Mike Hommey), warning should not count as error (William Brack), - xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup - FTP and HTTP code to reuse the uri parsing and IPv6 (William), - xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being - empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows - (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent - Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug - (Rob Richards), Schemas decimal type fixes (William Brack), - xmlByteConsumed static buffer (Ben Maurer). - - improvement: speedup parsing comments and DTDs, dictionnary support for - hash tables, Schemas Identity constraints (Kasimier), streaming XPath - subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical - values handling (Kasimier), add xmlTextReaderByteConsumed (Aron - Stansvik), - - Documentation: Wiki support (Joel Reed) - - -2.6.17: Jan 16 2005: - - build fixes: Windows, warnings removal (William Brack), - maintainer-clean dependency(William), build in a different directory - (William), fixing --with-minimum configure build (William), BeOS build - (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan - McNichol) - - bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile() - to use the catalog(s), loop on output (William Brack), XPath memory leak, - ID deallocation problem (Steve Shepard), debugDumpNode crash (William), - warning not using error callback (William), xmlStopParser bug (William), - UTF-16 with BOM on DTDs (William), namespace bug on empty elements in - push mode (Rob Richards), line and col computations fixups (Aleksey - Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), - patterns with too many steps, bug in RNG choice optimization, line number - sometimes missing. - - improvements: XSD Schemas (Kasimier Buchcik), python generator - (William), xmlUTF8Strpos speedup (William), unicode Python strings - (William), XSD error reports (Kasimier Buchcik), Python __str__ call - serialize(). - - new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for - the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel - Reed), error extraction API from regexps, new XMLSave option for format - (Phil Shafer) - - documentation: site improvement (John Fleck), FAQ entries - (William). - - -2.6.16: Nov 10 2004: - - general hardening and bug fixing crossing all the API based on new - automated regression testing - - build fix: IPv6 build and test on AIX (Dodji Seketeli) - - bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding - conversion functions return values, UTF-8 bug affecting XPath reported by - Markus Bertheau, catalog problem with NULL entries (William Brack) - - documentation: fix to xmllint man page, some API function descritpion - were updated. - - improvements: DTD validation APIs provided at the Python level (Brent - Hendricks) - - -2.6.15: Oct 27 2004: - - security fixes on the nanoftp and nanohttp modules - - build fixes: xmllint detection bug in configure, building outside the - source tree (Thomas Fitzsimmons) - - bug fixes: HTML parser on broken ASCII chars in names (William), Python - paths (Malcolm Tredinnick), xmlHasNsProp and default namespace (William), - saving to python file objects (Malcolm Tredinnick), DTD lookup fix - (Malcolm), save back in catalogs (William), tree build - fixes (DV and Rob Richards), Schemas memory bug, structured error handler - on Python 64bits, thread local memory deallocation, memory leak reported - by Volker Roth, xmlValidateDtd in the presence of an internal subset, - entities and _private problem (William), xmlBuildRelativeURI error - (William). - - improvements: better XInclude error reports (William), tree debugging - module and tests, convenience functions at the Reader API (Graham - Bennett), add support for PI in the HTML parser. - - -2.6.14: Sep 29 2004: - - build fixes: configure paths for xmllint and xsltproc, compilation - without HTML parser, compilation warning cleanups (William Brack & - Malcolm Tredinnick), VMS makefile update (Craig Berry), - - bug fixes: xmlGetUTF8Char (William Brack), QName properties (Kasimier - Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x - transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes - (Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc), - handling of failed realloc(), out of bound array adressing in Schemas - date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS - E20 validation fix (Malcolm), - - improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add - xmlSchemaValidateOneElement (Kasimier), Python exception hierearchy - (Malcolm Tredinnick), Python libxml2 driver improvement (Malcolm - Tredinnick), Schemas support for xsi:schemaLocation, - xsi:noNamespaceSchemaLocation, xsi:type (Kasimier Buchcik) - - -2.6.13: Aug 31 2004: - - build fixes: Windows and zlib (Igor Zlatkovic), -O flag with gcc, - Solaris compiler warning, fixing RPM BuildRequires, - - fixes: DTD loading on Windows (Igor), Schemas error reports APIs - (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack - and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace - problem (William), Schemas hexbinary empty values, encoding error could - genrate a serialization loop. - - Improvements: Schemas validity improvements (Kasimier), added --path - and --load-trace options to xmllint - - documentation: tutorial update (John Fleck) - - -2.6.12: Aug 22 2004: - - build fixes: fix --with-minimum, elfgcchack.h fixes (Peter - Breitenlohner), perl path lookup (William), diff on Solaris (Albert - Chin), some 64bits cleanups. - - Python: avoid a warning with 2.3 (William Brack), tab and space mixes - (William), wrapper generator fixes (William), Cygwin support (Gerrit P. - Haase), node wrapper fix (Marc-Antoine Parent), XML Schemas support - (Torkel Lyng) - - Schemas: a lot of bug fixes and improvements from Kasimier Buchcik - - fixes: RVT fixes (William), XPath context resets bug (William), memory - debug (Steve Hay), catalog white space handling (Peter Breitenlohner), - xmlReader state after attribute reading (William), structured error - handler (William), XInclude generated xml:base fixup (William), Windows - memory reallocation problem (Steve Hay), Out of Memory conditions - handling (William and Olivier Andrieu), htmlNewDoc() charset bug, - htmlReadMemory init (William), a posteriori validation DTD base - (William), notations serialization missing, xmlGetNodePath (Dodji), - xmlCheckUTF8 (Diego Tartara), missing line numbers on entity - (William) - - improvements: DocBook catalog build scrip (William), xmlcatalog tool - (Albert Chin), xmllint --c14n option, no_proxy environment (Mike Hommey), - xmlParseInNodeContext() addition, extend xmllint --shell, allow XInclude - to not generate start/end nodes, extend xmllint --version to include CVS - tag (William) - - documentation: web pages fixes, validity API docs fixes (William) - schemas API fix (Eric Haszlakiewicz), xmllint man page (John Fleck) - - -2.6.11: July 5 2004: - - Schemas: a lot of changes and improvements by Kasimier Buchcik for - attributes, namespaces and simple types. - - build fixes: --with-minimum (William Brack), some gcc cleanup - (William), --with-thread-alloc (William) - - portability: Windows binary package change (Igor Zlatkovic), Catalog - path on Windows - - documentation: update to the tutorial (John Fleck), xmllint return code - (John Fleck), man pages (Ville Skytta), - - bug fixes: C14N bug serializing namespaces (Aleksey Sanin), testSAX - properly initialize the library (William), empty node set in XPath - (William), xmlSchemas errors (William), invalid charref problem pointed - by Morus Walter, XInclude xml:base generation (William), Relax-NG bug - with div processing (William), XPointer and xml:base problem(William), - Reader and entities, xmllint return code for schemas (William), reader - streaming problem (Steve Ball), DTD serialization problem (William), - libxml.m4 fixes (Mike Hommey), do not provide destructors as methods on - Python classes, xmlReader buffer bug, Python bindings memory interfaces - improvement (with Stéphane Bidoul), Fixed the push parser to be back to - synchronous behaviour. - - improvement: custom per-thread I/O enhancement (Rob Richards), register - namespace in debug shell (Stefano Debenedetti), Python based regression - test for non-Unix users (William), dynamically increase the number of - XPath extension functions in Python and fix a memory leak (Marc-Antoine - Parent and William) - - performance: hack done with Arjan van de Ven to reduce ELF footprint - and generated code on Linux, plus use gcc runtime profiling to optimize - the code generated in the RPM packages. - - -2.6.10: May 17 2004: - - Web page generated for ChangeLog - - build fixes: --without-html problems, make check without make all - - portability: problem with xpath.c on Windows (MSC and Borland), memcmp - vs. strncmp on Solaris, XPath tests on Windows (Mark Vakoc), C++ do not - use "list" as parameter name, make tests work with Python 1.5 (Ed - Davis), - - improvements: made xmlTextReaderMode public, small buffers resizing - (Morten Welinder), add --maxmem option to xmllint, add - xmlPopInputCallback() for Matt Sergeant, refactoring of serialization - escaping, added escaping customization - - bugfixes: xsd:extension (Taihei Goi), assorted regexp bugs (William - Brack), xmlReader end of stream problem, node deregistration with reader, - URI escaping and filemanes, XHTML1 formatting (Nick Wellnhofer), regexp - transition reduction (William), various XSD Schemas fixes (Kasimier - Buchcik), XInclude fallback problem (William), weird problems with DTD - (William), structured error handler callback context (William), reverse - xmlEncodeSpecialChars() behaviour back to escaping '"' - - -2.6.9: Apr 18 2004: - - implement xml:id Working Draft, relaxed XPath id() checking - - bugfixes: xmlCtxtReset (Brent Hendricks), line number and CDATA (Dave - Beckett), Relax-NG compilation (William Brack), Regexp patches (with - William), xmlUriEscape (Mark Vakoc), a Relax-NG notAllowed problem (with - William), Relax-NG name classes compares (William), XInclude duplicate - fallback (William), external DTD encoding detection (William), a DTD - validation bug (William), xmlReader Close() fix, recusive extention - schemas - - improvements: use xmlRead* APIs in test tools (Mark Vakoc), indenting - save optimization, better handle IIS broken HTTP redirect behaviour (Ian - Hummel), HTML parser frameset (James Bursa), libxml2-python RPM - dependancy, XML Schemas union support (Kasimier Buchcik), warning removal - clanup (William), keep ChangeLog compressed when installing from RPMs - - documentation: examples and xmlDocDumpMemory docs (John Fleck), new - example (load, xpath, modify, save), xmlCatalogDump() comments, - - Windows: Borland C++ builder (Eric Zurcher), work around Microsoft - compiler NaN handling bug (Mark Vakoc) - - -2.6.8: Mar 23 2004: - - First step of the cleanup of the serialization code and APIs - - XML Schemas: mixed content (Adam Dickmeiss), QName handling fixes (Adam - Dickmeiss), anyURI for "" (John Belmonte) - - Python: Canonicalization C14N support added (Anthony Carrico) - - xmlDocCopyNode() extension (William) - - Relax-NG: fix when processing XInclude results (William), external - reference in interleave (William), missing error on - failure (William), memory leak in schemas datatype facets. - - xmlWriter: patch for better DTD support (Alfred Mickautsch) - - bug fixes: xmlXPathLangFunction memory leak (Mike Hommey and William - Brack), no ID errors if using HTML_PARSE_NOERROR, xmlcatalog fallbacks to - URI on SYSTEM lookup failure, XInclude parse flags inheritance (William), - XInclude and XPointer fixes for entities (William), XML parser bug - reported by Holger Rauch, nanohttp fd leak (William), regexps char - groups '-' handling (William), dictionnary reference counting problems, - do not close stderr. - - performance patches from Petr Pajas - - Documentation fixes: XML_CATALOG_FILES in man pages (Mike Hommey) - - compilation and portability fixes: --without-valid, catalog cleanups - (Peter Breitenlohner), MingW patch (Roland Schwingel), cross-compilation - to Windows (Christophe de Vienne), --with-html-dir fixup (Julio Merino - Vidal), Windows build (Eric Zurcher) - - -2.6.7: Feb 23 2004: - - documentation: tutorial updates (John Fleck), benchmark results - - xmlWriter: updates and fixes (Alfred Mickautsch, Lucas Brasilino) - - XPath optimization (Petr Pajas) - - DTD ID handling optimization - - bugfixes: xpath number with > 19 fractional (William Brack), push - mode with unescaped '>' characters, fix xmllint --stream --timing, fix - xmllint --memory --stream memory usage, xmlAttrSerializeTxtContent - handling NULL, trying to fix Relax-NG/Perl interface. - - python: 2.3 compatibility, whitespace fixes (Malcolm Tredinnick) - - Added relaxng option to xmllint --shell - - -2.6.6: Feb 12 2004: - - nanohttp and nanoftp: buffer overflow error on URI parsing (Igor and - William) reported by Yuuichi Teranishi - - bugfixes: make test and path issues, xmlWriter attribute serialization - (William Brack), xmlWriter indentation (William), schemas validation - (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg - Paraschenko), XInclude empty fallback (William), HTML warnings (William), - XPointer in XInclude (William), Python namespace serialization, - isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter - entities in internal subset (William), internal subset bug in push mode, - fix (Alexey Sarytchev) - - Build: fix for automake-1.8 (Alexander Winston), warnings removal - (Philip Ludlam), SOCKLEN_T detection fixes (Daniel Richard), fix - --with-minimum configuration. - - XInclude: allow the 2001 namespace without warning. - - Documentation: missing example/index.html (John Fleck), version - dependancies (John Fleck) - - reader API: structured error reporting (Steve Ball) - - Windows compilation: mingw, msys (Mikhail Grushinskiy), function - prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_ - patch - - Parsers: added xmlByteConsumed(ctxt) API to get the byte offest in - input. - - -2.6.5: Jan 25 2004: - - Bugfixes: dictionnaries for schemas (William Brack), regexp segfault - (William), xs:all problem (William), a number of XPointer bugfixes - (William), xmllint error go to stderr, DTD validation problem with - namespace, memory leak (William), SAX1 cleanup and minimal options fixes - (Mark Vadoc), parser context reset on error (Shaun McCance), XPath union - evaluation problem (William) , xmlReallocLoc with NULL (Aleksey Sanin), - XML Schemas double free (Steve Ball), XInclude with no href, argument - callbacks order for XPath callbacks (Frederic Peters) - - Documentation: python scripts (William Brack), xslt stylesheets (John - Fleck), doc (Sven Zimmerman), I/O example. - - Python bindings: fixes (William), enum support (Stéphane Bidoul), - structured error reporting (Stéphane Bidoul) - - XInclude: various fixes for conformance, problem related to dictionnary - references (William & me), recursion (William) - - xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred - Mickautsch), - - xmlSchemas: normalizedString datatype (John Belmonte) - - code cleanup for strings functions (William) - - Windows: compiler patches (Mark Vakoc) - - Parser optimizations, a few new XPath and dictionnary APIs for future - XSLT optimizations. - - -2.6.4: Dec 24 2003: - - Windows build fixes (Igor Zlatkovic) - - Some serious XInclude problems reported by Oleg Paraschenko and - - Unix and Makefile packaging fixes (me, William Brack, - - Documentation improvements (John Fleck, William Brack), example fix - (Lucas Brasilino) - - bugfixes: xmlTextReaderExpand() with xmlReaderWalker, XPath handling of - NULL strings (William Brack) , API building reader or parser from - filedescriptor should not close it, changed XPath sorting to be stable - again (William Brack), xmlGetNodePath() generating '(null)' (William - Brack), DTD validation and namespace bug (William Brack), XML Schemas - double inclusion behaviour - - -2.6.3: Dec 10 2003: - - documentation updates and cleanup (DV, William Brack, John Fleck) - - added a repository of examples, examples from Aleksey Sanin, Dodji - Seketeli, Alfred Mickautsch - - Windows updates: Mark Vakoc, Igor Zlatkovic, Eric Zurcher, Mingw - (Kenneth Haley) - - Unicode range checking (William Brack) - - code cleanup (William Brack) - - Python bindings: doc (John Fleck), bug fixes - - UTF-16 cleanup and BOM issues (William Brack) - - bug fixes: ID and xmlReader validation, XPath (William Brack), - xmlWriter (Alfred Mickautsch), hash.h inclusion problem, HTML parser - (James Bursa), attribute defaulting and validation, some serialization - cleanups, XML_GET_LINE macro, memory debug when using threads (William - Brack), serialization of attributes and entities content, xmlWriter - (Daniel Schulman) - - XInclude bugfix, new APIs and update to the last version including the - namespace change. - - XML Schemas improvements: include (Robert Stepanek), import and - namespace handling, fixed the regression tests troubles, added examples - based on Eric van der Vlist book, regexp fixes - - preliminary pattern support for streaming (needed for schemas - constraints), added xmlTextReaderPreservePattern() to collect subdocument - when streaming. - - various fixes in the structured error handling - - -2.6.2: Nov 4 2003: - - XPath context unregistration fixes - - text node coalescing fixes (Mark Lilback) - - API to screate a W3C Schemas from an existing document (Steve Ball) - - BeOS patches (Marcin 'Shard' Konicki) - - xmlStrVPrintf function added (Aleksey Sanin) - - compilation fixes (Mark Vakoc) - - stdin parsing fix (William Brack) - - a posteriori DTD validation fixes - - xmlReader bug fixes: Walker fixes, python bindings - - fixed xmlStopParser() to really stop the parser and errors - - always generate line numbers when using the new xmlReadxxx - functions - - added XInclude support to the xmlReader interface - - implemented XML_PARSE_NONET parser option - - DocBook XSLT processing bug fixed - - HTML serialization for

elements (William Brack and me) - - XPointer failure in XInclude are now handled as resource errors - - fixed xmllint --html to use the HTML serializer on output (added - --xmlout to implement the previous behaviour of saving it using the XML - serializer) - - -2.6.1: Oct 28 2003: - - Mostly bugfixes after the big 2.6.0 changes - - Unix compilation patches: libxml.m4 (Patrick Welche), warnings cleanup - (William Brack) - - Windows compilation patches (Joachim Bauch, Stephane Bidoul, Igor - Zlatkovic) - - xmlWriter bugfix (Alfred Mickautsch) - - chvalid.[ch]: couple of fixes from Stephane Bidoul - - context reset: error state reset, push parser reset (Graham - Bennett) - - context reuse: generate errors if file is not readable - - defaulted attributes for element coming from internal entities - (Stephane Bidoul) - - Python: tab and spaces mix (William Brack) - - Error handler could crash in DTD validation in 2.6.0 - - xmlReader: do not use the document or element _private field - - testSAX.c: avoid a problem with some PIs (Massimo Morara) - - general bug fixes: mandatory encoding in text decl, serializing - Document Fragment nodes, xmlSearchNs 2.6.0 problem (Kasimier Buchcik), - XPath errors not reported, slow HTML parsing of large documents. - - -2.6.0: Oct 20 2003: - - Major revision release: should be API and ABI compatible but got a lot - of change - - Increased the library modularity, far more options can be stripped out, - a --with-minimum configuration will weight around 160KBytes - - Use per parser and per document dictionnary, allocate names and small - text nodes from the dictionnary - - Switch to a SAX2 like parser rewrote most of the XML parser core, - provides namespace resolution and defaulted attributes, minimize memory - allocations and copies, namespace checking and specific error handling, - immutable buffers, make predefined entities static structures, etc... - - rewrote all the error handling in the library, all errors can be - intercepted at a structured level, with precise information - available. - - New simpler and more generic XML and HTML parser APIs, allowing to - easilly modify the parsing options and reuse parser context for multiple - consecutive documents. - - Similar new APIs for the xmlReader, for options and reuse, provided new - functions to access content as const strings, use them for Python - bindings - - a lot of other smaller API improvements: xmlStrPrintf (Aleksey Sanin), - Walker i.e. reader on a document tree based on Alfred Mickautsch code, - make room in nodes for line numbers, reference counting and future PSVI - extensions, generation of character ranges to be checked with faster - algorithm (William), xmlParserMaxDepth (Crutcher Dunnavant), buffer - access - - New xmlWriter API provided by Alfred Mickautsch - - Schemas: base64 support by Anthony Carrico - - Parser<->HTTP integration fix, proper processing of the Mime-Type - and charset information if available. - - Relax-NG: bug fixes including the one reported by Martijn Faassen and - zeroOrMore, better error reporting. - - Python bindings (Stéphane Bidoul), never use stdout for errors - output - - Portability: all the headers have macros for export and calling - convention definitions (Igor Zlatkovic), VMS update (Craig A. Berry), - Windows: threads (Jesse Pelton), Borland compiler (Eric Zurcher, Igor), - Mingw (Igor), typos (Mark Vakoc), beta version (Stephane Bidoul), - warning cleanups on AIX and MIPS compilers (William Brack), BeOS (Marcin - 'Shard' Konicki) - - Documentation fixes and README (William Brack), search fix (William), - tutorial updates (John Fleck), namespace docs (Stefan Kost) - - Bug fixes: xmlCleanupParser (Dave Beckett), threading uninitialized - mutexes, HTML doctype lowercase, SAX/IO (William), compression detection - and restore (William), attribute declaration in DTDs (William), namespace - on attribute in HTML output (William), input filename (Rob Richards), - namespace DTD validation, xmlReplaceNode (Chris Ryland), I/O callbacks - (Markus Keim), CDATA serialization (Shaun McCance), xmlReader (Peter - Derr), high codepoint charref like 􏿿, buffer access in push - mode (Justin Fletcher), TLS threads on Windows (Jesse Pelton), XPath bug - (William), xmlCleanupParser (Marc Liyanage), CDATA output (William), HTTP - error handling. - - xmllint options: --dtdvalidfpi for Tobias Reif, --sax1 for compat - testing, --nodict for building without tree dictionnary, --nocdata to - replace CDATA by text, --nsclean to remove surperfluous namespace - declarations - - added xml2-config --libtool-libs option from Kevin P. Fleming - - a lot of profiling and tuning of the code, speedup patch for - xmlSearchNs() by Luca Padovani. The xmlReader should do far less - allocation and it speed should get closer to SAX. Chris Anderson worked - on speeding and cleaning up repetitive checking code. - - cleanup of "make tests" - - libxml-2.0-uninstalled.pc from Malcolm Tredinnick - - deactivated the broken docBook SGML parser code and plugged the XML - parser instead. - - -2.5.11: Sep 9 2003: -A bugfix only release: - risk of crash in Relax-NG - - risk of crash when using multithreaded programs - - -2.5.10: Aug 15 2003: -A bugfixes only release - Windows Makefiles (William Brack) - - UTF-16 support fixes (Mark Itzcovitz) - - Makefile and portability (William Brack) automake, Linux alpha, Mingw - on Windows (Mikhail Grushinskiy) - - HTML parser (Oliver Stoeneberg) - - XInclude performance problem reported by Kevin Ruscoe - - XML parser performance problem reported by Grant Goodale - - xmlSAXParseDTD() bug fix from Malcolm Tredinnick - - and a couple other cleanup - - -2.5.9: Aug 9 2003: - - bugfixes: IPv6 portability, xmlHasNsProp (Markus Keim), Windows build - (Wiliam Brake, Jesse Pelton, Igor), Schemas (Peter Sobisch), threading - (Rob Richards), hexBinary type (), UTF-16 BOM (Dodji Seketeli), - xmlReader, Relax-NG schemas compilation, namespace handling, EXSLT (Sean - Griffin), HTML parsing problem (William Brack), DTD validation for mixed - content + namespaces, HTML serialization, library initialization, - progressive HTML parser - - better interfaces for Relax-NG error handling (Joachim Bauch, ) - - adding xmlXIncludeProcessTree() for XInclud'ing in a subtree - - doc fixes and improvements (John Fleck) - - configure flag for -with-fexceptions when embedding in C++ - - couple of new UTF-8 helper functions (William Brack) - - general encoding cleanup + ISO-8859-x without iconv (Peter Jacobi) - - xmlTextReader cleanup + enum for node types (Bjorn Reese) - - general compilation/warning cleanup Solaris/HP-UX/... (William - Brack) - - -2.5.8: Jul 6 2003: - - bugfixes: XPath, XInclude, file/URI mapping, UTF-16 save (Mark - Itzcovitz), UTF-8 checking, URI saving, error printing (William Brack), - PI related memleak, compilation without schemas or without xpath (Joerg - Schmitz-Linneweber/Garry Pennington), xmlUnlinkNode problem with DTDs, - rpm problem on , i86_64, removed a few compilation problems from 2.5.7, - xmlIOParseDTD, and xmlSAXParseDTD (Malcolm Tredinnick) - - portability: DJGPP (MsDos) , OpenVMS (Craig A. Berry) - - William Brack fixed multithreading lock problems - - IPv6 patch for FTP and HTTP accesses (Archana Shah/Wipro) - - Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane - Bidoul) - - A few W3C Schemas Structure improvements - - W3C Schemas Datatype improvements (Charlie Bozeman) - - Python bindings for thread globals (Stéphane Bidoul), and method/class - generator - - added --nonet option to xmllint - - documentation improvements (John Fleck) - - -2.5.7: Apr 25 2003: - - Relax-NG: Compiling to regexp and streaming validation on top of the - xmlReader interface, added to xmllint --stream - - xmlReader: Expand(), Next() and DOM access glue, bug fixes - - Support for large files: RGN validated a 4.5GB instance - - Thread support is now configured in by default - - Fixes: update of the Trio code (Bjorn), WXS Date and Duration fixes - (Charles Bozeman), DTD and namespaces (Brent Hendricks), HTML push parser - and zero bytes handling, some missing Windows file path conversions, - behaviour of the parser and validator in the presence of "out of memory" - error conditions - - extended the API to be able to plug a garbage collecting memory - allocator, added xmlMallocAtomic() and modified the allocations - accordingly. - - Performances: removed excessive malloc() calls, speedup of the push and - xmlReader interfaces, removed excessive thread locking - - Documentation: man page (John Fleck), xmlReader documentation - - Python: adding binding for xmlCatalogAddLocal (Brent M Hendricks) - - -2.5.6: Apr 1 2003: - - Fixed W3C XML Schemas datatype, should be compliant now except for - binHex and base64 which are not supported yet. - - bug fixes: non-ASCII IDs, HTML output, XInclude on large docs and - XInclude entities handling, encoding detection on external subsets, XML - Schemas bugs and memory leaks, HTML parser (James Bursa) - - portability: python/trio (Albert Chin), Sun compiler warnings - - documentation: added --relaxng option to xmllint man page (John) - - improved error reporting: xml:space, start/end tag mismatches, Relax NG - errors - - -2.5.5: Mar 24 2003: - - Lot of fixes on the Relax NG implementation. More testing including - DocBook and TEI examples. - - Increased the support for W3C XML Schemas datatype - - Several bug fixes in the URI handling layer - - Bug fixes: HTML parser, xmlReader, DTD validation, XPath, encoding - conversion, line counting in the parser. - - Added support for $XMLLINT_INDENT environment variable, FTP delete - - Fixed the RPM spec file name - - -2.5.4: Feb 20 2003: - - Conformance testing and lot of fixes on Relax NG and XInclude - implementation - - Implementation of XPointer element() scheme - - Bug fixes: XML parser, XInclude entities merge, validity checking on - namespaces, - 2 serialization bugs, node info generation problems, a DTD regexp - generation problem. - - - Portability: windows updates and path canonicalization (Igor) - - A few typo fixes (Kjartan Maraas) - - Python bindings generator fixes (Stephane Bidoul) - - -2.5.3: Feb 10 2003: - - RelaxNG and XML Schemas datatypes improvements, and added a first - version of RelaxNG Python bindings - - Fixes: XLink (Sean Chittenden), XInclude (Sean Chittenden), API fix for - serializing namespace nodes, encoding conversion bug, XHTML1 - serialization - - Portability fixes: Windows (Igor), AMD 64bits RPM spec file - - -2.5.2: Feb 5 2003: - - First implementation of RelaxNG, added --relaxng flag to xmllint - - Schemas support now compiled in by default. - - Bug fixes: DTD validation, namespace checking, XInclude and entities, - delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul), - XPath parser and evaluation, UTF8ToUTF8 serialization, XML reader memory - consumption, HTML parser, HTML serialization in the presence of - namespaces - - added an HTML API to check elements and attributes. - - Documentation improvement, PDF for the tutorial (John Fleck), doc - patches (Stefan Kost) - - Portability fixes: NetBSD (Julio Merino), Windows (Igor Zlatkovic) - - Added python bindings for XPointer, contextual error reporting - (Stéphane Bidoul) - - URI/file escaping problems (Stefano Zacchiroli) - - -2.5.1: Jan 8 2003: - - Fixes a memory leak and configuration/compilation problems in 2.5.0 - - documentation updates (John) - - a couple of XmlTextReader fixes - - -2.5.0: Jan 6 2003: - - New XmltextReader interface based on C# - API (with help of Stéphane Bidoul) - - Windows: more exports, including the new API (Igor) - - XInclude fallback fix - - Python: bindings for the new API, packaging (Stéphane Bidoul), - drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup - and iterators for Python-2.2 (Hannu Krosing) - - Tutorial fixes (john Fleck and Niraj Tolia) xmllint man update - (John) - - Fix an XML parser bug raised by Vyacheslav Pindyura - - Fix for VMS serialization (Nigel Hall) and config (Craig A. Berry) - - Entities handling fixes - - new API to optionally track node creation and deletion (Lukas - Schroeder) - - Added documentation for the XmltextReader interface and some XML guidelines - - -2.4.30: Dec 12 2002: - - 2.4.29 broke the python bindings, rereleasing - - Improvement/fixes of the XML API generator, and couple of minor code - fixes. - - -2.4.29: Dec 11 2002: - - Windows fixes (Igor): Windows CE port, pthread linking, python bindings - (Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates - - Fix for prev in python bindings (ERDI Gergo) - - Fix for entities handling (Marcus Clarke) - - Refactored the XML and HTML dumps to a single code path, fixed XHTML1 - dump - - Fix for URI parsing when handling URNs with fragment identifiers - - Fix for HTTP URL escaping problem - - added an TextXmlReader (C#) like API (work in progress) - - Rewrote the API in XML generation script, includes a C parser and saves - more information needed for C# bindings - - -2.4.28: Nov 22 2002: - - a couple of python binding fixes - - 2 bug fixes in the XML push parser - - potential memory leak removed (Martin Stoilov) - - fix to the configure script for Unix (Dimitri Papadopoulos) - - added encoding support for XInclude parse="text" - - autodetection of XHTML1 and specific serialization rules added - - nasty threading bug fixed (William Brack) - - -2.4.27: Nov 17 2002: - - fixes for the Python bindings - - a number of bug fixes: SGML catalogs, xmlParseBalancedChunkMemory(), - HTML parser, Schemas (Charles Bozeman), document fragment support - (Christian Glahn), xmlReconciliateNs (Brian Stafford), XPointer, - xmlFreeNode(), xmlSAXParseMemory (Peter Jones), xmlGetNodePath (Petr - Pajas), entities processing - - added grep to xmllint --shell - - VMS update patch from Craig A. Berry - - cleanup of the Windows build with support for more compilers (Igor), - better thread support on Windows - - cleanup of Unix Makefiles and spec file - - Improvements to the documentation (John Fleck) - - -2.4.26: Oct 18 2002: - - Patches for Windows CE port, improvements on Windows paths handling - - Fixes to the validation code (DTD and Schemas), xmlNodeGetPath() , - HTML serialization, Namespace compliance, and a number of small - problems - - -2.4.25: Sep 26 2002: - - A number of bug fixes: XPath, validation, Python bindings, DOM and - tree, xmlI/O, Html - - Serious rewrite of XInclude - - Made XML Schemas regexp part of the default build and APIs, small fix - and improvement of the regexp core - - Changed the validation code to reuse XML Schemas regexp APIs - - Better handling of Windows file paths, improvement of Makefiles (Igor, - Daniel Gehriger, Mark Vakoc) - - Improved the python I/O bindings, the tests, added resolver and regexp - APIs - - New logos from Marc Liyanage - - Tutorial improvements: John Fleck, Christopher Harris - - Makefile: Fixes for AMD x86_64 (Mandrake), DESTDIR (Christophe - Merlet) - - removal of all stderr/perror use for error reporting - - Better error reporting: XPath and DTD validation - - update of the trio portability layer (Bjorn Reese) - -2.4.24: Aug 22 2002 - XPath fixes (William), xf:escape-uri() (Wesley Terpstra) - - Python binding fixes: makefiles (William), generator, rpm build, x86-64 - (fcrozat) - - HTML + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_sdk_error_strings.xml b/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_sdk_error_strings.xml new file mode 100644 index 0000000000..b009804bc5 --- /dev/null +++ b/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_sdk_error_strings.xml @@ -0,0 +1,146 @@ + + + + 未知错误码: + + 未知错误 + 网络连接错误 + 数据包不全、丢失或无效 + SessionId(用户的会话标识)无效 + 参数值错误或非法,请检查参数值是否有效 + 无效的应用ID接入 + 网络请求发生错误 + 该用户未授权接入(AppKey无效) + 未检测到SIM卡 + 服务器处理发生错误,请求无法完成 + 未登录 + 账号格式不合法,合法账号为4-70个字符,仅允许小写字母及数字,支持邮箱注册 + 密码格式不合法,密码不能为空,长度为6-12个字符,由字母和数字组成,大小写敏感 + 登录失败 + 账号不存在或停用 + 账号密码错误 + 该手机或号码已经注册了n个账号 + 注册失败 + 该91通行证账号已经被注册 + 账号验证失败 + 昵称不合法,合法昵称由1-16个非空字符构成,请勿使用敏感词汇 + 新密码格式非法,密码不能为空,长度为6-12个字符,由字母和数字组成,大小写敏感 + 请输入正确的原密码 + 请输入正确的原密码 + 该用户已经设定了手机号码 + 该手机号已经被注册 + 指定时间内不能重复发送(手机注册短信验证码) + 手机短信验证码无效 + 真实姓名不合法 + 心情长度太长,不能超过140个字符 + 内容不合法 + 他(她)已不是您的好友,禁止当前操作! + 发送的图片数据超过了服务器允许的大小 + 发送的图片数据内容不合法 + 头像没有变更 + 该用户没有自定义头像 + 该应用不存在 + 图标没有变更 + 无自定义图标 + 支付密码错误 + 该账号未在商城开户 + 支付密码未设置 + 支付密码未验证 + 余额不足 + 订单号重复 + 页码超过范围 + 充值面额非法 + 短信支付账号无效 + 没有手机号码,账号未绑定手机号 + 充值卡卡号无效 + 充值卡密码无效 + 充值卡类型不支持 + 该用户不存在 + 该好友不存在 + 用户不允许被添加好友 + 用户已经是您的好友 + 备注长度不合法 + 您或对方已经到达好友个数上限 + 应用Id不合法 + 动态类型不合法 + 没有该条消息 + 内容长度不合法 + 发送者被禁止发消息 + 不能给自己发送短消息 + 该标签为客户端标签 + 无效的标签指令 + 无效的标签文本 + 自定义标签参数不足 + 自定义标签参数无效 + 反馈类型无效 + 您手机卡登录账号个数已达上限 + 业务系统未通过审核 + 接口不允许调用 + 相同的通讯录已经上传,忽略此次上传 + + + 取消操作 + 参数无效 + 该图标不存在 + 模板ID无效 + 模板参数无效 + 支付失败 + 取消支付 + 该排行榜不存在 + 用户排行列表不存在 + 该用户没有好友在玩 + 成就不存在 + 用户没有绑定第三方账号 + 分享内容重复 + 无此订单 + 该代付订单的代付人不是当前用户 + 对方不是你的好友 + 该第三方账号没有好友 + 已经绑定指定类型的第三方账号 + 第三方账号已经绑定其他91账号 + 已经绑定91账号 + 第三方登陆信息丢失 + 无法验证第三方账号密码 + 第三方账号绑定的91账号异常(停用等) + + + + 商品类型无效 + 计费类型无效 + + 该第三方信息不存在 + 不能解除当前登录的第三方账号的绑定 + 当前登录的第三方账号与已绑定的第三方账号不符 + + + + 重复发送 + 支付超时,请稍后重试 + 虚拟物品使用标志无效 + 商品ID无效 + 无效的平台SDK版本号 + + 图片大小不能超过1M + + 手机号码格式无效 + 重复绑定,账号已经绑定手机号 + 手机号已经绑定其他账号 + + 手机号码与绑定手机号码不一致 + 短信验证码错误 + 短信验证码过期 + 账号未绑定任何手机号 + 未通过手机号码验证 + 不符合抽奖条件 + 已经抽过奖 + 短信发送次数过多 + VIP用户无法使用手机号码找回密码 + 手机号码前后不一致 + + 有关联的91账号,不能以游客方式登录 + 非游客登录状态 + Uin不合法 + 账号无效(可能是保留账号) + 自动登录凭据失效,请重新输入密码登录 + + diff --git a/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_strings.xml b/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_strings.xml new file mode 100644 index 0000000000..f1a208c032 --- /dev/null +++ b/plugin/plugins/nd91/proj.android/DependProject/res/values/nd3_strings.xml @@ -0,0 +1,793 @@ + + + + 首页 + 好友 + 消息 + 精品 + 更多 + + 请重新登录 + + 删除 + 取消 + + + 成就榜 + 排行榜 + 论坛 + 看看谁在玩 + 邀请好友 + 新鲜事 + + 游戏 + 好友(%1$s) + 刷新 + + 我的好友 + 返回 + 可能认识的人 + 正在加载数据… + 加载数据失败,请点击重试 + 暂时没有可能认识的人! + 内牛满面~~没有人玩游戏。 + 暂时没有好友! + 更多记录...... + %1$s的好友 + Ta的好友 + 查找用户 + 按昵称查找用户 + 按通行证查找用户 + 按分类查找用户 + + 当前用户暂时没有排名! + 今日风平浪静,无事发生。 + 不限 + 别偷懒,快去加好友吧! + 人都跑哪去了!都在躲猫猫吗? + 太懒了吧,一个好友都没有! + 这家伙很懒,什么都没留下! + 暂时没有消息记录! + + + + + 搜索 + 抱歉,没有找到相关记录! + + + %1$s的游戏 + Ta的游戏 + 年龄: + + 不要超过30个字哦~ + 编辑心情 + 完成 + 提交成功 + 提交 + + %1$s的新鲜事 + Ta的新鲜事 + + + 看看谁在玩 + 我的好友 + @string/nd3_achieve_rank + 暂时没有成就! + @string/nd3_ranking + 暂时没有排行榜! + + 分享 + %1$s还没有分数 + %1$s分 + @string/nd3_no_rank_category_tip + 我的消息 + 系统消息 + 发送 + 暂时没有消息,记得常和好友联系噢! + 暂时没有消息记录! + 选取好友 + 加为好友 + 邀请 + 已邀请 + 邀请全部 + 邀请新浪微博好友! + 暂时没有%1$s好友! + Ta还没有好友 + Ta还没有玩游戏 ! + + 查看 %1$s + 查看 %1$s + + + 登录 + 91社区登录 + 1秒注册 + 登录 + 通行证: + + 密码:  + + 自动登录 + 其他账号登录 + 其他账号登录 + %1$s账户登录 + 取消 + 点击这里找回 + 没有91通行证? + 1秒注册 + 已有账号登录 + 账号应为4–70个字符,限小写字母、数字、邮箱账号 + 密码应为6–12个字符,限字母、数字,区分大小写 + 支付密码不能为空 + + 注册 + 返回 + 完成 + 获取验证码 + %1$02d秒后重发验证码 + 手机注册 + 您可以使用手机号作为通行证账号,您需要使用该手机接收验证码,才能完成注册。 + 快速注册 + 您可以输入邮箱、小写字母/数字作为通行证账号,也可以使用系统为您默认分配的账号。 + 通行证: + 手机号: + 输入验证码: + 小写字母、数字、邮箱 + 昵称:  + 10字以内 + 请输入手机号 + 请输入短信验证码 + 密码:  + 限6–12个字母、数字哦 + 我已阅读并同意遵守91社区服务条款 + 91社区服务条款 + 首次注册需要发送一条注册短信,由运营商收取正常短信通讯费用不含信息费。 + 密码应为6–12个字符,限字母、数字,区分大小写 + 昵称应为10个字符以内,支持中文 + 手机号码不能为空 + 手机号码格式不正确 + 请输入密码,限6–12个字母、数字 + 密码格式错误,限6–12个字母、数字 + 请输入验证码 + 验证码错误,请重输 + 验证码失效,请重新获取 + + + 91社区服务条款 + 返回 + + + 第三方账户登录 + 返回 + + 新浪微博账户登录 + %1$s账户登录 + + 新浪微博账户登录 + 返回 + 下一步 + %1$s账户登录 + 账号: + + 密码: + + + 绑定91通行证 + 返回 + 下一步 + 已经注册过91社区 + 还未注册过91社区 + + 注册91通行证 + 返回 + 下一步 + 通行证: + 小写字母、数字、邮箱 + 密码:  + 限6–12个字母、数字哦 + 91通行证使用条款 + 91通行证(%1$s)已经绑定过%2$s账号。 + + 绑定91通行证 + 返回 + 下一步 + 通行证: + 输入91通行证 + 密码:  + + 将%1$s账户与91通行证绑定,和粉丝们一起分享,轻松畅享互动的乐趣! + 如果已经注册了91通行证,建议您输入账号进行绑定,方便与好友联系,您也可以选择“跳过”直接进入社区。 + 91通行证(%1$s)已经绑定过%2$s账号。 + 跳过 + OK!绑定91通行证 + + 分享我的成就 + + + + 更多 + 个人信息管理 + 通行证管理 + 权限设置 + 91豆充值 + 充值消费记录 + 注销 + + 个人信息管理 + 返回 + 完成 + 添加照片 + 编辑 + 姓名: + 24字以内 + 昵称: + 10字以内 + 性别: + 保密 + 生日: + 保密 + 居住地: + 保密 + 拍照 + 选取现有图片 + 取消 + + + 保密 + 昵称应为10个字符以内,支持中文 + 真实姓名不能为空 + 真实姓名应为24个字符以内 + 保存成功 + 添加\n照片 + 编辑 + 上传成功 + 本地相册 + 马上拍照 + 返回 + + 通行证管理 + 返回 + + 91通行证ID:%1$s + 自动登录 + 修改密码 + 您尚未设置密码 + 绑定第三方账号 + 绑定%1$s账户 + 绑定手机送好礼 + 绑定手机 + 绑定第三方账号 + 设置新浪微博账户登录 + 您的%1$s账号%2$s和91通行证(%3$s)成功绑定! + 您要解除绑定%1$s%2$s? + 设置%1$s账户登录 + %1$s账户登录 + 账号处于登录状态不允许解绑 + 已绑定 + 未绑定 + 立即绑定 + + 修改密码 + 返回 + 完成 + 旧密码: + + 新密码: + + 请输入原密码 + 原密码应为6–12个字符,限字母、数字,区分大小写 + 请输入新密码 + 新密码应为6–12个字符,限字母、数字,区分大小写 + 修改成功 + + 设置密码 + 密码:   + 确认密码: + 成功设置密码后,您可以使用91通行证登录 + 2次密码不一致,请重新输入 + 密码应为6–12个字符,限字母、数字,区分大小写 + 设置成功 + + 绑定 + + + 绑定失败,请重试 + + 权限设置 + 返回 + + 添加好友 + 需要验证 + 允许任何人加为好友 + 不允许任何人加为好友 + 设置成功 + 支付密码 + 91豆支付密码验证 + 支付密码,即您的登录密码或设置过的支付密码。若开启91豆支付密码验证,登录后首次购买时会验证一次支付密码。 + 为保障支付安全,请输入支付密码,未设置支付密码时输入91通行证登录密码 + 请输入支付密码 + 支付密码错误,请重输 + + 充值消费记录 + 返回 + + 充值记录 + 消费记录 + + 充值记录 + 返回 + 按月浏览 + 充值91豆 + %1$d个 + + 取消 + 完成 + %1$04d年%2$02d月 + 本月暂无充值记录! + 更多记录… + + 充值记录 + 返回 + + 订单号: + 充值时间: + 充值方式: + 充值91豆: + + 消费记录 + 返回 + + 消费91豆 + %1$s个 + 暂无消费记录! + 更多记录… + + 消费记录 + 返回 + + 订单号: + 时间: + 项目: + 物品: + 数量: + 91豆: + + 很抱歉!短信发送失败! + 恭喜您!短信发送成功! + + 个人资料 + + 备注: + + 邀请91好友 + 邀请新浪微博好友 + 输入新浪微博账号 + 输入新浪微博账号密码 + 我的消息 + 发送 + 发送成功 + 发送的消息内容不能为空,限制140个字符 + 收件人: + 内容限制140字 + 您输入的内容太长,已经超出了%1$d个字符 + 新消息 + 消息不能全部为空格或者换行字符,请重新输入 + + + 余额不足 + 确认购买 + 购买成功 + 购买失败 + 取消购买 + 您的91豆余额不足,无法购买以下商品: + 您的91豆余额不足,需要充值才能购买以下商品: + 应用名称 + 商品名称 + 所需91豆 + 充值到账后请返回重新购买。 + 91豆充值到账后自动购买该商品。 + 91豆充值 + 您的购买清单: + 请输入支付密码: + 更换账号或使用其他手机登录时,首次支付需要输入91豆支付密码。\n如果你尚未设置支付密码,可以输入你的登录密码。\n为了保证支付安全,可以通过http://mpay.91.com/?v=2,网站设置支付密码。 + 购买 + 支付与充值客服电话:%s + 您已成功购买以下商品: + 消费记录 + 确定 + 数量 + 由于订单号重复,无法购买此商品。 + 由于网络或者服务器原因,无法购买此商品。 + 支付超时,请稍后重试。 + + + 确认订单 + 购买成功 + 余额不足 + 让好友购买 + 返回 + 购买 + 下一步 + 发送 + 查看消费记录 + 充值 + 还要和Ta说下哦~ + 请求发送成功 + 请求发送失败 + 可用余额: + + 您的91豆余额不足,无法代付以下商品: + 您的代付清单: + 游戏: + 商品: + 数量: + 总价: + %1$s个91豆 + 91豆充值到账后自动购买该商品。 + 让好友购买 + 充值客服电话:%1$s + 客服电话:%1$s + 付款成功,请注意查收商品! + 您可以到消费记录查看购买的商品。 + 为了您的支付安全,请输入支付密码,若未设置支付密码请输入91通行证登录密码。 + 请设置支付密码。支付密码可作为91通行证登录密码。 + 此商品已购买过了 + 3–5分钟即可到账,等会儿吧! + 你还没有好友,快去邀请好友吧:) + + + + + 请输入验证信息(不要超过20字哦~) + + + 你好啊! + 你好!很高兴认识你,做个朋友吧。 + 石头、剪刀、布,你输了,加我吧。 + 加你为好友有肉吃,快点加我吧! + 这年头加好友还要输入验证信息,我容易嘛我。 + 给个面子吧,加人被拒99次了。 + + 删除好友 + 真的要删除这个好友吗? + + 发送信息 + 不要超过140个字哦~ + + 收件人不能为空 + + 个人资料 + 好友资料 + 查看资料 + + 邀请%s好友 + 设置备注 + 限10个字 + 备注不能为空或全空格 + + 分享成功 + 分享失败 + + 账号不能为空 + 密码不能为空 + 新浪微博 + + 不能上网啦! + 看看网络连接,或者一会再试试吧~ + + + + 你已经同意%1$s的请求! + 你已经拒绝%1$s的请求! + 该订单已经取消! + + 你在想什么呢?快点告诉大家吧! + 保密 + + 添加成功 + 等待好友验证 + 该用户拒绝您的好友添加请求 + + 我在玩%1$s, 相当好玩,赶快来玩吧~ + + 未准备存储卡,无法下载 + 下载提示 + 继续 + 下载应用失败 + 准备下载%1$s<br/>软件版本%2$s,文件大小%3$s + <br/><br/><small>文件较大,推荐您使用91手机助手下载安装(sj.91.com),节省手机流量!</small> + + 改进建议 + 问题反馈 + 请输入您的意见,我们将不断改进 + 请填写详细描述(500字以内) + 意见反馈 + %1$s(%2$s) + %1$s + 客服电话:  + 非常感谢您的支持!我们会尽快给您回复,请注意查阅91社区系统消息。 + 分享到%1$s + + + 发现新版本V%1$s。建议您使用91手机助手升级节省手机流量 + 发现新版本V%1$s/%2$s。建议您使用91手机助手升级节省手机流量 + 发现新版本V%1$s。本次更新为强制更新,请您立即升级版本,否则软件将无法正常运行! + 发现新版本V%1$s/%2$s。本次更新为强制更新,请您立即升级版本,否则软件将无法正常运行! + 发现新版本V%1$s。建议您使用91手机助手升级节省手机流量 + 发现新版本V%1$s/%2$s。建议您使用91手机助手升级节省手机流量 + 发现新版本V%1$s + 发现新版本V%1$s/%2$s + + 已下载 %1$s KB / %2$s KB + 已下载 %1$s KB / %2$s MB + 已下载 %1$s MB / %2$s MB + 正在下载 %1$s + %1$s下载完成,是否立即安装? + 确认安装 + 安装 + %1$s下载完成(点击安装) + %1$s正在下载(点击取消下载) + 已下载 %1$s/%2$s + 已下载 %1$s + + + %1$s,欢迎你回来! + 您是否需要拨打客服电话? + 拨打 + 提示 + 输入内容不能为空! + + + + + + 商城 + 暂时没有商品! + 商品单价无效 + 商品购买数量无效 + %1$s个91豆 + 原价: + 现价: + 立刻购买 + 商品详情: + 可用时长: + 可用次数: + 抢购时间: + 限  购: + 描  述: + 每个ID限购%1$d%2$s商品 + %1$s次 + 无限 + %1$d天 + 最多允许购买%1$d%2$s商品 + 最少购买1%1$s商品 + + 不要超过300个字哦~ + 邀请内容不能为空! + + 取消图片分享 + 添加\n图片 + + + 请留下电话,以便与您联系 + + 忘记密码? + 密保管理 + + 您有%1$d条新消息 + 绑定更多账号,和好友齐分享 + 分享到%1$s + 未绑定 + + 关于我们 + 91社区 + 版本 %1$s + 开发商:%1$s + 开发商: + 开发商:网龙.博远无线 + + 登录超时,请重新登录 + + + 检查更新 + 更新 + 当前版本:%1$s + 最新版本:%1$s + 版本大小:%1$s + 新版本正在下载,请到桌面的消息通知栏查看下载进度。 + + + + 今天 + 本周 + 所有时间 + %1$s,排名%2$s, 共%3$d人 + + Ta + + %1$s,排名前%2$s%%,共%3$d人 + %1$s,排名后%2$s%%,共%3$d人 + + 全部 + 好友 + + 当前为测试模式 + 发现新版本您可以更新 + 当前为最新版本,无需更新 + 当前为升级测试模式 + + 余额: + + + + 91豆 + + + %1$s个%2$s + + 充值 + %1$1.2f%2$s%3$s + %1$1.2f个91豆 + + + 通知 + 升级提示 + 立即升级 + 重要更新 + + 余额不足 + 余额不足,是否充值? + 请求订单失败 + 请设置91通行证密码,初始支付密码与91通行证密码一致 + 请输入91通行证密码 + 91通行证密码错误,请重新输入 + 超过单次购买的最大金额 + 超过单次购买的最大数量 + 超过商品的库存 + 小提示:点击好友进行选择,一次可邀请10名 + 本次邀请人数已超10人,您可以下次再邀请。 + + 新版本下载 + 是否立即下载? + 下载 + 安装包比较大,建议您使用91手机助手升级节省手机流量。 + + 重要提示 + 注销账号需重启程序,是否现在重启? + 重启 + + 邀请成功 + 连接服务器失败 + 正在登录… + + 绑定手机 + 您的账号安全级别:低 + 您尚未绑定手机,忘记密码或账号不慎被盗时将无法通过手机找回密码 + 绑定手机有惊喜,开心拿好礼 + + 请输入手机号码 + 请输入短信验证码 + 点击获取验证码 + + %1$d秒后重新获取 + 立即绑定手机 + 手机号码不能为空 + 手机号码格式不正确 + 请输入验证码 + + 绑定成功 + 我要立即参加 + 不了,我不想参加 + 温馨提示: + 1. 手机号码仅作为身份验证,我们不会收取任何费用,请放心使用。 + 2. 网龙公司承诺保障您的隐私权益,不会泄露您的手机号码。 + + 绑定手机号码保障账号安全,享受91更多贴心服务! + + 客服电话:%1$s + 您的手机将收到一条包含验证码的短信,请注意查收。 + 绑定失败 + + 91通行证%1$s已成功绑定手机%2$s恭喜您获得一次抽奖机会,机会仅此一次,快去试试手气吧! + 试试手气 + 提示: + •一个手机号码只能绑定一个帐号 + •一个帐号只能被一个手机号码绑定 + •解除绑定请到91社区进行操作 + 确定 + 账号%1$s已成功绑定手机%2$s + + + 解除绑定 + + + %1$d秒后重新获取 + 请输入手机号码 + 解除绑定 + 手机号码不能为空 + 手机号码格式不正确 + 请输入验证码 + 成功解除绑定!解除绑定后将无法享受更多贴心服务,建议您尽快再次绑定! + %1$s已绑定手机%2$s + + + 验证绑定的手机号码,快速轻松找回密码! + 手机号码未绑定无法找回密码!您可以登录91安全中心aq.91.com找回密码。 + 找回密码 + 请输入帐号 + 请输入手机号码 + 请输入短信验证码 + 点击获取验证码 + 以后绑定 + %1$d秒后重新获取 + 确定 + 请输入帐号 + 请输入您的手机号码 + 手机号格式不对,请重新输入 + 请输入收到的短信验证码 + 验证码错误,请重输 + 验证码失效,请重新获取 + 输入的手机号与绑定的手机号不一致,请重新输入 + 密码重置成功 + 未绑定手机号码的用户,可以使用电脑登录aq.91.com找回密码,或者联系91客服人工找回,客服热线:0591-87085788 + + 重置密码 + 新密码:  + 限6–12个字母、数字 + 确认密码: + 提交 + + 当前账户: + 确定付款 + + 退出支付中心 + 若商品未到账,请登录91社区“更多”进行用户反馈 + + + 分享成功啦!活动随心享,关注有惊喜。是否立即关注%1$s官方微博? + 立即关注 + 感谢您的关注 + 温馨提示: + ●注册91通行证可以更好地保存您的数据,享受更多贴心服务; + ●您也可以使用已有91通行证登录,但游客模式数据将会丢失。 + 注册91通行证 + 我已有91通行证 + + 您现在处于游客模式,为了更好地保护您的数据,请注册91通行证 + + + 注销 + 退出程序 + 您是否要注销当前账号,并使用其它账号登录? + + 清空 + + + 你好,%1$s + + + 请稍等,正在请求订单…… + 请求订单失败 + + 帐号管理 + 返回 + 编辑 + 完成 + 登录 + 删除 + + + + 推广墙 + 立即下载 + 暂时没有待推广的应用 + 获取推广墙数据失败 + 正在请求下载地址…… + 获取下载地址失败 + %1$s 下载失败 + %1$s 正在下载 + 开始下载 %1$s + %1$s 下载完成 + + diff --git a/plugin/plugins/nd91/proj.android/DependProject/src/.gitignore b/plugin/plugins/nd91/proj.android/DependProject/src/.gitignore new file mode 100644 index 0000000000..5850658e59 --- /dev/null +++ b/plugin/plugins/nd91/proj.android/DependProject/src/.gitignore @@ -0,0 +1 @@ +#empty ignore file \ No newline at end of file diff --git a/plugin/plugins/nd91/proj.android/ForManifest.xml b/plugin/plugins/nd91/proj.android/ForManifest.xml new file mode 100644 index 0000000000..657c56c22d --- /dev/null +++ b/plugin/plugins/nd91/proj.android/ForManifest.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/Javascript/CocosPlayer/proj.android/build.xml b/plugin/plugins/nd91/proj.android/build.xml similarity index 96% rename from samples/Javascript/CocosPlayer/proj.android/build.xml rename to plugin/plugins/nd91/proj.android/build.xml index a0b5e9a321..1841ed089f 100644 --- a/samples/Javascript/CocosPlayer/proj.android/build.xml +++ b/plugin/plugins/nd91/proj.android/build.xml @@ -1,5 +1,5 @@ - + - - + diff --git a/plugin/plugins/nd91/proj.android/project.properties b/plugin/plugins/nd91/proj.android/project.properties new file mode 100644 index 0000000000..9d741eed16 --- /dev/null +++ b/plugin/plugins/nd91/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 +android.library=true +android.library.reference.1=../../../protocols/proj.android diff --git a/plugin/plugins/nd91/proj.android/res/.gitignore b/plugin/plugins/nd91/proj.android/res/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugin/plugins/nd91/proj.android/sdk/NdComPlatform.jar.REMOVED.git-id b/plugin/plugins/nd91/proj.android/sdk/NdComPlatform.jar.REMOVED.git-id new file mode 100644 index 0000000000..ef7be55acd --- /dev/null +++ b/plugin/plugins/nd91/proj.android/sdk/NdComPlatform.jar.REMOVED.git-id @@ -0,0 +1 @@ +5c8912fd6b26ff821f7f36d90c210af9c3041f87 \ No newline at end of file diff --git a/plugin/plugins/nd91/proj.android/src/org/cocos2dx/plugin/IAPNd91.java b/plugin/plugins/nd91/proj.android/src/org/cocos2dx/plugin/IAPNd91.java new file mode 100644 index 0000000000..c60c1e4348 --- /dev/null +++ b/plugin/plugins/nd91/proj.android/src/org/cocos2dx/plugin/IAPNd91.java @@ -0,0 +1,256 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; +import java.util.UUID; + +import com.nd.commplatform.NdCommplatform; +import com.nd.commplatform.NdErrorCode; +import com.nd.commplatform.NdMiscCallbackListener; +import com.nd.commplatform.entry.NdAppInfo; +import com.nd.commplatform.entry.NdBuyInfo; + +import android.app.Activity; +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.util.Log; + +public class IAPNd91 implements InterfaceIAP { + + private static final String LOG_TAG = "IAPNd91"; + private static Activity mContext = null; + private static IAPNd91 mNd91 = null; + private static boolean bDebug = false; + private static Hashtable curProductInfo = null; + + protected static void LogE(String msg, Exception e) { + Log.e(LOG_TAG, msg, e); + e.printStackTrace(); + } + + protected static void LogD(String msg) { + if (bDebug) { + Log.d(LOG_TAG, msg); + } + } + + public IAPNd91(Context context) { + mContext = (Activity) context; + mNd91 = this; + } + + @Override + public void configDeveloperInfo(Hashtable cpInfo) { + LogD("initDeveloperInfo invoked " + cpInfo.toString()); + final Hashtable curCPInfo = cpInfo; + PluginWrapper.runOnMainThread(new Runnable() { + @Override + public void run() { + try { + String appId = curCPInfo.get("Nd91AppId"); + String appKey = curCPInfo.get("Nd91AppKey"); + int id = Integer.parseInt(appId); + + NdAppInfo appInfo = new NdAppInfo(); + appInfo.setCtx(mContext); + + appInfo.setAppId(id); + appInfo.setAppKey(appKey); + + NdCommplatform.getInstance().initial(0, appInfo); + + String orientation = curCPInfo.get("Nd91Orientation"); + if (null != orientation) { + if (orientation.equals("landscape")) { + NdCommplatform.getInstance().ndSetScreenOrientation(NdCommplatform.SCREEN_ORIENTATION_LANDSCAPE); + } else + if (orientation.equals("auto")) { + NdCommplatform.getInstance().ndSetScreenOrientation(NdCommplatform.SCREEN_ORIENTATION_AUTO); + } + } + } catch (Exception e) { + LogE("Developer info is wrong!", e); + } + } + }); + } + + @Override + public void payForProduct(Hashtable info) { + LogD("payForProduct invoked " + info.toString()); + if (! networkReachable()) { + payResult(IAPWrapper.PAYRESULT_FAIL, "网络不可用"); + return; + } + + curProductInfo = info; + if (curProductInfo == null) { + payResult(IAPWrapper.PAYRESULT_FAIL, "商品信息错误"); + return; + } + + PluginWrapper.runOnMainThread(new Runnable() { + @Override + public void run() { + if (! isLogin()) { + userLogin(); + } else { + addPayment(curProductInfo); + } + } + }); + } + + @Override + public void setDebugMode(boolean debug) { + bDebug = debug; + } + + @Override + public String getSDKVersion() { + return "Unknown version"; + } + + private boolean networkReachable() { + boolean bRet = false; + try { + ConnectivityManager conn = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo netInfo = conn.getActiveNetworkInfo(); + bRet = (null == netInfo) ? false : netInfo.isAvailable(); + } catch (Exception e) { + LogE("Fail to check network status", e); + } + LogD("NetWork reachable : " + bRet); + return bRet; + } + + private static void payResult(int ret, String msg) { + IAPWrapper.onPayResult(mNd91, ret, msg); + LogD("Nd91 result : " + ret + " msg : " + msg); + } + + private static String getOrderSerial() { + UUID guid = UUID.randomUUID(); + String text = guid.toString(); + text = text.replace("-", "".trim()); + return text; + } + + private static boolean isLogin() { + boolean bRet = NdCommplatform.getInstance().isLogined(); + LogD("isLogin : " + bRet); + return bRet; + } + + private static void userLogin() { + LogD("User begin login"); + try { + NdCommplatform.getInstance().ndLogin(mContext, new NdMiscCallbackListener.OnLoginProcessListener() { + @Override + public void finishLoginProcess(int code) { + if (code == NdErrorCode.ND_COM_PLATFORM_SUCCESS) { + addPayment(curProductInfo); + } else if (code == NdErrorCode.ND_COM_PLATFORM_ERROR_CANCEL) { + payResult(IAPWrapper.PAYRESULT_FAIL, "用户取消登录"); + } else { + payResult(IAPWrapper.PAYRESULT_FAIL, "用户登录失败"); + } + } + }); + } catch (Exception e) { + payResult(IAPWrapper.PAYRESULT_FAIL, "用户登录失败"); + LogE("User login error", e); + } + } + + private static void addPayment(Hashtable productInfo) { + try { + do { + String id = productInfo.get("Nd91ProductId"); + String strPrice = productInfo.get("productPrice"); + String strName = productInfo.get("productName"); + String strDesc = productInfo.get("productDesc"); + String oriPrice = productInfo.get("Nd91OriginalPrice"); + String strCount = productInfo.get("Nd91ProductCount"); + + if (id == null || id.length() == 0) { + payResult(IAPWrapper.PAYRESULT_FAIL, "商品信息错误"); + break; + } + + float price = Float.parseFloat(strPrice); + float fOriPrice = price; + if (oriPrice != null && oriPrice.length() > 0) { + fOriPrice = Float.parseFloat(oriPrice); + } + int count = 1; + if (strCount != null && strCount.length() > 0) { + count = Integer.parseInt(strCount); + } + + String serial = IAPNd91.getOrderSerial(); + NdBuyInfo order = new NdBuyInfo(); + order.setSerial(serial); + order.setProductId(id); + order.setProductName(strName); + order.setProductPrice(price); + order.setProductOrginalPrice(fOriPrice); + order.setCount(count); + order.setPayDescription(strDesc); + + int aError = NdCommplatform.getInstance().ndUniPay(order, mContext, new NdMiscCallbackListener.OnPayProcessListener() { + + @Override + public void finishPayProcess(int code) { + IAPNd91.LogD("finishPayProcess code : " + code); + switch(code){ + case NdErrorCode.ND_COM_PLATFORM_SUCCESS: + IAPNd91.payResult(IAPWrapper.PAYRESULT_SUCCESS, "购买成功"); break; + case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_FAILURE: + IAPNd91.payResult(IAPWrapper.PAYRESULT_FAIL, "购买失败"); break; + case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_CANCEL: + IAPNd91.payResult(IAPWrapper.PAYRESULT_CANCEL, "取消购买"); break; + default: + IAPNd91.payResult(IAPWrapper.PAYRESULT_FAIL, "购买失败"); break; + } + } + }); + + if (aError != 0) { + IAPNd91.payResult(IAPWrapper.PAYRESULT_FAIL, "您输入参数有错,无法提交购买请求"); + } + } while (false); + } catch (Exception e) { + LogE("Error during payment", e); + IAPNd91.payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败"); + } + } + + @Override + public String getPluginVersion() { + return "0.2.0"; + } +} diff --git a/plugin/plugins/twitter/proj.android/.classpath b/plugin/plugins/twitter/proj.android/.classpath new file mode 100755 index 0000000000..e877b82024 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/plugin/plugins/twitter/proj.android/.project b/plugin/plugins/twitter/proj.android/.project new file mode 100755 index 0000000000..a46974059c --- /dev/null +++ b/plugin/plugins/twitter/proj.android/.project @@ -0,0 +1,33 @@ + + + libPluginTwitter + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/plugin/plugins/twitter/proj.android/AndroidManifest.xml b/plugin/plugins/twitter/proj.android/AndroidManifest.xml new file mode 100755 index 0000000000..8582917b67 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/plugin/plugins/twitter/proj.android/ForManifest.xml b/plugin/plugins/twitter/proj.android/ForManifest.xml new file mode 100755 index 0000000000..00d34cd419 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/ForManifest.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugin/plugins/twitter/proj.android/build.xml b/plugin/plugins/twitter/proj.android/build.xml new file mode 100755 index 0000000000..10e9663ff5 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/build.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/plugins/twitter/proj.android/project.properties b/plugin/plugins/twitter/proj.android/project.properties new file mode 100755 index 0000000000..9d741eed16 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 +android.library=true +android.library.reference.1=../../../protocols/proj.android diff --git a/plugin/plugins/twitter/proj.android/res/.gitignore b/plugin/plugins/twitter/proj.android/res/.gitignore new file mode 100755 index 0000000000..e69de29bb2 diff --git a/plugin/plugins/twitter/proj.android/sdk/signpost-commonshttp4-1.2.1.1.jar b/plugin/plugins/twitter/proj.android/sdk/signpost-commonshttp4-1.2.1.1.jar new file mode 100755 index 0000000000..50e9838e6f Binary files /dev/null and b/plugin/plugins/twitter/proj.android/sdk/signpost-commonshttp4-1.2.1.1.jar differ diff --git a/plugin/plugins/twitter/proj.android/sdk/signpost-core-1.2.1.1.jar b/plugin/plugins/twitter/proj.android/sdk/signpost-core-1.2.1.1.jar new file mode 100755 index 0000000000..59e7537f51 Binary files /dev/null and b/plugin/plugins/twitter/proj.android/sdk/signpost-core-1.2.1.1.jar differ diff --git a/plugin/plugins/twitter/proj.android/sdk/signpost-jetty6-1.2.1.1.jar b/plugin/plugins/twitter/proj.android/sdk/signpost-jetty6-1.2.1.1.jar new file mode 100755 index 0000000000..b5d974c7ce Binary files /dev/null and b/plugin/plugins/twitter/proj.android/sdk/signpost-jetty6-1.2.1.1.jar differ diff --git a/plugin/plugins/twitter/proj.android/sdk/twitter4j-core-android-3.0.1.jar.REMOVED.git-id b/plugin/plugins/twitter/proj.android/sdk/twitter4j-core-android-3.0.1.jar.REMOVED.git-id new file mode 100644 index 0000000000..cd6a606604 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/sdk/twitter4j-core-android-3.0.1.jar.REMOVED.git-id @@ -0,0 +1 @@ +62d02b6f0d450b3b64d061280594018742ddcd27 \ No newline at end of file diff --git a/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/Consts.java b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/Consts.java new file mode 100644 index 0000000000..74b4ea8da2 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/Consts.java @@ -0,0 +1,9 @@ +package org.cocos2dx.plugin; + +public interface Consts { + public static int EGETTING_ACCESS_TOKEN =0; + public static int EUSER_CANCELED = 1; + public static int EGETTING_REQUEST_TOKEN=2; + public static int EFAILED_OPENING_AUTHORIZATION_PAGE=3; + public static int EPAGE_ERROR =4; +} diff --git a/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/SocialTwitter.java b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/SocialTwitter.java new file mode 100755 index 0000000000..b799bbd151 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/SocialTwitter.java @@ -0,0 +1,195 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; + +import org.cocos2dx.plugin.TwitterApp.TwDialogListener; + +import android.app.Activity; +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.util.Log; + +public class SocialTwitter implements InterfaceSocial { + + private static final String LOG_TAG = "SocialTwitter"; + private static Activity mContext = null; + private static InterfaceSocial mSocialAdapter = null; + protected static boolean bDebug = false; + private static String CONSUMER_KEY=""; + private static String CONSUMER_SECRET=""; + + private static TwitterApp mTwitter = null; + private static boolean isInitialized = false; + private static Hashtable mShareInfo = null; + + public static String KEY_TEXT="SharedText"; + public static String KEY_IMAGE_PATH = "SharedImagePath"; + + protected static void LogE(String msg, Exception e) { + Log.e(LOG_TAG, msg, e); + e.printStackTrace(); + } + + protected static void LogD(String msg) { + if (bDebug) { + Log.d(LOG_TAG, msg); + } + } + + public SocialTwitter(Context context) { + mContext = (Activity) context; + mSocialAdapter = this; + } + + + @Override + public void configDeveloperInfo(Hashtable cpInfo) { + LogD("initDeveloperInfo invoked " + cpInfo.toString()); + try { + SocialTwitter.CONSUMER_KEY = cpInfo.get("TwitterKey"); + SocialTwitter.CONSUMER_SECRET = cpInfo.get("TwitterSecret"); + LogD("key : " + SocialTwitter.CONSUMER_KEY); + LogD("secret : " + SocialTwitter.CONSUMER_SECRET); + if(isInitialized){ + return; + } + isInitialized = true; + PluginWrapper.runOnMainThread(new Runnable() { + + @Override + public void run() { + mTwitter = new TwitterApp(PluginWrapper.getContext(), SocialTwitter.CONSUMER_KEY, SocialTwitter.CONSUMER_SECRET); + mTwitter.setListener(mTwLoginDialogListener); + } + }); + } catch (Exception e) { + LogE("Developer info is wrong!", e); + } + + } + + @Override + public void share(Hashtable info) { + LogD("share invoked " + info.toString()); + mShareInfo = info; + if (! networkReachable()) { + shareResult(SocialWrapper.SHARERESULT_FAIL, "Network error!"); + return; + } + + if (! isInitialized) { + shareResult(SocialWrapper.SHARERESULT_FAIL, "Initialize failed!"); + return; + } + + // need login + if(!mTwitter.hasAccessToken()){ + PluginWrapper.runOnMainThread(new Runnable() { + + @Override + public void run() { + mTwitter.authorize(); + } + }); + + return; + } + + PluginWrapper.runOnMainThread(new Runnable() { + + @Override + public void run() { + SocialTwitter.sendToTwitter(); + } + }); + } + + @Override + public void setDebugMode(boolean debug) { + bDebug = debug; + } + + @Override + public String getSDKVersion() { + return "Unknown version"; + } + + private boolean networkReachable() { + boolean bRet = false; + try { + ConnectivityManager conn = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo netInfo = conn.getActiveNetworkInfo(); + bRet = (null == netInfo) ? false : netInfo.isAvailable(); + } catch (Exception e) { + LogE("Fail to check network status", e); + } + LogD("NetWork reachable : " + bRet); + return bRet; + } + + private static void shareResult(int ret, String msg) { + SocialWrapper.onShareResult(mSocialAdapter, ret, msg); + LogD("SocialTwitter result : " + ret + " msg : " + msg); + } + + private static final TwDialogListener mTwLoginDialogListener = new TwDialogListener() { + + @Override + public void onError(int flag, String value) { + LogD("Twitter connection failed!"); + shareResult(SocialWrapper.SHARERESULT_FAIL, value); + } + + @Override + public void onComplete(String value) { + SocialTwitter.sendToTwitter(); + } + }; + + private static void sendToTwitter() { + String text = mShareInfo.get(KEY_TEXT); + String imagePath = mShareInfo.get(KEY_IMAGE_PATH); + try { + if(imagePath != null && imagePath.length() > 0){ + mTwitter.updateStatus(text, imagePath); + }else{ + mTwitter.updateStatus(text); + } + LogD("Posted to Twitter!"); + shareResult(SocialWrapper.SHARERESULT_SUCCESS, "Share succeed!"); + } catch (Exception e) { + LogD("Post to Twitter failed!"); + shareResult(SocialWrapper.SHARERESULT_FAIL, "Unknown error!"); + e.printStackTrace(); + } + } + + @Override + public String getPluginVersion() { + return "0.2.0"; + } +} diff --git a/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterApp.java b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterApp.java new file mode 100755 index 0000000000..0c36337846 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterApp.java @@ -0,0 +1,235 @@ +/** + * @author Lorensius W. L. T + * + * http://www.londatiga.net + */ + +package org.cocos2dx.plugin; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLDecoder; + +import oauth.signpost.OAuthProvider; +import oauth.signpost.basic.DefaultOAuthProvider; +import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer; +import twitter4j.StatusUpdate; +import twitter4j.Twitter; +import twitter4j.TwitterException; +import twitter4j.TwitterFactory; +import twitter4j.User; +import twitter4j.auth.AccessToken; +import android.app.ProgressDialog; +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.util.Log; +import android.view.Window; + +public class TwitterApp { + private Twitter mTwitter; + private TwitterSession mSession; + private AccessToken mAccessToken; + private CommonsHttpOAuthConsumer mHttpOauthConsumer; + private OAuthProvider mHttpOauthprovider; + private String mConsumerKey; + private String mSecretKey; + private ProgressDialog mProgressDlg; + private TwDialogListener mListener; + private Context context; + private boolean mInit = true; + private static final String LOG_TAG = "TwitterApp"; + public static final String CALLBACK_URL = "twitterapp://connect"; + + protected static void LogE(String msg, Exception e) { + Log.e(LOG_TAG, msg, e); + e.printStackTrace(); + } + + protected static void LogD(String msg) { + if (SocialTwitter.bDebug) { + Log.d(LOG_TAG, msg); + } + } + + + public TwitterApp(Context context, String consumerKey, String secretKey) { + this.context = context; + + mTwitter = new TwitterFactory().getInstance(); + mSession = new TwitterSession(context); + mProgressDlg = new ProgressDialog(context); + mProgressDlg.setCancelable(false); + mProgressDlg.requestWindowFeature(Window.FEATURE_NO_TITLE); + + mConsumerKey = consumerKey; + mSecretKey = secretKey; + + mHttpOauthConsumer = new CommonsHttpOAuthConsumer(mConsumerKey, mSecretKey); + mHttpOauthprovider = new DefaultOAuthProvider("https://twitter.com/oauth/request_token", + "https://twitter.com/oauth/access_token", + "https://twitter.com/oauth/authorize"); + + mAccessToken = mSession.getAccessToken(); + + configureToken(); + } + + public void setListener(TwDialogListener listener) { + mListener = listener; + } + + private void configureToken() { + if (mAccessToken != null) { + if (mInit) { + mTwitter.setOAuthConsumer(mConsumerKey, mSecretKey); + mInit = false; + } + mTwitter.setOAuthAccessToken(mAccessToken); + } + } + + public boolean hasAccessToken() { + return (mAccessToken == null) ? false : true; + } + + public void resetAccessToken() { + if (mAccessToken != null) { + mSession.resetAccessToken(); + mAccessToken = null; + } + } + + public String getUsername() { + return mSession.getUsername(); + } + + public void updateStatus(String status) throws Exception { + try { + mTwitter.updateStatus(status); + } catch (TwitterException e) { + throw e; + } + } + + public void updateStatus(String status, String imagePath) throws Exception { + StatusUpdate update = new StatusUpdate(status); + update.setMedia(new File(imagePath)); + try { + mTwitter.updateStatus(update); + } catch (TwitterException e) { + throw e; + } + } + + public void authorize() { + mProgressDlg.setMessage("Initializing ..."); + mProgressDlg.show(); + + new Thread() { + @Override + public void run() { + String authUrl = ""; + int what = 1; + try { + authUrl = mHttpOauthprovider.retrieveRequestToken(mHttpOauthConsumer, CALLBACK_URL); + what = 0; + LogD("Request token url " + authUrl); + } catch (Exception e) { + LogD("Failed to get request token"); + e.printStackTrace(); + } + mHandler.sendMessage(mHandler.obtainMessage(what, 1, 0, authUrl)); + } + }.start(); + } + + public void processToken(String callbackUrl) { + mProgressDlg.setMessage("Finalizing ..."); + mProgressDlg.show(); + + final String verifier = getVerifier(callbackUrl); + + new Thread() { + @Override + public void run() { + int what = 1; + try { + mHttpOauthprovider.retrieveAccessToken(mHttpOauthConsumer, verifier); + mAccessToken = new AccessToken(mHttpOauthConsumer.getToken(), mHttpOauthConsumer.getTokenSecret()); + configureToken(); + User user = mTwitter.verifyCredentials(); + mSession.storeAccessToken(mAccessToken, user.getName()); + what = 0; + } catch (Exception e){ + LogD("Error getting access token"); + e.printStackTrace(); + } + mHandler.sendMessage(mHandler.obtainMessage(what, 2, 0)); + } + }.start(); + } + + private String getVerifier(String callbackUrl) { + String verifier = ""; + try { + callbackUrl = callbackUrl.replace("twitterapp", "http"); + URL url = new URL(callbackUrl); + String query = url.getQuery(); + String array[] = query.split("&"); + for (String parameter : array) { + String v[] = parameter.split("="); + if (URLDecoder.decode(v[0]).equals(oauth.signpost.OAuth.OAUTH_VERIFIER)) { + verifier = URLDecoder.decode(v[1]); + break; + } + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } + return verifier; + } + + private void showLoginDialog(String url) { + final TwDialogListener listener = new TwDialogListener() { + @Override + public void onComplete(String value) { + processToken(value); + } + + @Override + public void onError(int flag, String value) { + mListener.onError(Consts.EFAILED_OPENING_AUTHORIZATION_PAGE, "Failed opening authorization page"); + } + }; + + new TwitterDialog(context, url, listener).show(); + } + + private Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + mProgressDlg.dismiss(); + + if (msg.what == 1) { + if (msg.arg1 == 1) + mListener.onError(Consts.EGETTING_REQUEST_TOKEN, "Error getting request token"); + else + mListener.onError(Consts.EGETTING_ACCESS_TOKEN, "Error getting access token"); + }else { + if (msg.arg1 == 1) + showLoginDialog((String) msg.obj); + else + mListener.onComplete(""); + } + } + }; + + public interface TwDialogListener { + public void onComplete(String value); + + public void onError(int flag, String value); + } + +} \ No newline at end of file diff --git a/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterDialog.java b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterDialog.java new file mode 100755 index 0000000000..68303860a6 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterDialog.java @@ -0,0 +1,182 @@ +/** + * Modified from FbDialog from Facebook SDK + * + * Lorensius W. L. T + */ +package org.cocos2dx.plugin; + +import org.cocos2dx.plugin.TwitterApp.TwDialogListener; + +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Bitmap; +import android.graphics.Color; +import android.graphics.Typeface; +import android.os.Bundle; +import android.util.Log; +import android.view.Display; +import android.view.ViewGroup; +import android.view.Window; +import android.webkit.CookieManager; +import android.webkit.CookieSyncManager; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.TextView; + +public class TwitterDialog extends Dialog { + static final FrameLayout.LayoutParams FILL = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.FILL_PARENT); + static final int MARGIN = 4; + static final int PADDING = 2; + + private String mUrl; + private TwDialogListener mListener; + private ProgressDialog mSpinner; + private WebView mWebView; + private LinearLayout mContent; + private TextView mTitle; + + private static final String LOG_TAG = "Twitter-WebView"; + + protected static void LogD(String msg) { + if (SocialTwitter.bDebug) { + Log.d(LOG_TAG, msg); + } + } + public TwitterDialog(Context context, String url, TwDialogListener listener) { + super(context); + + mUrl = url; + mListener = listener; + setOnCancelListener(mCancelListener); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mSpinner = new ProgressDialog(getContext()); + + mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); + mSpinner.setMessage("Loading..."); + mSpinner.setCancelable(false); + + mContent = new LinearLayout(getContext()); + + mContent.setOrientation(LinearLayout.VERTICAL); + + setUpTitle(); + setUpWebView(); + + Display display = getWindow().getWindowManager().getDefaultDisplay(); + double[] dimensions = new double[2]; + + if (display.getWidth() < display.getHeight()) { + dimensions[0] = 0.87 * display.getWidth(); + dimensions[1] = 0.82 * display.getHeight(); + } else { + dimensions[0] = 0.75 * display.getWidth(); + dimensions[1] = 0.75 * display.getHeight(); + } + + addContentView(mContent, new FrameLayout.LayoutParams((int) dimensions[0], (int) dimensions[1])); + } + + private void setUpTitle() { + requestWindowFeature(Window.FEATURE_NO_TITLE); + + // Drawable icon = getContext().getResources().getDrawable(R.drawable.twitter_icon); + + mTitle = new TextView(getContext()); + + mTitle.setText("Twitter"); + mTitle.setTextColor(Color.WHITE); + mTitle.setTypeface(Typeface.DEFAULT_BOLD); + mTitle.setBackgroundColor(0xFFbbd7e9); + mTitle.setPadding(MARGIN + PADDING, MARGIN, MARGIN, MARGIN); + mTitle.setCompoundDrawablePadding(MARGIN + PADDING); + // mTitle.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); + mTitle.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); + + mContent.addView(mTitle); + } + + private void setUpWebView() { + CookieSyncManager.createInstance(getContext()); + CookieManager cookieManager = CookieManager.getInstance(); + cookieManager.removeAllCookie(); + + mWebView = new WebView(getContext()); + + mWebView.setVerticalScrollBarEnabled(false); + mWebView.setHorizontalScrollBarEnabled(false); + mWebView.setWebViewClient(new TwitterWebViewClient()); + mWebView.getSettings().setJavaScriptEnabled(true); + mWebView.loadUrl(mUrl); + mWebView.setLayoutParams(FILL); + + + mContent.addView(mWebView); + } + + private class TwitterWebViewClient extends WebViewClient { + + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + LogD("Redirecting URL " + url); + + if (url.startsWith(TwitterApp.CALLBACK_URL)) { + mListener.onComplete(url); + + TwitterDialog.this.dismiss(); + + return true; + } else if (url.startsWith("authorize")) { + return false; + } + + return true; + } + + @Override + public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { + LogD("Page error: " + description); + + super.onReceivedError(view, errorCode, description, failingUrl); + + mListener.onError(Consts.EPAGE_ERROR, description); + + TwitterDialog.this.dismiss(); + } + + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + LogD("Loading URL: " + url); + super.onPageStarted(view, url, favicon); + mSpinner.show(); + } + + @Override + public void onPageFinished(WebView view, String url) { + super.onPageFinished(view, url); + String title = mWebView.getTitle(); + if (title != null && title.length() > 0) { + mTitle.setText(title); + } + mSpinner.dismiss(); + } + } + + private DialogInterface.OnCancelListener mCancelListener = new OnCancelListener() { + + @Override + public void onCancel(DialogInterface dialog) { + mSpinner.dismiss(); + mListener.onError(Consts.EUSER_CANCELED, "User canceled!"); + } + }; +} diff --git a/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterSession.java b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterSession.java new file mode 100755 index 0000000000..df31682937 --- /dev/null +++ b/plugin/plugins/twitter/proj.android/src/org/cocos2dx/plugin/TwitterSession.java @@ -0,0 +1,56 @@ +/** + * @author Lorensius W. L. T + * + * http://www.londatiga.net + */ +package org.cocos2dx.plugin; + +import twitter4j.auth.AccessToken; +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; + +public class TwitterSession { + private SharedPreferences sharedPref; + private Editor editor; + + private static final String TWEET_AUTH_KEY = "auth_key"; + private static final String TWEET_AUTH_SECRET_KEY = "auth_secret_key"; + private static final String TWEET_USER_NAME = "user_name"; + private static final String SHARED = "Twitter_Preferences"; + + public TwitterSession(Context context) { + sharedPref = context.getSharedPreferences(SHARED, Context.MODE_PRIVATE); + editor = sharedPref.edit(); + } + + public void storeAccessToken(AccessToken accessToken, String username) { + editor.putString(TWEET_AUTH_KEY, accessToken.getToken()); + editor.putString(TWEET_AUTH_SECRET_KEY, accessToken.getTokenSecret()); + editor.putString(TWEET_USER_NAME, username); + + editor.commit(); + } + + public void resetAccessToken() { + editor.putString(TWEET_AUTH_KEY, null); + editor.putString(TWEET_AUTH_SECRET_KEY, null); + editor.putString(TWEET_USER_NAME, null); + + editor.commit(); + } + + public String getUsername() { + return sharedPref.getString(TWEET_USER_NAME, ""); + } + + public AccessToken getAccessToken() { + String token = sharedPref.getString(TWEET_AUTH_KEY, null); + String tokenSecret = sharedPref.getString(TWEET_AUTH_SECRET_KEY, null); + + if (token != null && tokenSecret != null) + return new AccessToken(token, tokenSecret); + else + return null; + } +} diff --git a/plugin/plugins/umeng/proj.android/.classpath b/plugin/plugins/umeng/proj.android/.classpath new file mode 100644 index 0000000000..0db6ec03de --- /dev/null +++ b/plugin/plugins/umeng/proj.android/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/plugin/plugins/umeng/proj.android/.project b/plugin/plugins/umeng/proj.android/.project new file mode 100644 index 0000000000..21bd34bcab --- /dev/null +++ b/plugin/plugins/umeng/proj.android/.project @@ -0,0 +1,33 @@ + + + libPluginUmeng + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/plugin/plugins/umeng/proj.android/AndroidManifest.xml b/plugin/plugins/umeng/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..854add8fe4 --- /dev/null +++ b/plugin/plugins/umeng/proj.android/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/plugin/plugins/umeng/proj.android/ForManifest.xml b/plugin/plugins/umeng/proj.android/ForManifest.xml new file mode 100644 index 0000000000..919eac2cdf --- /dev/null +++ b/plugin/plugins/umeng/proj.android/ForManifest.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugin/plugins/umeng/proj.android/build.xml b/plugin/plugins/umeng/proj.android/build.xml new file mode 100644 index 0000000000..3772a508b8 --- /dev/null +++ b/plugin/plugins/umeng/proj.android/build.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/plugins/umeng/proj.android/project.properties b/plugin/plugins/umeng/proj.android/project.properties new file mode 100644 index 0000000000..9d741eed16 --- /dev/null +++ b/plugin/plugins/umeng/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 +android.library=true +android.library.reference.1=../../../protocols/proj.android diff --git a/plugin/plugins/umeng/proj.android/res/.gitignore b/plugin/plugins/umeng/proj.android/res/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugin/plugins/umeng/proj.android/sdk/umeng_sdk.jar.REMOVED.git-id b/plugin/plugins/umeng/proj.android/sdk/umeng_sdk.jar.REMOVED.git-id new file mode 100644 index 0000000000..0e3625cc6e --- /dev/null +++ b/plugin/plugins/umeng/proj.android/sdk/umeng_sdk.jar.REMOVED.git-id @@ -0,0 +1 @@ +ac5e2e30a4c3ff07611e9c6260eaff84bf644135 \ No newline at end of file diff --git a/plugin/plugins/umeng/proj.android/src/org/cocos2dx/plugin/AnalyticsUmeng.java b/plugin/plugins/umeng/proj.android/src/org/cocos2dx/plugin/AnalyticsUmeng.java new file mode 100644 index 0000000000..058fc0b434 --- /dev/null +++ b/plugin/plugins/umeng/proj.android/src/org/cocos2dx/plugin/AnalyticsUmeng.java @@ -0,0 +1,300 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; + +import org.json.JSONObject; + +import android.content.Context; +import android.util.Log; + +import com.umeng.analytics.MobclickAgent; + +public class AnalyticsUmeng implements InterfaceAnalytics{ + + private Context mContext = null; + + protected static String TAG = "AnalyticsUmeng"; + + protected static void LogE(String msg, Exception e) { + Log.e(TAG, msg, e); + e.printStackTrace(); + } + + private static boolean isDebug = true; + protected static void LogD(String msg) { + if (isDebug) { + Log.d(TAG, msg); + } + } + + public AnalyticsUmeng(Context context) { + mContext = context; + MobclickAgent.setWrapper("Cocos2d-x", "1.0"); + } + + public boolean isValid() { + return mContext != null; + } + @Override + public void startSession(String appKey) { + LogD("startSession invoked!"); + MobclickAgent.onResume(mContext); + } + + @Override + public void stopSession() { + LogD("stopSession invoked!"); + MobclickAgent.onPause(mContext); + } + + @Override + public void setSessionContinueMillis(int millis) { + LogD("setSessionContinueMillis invoked!"); + MobclickAgent.setSessionContinueMillis(millis); + } + + @Override + public void setCaptureUncaughtException(boolean isEnabled) { + LogD("setCaptureUncaughtException invoked!"); + if (isEnabled) { + MobclickAgent.onError(mContext); + } + } + + @Override + public void setDebugMode(boolean isDebugMode) { + isDebug = isDebugMode; + MobclickAgent.setDebugMode(isDebugMode); + } + + @Override + public void logError(String errorId, String message) { + LogD("logError invoked!"); + MobclickAgent.reportError(mContext, message); + } + + @Override + public void logEvent(String eventId) { + LogD("logEvent(" + eventId + ") invoked!"); + MobclickAgent.onEvent(mContext, eventId); + } + + @Override + public void logEvent(String eventId, Hashtable paramMap) { + LogD("logEvent(" + eventId + "," + paramMap.toString() + ") invoked!"); + HashMap curParam = changeTableToMap(paramMap); + MobclickAgent.onEvent(mContext, eventId, curParam); + } + + @Override + public void logTimedEventBegin(String eventId) { + LogD("logTimedEventBegin(" + eventId + ") invoked!"); + MobclickAgent.onEventBegin(mContext, eventId); + } + + @Override + public void logTimedEventEnd(String eventId) { + LogD("logTimedEventEnd(" + eventId + ") invoked!"); + MobclickAgent.onEventEnd(mContext, eventId); + } + + @Override + public String getSDKVersion() { + LogD("getSDKVersion invoked!"); + return "UMeng no version info"; + } + + protected String getConfigParams(String key) { + LogD("getConfigParams(" + key + ") invoked!"); + if (!isValid()) return null; + String ret = ""; + try{ + ret = MobclickAgent.getConfigParams(mContext, key); + } catch(Exception e){ + LogE("Exception in logTimedEventBegin", e); + } + LogD("get config : " + ret); + return ret; + } + + protected void updateOnlineConfig() { + LogD("updateOnlineConfig invoked!"); + if (!isValid()) return; + try{ + MobclickAgent.updateOnlineConfig(mContext); + } catch(Exception e){ + LogE("Exception in updateOnlineConfig", e); + } + } + + protected void logEventWithLabel(JSONObject eventInfo) { + LogD("logEventWithLabel invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + String label = eventInfo.getString("Param2"); + MobclickAgent.onEvent(mContext, eventId, label); + } catch(Exception e){ + LogE("Exception in logEventWithLabel", e); + } + } + + protected void logEventWithDurationLabel(JSONObject eventInfo) { + LogD("logEventWithDurationLabel invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try { + String eventId = eventInfo.getString("Param1"); + int duration = eventInfo.getInt("Param2"); + if (eventInfo.has("Param3")) { + String label = eventInfo.getString("Param3"); + MobclickAgent.onEventDuration(mContext, eventId, label, duration); + } else { + MobclickAgent.onEventDuration(mContext, eventId, duration); + } + } catch (Exception e) { + LogE("Exception in logEventWithDurationLabel", e); + } + } + + protected void logEventWithDurationParams(JSONObject eventInfo) { + LogD("logEventWithDurationParams invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try { + String eventId = eventInfo.getString("Param1"); + int duration = eventInfo.getInt("Param2"); + if (eventInfo.has("Param3")) { + JSONObject params = eventInfo.getJSONObject("Param3"); + HashMap curMap = getMapFromJson(params); + MobclickAgent.onEventDuration(mContext, eventId, curMap, duration); + } else { + MobclickAgent.onEventDuration(mContext, eventId, duration); + } + } catch (Exception e) { + LogE("Exception in logEventWithDurationParams", e); + } + } + + protected void logEventWithDuration(JSONObject eventInfo) { + LogD("logEventWithDuration invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + int duration = eventInfo.getInt("Param2"); + MobclickAgent.onEventDuration(mContext, eventId, duration); + } catch(Exception e){ + LogE("Exception in logEventWithDuration", e); + } + } + + protected void logTimedEventWithLabelBegin(JSONObject eventInfo) { + LogD("logTimedEventWithLabelBegin invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + String label = eventInfo.getString("Param2"); + MobclickAgent.onEventBegin(mContext, eventId, label); + } catch(Exception e){ + LogE("Exception in logTimedEventWithLabelBegin", e); + } + } + + protected void logTimedEventWithLabelEnd(JSONObject eventInfo) { + LogD("logTimedEventWithLabelEnd invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + String label = eventInfo.getString("Param2"); + MobclickAgent.onEventEnd(mContext, eventId, label); + } catch(Exception e){ + LogE("Exception in logTimedEventWithLabelEnd", e); + } + } + + protected void logTimedKVEventBegin(JSONObject eventInfo) { + LogD("logTimedKVEventBegin invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + String label = eventInfo.getString("Param2"); + JSONObject params = eventInfo.getJSONObject("Param3"); + + if (params != null) { + HashMap curMap = getMapFromJson(params); + MobclickAgent.onKVEventBegin(mContext, eventId, curMap, label); + } + } catch(Exception e){ + LogE("Exception in logTimedKVEventBegin", e); + } + } + + protected void logTimedKVEventEnd(JSONObject eventInfo) { + LogD("logTimedKVEventEnd invoked! event : " + eventInfo.toString()); + if (!isValid()) return; + try{ + String eventId = eventInfo.getString("Param1"); + String label = eventInfo.getString("Param2"); + MobclickAgent.onKVEventEnd(mContext, eventId, label); + } catch(Exception e){ + LogE("Exception in logTimedKVEventEnd", e); + } + } + + private HashMap changeTableToMap(Hashtable param) { + HashMap retParam = new HashMap(); + for(Iterator it = param.keySet().iterator(); it.hasNext(); ) { + String key = it.next(); + String value = param.get(key); + + retParam.put(key, value); + } + + return retParam; + } + + private HashMap getMapFromJson(JSONObject json) { + HashMap curMap = new HashMap(); + try { + @SuppressWarnings("rawtypes") + Iterator it = json.keys(); + while (it.hasNext()) { + String key = (String) it.next(); + String value = json.getString(key); + curMap.put(key, value); + } + } catch (Exception e) { + LogE("Error when get HashMap from JSONObject", e); + } + + return curMap; + } + + @Override + public String getPluginVersion() { + return "0.2.0"; + } +} diff --git a/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.h b/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.h new file mode 100644 index 0000000000..5f4cfa1cf9 --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.h @@ -0,0 +1,131 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#import "InterfaceAnalytics.h" + +@interface AnalyticsUmeng : NSObject +{ +} + +@property BOOL debug; + +/** + interfaces of protocol : InterfaceAnalytics + */ +- (void) startSession: (NSString*) appKey; +- (void) stopSession; +- (void) setSessionContinueMillis: (long) millis; +- (void) setCaptureUncaughtException: (BOOL) isEnabled; +- (void) setDebugMode: (BOOL) isDebugMode; +- (void) logError: (NSString*) errorId withMsg:(NSString*) message; +- (void) logEvent: (NSString*) eventId; +- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap; +- (void) logTimedEventBegin: (NSString*) eventId; +- (void) logTimedEventEnd: (NSString*) eventId; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +/** + interfaces of umeng SDK + */ +- (void) updateOnlineConfig; +- (NSString*) getConfigParams: (NSString*) key; + +/** + @brief logEvent with label. + @param params The dictionary include eventId & label + get eventId with key 'Param1' from dictionary + get label with key 'Param2' from dictionary + */ +- (void) logEventWithLabel: (NSMutableDictionary*) params; + +/** + @brief logEvent with duration. + @param params The dictionary include eventId & duration + get eventId with key 'Param1' from dictionary + get duration with key 'Param2' from dictionary + */ +- (void) logEventWithDuration: (NSMutableDictionary*) params; + +/** + @brief logEvent with duration & label. + @param params The dictionary include eventId & duration & label + get eventId with key 'Param1' from dictionary + get duration with key 'Param2' from dictionary + get label with key 'Param3' from dictionary + */ +- (void) logEventWithDurationLabel: (NSMutableDictionary*) params; + +/** + @brief logEvent with duration & attributes. + @param params The dictionary include eventId & duration & attributes + get eventId with key 'Param1' from dictionary + get duration with key 'Param2' from dictionary + get attributes with key 'Param3' from dictionary + */ +- (void) logEventWithDurationParams: (NSMutableDictionary*) params; + +/** + @brief log timed event begin with label. + @param params The dictionary include eventId & label + get eventId with key 'Param1' from dictionary + get label with key 'Param2' from dictionary + */ +- (void) logTimedEventWithLabelBegin: (NSMutableDictionary*) params; + +/** + @brief log timed event end with label. + @param params The dictionary include eventId & label + get eventId with key 'Param1' from dictionary + get label with key 'Param2' from dictionary + */ +- (void) logTimedEventWithLabelEnd: (NSMutableDictionary*) params; + +/** + @brief log timed KV event with label & attributes. + @param params The dictionary include eventId & label & attributes + get eventId with key 'Param1' from dictionary + get label with key 'Param2' from dictionary + get attributes with key 'Param3' from dictionary + */ +- (void) logTimedKVEventBegin: (NSMutableDictionary*) params; + +/** + @brief log timed KV event end with label. + @param params The dictionary include eventId & label + get eventId with key 'Param1' from dictionary + get label with key 'Param2' from dictionary + */ +- (void) logTimedKVEventEnd: (NSMutableDictionary*) params; + +/** + @brief start session with policy & channelId. + @param params The dictionary include appKey & policy & channelId + get appKey with key 'Param1' from dictionary + get policy(NSNumber*) with key 'Param2' from dictionary + get channelId with key 'Param3' from dictionary + */ +- (void) startSessionWithParams: (NSMutableDictionary*) params; +- (void) checkUpdate; + +@end diff --git a/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.m b/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.m new file mode 100644 index 0000000000..7805586e6b --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/AnalyticsUmeng.m @@ -0,0 +1,236 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#import "AnalyticsUmeng.h" +#import "MobClick.h" + +#define OUTPUT_LOG(...) if (self.debug) NSLog(__VA_ARGS__); + +@implementation AnalyticsUmeng + +@synthesize debug = __debug; + +- (void) startSession: (NSString*) appKey +{ + OUTPUT_LOG(@"Umeng startSession invoked"); + [[MobClick class] performSelector:@selector(setWrapperType:wrapperVersion:) withObject:@"Cocos2d-x" withObject:@"1.0"]; + [MobClick startWithAppkey:appKey]; +} + +- (void) stopSession +{ + OUTPUT_LOG(@"Umeng stopSession in umeng not available on iOS"); +} + +- (void) setSessionContinueMillis: (long) millis +{ + OUTPUT_LOG(@"Umeng setSessionContinueMillis in umeng not available on iOS"); +} + +- (void) setCaptureUncaughtException: (BOOL) isEnabled +{ + OUTPUT_LOG(@"Umeng setCaptureUncaughtException invoked"); + [MobClick setCrashReportEnabled:isEnabled]; +} + +- (void) setDebugMode: (BOOL) isDebugMode +{ + OUTPUT_LOG(@"Umeng setDebugMode invoked"); + self.debug = isDebugMode; + [MobClick setLogEnabled:isDebugMode]; +} + +- (void) logError: (NSString*) errorId withMsg:(NSString*) message +{ + OUTPUT_LOG(@"logError in umeng not available on iOS"); +} + +- (void) logEvent: (NSString*) eventId +{ + OUTPUT_LOG(@"Umeng logEvent invoked"); + [MobClick event:eventId]; +} + +- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap +{ + OUTPUT_LOG(@"Umeng logEventWithParam invoked"); + [MobClick event:eventId attributes:paramMap]; +} + +- (void) logTimedEventBegin: (NSString*) eventId +{ + OUTPUT_LOG(@"Umeng logTimedEventBegin invoked"); + [MobClick beginEvent:eventId]; +} + +- (void) logTimedEventEnd: (NSString*) eventId +{ + OUTPUT_LOG(@"Umeng logTimedEventEnd invoked"); + [MobClick endEvent:eventId]; +} + +- (NSString*) getSDKVersion +{ + return @"2.2.0"; +} + +- (NSString*) getPluginVersion +{ + return @"0.2.0"; +} + +- (void) updateOnlineConfig +{ + OUTPUT_LOG(@"Umeng updateOnlineConfig invoked"); + [MobClick updateOnlineConfig]; +} + +- (NSString*) getConfigParams: (NSString*) key +{ + OUTPUT_LOG(@"Umeng getConfigParams invoked (%@)", key); + return [MobClick getConfigParams:key]; +} + +- (void) logEventWithLabel: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logEventWithLabel invoked (%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSString* label = (NSString*) [params objectForKey:@"Param2"]; + if (label) { + [MobClick event:eventId label:label]; + } else { + [MobClick event:eventId]; + } +} + +- (void) logEventWithDuration: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logEventWithDuration invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSNumber* duration = (NSNumber*) [params objectForKey:@"Param2"]; + long numDur = [duration longValue]; + [MobClick event:eventId durations:numDur]; +} + +- (void) logEventWithDurationLabel:(NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logEventWithDurationLabel invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSNumber* duration = (NSNumber*) [params objectForKey:@"Param2"]; + NSString* label = (NSString*) [params objectForKey:@"Param3"]; + long numDur = [duration longValue]; + + if (! label) { + [MobClick event:eventId durations:numDur]; + } else { + [MobClick event:eventId label:label durations:numDur]; + } +} + +- (void) logEventWithDurationParams: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logEventWithDurationParams invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSNumber* duration = (NSNumber*) [params objectForKey:@"Param2"]; + NSMutableDictionary* paramMap = (NSMutableDictionary*) [params objectForKey:@"Param3"]; + long numDur = [duration longValue]; + + if (! paramMap) { + [MobClick event:eventId durations:numDur]; + } else { + [MobClick event:eventId attributes:paramMap durations:numDur]; + } +} + +- (void) logTimedEventWithLabelBegin: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logTimedEventWithLabelBegin invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSString* label = (NSString*) [params objectForKey:@"Param2"]; + + if (! label) { + [MobClick beginEvent:eventId]; + } else { + [MobClick beginEvent:eventId label:label]; + } +} + +- (void) logTimedEventWithLabelEnd: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logTimedEventWithLabelEnd invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSString* label = (NSString*) [params objectForKey:@"Param2"]; + + if (! label) { + [MobClick endEvent:eventId]; + } else { + [MobClick endEvent:eventId label:label]; + } +} + +- (void) logTimedKVEventBegin: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logTimedKVEventBegin invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSString* label = (NSString*) [params objectForKey:@"Param2"]; + NSMutableDictionary* paramMap = (NSMutableDictionary*) [params objectForKey:@"Param3"]; + + if (! label || ! paramMap) { + [MobClick beginEvent:eventId]; + } else { + [MobClick beginEvent:eventId primarykey:label attributes:paramMap]; + } +} + +- (void) logTimedKVEventEnd: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng logTimedKVEventEnd invoked(%@)", [params debugDescription]); + NSString* eventId = (NSString*) [params objectForKey:@"Param1"]; + NSString* label = (NSString*) [params objectForKey:@"Param2"]; + + if (! label) { + [MobClick endEvent:eventId]; + } else { + [MobClick endEvent:eventId primarykey:label]; + } +} + +- (void) startSessionWithParams: (NSMutableDictionary*) params +{ + OUTPUT_LOG(@"Umeng startSessionWithParams invoked(%@)", [params debugDescription]); + NSString* appKey = (NSString*) [params objectForKey:@"Param1"]; + NSNumber* policy = (NSNumber*) [params objectForKey:@"Param2"]; + NSString* channelId = (NSString*) [params objectForKey:@"Param3"]; + + int nPolicy = [policy intValue]; + [[MobClick class] performSelector:@selector(setWrapperType:wrapperVersion:) withObject:@"Cocos2d-x" withObject:@"1.0"]; + [MobClick startWithAppkey:appKey reportPolicy:(ReportPolicy)nPolicy channelId:channelId]; +} + +- (void) checkUpdate +{ + OUTPUT_LOG(@"Umeng checkUpdate invoked"); + [MobClick checkUpdate]; +} + +@end diff --git a/plugin/plugins/umeng/proj.ios/MobClick.h b/plugin/plugins/umeng/proj.ios/MobClick.h new file mode 100644 index 0000000000..5d6b9929a4 --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/MobClick.h @@ -0,0 +1,351 @@ +// +// MobClick.h +// MobClick +// +// Created by Aladdin on 2010-03-25. +// Updated by Minghua on 2013-04-01. +// Copyright 2010-2012 Umeng.com . All rights reserved. +// Version 2.2.0.OpenUDID, updated_at 2013-04-01. + +#import +#import + +#define UMOnlineConfigDidFinishedNotification @"OnlineConfigDidFinishedNotification" +#define XcodeAppVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] + +typedef enum { + REALTIME = 0, //实时发送 + BATCH = 1, //启动发送 + SENDDAILY = 4, //每日发送 + SENDWIFIONLY = 5, //仅在WIFI下启动时发送 + SEND_INTERVAL = 6, //按最小间隔发送 + SEND_ON_EXIT = 7 //退出或进入后台时发送 +} ReportPolicy; + +@protocol MobClickDelegate; +@class CLLocation; + +/** MobClick是统计的核心类,本身不需要实例化,所有方法以类方法的形式提供. + 目前发送策略有REALTIME,BATCH,SENDDAILY,SENDWIFIONLY,SEND_INTERVAL,SEND_ON_EXIT。 + 其中REALTIME,SENDWIFIONLY 只在模拟器和DEBUG模式下生效,真机release模式会自动改成BATCH。 + 关于发送策略的调整,请参见关于发送策略及发送策略变更的说明 + http://blog.umeng.com/index.php/2012/12/0601/ + SEND_INTERVAL 为按最小间隔发送,默认为10秒,取值范围为10 到 86400(一天), 如果不在这个区间的话,会按10设置。 + SEND_ON_EXIT 为退出或进入后台时发送,这种发送策略在App运行过程中不发送,对开发者和用户的影响最小。 + 不过这种发送策略只在iOS > 4.0时才会生效, iOS < 4.0 会被自动调整为BATCH。 + + */ +@interface MobClick : NSObject { +@private + id _internal; +} +#pragma mark basics + +///--------------------------------------------------------------------------------------- +/// @name 设置 +///--------------------------------------------------------------------------------------- + +/** 设置app版本号。由于历史原因需要和xcode3工程兼容,友盟提取的是Build号(CFBundleVersion),如果需要和App Store上的版本一致,需要调用此方法。 + + @param appVersion 版本号,例如设置成`XcodeAppVersion`. + @return void. +*/ ++ (void)setAppVersion:(NSString *)appVersion; + + +/** 开启CrashReport收集, 默认是开启状态. + + @param value 设置成NO,就可以关闭友盟CrashReport收集. + @return void. +*/ ++ (void)setCrashReportEnabled:(BOOL)value; + + +/** 设置是否打印sdk的log信息,默认不开启 + @param value 设置为YES,umeng SDK 会输出log信息,记得release产品时要设置回NO. + @return . + @exception . + */ + ++ (void)setLogEnabled:(BOOL)value; + + +///--------------------------------------------------------------------------------------- +/// @name 开启统计 +///--------------------------------------------------------------------------------------- + + +/** 开启友盟统计,默认以BATCH方式发送log. + + @param appKey 友盟appKey. + @param reportPolicy 发送策略. + @param channelId 渠道名称,为nil或@""时,默认会被被当作@"App Store"渠道 + @return void +*/ ++ (void)startWithAppkey:(NSString *)appKey; ++ (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid; + +/** 当reportPolicy == SEND_INTERVAL 时设定log发送间隔 + + @param second 单位为秒,最小为10,最大为86400(一天). + @return void. +*/ + ++ (void)setLogSendInterval:(double)second; + + +///--------------------------------------------------------------------------------------- +/// @name 页面计时 +///--------------------------------------------------------------------------------------- + + +/** 页面时长统计,记录某个view被打开多长时间,可以自己计时也可以调用beginLogPageView,endLogPageView自动计时 + + @param pageName 需要记录时长的view名称. + @param seconds 秒数,int型. + @return void. +*/ + ++ (void)logPageView:(NSString *)pageName seconds:(int)seconds; ++ (void)beginLogPageView:(NSString *)pageName; ++ (void)endLogPageView:(NSString *)pageName; + +#pragma mark event logs + + +///--------------------------------------------------------------------------------------- +/// @name 事件统计 +///--------------------------------------------------------------------------------------- + + +/** 自定义事件,数量统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID + + @param eventId 网站上注册的事件Id. + @param label 分类标签。不同的标签会分别进行统计,方便同一事件的不同标签的对比,为nil或空字符串时后台会生成和eventId同名的标签. + @param accumulation 累加值。为减少网络交互,可以自行对某一事件ID的某一分类标签进行累加,再传入次数作为参数。 + @return void. + */ ++ (void)event:(NSString *)eventId; //等同于 event:eventId label:eventId; +/** 自定义事件,数量统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID + */ ++ (void)event:(NSString *)eventId label:(NSString *)label; // label为nil或@""时,等同于 event:eventId label:eventId; +/** 自定义事件,数量统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID + */ ++ (void)event:(NSString *)eventId acc:(NSInteger)accumulation; +/** 自定义事件,数量统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID + */ ++ (void)event:(NSString *)eventId label:(NSString *)label acc:(NSInteger)accumulation; +/** 自定义事件,数量统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID + */ ++ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes; + +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + beginEvent,endEvent要配对使用,也可以自己计时后通过durations参数传递进来 + + @param eventId 网站上注册的事件Id. + @param label 分类标签。不同的标签会分别进行统计,方便同一事件的不同标签的对比,为nil或空字符串时后台会生成和eventId同名的标签. + @param primarykey 这个参数用于和event_id一起标示一个唯一事件,并不会被统计;对于同一个事件在beginEvent和endEvent 中要传递相同的eventId 和 primarykey + @param millisecond 自己计时需要的话需要传毫秒进来 + @return void. + + + @warning 每个event的attributes不能超过10个 + eventId、attributes中key和value都不能使用空格和特殊字符,eventId、attributes的key最大为128个bytes(128个英文及数字或42个左右汉字)。label、attributes的value最大为256个bytes(256个英文及数字或84个左右汉字), + 超过后将被截短。其中eventId超过的将抛弃不再发送。 + id, ts, du是保留字段,不能作为eventId及key的名称 + +*/ ++ (void)beginEvent:(NSString *)eventId; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ ++ (void)endEvent:(NSString *)eventId; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)beginEvent:(NSString *)eventId label:(NSString *)label; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)endEvent:(NSString *)eventId label:(NSString *)label; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)beginEvent:(NSString *)eventId primarykey :(NSString *)keyName attributes:(NSDictionary *)attributes; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)endEvent:(NSString *)eventId primarykey:(NSString *)keyName; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)event:(NSString *)eventId durations:(int)millisecond; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)event:(NSString *)eventId label:(NSString *)label durations:(int)millisecond; +/** 自定义事件,时长统计. + 使用前,请先到友盟App管理后台的设置->编辑自定义事件 中添加相应的事件ID,然后在工程中传入相应的事件ID. + */ + ++ (void)event:(NSString *)eventId attributes:(NSDictionary *)attributes durations:(int)millisecond; + + +///--------------------------------------------------------------------------------------- +/// @name 按渠道自动更新 +///--------------------------------------------------------------------------------------- + + +/** 按渠道自动更新检测 + 检查当前app是否有更新,有更新弹出UIAlertView提示用户,当用户点击升级按钮时app会跳转到您预先设置的网址。 + 无更新不做任何操作。 + 您需要先在服务器端设置app版本信息,默认渠道是App Store. + 如果您想自己控制自动更新操作流程,请实现MobClickDelegate的appUpdate方法。 + + @param title 对应UIAlertView的title. + @param cancelTitle 对应UIAlertView的cancelTitle. + @param otherTitle 对应UIAlertView的otherTitle. + @param delegate 需要自定义checkUpdate的对象. + @param callBackSelectorWithDictionary 当checkUpdate事件完成时此方法会被调用,同时标记app更新信息的字典被传回. + @return void. + */ + ++ (void)checkUpdate; +/** 按渠道自动更新检测 + */ + ++ (void)checkUpdate:(NSString *)title cancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherTitle; +/** 按渠道自动更新检测 + */ + ++ (void)checkUpdateWithDelegate:(id)delegate selector:(SEL)callBackSelectorWithDictionary; + + +///--------------------------------------------------------------------------------------- +/// @name 在线参数 +///--------------------------------------------------------------------------------------- + + +/** 使用在线参数功能,可以让你动态修改应用中的参数值, + 检查并更新服务器端配置的在线参数,缓存在[NSUserDefaults standardUserDefaults]里, + 调用此方法您将自动拥有在线更改SDK端发送策略的功能,您需要先在服务器端设置好在线参数. + 请在[MobClick startWithAppkey:]方法之后调用; + 如果想知道在线参数是否完成完成,请监听UMOnlineConfigDidFinishedNotification + @param 无. + @return void. + */ + ++ (void)updateOnlineConfig; + +/** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数的数值 + 带参数的方法获取某个key的值,不带参数的获取所有的在线参数. + 需要先调用updateOnlineConfig才能使用,如果想知道在线参数是否完成完成,请监听UMOnlineConfigDidFinishedNotification + + @param key + @return (NSString *) . + */ + ++ (NSString *)getConfigParams:(NSString *)key; + +/** 从[NSUserDefaults standardUserDefaults]获取缓存的在线参数 + @return (NSDictionary *). + */ + ++ (NSDictionary *)getConfigParams; + + +///--------------------------------------------------------------------------------------- +/// @name 地理位置设置 +///--------------------------------------------------------------------------------------- + + +/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息 + 需要链接 CoreLocation.framework 并且 #import + @param latitude 纬度. + @param longitude 经度. + @param location CLLocation *型的地理信息 + @return void + */ + ++ (void)setLatitude:(double)latitude longitude:(double)longitude; +/** 为了更精确的统计用户地理位置,可以调用此方法传入经纬度信息 + */ + ++ (void)setLocation:(CLLocation *)location; + + +///--------------------------------------------------------------------------------------- +/// @name helper方法 +///--------------------------------------------------------------------------------------- + + +/** 判断设备是否越狱,判断方法根据 apt和Cydia.app的path来判断 + */ ++ (BOOL)isJailbroken; +/** 判断你的App是否被破解 + */ ++ (BOOL)isPirated; + +#pragma mark DEPRECATED methods from version 1.7 + + +/** 设置MobClick代理,已经startWithAppkey:所取代,不要再使用,原有代码可以删除 +*/ + ++ (void)setDelegate:(id)delegate; ++ (void)setDelegate:(id)delegate reportPolicy:(ReportPolicy)rp; + +/** 记录启动时间,模块开始启用,不要再使用,原有代码可以删除 +*/ + ++ (void)appLaunched; + +/** 记录软件终止时间,模块终止,不要再使用,原有代码可以删除 + */ + ++ (void)appTerminated; + +/** 友盟模块启动 + [MobClick startWithAppkey:]通常在application:didFinishLaunchingWithOptions:里被调用监听 + App启动和退出事件,如果你没法在application:didFinishLaunchingWithOptions:里添加友盟的[MobClick startWithAppkey:] + 方法,App的启动事件可能会无法监听,此时你就可以手动调用[MobClick startSession:nil]来启动友盟的session。 + 通常发生在某些第三方框架生成的app里,普通app使用不到. + + */ + ++ (void)startSession:(NSNotification *)notification; + + +/** 获取友盟sdk 版本号,目前友盟模块启动时自动调用,不要再使用,原有代码可以删除 + */ + ++ (NSString *)getAgentVersion; // +@end + +/** MobClickDelegate protocol + 此协议的三个方法不再建议使用,建议用新方法代替 + + (void)startWithAppkey:(NSString *)appKey reportPolicy:(ReportPolicy)rp channelId:(NSString *)cid; + + (void)checkUpdate:(id)delegate selector:(SEL)callBackSelector; + + */ + + +@protocol MobClickDelegate +@optional +- (NSString *)appKey; +- (NSString *)channelId; +- (void)appUpdate:(NSDictionary *)appUpdateInfo; + +@end \ No newline at end of file diff --git a/plugin/plugins/umeng/proj.ios/PluginUmeng-Prefix.pch b/plugin/plugins/umeng/proj.ios/PluginUmeng-Prefix.pch new file mode 100644 index 0000000000..d5d6a02bde --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/PluginUmeng-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'libPluginUmeng' target in the 'libPluginUmeng' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/plugin/plugins/umeng/proj.ios/PluginUmeng.xcodeproj/project.pbxproj b/plugin/plugins/umeng/proj.ios/PluginUmeng.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..3500b4499c --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/PluginUmeng.xcodeproj/project.pbxproj @@ -0,0 +1,245 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + FA09A305168ADAEC008C1C7B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA09A304168ADAEC008C1C7B /* Foundation.framework */; }; + FAB6DFE91756F3B600C90D89 /* AnalyticsUmeng.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DFE61756F3B600C90D89 /* AnalyticsUmeng.m */; }; + FAB6DFEA1756F3B600C90D89 /* libMobClickLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB6DFE71756F3B600C90D89 /* libMobClickLibrary.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + FA09A2FF168ADAEC008C1C7B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + FA09A301168ADAEC008C1C7B /* libPluginUmeng.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPluginUmeng.a; sourceTree = BUILT_PRODUCTS_DIR; }; + FA09A304168ADAEC008C1C7B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + FAB6DFE51756F3B600C90D89 /* AnalyticsUmeng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnalyticsUmeng.h; sourceTree = ""; }; + FAB6DFE61756F3B600C90D89 /* AnalyticsUmeng.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnalyticsUmeng.m; sourceTree = ""; }; + FAB6DFE71756F3B600C90D89 /* libMobClickLibrary.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libMobClickLibrary.a; sourceTree = ""; }; + FAB6DFE81756F3B600C90D89 /* MobClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobClick.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA09A2FE168ADAEC008C1C7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA09A305168ADAEC008C1C7B /* Foundation.framework in Frameworks */, + FAB6DFEA1756F3B600C90D89 /* libMobClickLibrary.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA09A2F6168ADAEC008C1C7B = { + isa = PBXGroup; + children = ( + FAB6DFE51756F3B600C90D89 /* AnalyticsUmeng.h */, + FAB6DFE61756F3B600C90D89 /* AnalyticsUmeng.m */, + FAB6DFE71756F3B600C90D89 /* libMobClickLibrary.a */, + FAB6DFE81756F3B600C90D89 /* MobClick.h */, + FA09A303168ADAEC008C1C7B /* Frameworks */, + FA09A302168ADAEC008C1C7B /* Products */, + ); + sourceTree = ""; + }; + FA09A302168ADAEC008C1C7B /* Products */ = { + isa = PBXGroup; + children = ( + FA09A301168ADAEC008C1C7B /* libPluginUmeng.a */, + ); + name = Products; + sourceTree = ""; + }; + FA09A303168ADAEC008C1C7B /* Frameworks */ = { + isa = PBXGroup; + children = ( + FA09A304168ADAEC008C1C7B /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FA09A300168ADAEC008C1C7B /* PluginUmeng */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA09A30F168ADAEC008C1C7B /* Build configuration list for PBXNativeTarget "PluginUmeng" */; + buildPhases = ( + FA09A2FD168ADAEC008C1C7B /* Sources */, + FA09A2FE168ADAEC008C1C7B /* Frameworks */, + FA09A2FF168ADAEC008C1C7B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PluginUmeng; + productName = libPluginUmeng; + productReference = FA09A301168ADAEC008C1C7B /* libPluginUmeng.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA09A2F8168ADAEC008C1C7B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = zhangbin; + }; + buildConfigurationList = FA09A2FB168ADAEC008C1C7B /* Build configuration list for PBXProject "PluginUmeng" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FA09A2F6168ADAEC008C1C7B; + productRefGroup = FA09A302168ADAEC008C1C7B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FA09A300168ADAEC008C1C7B /* PluginUmeng */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + FA09A2FD168ADAEC008C1C7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FAB6DFE91756F3B600C90D89 /* AnalyticsUmeng.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FA09A30D168ADAEC008C1C7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + FA09A30E168ADAEC008C1C7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FA09A310168ADAEC008C1C7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/libPluginUmeng.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginUmeng-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../protocols/include", + "$(SRCROOT)/../../../protocols/platform/ios", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)\"", + "\"$(SRCROOT)/../platform/ios\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = PluginUmeng; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + FA09A311168ADAEC008C1C7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/libPluginUmeng.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginUmeng-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../protocols/include", + "$(SRCROOT)/../../../protocols/platform/ios", + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)\"", + "\"$(SRCROOT)/../platform/ios\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = PluginUmeng; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FA09A2FB168ADAEC008C1C7B /* Build configuration list for PBXProject "PluginUmeng" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA09A30D168ADAEC008C1C7B /* Debug */, + FA09A30E168ADAEC008C1C7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA09A30F168ADAEC008C1C7B /* Build configuration list for PBXNativeTarget "PluginUmeng" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA09A310168ADAEC008C1C7B /* Debug */, + FA09A311168ADAEC008C1C7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA09A2F8168ADAEC008C1C7B /* Project object */; +} diff --git a/plugin/plugins/umeng/proj.ios/libMobClickLibrary.a.REMOVED.git-id b/plugin/plugins/umeng/proj.ios/libMobClickLibrary.a.REMOVED.git-id new file mode 100644 index 0000000000..64079d8ea3 --- /dev/null +++ b/plugin/plugins/umeng/proj.ios/libMobClickLibrary.a.REMOVED.git-id @@ -0,0 +1 @@ +c61504f40c4fbe912ff1d74677edf29234eb192c \ No newline at end of file diff --git a/plugin/plugins/weibo/proj.android/.classpath b/plugin/plugins/weibo/proj.android/.classpath new file mode 100755 index 0000000000..53721329ac --- /dev/null +++ b/plugin/plugins/weibo/proj.android/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/plugin/plugins/weibo/proj.android/.project b/plugin/plugins/weibo/proj.android/.project new file mode 100755 index 0000000000..960d21be03 --- /dev/null +++ b/plugin/plugins/weibo/proj.android/.project @@ -0,0 +1,33 @@ + + + libPluginWeibo + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/plugin/plugins/weibo/proj.android/AndroidManifest.xml b/plugin/plugins/weibo/proj.android/AndroidManifest.xml new file mode 100755 index 0000000000..14936252dc --- /dev/null +++ b/plugin/plugins/weibo/proj.android/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/plugin/plugins/weibo/proj.android/ForManifest.xml b/plugin/plugins/weibo/proj.android/ForManifest.xml new file mode 100755 index 0000000000..00d34cd419 --- /dev/null +++ b/plugin/plugins/weibo/proj.android/ForManifest.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugin/plugins/weibo/proj.android/build.xml b/plugin/plugins/weibo/proj.android/build.xml new file mode 100755 index 0000000000..77909e9ad8 --- /dev/null +++ b/plugin/plugins/weibo/proj.android/build.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/plugins/weibo/proj.android/project.properties b/plugin/plugins/weibo/proj.android/project.properties new file mode 100755 index 0000000000..9d741eed16 --- /dev/null +++ b/plugin/plugins/weibo/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 +android.library=true +android.library.reference.1=../../../protocols/proj.android diff --git a/plugin/plugins/weibo/proj.android/res/.gitignore b/plugin/plugins/weibo/proj.android/res/.gitignore new file mode 100755 index 0000000000..e69de29bb2 diff --git a/plugin/plugins/weibo/proj.android/sdk/weibosdk.jar b/plugin/plugins/weibo/proj.android/sdk/weibosdk.jar new file mode 100755 index 0000000000..e1809e78b6 Binary files /dev/null and b/plugin/plugins/weibo/proj.android/sdk/weibosdk.jar differ diff --git a/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/AccessTokenKeeper.java b/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/AccessTokenKeeper.java new file mode 100755 index 0000000000..95c5f4012b --- /dev/null +++ b/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/AccessTokenKeeper.java @@ -0,0 +1,50 @@ +package org.cocos2dx.plugin; + +import com.weibo.sdk.android.Oauth2AccessToken; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +/** + * 该类用于保存Oauth2AccessToken到sharepreference,并提供读取功能 + * @author xiaowei6@staff.sina.com.cn + * + */ +public class AccessTokenKeeper { + private static final String PREFERENCES_NAME = "com_weibo_sdk_android"; + /** + * 保存accesstoken到SharedPreferences + * @param context Activity 上下文环境 + * @param token Oauth2AccessToken + */ + public static void keepAccessToken(Context context, Oauth2AccessToken token) { + SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND); + Editor editor = pref.edit(); + editor.putString("token", token.getToken()); + editor.putLong("expiresTime", token.getExpiresTime()); + editor.commit(); + } + /** + * 清空sharepreference + * @param context + */ + public static void clear(Context context){ + SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND); + Editor editor = pref.edit(); + editor.clear(); + editor.commit(); + } + + /** + * 从SharedPreferences读取accessstoken + * @param context + * @return Oauth2AccessToken + */ + public static Oauth2AccessToken readAccessToken(Context context){ + Oauth2AccessToken token = new Oauth2AccessToken(); + SharedPreferences pref = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_APPEND); + token.setToken(pref.getString("token", "")); + token.setExpiresTime(pref.getLong("expiresTime", 0)); + return token; + } +} diff --git a/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/SocialWeibo.java b/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/SocialWeibo.java new file mode 100755 index 0000000000..8a50d5f5ad --- /dev/null +++ b/plugin/plugins/weibo/proj.android/src/org/cocos2dx/plugin/SocialWeibo.java @@ -0,0 +1,228 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.io.IOException; +import java.util.Hashtable; + + +import com.weibo.sdk.android.Oauth2AccessToken; +import com.weibo.sdk.android.Weibo; +import com.weibo.sdk.android.WeiboAuthListener; +import com.weibo.sdk.android.WeiboDialogError; +import com.weibo.sdk.android.WeiboException; +import com.weibo.sdk.android.api.StatusesAPI; +import com.weibo.sdk.android.net.RequestListener; + +import android.app.Activity; +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Bundle; +import android.util.Log; + +public class SocialWeibo implements InterfaceSocial { + + private static final String LOG_TAG = "SocialWeibo"; + private static Activity mContext = null; + private static SocialWeibo mSocialAdapter = null; + protected static boolean bDebug = false; + + private String APP_KEY = ""; + private String REDIRECT_URL = ""; + + private boolean isInitialized = false; + private Hashtable mShareInfo = null; + + public static final String KEY_TEXT="SharedText"; + public static final String KEY_IMAGE_PATH = "SharedImagePath"; + + private Weibo mWeibo = null; + private Oauth2AccessToken accessToken = null; + + protected static void LogE(String msg, Exception e) { + Log.e(LOG_TAG, msg, e); + e.printStackTrace(); + } + + protected static void LogD(String msg) { + if (bDebug) { + Log.d(LOG_TAG, msg); + } + } + + public SocialWeibo(Context context) { + mContext = (Activity) context; + mSocialAdapter = this; + } + + @Override + public void configDeveloperInfo(Hashtable cpInfo) { + LogD("configDeveloperInfo invoked " + cpInfo.toString()); + try { + mSocialAdapter.APP_KEY = cpInfo.get("WeiboAppKey"); + mSocialAdapter.REDIRECT_URL = cpInfo.get("WeiboRedirectUrl"); + + LogD("app key : " + mSocialAdapter.APP_KEY); + LogD("redirect url : " + mSocialAdapter.REDIRECT_URL); + if(isInitialized){ + return; + } + isInitialized = true; + PluginWrapper.runOnMainThread(new Runnable() { + + @Override + public void run() { + mSocialAdapter.mWeibo = Weibo.getInstance(APP_KEY, REDIRECT_URL); + mSocialAdapter.accessToken = AccessTokenKeeper.readAccessToken(mContext); + } + }); + } catch (Exception e) { + LogE("Developer info is wrong!", e); + } + } + + @Override + public void share(Hashtable info) { + LogD("share invoked " + info.toString()); + mShareInfo = info; + if (! networkReachable()) { + shareResult(SocialWrapper.SHARERESULT_FAIL, "Network error!"); + return; + } + + if (! isInitialized) { + shareResult(SocialWrapper.SHARERESULT_FAIL, "Initialize failed!"); + return; + } + + PluginWrapper.runOnMainThread(new Runnable() { + @Override + public void run() { + if (mSocialAdapter.accessToken.isSessionValid()) { + mSocialAdapter.shareToWeibo(); + } else { + mSocialAdapter.mWeibo.authorize(mContext, new WeiboAuthDialogListener()); + } + } + }); + } + + @Override + public void setDebugMode(boolean debug) { + bDebug = debug; + } + + @Override + public String getSDKVersion() { + return "Unknown version"; + } + + private boolean networkReachable() { + boolean bRet = false; + try { + ConnectivityManager conn = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo netInfo = conn.getActiveNetworkInfo(); + bRet = (null == netInfo) ? false : netInfo.isAvailable(); + } catch (Exception e) { + LogE("Fail to check network status", e); + } + LogD("NetWork reachable : " + bRet); + return bRet; + } + + public static void shareResult(int ret, String msg) { + SocialWrapper.onShareResult(mSocialAdapter, ret, msg); + LogD("SocialWeibo result : " + ret + " msg : " + msg); + } + + class WeiboAuthDialogListener implements WeiboAuthListener { + + @Override + public void onComplete(Bundle values) { + try { + String token = values.getString("access_token"); + String expires_in = values.getString("expires_in"); + mSocialAdapter.accessToken = new Oauth2AccessToken(token, expires_in); + AccessTokenKeeper.keepAccessToken(mContext, accessToken); + + mSocialAdapter.shareToWeibo(); + } catch (Exception e) { + shareResult(SocialWrapper.SHARERESULT_FAIL, "认证失败!"); + LogE("anthorize failed", e); + } + } + + @Override + public void onError(WeiboDialogError e) { + shareResult(SocialWrapper.SHARERESULT_FAIL, e.getMessage()); + } + + @Override + public void onCancel() { + shareResult(SocialWrapper.SHARERESULT_FAIL, "取消认证!"); + } + + @Override + public void onWeiboException(WeiboException e) { + shareResult(SocialWrapper.SHARERESULT_FAIL, e.getMessage()); + } + } + + private void shareToWeibo() { + String text = mShareInfo.get(KEY_TEXT); + String imagePath = mShareInfo.get(KEY_IMAGE_PATH); + StatusesAPI api = new StatusesAPI(accessToken); + if (imagePath != null && imagePath.length() > 0) { + api.upload(text, imagePath, "90.0", "90.0", new WeiboRequestListener()); + } else { + api.update(text, "90.0", "90.0", new WeiboRequestListener()); + } + } + + class WeiboRequestListener implements RequestListener { + + @Override + public void onComplete(String arg0) { + shareResult(SocialWrapper.SHARERESULT_SUCCESS, "分享成功!"); + } + + @Override + public void onError(WeiboException arg0) { + LogE("Share onError", arg0); + shareResult(SocialWrapper.SHARERESULT_FAIL, "分享失败!"); + } + + @Override + public void onIOException(IOException arg0) { + LogE("Share onIOException", arg0); + shareResult(SocialWrapper.SHARERESULT_FAIL, "分享失败!"); + } + } + + @Override + public String getPluginVersion() { + return "0.2.0"; + } +} diff --git a/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.h b/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.h new file mode 100755 index 0000000000..71bd0c3b7b --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.h @@ -0,0 +1,251 @@ +// +// JSONKit.h +// http://github.com/johnezang/JSONKit +// Dual licensed under either the terms of the BSD License, or alternatively +// under the terms of the Apache License, Version 2.0, as specified below. +// + +/* + Copyright (c) 2011, John Engelhart + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Zang Industries nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + Copyright 2011 John Engelhart + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include +#include +#include +#include +#include + +#ifdef __OBJC__ +#import +#import +#import +#import +#import +#import +#endif // __OBJC__ + +#ifdef __cplusplus +extern "C" { +#endif + + +// For Mac OS X < 10.5. +#ifndef NSINTEGER_DEFINED +#define NSINTEGER_DEFINED +#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef long NSInteger; +typedef unsigned long NSUInteger; +#define NSIntegerMin LONG_MIN +#define NSIntegerMax LONG_MAX +#define NSUIntegerMax ULONG_MAX +#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef int NSInteger; +typedef unsigned int NSUInteger; +#define NSIntegerMin INT_MIN +#define NSIntegerMax INT_MAX +#define NSUIntegerMax UINT_MAX +#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +#endif // NSINTEGER_DEFINED + + +#ifndef _JSONKIT_H_ +#define _JSONKIT_H_ + +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) +#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else +#define JK_DEPRECATED_ATTRIBUTE +#endif + +#define JSONKIT_VERSION_MAJOR 1 +#define JSONKIT_VERSION_MINOR 4 + +typedef NSUInteger JKFlags; + +/* + JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON. + JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines. + JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode. + This option allows JSON with malformed Unicode to be parsed without reporting an error. + Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER". + */ + +enum { + JKParseOptionNone = 0, + JKParseOptionStrict = 0, + JKParseOptionComments = (1 << 0), + JKParseOptionUnicodeNewlines = (1 << 1), + JKParseOptionLooseUnicode = (1 << 2), + JKParseOptionPermitTextAfterValidJSON = (1 << 3), + JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON), +}; +typedef JKFlags JKParseOptionFlags; + +enum { + JKSerializeOptionNone = 0, + JKSerializeOptionPretty = (1 << 0), + JKSerializeOptionEscapeUnicode = (1 << 1), + JKSerializeOptionEscapeForwardSlashes = (1 << 4), + JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes), +}; +typedef JKFlags JKSerializeOptionFlags; + +#ifdef __OBJC__ + +typedef struct JKParseState JKParseState; // Opaque internal, private type. + +// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict + +@interface JSONDecoder : NSObject { + JKParseState *parseState; +} ++ (id)decoder; ++ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (void)clearCache; + +// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods. +- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead. +- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead. +// The NSData MUST be UTF8 encoded JSON. +- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead. +- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead. + +// Methods that return immutable collection objects. +- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; +- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; +// The NSData MUST be UTF8 encoded JSON. +- (id)objectWithData:(NSData *)jsonData; +- (id)objectWithData:(NSData *)jsonData error:(NSError **)error; + +// Methods that return mutable collection objects. +- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length; +- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error; +// The NSData MUST be UTF8 encoded JSON. +- (id)mutableObjectWithData:(NSData *)jsonData; +- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error; + +@end + +//////////// +#pragma mark Deserializing methods +//////////// + +@interface NSString (JSONKitDeserializing) +- (id)objectFromJSONString; +- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; +- (id)mutableObjectFromJSONString; +- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; +@end + +@interface NSData (JSONKitDeserializing) +// The NSData MUST be UTF8 encoded JSON. +- (id)objectFromJSONData; +- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; +- (id)mutableObjectFromJSONData; +- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags; +- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error; +@end + +//////////// +#pragma mark Serializing methods +//////////// + +@interface NSString (JSONKitSerializing) +// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString). +// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes: +// includeQuotes:YES `a "test"...` -> `"a \"test\"..."` +// includeQuotes:NO `a "test"...` -> `a \"test\"...` +- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; +- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error; +@end + +@interface NSArray (JSONKitSerializing) +- (NSData *)JSONData; +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; +- (NSString *)JSONString; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; +@end + +@interface NSDictionary (JSONKitSerializing) +- (NSData *)JSONData; +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; +- (NSString *)JSONString; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error; +@end + +#ifdef __BLOCKS__ + +@interface NSArray (JSONKitSerializingBlockAdditions) +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; +@end + +@interface NSDictionary (JSONKitSerializingBlockAdditions) +- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; +- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error; +@end + +#endif + + +#endif // __OBJC__ + +#endif // _JSONKIT_H_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.m.REMOVED.git-id b/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.m.REMOVED.git-id new file mode 100644 index 0000000000..54ee522c27 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/JSONKit/JSONKit.m.REMOVED.git-id @@ -0,0 +1 @@ +9f27f47f49d16e5ad6150696261f716807916658 \ No newline at end of file diff --git a/plugin/plugins/weibo/proj.ios/PluginWeibo-Prefix.pch b/plugin/plugins/weibo/proj.ios/PluginWeibo-Prefix.pch new file mode 100644 index 0000000000..a3d34899a9 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/PluginWeibo-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'PluginWeibo' target in the 'PluginWeibo' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/plugin/plugins/weibo/proj.ios/PluginWeibo.xcodeproj/project.pbxproj b/plugin/plugins/weibo/proj.ios/PluginWeibo.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..6a65f68170 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/PluginWeibo.xcodeproj/project.pbxproj @@ -0,0 +1,283 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + FAE27534175D9D2900F5DA8E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE27533175D9D2900F5DA8E /* Foundation.framework */; }; + FAE27547175D9DCF00F5DA8E /* SocialWeibo.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE27546175D9DCF00F5DA8E /* SocialWeibo.m */; }; + FAE27561175DC52900F5DA8E /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE27557175DC52900F5DA8E /* JSONKit.m */; }; + FAE27562175DC52900F5DA8E /* SinaWeibo.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE2755B175DC52900F5DA8E /* SinaWeibo.m */; }; + FAE27563175DC52900F5DA8E /* SinaWeiboAuthorizeView.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE2755D175DC52900F5DA8E /* SinaWeiboAuthorizeView.m */; }; + FAE27564175DC52900F5DA8E /* SinaWeiboRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE27560175DC52900F5DA8E /* SinaWeiboRequest.m */; }; + FAE2756E175DD1E700F5DA8E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE2756D175DD1E700F5DA8E /* UIKit.framework */; }; + FAE27570175DD1F500F5DA8E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE2756F175DD1F500F5DA8E /* CoreGraphics.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + FAE2752E175D9D2900F5DA8E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + FAE27530175D9D2900F5DA8E /* libPluginWeibo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPluginWeibo.a; sourceTree = BUILT_PRODUCTS_DIR; }; + FAE27533175D9D2900F5DA8E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + FAE27545175D9DCF00F5DA8E /* SocialWeibo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialWeibo.h; sourceTree = ""; }; + FAE27546175D9DCF00F5DA8E /* SocialWeibo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialWeibo.m; sourceTree = ""; }; + FAE27556175DC52900F5DA8E /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = ""; }; + FAE27557175DC52900F5DA8E /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = ""; }; + FAE27559175DC52900F5DA8E /* SinaWeibo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SinaWeibo.bundle; sourceTree = ""; }; + FAE2755A175DC52900F5DA8E /* SinaWeibo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinaWeibo.h; sourceTree = ""; }; + FAE2755B175DC52900F5DA8E /* SinaWeibo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SinaWeibo.m; sourceTree = ""; }; + FAE2755C175DC52900F5DA8E /* SinaWeiboAuthorizeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinaWeiboAuthorizeView.h; sourceTree = ""; }; + FAE2755D175DC52900F5DA8E /* SinaWeiboAuthorizeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SinaWeiboAuthorizeView.m; sourceTree = ""; }; + FAE2755E175DC52900F5DA8E /* SinaWeiboConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinaWeiboConstants.h; sourceTree = ""; }; + FAE2755F175DC52900F5DA8E /* SinaWeiboRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinaWeiboRequest.h; sourceTree = ""; }; + FAE27560175DC52900F5DA8E /* SinaWeiboRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SinaWeiboRequest.m; sourceTree = ""; }; + FAE2756D175DD1E700F5DA8E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + FAE2756F175DD1F500F5DA8E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FAE2752D175D9D2900F5DA8E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FAE27570175DD1F500F5DA8E /* CoreGraphics.framework in Frameworks */, + FAE2756E175DD1E700F5DA8E /* UIKit.framework in Frameworks */, + FAE27534175D9D2900F5DA8E /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FAE27525175D9D2900F5DA8E = { + isa = PBXGroup; + children = ( + FAE27555175DC52900F5DA8E /* JSONKit */, + FAE27558175DC52900F5DA8E /* SinaWeibo */, + FAE27545175D9DCF00F5DA8E /* SocialWeibo.h */, + FAE27546175D9DCF00F5DA8E /* SocialWeibo.m */, + FAE27532175D9D2900F5DA8E /* Frameworks */, + FAE27531175D9D2900F5DA8E /* Products */, + ); + sourceTree = ""; + }; + FAE27531175D9D2900F5DA8E /* Products */ = { + isa = PBXGroup; + children = ( + FAE27530175D9D2900F5DA8E /* libPluginWeibo.a */, + ); + name = Products; + sourceTree = ""; + }; + FAE27532175D9D2900F5DA8E /* Frameworks */ = { + isa = PBXGroup; + children = ( + FAE2756F175DD1F500F5DA8E /* CoreGraphics.framework */, + FAE2756D175DD1E700F5DA8E /* UIKit.framework */, + FAE27533175D9D2900F5DA8E /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FAE27555175DC52900F5DA8E /* JSONKit */ = { + isa = PBXGroup; + children = ( + FAE27556175DC52900F5DA8E /* JSONKit.h */, + FAE27557175DC52900F5DA8E /* JSONKit.m */, + ); + path = JSONKit; + sourceTree = ""; + }; + FAE27558175DC52900F5DA8E /* SinaWeibo */ = { + isa = PBXGroup; + children = ( + FAE27559175DC52900F5DA8E /* SinaWeibo.bundle */, + FAE2755A175DC52900F5DA8E /* SinaWeibo.h */, + FAE2755B175DC52900F5DA8E /* SinaWeibo.m */, + FAE2755C175DC52900F5DA8E /* SinaWeiboAuthorizeView.h */, + FAE2755D175DC52900F5DA8E /* SinaWeiboAuthorizeView.m */, + FAE2755E175DC52900F5DA8E /* SinaWeiboConstants.h */, + FAE2755F175DC52900F5DA8E /* SinaWeiboRequest.h */, + FAE27560175DC52900F5DA8E /* SinaWeiboRequest.m */, + ); + path = SinaWeibo; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FAE2752F175D9D2900F5DA8E /* PluginWeibo */ = { + isa = PBXNativeTarget; + buildConfigurationList = FAE2753E175D9D2B00F5DA8E /* Build configuration list for PBXNativeTarget "PluginWeibo" */; + buildPhases = ( + FAE2752C175D9D2900F5DA8E /* Sources */, + FAE2752D175D9D2900F5DA8E /* Frameworks */, + FAE2752E175D9D2900F5DA8E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PluginWeibo; + productName = PluginWeibo; + productReference = FAE27530175D9D2900F5DA8E /* libPluginWeibo.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FAE27527175D9D2900F5DA8E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = zhangbin; + }; + buildConfigurationList = FAE2752A175D9D2900F5DA8E /* Build configuration list for PBXProject "PluginWeibo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FAE27525175D9D2900F5DA8E; + productRefGroup = FAE27531175D9D2900F5DA8E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FAE2752F175D9D2900F5DA8E /* PluginWeibo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + FAE2752C175D9D2900F5DA8E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FAE27547175D9DCF00F5DA8E /* SocialWeibo.m in Sources */, + FAE27561175DC52900F5DA8E /* JSONKit.m in Sources */, + FAE27562175DC52900F5DA8E /* SinaWeibo.m in Sources */, + FAE27563175DC52900F5DA8E /* SinaWeiboAuthorizeView.m in Sources */, + FAE27564175DC52900F5DA8E /* SinaWeiboRequest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FAE2753C175D9D2B00F5DA8E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + FAE2753D175D9D2B00F5DA8E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FAE2753F175D9D2B00F5DA8E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + DSTROOT = /tmp/PluginWeibo.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginWeibo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../protocols/include", + "$(SRCROOT)/../../../protocols/platform/ios", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + FAE27540175D9D2B00F5DA8E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + DSTROOT = /tmp/PluginWeibo.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginWeibo-Prefix.pch"; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../protocols/include", + "$(SRCROOT)/../../../protocols/platform/ios", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FAE2752A175D9D2900F5DA8E /* Build configuration list for PBXProject "PluginWeibo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FAE2753C175D9D2B00F5DA8E /* Debug */, + FAE2753D175D9D2B00F5DA8E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FAE2753E175D9D2B00F5DA8E /* Build configuration list for PBXNativeTarget "PluginWeibo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FAE2753F175D9D2B00F5DA8E /* Debug */, + FAE27540175D9D2B00F5DA8E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FAE27527175D9D2900F5DA8E /* Project object */; +} diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.h b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.h new file mode 100755 index 0000000000..b80c1593f5 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.h @@ -0,0 +1,90 @@ +// +// SinaWeibo.h +// sinaweibo_ios_sdk +// +// Created by Wade Cheng on 4/19/12. +// Copyright (c) 2012 SINA. All rights reserved. +// + +#import +#import "SinaWeiboAuthorizeView.h" +#import "SinaWeiboRequest.h" + +@protocol SinaWeiboDelegate; + +@interface SinaWeibo : NSObject +{ + NSString *userID; + NSString *accessToken; + NSDate *expirationDate; + id delegate; + + NSString *appKey; + NSString *appSecret; + NSString *appRedirectURI; + NSString *ssoCallbackScheme; + + SinaWeiboRequest *request; + NSMutableSet *requests; + BOOL ssoLoggingIn; +} + +@property (nonatomic, copy) NSString *userID; +@property (nonatomic, copy) NSString *accessToken; +@property (nonatomic, copy) NSDate *expirationDate; +@property (nonatomic, copy) NSString *refreshToken; +@property (nonatomic, copy) NSString *ssoCallbackScheme; +@property (nonatomic, assign) id delegate; + +- (id)initWithAppKey:(NSString *)appKey appSecret:(NSString *)appSecrect + appRedirectURI:(NSString *)appRedirectURI + andDelegate:(id)delegate; + +- (id)initWithAppKey:(NSString *)appKey appSecret:(NSString *)appSecrect + appRedirectURI:(NSString *)appRedirectURI + ssoCallbackScheme:(NSString *)ssoCallbackScheme + andDelegate:(id)delegate; + +- (void)applicationDidBecomeActive; +- (BOOL)handleOpenURL:(NSURL *)url; + +// Log in using OAuth Web authorization. +// If succeed, sinaweiboDidLogIn will be called. +- (void)logIn; + +// Log out. +// If succeed, sinaweiboDidLogOut will be called. +- (void)logOut; + +// Check if user has logged in, or the authorization is expired. +- (BOOL)isLoggedIn; +- (BOOL)isAuthorizeExpired; + + +// isLoggedIn && isAuthorizeExpired +- (BOOL)isAuthValid; + +- (SinaWeiboRequest*)requestWithURL:(NSString *)url + params:(NSMutableDictionary *)params + httpMethod:(NSString *)httpMethod + delegate:(id)delegate; + +@end + + +/** + * @description 第三方应用需实现此协议,登录时传入此类对象,用于完成登录结果的回调 + */ +@protocol SinaWeiboDelegate + +@optional + +- (void)sinaweiboDidLogIn:(SinaWeibo *)sinaweibo; +- (void)sinaweiboDidLogOut:(SinaWeibo *)sinaweibo; +- (void)sinaweiboLogInDidCancel:(SinaWeibo *)sinaweibo; +- (void)sinaweibo:(SinaWeibo *)sinaweibo logInDidFailWithError:(NSError *)error; +- (void)sinaweibo:(SinaWeibo *)sinaweibo accessTokenInvalidOrExpired:(NSError *)error; + +@end + +extern BOOL SinaWeiboIsDeviceIPad(); diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.m b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.m new file mode 100755 index 0000000000..96366dd150 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeibo.m @@ -0,0 +1,552 @@ +// +// SinaWeibo.m +// sinaweibo_ios_sdk +// +// Created by Wade Cheng on 4/19/12. +// Copyright (c) 2012 SINA. All rights reserved. +// + +#import "SinaWeibo.h" +#import "SinaWeiboRequest.h" +#import "SinaWeiboAuthorizeView.h" +#import "SinaWeiboConstants.h" + +@interface SinaWeibo () + +@property (nonatomic, copy) NSString *appKey; +@property (nonatomic, copy) NSString *appSecret; +@property (nonatomic, copy) NSString *appRedirectURI; + +@end + +@implementation SinaWeibo + +@synthesize userID; +@synthesize accessToken; +@synthesize expirationDate; +@synthesize refreshToken; +@synthesize ssoCallbackScheme; +@synthesize delegate; +@synthesize appKey; +@synthesize appSecret; +@synthesize appRedirectURI; + +#pragma mark - Memory management + +/** + * @description 初始化构造函数,返回采用默认sso回调地址构造的SinaWeibo对象 + * @param _appKey: 分配给第三方应用的appkey + * @param _appSecrect: 分配给第三方应用的appsecrect + * @param _appRedirectURI: 微博开放平台中授权设置的应用回调页 + * @return SinaWeibo对象 + */ +- (id)initWithAppKey:(NSString *)_appKey appSecret:(NSString *)_appSecrect + appRedirectURI:(NSString *)_appRedirectURI + andDelegate:(id)_delegate +{ + return [self initWithAppKey:_appKey appSecret:_appSecrect appRedirectURI:_appRedirectURI ssoCallbackScheme:nil andDelegate:_delegate]; +} + + +/** + * @description 初始化构造函数,返回采用默认sso回调地址构造的SinaWeibo对象 + * @param _appKey: 分配给第三方应用的appkey + * @param _appSecrect: 分配给第三方应用的appsecrect + * @param _ssoCallbackScheme: sso回调地址,此值应与URL Types中定义的保持一致 + * 若为nil,则初始化为默认格式 sinaweibosso.your_app_key; + * @param _appRedirectURI: 微博开放平台中授权设置的应用回调页 + * @return SinaWeibo对象 + */ +- (id)initWithAppKey:(NSString *)_appKey appSecret:(NSString *)_appSecrect + appRedirectURI:(NSString *)_appRedirectURI + ssoCallbackScheme:(NSString *)_ssoCallbackScheme + andDelegate:(id)_delegate +{ + if ((self = [super init])) + { + self.appKey = _appKey; + self.appSecret = _appSecrect; + self.appRedirectURI = _appRedirectURI; + self.delegate = _delegate; + + if (!_ssoCallbackScheme) + { + _ssoCallbackScheme = [NSString stringWithFormat:@"sinaweibosso.%@://", self.appKey]; + } + self.ssoCallbackScheme = _ssoCallbackScheme; + + requests = [[NSMutableSet alloc] init]; + } + + return self; +} + +- (void)dealloc +{ + delegate = nil; + + for (SinaWeiboRequest* _request in requests) + { + _request.sinaweibo = nil; + } + + [request disconnect]; + [request release], request = nil; + [userID release], userID = nil; + [accessToken release], accessToken = nil; + [expirationDate release], expirationDate = nil; + [appKey release], appKey = nil; + [appSecret release], appSecret = nil; + [appRedirectURI release], appRedirectURI = nil; + [ssoCallbackScheme release], ssoCallbackScheme = nil; + + [super dealloc]; +} + +/** + * @description 清空认证信息 + */ +- (void)removeAuthData +{ + self.accessToken = nil; + self.userID = nil; + self.expirationDate = nil; + + NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + NSArray* sinaweiboCookies = [cookies cookiesForURL: + [NSURL URLWithString:@"https://open.weibo.cn"]]; + + for (NSHTTPCookie* cookie in sinaweiboCookies) + { + [cookies deleteCookie:cookie]; + } +} + +#pragma mark - Private methods + +- (void)requestAccessTokenWithAuthorizationCode:(NSString *)code +{ + NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: + self.appKey, @"client_id", + self.appSecret, @"client_secret", + @"authorization_code", @"grant_type", + self.appRedirectURI, @"redirect_uri", + code, @"code", nil]; + [request disconnect]; + [request release], request = nil; + + request = [[SinaWeiboRequest requestWithURL:kSinaWeiboWebAccessTokenURL + httpMethod:@"POST" + params:params + delegate:self] retain]; + + [request connect]; +} + +- (void)requestDidFinish:(SinaWeiboRequest *)_request +{ + [requests removeObject:_request]; + _request.sinaweibo = nil; +} + +- (void)requestDidFailWithInvalidToken:(NSError *)error +{ + if ([delegate respondsToSelector:@selector(sinaweibo:accessTokenInvalidOrExpired:)]) + { + [delegate sinaweibo:self accessTokenInvalidOrExpired:error]; + } +} + +- (void)notifyTokenExpired:(id)requestDelegate +{ + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + @"Token expired", NSLocalizedDescriptionKey, nil]; + + NSError *error = [NSError errorWithDomain:kSinaWeiboSDKErrorDomain + code:21315 + userInfo:userInfo]; + + if ([delegate respondsToSelector:@selector(sinaweibo:accessTokenInvalidOrExpired:)]) + { + [delegate sinaweibo:self accessTokenInvalidOrExpired:error]; + } + + if ([requestDelegate respondsToSelector:@selector(request:didFailWithError:)]) + { + [requestDelegate request:nil didFailWithError:error]; + } +} + +- (void)logInDidCancel +{ + if ([delegate respondsToSelector:@selector(sinaweiboLogInDidCancel:)]) + { + [delegate sinaweiboLogInDidCancel:self]; + } +} + +- (void)logInDidFinishWithAuthInfo:(NSDictionary *)authInfo +{ + NSString *access_token = [authInfo objectForKey:@"access_token"]; + NSString *uid = [authInfo objectForKey:@"uid"]; + NSString *remind_in = [authInfo objectForKey:@"remind_in"]; + NSString *refresh_token = [authInfo objectForKey:@"refresh_token"]; + if (access_token && uid) + { + if (remind_in != nil) + { + int expVal = [remind_in intValue]; + if (expVal == 0) + { + self.expirationDate = [NSDate distantFuture]; + } + else + { + self.expirationDate = [NSDate dateWithTimeIntervalSinceNow:expVal]; + } + } + + self.accessToken = access_token; + self.userID = uid; + self.refreshToken = refresh_token; + + if ([delegate respondsToSelector:@selector(sinaweiboDidLogIn:)]) + { + [delegate sinaweiboDidLogIn:self]; + } + } +} + +- (void)logInDidFailWithErrorInfo:(NSDictionary *)errorInfo +{ + NSString *error_code = [errorInfo objectForKey:@"error_code"]; + if ([error_code isEqualToString:@"21330"]) + { + [self logInDidCancel]; + } + else + { + if ([delegate respondsToSelector:@selector(sinaweibo:logInDidFailWithError:)]) + { + NSString *error_description = [errorInfo objectForKey:@"error_description"]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + errorInfo, @"error", + error_description, NSLocalizedDescriptionKey, nil]; + NSError *error = [NSError errorWithDomain:kSinaWeiboSDKErrorDomain + code:[error_code intValue] + userInfo:userInfo]; + [delegate sinaweibo:self logInDidFailWithError:error]; + } + + } +} + +#pragma mark - Validation + +/** + * @description 判断是否登录 + * @return YES为已登录;NO为未登录 + */ +- (BOOL)isLoggedIn +{ + return userID && accessToken && expirationDate; +} + +/** + * @description 判断登录是否过期 + * @return YES为已过期;NO为未为期 + */ +- (BOOL)isAuthorizeExpired +{ + NSDate *now = [NSDate date]; + return ([now compare:expirationDate] == NSOrderedDescending); +} + + +/** + * @description 判断登录是否有效,当已登录并且登录未过期时为有效状态 + * @return YES为有效;NO为无效 + */ +- (BOOL)isAuthValid +{ + return ([self isLoggedIn] && ![self isAuthorizeExpired]); +} + +#pragma mark - LogIn / LogOut + +/** + * @description 登录入口,当初始化SinaWeibo对象完成后直接调用此方法完成登录 + */ +- (void)logIn +{ + if ([self isAuthValid]) + { + if ([delegate respondsToSelector:@selector(sinaweiboDidLogIn:)]) + { + [delegate sinaweiboDidLogIn:self]; + } + } + else + { + [self removeAuthData]; + + ssoLoggingIn = NO; + + // open sina weibo app + UIDevice *device = [UIDevice currentDevice]; + if ([device respondsToSelector:@selector(isMultitaskingSupported)] && + [device isMultitaskingSupported]) + { + NSDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: + self.appKey, @"client_id", + self.appRedirectURI, @"redirect_uri", + self.ssoCallbackScheme, @"callback_uri", nil]; + + // 先用iPad微博打开 + NSString *appAuthBaseURL = kSinaWeiboAppAuthURL_iPad; + if (SinaWeiboIsDeviceIPad()) + { + NSString *appAuthURL = [SinaWeiboRequest serializeURL:appAuthBaseURL + params:params httpMethod:@"GET"]; + ssoLoggingIn = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appAuthURL]]; + } + + // 在用iPhone微博打开 + if (!ssoLoggingIn) + { + appAuthBaseURL = kSinaWeiboAppAuthURL_iPhone; + NSString *appAuthURL = [SinaWeiboRequest serializeURL:appAuthBaseURL + params:params httpMethod:@"GET"]; + ssoLoggingIn = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appAuthURL]]; + } + } + + if (!ssoLoggingIn) + { + // open authorize view + + NSDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: + self.appKey, @"client_id", + @"code", @"response_type", + self.appRedirectURI, @"redirect_uri", + @"mobile", @"display", nil]; + + SinaWeiboAuthorizeView *authorizeView = \ + [[SinaWeiboAuthorizeView alloc] initWithAuthParams:params + delegate:self]; + [authorizeView show]; + [authorizeView release]; + } + } +} + +/** + * @description 退出方法,需要退出时直接调用此方法 + */ +- (void)logOut +{ + [self removeAuthData]; + + if ([delegate respondsToSelector:@selector(sinaweiboDidLogOut:)]) + { + [delegate sinaweiboDidLogOut:self]; + } +} + +#pragma mark - Send request with token + +/** + * @description 微博API的请求接口,方法中自动完成token信息的拼接 + * @param url: 请求的接口 + * @param params: 请求的参数,如发微博所带的文字内容等 + * @param httpMethod: http类型,GET或POST + * @param _delegate: 处理请求结果的回调的对象,SinaweiboRequestDelegate类 + * @return 完成实际请求操作的SinaWeiboRequest对象 + */ + +- (SinaWeiboRequest *)requestWithURL:(NSString *)url + params:(NSMutableDictionary *)params + httpMethod:(NSString *)httpMethod + delegate:(id)_delegate +{ + if (params == nil) + { + params = [NSMutableDictionary dictionary]; + } + + if ([self isAuthValid]) + { + [params setValue:self.accessToken forKey:@"access_token"]; + NSString *fullURL = [kSinaWeiboSDKAPIDomain stringByAppendingString:url]; + + SinaWeiboRequest *_request = [SinaWeiboRequest requestWithURL:fullURL + httpMethod:httpMethod + params:params + delegate:_delegate]; + _request.sinaweibo = self; + [requests addObject:_request]; + [_request connect]; + return _request; + } + else + { + //notify token expired in next runloop + [self performSelectorOnMainThread:@selector(notifyTokenExpired:) + withObject:_delegate + waitUntilDone:NO]; + + return nil; + } +} + +#pragma mark - SinaWeiboAuthorizeView Delegate + +- (void)authorizeView:(SinaWeiboAuthorizeView *)authView didRecieveAuthorizationCode:(NSString *)code +{ + [self requestAccessTokenWithAuthorizationCode:code]; +} + +- (void)authorizeView:(SinaWeiboAuthorizeView *)authView didFailWithErrorInfo:(NSDictionary *)errorInfo +{ + [self logInDidFailWithErrorInfo:errorInfo]; +} + +- (void)authorizeViewDidCancel:(SinaWeiboAuthorizeView *)authView +{ + [self logInDidCancel]; +} + +#pragma mark - SinaWeiboRequest Delegate + +- (void)request:(SinaWeiboRequest *)_request didFailWithError:(NSError *)error +{ + if (_request == request) + { + if ([delegate respondsToSelector:@selector(sinaweibo:logInDidFailWithError:)]) + { + [delegate sinaweibo:self logInDidFailWithError:error]; + } + + [request release], request = nil; + } +} + +- (void)request:(SinaWeiboRequest *)_request didFinishLoadingWithResult:(id)result +{ + if (_request == request) + { + NSLog(@"access token result = %@", result); + + [self logInDidFinishWithAuthInfo:result]; + [request release], request = nil; + } +} + +#pragma mark - Application life cycle + +/** + * @description 当应用从后台唤起时,应调用此方法,需要完成退出当前登录状态的功能 + */ +- (void)applicationDidBecomeActive +{ + if (ssoLoggingIn) + { + // user open the app manually + // clean sso login state + ssoLoggingIn = NO; + + if ([delegate respondsToSelector:@selector(sinaweiboLogInDidCancel:)]) + { + [delegate sinaweiboLogInDidCancel:self]; + } + } +} + +/** + * @description sso回调方法,官方客户端完成sso授权后,回调唤起应用,应用中应调用此方法完成sso登录 + * @param url: 官方客户端回调给应用时传回的参数,包含认证信息等 + * @return YES + */ +- (BOOL)handleOpenURL:(NSURL *)url +{ + NSString *urlString = [url absoluteString]; + if ([urlString hasPrefix:self.ssoCallbackScheme]) + { + if (!ssoLoggingIn) + { + // sso callback after user have manually opened the app + // ignore the request + } + else + { + ssoLoggingIn = NO; + + if ([SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"sso_error_user_cancelled"]) + { + if ([delegate respondsToSelector:@selector(sinaweiboLogInDidCancel:)]) + { + [delegate sinaweiboLogInDidCancel:self]; + } + } + else if ([SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"sso_error_invalid_params"]) + { + if ([delegate respondsToSelector:@selector(sinaweibo:logInDidFailWithError:)]) + { + NSString *error_description = @"Invalid sso params"; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + error_description, NSLocalizedDescriptionKey, nil]; + NSError *error = [NSError errorWithDomain:kSinaWeiboSDKErrorDomain + code:kSinaWeiboSDKErrorCodeSSOParamsError + userInfo:userInfo]; + [delegate sinaweibo:self logInDidFailWithError:error]; + } + } + else if ([SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"error_code"]) + { + NSString *error_code = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"error_code"]; + NSString *error = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"error"]; + NSString *error_uri = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"error_uri"]; + NSString *error_description = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"error_description"]; + + NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys: + error, @"error", + error_uri, @"error_uri", + error_code, @"error_code", + error_description, @"error_description", nil]; + + [self logInDidFailWithErrorInfo:errorInfo]; + } + else + { + NSString *access_token = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"access_token"]; + NSString *expires_in = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"expires_in"]; + NSString *remind_in = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"remind_in"]; + NSString *uid = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"uid"]; + NSString *refresh_token = [SinaWeiboRequest getParamValueFromUrl:urlString paramName:@"refresh_token"]; + + NSMutableDictionary *authInfo = [NSMutableDictionary dictionary]; + if (access_token) [authInfo setObject:access_token forKey:@"access_token"]; + if (expires_in) [authInfo setObject:expires_in forKey:@"expires_in"]; + if (remind_in) [authInfo setObject:remind_in forKey:@"remind_in"]; + if (refresh_token) [authInfo setObject:refresh_token forKey:@"refresh_token"]; + if (uid) [authInfo setObject:uid forKey:@"uid"]; + + [self logInDidFinishWithAuthInfo:authInfo]; + } + } + } + return YES; +} + +@end + +BOOL SinaWeiboIsDeviceIPad() +{ +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200 + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) + { + return YES; + } +#endif + return NO; +} diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.h b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.h new file mode 100755 index 0000000000..2c001def1b --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.h @@ -0,0 +1,46 @@ +// +// SinaWeiboAuthorizeView.h +// sinaweibo_ios_sdk +// +// Created by Wade Cheng on 4/19/12. +// Copyright (c) 2012 SINA. All rights reserved. +// + +#import +#import + +@protocol SinaWeiboAuthorizeViewDelegate; + +@interface SinaWeiboAuthorizeView : UIView +{ + UIWebView *webView; + UIButton *closeButton; + UIView *modalBackgroundView; + UIActivityIndicatorView *indicatorView; + UIInterfaceOrientation previousOrientation; + + id delegate; + + NSString *appRedirectURI; + NSDictionary *authParams; +} + +@property (nonatomic, assign) id delegate; + +- (id)initWithAuthParams:(NSDictionary *)params + delegate:(id)delegate; + +- (void)show; +- (void)hide; + +@end + +@protocol SinaWeiboAuthorizeViewDelegate + +- (void)authorizeView:(SinaWeiboAuthorizeView *)authView + didRecieveAuthorizationCode:(NSString *)code; +- (void)authorizeView:(SinaWeiboAuthorizeView *)authView + didFailWithErrorInfo:(NSDictionary *)errorInfo; +- (void)authorizeViewDidCancel:(SinaWeiboAuthorizeView *)authView; + +@end \ No newline at end of file diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.m b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.m new file mode 100755 index 0000000000..62e5fae8dd --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboAuthorizeView.m @@ -0,0 +1,465 @@ +// +// SinaWeiboAuthorizeView.m +// sinaweibo_ios_sdk +// +// Created by Wade Cheng on 4/19/12. +// Copyright (c) 2012 SINA. All rights reserved. +// + +#import "SinaWeiboAuthorizeView.h" +#import "SinaWeiboRequest.h" +#import "SinaWeibo.h" +#import "SinaWeiboConstants.h" +#import + +static CGFloat kBorderGray[4] = {0.3, 0.3, 0.3, 0.8}; +static CGFloat kBorderBlack[4] = {0.3, 0.3, 0.3, 1}; +static CGFloat kTransitionDuration = 0.3; +static CGFloat kPadding = 0; +static CGFloat kBorderWidth = 10; + +@implementation SinaWeiboAuthorizeView + +@synthesize delegate; + +#pragma mark - Drawing + +- (void)addRoundedRectToPath:(CGContextRef)context rect:(CGRect)rect radius:(float)radius +{ + CGContextBeginPath(context); + CGContextSaveGState(context); + + if (radius == 0) + { + CGContextTranslateCTM(context, CGRectGetMinX(rect), CGRectGetMinY(rect)); + CGContextAddRect(context, rect); + } + else + { + rect = CGRectOffset(CGRectInset(rect, 0.5, 0.5), 0.5, 0.5); + CGContextTranslateCTM(context, CGRectGetMinX(rect)-0.5, CGRectGetMinY(rect)-0.5); + CGContextScaleCTM(context, radius, radius); + float fw = CGRectGetWidth(rect) / radius; + float fh = CGRectGetHeight(rect) / radius; + + CGContextMoveToPoint(context, fw, fh/2); + CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1); + CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1); + CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1); + CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); + } + + CGContextClosePath(context); + CGContextRestoreGState(context); +} + +- (void)drawRect:(CGRect)rect fill:(const CGFloat*)fillColors radius:(CGFloat)radius +{ + CGContextRef context = UIGraphicsGetCurrentContext(); + CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); + + if (fillColors) + { + CGContextSaveGState(context); + CGContextSetFillColor(context, fillColors); + if (radius) + { + [self addRoundedRectToPath:context rect:rect radius:radius]; + CGContextFillPath(context); + } + else + { + CGContextFillRect(context, rect); + } + CGContextRestoreGState(context); + } + + CGColorSpaceRelease(space); +} + +- (void)strokeLines:(CGRect)rect stroke:(const CGFloat*)strokeColor +{ + CGContextRef context = UIGraphicsGetCurrentContext(); + CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); + + CGContextSaveGState(context); + CGContextSetStrokeColorSpace(context, space); + CGContextSetStrokeColor(context, strokeColor); + CGContextSetLineWidth(context, 1.0); + + { + CGPoint points[] = {{rect.origin.x+0.5, rect.origin.y-0.5}, + {rect.origin.x+rect.size.width, rect.origin.y-0.5}}; + CGContextStrokeLineSegments(context, points, 2); + } + { + CGPoint points[] = {{rect.origin.x+0.5, rect.origin.y+rect.size.height-0.5}, + {rect.origin.x+rect.size.width-0.5, rect.origin.y+rect.size.height-0.5}}; + CGContextStrokeLineSegments(context, points, 2); + } + { + CGPoint points[] = {{rect.origin.x+rect.size.width-0.5, rect.origin.y}, + {rect.origin.x+rect.size.width-0.5, rect.origin.y+rect.size.height}}; + CGContextStrokeLineSegments(context, points, 2); + } + { + CGPoint points[] = {{rect.origin.x+0.5, rect.origin.y}, + {rect.origin.x+0.5, rect.origin.y+rect.size.height}}; + CGContextStrokeLineSegments(context, points, 2); + } + + CGContextRestoreGState(context); + + CGColorSpaceRelease(space); +} + +- (void)drawRect:(CGRect)rect +{ + [self drawRect:rect fill:kBorderGray radius:0]; + + CGRect webRect = CGRectMake( + ceil(rect.origin.x+kBorderWidth), ceil(rect.origin.y+kBorderWidth)+1, + rect.size.width-kBorderWidth*2, rect.size.height-(1+kBorderWidth*2)); + + [self strokeLines:webRect stroke:kBorderBlack]; +} + +#pragma mark - Memory management + +- (id)init +{ + if ((self = [super init])) + { + self.backgroundColor = [UIColor clearColor]; + self.autoresizesSubviews = YES; + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.contentMode = UIViewContentModeRedraw; + + webView = [[UIWebView alloc] init]; + webView.delegate = self; + webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self addSubview:webView]; + [webView release]; + + UIImage* closeImage = [UIImage imageNamed:@"SinaWeibo.bundle/images/close.png"]; + UIColor* color = [UIColor colorWithRed:167.0/255 green:184.0/255 blue:216.0/255 alpha:1]; + closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [closeButton setImage:closeImage forState:UIControlStateNormal]; + [closeButton setTitleColor:color forState:UIControlStateNormal]; + [closeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted]; + [closeButton addTarget:self action:@selector(cancel) + forControlEvents:UIControlEventTouchUpInside]; + closeButton.titleLabel.font = [UIFont boldSystemFontOfSize:12]; + closeButton.showsTouchWhenHighlighted = YES; + closeButton.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; + [self addSubview:closeButton]; + + indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: + UIActivityIndicatorViewStyleGray]; + indicatorView.autoresizingMask = + UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin + | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; + [self addSubview:indicatorView]; + + modalBackgroundView = [[UIView alloc] init]; + } + + return self; +} + +- (void)dealloc +{ + [authParams release], authParams = nil; + [appRedirectURI release], appRedirectURI = nil; + [modalBackgroundView release], modalBackgroundView = nil; + + [super dealloc]; +} + +- (id)initWithAuthParams:(NSDictionary *)params + delegate:(id)_delegate +{ + if ((self = [self init])) + { + self.delegate = _delegate; + authParams = [params copy]; + appRedirectURI = [[authParams objectForKey:@"redirect_uri"] retain]; + } + return self; +} + +#pragma mark - View orientation + +- (BOOL)shouldRotateToOrientation:(UIInterfaceOrientation)orientation +{ + if (orientation == previousOrientation) + { + return NO; + } + else + { + return orientation == UIInterfaceOrientationPortrait + || orientation == UIInterfaceOrientationPortraitUpsideDown + || orientation == UIInterfaceOrientationLandscapeLeft + || orientation == UIInterfaceOrientationLandscapeRight; + } +} + +- (CGAffineTransform)transformForOrientation +{ + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; + if (orientation == UIInterfaceOrientationLandscapeLeft) + { + return CGAffineTransformMakeRotation(M_PI*1.5); + } + else if (orientation == UIInterfaceOrientationLandscapeRight) + { + return CGAffineTransformMakeRotation(M_PI/2); + } + else if (orientation == UIInterfaceOrientationPortraitUpsideDown) + { + return CGAffineTransformMakeRotation(-M_PI); + } + else + { + return CGAffineTransformIdentity; + } +} + +- (void)sizeToFitOrientation:(BOOL)transform +{ + if (transform) + { + self.transform = CGAffineTransformIdentity; + } + + CGRect frame = [UIScreen mainScreen].applicationFrame; + CGPoint center = CGPointMake(frame.origin.x + ceil(frame.size.width/2), + frame.origin.y + ceil(frame.size.height/2)); + + CGFloat scaleFactor = SinaWeiboIsDeviceIPad() ? 0.6f : 1.0f; + + CGFloat width = floor(scaleFactor * frame.size.width) - kPadding * 2; + CGFloat height = floor(scaleFactor * frame.size.height) - kPadding * 2; + + previousOrientation = [UIApplication sharedApplication].statusBarOrientation; + if (UIInterfaceOrientationIsLandscape(previousOrientation)) + { + self.frame = CGRectMake(kPadding, kPadding, height, width); + } + else + { + self.frame = CGRectMake(kPadding, kPadding, width, height); + } + self.center = center; + + if (transform) + { + self.transform = [self transformForOrientation]; + } +} + +- (void)updateWebOrientation +{ + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; + if (UIInterfaceOrientationIsLandscape(orientation)) + { + [webView stringByEvaluatingJavaScriptFromString: + @"document.body.setAttribute('orientation', 90);"]; + } + else + { + [webView stringByEvaluatingJavaScriptFromString: + @"document.body.removeAttribute('orientation');"]; + } +} + +#pragma mark - UIDeviceOrientationDidChangeNotification Methods + +- (void)deviceOrientationDidChange:(id)object +{ + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; + if ([self shouldRotateToOrientation:orientation]) + { + NSTimeInterval duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration; + + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:duration]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + [self sizeToFitOrientation:orientation]; + [UIView commitAnimations]; + } +} + +#pragma mark - Animation + +- (void)bounce1AnimationStopped +{ + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:kTransitionDuration/2]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped)]; + self.transform = CGAffineTransformScale([self transformForOrientation], 0.9, 0.9); + [UIView commitAnimations]; +} + +- (void)bounce2AnimationStopped +{ + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:kTransitionDuration/2]; + self.transform = [self transformForOrientation]; + [UIView commitAnimations]; +} + +#pragma mark Obeservers + +- (void)addObservers +{ + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(deviceOrientationDidChange:) + name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +} + +- (void)removeObservers +{ + [[NSNotificationCenter defaultCenter] removeObserver:self + name:@"UIDeviceOrientationDidChangeNotification" object:nil]; +} + +#pragma mark - Activity Indicator + +- (void)showIndicator +{ + [indicatorView sizeToFit]; + [indicatorView startAnimating]; + indicatorView.center = webView.center; +} + +- (void)hideIndicator +{ + [indicatorView stopAnimating]; +} + +#pragma mark - Show / Hide + +- (void)load +{ + NSString *authPagePath = [SinaWeiboRequest serializeURL:kSinaWeiboWebAuthURL + params:authParams httpMethod:@"GET"]; + [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:authPagePath]]]; +} + +- (void)showWebView +{ + UIWindow* window = [UIApplication sharedApplication].keyWindow; + if (!window) + { + window = [[UIApplication sharedApplication].windows objectAtIndex:0]; + } + modalBackgroundView.frame = window.frame; + [modalBackgroundView addSubview:self]; + [window addSubview:modalBackgroundView]; + + self.transform = CGAffineTransformScale([self transformForOrientation], 0.001, 0.001); + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:kTransitionDuration/1.5]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped)]; + self.transform = CGAffineTransformScale([self transformForOrientation], 1.1, 1.1); + [UIView commitAnimations]; +} + +- (void)show +{ + [self load]; + [self sizeToFitOrientation:NO]; + + CGFloat innerWidth = self.frame.size.width - (kBorderWidth+1)*2; + [closeButton sizeToFit]; + closeButton.frame = CGRectMake(2, 2, 29, 29); + + webView.frame = CGRectMake(kBorderWidth+1, kBorderWidth+1, innerWidth, + self.frame.size.height - (1 + kBorderWidth*2)); + + [self showWebView]; + [self showIndicator]; + + [self addObservers]; +} + +- (void)_hide +{ + [self removeFromSuperview]; + [modalBackgroundView removeFromSuperview]; +} + +- (void)hide +{ + [self removeObservers]; + + [webView stopLoading]; + + [self performSelectorOnMainThread:@selector(_hide) withObject:nil waitUntilDone:NO]; +} + +- (void)cancel +{ + [self hide]; + [delegate authorizeViewDidCancel:self]; +} + +#pragma mark - UIWebView Delegate + +- (void)webViewDidFinishLoad:(UIWebView *)aWebView +{ + [self hideIndicator]; +} + +- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error +{ + [self hideIndicator]; +} + +- (BOOL)webView:(UIWebView *)aWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType +{ + NSString *url = request.URL.absoluteString; + NSLog(@"url = %@", url); + + NSString *siteRedirectURI = [NSString stringWithFormat:@"%@%@", kSinaWeiboSDKOAuth2APIDomain, appRedirectURI]; + + if ([url hasPrefix:appRedirectURI] || [url hasPrefix:siteRedirectURI]) + { + NSString *error_code = [SinaWeiboRequest getParamValueFromUrl:url paramName:@"error_code"]; + + if (error_code) + { + NSString *error = [SinaWeiboRequest getParamValueFromUrl:url paramName:@"error"]; + NSString *error_uri = [SinaWeiboRequest getParamValueFromUrl:url paramName:@"error_uri"]; + NSString *error_description = [SinaWeiboRequest getParamValueFromUrl:url paramName:@"error_description"]; + + NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys: + error, @"error", + error_uri, @"error_uri", + error_code, @"error_code", + error_description, @"error_description", nil]; + + [self hide]; + [delegate authorizeView:self didFailWithErrorInfo:errorInfo]; + } + else + { + NSString *code = [SinaWeiboRequest getParamValueFromUrl:url paramName:@"code"]; + if (code) + { + [self hide]; + [delegate authorizeView:self didRecieveAuthorizationCode:code]; + } + } + + return NO; + } + + return YES; +} + +@end diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboConstants.h b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboConstants.h new file mode 100755 index 0000000000..99b9556950 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboConstants.h @@ -0,0 +1,31 @@ +// +// SinaWeiboConstants.h +// sinaweibo_ios_sdk +// +// Created by Wade Cheng on 4/22/12. +// Copyright (c) 2012 SINA. All rights reserved. +// + +#ifndef sinaweibo_ios_sdk_SinaWeiboConstants_h +#define sinaweibo_ios_sdk_SinaWeiboConstants_h + +#define SinaWeiboSdkVersion @"2.0" + +#define kSinaWeiboSDKErrorDomain @"SinaWeiboSDKErrorDomain" +#define kSinaWeiboSDKErrorCodeKey @"SinaWeiboSDKErrorCodeKey" + +#define kSinaWeiboSDKAPIDomain @"https://open.weibo.cn/2/" +#define kSinaWeiboSDKOAuth2APIDomain @"https://open.weibo.cn/2/oauth2/" +#define kSinaWeiboWebAuthURL @"https://open.weibo.cn/2/oauth2/authorize" +#define kSinaWeiboWebAccessTokenURL @"https://open.weibo.cn/2/oauth2/access_token" + +#define kSinaWeiboAppAuthURL_iPhone @"sinaweibosso://login" +#define kSinaWeiboAppAuthURL_iPad @"sinaweibohdsso://login" + +typedef enum +{ + kSinaWeiboSDKErrorCodeParseError = 200, + kSinaWeiboSDKErrorCodeSSOParamsError = 202, +} SinaWeiboSDKErrorCode; + +#endif diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.h b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.h new file mode 100755 index 0000000000..5d81a213fd --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.h @@ -0,0 +1,72 @@ +// +// SinaWeiboRequest.h +// sinaweibo_ios_sdk +// Based on OAuth 2.0 +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright 2011 Sina. All rights reserved. +// + +#import + +@class SinaWeiboRequest; +@class SinaWeibo; + + +/** + * @description 第三方应用访问微博API时实现此此协议,当sdk完成api的访问后通过传入的此类对象完成接口访问结果的回调,应用在协议实现的相应方法中接收访问结果并做对应处理。 + */ +@protocol SinaWeiboRequestDelegate +@optional +- (void)request:(SinaWeiboRequest *)request didReceiveResponse:(NSURLResponse *)response; +- (void)request:(SinaWeiboRequest *)request didReceiveRawData:(NSData *)data; +- (void)request:(SinaWeiboRequest *)request didFailWithError:(NSError *)error; +- (void)request:(SinaWeiboRequest *)request didFinishLoadingWithResult:(id)result; +@end + +@interface SinaWeiboRequest : NSObject +{ + SinaWeibo *sinaweibo;//weak reference + + NSString *url; + NSString *httpMethod; + NSDictionary *params; + + NSURLConnection *connection; + NSMutableData *responseData; + + id delegate; +} + +@property (nonatomic, assign) SinaWeibo *sinaweibo; +@property (nonatomic, retain) NSString *url; +@property (nonatomic, retain) NSString *httpMethod; +@property (nonatomic, retain) NSDictionary *params; +@property (nonatomic, assign) id delegate; + ++ (SinaWeiboRequest *)requestWithURL:(NSString *)url + httpMethod:(NSString *)httpMethod + params:(NSDictionary *)params + delegate:(id)delegate; + ++ (SinaWeiboRequest *)requestWithAccessToken:(NSString *)accessToken + url:(NSString *)url + httpMethod:(NSString *)httpMethod + params:(NSDictionary *)params + delegate:(id)delegate; + ++ (NSString *)getParamValueFromUrl:(NSString*)url paramName:(NSString *)paramName; ++ (NSString *)serializeURL:(NSString *)baseURL params:(NSDictionary *)params httpMethod:(NSString *)httpMethod; + +- (void)connect; +- (void)disconnect; + +@end diff --git a/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.m b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.m new file mode 100755 index 0000000000..9909c88d9c --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SinaWeibo/SinaWeiboRequest.m @@ -0,0 +1,412 @@ +// +// SinaWeiboRequest.m +// sinaweibo_ios_sdk +// Based on OAuth 2.0 +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright 2011 Sina. All rights reserved. +// + +#import "SinaWeiboRequest.h" +#import "SinaWeiboConstants.h" +#import "JSONKit.h" +#import "SinaWeibo.h" + +#define kSinaWeiboRequestTimeOutInterval 180.0 +#define kSinaWeiboRequestStringBoundary @"293iosfksdfkiowjksdf31jsiuwq003s02dsaffafass3qw" + +@interface NSString (SinaWeiboEncode) +- (NSString *)URLEncodedString; +@end + +@implementation NSString (SinaWeiboEncode) + +- (NSString *)URLEncodedStringWithCFStringEncoding:(CFStringEncoding)encoding +{ + return [(NSString *) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)[[self mutableCopy] autorelease], NULL, CFSTR("=,!$&'()*+;@?\n\"<>#\t :/"), encoding) autorelease]; +} + +- (NSString *)URLEncodedString +{ + return [self URLEncodedStringWithCFStringEncoding:kCFStringEncodingUTF8]; +} + +@end + +@interface SinaWeibo (SinaWeiboRequest) +- (void)requestDidFinish:(SinaWeiboRequest *)request; +- (void)requestDidFailWithInvalidToken:(NSError *)error; +@end + +@interface SinaWeiboRequest (Private) + +- (void)appendUTF8Body:(NSMutableData *)body dataString:(NSString *)dataString; +- (NSMutableData *)postBodyHasRawData:(BOOL*)hasRawData; + +- (void)handleResponseData:(NSData *)data; +- (id)parseJSONData:(NSData *)data error:(NSError **)error; + +- (id)errorWithCode:(NSInteger)code userInfo:(NSDictionary *)userInfo; +- (void)failedWithError:(NSError *)error; + +@end + + +@implementation SinaWeiboRequest + +@synthesize sinaweibo; +@synthesize url; +@synthesize httpMethod; +@synthesize params; +@synthesize delegate; + +#pragma mark - SinaWeiboRequest Life Circle + +- (void)dealloc +{ + sinaweibo = nil; + + [url release], url = nil; + [httpMethod release], httpMethod = nil; + [params release], params = nil; + + [responseData release]; + responseData = nil; + + [connection cancel]; + [connection release], connection = nil; + + [super dealloc]; +} + +#pragma mark - SinaWeiboRequest Private Methods + +- (void)appendUTF8Body:(NSMutableData *)body dataString:(NSString *)dataString +{ + [body appendData:[dataString dataUsingEncoding:NSUTF8StringEncoding]]; +} + +- (NSMutableData *)postBodyHasRawData:(BOOL*)hasRawData +{ + NSString *bodyPrefixString = [NSString stringWithFormat:@"--%@\r\n", kSinaWeiboRequestStringBoundary]; + NSString *bodySuffixString = [NSString stringWithFormat:@"\r\n--%@--\r\n", kSinaWeiboRequestStringBoundary]; + + NSMutableDictionary *dataDictionary = [NSMutableDictionary dictionary]; + + NSMutableData *body = [NSMutableData data]; + [self appendUTF8Body:body dataString:bodyPrefixString]; + + for (id key in [params keyEnumerator]) + { + if (([[params valueForKey:key] isKindOfClass:[UIImage class]]) || ([[params valueForKey:key] isKindOfClass:[NSData class]])) + { + [dataDictionary setObject:[params valueForKey:key] forKey:key]; + continue; + } + + [self appendUTF8Body:body dataString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n%@\r\n", key, [params valueForKey:key]]]; + [self appendUTF8Body:body dataString:bodyPrefixString]; + } + + if ([dataDictionary count] > 0) + { + *hasRawData = YES; + for (id key in dataDictionary) + { + NSObject *dataParam = [dataDictionary valueForKey:key]; + + if ([dataParam isKindOfClass:[UIImage class]]) + { + NSData* imageData = UIImagePNGRepresentation((UIImage *)dataParam); + [self appendUTF8Body:body dataString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"file\"\r\n", key]]; + [self appendUTF8Body:body dataString:[NSString stringWithString:@"Content-Type: image/png\r\nContent-Transfer-Encoding: binary\r\n\r\n"]]; + [body appendData:imageData]; + } + else if ([dataParam isKindOfClass:[NSData class]]) + { + [self appendUTF8Body:body dataString:[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"file\"\r\n", key]]; + [self appendUTF8Body:body dataString:[NSString stringWithString:@"Content-Type: content/unknown\r\nContent-Transfer-Encoding: binary\r\n\r\n"]]; + [body appendData:(NSData*)dataParam]; + } + [self appendUTF8Body:body dataString:bodySuffixString]; + } + } + + return body; +} + +- (void)handleResponseData:(NSData *)data +{ + if ([delegate respondsToSelector:@selector(request:didReceiveRawData:)]) + { + [delegate request:self didReceiveRawData:data]; + } + + NSError *error = nil; + id result = [self parseJSONData:data error:&error]; + + if (error) + { + [self failedWithError:error]; + } + else + { + NSInteger error_code = 0; + if([result isKindOfClass:[NSDictionary class]]) + { + [[result objectForKey:@"error_code"] intValue]; + } + + if (error_code != 0) + { + NSString *error_description = [result objectForKey:@"error"]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + result, @"error", + error_description, NSLocalizedDescriptionKey, nil]; + NSError *error = [NSError errorWithDomain:kSinaWeiboSDKErrorDomain + code:[[result objectForKey:@"error_code"] intValue] + userInfo:userInfo]; + + if (error_code == 21314 //Token已经被使用 + || error_code == 21315 //Token已经过期 + || error_code == 21316 //Token不合法 + || error_code == 21317 //Token不合法 + || error_code == 21327 //token过期 + || error_code == 21332) //access_token 无效 + { + [sinaweibo requestDidFailWithInvalidToken:error]; + } + else + { + [self failedWithError:error]; + } + } + else + { + if ([delegate respondsToSelector:@selector(request:didFinishLoadingWithResult:)]) + { + [delegate request:self didFinishLoadingWithResult:(result == nil ? data : result)]; + } + } + } +} + +- (id)parseJSONData:(NSData *)data error:(NSError **)error +{ + NSError *parseError = nil; + id result =[data objectFromJSONDataWithParseOptions:JKParseOptionStrict error:&parseError]; + + if (parseError && (error != nil)) + { + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + parseError, @"error", + @"Data parse error", NSLocalizedDescriptionKey, nil]; + *error = [self errorWithCode:kSinaWeiboSDKErrorCodeParseError + userInfo:userInfo]; + } + + return result; +} + +- (id)errorWithCode:(NSInteger)code userInfo:(NSDictionary *)userInfo +{ + return [NSError errorWithDomain:kSinaWeiboSDKErrorDomain code:code userInfo:userInfo]; +} + +- (void)failedWithError:(NSError *)error +{ + if ([delegate respondsToSelector:@selector(request:didFailWithError:)]) + { + [delegate request:self didFailWithError:error]; + } +} + +#pragma mark - SinaWeiboRequest Public Methods + ++ (NSString *)getParamValueFromUrl:(NSString*)url paramName:(NSString *)paramName +{ + if (![paramName hasSuffix:@"="]) + { + paramName = [NSString stringWithFormat:@"%@=", paramName]; + } + + NSString * str = nil; + NSRange start = [url rangeOfString:paramName]; + if (start.location != NSNotFound) + { + // confirm that the parameter is not a partial name match + unichar c = '?'; + if (start.location != 0) + { + c = [url characterAtIndex:start.location - 1]; + } + if (c == '?' || c == '&' || c == '#') + { + NSRange end = [[url substringFromIndex:start.location+start.length] rangeOfString:@"&"]; + NSUInteger offset = start.location+start.length; + str = end.location == NSNotFound ? + [url substringFromIndex:offset] : + [url substringWithRange:NSMakeRange(offset, end.location)]; + str = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + } + } + return str; +} + ++ (NSString *)serializeURL:(NSString *)baseURL params:(NSDictionary *)params httpMethod:(NSString *)httpMethod +{ + NSURL* parsedURL = [NSURL URLWithString:baseURL]; + NSString* queryPrefix = parsedURL.query ? @"&" : @"?"; + + NSMutableArray* pairs = [NSMutableArray array]; + for (NSString* key in [params keyEnumerator]) + { + if (([[params objectForKey:key] isKindOfClass:[UIImage class]]) + ||([[params objectForKey:key] isKindOfClass:[NSData class]])) + { + if ([httpMethod isEqualToString:@"GET"]) + { + NSLog(@"can not use GET to upload a file"); + } + continue; + } + + NSString* escaped_value = (NSString *)CFURLCreateStringByAddingPercentEscapes( + NULL, /* allocator */ + (CFStringRef)[params objectForKey:key], + NULL, /* charactersToLeaveUnescaped */ + (CFStringRef)@"!*'();:@&=+$,/?%#[]", + kCFStringEncodingUTF8); + + [pairs addObject:[NSString stringWithFormat:@"%@=%@", key, escaped_value]]; + [escaped_value release]; + } + NSString* query = [pairs componentsJoinedByString:@"&"]; + + return [NSString stringWithFormat:@"%@%@%@", baseURL, queryPrefix, query]; +} + ++ (SinaWeiboRequest *)requestWithURL:(NSString *)url + httpMethod:(NSString *)httpMethod + params:(NSDictionary *)params + delegate:(id)delegate +{ + SinaWeiboRequest *request = [[[SinaWeiboRequest alloc] init] autorelease]; + + request.url = url; + request.httpMethod = httpMethod; + request.params = params; + request.delegate = delegate; + + return request; +} + ++ (SinaWeiboRequest *)requestWithAccessToken:(NSString *)accessToken + url:(NSString *)url + httpMethod:(NSString *)httpMethod + params:(NSDictionary *)params + delegate:(id)delegate +{ + // add the access token field + NSMutableDictionary *mutableParams = [NSMutableDictionary dictionaryWithDictionary:params]; + [mutableParams setObject:accessToken forKey:@"access_token"]; + return [SinaWeiboRequest requestWithURL:url + httpMethod:httpMethod + params:mutableParams + delegate:delegate]; +} + +- (void)connect +{ + NSString* urlString = [[self class] serializeURL:url params:params httpMethod:httpMethod]; + NSMutableURLRequest* request = + [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString] + cachePolicy:NSURLRequestReloadIgnoringLocalCacheData + timeoutInterval:kSinaWeiboRequestTimeOutInterval]; + + [request setHTTPMethod:self.httpMethod]; + if ([self.httpMethod isEqualToString: @"POST"]) + { + BOOL hasRawData = NO; + [request setHTTPBody:[self postBodyHasRawData:&hasRawData]]; + + if (hasRawData) + { + NSString* contentType = [NSString + stringWithFormat:@"multipart/form-data; boundary=%@", kSinaWeiboRequestStringBoundary]; + [request setValue:contentType forHTTPHeaderField:@"Content-Type"]; + } + } + + connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; +} + +- (void)disconnect +{ + [responseData release]; + responseData = nil; + + [connection cancel]; + [connection release], connection = nil; +} + +#pragma mark - NSURLConnection Delegate Methods + +- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response +{ + responseData = [[NSMutableData alloc] init]; + + if ([delegate respondsToSelector:@selector(request:didReceiveResponse:)]) + { + [delegate request:self didReceiveResponse:response]; + } +} + +- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data +{ + [responseData appendData:data]; +} + +- (NSCachedURLResponse *)connection:(NSURLConnection *)connection + willCacheResponse:(NSCachedURLResponse*)cachedResponse +{ + return nil; +} + +- (void)connectionDidFinishLoading:(NSURLConnection *)theConnection +{ + [self handleResponseData:responseData]; + + [responseData release]; + responseData = nil; + + [connection cancel]; + [connection release]; + connection = nil; + + [sinaweibo requestDidFinish:self]; +} + +- (void)connection:(NSURLConnection *)theConnection didFailWithError:(NSError *)error +{ + [self failedWithError:error]; + + [responseData release]; + responseData = nil; + + [connection cancel]; + [connection release]; + connection = nil; + + [sinaweibo requestDidFinish:self]; +} + +@end diff --git a/plugin/plugins/weibo/proj.ios/SocialWeibo.h b/plugin/plugins/weibo/proj.ios/SocialWeibo.h new file mode 100644 index 0000000000..eee8bd4626 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SocialWeibo.h @@ -0,0 +1,56 @@ +/**************************************************************************** + Copyright (c) 2012-2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "InterfaceSocial.h" +#import "SinaWeibo.h" +#import "SinaWeiboRequest.h" + +@interface SocialWeibo : NSObject +{ + SinaWeibo *sinaweibo; +} + +@property (copy, nonatomic) NSMutableDictionary* mShareInfo; +@property (readonly, nonatomic) SinaWeibo *sinaweibo; +@property BOOL debug; + +/** + methods of protocol : InterfaceSocial + */ +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; +- (void) share: (NSMutableDictionary*) shareInfo; +- (void) setDebugMode: (BOOL) debug; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +/** + methods of protocol : SinaWeiboDelegate + */ +- (void)sinaweiboDidLogIn:(SinaWeibo *)sinaweibo; +- (void)sinaweiboDidLogOut:(SinaWeibo *)sinaweibo; +- (void)sinaweiboLogInDidCancel:(SinaWeibo *)sinaweibo; +- (void)sinaweibo:(SinaWeibo *)sinaweibo logInDidFailWithError:(NSError *)error; +- (void)sinaweibo:(SinaWeibo *)sinaweibo accessTokenInvalidOrExpired:(NSError *)error; + +@end diff --git a/plugin/plugins/weibo/proj.ios/SocialWeibo.m b/plugin/plugins/weibo/proj.ios/SocialWeibo.m new file mode 100644 index 0000000000..e3932688a6 --- /dev/null +++ b/plugin/plugins/weibo/proj.ios/SocialWeibo.m @@ -0,0 +1,186 @@ +/**************************************************************************** + Copyright (c) 2012-2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "SocialWeibo.h" +#import "SocialWrapper.h" +#import "SinaWeibo/SinaWeiboConstants.h" + +#define OUTPUT_LOG(...) if (self.debug) NSLog(__VA_ARGS__); + +@implementation SocialWeibo + +@synthesize mShareInfo; +@synthesize sinaweibo; +@synthesize debug = __debug; + +- (void)dealloc +{ + if (sinaweibo) { + [sinaweibo release]; + sinaweibo = nil; + } + + [super dealloc]; +} + +#pragma mark - InterfaceSocial + +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo +{ + OUTPUT_LOG(@"configDeveloperInfo invoked (%@)", [cpInfo description]); + + if (! sinaweibo) { + NSString* appKey = (NSString*) [cpInfo objectForKey:@"WeiboAppKey"]; + NSString* appSecret = (NSString*) [cpInfo objectForKey:@"WeiboAppSecret"]; + NSString* appUrl = (NSString*) [cpInfo objectForKey:@"WeiboRedirectUrl"]; + + sinaweibo = [[SinaWeibo alloc] initWithAppKey:appKey appSecret:appSecret appRedirectURI:appUrl andDelegate: self]; + } +} + +- (void) share: (NSMutableDictionary*) shareInfo +{ + OUTPUT_LOG(@"share invoked (%@)", [shareInfo description]); + assert(sinaweibo != nil); + + self.mShareInfo = shareInfo; + BOOL authValid = sinaweibo.isAuthValid; + if (! authValid) { + [sinaweibo logIn]; + } else { + [self doShare]; + } +} + +- (void) doShare +{ + NSString* strText = [mShareInfo objectForKey:@"SharedText"]; + NSString* strImgPath = [mShareInfo objectForKey:@"SharedImagePath"]; + + if (nil == strImgPath) { + [sinaweibo requestWithURL:@"statuses/update.json" + params:[NSMutableDictionary dictionaryWithObjectsAndKeys:strText, @"status", nil] + httpMethod:@"POST" + delegate:self]; + } else { + [sinaweibo requestWithURL:@"statuses/upload.json" + params:[NSMutableDictionary dictionaryWithObjectsAndKeys: + strText, @"status", + [UIImage imageNamed:strImgPath], @"pic", nil] + httpMethod:@"POST" + delegate:self]; + } +} + +- (void) setDebugMode: (BOOL) debug +{ + self.debug = debug; +} + +- (NSString*) getSDKVersion +{ + return SinaWeiboSdkVersion; +} + +- (NSString*) getPluginVersion +{ + return @"0.2.0"; +} + +#pragma mark - SinaWeibo Delegate + +- (void)storeAuthData +{ + NSDictionary *authData = [NSDictionary dictionaryWithObjectsAndKeys: + sinaweibo.accessToken, @"AccessTokenKey", + sinaweibo.expirationDate, @"ExpirationDateKey", + sinaweibo.userID, @"UserIDKey", + sinaweibo.refreshToken, @"refresh_token", nil]; + [[NSUserDefaults standardUserDefaults] setObject:authData forKey:@"SinaWeiboAuthData"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (void)removeAuthData +{ + [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"SinaWeiboAuthData"]; +} + +- (void)sinaweiboDidLogIn:(SinaWeibo *)weibo +{ + OUTPUT_LOG(@"sinaweiboDidLogIn userID = %@ accesstoken = %@ expirationDate = %@ refresh_token = %@", + weibo.userID, weibo.accessToken, weibo.expirationDate,weibo.refreshToken); + + [self storeAuthData]; + + if (nil != mShareInfo) { + [self doShare]; + } +} + +- (void)sinaweiboDidLogOut:(SinaWeibo *)sinaweibo +{ + OUTPUT_LOG(@"sinaweiboDidLogOut"); + [self removeAuthData]; +} + +- (void)sinaweiboLogInDidCancel:(SinaWeibo *)sinaweibo +{ + OUTPUT_LOG(@"sinaweiboLogInDidCancel"); + [SocialWrapper onShareResult:self withRet:kShareCancel withMsg:@"User Canceled"]; +} + +- (void)sinaweibo:(SinaWeibo *)sinaweibo logInDidFailWithError:(NSError *)error +{ + OUTPUT_LOG(@"sinaweibo logInDidFailWithError %@", error); + [SocialWrapper onShareResult:self withRet:kShareFail withMsg:[error description]]; +} + +- (void)sinaweibo:(SinaWeibo *)sinaweibo accessTokenInvalidOrExpired:(NSError *)error +{ + OUTPUT_LOG(@"sinaweiboAccessTokenInvalidOrExpired %@", error); + [self removeAuthData]; + [SocialWrapper onShareResult:self withRet:kShareFail withMsg:[error description]]; +} + +#pragma mark - SinaWeiboRequest Delegate + +- (void)request:(SinaWeiboRequest *)request didFailWithError:(NSError *)error +{ + if ([request.url hasSuffix:@"statuses/update.json"] || + [request.url hasSuffix:@"statuses/upload.json"]) + { + [SocialWrapper onShareResult:self withRet:kShareFail withMsg:[error description]]; + } +} + +- (void)request:(SinaWeiboRequest *)request didFinishLoadingWithResult:(id)result +{ + if ([request.url hasSuffix:@"statuses/update.json"] || + [request.url hasSuffix:@"statuses/upload.json"]) + { + [SocialWrapper onShareResult:self withRet:kShareSuccess withMsg:@"Share Success"]; + } +} + +@end diff --git a/plugin/protocols/PluginManager.cpp b/plugin/protocols/PluginManager.cpp new file mode 100644 index 0000000000..f39a893ca2 --- /dev/null +++ b/plugin/protocols/PluginManager.cpp @@ -0,0 +1,105 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginManager.h" +#include "PluginFactory.h" + +namespace cocos2d { namespace plugin { + +static PluginManager* s_pPluginManager = NULL; + +PluginManager::PluginManager(void) +{ +} + +PluginManager::~PluginManager() +{ + std::map::iterator it = m_pluginsMap.begin(); + for (;it != m_pluginsMap.end();++it) + { + if (it->second != NULL) { + delete it->second; + it->second = NULL; + } + } + m_pluginsMap.clear(); +} + +PluginManager* PluginManager::getInstance() +{ + if (s_pPluginManager == NULL) + { + s_pPluginManager = new PluginManager(); + } + return s_pPluginManager; +} + +void PluginManager::end() +{ + if (s_pPluginManager != NULL) + { + delete s_pPluginManager; + s_pPluginManager = NULL; + } + + PluginFactory::purgeFactory(); +} + +PluginProtocol* PluginManager::loadPlugin(const char* name) +{ + PluginProtocol* pRet = NULL; + do { + if (name == NULL || strlen(name) == 0) break; + std::map::iterator it = m_pluginsMap.find(name); + if (it != m_pluginsMap.end()) + { + if (it->second == NULL) { + it->second = PluginFactory::getInstance()->createPlugin(name); + } + pRet = it->second; + } else + { + pRet = PluginFactory::getInstance()->createPlugin(name); + m_pluginsMap["name"] = pRet; + } + } while (false); + + return pRet; +} + +void PluginManager::unloadPlugin(const char* name) +{ + do { + if (name == NULL || strlen(name) == 0) break; + std::map::iterator it = m_pluginsMap.find(name); + if (it != m_pluginsMap.end()) + { + if (it->second != NULL) { + delete it->second; + it->second = NULL; + } + } + } while (false); +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/PluginParam.cpp b/plugin/protocols/PluginParam.cpp new file mode 100644 index 0000000000..cf1fe80e79 --- /dev/null +++ b/plugin/protocols/PluginParam.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "PluginParam.h" + +namespace cocos2d { namespace plugin { + +PluginParam::PluginParam() +{ + m_type = kParamTypeNull; +} + +PluginParam::PluginParam(int nValue) +: m_nValue(nValue) +{ + m_type = kParamTypeInt; +} + +PluginParam::PluginParam(float fValue) +: m_fValue(fValue) +{ + m_type = kParamTypeFloat; +} + +PluginParam::PluginParam(bool bValue) +: m_bValue(bValue) +{ + m_type = kParamTypeBool; +} + +PluginParam::PluginParam(const char* strValue) +: m_strValue(strValue) +{ + m_type = kParamTypeString; +} + +PluginParam::PluginParam(std::map mapValue) +: m_mapValue(mapValue) +{ + m_type = kParamTypeMap; +} + +PluginParam::PluginParam(StringMap strMapValue) +: m_strMapValue(strMapValue) +{ + m_type = kParamTypeStringMap; +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/include/PluginFactory.h b/plugin/protocols/include/PluginFactory.h new file mode 100644 index 0000000000..c331eb87f3 --- /dev/null +++ b/plugin/protocols/include/PluginFactory.h @@ -0,0 +1,51 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PLUGIN_FACTORY_H__ +#define __CCX_PLUGIN_FACTORY_H__ + +namespace cocos2d { namespace plugin { + +class PluginProtocol; +class PluginManager; +class PluginFactory +{ +public: + virtual ~PluginFactory(); + /** Get singleton of PluginFactory */ + static PluginFactory* getInstance(); + + /** Destory the instance of PluginFactory */ + static void purgeFactory(); + +private: + friend class PluginManager; + PluginFactory(void); + + /** create the plugin by name */ + PluginProtocol* createPlugin(const char* name); +}; + +}} //namespace cocos2d { namespace plugin { + +#endif /* __CCX_PLUGIN_FACTORY_H__ */ diff --git a/plugin/protocols/include/PluginManager.h b/plugin/protocols/include/PluginManager.h new file mode 100644 index 0000000000..8800487f78 --- /dev/null +++ b/plugin/protocols/include/PluginManager.h @@ -0,0 +1,54 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PLUGINMANAGER_H__ +#define __CCX_PLUGINMANAGER_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace cocos2d { namespace plugin { + +class PluginManager +{ +public: + virtual ~PluginManager(); + /** Get singleton of PluginManager */ + static PluginManager* getInstance(); + /** Destory the instance of PluginManager */ + static void end(); + + /** load the plugin by name */ + PluginProtocol* loadPlugin(const char* name); + /** unload the plugin by name */ + void unloadPlugin(const char* name); + +private: + PluginManager(void); + std::map m_pluginsMap; +}; + +}} //namespace cocos2d { namespace plugin { + +#endif /* __CCX_PLUGINMANAGER_H__ */ diff --git a/plugin/protocols/include/PluginParam.h b/plugin/protocols/include/PluginParam.h new file mode 100644 index 0000000000..3de45c0390 --- /dev/null +++ b/plugin/protocols/include/PluginParam.h @@ -0,0 +1,100 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PLUGIN_PARAM_H__ +#define __CCX_PLUGIN_PARAM_H__ + +#include +#include + +typedef std::map StringMap; + +namespace cocos2d { namespace plugin { + +class PluginProtocol; +class PluginParam +{ +public: + PluginParam(); + PluginParam(int nValue); + PluginParam(float fValue); + PluginParam(bool bValue); + PluginParam(const char* strValue); + PluginParam(StringMap strMapValue); + + typedef enum{ + kParamTypeNull = 0, + kParamTypeInt, + kParamTypeFloat, + kParamTypeBool, + kParamTypeString, + kParamTypeStringMap, + kParamTypeMap, + } ParamType; + + inline ParamType getCurrentType() { + return m_type; + } + + inline int getIntValue() { + return m_nValue; + } + + inline float getFloatValue() { + return m_fValue; + } + + inline bool getBoolValue() { + return m_bValue; + } + + inline const char* getStringValue() { + return m_strValue.c_str(); + } + + inline std::map getMapValue() { + return m_mapValue; + } + + inline StringMap getStrMapValue() { + return m_strMapValue; + } + +private: + friend class PluginProtocol; + PluginParam(std::map mapValue); + +private: + ParamType m_type; + + int m_nValue; + float m_fValue; + bool m_bValue; + std::string m_strValue; + std::map m_mapValue; + StringMap m_strMapValue; +}; + +}} //namespace cocos2d { namespace plugin { + +#endif /* __CCX_PLUGIN_PARAM_H__ */ diff --git a/plugin/protocols/include/PluginProtocol.h b/plugin/protocols/include/PluginProtocol.h new file mode 100644 index 0000000000..57a0d3aae0 --- /dev/null +++ b/plugin/protocols/include/PluginProtocol.h @@ -0,0 +1,84 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_IPLUGIN_H__ +#define __CCX_IPLUGIN_H__ + +#include "PluginParam.h" +#include + +namespace cocos2d { namespace plugin { + +/** + The super class for all plugins. +*/ +class PluginFactory; +class PluginProtocol +{ +public: + virtual ~PluginProtocol(); + + /** + @brief plug-in info methods(name, version, SDK version) + */ + inline const char* getPluginName() { return m_pPluginName.c_str(); } + const char* getPluginVersion(); + const char* getSDKVersion(); + + /** + @brief switch debug plug-in on/off + */ + void setDebugMode(bool bDebug); + + /** + * @brief methods for reflections + */ + void callFuncWithParam(const char* funcName, PluginParam* param, ...); + void callFuncWithParam(const char* funcName, std::vector params); + + const char* callStringFuncWithParam(const char* funcName, PluginParam* param, ...); + const char* callStringFuncWithParam(const char* funcName, std::vector params); + + int callIntFuncWithParam(const char* funcName, PluginParam* param, ...); + int callIntFuncWithParam(const char* funcName, std::vector params); + + bool callBoolFuncWithParam(const char* funcName, PluginParam* param, ...); + bool callBoolFuncWithParam(const char* funcName, std::vector params); + + float callFloatFuncWithParam(const char* funcName, PluginParam* param, ...); + float callFloatFuncWithParam(const char* funcName, std::vector params); + +protected: + PluginProtocol() {} + +private: + friend class PluginFactory; + inline void setPluginName(const char* name) { + m_pPluginName = name; + } + std::string m_pPluginName; +}; + +}} //namespace cocos2d { namespace plugin { + +#endif /* __CCX_IPLUGIN_H__ */ diff --git a/plugin/protocols/include/ProtocolAds.h b/plugin/protocols/include/ProtocolAds.h new file mode 100644 index 0000000000..4ca675cf1d --- /dev/null +++ b/plugin/protocols/include/ProtocolAds.h @@ -0,0 +1,136 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PROTOCOL_ADS_H__ +#define __CCX_PROTOCOL_ADS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace cocos2d { namespace plugin { + +typedef std::map TAdsDeveloperInfo; + +typedef enum +{ + kAdsReceived = 0, // The ad is received + + kFullScreenViewShown, // The full screen advertisement shown + kFullScreenViewDismissed, // The full screen advertisement dismissed + + kPointsSpendSucceed, // The points spend succeed + kPointsSpendFailed, // The points spend failed + + kNetworkError, // Network error + kUnknownError, // Unknown error +} AdsResultCode; + +class ProtocolAds; +class AdsListener +{ +public: + /** + @brief The advertisement request result + */ + virtual void onAdsResult(AdsResultCode code, const char* msg) = 0; + + /** + @brief Player get points from advertisement(For example: Tapjoy) + @param points The point number player has got. + @param pAdsPlugin The plugin which the player get points. Used to spend the points. + */ + virtual void onPlayerGetPoints(ProtocolAds* pAdsPlugin, int points) {} +}; + +class ProtocolAds : public PluginProtocol +{ +public: + ProtocolAds(); + virtual ~ProtocolAds(); + + typedef enum { + kBannerAd = 0, + kFullScreenAd, + } AdsType; + + typedef enum { + kPosCenter = 0, + kPosTop, + kPosTopLeft, + kPosTopRight, + kPosBottom, + kPosBottomLeft, + kPosBottomRight, + } AdsPos; + + /** + @brief config the application info + @param devInfo This parameter is the info of aplication, + different plugin have different format + @warning Must invoke this interface before other interfaces. + And invoked only once. + */ + void configDeveloperInfo(TAdsDeveloperInfo devInfo); + + /** + @brief show adview + @param type The adview type need to show. + @param sizeEnum The size of the banner view. + (only used when type is kBannerAd) + In different plugin, it's have different mean. + Pay attention to the subclass definition + @param pos The position where the adview be shown. + (only used when type is kBannerAd) + */ + void showAds(AdsType type, int sizeEnum = 0, AdsPos pos = kPosCenter); + + /** + @brief Hide the adview + @param type The adview type need to hide. + */ + void hideAds(AdsType type); + + /** + @brief Spend the points. + Use this method to notify server spend points. + @param points Need spend number of points + */ + void spendPoints(int points); + + /** + @brief set the Ads listener + */ + void setAdsListener(AdsListener* pListener); + + // For the callbak methods + void onAdsResult(AdsResultCode code, const char* msg); + void onPlayerGetPoints(int points); + +protected: + AdsListener* m_pListener; +}; + +}} // namespace cocos2d { namespace plugin { + +#endif /* __CCX_PROTOCOL_ADS_H__ */ diff --git a/plugin/protocols/include/ProtocolAnalytics.h b/plugin/protocols/include/ProtocolAnalytics.h new file mode 100644 index 0000000000..9360c9eb69 --- /dev/null +++ b/plugin/protocols/include/ProtocolAnalytics.h @@ -0,0 +1,97 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PROTOCOL_ANALYTICS_H__ +#define __CCX_PROTOCOL_ANALYTICS_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace cocos2d { namespace plugin { + +typedef std::pair< std::string, std::string > LogEventParamPair; +typedef std::map< std::string, std::string > LogEventParamMap; + +class ProtocolAnalytics : public PluginProtocol +{ +public: + ProtocolAnalytics(); + virtual ~ProtocolAnalytics(); + + /** + @brief Start a new session. + @param appKey The identity of the application. + */ + void startSession(const char* appKey); + + /** + @brief Stop a session. + @warning This interface only worked on android + */ + void stopSession(); + + /** + @brief Set the timeout for expiring a session. + @param millis In milliseconds as the unit of time. + @note It must be invoked before calling startSession. + */ + void setSessionContinueMillis(long millis); + + /** + @brief log an error + @param errorId The identity of error + @param message Extern message for the error + */ + void logError(const char* errorId, const char* message); + + /** + @brief log an event. + @param eventId The identity of event + @param paramMap Extern parameters of the event, use NULL if not needed. + */ + void logEvent(const char* eventId, LogEventParamMap* paramMap = NULL); + + /** + @brief Track an event begin. + @param eventId The identity of event + */ + void logTimedEventBegin(const char* eventId); + + /** + @brief Track an event end. + @param eventId The identity of event + */ + void logTimedEventEnd(const char* eventId); + + /** + @brief Whether to catch uncaught exceptions to server. + @warning This interface only worked on android. + */ + void setCaptureUncaughtException(bool enabled); +}; + +}} // namespace cocos2d { namespace plugin { + + +#endif /* __CCX_PROTOCOL_ANALYTICS_H__ */ diff --git a/plugin/protocols/include/ProtocolIAP.h b/plugin/protocols/include/ProtocolIAP.h new file mode 100644 index 0000000000..f2d4c8df69 --- /dev/null +++ b/plugin/protocols/include/ProtocolIAP.h @@ -0,0 +1,97 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PROTOCOL_IAP_H__ +#define __CCX_PROTOCOL_IAP_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace cocos2d { namespace plugin { + +typedef std::map TIAPDeveloperInfo; +typedef std::map TProductInfo; + +typedef enum +{ + kPaySuccess = 0, + kPayFail, + kPayCancel, + kPayTimeOut, +} PayResultCode; + +class PayResultListener +{ +public: + virtual void onPayResult(PayResultCode ret, const char* msg, TProductInfo info) = 0; +}; + +class ProtocolIAP : public PluginProtocol +{ +public: + ProtocolIAP(); + virtual ~ProtocolIAP(); + + /** + @brief config the developer info + @param devInfo This parameter is the info of developer, + different plugin have different format + @warning Must invoke this interface before other interfaces. + And invoked only once. + */ + void configDeveloperInfo(TIAPDeveloperInfo devInfo); + + /** + @brief pay for product + @param info The info of product, must contains key: + productName The name of product + productPrice The price of product(must can be parse to float) + productDesc The description of product + @warning For different plugin, the parameter should have other keys to pay. + Look at the manual of plugins. + */ + void payForProduct(TProductInfo info); + + /** + @breif set the result listener + @param pListener The callback object for pay result + @wraning Must invoke this interface before payForProduct. + */ + void setResultListener(PayResultListener* pListener); + + /** + @brief pay result callback + */ + void onPayResult(PayResultCode ret, const char* msg); + +protected: + static bool m_bPaying; + + TProductInfo m_curInfo; + PayResultListener* m_pListener; +}; + +}} // namespace cocos2d { namespace plugin { + +#endif /* __CCX_PROTOCOL_IAP_H__ */ diff --git a/plugin/protocols/include/ProtocolSocial.h b/plugin/protocols/include/ProtocolSocial.h new file mode 100755 index 0000000000..ab0717295b --- /dev/null +++ b/plugin/protocols/include/ProtocolSocial.h @@ -0,0 +1,93 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __CCX_PROTOCOL_SOCIAL_H__ +#define __CCX_PROTOCOL_SOCIAL_H__ + +#include "PluginProtocol.h" +#include +#include + +namespace cocos2d { namespace plugin { + +typedef std::map TSocialDeveloperInfo; +typedef std::map TShareInfo; + +typedef enum +{ + kShareSuccess = 0, + kShareFail, + kShareCancel, + kShareTimeOut, +} ShareResultCode; + +class ShareResultListener +{ +public: + virtual void onShareResult(ShareResultCode ret, const char* msg) = 0; +}; + +class ProtocolSocial : public PluginProtocol +{ +public: + ProtocolSocial(); + virtual ~ProtocolSocial(); + + /** + @brief config the social developer info + @param devInfo This parameter is the info of developer, + different plugin have different format + @warning Must invoke this interface before other interfaces. + And invoked only once. + */ + void configDeveloperInfo(TSocialDeveloperInfo devInfo); + + /** + @brief share information + @param info The info of share, contains key: + SharedText The text need to share + SharedImagePath The full path of image file need to share (optinal) + @warning For different plugin, the parameter should have other keys to share. + Look at the manual of plugins. + */ + void share(TShareInfo info); + + /** + @breif set the result listener + @param pListener The callback object for share result + @wraning Must invoke this interface before share + */ + void setResultListener(ShareResultListener* pListener); + + /** + @brief share result callback + */ + void onShareResult(ShareResultCode ret, const char* msg); + +protected: + ShareResultListener* m_pListener; +}; + +}} // namespace cocos2d { namespace plugin { + +#endif /* ----- #ifndef __CCX_PROTOCOL_SOCIAL_H__ ----- */ diff --git a/plugin/protocols/jsb_protocols.ini b/plugin/protocols/jsb_protocols.ini new file mode 100644 index 0000000000..2596b928bc --- /dev/null +++ b/plugin/protocols/jsb_protocols.ini @@ -0,0 +1,62 @@ +[protocols] +# the prefix to be added to the generated functions. You might or might not use this in your own +# templates +prefix = pluginx_protocols + +# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`) +# all classes will be embedded in that namespace +target_namespace = plugin + +android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include +android_flags = -D_SIZE_T_DEFINED_ + +clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include +clang_flags = -nostdinc -x c++ + +cocos_headers = -I%(pluginxdir)s/protocols/include + +cocos_flags = -DANDROID + +cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common + +# extra arguments for clang +extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s + +# what headers to parse +headers = %(pluginxdir)s/protocols/include/PluginManager.h %(pluginxdir)s/protocols/include/ProtocolAnalytics.h %(pluginxdir)s/protocols/include/ProtocolIAP.h %(pluginxdir)s/protocols/include/ProtocolAds.h %(pluginxdir)s/protocols/include/ProtocolSocial.h + +# what classes to produce code for. You can use regular expressions here. When testing the regular +# expression, it will be enclosed in "^$", like this: "^CCMenu*$". +classes = PluginProtocol PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds ProtocolSocial + +# what should we skip? in the format ClassName::[function function] +# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also +# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just +# add a single "*" as functions. See bellow for several examples. A special class name is "*", which +# will apply to all class names. This is a convenience wildcard to be able to skip similar named +# functions from all classes. + +skip = ProtocolIAP::[setResultListener], + ProtocolAds::[setAdsListener], + ProtocolSocial::[setResultListener], + PluginProtocol::[callFuncWithParam callStringFuncWithParam callIntFuncWithParam callBoolFuncWithParam callFloatFuncWithParam] + +rename_functions = + +rename_classes = + +# for all class names, should we remove something when registering in the target VM? +remove_prefix = + +# classes for which there will be no "parent" lookup +classes_have_no_parents = + +# base classes which will be skipped when their sub-classes found them. +base_classes_to_skip = + +# classes that create no constructor +# CCSet is special and we will use a hand-written constructor +abstract_classes = PluginProtocol ProtocolIAP ProtocolAnalytics PluginManager ProtocolAds ProtocolSocial + +# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'. +script_control_cpp = yes diff --git a/plugin/protocols/platform/android/PluginFactory.cpp b/plugin/protocols/platform/android/PluginFactory.cpp new file mode 100644 index 0000000000..6b4ba4a89b --- /dev/null +++ b/plugin/protocols/platform/android/PluginFactory.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginFactory.h" +#include "PluginUtils.h" +#include "PluginJniHelper.h" +#include "ProtocolAds.h" +#include "ProtocolAnalytics.h" +#include "ProtocolIAP.h" +#include "ProtocolSocial.h" + +namespace cocos2d { namespace plugin { + +enum { + kPluginAds = 1, + kPluginAnalytics, + kPluginIAP, + kPluginSocial, +}; + +#define ANDROID_PLUGIN_PACKAGE_PREFIX "org/cocos2dx/plugin/" + +static PluginFactory* s_pFactory = NULL; + +PluginFactory::PluginFactory() +{ + +} + +PluginFactory::~PluginFactory() +{ + +} + +PluginFactory* PluginFactory::getInstance() +{ + if (NULL == s_pFactory) + { + s_pFactory = new PluginFactory(); + } + + return s_pFactory; +} + +void PluginFactory::purgeFactory() +{ + if (NULL != s_pFactory) + { + delete s_pFactory; + s_pFactory = NULL; + } +} + +/** create the plugin by name */ +PluginProtocol* PluginFactory::createPlugin(const char* name) +{ + PluginProtocol* pRet = NULL; + do + { + if (name == NULL || strlen(name) == 0) break; + + std::string jClassName = ANDROID_PLUGIN_PACKAGE_PREFIX; + jClassName.append(name); + PluginUtils::outputLog("PluginFactory", "Java class name of plugin %s is : %s", name, jClassName.c_str()); + + PluginJniMethodInfo t; + if (! PluginJniHelper::getStaticMethodInfo(t + , "org/cocos2dx/plugin/PluginWrapper" + , "initPlugin" + , "(Ljava/lang/String;)Ljava/lang/Object;")) + { + PluginUtils::outputLog("PluginFactory", "Can't find method initPlugin in class org.cocos2dx.plugin.PluginWrapper"); + break; + } + + jstring clsName = t.env->NewStringUTF(jClassName.c_str()); + jobject jObj = t.env->CallStaticObjectMethod(t.classID, t.methodID, clsName); + t.env->DeleteLocalRef(clsName); + t.env->DeleteLocalRef(t.classID); + if (jObj == NULL) + { + PluginUtils::outputLog("PluginFactory", "Can't find java class %s", jClassName.c_str()); + break; + } + + if (! PluginJniHelper::getStaticMethodInfo(t + , "org/cocos2dx/plugin/PluginWrapper" + , "getPluginType" + , "(Ljava/lang/Object;)I")) + { + PluginUtils::outputLog("PluginFactory", "Can't find method getPluginType in class org.cocos2dx.plugin.PluginWrapper"); + break; + } + int curType = t.env->CallStaticIntMethod(t.classID, t.methodID, jObj); + t.env->DeleteLocalRef(t.classID); + PluginUtils::outputLog("PluginFactory", "The type of plugin %s is : %d", name, curType); + + switch (curType) + { + case kPluginAds: + pRet = new ProtocolAds(); + break; + case kPluginAnalytics: + pRet = new ProtocolAnalytics(); + break; + case kPluginIAP: + pRet = new ProtocolIAP(); + break; + case kPluginSocial: + pRet = new ProtocolSocial(); + break; + default: + break; + } + + if (pRet != NULL) + { + pRet->setPluginName(name); + PluginUtils::initJavaPlugin(pRet, jObj, jClassName.c_str()); + } + } while(0); + + return pRet; +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/PluginJavaData.h b/plugin/protocols/platform/android/PluginJavaData.h new file mode 100644 index 0000000000..5ab55ea462 --- /dev/null +++ b/plugin/protocols/platform/android/PluginJavaData.h @@ -0,0 +1,40 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __PLUGIN_JAVA_DATA_H__ +#define __PLUGIN_JAVA_DATA_H__ + +#include +#include + +namespace cocos2d { namespace plugin { + +typedef struct _PluginJavaData_ +{ + jobject jobj; + std::string jclassName; +} PluginJavaData; + +}} //namespace cocos2d { namespace plugin { + +#endif // __PLUGIN_JAVA_DATA_H__ diff --git a/plugin/protocols/platform/android/PluginJniHelper.cpp b/plugin/protocols/platform/android/PluginJniHelper.cpp new file mode 100644 index 0000000000..fd3deb9ea9 --- /dev/null +++ b/plugin/protocols/platform/android/PluginJniHelper.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginJniHelper.h" +#include +#include + +#if 1 +#define LOG_TAG "PluginJniHelper" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) +#else +#define LOGD(...) +#endif + +#define JAVAVM cocos2d::PluginJniHelper::getJavaVM() + +using namespace std; + +extern "C" +{ + + ////////////////////////////////////////////////////////////////////////// + // java vm helper function + ////////////////////////////////////////////////////////////////////////// + + static bool getEnv(JNIEnv **env) + { + + bool bRet = false; + + do + { + if (JAVAVM->GetEnv((void**)env, JNI_VERSION_1_4) != JNI_OK) + { + LOGD("Failed to get the environment using GetEnv()"); + break; + } + + if (JAVAVM->AttachCurrentThread(env, 0) < 0) + { + LOGD("Failed to get the environment using AttachCurrentThread()"); + break; + } + bRet = true; + } while (0); + + return bRet; + } + + static jclass getClassID_(const char *className, JNIEnv *env) + { + JNIEnv *pEnv = env; + jclass ret = 0; + + do + { + if (! pEnv) + { + if (! getEnv(&pEnv)) + { + break; + } + } + + ret = pEnv->FindClass(className); + if (! ret) + { + LOGD("Failed to find class of %s", className); + break; + } + } while (0); + + return ret; + } + + static bool getStaticMethodInfo_(cocos2d::PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode) + { + jmethodID methodID = 0; + JNIEnv *pEnv = 0; + bool bRet = false; + do + { + if (! getEnv(&pEnv)) + { + break; + } + + jclass classID = getClassID_(className, pEnv); + + if(pEnv->ExceptionCheck()) pEnv->ExceptionClear(); + methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode); + if (! methodID) + { + if(pEnv->ExceptionCheck()) + { + pEnv->ExceptionClear(); + } + LOGD("Failed to find static method id of %s", methodName); + break; + } + + methodinfo.classID = classID; + methodinfo.env = pEnv; + methodinfo.methodID = methodID; + bRet = true; + } while (0); + + return bRet; + } + + static bool getMethodInfo_(cocos2d::PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode) + { + jmethodID methodID = 0; + JNIEnv *pEnv = 0; + bool bRet = false; + + do + { + if (! getEnv(&pEnv)) + { + break; + } + + jclass classID = getClassID_(className, pEnv); + + if(pEnv->ExceptionCheck()) pEnv->ExceptionClear(); + methodID = pEnv->GetMethodID(classID, methodName, paramCode); + if (! methodID) + { + if(pEnv->ExceptionCheck()) + { + pEnv->ExceptionClear(); + } + LOGD("Failed to find method %s in class %s", methodName, className); + break; + } + + methodinfo.classID = classID; + methodinfo.env = pEnv; + methodinfo.methodID = methodID; + + bRet = true; + } while (0); + + return bRet; + } + + static string jstring2string_(jstring jstr) + { + if (jstr == NULL) + { + return ""; + } + + JNIEnv *env = 0; + + if (! getEnv(&env)) + { + return 0; + } + + const char* chars = env->GetStringUTFChars(jstr, NULL); + string ret(chars); + env->ReleaseStringUTFChars(jstr, chars); + + return ret; + } +} + +namespace cocos2d { + +JavaVM* PluginJniHelper::m_psJavaVM = NULL; + +JavaVM* PluginJniHelper::getJavaVM() +{ + return m_psJavaVM; +} + +void PluginJniHelper::setJavaVM(JavaVM *javaVM) +{ + m_psJavaVM = javaVM; +} + +jclass PluginJniHelper::getClassID(const char *className, JNIEnv *env) +{ + return getClassID_(className, env); +} + +bool PluginJniHelper::getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode) +{ + return getStaticMethodInfo_(methodinfo, className, methodName, paramCode); +} + +bool PluginJniHelper::getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode) +{ + return getMethodInfo_(methodinfo, className, methodName, paramCode); +} + +string PluginJniHelper::jstring2string(jstring str) +{ + return jstring2string_(str); +} + +} // end of namespace cocos2d diff --git a/plugin/protocols/platform/android/PluginJniHelper.h b/plugin/protocols/platform/android/PluginJniHelper.h new file mode 100644 index 0000000000..6fb3080b0d --- /dev/null +++ b/plugin/protocols/platform/android/PluginJniHelper.h @@ -0,0 +1,54 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __PLUGIN_JNI_HELPER_H__ +#define __PLUGIN_JNI_HELPER_H__ + +#include +#include + +namespace cocos2d { + +typedef struct PluginJniMethodInfo_ +{ + JNIEnv * env; + jclass classID; + jmethodID methodID; +} PluginJniMethodInfo; + +class PluginJniHelper +{ +public: + static JavaVM* getJavaVM(); + static void setJavaVM(JavaVM *javaVM); + static jclass getClassID(const char *className, JNIEnv *env=0); + static bool getStaticMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static bool getMethodInfo(PluginJniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode); + static std::string jstring2string(jstring str); + +private: + static JavaVM *m_psJavaVM; +}; +} + +#endif // __PLUGIN_JNI_HELPER_H__ diff --git a/plugin/protocols/platform/android/PluginJniMacros.h b/plugin/protocols/platform/android/PluginJniMacros.h new file mode 100644 index 0000000000..5cba8480f0 --- /dev/null +++ b/plugin/protocols/platform/android/PluginJniMacros.h @@ -0,0 +1,166 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __PLUGIN_JNI_MACROS_H__ +#define __PLUGIN_JNI_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_BASERET_JAVA_FUNC_WITH_PARAM(retType, paramCode, param, retCode, defaultRet) \ +retType ret = defaultRet; \ +return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); \ +return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); \ +return_val_if_fails(pData != NULL, ret); \ + \ +PluginJniMethodInfo t; \ +if (PluginJniHelper::getMethodInfo(t \ + , pData->jclassName.c_str() \ + , funcName \ + , paramCode)) \ +{ \ + if (NULL != param) \ + { \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID, param); \ + } else { \ + ret = t.env->Call##retCode##Method(pData->jobj, t.methodID); \ + } \ + t.env->DeleteLocalRef(t.classID); \ +} \ +return ret; \ + + +#define CALL_JAVA_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_JAVA_FUNC(retType, retCode, defaultRet, jRetCode) \ +retType ret = defaultRet; \ +PluginJavaData* pData = PluginUtils::getPluginJavaData(this); \ +if (NULL == pData) { \ + PluginUtils::outputLog("PluginProtocol", "Can't find java data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +std::string paramCode; \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + paramCode = "()"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), NULL); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + switch(pRetParam->getCurrentType()) \ + { \ + case PluginParam::kParamTypeInt: \ + paramCode = "(I)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getIntValue()); \ + break; \ + case PluginParam::kParamTypeFloat: \ + paramCode = "(F)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getFloatValue()); \ + break; \ + case PluginParam::kParamTypeBool: \ + paramCode = "(Z)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), pRetParam->getBoolValue()); \ + break; \ + case PluginParam::kParamTypeString: \ + { \ + jstring jstr = PluginUtils::getEnv()->NewStringUTF(pRetParam->getStringValue()); \ + paramCode = "(Ljava/lang/String;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jstr); \ + PluginUtils::getEnv()->DeleteLocalRef(jstr); \ + } \ + break; \ + case PluginParam::kParamTypeStringMap: \ + case PluginParam::kParamTypeMap: \ + { \ + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); \ + paramCode = "(Lorg/json/JSONObject;)"; \ + paramCode.append(jRetCode); \ + ret = PluginUtils::callJava##retCode##FuncWithName_oneParam(this, funcName, paramCode.c_str(), jMap); \ + PluginUtils::getEnv()->DeleteLocalRef(jMap); \ + } \ + break; \ + default: \ + break; \ + } \ + \ + if (needDel && pRetParam != NULL) \ + { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_JNI_MACROS_H__ diff --git a/plugin/protocols/platform/android/PluginProtocol.cpp b/plugin/protocols/platform/android/PluginProtocol.cpp new file mode 100644 index 0000000000..71a1e5956f --- /dev/null +++ b/plugin/protocols/platform/android/PluginProtocol.cpp @@ -0,0 +1,214 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginProtocol.h" +#include "PluginUtils.h" + +#define LOG_TAG "PluginProtocol" + +namespace cocos2d { namespace plugin { + +PluginProtocol::~PluginProtocol() +{ + PluginUtils::erasePluginJavaData(this); +} + +const char* PluginProtocol::getPluginVersion() +{ + std::string verName; + + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "getPluginVersion" + , "()Ljava/lang/String;")) + { + jstring ret = (jstring)(t.env->CallObjectMethod(pData->jobj, t.methodID)); + verName = PluginJniHelper::jstring2string(ret); + } + return verName.c_str(); +} + +const char* PluginProtocol::getSDKVersion() +{ + std::string verName; + + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "getSDKVersion" + , "()Ljava/lang/String;")) + { + jstring ret = (jstring)(t.env->CallObjectMethod(pData->jobj, t.methodID)); + verName = PluginJniHelper::jstring2string(ret); + } + return verName.c_str(); +} + +void PluginProtocol::setDebugMode(bool isDebugMode) +{ + PluginUtils::callJavaFunctionWithName_oneParam(this, "setDebugMode", "(Z)V", isDebugMode); +} + +void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + std::vector allParams; + if (NULL != param) + { + allParams.push_back(param); + + va_list argp; + PluginParam* pArg = NULL; + va_start( argp, param ); + while (1) + { + pArg = va_arg(argp, PluginParam*); + if (pArg == NULL) + break; + + allParams.push_back(pArg); + } + va_end(argp); + } + + callFuncWithParam(funcName, allParams); +} + +void PluginProtocol::callFuncWithParam(const char* funcName, std::vector params) +{ + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + if (NULL == pData) { + PluginUtils::outputLog(LOG_TAG, "Can't find java data for plugin : %s", this->getPluginName()); + return; + } + + int nParamNum = params.size(); + if (nParamNum == 0) + { + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "()V", NULL); + } else + { + PluginParam* pRetParam = NULL; + bool needDel = false; + if (nParamNum == 1) { + pRetParam = params[0]; + } else { + std::map allParams; + for (int i = 0; i < nParamNum; i++) + { + PluginParam* pArg = params[i]; + if (pArg == NULL) + { + break; + } + + char strKey[8] = { 0 }; + sprintf(strKey, "Param%d", i + 1); + allParams[strKey] = pArg; + } + + pRetParam = new PluginParam(allParams); + needDel = true; + } + + switch(pRetParam->getCurrentType()) + { + case PluginParam::kParamTypeInt: + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "(I)V", pRetParam->getIntValue()); + break; + case PluginParam::kParamTypeFloat: + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "(F)V", pRetParam->getFloatValue()); + break; + case PluginParam::kParamTypeBool: + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "(Z)V", pRetParam->getBoolValue()); + break; + case PluginParam::kParamTypeString: + { + jstring jstr = PluginUtils::getEnv()->NewStringUTF(pRetParam->getStringValue()); + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "(Ljava/lang/String;)V", jstr); + PluginUtils::getEnv()->DeleteLocalRef(jstr); + } + break; + case PluginParam::kParamTypeStringMap: + case PluginParam::kParamTypeMap: + { + jobject jMap = PluginUtils::getJObjFromParam(pRetParam); + PluginUtils::callJavaFunctionWithName_oneParam(this, funcName, "(Lorg/json/JSONObject;)V", jMap); + PluginUtils::getEnv()->DeleteLocalRef(jMap); + } + break; + default: + break; + } + + if (needDel && pRetParam != NULL) + { + delete pRetParam; + pRetParam = NULL; + } + } +} + +const char* PluginProtocol::callStringFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_JAVA_FUNC_WITH_VALIST(String) +} + +const char* PluginProtocol::callStringFuncWithParam(const char* funcName, std::vector params) +{ + CALL_JAVA_FUNC(const char*, String, "", "Ljava/lang/String;") +} + +int PluginProtocol::callIntFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_JAVA_FUNC_WITH_VALIST(Int) +} + +int PluginProtocol::callIntFuncWithParam(const char* funcName, std::vector params) +{ + CALL_JAVA_FUNC(int, Int, 0, "I") +} + +bool PluginProtocol::callBoolFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_JAVA_FUNC_WITH_VALIST(Bool) +} + +bool PluginProtocol::callBoolFuncWithParam(const char* funcName, std::vector params) +{ + CALL_JAVA_FUNC(bool, Bool, false, "Z") +} + +float PluginProtocol::callFloatFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_JAVA_FUNC_WITH_VALIST(Float) +} + +float PluginProtocol::callFloatFuncWithParam(const char* funcName, std::vector params) +{ + CALL_JAVA_FUNC(float, Float, 0.0f, "F") +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/PluginUtils.cpp b/plugin/protocols/platform/android/PluginUtils.cpp new file mode 100644 index 0000000000..abe494e05e --- /dev/null +++ b/plugin/protocols/platform/android/PluginUtils.cpp @@ -0,0 +1,249 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginUtils.h" +#include +#include + +#define MAX_LOG_LEN 256 + +namespace cocos2d { namespace plugin { + +#define JAVAVM cocos2d::PluginJniHelper::getJavaVM() + +jobject PluginUtils::createJavaMapObject(std::map* paramMap) +{ + JNIEnv* env = getEnv(); + jclass class_Hashtable = env->FindClass("java/util/Hashtable"); + jmethodID construct_method = env->GetMethodID( class_Hashtable, "","()V"); + jobject obj_Map = env->NewObject( class_Hashtable, construct_method, ""); + if (paramMap != NULL) + { + jmethodID add_method= env->GetMethodID( class_Hashtable,"put","(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + for (std::map::const_iterator it = paramMap->begin(); it != paramMap->end(); ++it) + { + env->CallObjectMethod(obj_Map, add_method, env->NewStringUTF(it->first.c_str()), env->NewStringUTF(it->second.c_str())); + } + } + env->DeleteLocalRef(class_Hashtable); + return obj_Map; +} + +void PluginUtils::initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className) +{ + cocos2d::plugin::PluginJavaData* pUserData = new cocos2d::plugin::PluginJavaData(); + pUserData->jobj = PluginUtils::getEnv()->NewGlobalRef(jObj); + pUserData->jclassName = className; + cocos2d::plugin::PluginUtils::setPluginJavaData(pPlugin, pUserData); +} + +JNIEnv* PluginUtils::getEnv() +{ + bool bRet = false; + JNIEnv* env = NULL; + do + { + if (JAVAVM->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK) + { + outputLog("PluginUtils", "Failed to get the environment using GetEnv()"); + break; + } + + if (JAVAVM->AttachCurrentThread(&env, 0) < 0) + { + outputLog("PluginUtils", "Failed to get the environment using AttachCurrentThread()"); + break; + } + + bRet = true; + } while (0); + + if (!bRet) { + env = NULL; + } + + return env; +} + +std::map s_PluginObjMap; +std::map s_JObjPluginMap; + +typedef std::map::iterator ObjMapIter; +typedef std::map::iterator JObjPluginMapIter; + +PluginJavaData* PluginUtils::getPluginJavaData(PluginProtocol* pKeyObj) +{ + PluginJavaData* ret = NULL; + ObjMapIter it = s_PluginObjMap.find(pKeyObj); + if (it != s_PluginObjMap.end()) { + ret = it->second; + } + + return ret; +} + +PluginProtocol* PluginUtils::getPluginPtr(std::string className) +{ + PluginProtocol* ret = NULL; + JObjPluginMapIter it = s_JObjPluginMap.find(className); + if (it != s_JObjPluginMap.end()) { + ret = it->second; + } + + return ret; +} + +void PluginUtils::setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData) +{ + erasePluginJavaData(pKeyObj); + s_PluginObjMap.insert(std::pair(pKeyObj, pData)); + s_JObjPluginMap.insert(std::pair(pData->jclassName, pKeyObj)); +} + +void PluginUtils::erasePluginJavaData(PluginProtocol* pKeyObj) +{ + ObjMapIter it = s_PluginObjMap.find(pKeyObj); + if (it != s_PluginObjMap.end()) { + PluginJavaData* pData = it->second; + if (pData != NULL) + { + jobject jobj = pData->jobj; + + JObjPluginMapIter pluginIt = s_JObjPluginMap.find(pData->jclassName); + if (pluginIt != s_JObjPluginMap.end()) + { + s_JObjPluginMap.erase(pluginIt); + } + + JNIEnv* pEnv = getEnv(); + outputLog("PluginUtils", "Delete global reference."); + pEnv->DeleteGlobalRef(jobj); + delete pData; + } + s_PluginObjMap.erase(it); + } +} + +void PluginUtils::outputLog(const char* logTag, const char* pFormat, ...) +{ + char buf[MAX_LOG_LEN + 1]; + + va_list args; + va_start(args, pFormat); + vsnprintf(buf, MAX_LOG_LEN, pFormat, args); + va_end(args); + + __android_log_print(ANDROID_LOG_DEBUG, logTag, buf); +} + +jobject PluginUtils::getJObjFromParam(PluginParam* param) +{ + if (NULL == param) + { + return NULL; + } + + jobject obj = NULL; + PluginJniMethodInfo t; + JNIEnv* env = PluginUtils::getEnv(); + + switch(param->getCurrentType()) + { + case PluginParam::kParamTypeInt: + if (PluginJniHelper::getStaticMethodInfo(t, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;")) + { + obj = t.env->CallStaticObjectMethod(t.classID, t.methodID, param->getIntValue()); + } + break; + case PluginParam::kParamTypeFloat: + if (PluginJniHelper::getStaticMethodInfo(t, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;")) + { + obj = t.env->CallStaticObjectMethod(t.classID, t.methodID, param->getFloatValue()); + } + break; + case PluginParam::kParamTypeBool: + if (PluginJniHelper::getStaticMethodInfo(t, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;")) + { + obj = t.env->CallStaticObjectMethod(t.classID, t.methodID, param->getBoolValue()); + } + break; + case PluginParam::kParamTypeString: + obj = env->NewStringUTF(param->getStringValue()); + break; + case PluginParam::kParamTypeStringMap: + { + jclass cls = env->FindClass("org/json/JSONObject"); + jmethodID mid = env->GetMethodID(cls,"","()V"); + obj = env->NewObject(cls,mid); + std::map::iterator it; + std::map mapParam = param->getStrMapValue(); + for (it = mapParam.begin(); it != mapParam.end(); it++) + { + PluginJniMethodInfo tInfo; + if (PluginJniHelper::getMethodInfo(tInfo, "org/json/JSONObject", "put", "(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;")) + { + jstring strKey = tInfo.env->NewStringUTF(it->first.c_str()); + jstring strValue = tInfo.env->NewStringUTF(it->second.c_str()); + + tInfo.env->CallObjectMethod(obj, tInfo.methodID, strKey, strValue); + tInfo.env->DeleteLocalRef(tInfo.classID); + + tInfo.env->DeleteLocalRef(strKey); + tInfo.env->DeleteLocalRef(strValue); + } + } + } + break; + case PluginParam::kParamTypeMap: + { + jclass cls = env->FindClass("org/json/JSONObject"); + jmethodID mid = env->GetMethodID(cls,"","()V"); + obj = env->NewObject(cls,mid); + + std::map::iterator it; + std::map mapParam = param->getMapValue(); + for (it = mapParam.begin(); it != mapParam.end(); it++) + { + PluginJniMethodInfo tInfo; + if (PluginJniHelper::getMethodInfo(tInfo, "org/json/JSONObject", "put", "(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;")) + { + jstring strKey = tInfo.env->NewStringUTF(it->first.c_str()); + jobject objValue = PluginUtils::getJObjFromParam(it->second); + + tInfo.env->CallObjectMethod(obj, tInfo.methodID, strKey, objValue); + tInfo.env->DeleteLocalRef(tInfo.classID); + + tInfo.env->DeleteLocalRef(strKey); + PluginUtils::getEnv()->DeleteLocalRef(objValue); + } + } + } + break; + default: + break; + } + + return obj; +} + +}}// namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/PluginUtils.h b/plugin/protocols/platform/android/PluginUtils.h new file mode 100644 index 0000000000..b1980cf61b --- /dev/null +++ b/plugin/protocols/platform/android/PluginUtils.h @@ -0,0 +1,131 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __PLUGIN_UTILS_H__ +#define __PLUGIN_UTILS_H__ + +#include "PluginJniHelper.h" +#include "PluginJavaData.h" +#include +#include "PluginParam.h" +#include "PluginJniMacros.h" + +namespace cocos2d { namespace plugin { + +class PluginProtocol; +class PluginUtils +{ +public: + static jobject createJavaMapObject(std::map* paramMap); + static void initJavaPlugin(PluginProtocol* pPlugin, jobject jObj, const char* className); + static JNIEnv* getEnv(); + + static PluginJavaData* getPluginJavaData(PluginProtocol* pKeyObj); + static void setPluginJavaData(PluginProtocol* pKeyObj, PluginJavaData* pData); + static void erasePluginJavaData(PluginProtocol* pKeyObj); + + static PluginProtocol* getPluginPtr(std::string className); + + static jobject getJObjFromParam(PluginParam* param); + + // methods have no return value + template + static void callJavaFunctionWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(paramCode != NULL && strlen(paramCode) > 0); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_if_fails(pData != NULL); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + if (param != NULL) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, param); + } else { + t.env->CallVoidMethod(pData->jobj, t.methodID); + } + t.env->DeleteLocalRef(t.classID); + } + } + + // methods return value is string + template + static const char* callJavaStringFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + const char* ret = ""; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + return_val_if_fails(paramCode != NULL && strlen(paramCode) > 0, ret); + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + return_val_if_fails(pData != NULL, ret); + + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , paramCode)) + { + jstring strRet = NULL; + if (param != NULL) + { + strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID, param); + } else { + strRet = (jstring) t.env->CallObjectMethod(pData->jobj, t.methodID); + } + ret = PluginJniHelper::jstring2string(strRet).c_str(); + t.env->DeleteLocalRef(t.classID); + } + return ret; + } + + // methods return value is int + template + static int callJavaIntFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(int, paramCode, param, Int, 0) + } + + // methods return value is float + template + static float callJavaFloatFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(float, paramCode, param, Float, 0.0f) + } + + // methods return value is bool + template + static bool callJavaBoolFuncWithName_oneParam(PluginProtocol* thiz, const char* funcName, const char* paramCode, T param) + { + CALL_BASERET_JAVA_FUNC_WITH_PARAM(bool, paramCode, param, Boolean, false) + } + + static void outputLog(const char* logTag, const char* pFormat, ...); +}; + +}} // namespace cocos2d { namespace plugin { + +#endif //__PLUGIN_UTILS_H__ diff --git a/plugin/protocols/platform/android/ProtocolAds.cpp b/plugin/protocols/platform/android/ProtocolAds.cpp new file mode 100644 index 0000000000..8bdc34029c --- /dev/null +++ b/plugin/protocols/platform/android/ProtocolAds.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "ProtocolAds.h" +#include "PluginJniHelper.h" +#include +#include "PluginUtils.h" +#include "PluginJavaData.h" + +namespace cocos2d { namespace plugin { + +extern "C" { + JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_AdsWrapper_nativeOnAdsResult(JNIEnv* env, jobject thiz, jstring className, jint ret, jstring msg) { + std::string strMsg = PluginJniHelper::jstring2string(msg); + std::string strClassName = PluginJniHelper::jstring2string(className); + PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); + PluginUtils::outputLog("ProtocolAds", "nativeOnAdsResult(), Get plugin ptr : %p", pPlugin); + if (pPlugin != NULL) + { + PluginUtils::outputLog("ProtocolAds", "nativeOnAdsResult(), Get plugin name : %s", pPlugin->getPluginName()); + ProtocolAds* pAds = dynamic_cast(pPlugin); + if (pAds != NULL) + { + pAds->onAdsResult((AdsResultCode) ret, strMsg.c_str()); + } + } + } + + JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_AdsWrapper_nativeOnPlayerGetPoints(JNIEnv* env, jobject thiz, jstring className, jint points) { + std::string strClassName = PluginJniHelper::jstring2string(className); + PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); + PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin ptr : %p", pPlugin); + if (pPlugin != NULL) + { + PluginUtils::outputLog("ProtocolAds", "nativeOnPlayerGetPoints(), Get plugin name : %s", pPlugin->getPluginName()); + ProtocolAds* pAds = dynamic_cast(pPlugin); + if (pAds != NULL) + { + pAds->onPlayerGetPoints(points); + } + } + } +} + +ProtocolAds::ProtocolAds() +: m_pListener(NULL) +{ +} + +ProtocolAds::~ProtocolAds() +{ +} + +void ProtocolAds::configDeveloperInfo(TAdsDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtils::outputLog("ProtocolAds", "The application info is empty!"); + return; + } + else + { + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "configDeveloperInfo" + , "(Ljava/util/Hashtable;)V")) + { + // generate the hashtable from map + jobject obj_Map = PluginUtils::createJavaMapObject(&devInfo); + + // invoke java method + t.env->CallVoidMethod(pData->jobj, t.methodID, obj_Map); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +void ProtocolAds::showAds(AdsType type, int sizeEnum, AdsPos pos) +{ + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + + PluginUtils::outputLog("ProtocolAds", "Class name : %s", pData->jclassName.c_str()); + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "showAds" + , "(III)V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID, type, sizeEnum, pos); + t.env->DeleteLocalRef(t.classID); + } +} + +void ProtocolAds::hideAds(AdsType type) +{ + PluginUtils::callJavaFunctionWithName_oneParam(this, "hideAds", "(I)V", type); +} + +void ProtocolAds::spendPoints(int points) +{ + PluginUtils::callJavaFunctionWithName_oneParam(this, "spendPoints", "(I)V", points); +} + +void ProtocolAds::setAdsListener(AdsListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg) +{ + PluginUtils::outputLog("ProtocolAds", "ProtocolAds::adsResult invoked!"); + if (m_pListener != NULL) + { + m_pListener->onAdsResult(code, msg); + } +} + +void ProtocolAds::onPlayerGetPoints(int points) +{ + PluginUtils::outputLog("ProtocolAds", "ProtocolAds::onPlayerGetPoints invoked!"); + if (m_pListener != NULL) + { + m_pListener->onPlayerGetPoints(this, points); + } +} + +}} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/ProtocolAnalytics.cpp b/plugin/protocols/platform/android/ProtocolAnalytics.cpp new file mode 100644 index 0000000000..a7cd8eca6c --- /dev/null +++ b/plugin/protocols/platform/android/ProtocolAnalytics.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "ProtocolAnalytics.h" +#include "PluginJniHelper.h" +#include +#include "PluginUtils.h" +#include "PluginJavaData.h" + +namespace cocos2d { namespace plugin { + +static void callJavaFunctionWithName_string_map(ProtocolAnalytics* thiz, const char* funcName, const char* keyParam, LogEventParamMap* paramMap) +{ + return_if_fails(funcName != NULL && strlen(funcName) > 0); + return_if_fails(keyParam != NULL); + + PluginJavaData* pData = PluginUtils::getPluginJavaData(thiz); + + PluginJniMethodInfo t; + if (NULL == paramMap) + { + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "(Ljava/lang/String;)V")) + { + jstring jeventId = t.env->NewStringUTF(keyParam); + t.env->CallVoidMethod(pData->jobj, t.methodID, jeventId); + t.env->DeleteLocalRef(jeventId); + t.env->DeleteLocalRef(t.classID); + } + } + else + { + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , funcName + , "(Ljava/lang/String;Ljava/util/Hashtable;)V")) + { + jstring jeventId = t.env->NewStringUTF(keyParam); + jobject obj_Map = PluginUtils::createJavaMapObject(paramMap); + t.env->CallVoidMethod(pData->jobj, t.methodID, jeventId, obj_Map); + t.env->DeleteLocalRef(jeventId); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +ProtocolAnalytics::ProtocolAnalytics() +{ +} + +ProtocolAnalytics::~ProtocolAnalytics() +{ +} + +void ProtocolAnalytics::startSession(const char* appKey) +{ + callJavaFunctionWithName_string_map(this, "startSession", appKey, NULL); +} + +void ProtocolAnalytics::stopSession() +{ + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "stopSession" + , "()V")) + { + t.env->CallVoidMethod(pData->jobj, t.methodID); + t.env->DeleteLocalRef(t.classID); + } +} + +void ProtocolAnalytics::setSessionContinueMillis(long millis) +{ + PluginUtils::callJavaFunctionWithName_oneParam(this, "setSessionContinueMillis", "(I)V", millis); +} + +void ProtocolAnalytics::setCaptureUncaughtException(bool isEnabled) +{ + PluginUtils::callJavaFunctionWithName_oneParam(this, "setCaptureUncaughtException", "(Z)V", isEnabled); +} + +void ProtocolAnalytics::logError(const char* errorId, const char* message) +{ + return_if_fails(errorId != NULL && strlen(errorId) > 0); + return_if_fails(message != NULL && strlen(message) > 0); + + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "logError" + , "(Ljava/lang/String;Ljava/lang/String;)V")) + { + jstring jerrorId = t.env->NewStringUTF(errorId); + jstring jmessage = t.env->NewStringUTF(message); + + t.env->CallVoidMethod(pData->jobj, t.methodID, jerrorId, jmessage); + t.env->DeleteLocalRef(jerrorId); + t.env->DeleteLocalRef(jmessage); + t.env->DeleteLocalRef(t.classID); + } +} + +void ProtocolAnalytics::logEvent(const char* eventId, LogEventParamMap* pParams/* = NULL */) +{ + callJavaFunctionWithName_string_map(this, "logEvent", eventId, pParams); +} + +void ProtocolAnalytics::logTimedEventBegin(const char* eventId) +{ + callJavaFunctionWithName_string_map(this, "logTimedEventBegin", eventId, NULL); +} + +void ProtocolAnalytics::logTimedEventEnd(const char* eventId) +{ + callJavaFunctionWithName_string_map(this, "logTimedEventEnd", eventId, NULL); +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/ProtocolIAP.cpp b/plugin/protocols/platform/android/ProtocolIAP.cpp new file mode 100644 index 0000000000..270e8ea44f --- /dev/null +++ b/plugin/protocols/platform/android/ProtocolIAP.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "ProtocolIAP.h" +#include "PluginJniHelper.h" +#include +#include "PluginUtils.h" +#include "PluginJavaData.h" + +namespace cocos2d { namespace plugin { + +extern "C" { + JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_IAPWrapper_nativeOnPayResult(JNIEnv* env, jobject thiz, jstring className, jint ret, jstring msg) + { + std::string strMsg = PluginJniHelper::jstring2string(msg); + std::string strClassName = PluginJniHelper::jstring2string(className); + PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); + PluginUtils::outputLog("ProtocolIAP", "nativeOnPayResult(), Get plugin ptr : %p", pPlugin); + if (pPlugin != NULL) + { + PluginUtils::outputLog("ProtocolIAP", "nativeOnPayResult(), Get plugin name : %s", pPlugin->getPluginName()); + ProtocolIAP* pIAP = dynamic_cast(pPlugin); + if (pIAP != NULL) + { + pIAP->onPayResult((PayResultCode) ret, strMsg.c_str()); + } + } + } +} + +bool ProtocolIAP::m_bPaying = false; + +ProtocolIAP::ProtocolIAP() +: m_pListener(NULL) +{ +} + +ProtocolIAP::~ProtocolIAP() +{ +} + +void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtils::outputLog("ProtocolIAP", "The developer info is empty!"); + return; + } + else + { + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "configDeveloperInfo" + , "(Ljava/util/Hashtable;)V")) + { + // generate the hashtable from map + jobject obj_Map = PluginUtils::createJavaMapObject(&devInfo); + + // invoke java method + t.env->CallVoidMethod(pData->jobj, t.methodID, obj_Map); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +void ProtocolIAP::payForProduct(TProductInfo info) +{ + if (m_bPaying) + { + PluginUtils::outputLog("ProtocolIAP", "Now is paying"); + return; + } + + if (info.empty()) + { + if (NULL != m_pListener) + { + onPayResult(kPayFail, "Product info error"); + } + PluginUtils::outputLog("ProtocolIAP", "The product info is empty!"); + return; + } + else + { + m_bPaying = true; + m_curInfo = info; + + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "payForProduct" + , "(Ljava/util/Hashtable;)V")) + { + // generate the hashtable from map + jobject obj_Map = PluginUtils::createJavaMapObject(&info); + + // invoke java method + t.env->CallVoidMethod(pData->jobj, t.methodID, obj_Map); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +void ProtocolIAP::setResultListener(PayResultListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg) +{ + m_bPaying = false; + if (m_pListener) + { + m_pListener->onPayResult(ret, msg, m_curInfo); + } + else + { + PluginUtils::outputLog("ProtocolIAP", "Result listener is null!"); + } + m_curInfo.clear(); + PluginUtils::outputLog("ProtocolIAP", "Pay result is : %d(%s)", (int) ret, msg); +} + +}} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/android/ProtocolSocial.cpp b/plugin/protocols/platform/android/ProtocolSocial.cpp new file mode 100755 index 0000000000..8c933d3380 --- /dev/null +++ b/plugin/protocols/platform/android/ProtocolSocial.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "ProtocolSocial.h" +#include "PluginJniHelper.h" +#include +#include "PluginUtils.h" +#include "PluginJavaData.h" + +namespace cocos2d { namespace plugin { + +extern "C" { + JNIEXPORT void JNICALL Java_org_cocos2dx_plugin_SocialWrapper_nativeOnShareResult(JNIEnv* env, jobject thiz, jstring className, jint ret, jstring msg) + { + std::string strMsg = PluginJniHelper::jstring2string(msg); + std::string strClassName = PluginJniHelper::jstring2string(className); + PluginProtocol* pPlugin = PluginUtils::getPluginPtr(strClassName); + PluginUtils::outputLog("ProtocolSocial", "nativeOnShareResult(), Get plugin ptr : %p", pPlugin); + if (pPlugin != NULL) + { + PluginUtils::outputLog("ProtocolSocial", "nativeOnShareResult(), Get plugin name : %s", pPlugin->getPluginName()); + ProtocolSocial* pSocial = dynamic_cast(pPlugin); + if (pSocial != NULL) + { + pSocial->onShareResult((ShareResultCode) ret, strMsg.c_str()); + } + } + } +} + +ProtocolSocial::ProtocolSocial() +: m_pListener(NULL) +{ +} + +ProtocolSocial::~ProtocolSocial() +{ +} + +void ProtocolSocial::configDeveloperInfo(TSocialDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtils::outputLog("ProtocolSocial", "The developer info is empty!"); + return; + } + else + { + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "configDeveloperInfo" + , "(Ljava/util/Hashtable;)V")) + { + // generate the hashtable from map + jobject obj_Map = PluginUtils::createJavaMapObject(&devInfo); + + // invoke java method + t.env->CallVoidMethod(pData->jobj, t.methodID, obj_Map); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +void ProtocolSocial::share(TShareInfo info) +{ + if (info.empty()) + { + if (NULL != m_pListener) + { + onShareResult(kShareFail, "Share info error"); + } + PluginUtils::outputLog("ProtocolSocial", "The Share info is empty!"); + return; + } + else + { + PluginJavaData* pData = PluginUtils::getPluginJavaData(this); + PluginJniMethodInfo t; + if (PluginJniHelper::getMethodInfo(t + , pData->jclassName.c_str() + , "share" + , "(Ljava/util/Hashtable;)V")) + { + // generate the hashtable from map + jobject obj_Map = PluginUtils::createJavaMapObject(&info); + + // invoke java method + t.env->CallVoidMethod(pData->jobj, t.methodID, obj_Map); + t.env->DeleteLocalRef(obj_Map); + t.env->DeleteLocalRef(t.classID); + } + } +} + +void ProtocolSocial::setResultListener(ShareResultListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolSocial::onShareResult(ShareResultCode ret, const char* msg) +{ + if (m_pListener) + { + m_pListener->onShareResult(ret, msg); + } + else + { + PluginUtils::outputLog("ProtocolSocial", "Result listener is null!"); + } + PluginUtils::outputLog("ProtocolSocial", "Share result is : %d(%s)", (int) ret, msg); +} + +}} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/InterfaceAds.h b/plugin/protocols/platform/ios/InterfaceAds.h new file mode 100644 index 0000000000..7fb01971ed --- /dev/null +++ b/plugin/protocols/platform/ios/InterfaceAds.h @@ -0,0 +1,37 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceAds + +- (void) configDeveloperInfo: (NSMutableDictionary*) devInfo; +- (void) showAds: (int) type size:(int) sizeEnum position:(int) pos; +- (void) hideAds: (int) type; +- (void) spendPoints: (int) points; +- (void) setDebugMode: (BOOL) debug; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +@end diff --git a/plugin/protocols/platform/ios/InterfaceAnalytics.h b/plugin/protocols/platform/ios/InterfaceAnalytics.h new file mode 100644 index 0000000000..e834edd12e --- /dev/null +++ b/plugin/protocols/platform/ios/InterfaceAnalytics.h @@ -0,0 +1,42 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceAnalytics + +- (void) startSession: (NSString*) appKey; +- (void) stopSession; +- (void) setSessionContinueMillis: (long) millis; +- (void) setCaptureUncaughtException: (BOOL) isEnabled; +- (void) setDebugMode: (BOOL) debug; +- (void) logError: (NSString*) errorId withMsg:(NSString*) message; +- (void) logEvent: (NSString*) eventId; +- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap; +- (void) logTimedEventBegin: (NSString*) eventId; +- (void) logTimedEventEnd: (NSString*) eventId; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +@end diff --git a/plugin/protocols/platform/ios/InterfaceIAP.h b/plugin/protocols/platform/ios/InterfaceIAP.h new file mode 100644 index 0000000000..86af913f05 --- /dev/null +++ b/plugin/protocols/platform/ios/InterfaceIAP.h @@ -0,0 +1,35 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@protocol InterfaceIAP + +- (void) configDeveloperInfo: (NSMutableDictionary*) cpInfo; +- (void) payForProduct: (NSMutableDictionary*) profuctInfo; +- (void) setDebugMode: (BOOL) debug; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +@end diff --git a/plugin/protocols/platform/ios/InterfaceSocial.h b/plugin/protocols/platform/ios/InterfaceSocial.h new file mode 100644 index 0000000000..00033030da --- /dev/null +++ b/plugin/protocols/platform/ios/InterfaceSocial.h @@ -0,0 +1,33 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +@protocol InterfaceSocial + +- (void) configDeveloperInfo : (NSMutableDictionary*) cpInfo; +- (void) share: (NSMutableDictionary*) shareInfo; +- (void) setDebugMode: (BOOL) debug; +- (NSString*) getSDKVersion; +- (NSString*) getPluginVersion; + +@end diff --git a/plugin/protocols/platform/ios/PluginFactory.mm b/plugin/protocols/platform/ios/PluginFactory.mm new file mode 100644 index 0000000000..09e6b1aba5 --- /dev/null +++ b/plugin/protocols/platform/ios/PluginFactory.mm @@ -0,0 +1,107 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginFactory.h" +#include "ProtocolAds.h" +#include "ProtocolAnalytics.h" +#include "ProtocolIAP.h" +#include "ProtocolSocial.h" +#include "PluginUtilsIOS.h" + +#import +#import "InterfaceAds.h" +#import "InterfaceAnalytics.h" +#import "InterfaceIAP.h" +#import "InterfaceSocial.h" + +namespace cocos2d { namespace plugin { + +static PluginFactory* s_pFactory = NULL; + +PluginFactory::PluginFactory() +{ + +} + +PluginFactory::~PluginFactory() +{ + +} + +PluginFactory* PluginFactory::getInstance() +{ + if (NULL == s_pFactory) + { + s_pFactory = new PluginFactory(); + } + + return s_pFactory; +} + +void PluginFactory::purgeFactory() +{ + if (NULL != s_pFactory) + { + delete s_pFactory; + s_pFactory = NULL; + } +} + +/** create the plugin by name */ +PluginProtocol* PluginFactory::createPlugin(const char* name) +{ + PluginProtocol* pRet = NULL; + do + { + if (name == NULL || strlen(name) == 0) break; + + NSString* className = [NSString stringWithUTF8String:name]; + id obj = [[NSClassFromString(className) alloc] init]; + if (obj == nil) break; + + if ([obj conformsToProtocol:@protocol(InterfaceAds)]) { + pRet = new ProtocolAds(); + } else + if ([obj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + pRet = new ProtocolAnalytics(); + } else + if ([obj conformsToProtocol:@protocol(InterfaceIAP)]) { + pRet = new ProtocolIAP(); + } else + if ([obj conformsToProtocol:@protocol(InterfaceSocial)]) { + pRet = new ProtocolSocial(); + } else { + PluginUtilsIOS::outputLog("Plugin %s not implements a right protocol", name); + } + + if (pRet != NULL) + { + pRet->setPluginName(name); + PluginUtilsIOS::initOCPlugin(pRet, obj, name); + } + } while(0); + + return pRet; +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/PluginOCMacros.h b/plugin/protocols/platform/ios/PluginOCMacros.h new file mode 100644 index 0000000000..aa7b18a68f --- /dev/null +++ b/plugin/protocols/platform/ios/PluginOCMacros.h @@ -0,0 +1,101 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __PLUGIN_OC_MACROS_H__ +#define __PLUGIN_OC_MACROS_H__ + +#define return_if_fails(cond) if (!(cond)) return; +#define return_val_if_fails(cond, ret) if(!(cond)) return (ret); + +#define CALL_OC_FUNC_WITH_VALIST(retCode) \ +std::vector allParams; \ +if (NULL != param) \ +{ \ + allParams.push_back(param); \ + \ + va_list argp; \ + PluginParam* pArg = NULL; \ + va_start( argp, param ); \ + while (1) \ + { \ + pArg = va_arg(argp, PluginParam*); \ + if (pArg == NULL) \ + break; \ + \ + allParams.push_back(pArg); \ + } \ + va_end(argp); \ +} \ + \ +return call##retCode##FuncWithParam(funcName, allParams); \ + + +#define CALL_OC_FUNC(retType, defaultRet, retCode) \ +retType ret = defaultRet; \ +PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); \ +if (NULL == pData) { \ + PluginUtilsIOS::outputLog("Can't find OC data for plugin : %s", this->getPluginName()); \ + return ret; \ +} \ + \ +int nParamNum = params.size(); \ +if (0 == nParamNum) \ +{ \ + ret = PluginUtilsIOS::callOC##retCode##FunctionWithName_oneParam(this, funcName, NULL); \ +} else \ +{ \ + PluginParam* pRetParam = NULL; \ + bool needDel = false; \ + if (nParamNum == 1) { \ + pRetParam = params[0]; \ + } else { \ + std::map allParams; \ + for (int i = 0; i < nParamNum; i++) \ + { \ + PluginParam* pArg = params[i]; \ + if (pArg == NULL) \ + { \ + break; \ + } \ + \ + char strKey[8] = { 0 }; \ + sprintf(strKey, "Param%d", i + 1); \ + allParams[strKey] = pArg; \ + } \ + \ + pRetParam = new PluginParam(allParams); \ + needDel = true; \ + } \ + \ + id ocParam = PluginUtilsIOS::getOCObjFromParam(pRetParam); \ + ret = PluginUtilsIOS::callOC##retCode##FunctionWithName_oneParam(this, funcName, ocParam); \ + \ + if (needDel && NULL != pRetParam) { \ + delete pRetParam; \ + pRetParam = NULL; \ + } \ +} \ +return ret; \ + + +#endif // __PLUGIN_OC_MACROS_H__ diff --git a/plugin/protocols/platform/ios/PluginProtocol.mm b/plugin/protocols/platform/ios/PluginProtocol.mm new file mode 100644 index 0000000000..9f4fe4e0e5 --- /dev/null +++ b/plugin/protocols/platform/ios/PluginProtocol.mm @@ -0,0 +1,196 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "PluginProtocol.h" +#include "PluginUtilsIOS.h" +#include "PluginOCMacros.h" + +namespace cocos2d { namespace plugin { + +PluginProtocol::~PluginProtocol() +{ + PluginUtilsIOS::erasePluginOCData(this); +} + +const char* PluginProtocol::getPluginVersion() +{ + std::string verName; + + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + if (pData) { + id pOCObj = pData->obj; + SEL selector = NSSelectorFromString(@"getPluginVersion"); + + if ([pOCObj respondsToSelector:selector]) { + NSString* strRet = (NSString*)[pOCObj performSelector:selector]; + verName = [strRet UTF8String]; + } else { + PluginUtilsIOS::outputLog("Can't find function 'getPluginVersion' in class '%s'", pData->className.c_str()); + } + } else { + PluginUtilsIOS::outputLog("Plugin %p not right initilized", this); + } + + return verName.c_str(); +} + +const char* PluginProtocol::getSDKVersion() +{ + std::string verName; + + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + if (pData) { + id pOCObj = pData->obj; + SEL selector = NSSelectorFromString(@"getSDKVersion"); + + if ([pOCObj respondsToSelector:selector]) { + NSString* strRet = (NSString*)[pOCObj performSelector:selector]; + verName = [strRet UTF8String]; + } else { + PluginUtilsIOS::outputLog("Can't find function 'getSDKVersion' in class '%s'", pData->className.c_str()); + } + } else { + PluginUtilsIOS::outputLog("Plugin %s not right initilized", this->getPluginName()); + } + + return verName.c_str(); +} + +void PluginProtocol::setDebugMode(bool isDebugMode) +{ + NSNumber* bDebug = [NSNumber numberWithBool:isDebugMode]; + PluginUtilsIOS::callOCFunctionWithName_oneParam(this, "setDebugMode", bDebug); +} + +void PluginProtocol::callFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + std::vector allParams; + if (NULL != param) + { + allParams.push_back(param); + + va_list argp; + PluginParam* pArg = NULL; + va_start( argp, param ); + while (1) + { + pArg = va_arg(argp, PluginParam*); + if (pArg == NULL) + break; + + allParams.push_back(pArg); + } + va_end(argp); + } + + callFuncWithParam(funcName, allParams); +} + +void PluginProtocol::callFuncWithParam(const char* funcName, std::vector params) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + if (NULL == pData) { + PluginUtilsIOS::outputLog("Can't find OC data for plugin : %s", this->getPluginName()); + return; + } + + int nParamNum = params.size(); + if (0 == nParamNum) + { + PluginUtilsIOS::callOCFunctionWithName_oneParam(this, funcName, NULL); + } else + { + PluginParam* pRetParam = NULL; + bool needDel = false; + if (nParamNum == 1) { + pRetParam = params[0]; + } else { + std::map allParams; + for (int i = 0; i < nParamNum; i++) + { + PluginParam* pArg = params[i]; + if (pArg == NULL) + { + break; + } + + char strKey[8] = { 0 }; + sprintf(strKey, "Param%d", i + 1); + allParams[strKey] = pArg; + } + + pRetParam = new PluginParam(allParams); + needDel = true; + } + + id ocParam = PluginUtilsIOS::getOCObjFromParam(pRetParam); + PluginUtilsIOS::callOCFunctionWithName_oneParam(this, funcName, ocParam); + + if (needDel && NULL != pRetParam) { + delete pRetParam; + pRetParam = NULL; + } + } +} + +const char* PluginProtocol::callStringFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_OC_FUNC_WITH_VALIST(String) +} + +const char* PluginProtocol::callStringFuncWithParam(const char* funcName, std::vector params) +{ + CALL_OC_FUNC(const char*, "", String) +} + +int PluginProtocol::callIntFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_OC_FUNC_WITH_VALIST(Int) +} + +int PluginProtocol::callIntFuncWithParam(const char* funcName, std::vector params) +{ + CALL_OC_FUNC(int, 0, Int) +} + +bool PluginProtocol::callBoolFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_OC_FUNC_WITH_VALIST(Bool) +} + +bool PluginProtocol::callBoolFuncWithParam(const char* funcName, std::vector params) +{ + CALL_OC_FUNC(bool, false, Bool) +} + +float PluginProtocol::callFloatFuncWithParam(const char* funcName, PluginParam* param, ...) +{ + CALL_OC_FUNC_WITH_VALIST(Float) +} + +float PluginProtocol::callFloatFuncWithParam(const char* funcName, std::vector params) +{ + CALL_OC_FUNC(float, 0.0f, Float) +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/PluginUtilsIOS.h b/plugin/protocols/platform/ios/PluginUtilsIOS.h new file mode 100644 index 0000000000..18118691b8 --- /dev/null +++ b/plugin/protocols/platform/ios/PluginUtilsIOS.h @@ -0,0 +1,89 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __PLUGIN_UTILS_IOS_H__ +#define __PLUGIN_UTILS_IOS_H__ + +#include "PluginProtocol.h" +#include +#include +#include "PluginParam.h" + +namespace cocos2d { namespace plugin { + +typedef struct _PluginOCData +{ + id obj; + std::string className; +} PluginOCData; + +class PluginUtilsIOS +{ +public: + static void initOCPlugin(PluginProtocol* pPlugin, id ocObj, const char* className); + + static PluginOCData* getPluginOCData(PluginProtocol* pKeyObj); + static void setPluginOCData(PluginProtocol* pKeyObj, PluginOCData* pData); + static void erasePluginOCData(PluginProtocol* pKeyObj); + + static PluginProtocol* getPluginPtr(id obj); + + static id getOCObjFromParam(PluginParam* param); + + static NSMutableDictionary* createDictFromMap(std::map* paramMap); + + /** + @brief method don't have return value + */ + static void callOCFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param); + + /** + @brief method return int value + */ + static int callOCIntFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param); + + /** + @brief method return float value + */ + static float callOCFloatFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param); + + /** + @brief method return bool value + */ + static bool callOCBoolFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param); + + /** + @brief method return string value + */ + static const char* callOCStringFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param); + + static void outputLog(const char* pFormat, ...); + +private: + static id callRetFunction(PluginProtocol* pPlugin, const char* funcName, id param); +}; + +}} // namespace cocos2d { namespace plugin { + +#endif //__PLUGIN_UTILS_IOS_H__ diff --git a/plugin/protocols/platform/ios/PluginUtilsIOS.mm b/plugin/protocols/platform/ios/PluginUtilsIOS.mm new file mode 100644 index 0000000000..5c5d80c7fb --- /dev/null +++ b/plugin/protocols/platform/ios/PluginUtilsIOS.mm @@ -0,0 +1,274 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "PluginUtilsIOS.h" +#include +#import +#include "PluginOCMacros.h" + +#define MAX_LOG_LEN 256 + +namespace cocos2d { namespace plugin { + +void PluginUtilsIOS::initOCPlugin(PluginProtocol* pPlugin, id ocObj, const char* className) +{ + PluginOCData* pData = new PluginOCData(); + pData->obj = ocObj; + pData->className = className; + PluginUtilsIOS::setPluginOCData(pPlugin, pData); +} + +std::map s_PluginOCObjMap; +std::map s_OCObjPluginMap; + +typedef std::map::iterator OCObjMapIter; +typedef std::map::iterator OCObjPluginMapIter; + +PluginOCData* PluginUtilsIOS::getPluginOCData(PluginProtocol* pKeyObj) +{ + PluginOCData* ret = NULL; + OCObjMapIter it = s_PluginOCObjMap.find(pKeyObj); + if (it != s_PluginOCObjMap.end()) { + ret = it->second; + } + + return ret; +} + +PluginProtocol* PluginUtilsIOS::getPluginPtr(id obj) +{ + PluginProtocol* ret = NULL; + OCObjPluginMapIter it = s_OCObjPluginMap.find(obj); + if (it != s_OCObjPluginMap.end()) { + ret = it->second; + } + + return ret; +} + +id PluginUtilsIOS::getOCObjFromParam(PluginParam* param) +{ + if (NULL == param) + { + return nil; + } + + id obj = nil; + switch(param->getCurrentType()) + { + case PluginParam::kParamTypeInt: + obj = [NSNumber numberWithInt:param->getIntValue()]; + break; + case PluginParam::kParamTypeFloat: + obj = [NSNumber numberWithFloat:param->getFloatValue()]; + break; + case PluginParam::kParamTypeBool: + obj = [NSNumber numberWithBool:param->getBoolValue()]; + break; + case PluginParam::kParamTypeString: + obj = [NSString stringWithUTF8String:param->getStringValue()]; + break; + case PluginParam::kParamTypeStringMap: + { + std::map mapValue = param->getStrMapValue(); + obj = createDictFromMap(&mapValue); + } + break; + case PluginParam::kParamTypeMap: + { + obj = [NSMutableDictionary dictionary]; + std::map paramMap = param->getMapValue(); + std::map::const_iterator it; + for (it = paramMap.begin(); it != paramMap.end(); ++it) + { + NSString* pKey = [NSString stringWithUTF8String:it->first.c_str()]; + id objValue = PluginUtilsIOS::getOCObjFromParam(it->second); + [obj setValue:objValue forKey:pKey]; + } + } + break; + default: + break; + } + + return obj; +} + +void PluginUtilsIOS::setPluginOCData(PluginProtocol* pKeyObj, PluginOCData* pData) +{ + erasePluginOCData(pKeyObj); + s_PluginOCObjMap.insert(std::pair(pKeyObj, pData)); + s_OCObjPluginMap.insert(std::pair(pData->obj, pKeyObj)); +} + +void PluginUtilsIOS::erasePluginOCData(PluginProtocol* pKeyObj) +{ + OCObjMapIter it = s_PluginOCObjMap.find(pKeyObj); + if (it != s_PluginOCObjMap.end()) { + PluginOCData* pData = it->second; + if (pData != NULL) + { + id jobj = pData->obj; + + OCObjPluginMapIter pluginIt = s_OCObjPluginMap.find(jobj); + if (pluginIt != s_OCObjPluginMap.end()) + { + s_OCObjPluginMap.erase(pluginIt); + } + + [jobj release]; + delete pData; + } + s_PluginOCObjMap.erase(it); + } +} + +NSMutableDictionary* PluginUtilsIOS::createDictFromMap(std::map* paramMap) +{ + if (NULL == paramMap) + { + return nil; + } + + NSMutableDictionary* dict = [NSMutableDictionary dictionary]; + std::map::const_iterator it; + for (it = paramMap->begin(); it != paramMap->end(); ++it) + { + NSString* pKey = [NSString stringWithUTF8String:it->first.c_str()]; + NSString* pValue = [NSString stringWithUTF8String:it->second.c_str()]; + [dict setValue:pValue forKey:pKey]; + } + + return dict; +} + +void PluginUtilsIOS::callOCFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param) +{ + return_if_fails(funcName != NULL && strlen(funcName) > 0); + + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(pPlugin); + if (pData) { + id pOCObj = pData->obj; + + NSString* strFuncName = [NSString stringWithUTF8String:funcName]; + if (param != nil) { + strFuncName = [strFuncName stringByAppendingString:@":"]; + } + SEL selector = NSSelectorFromString(strFuncName); + if ([pOCObj respondsToSelector:selector]) { + if (param == nil) { + [pOCObj performSelector:selector]; + } else { + [pOCObj performSelector:selector withObject:param]; + } + } else { + outputLog("Can't find function '%s' in class '%s'", [strFuncName UTF8String], pData->className.c_str()); + } + } else { + PluginUtilsIOS::outputLog("Plugin %s not right initilized", pPlugin->getPluginName()); + } +} + +int PluginUtilsIOS::callOCIntFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param) +{ + int ret = (NSInteger)callRetFunction(pPlugin, funcName, param); + return ret; +} + +float PluginUtilsIOS::callOCFloatFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param) +{ + float ret = 0.0f; + NSNumber* pRet = (NSNumber*)callRetFunction(pPlugin, funcName, param); + if (nil != pRet) { + ret = [pRet floatValue]; + } + + return ret; +} + +bool PluginUtilsIOS::callOCBoolFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param) +{ + bool ret = false; + NSNumber* pRet = (NSNumber*)callRetFunction(pPlugin, funcName, param); + if (nil != pRet) { + ret = [pRet boolValue]; + } + + return ret; +} + +const char* PluginUtilsIOS::callOCStringFunctionWithName_oneParam(PluginProtocol* pPlugin, const char* funcName, id param) +{ + const char* ret = ""; + NSString* pRet = (NSString*)callRetFunction(pPlugin, funcName, param); + if (nil != pRet) { + ret = [pRet UTF8String]; + } + + return ret; +} + +id PluginUtilsIOS::callRetFunction(PluginProtocol* pPlugin, const char* funcName, id param) +{ + id ret = nil; + return_val_if_fails(funcName != NULL && strlen(funcName) > 0, ret); + + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(pPlugin); + if (pData) { + id pOCObj = pData->obj; + + NSString* strFuncName = [NSString stringWithUTF8String:funcName]; + if (param != nil) { + strFuncName = [strFuncName stringByAppendingString:@":"]; + } + SEL selector = NSSelectorFromString(strFuncName); + if ([pOCObj respondsToSelector:selector]) { + if (param == nil) { + ret = [pOCObj performSelector:selector]; + } else { + ret = [pOCObj performSelector:selector withObject:param]; + } + } else { + outputLog("Can't find function '%s' in class '%s'", [strFuncName UTF8String], pData->className.c_str()); + } + } else { + PluginUtilsIOS::outputLog("Plugin %s not right initilized", pPlugin->getPluginName()); + } + + return ret; +} + +void PluginUtilsIOS::outputLog(const char* pFormat, ...) +{ + printf("Plugin-x: "); + char szBuf[MAX_LOG_LEN+1] = {0}; + va_list ap; + va_start(ap, pFormat); + vsnprintf(szBuf, MAX_LOG_LEN, pFormat, ap); + va_end(ap); + printf("%s", szBuf); + printf("\n"); +} + +}}// namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/ProtocolAds.mm b/plugin/protocols/platform/ios/ProtocolAds.mm new file mode 100644 index 0000000000..1902f0eec0 --- /dev/null +++ b/plugin/protocols/platform/ios/ProtocolAds.mm @@ -0,0 +1,119 @@ +/**************************************************************************** + Copyright (c) 2012+2013 cocos2d+x.org + + http://www.cocos2d+x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "ProtocolAds.h" +#include "PluginUtilsIOS.h" +#import "InterfaceAds.h" + +namespace cocos2d { namespace plugin { + +ProtocolAds::ProtocolAds() +: m_pListener(NULL) +{ +} + +ProtocolAds::~ProtocolAds() +{ +} + +void ProtocolAds::configDeveloperInfo(TAdsDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtilsIOS::outputLog("The developer info is empty for %s!", this->getPluginName()); + return; + } + else + { + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAds)]) { + NSObject* curObj = ocObj; + NSMutableDictionary* pDict = PluginUtilsIOS::createDictFromMap(&devInfo); + [curObj configDeveloperInfo:pDict]; + } + } +} + +void ProtocolAds::showAds(AdsType type, int sizeEnum, AdsPos pos) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAds)]) { + NSObject* curObj = ocObj; + [curObj showAds:type size:sizeEnum position:pos]; + } +} + +void ProtocolAds::hideAds(AdsType type) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAds)]) { + NSObject* curObj = ocObj; + [curObj hideAds:type]; + } +} + +void ProtocolAds::spendPoints(int points) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAds)]) { + NSObject* curObj = ocObj; + [curObj spendPoints:points]; + } +} + +// For the callbak methods +void ProtocolAds::setAdsListener(AdsListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolAds::onAdsResult(AdsResultCode code, const char* msg) +{ + if (m_pListener != NULL) + { + m_pListener->onAdsResult(code, msg); + } +} + +void ProtocolAds::onPlayerGetPoints(int points) +{ + if (m_pListener != NULL) + { + m_pListener->onPlayerGetPoints(this, points); + } +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/ProtocolAnalytics.mm b/plugin/protocols/platform/ios/ProtocolAnalytics.mm new file mode 100644 index 0000000000..3fb65f6b01 --- /dev/null +++ b/plugin/protocols/platform/ios/ProtocolAnalytics.mm @@ -0,0 +1,177 @@ +/**************************************************************************** + Copyright (c) 2012+2013 cocos2d+x.org + + http://www.cocos2d+x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#include "ProtocolAnalytics.h" +#import "InterfaceAnalytics.h" +#include "PluginUtilsIOS.h" + +namespace cocos2d { namespace plugin { + +ProtocolAnalytics::ProtocolAnalytics() +{ +} + +ProtocolAnalytics::~ProtocolAnalytics() +{ + PluginUtilsIOS::erasePluginOCData(this); +} + +/** + @brief Start a new session. + @param appKey The identity of the application. + */ +void ProtocolAnalytics::startSession(const char* appKey) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + NSString* pStrKey = [NSString stringWithUTF8String:appKey]; + [curObj startSession:pStrKey]; + } +} + +/** + @brief Stop a session. + @warning This interface only worked on android + */ +void ProtocolAnalytics::stopSession() +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + [curObj stopSession]; + } +} + +/** + @brief Set the timeout for expiring a session. + @param millis In milliseconds as the unit of time. + @note It must be invoked before calling startSession. + */ +void ProtocolAnalytics::setSessionContinueMillis(long millis) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + [curObj setSessionContinueMillis:millis]; + } +} + +/** + @brief log an error + @param errorId The identity of error + @param message Extern message for the error + */ +void ProtocolAnalytics::logError(const char* errorId, const char* message) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + NSString* pError = [NSString stringWithUTF8String:errorId]; + NSString* pMsg = [NSString stringWithUTF8String:message]; + [curObj logError:pError withMsg:pMsg]; + } +} + +/** + @brief log an event. + @param eventId The identity of event + @param paramMap Extern parameters of the event, use NULL if not needed. + */ +void ProtocolAnalytics::logEvent(const char* eventId, LogEventParamMap* paramMap) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + NSString* pId = [NSString stringWithUTF8String:eventId]; + NSMutableDictionary* dict = PluginUtilsIOS::createDictFromMap(paramMap); + [curObj logEvent:pId withParam:dict]; + } +} + +/** + @brief Track an event begin. + @param eventId The identity of event + */ +void ProtocolAnalytics::logTimedEventBegin(const char* eventId) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + NSString* pEvent = [NSString stringWithUTF8String:eventId]; + [curObj logTimedEventBegin:pEvent]; + } +} + +/** + @brief Track an event end. + @param eventId The identity of event + */ +void ProtocolAnalytics::logTimedEventEnd(const char* eventId) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + NSString* pEvent = [NSString stringWithUTF8String:eventId]; + [curObj logTimedEventEnd:pEvent]; + } +} + +/** + @brief Whether to catch uncaught exceptions to server. + @warning This interface only worked on android. + */ +void ProtocolAnalytics::setCaptureUncaughtException(bool enabled) +{ + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceAnalytics)]) { + NSObject* curObj = ocObj; + [curObj setCaptureUncaughtException:enabled]; + } +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/ProtocolIAP.mm b/plugin/protocols/platform/ios/ProtocolIAP.mm new file mode 100644 index 0000000000..e3680b273d --- /dev/null +++ b/plugin/protocols/platform/ios/ProtocolIAP.mm @@ -0,0 +1,118 @@ +/**************************************************************************** + Copyright (c) 2012-2013 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#include "ProtocolIAP.h" +#include "PluginUtilsIOS.h" +#import "InterfaceIAP.h" + +namespace cocos2d { namespace plugin { + +bool ProtocolIAP::m_bPaying = false; + +ProtocolIAP::ProtocolIAP() +: m_pListener(NULL) +{ +} + +ProtocolIAP::~ProtocolIAP() +{ + PluginUtilsIOS::erasePluginOCData(this); +} + +void ProtocolIAP::configDeveloperInfo(TIAPDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtilsIOS::outputLog("The developer info is empty for %s!", this->getPluginName()); + return; + } + else + { + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceIAP)]) { + NSObject* curObj = ocObj; + NSMutableDictionary* pDict = PluginUtilsIOS::createDictFromMap(&devInfo); + [curObj configDeveloperInfo:pDict]; + } + } +} + +void ProtocolIAP::payForProduct(TProductInfo info) +{ + if (m_bPaying) + { + PluginUtilsIOS::outputLog("Now is paying"); + return; + } + + if (info.empty()) + { + if (NULL != m_pListener) + { + onPayResult(kPayFail, "Product info error"); + } + PluginUtilsIOS::outputLog("The product info is empty for %s!", this->getPluginName()); + return; + } + else + { + m_bPaying = true; + m_curInfo = info; + + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceIAP)]) { + NSObject* curObj = ocObj; + NSMutableDictionary* dict = PluginUtilsIOS::createDictFromMap(&info); + [curObj payForProduct:dict]; + } + } +} + +void ProtocolIAP::setResultListener(PayResultListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolIAP::onPayResult(PayResultCode ret, const char* msg) +{ + m_bPaying = false; + if (m_pListener) + { + m_pListener->onPayResult(ret, msg, m_curInfo); + } + else + { + PluginUtilsIOS::outputLog("Pay result listener of %s is null!", this->getPluginName()); + } + + m_curInfo.clear(); + PluginUtilsIOS::outputLog("Pay result of %s is : %d(%s)", this->getPluginName(), (int) ret, msg); +} + +}} //namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/ProtocolSocial.mm b/plugin/protocols/platform/ios/ProtocolSocial.mm new file mode 100755 index 0000000000..0c5d559d4f --- /dev/null +++ b/plugin/protocols/platform/ios/ProtocolSocial.mm @@ -0,0 +1,103 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "ProtocolSocial.h" +#include "PluginUtilsIOS.h" +#import "InterfaceSocial.h" + +namespace cocos2d { namespace plugin { + +ProtocolSocial::ProtocolSocial() +: m_pListener(NULL) +{ +} + +ProtocolSocial::~ProtocolSocial() +{ +} + +void ProtocolSocial::configDeveloperInfo(TSocialDeveloperInfo devInfo) +{ + if (devInfo.empty()) + { + PluginUtilsIOS::outputLog("The developer info is empty for %s!", this->getPluginName()); + return; + } + else + { + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceSocial)]) { + NSObject* curObj = ocObj; + NSMutableDictionary* pDict = PluginUtilsIOS::createDictFromMap(&devInfo); + [curObj configDeveloperInfo:pDict]; + } + } +} + +void ProtocolSocial::share(TShareInfo info) +{ + if (info.empty()) + { + if (NULL != m_pListener) + { + onShareResult(kShareFail, "Share info error"); + } + PluginUtilsIOS::outputLog("The Share info of %s is empty!", this->getPluginName()); + return; + } + else + { + PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this); + assert(pData != NULL); + + id ocObj = pData->obj; + if ([ocObj conformsToProtocol:@protocol(InterfaceSocial)]) { + NSObject* curObj = ocObj; + NSMutableDictionary* pDict = PluginUtilsIOS::createDictFromMap(&info); + [curObj share:pDict]; + } + } +} + +void ProtocolSocial::setResultListener(ShareResultListener* pListener) +{ + m_pListener = pListener; +} + +void ProtocolSocial::onShareResult(ShareResultCode ret, const char* msg) +{ + if (m_pListener) + { + m_pListener->onShareResult(ret, msg); + } + else + { + PluginUtilsIOS::outputLog("Share result listener of %s is null!", this->getPluginName()); + } + PluginUtilsIOS::outputLog("Share result of %s is : %d(%s)", this->getPluginName(), (int) ret, msg); +} + +}} // namespace cocos2d { namespace plugin { diff --git a/plugin/protocols/platform/ios/SocialWrapper.h b/plugin/protocols/platform/ios/SocialWrapper.h new file mode 100644 index 0000000000..3cd4692bca --- /dev/null +++ b/plugin/protocols/platform/ios/SocialWrapper.h @@ -0,0 +1,41 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +typedef enum { + kShareSuccess = 0, + kShareFail, + kShareCancel, + kShareTimeOut, +} ShareResult; + +@interface SocialWrapper : NSObject +{ + +} + ++ (void) onShareResult:(id) obj withRet:(ShareResult) ret withMsg:(NSString*) msg; + +@end diff --git a/plugin/protocols/platform/ios/SocialWrapper.mm b/plugin/protocols/platform/ios/SocialWrapper.mm new file mode 100644 index 0000000000..a91271fb15 --- /dev/null +++ b/plugin/protocols/platform/ios/SocialWrapper.mm @@ -0,0 +1,46 @@ +/**************************************************************************** +Copyright (c) 2012+2013 cocos2d+x.org + +http://www.cocos2d+x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import "SocialWrapper.h" +#include "PluginUtilsIOS.h" +#include "ProtocolSocial.h" + +using namespace cocos2d::plugin; + +@implementation SocialWrapper + ++ (void) onShareResult:(id) obj withRet:(ShareResult) ret withMsg:(NSString*) msg +{ + PluginProtocol* pPlugin = PluginUtilsIOS::getPluginPtr(obj); + ProtocolSocial* pSocial = dynamic_cast(pPlugin); + if (pSocial) { + const char* chMsg = [msg UTF8String]; + ShareResultCode cRet = (ShareResultCode) ret; + pSocial->onShareResult(cRet, chMsg); + } else { + PluginUtilsIOS::outputLog("Can't find the C++ object of the social plugin"); + } +} + +@end diff --git a/plugin/protocols/proj.android/.classpath b/plugin/protocols/proj.android/.classpath new file mode 100644 index 0000000000..a4f1e40546 --- /dev/null +++ b/plugin/protocols/proj.android/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugin/protocols/proj.android/.project b/plugin/protocols/proj.android/.project new file mode 100644 index 0000000000..b5748e7ae6 --- /dev/null +++ b/plugin/protocols/proj.android/.project @@ -0,0 +1,45 @@ + + + libPluginProtocol + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + android + 2 + PARENT-1-PROJECT_LOC/platform/android + + + include + 2 + PARENT-1-PROJECT_LOC/include + + + diff --git a/plugin/protocols/proj.android/AndroidManifest.xml b/plugin/protocols/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..f38b7f81b4 --- /dev/null +++ b/plugin/protocols/proj.android/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/plugin/protocols/proj.android/build.xml b/plugin/protocols/proj.android/build.xml new file mode 100644 index 0000000000..596b7e8cf2 --- /dev/null +++ b/plugin/protocols/proj.android/build.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/protocols/proj.android/build_native.sh b/plugin/protocols/proj.android/build_native.sh new file mode 100755 index 0000000000..732d804dad --- /dev/null +++ b/plugin/protocols/proj.android/build_native.sh @@ -0,0 +1,22 @@ +# set params +PLUGIN_ANDROID_ROOT=$(cd "$(dirname "$0")"; pwd) + +if [ ! "${PLUGIN_ROOT}" ]; then + PLUGIN_ROOT="$PLUGIN_ANDROID_ROOT"/../.. +fi + +${PLUGIN_ROOT}/tools/toolsForPublish/checkEnvironment.sh +source ${PLUGIN_ROOT}/tools/toolsForPublish/environment.sh + +# build +"$ANDROID_NDK_ROOT"/ndk-build -C "$PLUGIN_ANDROID_ROOT" + +echo +if [ "0" != "$?" ]; then + echo "Build error occoured!!!" + exit 1 +fi + +echo +echo "Native build action success." +exit 0 \ No newline at end of file diff --git a/plugin/protocols/proj.android/jni/Android.mk b/plugin/protocols/proj.android/jni/Android.mk new file mode 100755 index 0000000000..4bc000a7bd --- /dev/null +++ b/plugin/protocols/proj.android/jni/Android.mk @@ -0,0 +1,32 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := PluginProtocolStatic + +LOCAL_MODULE_FILENAME := libPluginProtocolStatic + +LOCAL_SRC_FILES :=\ +$(addprefix ../../platform/android/, \ + PluginFactory.cpp \ + PluginJniHelper.cpp \ + PluginUtils.cpp \ + PluginProtocol.cpp \ + ProtocolAnalytics.cpp \ + ProtocolIAP.cpp \ + ProtocolAds.cpp \ + ProtocolSocial.cpp \ +) \ +../../PluginManager.cpp \ +../../PluginParam.cpp + +LOCAL_CFLAGS := -Wno-psabi +LOCAL_EXPORT_CFLAGS := -Wno-psabi + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include $(LOCAL_PATH)/../../platform/android +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include $(LOCAL_PATH)/../../platform/android + +LOCAL_LDLIBS := -landroid +LOCAL_LDLIBS += -llog + +include $(BUILD_STATIC_LIBRARY) diff --git a/plugin/protocols/proj.android/jni/Application.mk b/plugin/protocols/proj.android/jni/Application.mk new file mode 100644 index 0000000000..750687880a --- /dev/null +++ b/plugin/protocols/proj.android/jni/Application.mk @@ -0,0 +1,7 @@ +# it is needed for ndk-r5 +APP_STL := gnustl_static +APP_CPPFLAGS += -frtti +APP_MODULES := PluginProtocolStatic +APP_ABI :=armeabi +#APP_ABI :=x86 +#APP_ABI :=mips mips-r2 mips-r2-sf armeabi diff --git a/plugin/protocols/proj.android/project.properties b/plugin/protocols/proj.android/project.properties new file mode 100644 index 0000000000..5ca3505c8b --- /dev/null +++ b/plugin/protocols/proj.android/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-7 +android.library=true diff --git a/plugin/protocols/proj.android/res/.gitignore b/plugin/protocols/proj.android/res/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java new file mode 100644 index 0000000000..42978cad90 --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/AdsWrapper.java @@ -0,0 +1,114 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import android.view.Gravity; +import android.view.View; +import android.view.WindowManager; + +public class AdsWrapper { + + public static final int RESULT_CODE_AdsReceived = 0; // The ad is received + public static final int RESULT_CODE_FullScreenViewShown = 1; // The full screen advertisement shown + public static final int RESULT_CODE_FullScreenViewDismissed = 2; // The full screen advertisement dismissed + public static final int RESULT_CODE_PointsSpendSucceed = 3; // The points spend succeed + public static final int RESULT_CODE_PointsSpendFailed = 4; // The points spend failed + public static final int RESULT_CODE_NetworkError = 5; // Network error + public static final int RESULT_CODE_UnknownError = 6; // Unknown error + + public static final int ADS_TYPE_BANNER = 0; + public static final int ADS_TYPE_FULL_SCREEN = 1; + + public static final int POS_CENTER = 0; + public static final int POS_TOP = 1; + public static final int POS_TOP_LEFT = 2; + public static final int POS_TOP_RIGHT = 3; + public static final int POS_BOTTOM = 4; + public static final int POS_BOTTOM_LEFT = 5; + public static final int POS_BOTTOM_RIGHT = 6; + + public static void addAdView(WindowManager mWm, View adView, int pos) { + WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams(); + mLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; + mLayoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT; + mLayoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; + mLayoutParams.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; + + switch (pos) { + case POS_CENTER: + mLayoutParams.gravity = Gravity.CENTER; + break; + case POS_TOP: + mLayoutParams.gravity = Gravity.TOP; + break; + case POS_TOP_LEFT: + mLayoutParams.gravity = Gravity.TOP | Gravity.LEFT; + break; + case POS_TOP_RIGHT: + mLayoutParams.gravity = Gravity.TOP | Gravity.RIGHT; + break; + case POS_BOTTOM: + mLayoutParams.gravity = Gravity.BOTTOM; + break; + case POS_BOTTOM_LEFT: + mLayoutParams.gravity = Gravity.BOTTOM | Gravity.LEFT; + break; + case POS_BOTTOM_RIGHT: + mLayoutParams.gravity = Gravity.BOTTOM | Gravity.RIGHT; + break; + default: + break; + } + mWm.addView(adView, mLayoutParams); + } + + public static void onAdsResult(InterfaceAds adapter, int code, String msg) { + final int curCode = code; + final String curMsg = msg; + final InterfaceAds curObj = adapter; + PluginWrapper.runOnGLThread(new Runnable(){ + @Override + public void run() { + String name = curObj.getClass().getName(); + name = name.replace('.', '/'); + AdsWrapper.nativeOnAdsResult(name, curCode, curMsg); + } + }); + } + private native static void nativeOnAdsResult(String className, int code, String msg); + + public static void onPlayerGetPoints(InterfaceAds adapter, int points) { + final int curPoints = points; + final InterfaceAds curAdapter = adapter; + PluginWrapper.runOnGLThread(new Runnable(){ + @Override + public void run() { + String name = curAdapter.getClass().getName(); + name = name.replace('.', '/'); + AdsWrapper.nativeOnPlayerGetPoints(name, curPoints); + } + }); + } + private native static void nativeOnPlayerGetPoints(String className, int points); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/IAPWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/IAPWrapper.java new file mode 100644 index 0000000000..a26c437c18 --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/IAPWrapper.java @@ -0,0 +1,46 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +public class IAPWrapper { + public static final int PAYRESULT_SUCCESS = 0; + public static final int PAYRESULT_FAIL = 1; + public static final int PAYRESULT_CANCEL = 2; + public static final int PAYRESULT_TIMEOUT = 3; + + public static void onPayResult(InterfaceIAP obj, int ret, String msg) { + final int curRet = ret; + final String curMsg = msg; + final InterfaceIAP curObj = obj; + PluginWrapper.runOnGLThread(new Runnable() { + @Override + public void run() { + String name = curObj.getClass().getName(); + name = name.replace('.', '/'); + nativeOnPayResult(name, curRet, curMsg); + } + }); + } + private static native void nativeOnPayResult(String className, int ret, String msg); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java new file mode 100644 index 0000000000..6d7f85f1f9 --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAds.java @@ -0,0 +1,39 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; + +public interface InterfaceAds { + + public final int PluginType = 1; + + public void configDeveloperInfo(Hashtable devInfo); + public void showAds(int type, int sizeEnum, int pos); + public void hideAds(int type); + public void spendPoints(int points); + public void setDebugMode(boolean debug); + public String getSDKVersion(); + public String getPluginVersion(); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAnalytics.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAnalytics.java new file mode 100644 index 0000000000..84aa078449 --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceAnalytics.java @@ -0,0 +1,44 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; + +public interface InterfaceAnalytics { + + public final int PluginType = 2; + + public void startSession(String appKey); + public void stopSession(); + public void setSessionContinueMillis(int millis); + public void setCaptureUncaughtException(boolean isEnabled); + public void setDebugMode(boolean isDebugMode); + public void logError(String errorId, String message); + public void logEvent(String eventId); + public void logEvent(String eventId, Hashtable paramMap); + public void logTimedEventBegin(String eventId); + public void logTimedEventEnd(String eventId); + public String getSDKVersion(); + public String getPluginVersion(); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceIAP.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceIAP.java new file mode 100644 index 0000000000..d576287cf2 --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceIAP.java @@ -0,0 +1,36 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; + +public interface InterfaceIAP { + public final int PluginType = 3; + + public void configDeveloperInfo(Hashtable cpInfo); + public void payForProduct(Hashtable cpInfo); + public void setDebugMode(boolean debug); + public String getSDKVersion(); + public String getPluginVersion(); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceSocial.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceSocial.java new file mode 100755 index 0000000000..4066a0be9e --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/InterfaceSocial.java @@ -0,0 +1,36 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.util.Hashtable; + +public interface InterfaceSocial { + public final int PluginType = 4; + + public void configDeveloperInfo(Hashtable cpInfo); + public void share(Hashtable cpInfo); + public void setDebugMode(boolean debug); + public String getSDKVersion(); + public String getPluginVersion(); +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/PluginWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/PluginWrapper.java new file mode 100644 index 0000000000..d736d4aeeb --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/PluginWrapper.java @@ -0,0 +1,111 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +import java.lang.reflect.Field; + +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.os.Handler; +import android.util.Log; + + +public class PluginWrapper { + + protected static Context sContext = null; + protected static GLSurfaceView sGLSurfaceView = null; + protected static Handler sMainThreadHandler = null; + private static final String TAG = "PluginWrapper"; + + public static void init(Context context) + { + sContext = context; + if (null == sMainThreadHandler) { + sMainThreadHandler = new Handler(); + } + } + + public static void setGLSurfaceView(GLSurfaceView value) { + sGLSurfaceView = value; + } + + protected static Object initPlugin(String classFullName) + { + Log.i(TAG, "class name : ----" + classFullName + "----"); + Class c = null; + try { + String fullName = classFullName.replace('/', '.'); + c = Class.forName(fullName); + } catch (ClassNotFoundException e) { + Log.e(TAG, "Class " + classFullName + " not found."); + e.printStackTrace(); + return null; + } + + try { + Context ctx = getContext(); + if (ctx != null) { + Object o = c.getDeclaredConstructor(Context.class).newInstance(ctx); + return o; + } else { + Log.e(TAG, "Plugin " + classFullName + " wasn't initialized."); + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + protected static int getPluginType(Object obj) { + int nRet = -1; + try + { + Field filedID = obj.getClass().getField("PluginType"); + Integer nObj = (Integer) filedID.get(obj); + nRet = nObj.intValue(); + } catch (Exception e) { + e.printStackTrace(); + } + + return nRet; + } + + public static Context getContext() { + return sContext; + } + + public static void runOnGLThread(Runnable r) { + if (null != sGLSurfaceView) { + sGLSurfaceView.queueEvent(r); + } else { + Log.i(TAG, "runOnGLThread sGLSurfaceView is null"); + r.run(); + } + } + + public static void runOnMainThread(Runnable r) { + if (null == sMainThreadHandler) return; + sMainThreadHandler.post(r); + } +} diff --git a/plugin/protocols/proj.android/src/org/cocos2dx/plugin/SocialWrapper.java b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/SocialWrapper.java new file mode 100755 index 0000000000..76de053aba --- /dev/null +++ b/plugin/protocols/proj.android/src/org/cocos2dx/plugin/SocialWrapper.java @@ -0,0 +1,46 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.plugin; + +public class SocialWrapper { + public static final int SHARERESULT_SUCCESS = 0; + public static final int SHARERESULT_FAIL = 1; + public static final int SHARERESULT_CANCEL = 2; + public static final int SHARERESULT_TIMEOUT = 3; + + public static void onShareResult(InterfaceSocial obj, int ret, String msg) { + final int curRet = ret; + final String curMsg = msg; + final InterfaceSocial curAdapter = obj; + PluginWrapper.runOnGLThread(new Runnable() { + @Override + public void run() { + String name = curAdapter.getClass().getName(); + name = name.replace('.', '/'); + nativeOnShareResult(name, curRet, curMsg); + } + }); + } + private static native void nativeOnShareResult(String className, int ret, String msg); +} diff --git a/plugin/protocols/proj.ios/PluginProtocol-Prefix.pch b/plugin/protocols/proj.ios/PluginProtocol-Prefix.pch new file mode 100644 index 0000000000..f482cf0684 --- /dev/null +++ b/plugin/protocols/proj.ios/PluginProtocol-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'libPluginProtocol' target in the 'libPluginProtocol' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/plugin/protocols/proj.ios/PluginProtocol.xcodeproj/project.pbxproj b/plugin/protocols/proj.ios/PluginProtocol.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..25c0193642 --- /dev/null +++ b/plugin/protocols/proj.ios/PluginProtocol.xcodeproj/project.pbxproj @@ -0,0 +1,307 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + FA09A325168ADBC2008C1C7B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA09A324168ADBC2008C1C7B /* Foundation.framework */; }; + FA09A33E168ADC1F008C1C7B /* PluginManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA09A33C168ADC1F008C1C7B /* PluginManager.cpp */; }; + FA8CC1E6173754CF00464206 /* PluginUtilsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA8CC1E5173754CF00464206 /* PluginUtilsIOS.mm */; }; + FA8CC2041737A3CE00464206 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8CC2031737A3CE00464206 /* CoreFoundation.framework */; }; + FA8CC208173894F000464206 /* ProtocolAds.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA8CC205173894F000464206 /* ProtocolAds.mm */; }; + FA8CC209173894F000464206 /* ProtocolAnalytics.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA8CC206173894F000464206 /* ProtocolAnalytics.mm */; }; + FA8CC20A173894F000464206 /* ProtocolIAP.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA8CC207173894F000464206 /* ProtocolIAP.mm */; }; + FAB6DF961755D7E500C90D89 /* PluginParam.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DF951755D7E500C90D89 /* PluginParam.cpp */; }; + FAB6DF981755D82F00C90D89 /* PluginFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DF971755D82F00C90D89 /* PluginFactory.mm */; }; + FAB6DF9A1755D93600C90D89 /* PluginProtocol.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DF991755D93600C90D89 /* PluginProtocol.mm */; }; + FAB6DFD31756EA4D00C90D89 /* ProtocolSocial.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DFD21756EA4D00C90D89 /* ProtocolSocial.mm */; }; + FAE27553175DB9FB00F5DA8E /* SocialWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAE27552175DB9FB00F5DA8E /* SocialWrapper.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + FA09A31F168ADBC2008C1C7B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/${PRODUCT_NAME}"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + FA09A321168ADBC2008C1C7B /* libPluginProtocol.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPluginProtocol.a; sourceTree = BUILT_PRODUCTS_DIR; }; + FA09A324168ADBC2008C1C7B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + FA09A337168ADC05008C1C7B /* PluginManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginManager.h; sourceTree = ""; }; + FA09A338168ADC05008C1C7B /* PluginProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProtocol.h; sourceTree = ""; }; + FA09A339168ADC05008C1C7B /* ProtocolAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolAnalytics.h; sourceTree = ""; }; + FA09A33A168ADC05008C1C7B /* ProtocolIAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolIAP.h; sourceTree = ""; }; + FA09A33C168ADC1F008C1C7B /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = ../PluginManager.cpp; sourceTree = ""; }; + FA4E3033172BD02800A3E673 /* ProtocolSocial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolSocial.h; sourceTree = ""; }; + FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolAds.h; sourceTree = ""; }; + FA8CC1E4173754CF00464206 /* PluginUtilsIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginUtilsIOS.h; sourceTree = ""; }; + FA8CC1E5173754CF00464206 /* PluginUtilsIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginUtilsIOS.mm; sourceTree = ""; }; + FA8CC2031737A3CE00464206 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + FA8CC205173894F000464206 /* ProtocolAds.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolAds.mm; sourceTree = ""; }; + FA8CC206173894F000464206 /* ProtocolAnalytics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolAnalytics.mm; sourceTree = ""; }; + FA8CC207173894F000464206 /* ProtocolIAP.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolIAP.mm; sourceTree = ""; }; + FA8CC21B1739E86E00464206 /* InterfaceAds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceAds.h; sourceTree = ""; }; + FA8CC21C1739E86E00464206 /* InterfaceAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceAnalytics.h; sourceTree = ""; }; + FA8CC21D1739E86E00464206 /* InterfaceIAP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceIAP.h; sourceTree = ""; }; + FA8CC21E1739E86E00464206 /* InterfaceSocial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterfaceSocial.h; sourceTree = ""; }; + FAB6DF931755D7D100C90D89 /* PluginFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginFactory.h; sourceTree = ""; }; + FAB6DF941755D7D100C90D89 /* PluginParam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginParam.h; sourceTree = ""; }; + FAB6DF951755D7E500C90D89 /* PluginParam.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginParam.cpp; path = ../PluginParam.cpp; sourceTree = ""; }; + FAB6DF971755D82F00C90D89 /* PluginFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginFactory.mm; sourceTree = ""; }; + FAB6DF991755D93600C90D89 /* PluginProtocol.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProtocol.mm; sourceTree = ""; }; + FAB6DFCD1755EF8E00C90D89 /* PluginOCMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginOCMacros.h; sourceTree = ""; }; + FAB6DFD21756EA4D00C90D89 /* ProtocolSocial.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProtocolSocial.mm; sourceTree = ""; }; + FAE27551175DB9FB00F5DA8E /* SocialWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialWrapper.h; sourceTree = ""; }; + FAE27552175DB9FB00F5DA8E /* SocialWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SocialWrapper.mm; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA09A31E168ADBC2008C1C7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA8CC2041737A3CE00464206 /* CoreFoundation.framework in Frameworks */, + FA09A325168ADBC2008C1C7B /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA09A316168ADBC2008C1C7B = { + isa = PBXGroup; + children = ( + FAB6DF951755D7E500C90D89 /* PluginParam.cpp */, + FA8CC2031737A3CE00464206 /* CoreFoundation.framework */, + FA0CB8B5168D3CC200E36B11 /* ios */, + FA09A33C168ADC1F008C1C7B /* PluginManager.cpp */, + FA09A336168ADC05008C1C7B /* include */, + FA09A323168ADBC2008C1C7B /* Frameworks */, + FA09A322168ADBC2008C1C7B /* Products */, + ); + sourceTree = ""; + }; + FA09A322168ADBC2008C1C7B /* Products */ = { + isa = PBXGroup; + children = ( + FA09A321168ADBC2008C1C7B /* libPluginProtocol.a */, + ); + name = Products; + sourceTree = ""; + }; + FA09A323168ADBC2008C1C7B /* Frameworks */ = { + isa = PBXGroup; + children = ( + FA09A324168ADBC2008C1C7B /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FA09A336168ADC05008C1C7B /* include */ = { + isa = PBXGroup; + children = ( + FAB6DF931755D7D100C90D89 /* PluginFactory.h */, + FAB6DF941755D7D100C90D89 /* PluginParam.h */, + FA09A337168ADC05008C1C7B /* PluginManager.h */, + FA09A338168ADC05008C1C7B /* PluginProtocol.h */, + FA7C6C971724E4DD008A0ECC /* ProtocolAds.h */, + FA09A339168ADC05008C1C7B /* ProtocolAnalytics.h */, + FA09A33A168ADC05008C1C7B /* ProtocolIAP.h */, + FA4E3033172BD02800A3E673 /* ProtocolSocial.h */, + ); + name = include; + path = ../include; + sourceTree = ""; + }; + FA0CB8B5168D3CC200E36B11 /* ios */ = { + isa = PBXGroup; + children = ( + FAE27551175DB9FB00F5DA8E /* SocialWrapper.h */, + FAE27552175DB9FB00F5DA8E /* SocialWrapper.mm */, + FAB6DFCD1755EF8E00C90D89 /* PluginOCMacros.h */, + FAB6DF991755D93600C90D89 /* PluginProtocol.mm */, + FAB6DF971755D82F00C90D89 /* PluginFactory.mm */, + FA8CC21B1739E86E00464206 /* InterfaceAds.h */, + FA8CC21C1739E86E00464206 /* InterfaceAnalytics.h */, + FA8CC21D1739E86E00464206 /* InterfaceIAP.h */, + FA8CC21E1739E86E00464206 /* InterfaceSocial.h */, + FA8CC205173894F000464206 /* ProtocolAds.mm */, + FA8CC206173894F000464206 /* ProtocolAnalytics.mm */, + FA8CC207173894F000464206 /* ProtocolIAP.mm */, + FAB6DFD21756EA4D00C90D89 /* ProtocolSocial.mm */, + FA8CC1E4173754CF00464206 /* PluginUtilsIOS.h */, + FA8CC1E5173754CF00464206 /* PluginUtilsIOS.mm */, + ); + name = ios; + path = ../platform/ios; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FA09A320168ADBC2008C1C7B /* PluginProtocol */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA09A32F168ADBC2008C1C7B /* Build configuration list for PBXNativeTarget "PluginProtocol" */; + buildPhases = ( + FA09A31D168ADBC2008C1C7B /* Sources */, + FA09A31E168ADBC2008C1C7B /* Frameworks */, + FA09A31F168ADBC2008C1C7B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PluginProtocol; + productName = PluginProtocol; + productReference = FA09A321168ADBC2008C1C7B /* libPluginProtocol.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA09A318168ADBC2008C1C7B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0440; + ORGANIZATIONNAME = zhangbin; + }; + buildConfigurationList = FA09A31B168ADBC2008C1C7B /* Build configuration list for PBXProject "PluginProtocol" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FA09A316168ADBC2008C1C7B; + productRefGroup = FA09A322168ADBC2008C1C7B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FA09A320168ADBC2008C1C7B /* PluginProtocol */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + FA09A31D168ADBC2008C1C7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA09A33E168ADC1F008C1C7B /* PluginManager.cpp in Sources */, + FA8CC1E6173754CF00464206 /* PluginUtilsIOS.mm in Sources */, + FA8CC208173894F000464206 /* ProtocolAds.mm in Sources */, + FA8CC209173894F000464206 /* ProtocolAnalytics.mm in Sources */, + FA8CC20A173894F000464206 /* ProtocolIAP.mm in Sources */, + FAB6DF961755D7E500C90D89 /* PluginParam.cpp in Sources */, + FAB6DF981755D82F00C90D89 /* PluginFactory.mm in Sources */, + FAB6DF9A1755D93600C90D89 /* PluginProtocol.mm in Sources */, + FAB6DFD31756EA4D00C90D89 /* ProtocolSocial.mm in Sources */, + FAE27553175DB9FB00F5DA8E /* SocialWrapper.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FA09A32D168ADBC2008C1C7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + FA09A32E168ADBC2008C1C7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FA09A330168ADBC2008C1C7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/PluginProtocol.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginProtocol-Prefix.pch"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + FA09A331168ADBC2008C1C7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/PluginProtocol.dst; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PluginProtocol-Prefix.pch"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FA09A31B168ADBC2008C1C7B /* Build configuration list for PBXProject "PluginProtocol" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA09A32D168ADBC2008C1C7B /* Debug */, + FA09A32E168ADBC2008C1C7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA09A32F168ADBC2008C1C7B /* Build configuration list for PBXNativeTarget "PluginProtocol" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA09A330168ADBC2008C1C7B /* Debug */, + FA09A331168ADBC2008C1C7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA09A318168ADBC2008C1C7B /* Project object */; +} diff --git a/plugin/samples/HelloAds/Classes/AppDelegate.cpp b/plugin/samples/HelloAds/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..1eb01cb82e --- /dev/null +++ b/plugin/samples/HelloAds/Classes/AppDelegate.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "AppDelegate.h" +#include "HelloWorldScene.h" + +USING_NS_CC; + +AppDelegate::AppDelegate() { + +} + +AppDelegate::~AppDelegate() +{ +} + +bool AppDelegate::applicationDidFinishLaunching() { + // initialize director + CCDirector* pDirector = CCDirector::sharedDirector(); + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + + pDirector->setOpenGLView(pEGLView); + + // turn on display FPS + pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + + // create a scene. it's an autorelease object + CCScene *pScene = HelloWorld::scene(); + + // run + pDirector->runWithScene(pScene); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() { + CCDirector::sharedDirector()->stopAnimation(); + + // if you use SimpleAudioEngine, it must be pause + // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() { + CCDirector::sharedDirector()->startAnimation(); + + // if you use SimpleAudioEngine, it must resume here + // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); +} diff --git a/plugin/samples/HelloAds/Classes/AppDelegate.h b/plugin/samples/HelloAds/Classes/AppDelegate.h new file mode 100644 index 0000000000..301f41163a --- /dev/null +++ b/plugin/samples/HelloAds/Classes/AppDelegate.h @@ -0,0 +1,61 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "cocos2d.h" + +/** +@brief The cocos2d Application. + +The reason for implement as private inheritance is to hide some interface call by CCDirector. +*/ +class AppDelegate : private cocos2d::CCApplication +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + /** + @brief Implement CCDirector and CCScene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp new file mode 100644 index 0000000000..f622c8d36b --- /dev/null +++ b/plugin/samples/HelloAds/Classes/HelloWorldScene.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "HelloWorldScene.h" +#include "PluginManager.h" + +USING_NS_CC; +using namespace cocos2d::plugin; + +const std::string s_aTestCases[] = { + "Admob", +}; + +const std::string s_aTestTypes[] = { + "Banner", + "Full Screen", +}; + +const std::string s_aTestPoses[] = { + "Pos: Center", + "Pos: Top", + "Pos: TopLeft", + "Pos: TopRight", + "Pos: Bottom", + "Pos: BottomLeft", + "Pos: BottomRight", +}; + +CCScene* HelloWorld::scene() +{ + // 'scene' is an autorelease object + CCScene *scene = CCScene::create(); + + // 'layer' is an autorelease object + HelloWorld *layer = HelloWorld::create(); + + // add layer as a child to scene + scene->addChild(layer); + + // return the scene + return scene; +} + +// on "init" you need to initialize your instance +bool HelloWorld::init() +{ + ////////////////////////////// + // 1. super init first + if ( !CCLayer::init() ) + { + return false; + } + + m_pAdmob = dynamic_cast(PluginManager::getInstance()->loadPlugin("AdsAdmob")); + TAdsDeveloperInfo devInfo; + devInfo["AdmobID"] = "a1516fb6b16b12f"; + m_pAdmob->configDeveloperInfo(devInfo); + m_pListener = new MyAdsListener(); + m_pAdmob->setAdsListener(m_pListener); + m_pAdmob->setDebugMode(true); + + CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); + CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin(); + CCPoint posMid = ccp(origin.x + visibleSize.width / 2, origin.y + visibleSize.height / 2); + + ///////////////////////////// + // 2. add a menu item with "X" image, which is clicked to quit the program + // you may modify it. + + // add a "close" icon to exit the progress. it's an autorelease object + CCMenuItemImage *pCloseItem = CCMenuItemImage::create( + "CloseNormal.png", + "CloseSelected.png", + this, + menu_selector(HelloWorld::menuCloseCallback)); + + pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 , + origin.y + pCloseItem->getContentSize().height/2)); + + // create menu, it's an autorelease object + CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); + pMenu->setPosition(CCPointZero); + + CCLabelTTF* label1 = CCLabelTTF::create("ShowAds", "Arial", 24); + CCMenuItemLabel* pItemShow = CCMenuItemLabel::create(label1, this, menu_selector(HelloWorld::testShow)); + pItemShow->setAnchorPoint(ccp(0.5f, 0)); + pMenu->addChild(pItemShow, 0); + pItemShow->setPosition(ccpAdd(posMid, ccp(-100, -120))); + + CCLabelTTF* label2 = CCLabelTTF::create("HideAds", "Arial", 24); + CCMenuItemLabel* pItemHide = CCMenuItemLabel::create(label2, this, menu_selector(HelloWorld::testHide)); + pItemHide->setAnchorPoint(ccp(0.5f, 0)); + pMenu->addChild(pItemHide, 0); + pItemHide->setPosition(ccpAdd(posMid, ccp(100, -120))); + + // create optional menu + // cases item + m_pCaseItem = CCMenuItemToggle::createWithTarget(this, + menu_selector(HelloWorld::caseChanged), + CCMenuItemFont::create( s_aTestCases[0].c_str() ), + NULL ); + int caseLen = sizeof(s_aTestCases) / sizeof(std::string); + for (int i = 1; i < caseLen; ++i) + { + m_pCaseItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestCases[i].c_str() ) ); + } + m_pCaseItem->setPosition(ccpAdd(posMid, ccp(-200, 120))); + pMenu->addChild(m_pCaseItem); + + // type item + m_pTypeItem = CCMenuItemToggle::createWithTarget(this, + menu_selector(HelloWorld::typeChanged), + CCMenuItemFont::create( s_aTestTypes[0].c_str() ), + NULL ); + int typeLen = sizeof(s_aTestTypes) / sizeof(std::string); + for (int i = 1; i < typeLen; ++i) + { + m_pTypeItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestTypes[i].c_str() ) ); + } + m_pTypeItem->setPosition(ccpAdd(posMid, ccp(0, 120))); + pMenu->addChild(m_pTypeItem); + + // poses item + m_pPosItem = CCMenuItemToggle::createWithTarget(this, + menu_selector(HelloWorld::posChanged), + CCMenuItemFont::create( s_aTestPoses[0].c_str() ), + NULL ); + int posLen = sizeof(s_aTestPoses) / sizeof(std::string); + for (int i = 1; i < posLen; ++i) + { + m_pPosItem->getSubItems()->addObject( CCMenuItemFont::create( s_aTestPoses[i].c_str() ) ); + } + m_pPosItem->setPosition(ccpAdd(posMid, ccp(200, 120))); + pMenu->addChild(m_pPosItem); + + // init options + m_pAds = m_pAdmob; + m_ePos = ProtocolAds::kPosCenter; + m_eType = ProtocolAds::kBannerAd; + + this->addChild(pMenu, 1); + + return true; +} + +void HelloWorld::testShow(CCObject* pSender) +{ + int nSize = 0; + if (m_pAds == m_pAdmob) + { + nSize = 0; + } + + if (m_pAds) + { + m_pAds->showAds(m_eType, nSize, m_ePos); + } +} + +void HelloWorld::testHide(CCObject* pSender) +{ + m_pAds->hideAds(m_eType); +} + +void HelloWorld::menuCloseCallback(CCObject* pSender) +{ + CCDirector::sharedDirector()->end(); + + if (m_pAdmob != NULL) + { + PluginManager::getInstance()->unloadPlugin("AdsAdmob"); + m_pAdmob = NULL; + } + + if (NULL != m_pListener) + { + delete m_pListener; + m_pListener = NULL; + } + + PluginManager::end(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif +} + +void HelloWorld::caseChanged(CCObject* pSender) +{ + std::string strLog = ""; + switch (m_pCaseItem->getSelectedIndex()) + { + case 0: + m_pAds = m_pAdmob; + strLog = "Admob"; + break; + default: + break; + } + CCLog("case selected change to : %s", strLog.c_str()); +} + +void HelloWorld::typeChanged(CCObject* pSender) +{ + int selectIndex = m_pTypeItem->getSelectedIndex(); + m_eType = (ProtocolAds::AdsType) selectIndex; + CCLog("type selected change to : %d", m_eType); +} + +void HelloWorld::posChanged(CCObject* pSender) +{ + int selectIndex = m_pPosItem->getSelectedIndex(); + m_ePos = (ProtocolAds::AdsPos) selectIndex; + CCLog("pos selected change to : %d", m_ePos); +} + +void MyAdsListener::onAdsResult(AdsResultCode code, const char* msg) +{ + CCLog("OnAdsResult, code : %d, msg : %s", code, msg); +} + +void MyAdsListener::onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points) +{ + CCLog("Player get points : %d", points); + + // @warning should add code to give game-money to player here + + // spend the points of player + if (pAdsPlugin != NULL) { + pAdsPlugin->spendPoints(points); + } +} diff --git a/plugin/samples/HelloAds/Classes/HelloWorldScene.h b/plugin/samples/HelloAds/Classes/HelloWorldScene.h new file mode 100644 index 0000000000..19a04807ff --- /dev/null +++ b/plugin/samples/HelloAds/Classes/HelloWorldScene.h @@ -0,0 +1,72 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __HELLOWORLD_SCENE_H__ +#define __HELLOWORLD_SCENE_H__ + +#include "cocos2d.h" +#include "ProtocolAds.h" + +class MyAdsListener : public cocos2d::plugin::AdsListener +{ +public: + virtual void onAdsResult(cocos2d::plugin::AdsResultCode code, const char* msg); + virtual void onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points); +}; + +class HelloWorld : public cocos2d::CCLayer +{ +public: + // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone + virtual bool init(); + + // there's no 'id' in cpp, so we recommend returning the class instance pointer + static cocos2d::CCScene* scene(); + + // a selector callback + void menuCloseCallback(CCObject* pSender); + void testShow(CCObject* pSender); + void testHide(CCObject* pSender); + + // option changed callback + void caseChanged(CCObject* pSender); + void posChanged(CCObject* pSender); + void typeChanged(CCObject* pSender); + + // implement the "static node()" method manually + CREATE_FUNC(HelloWorld); + +private: + cocos2d::plugin::ProtocolAds* m_pAdmob; + MyAdsListener* m_pListener; + + cocos2d::CCMenuItemToggle* m_pCaseItem; + cocos2d::CCMenuItemToggle* m_pTypeItem; + cocos2d::CCMenuItemToggle* m_pPosItem; + + cocos2d::plugin::ProtocolAds* m_pAds; + cocos2d::plugin::ProtocolAds::AdsPos m_ePos; + cocos2d::plugin::ProtocolAds::AdsType m_eType; +}; + +#endif // __HELLOWORLD_SCENE_H__ diff --git a/plugin/samples/HelloAds/proj.android/.classpath b/plugin/samples/HelloAds/proj.android/.classpath new file mode 100644 index 0000000000..9f9f31f70f --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/.classpath @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAds/proj.android/.project b/plugin/samples/HelloAds/proj.android/.project new file mode 100644 index 0000000000..f731d7c4b7 --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/.project @@ -0,0 +1,45 @@ + + + HelloAds + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + plugin-x + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/plugin/samples/HelloAds/proj.android/AndroidManifest.xml b/plugin/samples/HelloAds/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..851b907ad6 --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/Javascript/CocosPlayer/proj.android/README.md b/plugin/samples/HelloAds/proj.android/README.md similarity index 100% rename from samples/Javascript/CocosPlayer/proj.android/README.md rename to plugin/samples/HelloAds/proj.android/README.md diff --git a/plugin/samples/HelloAds/proj.android/ant.properties b/plugin/samples/HelloAds/proj.android/ant.properties new file mode 100644 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloAds/proj.android/build.xml b/plugin/samples/HelloAds/proj.android/build.xml new file mode 100644 index 0000000000..693f927946 --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/build.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAds/proj.android/build_native.sh b/plugin/samples/HelloAds/proj.android/build_native.sh new file mode 100755 index 0000000000..38baa1e90a --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/build_native.sh @@ -0,0 +1,78 @@ +APPNAME="HelloAds" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" + +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +# run ndk-build +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloAds/proj.android/jni/Android.mk b/plugin/samples/HelloAds/proj.android/jni/Android.mk new file mode 100644 index 0000000000..49fb10bb3c --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/jni/Android.mk @@ -0,0 +1,21 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := cocos2dcpp_shared + +LOCAL_MODULE_FILENAME := libcocos2dcpp + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../Classes/HelloWorldScene.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes + +LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static \ +PluginProtocolStatic + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) +$(call import-module,protocols/android) diff --git a/plugin/samples/HelloAds/proj.android/jni/Application.mk b/plugin/samples/HelloAds/proj.android/jni/Application.mk new file mode 100644 index 0000000000..743886713b --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 diff --git a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp b/plugin/samples/HelloAds/proj.android/jni/hellocpp/main.cpp similarity index 54% rename from samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp rename to plugin/samples/HelloAds/proj.android/jni/hellocpp/main.cpp index 07a0733a7a..9c34831dd9 100644 --- a/samples/Javascript/CocosPlayer/proj.android/jni/cocosplayer/main.cpp +++ b/plugin/samples/HelloAds/proj.android/jni/hellocpp/main.cpp @@ -1,10 +1,10 @@ #include "AppDelegate.h" -#include "PlayerStatus.h" #include "cocos2d.h" -#include "platform/android/jni/JniHelper.h" #include "CCEventType.h" +#include "platform/android/jni/JniHelper.h" #include #include +#include "PluginJniHelper.h" #define LOG_TAG "main" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) @@ -13,11 +13,11 @@ using namespace cocos2d; extern "C" { - + jint JNI_OnLoad(JavaVM *vm, void *reserved) { JniHelper::setJavaVM(vm); - + PluginJniHelper::setJavaVM(vm); // for plugins return JNI_VERSION_1_4; } @@ -35,7 +35,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi { ccDrawInit(); ccGLInvalidateStateCache(); - + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); CCTextureCache::reloadAllTextures(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); @@ -43,37 +43,4 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi } } - - void Java_org_cocos2dx_lib_Cocos2dxGLSurfaceView_nativeRunCCB(JNIEnv* env, jobject thiz) - { - LOGD("INSIDE JNI RUN CALL"); - handle_ccb_run(); - } - - void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeRunCCB(JNIEnv* env, jobject thiz) - { - LOGD("INSIDE JNI RUN CALL"); - handle_ccb_run(); - } - - void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeStopCCB(JNIEnv* env, jobject thiz) - { - LOGD("INSIDE JNI STOP CALL"); - handle_ccb_stop(); - } - - void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeRunScript(JNIEnv* env, jobject thiz, jstring jsString) - { - LOGD("INSIDE JNI RUN SCRIPT CALL"); - } - - void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeConnected(JNIEnv* env, jobject thiz) - { - handle_connected(); - } - - void Java_org_cocos2dx_cocosplayer_CocosPlayerSocket_nativeDisconnected(JNIEnv* env, jobject thiz) - { - handle_disconnected(); - } } diff --git a/samples/Javascript/CocosPlayer/proj.android/proguard-project.txt b/plugin/samples/HelloAds/proj.android/proguard-project.txt similarity index 100% rename from samples/Javascript/CocosPlayer/proj.android/proguard-project.txt rename to plugin/samples/HelloAds/proj.android/proguard-project.txt diff --git a/samples/Javascript/CocosPlayer/proj.android/project.properties b/plugin/samples/HelloAds/proj.android/project.properties similarity index 95% rename from samples/Javascript/CocosPlayer/proj.android/project.properties rename to plugin/samples/HelloAds/proj.android/project.properties index 9feb1bfb24..db4ff43492 100644 --- a/samples/Javascript/CocosPlayer/proj.android/project.properties +++ b/plugin/samples/HelloAds/proj.android/project.properties @@ -8,6 +8,6 @@ # project structure. # Project target. -target=android-16 +target=android-13 android.library.reference.1=../../../../cocos2dx/platform/android/java diff --git a/samples/Javascript/CocosPlayer/proj.android/res/values/strings.xml b/plugin/samples/HelloAds/proj.android/res/values/strings.xml similarity index 56% rename from samples/Javascript/CocosPlayer/proj.android/res/values/strings.xml rename to plugin/samples/HelloAds/proj.android/res/values/strings.xml index 75cb82bf6b..dc725f3f51 100644 --- a/samples/Javascript/CocosPlayer/proj.android/res/values/strings.xml +++ b/plugin/samples/HelloAds/proj.android/res/values/strings.xml @@ -1,4 +1,4 @@ - CocosPlayer + HelloAds diff --git a/plugin/samples/HelloAds/proj.android/src/org/cocos2dx/HelloAds/HelloAds.java b/plugin/samples/HelloAds/proj.android/src/org/cocos2dx/HelloAds/HelloAds.java new file mode 100644 index 0000000000..5b8a2315c9 --- /dev/null +++ b/plugin/samples/HelloAds/proj.android/src/org/cocos2dx/HelloAds/HelloAds.java @@ -0,0 +1,52 @@ +/**************************************************************************** +Copyright (c) 2010-2011 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.HelloAds; + +import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.lib.Cocos2dxGLSurfaceView; +import org.cocos2dx.plugin.PluginWrapper; + +import android.os.Bundle; + +public class HelloAds extends Cocos2dxActivity{ + + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + + PluginWrapper.init(this); // for plugins + PluginWrapper.setGLSurfaceView(Cocos2dxGLSurfaceView.getInstance()); + } + + public Cocos2dxGLSurfaceView onCreateView() { + Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); + // HelloAds should create stencil buffer + glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); + + return glSurfaceView; + } + + static { + System.loadLibrary("cocos2dcpp"); + } +} diff --git a/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..679d315fd6 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp @@ -0,0 +1,88 @@ +#include "AppDelegate.h" + +#include "cocos2d.h" +#include "SimpleAudioEngine.h" +#include "ScriptingCore.h" +#include "generated/jsb_cocos2dx_auto.hpp" +#include "generated/jsb_cocos2dx_extension_auto.hpp" +#include "cocos2d_specifics.hpp" +#include "js_bindings_chipmunk_registration.h" +#include "js_bindings_system_registration.h" +#include "js_bindings_ccbreader.h" +#include "jsb_opengl_registration.h" + +#include "jsb_pluginx_protocols_auto.hpp" +#include "jsb_pluginx_extension_registration.h" + +USING_NS_CC; +using namespace CocosDenshion; + +AppDelegate::AppDelegate() +{ +} + +AppDelegate::~AppDelegate() +{ + CCScriptEngineManager::sharedManager()->purgeSharedManager(); +} + +bool AppDelegate::applicationDidFinishLaunching() +{ + // initialize director + CCDirector *pDirector = CCDirector::sharedDirector(); + pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + + // turn on display FPS + pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + CCLOG("applicationDidFinishLaunching 01"); + ScriptingCore* sc = ScriptingCore::getInstance(); + sc->addRegisterCallback(register_all_cocos2dx); + sc->addRegisterCallback(register_all_cocos2dx_extension); + sc->addRegisterCallback(register_cocos2dx_js_extensions); + sc->addRegisterCallback(jsb_register_chipmunk); + sc->addRegisterCallback(jsb_register_system); + sc->addRegisterCallback(JSB_register_opengl); + + sc->addRegisterCallback(register_all_pluginx_protocols); + sc->addRegisterCallback(register_pluginx_js_extensions); + sc->start(); + CCLOG("applicationDidFinishLaunching 02"); + CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance(); + CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); + ScriptingCore::getInstance()->runScript("main.js"); + CCLOG("applicationDidFinishLaunching 03"); + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() +{ + CCDirector::sharedDirector()->stopAnimation(); + SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + SimpleAudioEngine::sharedEngine()->pauseAllEffects(); + + ScriptingCore* sc = ScriptingCore::getInstance(); + jsval nsval; + JS_GetProperty(sc->getGlobalContext(), sc->getGlobalObject(), "plugin", &nsval); + if (nsval != JSVAL_VOID) { + sc->executeFunctionWithOwner(nsval, "onApplicationDidEnterBackground"); + } +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() +{ + CCDirector::sharedDirector()->startAnimation(); + SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); + SimpleAudioEngine::sharedEngine()->resumeAllEffects(); + + ScriptingCore* sc = ScriptingCore::getInstance(); + jsval nsval; + JS_GetProperty(sc->getGlobalContext(), sc->getGlobalObject(), "plugin", &nsval); + if (nsval != JSVAL_VOID) { + sc->executeFunctionWithOwner(nsval, "onApplicationWillEnterForeground"); + } +} diff --git a/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.h b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.h new file mode 100644 index 0000000000..87b997b546 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.h @@ -0,0 +1,37 @@ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "CCApplication.h" +/** + @brief The cocos2d Application. + + The reason for implement as private inheritance is to hide some interface call by CCDirector. + */ +class AppDelegate : private cocos2d::CCApplication +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + /** + @brief Implement CCDirector and CCScene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/plugin/samples/HelloAnalytics-JS/Resources/main.js b/plugin/samples/HelloAnalytics-JS/Resources/main.js new file mode 100644 index 0000000000..c458e69b95 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Resources/main.js @@ -0,0 +1,49 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + + http://www.cocos2d-x.org + + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +// boot code needed for cocos2d + JS bindings. +// Not needed by cocos2d-html5 +require("jsb_cocos2d.js"); +require("jsb_pluginx.js"); +var appFiles = [ + 'src/resource.js', + 'src/myApp.js' +]; +cc.dumpConfig(); + +for( var i=0; i < appFiles.length; i++) { + require( appFiles[i] ); +} +var director = cc.Director.getInstance(); +director.setDisplayStats(true); + +// set FPS. the default value is 1.0/60 if you don't call this +director.setAnimationInterval(1.0 / 60); + +// create a scene. it's an autorelease object +var myScene = new MyScene(); + +// run +director.runWithScene(myScene); diff --git a/plugin/samples/HelloAnalytics-JS/Resources/res/background.png.REMOVED.git-id b/plugin/samples/HelloAnalytics-JS/Resources/res/background.png.REMOVED.git-id new file mode 100644 index 0000000000..15b10523a1 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Resources/res/background.png.REMOVED.git-id @@ -0,0 +1 @@ +b2e4ae6ce873ef4a74cf0230693ef26e939d2778 \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics-JS/Resources/src/myApp.js b/plugin/samples/HelloAnalytics-JS/Resources/src/myApp.js new file mode 100644 index 0000000000..df7ed4b57b --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Resources/src/myApp.js @@ -0,0 +1,281 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2011 Zynga Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + + + +var g_pAnalytics = null; +var s_strAppKey = ""; +// The app key of flurry +var FLURRY_KEY_IOS = "KMGG7CD9WPK2TW4X9VR8"; +var FLURRY_KEY_ANDROID = "SPKFH8KMPGHMMBWRBT5W"; +var UMENG_KEY_IOS = "50d2b18c5270152187000097"; +var UMENG_KEY_ANDROID = ""; // umeng key for android is setted in AndroidManifest.xml + + +plugin.onApplicationDidEnterBackground = function() { + if (g_pAnalytics != null) { + cc.log("plugin.onApplicationDidEnterBackground."); + g_pAnalytics.stopSession(); + } +}; + + +plugin.onApplicationWillEnterForeground = function() { + if (g_pAnalytics != null) { + cc.log("plugin.onApplicationWillEnterForeground."); + g_pAnalytics.startSession(s_strAppKey); + } +}; + +var loadAnalyticsPlugin = function() { + var langType = cc.Application.getInstance().getCurrentLanguage(); + + var umengKey = ""; + var flurryKey = ""; + + var targetDevice = cc.Application.getInstance().getTargetPlatform(); + if (targetDevice == 1) + { + umengKey = UMENG_KEY_IOS; + flurryKey = FLURRY_KEY_IOS; + } + else if (targetDevice == 2) + { + umengKey = UMENG_KEY_ANDROID; + flurryKey = FLURRY_KEY_ANDROID; + } + + + if (cc.LANGUAGE_CHINESE == langType) + { + g_pAnalytics = plugin.PluginManager.getInstance().loadPlugin("AnalyticsUmeng"); + s_strAppKey = umengKey; + } + else + { + g_pAnalytics = plugin.PluginManager.getInstance().loadPlugin("AnalyticsFlurry"); + s_strAppKey = flurryKey; + } + + g_pAnalytics.setDebugMode(true); + g_pAnalytics.startSession(s_strAppKey); + g_pAnalytics.setCaptureUncaughtException(true); + + g_pAnalytics.callFuncWithParam("updateOnlineConfig", null); + + g_pAnalytics.callFuncWithParam("setReportLocation", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeBool, true)); + g_pAnalytics.callFuncWithParam("logPageView", null); + g_pAnalytics.callFuncWithParam("setVersionName", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "1.1")); + g_pAnalytics.callFuncWithParam("setAge", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 20)); + g_pAnalytics.callFuncWithParam("setGender", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 1)); + g_pAnalytics.callFuncWithParam("setUserId", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "123456")); + g_pAnalytics.callFuncWithParam("setUseHttps", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeBool, false)); +} + + +TAG_LOG_EVENT_ID = 0; +TAG_LOG_EVENT_ID_KV = 1; +TAG_LOG_ONLINE_CONFIG = 2; +TAG_LOG_EVENT_ID_DURATION = 3; +TAG_LOG_EVENT_BEGIN = 4; +TAG_LOG_EVENT_END = 5; +TAG_MAKE_ME_CRASH = 6; + +var s_EventMenuItem = [ + {id: "OnlineConfig", tag: TAG_LOG_ONLINE_CONFIG}, + {id: "LogEvent-eventId", tag: TAG_LOG_EVENT_ID}, + {id: "LogEvent-eventId-kv", tag: TAG_LOG_EVENT_ID_KV}, + {id: "LogEvent-eventId-Duration", tag: TAG_LOG_EVENT_ID_DURATION}, + {id: "LogEvent-Begin", tag: TAG_LOG_EVENT_BEGIN}, + {id: "LogEvent-End", tag: TAG_LOG_EVENT_END}, + {id: "MakeMeCrash", tag: TAG_MAKE_ME_CRASH} +]; + +var HelloWorld = cc.Layer.extend({ + ctor:function() { + this._super(); + cc.associateWithNative( this, cc.Layer ); + }, + + onEnter: function() { + this._super(); + var size = cc.Director.getInstance().getWinSize(); + + ///////////////////////////// + // 2. add a menu item with "X" image, which is clicked to quit the program + // you may modify it. + + // add a "close" icon to exit the progress. it's an autorelease object + var pCloseItem = cc.MenuItemImage.create( + "CloseNormal.png", + "CloseSelected.png", + this.menuCloseCallback, + this); + pCloseItem.setPosition( cc.p(size.width - 20, 20) ); + + // create menu, it's an autorelease object + var pMenu = cc.Menu.create(pCloseItem); + pMenu.setPosition( cc.p(0, 0) ); + this.addChild(pMenu, 1); + + var yPos = 0; + for (var i = 0; i < s_EventMenuItem.length; i++) { + var label = cc.LabelTTF.create(s_EventMenuItem[i].id, "Arial", 24); + var pMenuItem = cc.MenuItemLabel.create(label, this.eventMenuCallback, this); + pMenu.addChild(pMenuItem, 0, s_EventMenuItem[i].tag); + yPos = size.height - 50*i - 100; + pMenuItem.setPosition( cc.p(size.width / 2, yPos)); + } + + var strName = g_pAnalytics.getPluginName(); + var strVer = g_pAnalytics.getPluginVersion(); + var ret = "Plugin : "+strName+", Ver : "+ strVer; + var pLabel = cc.LabelTTF.create(ret, "Arial", 24, cc.size(size.width, 0), cc.TEXT_ALIGNMENT_CENTER); + pLabel.setPosition(cc.p(size.width / 2, yPos - 100)); + this.addChild(pLabel); + + var label = cc.LabelTTF.create("reload all plugins", "Arial", 24); + var pMenuItem = cc.MenuItemLabel.create(label, this.reloadPluginMenuCallback, this); + pMenuItem.setAnchorPoint(cc.p(0.5, 0)); + pMenu.addChild(pMenuItem, 0); + pMenuItem.setPosition( cc.p(size.width / 2, 0)); + }, + + reloadPluginMenuCallback: function(pSender) { + cc.log("reloadPluginMenuCallback"); + plugin.PluginManager.getInstance().unloadPlugin("AnalyticsFlurry"); + plugin.PluginManager.getInstance().unloadPlugin("AnalyticsUmeng"); + + loadAnalyticsPlugin(); + }, + + eventMenuCallback: function(pSender) { + switch (pSender.getTag()) + { + case TAG_LOG_EVENT_ID: + { + g_pAnalytics.logEvent("click"); + g_pAnalytics.logEvent("music"); + } + break; + case TAG_LOG_EVENT_ID_KV: + { + var paramMap = {}; + paramMap["type"] = "popular"; + paramMap["artist"] = "JJLin"; + g_pAnalytics.logEvent("music", paramMap); + } + break; + case TAG_LOG_ONLINE_CONFIG: + { + cc.log("Online config = " + g_pAnalytics.callStringFuncWithParam("getConfigParams", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "abc"))); + } + break; + case TAG_LOG_EVENT_ID_DURATION: + { + g_pAnalytics.callFuncWithParam("logEventWithDuration", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "book"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 12000)); + g_pAnalytics.callFuncWithParam("logEventWithDurationLabel", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "book"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 23000), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "chapter1")); + var paramMap = {}; + paramMap["type"] = "popular"; + paramMap["artist"] = "JJLin"; + g_pAnalytics.callFuncWithParam("logEventWithDurationParams", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeInt, 2330000), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap)); + } + break; + case TAG_LOG_EVENT_BEGIN: + { + g_pAnalytics.logTimedEventBegin("music"); + + var paramMap = {}; + paramMap["type"] = "popular"; + paramMap["artist"] = "JJLin"; + + g_pAnalytics.callFuncWithParam("logTimedEventWithLabelBegin", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "one")); + g_pAnalytics.callFuncWithParam("logTimedKVEventBegin", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "flag0"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap)); + + g_pAnalytics.callFuncWithParam("logTimedEventBeginWithParams", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music-kv"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeStringMap, paramMap)); + } + break; + case TAG_LOG_EVENT_END: + { + g_pAnalytics.logTimedEventEnd("music"); + + g_pAnalytics.callFuncWithParam("logTimedEventWithLabelEnd", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "one")); + g_pAnalytics.callFuncWithParam("logTimedKVEventEnd", + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music"), + new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "flag0")); + + g_pAnalytics.callFuncWithParam("logTimedEventEnd", new plugin.PluginParam(plugin.PluginParam.ParamType.TypeString, "music-kv")); + } + break; + case TAG_MAKE_ME_CRASH: + { + + } + break; + default: + break; + } + }, + + menuCloseCallback: function() { + cc.log("menuCloseCallback"); + } + +}); + +var MyScene = cc.Scene.extend({ + ctor:function() { + this._super(); + cc.associateWithNative( this, cc.Scene ); + }, + + onEnter:function () { + this._super(); + loadAnalyticsPlugin(); + + var layer = new HelloWorld(); + layer.init(); + this.addChild(layer); + } +}); + diff --git a/plugin/samples/HelloAnalytics-JS/Resources/src/resource.js b/plugin/samples/HelloAnalytics-JS/Resources/src/resource.js new file mode 100644 index 0000000000..145f7ac6ab --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/Resources/src/resource.js @@ -0,0 +1,20 @@ +var s_HelloWorld = "res/HelloWorld.png"; +var s_CloseNormal = "res/CloseNormal.png"; +var s_CloseSelected = "res/CloseSelected.png"; + +var g_ressources = [ + //image + {src:s_HelloWorld}, + {src:s_CloseNormal}, + {src:s_CloseSelected} + + //plist + + //fnt + + //tmx + + //bgm + + //effect +]; \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/.classpath b/plugin/samples/HelloAnalytics-JS/proj.android/.classpath new file mode 100644 index 0000000000..e6251b7af1 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/.project b/plugin/samples/HelloAnalytics-JS/proj.android/.project new file mode 100644 index 0000000000..1a14e76384 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/.project @@ -0,0 +1,40 @@ + + + HelloAnalytics-JS + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + publish + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/AndroidManifest.xml b/plugin/samples/HelloAnalytics-JS/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..57119a6dcf --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/AndroidManifest.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/ant.properties b/plugin/samples/HelloAnalytics-JS/proj.android/ant.properties new file mode 100644 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/build.xml b/plugin/samples/HelloAnalytics-JS/proj.android/build.xml new file mode 100644 index 0000000000..2177fd234b --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh b/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh new file mode 100755 index 0000000000..62e0ebf499 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh @@ -0,0 +1,87 @@ +APPNAME="HelloAnalytics-JS" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" +BINDINGS_JS_ROOT="$COCOS2DX_ROOT/scripting/javascript/bindings/js" + +echo "PLUGIN_ROOT = $PLUGIN_ROOT" +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "---------------------------------------------------------" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +# copy bindings/*.js into assets' root +cp -f "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets +# copy plugin js into assets' path +cp -f "$PLUGIN_ROOT/jsbindings/js"/* "$APP_ANDROID_ROOT"/assets + +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/jni/Android.mk b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Android.mk new file mode 100644 index 0000000000..697fee5588 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Android.mk @@ -0,0 +1,39 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := game_shared + +LOCAL_MODULE_FILENAME := libgame + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../../../jsbindings/auto/jsb_pluginx_protocols_auto.cpp \ + ../../../../jsbindings/manual/pluginxUTF8.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_basic_conversions.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_manual_protocols.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_manual_callback.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_extension_registration.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \ + $(LOCAL_PATH)/../../../../jsbindings \ + $(LOCAL_PATH)/../../../../jsbindings/auto \ + $(LOCAL_PATH)/../../../../jsbindings/manual + +LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \ + PluginProtocolStatic + +LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static +LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static +LOCAL_WHOLE_STATIC_LIBRARIES += spidermonkey_static +LOCAL_WHOLE_STATIC_LIBRARIES += scriptingcore-spidermonkey + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) +$(call import-module,CocosDenshion/android) +$(call import-module,external/chipmunk) +$(call import-module,scripting/javascript/spidermonkey-android) +$(call import-module,scripting/javascript/bindings) +$(call import-module,protocols/android) diff --git a/samples/Javascript/CocosPlayer/proj.android/jni/Application.mk b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk similarity index 96% rename from samples/Javascript/CocosPlayer/proj.android/jni/Application.mk rename to plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk index 1444a4d607..a1f26bfc9c 100644 --- a/samples/Javascript/CocosPlayer/proj.android/jni/Application.mk +++ b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk @@ -1,3 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 +APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/jni/hellocpp/main.cpp b/plugin/samples/HelloAnalytics-JS/proj.android/jni/hellocpp/main.cpp new file mode 100644 index 0000000000..861d869406 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,47 @@ +#include "AppDelegate.h" +#include "platform/android/jni/JniHelper.h" +#include "PluginJniHelper.h" +#include +#include + +#include "cocos2d.h" + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +extern "C" +{ + +jint JNI_OnLoad(JavaVM *vm, void *reserved) +{ + JniHelper::setJavaVM(vm); + PluginJniHelper::setJavaVM(vm); + + return JNI_VERSION_1_4; +} + +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) +{ + if (!CCDirector::sharedDirector()->getOpenGLView()) + { + CCEGLView *view = CCEGLView::sharedOpenGLView(); + view->setFrameSize(w, h); + + AppDelegate *pAppDelegate = new AppDelegate(); + CCApplication::sharedApplication()->run(); + } + else + { + ccDrawInit(); + ccGLInvalidateStateCache(); + + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); + CCTextureCache::reloadAllTextures(); + CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); + CCDirector::sharedDirector()->setGLDefaultValues(); + } +} + +} diff --git a/samples/Javascript/CocosPlayer/proj.android/ndkgdb.sh b/plugin/samples/HelloAnalytics-JS/proj.android/ndkgdb.sh similarity index 83% rename from samples/Javascript/CocosPlayer/proj.android/ndkgdb.sh rename to plugin/samples/HelloAnalytics-JS/proj.android/ndkgdb.sh index 4004da2c55..50a1ea115e 100755 --- a/samples/Javascript/CocosPlayer/proj.android/ndkgdb.sh +++ b/plugin/samples/HelloAnalytics-JS/proj.android/ndkgdb.sh @@ -1,5 +1,5 @@ -APPNAME="CocosPlayer" -APP_ANDROID_NAME="org.cocos2dx.cocosplayer" +APPNAME="HelloAnalytics-JS" +APP_ANDROID_NAME="org.cocos2dx.helloanalytics" if [ -z "${SDK_ROOT+aaa}" ]; then # ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk" @@ -16,12 +16,12 @@ if [ -z "${COCOS2DX_ROOT+aaa}" ]; then # ... find current working directory DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory - COCOS2DX_ROOT="$DIR/../../.." + COCOS2DX_ROOT="$DIR/../.." APP_ROOT="$DIR/.." APP_ANDROID_ROOT="$DIR" else - APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME" - APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android" + APP_ROOT="$COCOS2DX_ROOT/$APPNAME" + APP_ANDROID_ROOT="$COCOS2DX_ROOT/$APPNAME/proj.android" fi echo "NDK_ROOT = $NDK_ROOT" diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/proguard-project.txt b/plugin/samples/HelloAnalytics-JS/proj.android/proguard-project.txt new file mode 100644 index 0000000000..b60ae7ea07 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/project.properties b/plugin/samples/HelloAnalytics-JS/proj.android/project.properties new file mode 100644 index 0000000000..859630e465 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 +android.library.reference.1=../../../../cocos2dx/platform/android/java diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/res/values/strings.xml b/plugin/samples/HelloAnalytics-JS/proj.android/res/values/strings.xml new file mode 100644 index 0000000000..1b284156a7 --- /dev/null +++ b/plugin/samples/HelloAnalytics-JS/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + HelloAnalytics-JS + diff --git a/samples/Javascript/CocosPlayer/proj.android/src/org/cocos2dx/cocosplayer/CocosPlayer.java b/plugin/samples/HelloAnalytics-JS/proj.android/src/org/cocos2dx/helloanalyticsjs/HelloAnalytics.java similarity index 68% rename from samples/Javascript/CocosPlayer/proj.android/src/org/cocos2dx/cocosplayer/CocosPlayer.java rename to plugin/samples/HelloAnalytics-JS/proj.android/src/org/cocos2dx/helloanalyticsjs/HelloAnalytics.java index e70c0c6b0e..3d88dc3518 100644 --- a/samples/Javascript/CocosPlayer/proj.android/src/org/cocos2dx/cocosplayer/CocosPlayer.java +++ b/plugin/samples/HelloAnalytics-JS/proj.android/src/org/cocos2dx/helloanalyticsjs/HelloAnalytics.java @@ -21,33 +21,21 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -package org.cocos2dx.cocosplayer; +package org.cocos2dx.helloanalyticsjs; import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.plugin.PluginWrapper; import android.os.Bundle; -import android.app.Activity; -import android.content.Intent; -import android.content.ContextWrapper; -import android.content.Context; -public class CocosPlayer extends Cocos2dxActivity{ +public class HelloAnalytics extends Cocos2dxActivity{ - public static Context c; - - public static Activity activity; - - public static void setOrientation(int orient) { - activity.setRequestedOrientation(orient); + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + PluginWrapper.init(this); } - - protected void onCreate(Bundle savedInstanceState){ - super.onCreate(savedInstanceState); - activity = this; - c = getApplicationContext(); - } - static { - System.loadLibrary("cocosplayer"); + static { + System.loadLibrary("game"); } } diff --git a/plugin/samples/HelloAnalytics/Classes/AppDelegate.cpp b/plugin/samples/HelloAnalytics/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..8375de18bb --- /dev/null +++ b/plugin/samples/HelloAnalytics/Classes/AppDelegate.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "AppDelegate.h" +#include "cocos2d.h" +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "ProtocolAnalytics.h" + +using namespace cocos2d::plugin; +USING_NS_CC; + +// The app key of flurry +#define FLURRY_KEY_IOS "KMGG7CD9WPK2TW4X9VR8" +#define FLURRY_KEY_ANDROID "SPKFH8KMPGHMMBWRBT5W" +#define UMENG_KEY_IOS "50d2b18c5270152187000097" +#define UMENG_KEY_ANDROID "" // umeng key for android is setted in AndroidManifest.xml + +ProtocolAnalytics* g_pAnalytics = NULL; +std::string s_strAppKey = ""; + +AppDelegate::AppDelegate() +{ + +} + +AppDelegate::~AppDelegate() +{ + +} + +void AppDelegate::loadAnalyticsPlugin() +{ + PluginProtocol* pPlugin = NULL; + ccLanguageType langType = CCApplication::sharedApplication()->getCurrentLanguage(); + + std::string umengKey = ""; + std::string flurryKey = ""; + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + umengKey = UMENG_KEY_IOS; + flurryKey = FLURRY_KEY_IOS; +#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) + umengKey = UMENG_KEY_ANDROID; + flurryKey = FLURRY_KEY_ANDROID; +#endif + + if (kLanguageChinese == langType) + { + pPlugin = PluginManager::getInstance()->loadPlugin("AnalyticsUmeng"); + s_strAppKey = umengKey; + } + else + { + pPlugin = PluginManager::getInstance()->loadPlugin("AnalyticsFlurry"); + s_strAppKey = flurryKey; + } + + g_pAnalytics = dynamic_cast(pPlugin); +} + +bool AppDelegate::applicationDidFinishLaunching() +{ + loadAnalyticsPlugin(); + g_pAnalytics->setDebugMode(true); + g_pAnalytics->startSession(s_strAppKey.c_str()); + g_pAnalytics->setCaptureUncaughtException(true); + g_pAnalytics->setSessionContinueMillis(10000); + + const char* sdkVer = g_pAnalytics->getSDKVersion(); + CCLog("SDK version : %s", sdkVer); + + g_pAnalytics->callFuncWithParam("updateOnlineConfig", NULL); + + PluginParam pParam1(true); + g_pAnalytics->callFuncWithParam("setReportLocation", &pParam1, NULL); + + g_pAnalytics->callFuncWithParam("logPageView", NULL); + + PluginParam pParam2("1.1"); + g_pAnalytics->callFuncWithParam("setVersionName", &pParam2, NULL); + + PluginParam pParam3(20); + g_pAnalytics->callFuncWithParam("setAge", &pParam3, NULL); + + PluginParam pParam4(1); + g_pAnalytics->callFuncWithParam("setGender", &pParam4, NULL); + + PluginParam pParam5("123456"); + g_pAnalytics->callFuncWithParam("setUserId", &pParam5, NULL); + + PluginParam pParam6(false); + g_pAnalytics->callFuncWithParam("setUseHttps", &pParam6, NULL); + + // initialize director + CCDirector *pDirector = CCDirector::sharedDirector(); + pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + + // turn on display FPS + //pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + + // create a scene. it's an autorelease object + CCScene *pScene = HelloWorld::scene(); + + // run + pDirector->runWithScene(pScene); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() +{ + CCDirector::sharedDirector()->pause(); + + // if you use SimpleAudioEngine, it must be pause + // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + g_pAnalytics->stopSession(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() +{ + CCDirector::sharedDirector()->resume(); + if (g_pAnalytics) + { + g_pAnalytics->startSession(s_strAppKey.c_str()); + } + + // if you use SimpleAudioEngine, it must resume here + // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); +} diff --git a/plugin/samples/HelloAnalytics/Classes/AppDelegate.h b/plugin/samples/HelloAnalytics/Classes/AppDelegate.h new file mode 100644 index 0000000000..cb6c1f28dd --- /dev/null +++ b/plugin/samples/HelloAnalytics/Classes/AppDelegate.h @@ -0,0 +1,63 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "CCApplication.h" + +/** +@brief The cocos2d Application. + +The reason for implement as private inheritance is to hide some interface call by CCDirector. +*/ +class AppDelegate : private cocos2d::CCApplication +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + /** + @brief Implement CCDirector and CCScene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); + + static void loadAnalyticsPlugin(); +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.cpp b/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.cpp new file mode 100644 index 0000000000..2f24e66294 --- /dev/null +++ b/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.cpp @@ -0,0 +1,241 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "ProtocolAnalytics.h" +#include "AppDelegate.h" + +using namespace cocos2d; +using namespace cocos2d::plugin; + +extern ProtocolAnalytics* g_pAnalytics; +extern std::string s_strAppKey; + +enum { + TAG_LOG_EVENT_ID = 0, + TAG_LOG_EVENT_ID_KV, + TAG_LOG_ONLINE_CONFIG, + TAG_LOG_EVENT_ID_DURATION, + TAG_LOG_EVENT_BEGIN, + TAG_LOG_EVENT_END, + TAG_MAKE_ME_CRASH +}; + +typedef struct tagEventMenuItem { + std::string id; + int tag; +}EventMenuItem; + +static EventMenuItem s_EventMenuItem[] = { + {"OnlineConfig", TAG_LOG_ONLINE_CONFIG}, + {"LogEvent-eventId" , TAG_LOG_EVENT_ID}, + {"LogEvent-eventId-kv", TAG_LOG_EVENT_ID_KV}, + {"LogEvent-eventId-Duration", TAG_LOG_EVENT_ID_DURATION}, + {"LogEvent-Begin", TAG_LOG_EVENT_BEGIN}, + {"LogEvent-End", TAG_LOG_EVENT_END}, + {"MakeMeCrash", TAG_MAKE_ME_CRASH} +}; + +CCScene* HelloWorld::scene() +{ + // 'scene' is an autorelease object + CCScene *scene = CCScene::create(); + + // 'layer' is an autorelease object + HelloWorld *layer = HelloWorld::create(); + + // add layer as a child to scene + scene->addChild(layer); + + // return the scene + return scene; +} + +// on "init" you need to initialize your instance +bool HelloWorld::init() +{ + ////////////////////////////// + // 1. super init first + if ( !CCLayer::init() ) + { + return false; + } + + CCSize size = CCDirector::sharedDirector()->getWinSize(); + + ///////////////////////////// + // 2. add a menu item with "X" image, which is clicked to quit the program + // you may modify it. + + // add a "close" icon to exit the progress. it's an autorelease object + CCMenuItemImage *pCloseItem = CCMenuItemImage::create( + "CloseNormal.png", + "CloseSelected.png", + this, + menu_selector(HelloWorld::menuCloseCallback) ); + pCloseItem->setPosition( ccp(size.width - 20, 20) ); + + // create menu, it's an autorelease object + CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); + pMenu->setPosition( CCPointZero ); + this->addChild(pMenu, 1); + + float yPos = 0; + for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) { + CCLabelTTF* label = CCLabelTTF::create(s_EventMenuItem[i].id.c_str(), "Arial", 24); + CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::eventMenuCallback)); + pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag); + yPos = size.height - 35*i - 100; + pMenuItem->setPosition( ccp(size.width / 2, yPos)); + } + + std::string strName = g_pAnalytics->getPluginName(); + std::string strVer = g_pAnalytics->getSDKVersion(); + char ret[256] = { 0 }; + sprintf(ret, "Plugin : %s, Ver : %s", strName.c_str(), strVer.c_str()); + CCLabelTTF* pLabel = CCLabelTTF::create(ret, "Arial", 18, CCSizeMake(size.width, 0), kCCTextAlignmentCenter); + pLabel->setPosition(ccp(size.width / 2, yPos - 80)); + addChild(pLabel); + + CCLabelTTF* label = CCLabelTTF::create("reload all plugins", "Arial", 24); + CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::reloadPluginMenuCallback)); + pMenuItem->setAnchorPoint(ccp(0.5f, 0)); + pMenu->addChild(pMenuItem, 0); + pMenuItem->setPosition( ccp(size.width / 2, 0)); + + return true; +} + +void HelloWorld::reloadPluginMenuCallback(CCObject* pSender) +{ + PluginManager::getInstance()->unloadPlugin("AnalyticsFlurry"); + PluginManager::getInstance()->unloadPlugin("AnalyticsUmeng"); + + AppDelegate::loadAnalyticsPlugin(); +} + +void HelloWorld::eventMenuCallback(CCObject* pSender) +{ + CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender; + + switch (pMenuItem->getTag()) + { + case TAG_LOG_EVENT_ID: + { + g_pAnalytics->logEvent("click"); + g_pAnalytics->logEvent("music"); + } + break; + case TAG_LOG_EVENT_ID_KV: + { + LogEventParamMap paramMap; + paramMap.insert(LogEventParamPair("type", "popular")); + paramMap.insert(LogEventParamPair("artist", "JJLin")); + g_pAnalytics->logEvent("music", ¶mMap); + } + break; + case TAG_LOG_ONLINE_CONFIG: + { + PluginParam param("abc"); + CCLog("Online config = %s", g_pAnalytics->callStringFuncWithParam("getConfigParams", ¶m, NULL)); + } + break; + case TAG_LOG_EVENT_ID_DURATION: + { + PluginParam event1("book"); + PluginParam dura1(12000); + g_pAnalytics->callFuncWithParam("logEventWithDuration", &event1, &dura1, NULL); + + PluginParam event2("book"); + PluginParam dura2(12000); + PluginParam label("chapter1"); + g_pAnalytics->callFuncWithParam("logEventWithDurationLabel", &event2, &dura2, &label, NULL); + + PluginParam event3("music"); + PluginParam dura3(2330000); + LogEventParamMap paramMap; + paramMap.insert(LogEventParamPair("type", "popular")); + paramMap.insert(LogEventParamPair("artist", "JJLin")); + PluginParam mapValue(paramMap); + g_pAnalytics->callFuncWithParam("logEventWithDurationParams", &event3, &dura3, &mapValue, NULL); + } + break; + case TAG_LOG_EVENT_BEGIN: + { + g_pAnalytics->logTimedEventBegin("music"); + + PluginParam event1("music"); + PluginParam label1("one"); + g_pAnalytics->callFuncWithParam("logTimedEventWithLabelBegin", &event1, &label1, NULL); + + PluginParam event2("music"); + PluginParam label2("flag0"); + LogEventParamMap paramMap; + paramMap.insert(LogEventParamPair("type", "popular")); + paramMap.insert(LogEventParamPair("artist", "JJLin")); + PluginParam mapValue(paramMap); + g_pAnalytics->callFuncWithParam("logTimedKVEventBegin", &event2, &label2, &mapValue, NULL); + + PluginParam event3("music-kv"); + g_pAnalytics->callFuncWithParam("logTimedEventBeginWithParams", &event3, &mapValue, NULL); + } + break; + case TAG_LOG_EVENT_END: + { + g_pAnalytics->logTimedEventEnd("music"); + + PluginParam event1("music"); + PluginParam label1("one"); + g_pAnalytics->callFuncWithParam("logTimedEventWithLabelEnd", &event1, &label1, NULL); + + PluginParam event2("music"); + PluginParam label2("flag0"); + g_pAnalytics->callFuncWithParam("logTimedKVEventEnd", &event2, &label2, NULL); + + PluginParam event3("music-kv"); + g_pAnalytics->callFuncWithParam("logTimedEventEnd", &event3, NULL); + } + break; + case TAG_MAKE_ME_CRASH: + { + char* pNull = NULL; + *pNull = 0; + } + break; + default: + break; + } +} + +void HelloWorld::menuCloseCallback(CCObject* pSender) +{ + if (g_pAnalytics) + g_pAnalytics->stopSession(); + + PluginManager::end(); + CCDirector::sharedDirector()->end(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif +} diff --git a/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.h b/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.h new file mode 100644 index 0000000000..35352d5970 --- /dev/null +++ b/plugin/samples/HelloAnalytics/Classes/HelloWorldScene.h @@ -0,0 +1,47 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __HELLOWORLD_SCENE_H__ +#define __HELLOWORLD_SCENE_H__ + +#include "cocos2d.h" + +class HelloWorld : public cocos2d::CCLayer +{ +public: + // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone + virtual bool init(); + + // there's no 'id' in cpp, so we recommand to return the exactly class pointer + static cocos2d::CCScene* scene(); + + // a selector callback + void menuCloseCallback(CCObject* pSender); + void eventMenuCallback(CCObject* pSender); + void reloadPluginMenuCallback(CCObject* pSender); + + // implement the "static node()" method manually + CREATE_FUNC(HelloWorld); +}; + +#endif // __HELLOWORLD_SCENE_H__ diff --git a/plugin/samples/HelloAnalytics/proj.android/.classpath b/plugin/samples/HelloAnalytics/proj.android/.classpath new file mode 100644 index 0000000000..e6251b7af1 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics/proj.android/.project b/plugin/samples/HelloAnalytics/proj.android/.project new file mode 100644 index 0000000000..242b4d396f --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/.project @@ -0,0 +1,45 @@ + + + HelloAnalytics + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + publish + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/plugin/samples/HelloAnalytics/proj.android/AndroidManifest.xml b/plugin/samples/HelloAnalytics/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..a981cdb8ed --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/AndroidManifest.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics/proj.android/ant.properties b/plugin/samples/HelloAnalytics/proj.android/ant.properties new file mode 100644 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloAnalytics/proj.android/build.xml b/plugin/samples/HelloAnalytics/proj.android/build.xml new file mode 100644 index 0000000000..80abad0ab0 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloAnalytics/proj.android/build_native.sh b/plugin/samples/HelloAnalytics/proj.android/build_native.sh new file mode 100755 index 0000000000..7b388a1442 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/build_native.sh @@ -0,0 +1,81 @@ +APPNAME="HelloAnalytics" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" + +echo "PLUGIN_ROOT = $PLUGIN_ROOT" +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "---------------------------------------------------------" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloAnalytics/proj.android/jni/Android.mk b/plugin/samples/HelloAnalytics/proj.android/jni/Android.mk new file mode 100644 index 0000000000..6940ebe855 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/jni/Android.mk @@ -0,0 +1,21 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := game_shared + +LOCAL_MODULE_FILENAME := libgame + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../Classes/HelloWorldScene.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes + +LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \ + PluginProtocolStatic + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) \ +$(call import-module,protocols/android) diff --git a/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk b/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk new file mode 100644 index 0000000000..d16d4facd2 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_CPPFLAGS += -frtti \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics/proj.android/jni/hellocpp/main.cpp b/plugin/samples/HelloAnalytics/proj.android/jni/hellocpp/main.cpp new file mode 100644 index 0000000000..ee1079c797 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,47 @@ +#include "AppDelegate.h" +#include "platform/android/jni/JniHelper.h" +#include "PluginJniHelper.h" +#include +#include + +#include "HelloWorldScene.h" + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +extern "C" +{ + +jint JNI_OnLoad(JavaVM *vm, void *reserved) +{ + JniHelper::setJavaVM(vm); + PluginJniHelper::setJavaVM(vm); + + return JNI_VERSION_1_4; +} + +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) +{ + if (!CCDirector::sharedDirector()->getOpenGLView()) + { + CCEGLView *view = CCEGLView::sharedOpenGLView(); + view->setFrameSize(w, h); + + AppDelegate *pAppDelegate = new AppDelegate(); + CCApplication::sharedApplication()->run(); + } + else + { + ccDrawInit(); + ccGLInvalidateStateCache(); + + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); + CCTextureCache::reloadAllTextures(); + CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); + CCDirector::sharedDirector()->setGLDefaultValues(); + } +} + +} diff --git a/plugin/samples/HelloAnalytics/proj.android/ndkgdb.sh b/plugin/samples/HelloAnalytics/proj.android/ndkgdb.sh new file mode 100755 index 0000000000..e706c46ad3 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/ndkgdb.sh @@ -0,0 +1,47 @@ +APPNAME="HelloAnalytics" +APP_ANDROID_NAME="org.cocos2dx.helloanalytics" + +if [ -z "${SDK_ROOT+aaa}" ]; then +# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk" + SDK_ROOT="$HOME/bin/android-sdk" +fi + +if [ -z "${NDK_ROOT+aaa}" ]; then +# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk" + NDK_ROOT="$HOME/bin/android-ndk" +fi + +if [ -z "${COCOS2DX_ROOT+aaa}" ]; then +# ... if COCOS2DX_ROOT is not set +# ... find current working directory + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory + COCOS2DX_ROOT="$DIR/../.." + APP_ROOT="$DIR/.." + APP_ANDROID_ROOT="$DIR" +else + APP_ROOT="$COCOS2DX_ROOT/$APPNAME" + APP_ANDROID_ROOT="$COCOS2DX_ROOT/$APPNAME/proj.android" +fi + +echo "NDK_ROOT = $NDK_ROOT" +echo "SDK_ROOT = $SDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "APP_ANDROID_NAME = $APP_ANDROID_NAME" + +echo +echo "Killing and restarting ${APP_ANDROID_NAME}" +echo + +set -x + +"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}" + +NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \ + "${NDK_ROOT}"/ndk-gdb \ + --adb="${SDK_ROOT}"/platform-tools/adb \ + --verbose \ + --start \ + --force diff --git a/plugin/samples/HelloAnalytics/proj.android/proguard-project.txt b/plugin/samples/HelloAnalytics/proj.android/proguard-project.txt new file mode 100644 index 0000000000..b60ae7ea07 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugin/samples/HelloAnalytics/proj.android/project.properties b/plugin/samples/HelloAnalytics/proj.android/project.properties new file mode 100644 index 0000000000..859630e465 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 +android.library.reference.1=../../../../cocos2dx/platform/android/java diff --git a/plugin/samples/HelloAnalytics/proj.android/res/values/strings.xml b/plugin/samples/HelloAnalytics/proj.android/res/values/strings.xml new file mode 100644 index 0000000000..5d8f1e706b --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + HelloAnalytics + diff --git a/plugin/samples/HelloAnalytics/proj.android/src/org/cocos2dx/helloanalytics/HelloAnalytics.java b/plugin/samples/HelloAnalytics/proj.android/src/org/cocos2dx/helloanalytics/HelloAnalytics.java new file mode 100644 index 0000000000..1ec319368f --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.android/src/org/cocos2dx/helloanalytics/HelloAnalytics.java @@ -0,0 +1,41 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.helloanalytics; + +import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.plugin.PluginWrapper; + +import android.os.Bundle; + +public class HelloAnalytics extends Cocos2dxActivity{ + + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + PluginWrapper.init(this); + } + + static { + System.loadLibrary("game"); + } +} diff --git a/plugin/samples/HelloAnalytics/proj.ios/AppController.h b/plugin/samples/HelloAnalytics/proj.ios/AppController.h new file mode 100755 index 0000000000..3d51064ca0 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/AppController.h @@ -0,0 +1,33 @@ +/**************************************************************************** + Copyright (c) 2010 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +@class RootViewController; + +@interface AppController : NSObject { + UIWindow *window; + RootViewController *viewController; +} + +@end + diff --git a/plugin/samples/HelloAnalytics/proj.ios/AppController.mm b/plugin/samples/HelloAnalytics/proj.ios/AppController.mm new file mode 100755 index 0000000000..42ba3259fd --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/AppController.mm @@ -0,0 +1,134 @@ +/**************************************************************************** + Copyright (c) 2010 cocos2d-x.org + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ +#import +#import "AppController.h" +#import "cocos2d.h" +#import "EAGLView.h" +#import "AppDelegate.h" + +#import "RootViewController.h" + +@implementation AppController + +#pragma mark - +#pragma mark Application lifecycle + +// cocos2d application instance +static AppDelegate s_sharedApplication; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + // Override point for customization after application launch. + + // Add the view controller's view to the window and display. + window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; + EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] + pixelFormat: kEAGLColorFormatRGBA8 + depthFormat: GL_DEPTH_COMPONENT16 + preserveBackbuffer: NO + sharegroup:nil + multiSampling:NO + numberOfSamples:0]; + + // Use RootViewController manage EAGLView + viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; + viewController.wantsFullScreenLayout = YES; + viewController.view = __glView; + + // Set RootViewController to window + if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) + { + // warning: addSubView doesn't work on iOS6 + [window addSubview: viewController.view]; + } + else + { + // use this method on ios6 + [window setRootViewController:viewController]; + } + + [window makeKeyAndVisible]; + + [[UIApplication sharedApplication] setStatusBarHidden: YES]; + + cocos2d::CCApplication::sharedApplication()->run(); + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + /* + 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. + 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. + */ + cocos2d::CCDirector::sharedDirector()->pause(); +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + /* + 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. + */ + cocos2d::CCDirector::sharedDirector()->resume(); +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + /* + 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. + If your application supports background execution, called instead of applicationWillTerminate: when the user quits. + */ + cocos2d::CCApplication::sharedApplication()->applicationDidEnterBackground(); +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + /* + Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. + */ + cocos2d::CCApplication::sharedApplication()->applicationWillEnterForeground(); +} + +- (void)applicationWillTerminate:(UIApplication *)application { + /* + Called when the application is about to terminate. + See also applicationDidEnterBackground:. + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { + /* + Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. + */ +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end + diff --git a/plugin/samples/HelloAnalytics/proj.ios/Default-568h@2x.png.REMOVED.git-id b/plugin/samples/HelloAnalytics/proj.ios/Default-568h@2x.png.REMOVED.git-id new file mode 100644 index 0000000000..8f5838f3a8 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/Default-568h@2x.png.REMOVED.git-id @@ -0,0 +1 @@ +66c6d1cead373b45218424f6a82f370897e443e4 \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics/proj.ios/Default@2x.png.REMOVED.git-id b/plugin/samples/HelloAnalytics/proj.ios/Default@2x.png.REMOVED.git-id new file mode 100644 index 0000000000..8843505b20 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/Default@2x.png.REMOVED.git-id @@ -0,0 +1 @@ +84689888a14a2123d2b39f7f2f61be8c15207479 \ No newline at end of file diff --git a/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics.xcodeproj/project.pbxproj b/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics.xcodeproj/project.pbxproj new file mode 100755 index 0000000000..76e7e6adca --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics.xcodeproj/project.pbxproj @@ -0,0 +1,576 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492D4B1289302400A09262 /* OpenGLES.framework */; }; + BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492C21128924A800A09262 /* libxml2.dylib */; }; + BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492B6912891AC600A09262 /* libz.dylib */; }; + BF13742F128A8E6A00D9F789 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF137426128A8E4600D9F789 /* QuartzCore.framework */; }; + BF365AA812A103F70050DCF4 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF365AA712A103F70050DCF4 /* AppController.mm */; }; + BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF4DE6AC138BB89600CF907D /* RootViewController.mm */; }; + D446FD79161028E9000ADA7B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD78161028E9000ADA7B /* Default.png */; }; + D446FD7B161028ED000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD7A161028ED000ADA7B /* Default@2x.png */; }; + D446FD7D161028F4000ADA7B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD7C161028F4000ADA7B /* Default-568h@2x.png */; }; + D4ABB4B313B4395300552E6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ABB4B213B4395300552E6E /* main.m */; }; + D4EF94E815BD319200D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E715BD319200D803EB /* Icon-57.png */; }; + D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E915BD319500D803EB /* Icon-114.png */; }; + D4EF94EC15BD319B00D803EB /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94EB15BD319B00D803EB /* Icon-72.png */; }; + D4EF94EE15BD319D00D803EB /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94ED15BD319D00D803EB /* Icon-144.png */; }; + FA0CB877168D2F5400E36B11 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0CB873168D2F5400E36B11 /* AppDelegate.cpp */; }; + FA0CB878168D2F5400E36B11 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0CB875168D2F5400E36B11 /* HelloWorldScene.cpp */; }; + FA0CB87E168D2FB200E36B11 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0CB87D168D2FB200E36B11 /* SystemConfiguration.framework */; }; + FA0CB8A6168D31EA00E36B11 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = FA0CB8A3168D31EA00E36B11 /* CloseNormal.png */; }; + FA0CB8A7168D31EA00E36B11 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = FA0CB8A4168D31EA00E36B11 /* CloseSelected.png */; }; + FA3FC131168D6AF400F56319 /* libPluginProtocol.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA3FC12E168D6ADD00F56319 /* libPluginProtocol.a */; }; + FA7C6D1817251CD5008A0ECC /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA7C6CF517251BEA008A0ECC /* libcocos2dx.a */; }; + FA7C6D1917251CD5008A0ECC /* libPluginFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA7C6D0817251C10008A0ECC /* libPluginFlurry.a */; }; + FA7C6D1A17251CD5008A0ECC /* libPluginUmeng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA7C6D1117251C17008A0ECC /* libPluginUmeng.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + FA3FC12D168D6ADD00F56319 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA3FC126168D6ADC00F56319 /* PluginProtocol.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA09A321168ADBC2008C1C7B; + remoteInfo = PluginProtocol; + }; + FA3FC12F168D6AEB00F56319 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA3FC126168D6ADC00F56319 /* PluginProtocol.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FA09A320168ADBC2008C1C7B; + remoteInfo = PluginProtocol; + }; + FA7C6CF417251BEA008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6CED17251BEA008A0ECC /* cocos2dx.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1551A33F158F2AB200E66CFE; + remoteInfo = cocos2dx; + }; + FA7C6D0717251C10008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6D0017251C10008A0ECC /* PluginFlurry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA09A372168AFD41008C1C7B; + remoteInfo = PluginFlurry; + }; + FA7C6D1017251C17008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6D0917251C16008A0ECC /* PluginUmeng.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA09A301168ADAEC008C1C7B; + remoteInfo = PluginUmeng; + }; + FA7C6D1217251C30008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6D0017251C10008A0ECC /* PluginFlurry.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FA09A371168AFD41008C1C7B; + remoteInfo = PluginFlurry; + }; + FA7C6D1417251C30008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6D0917251C16008A0ECC /* PluginUmeng.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FA09A300168ADAEC008C1C7B; + remoteInfo = PluginUmeng; + }; + FA7C6D1617251C30008A0ECC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FA7C6CED17251BEA008A0ECC /* cocos2dx.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 1551A33E158F2AB200E66CFE; + remoteInfo = cocos2dx; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* HelloAnalytics.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloAnalytics.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 781C33B11547F06B00633F88 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; + 781C33B31547F06B00633F88 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 781C33B51547F06B00633F88 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + BF137426128A8E4600D9F789 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + BF365AA612A103F70050DCF4 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; + BF365AA712A103F70050DCF4 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; + BF492B6912891AC600A09262 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + BF492C21128924A800A09262 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + BF492D4B1289302400A09262 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + BF4DE6AB138BB89600CF907D /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; + BF4DE6AC138BB89600CF907D /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; + D446FD78161028E9000ADA7B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = ../proj.ios/Default.png; sourceTree = ""; }; + D446FD7A161028ED000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = ""; }; + D446FD7C161028F4000ADA7B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = ""; }; + D4ABB4B213B4395300552E6E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D4EF94E715BD319200D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = ""; }; + D4EF94E915BD319500D803EB /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-114.png"; path = "../proj.ios/Icon-114.png"; sourceTree = ""; }; + D4EF94EB15BD319B00D803EB /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "../proj.ios/Icon-72.png"; sourceTree = ""; }; + D4EF94ED15BD319D00D803EB /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-144.png"; path = "../proj.ios/Icon-144.png"; sourceTree = ""; }; + FA0CB873168D2F5400E36B11 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; + FA0CB874168D2F5400E36B11 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + FA0CB875168D2F5400E36B11 /* HelloWorldScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HelloWorldScene.cpp; sourceTree = ""; }; + FA0CB876168D2F5400E36B11 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorldScene.h; sourceTree = ""; }; + FA0CB87D168D2FB200E36B11 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + FA0CB8A3168D31EA00E36B11 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseNormal.png; sourceTree = ""; }; + FA0CB8A4168D31EA00E36B11 /* CloseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseSelected.png; sourceTree = ""; }; + FA3FC126168D6ADC00F56319 /* PluginProtocol.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginProtocol.xcodeproj; path = ../../../protocols/proj.ios/PluginProtocol.xcodeproj; sourceTree = ""; }; + FA7C6CED17251BEA008A0ECC /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = ""; }; + FA7C6D0017251C10008A0ECC /* PluginFlurry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginFlurry.xcodeproj; path = ../../../plugins/flurry/proj.ios/PluginFlurry.xcodeproj; sourceTree = ""; }; + FA7C6D0917251C16008A0ECC /* PluginUmeng.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginUmeng.xcodeproj; path = ../../../plugins/umeng/proj.ios/PluginUmeng.xcodeproj; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA7C6D1817251CD5008A0ECC /* libcocos2dx.a in Frameworks */, + FA7C6D1917251CD5008A0ECC /* libPluginFlurry.a in Frameworks */, + FA7C6D1A17251CD5008A0ECC /* libPluginUmeng.a in Frameworks */, + FA3FC131168D6AF400F56319 /* libPluginProtocol.a in Frameworks */, + FA0CB87E168D2FB200E36B11 /* SystemConfiguration.framework in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */, + BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */, + BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */, + BF13742F128A8E6A00D9F789 /* QuartzCore.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* HelloAnalytics.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + FA7C6D0917251C16008A0ECC /* PluginUmeng.xcodeproj */, + FA7C6D0017251C10008A0ECC /* PluginFlurry.xcodeproj */, + FA7C6CED17251BEA008A0ECC /* cocos2dx.xcodeproj */, + FA3FC126168D6ADC00F56319 /* PluginProtocol.xcodeproj */, + FA0CB87D168D2FB200E36B11 /* SystemConfiguration.framework */, + FA0CB872168D2F5400E36B11 /* Classes */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + BF5681CC1313A84D0055EEAC /* ios */, + 19C28FACFE9D520D11CA2CBB /* Products */, + 784521C214EBA449009D533B /* Resources */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + BF492B6912891AC600A09262 /* libz.dylib */, + BF137426128A8E4600D9F789 /* QuartzCore.framework */, + BF492D4B1289302400A09262 /* OpenGLES.framework */, + BF492C21128924A800A09262 /* libxml2.dylib */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + 781C33B11547F06B00633F88 /* OpenAL.framework */, + 781C33B31547F06B00633F88 /* AudioToolbox.framework */, + 781C33B51547F06B00633F88 /* AVFoundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 784521C214EBA449009D533B /* Resources */ = { + isa = PBXGroup; + children = ( + FA0CB8A3168D31EA00E36B11 /* CloseNormal.png */, + FA0CB8A4168D31EA00E36B11 /* CloseSelected.png */, + D4EF94ED15BD319D00D803EB /* Icon-144.png */, + D4EF94EB15BD319B00D803EB /* Icon-72.png */, + D4EF94E915BD319500D803EB /* Icon-114.png */, + D4EF94E715BD319200D803EB /* Icon-57.png */, + D446FD7C161028F4000ADA7B /* Default-568h@2x.png */, + D446FD7A161028ED000ADA7B /* Default@2x.png */, + D446FD78161028E9000ADA7B /* Default.png */, + ); + name = Resources; + path = ../Resources; + sourceTree = ""; + }; + BF5681CC1313A84D0055EEAC /* ios */ = { + isa = PBXGroup; + children = ( + D4ABB4B213B4395300552E6E /* main.m */, + BF365AA612A103F70050DCF4 /* AppController.h */, + BF365AA712A103F70050DCF4 /* AppController.mm */, + BF4DE6AB138BB89600CF907D /* RootViewController.h */, + BF4DE6AC138BB89600CF907D /* RootViewController.mm */, + ); + name = ios; + sourceTree = ""; + }; + FA0CB872168D2F5400E36B11 /* Classes */ = { + isa = PBXGroup; + children = ( + FA0CB873168D2F5400E36B11 /* AppDelegate.cpp */, + FA0CB874168D2F5400E36B11 /* AppDelegate.h */, + FA0CB875168D2F5400E36B11 /* HelloWorldScene.cpp */, + FA0CB876168D2F5400E36B11 /* HelloWorldScene.h */, + ); + name = Classes; + path = ../Classes; + sourceTree = ""; + }; + FA3FC127168D6ADC00F56319 /* Products */ = { + isa = PBXGroup; + children = ( + FA3FC12E168D6ADD00F56319 /* libPluginProtocol.a */, + ); + name = Products; + sourceTree = ""; + }; + FA7C6CEE17251BEA008A0ECC /* Products */ = { + isa = PBXGroup; + children = ( + FA7C6CF517251BEA008A0ECC /* libcocos2dx.a */, + ); + name = Products; + sourceTree = ""; + }; + FA7C6D0117251C10008A0ECC /* Products */ = { + isa = PBXGroup; + children = ( + FA7C6D0817251C10008A0ECC /* libPluginFlurry.a */, + ); + name = Products; + sourceTree = ""; + }; + FA7C6D0A17251C16008A0ECC /* Products */ = { + isa = PBXGroup; + children = ( + FA7C6D1117251C17008A0ECC /* libPluginUmeng.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* HelloAnalytics */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloAnalytics" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + FA7C6D1317251C30008A0ECC /* PBXTargetDependency */, + FA7C6D1517251C30008A0ECC /* PBXTargetDependency */, + FA7C6D1717251C30008A0ECC /* PBXTargetDependency */, + FA3FC130168D6AEB00F56319 /* PBXTargetDependency */, + ); + name = HelloAnalytics; + productName = HelloWorld; + productReference = 1D6058910D05DD3D006BFB54 /* HelloAnalytics.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloAnalytics" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = FA7C6CEE17251BEA008A0ECC /* Products */; + ProjectRef = FA7C6CED17251BEA008A0ECC /* cocos2dx.xcodeproj */; + }, + { + ProductGroup = FA7C6D0117251C10008A0ECC /* Products */; + ProjectRef = FA7C6D0017251C10008A0ECC /* PluginFlurry.xcodeproj */; + }, + { + ProductGroup = FA3FC127168D6ADC00F56319 /* Products */; + ProjectRef = FA3FC126168D6ADC00F56319 /* PluginProtocol.xcodeproj */; + }, + { + ProductGroup = FA7C6D0A17251C16008A0ECC /* Products */; + ProjectRef = FA7C6D0917251C16008A0ECC /* PluginUmeng.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* HelloAnalytics */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + FA3FC12E168D6ADD00F56319 /* libPluginProtocol.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPluginProtocol.a; + remoteRef = FA3FC12D168D6ADD00F56319 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA7C6CF517251BEA008A0ECC /* libcocos2dx.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcocos2dx.a; + remoteRef = FA7C6CF417251BEA008A0ECC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA7C6D0817251C10008A0ECC /* libPluginFlurry.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPluginFlurry.a; + remoteRef = FA7C6D0717251C10008A0ECC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA7C6D1117251C17008A0ECC /* libPluginUmeng.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPluginUmeng.a; + remoteRef = FA7C6D1017251C17008A0ECC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D4EF94E815BD319200D803EB /* Icon-57.png in Resources */, + D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */, + D4EF94EC15BD319B00D803EB /* Icon-72.png in Resources */, + D4EF94EE15BD319D00D803EB /* Icon-144.png in Resources */, + D446FD79161028E9000ADA7B /* Default.png in Resources */, + D446FD7B161028ED000ADA7B /* Default@2x.png in Resources */, + D446FD7D161028F4000ADA7B /* Default-568h@2x.png in Resources */, + FA0CB8A6168D31EA00E36B11 /* CloseNormal.png in Resources */, + FA0CB8A7168D31EA00E36B11 /* CloseSelected.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BF365AA812A103F70050DCF4 /* AppController.mm in Sources */, + BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */, + D4ABB4B313B4395300552E6E /* main.m in Sources */, + FA0CB877168D2F5400E36B11 /* AppDelegate.cpp in Sources */, + FA0CB878168D2F5400E36B11 /* HelloWorldScene.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + FA3FC130168D6AEB00F56319 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = PluginProtocol; + targetProxy = FA3FC12F168D6AEB00F56319 /* PBXContainerItemProxy */; + }; + FA7C6D1317251C30008A0ECC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = PluginFlurry; + targetProxy = FA7C6D1217251C30008A0ECC /* PBXContainerItemProxy */; + }; + FA7C6D1517251C30008A0ECC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = PluginUmeng; + targetProxy = FA7C6D1417251C30008A0ECC /* PBXContainerItemProxy */; + }; + FA7C6D1717251C30008A0ECC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = cocos2dx; + targetProxy = FA7C6D1617251C30008A0ECC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = HelloAnalytics_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_FILE32API, + CC_TARGET_OS_IPHONE, + "COCOS2D_DEBUG=1", + ); + GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + HEADER_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/include/libxml2/\"", + "\"$(SRCROOT)/../../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../../cocos2dx\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk\"", + "\"$(SRCROOT)/../../../protocols/include\"", + "\"$(SRCROOT)/../../../plugins/flurry/include\"", + "\"$(SRCROOT)/../../../plugins/umeng/include\"", + ); + INFOPLIST_FILE = "HelloAnalytics-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../plugins/flurry/platform/ios\"", + "\"$(SRCROOT)/../../../plugins/umeng/platform/ios\"", + ); + "OTHER_LDFLAGS[arch=*]" = "-ObjC"; + PRODUCT_NAME = HelloAnalytics; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = HelloAnalytics_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_FILE32API, + CC_TARGET_OS_IPHONE, + ); + GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + HEADER_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/include/libxml2/\"", + "\"$(SRCROOT)/../../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../../cocos2dx\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk\"", + "\"$(SRCROOT)/../../../protocols/include\"", + "\"$(SRCROOT)/../../../plugins/flurry/include\"", + "\"$(SRCROOT)/../../../plugins/umeng/include\"", + ); + INFOPLIST_FILE = "HelloAnalytics-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../plugins/flurry/platform/ios\"", + "\"$(SRCROOT)/../../../plugins/umeng/platform/ios\"", + ); + "OTHER_LDFLAGS[arch=*]" = "-ObjC"; + PRODUCT_NAME = HelloAnalytics; + PROVISIONING_PROFILE = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + "INFOPLIST_PREFIX_HEADER[sdk=*]" = ""; + SDKROOT = iphoneos; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloAnalytics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloAnalytics" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics_Prefix.pch b/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics_Prefix.pch new file mode 100755 index 0000000000..b8914281d2 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/HelloAnalytics_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'HelloWorld' target in the 'HelloWorld' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/plugin/samples/HelloAnalytics/proj.ios/RootViewController.h b/plugin/samples/HelloAnalytics/proj.ios/RootViewController.h new file mode 100755 index 0000000000..a40c2edd28 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/RootViewController.h @@ -0,0 +1,33 @@ +/**************************************************************************** + Copyright (c) 2010-2011 cocos2d-x.org + Copyright (c) 2010 Ricardo Quesada + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import + + +@interface RootViewController : UIViewController { + +} + +@end diff --git a/plugin/samples/HelloAnalytics/proj.ios/RootViewController.mm b/plugin/samples/HelloAnalytics/proj.ios/RootViewController.mm new file mode 100755 index 0000000000..ae2156e3f0 --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/RootViewController.mm @@ -0,0 +1,94 @@ +/**************************************************************************** + Copyright (c) 2010-2011 cocos2d-x.org + Copyright (c) 2010 Ricardo Quesada + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#import "RootViewController.h" + + +@implementation RootViewController + +/* + // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { + // Custom initialization + } + return self; +} +*/ + +/* +// Implement loadView to create a view hierarchy programmatically, without using a nib. +- (void)loadView { +} +*/ + +/* +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad { + [super viewDidLoad]; +} + +*/ +// Override to allow orientations other than the default portrait orientation. +// This method is deprecated on ios6 +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return UIInterfaceOrientationIsPortrait( interfaceOrientation ); +} + +// For ios6.0 and higher, use supportedInterfaceOrientations & shouldAutorotate instead +- (NSUInteger) supportedInterfaceOrientations +{ +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif +} + +- (BOOL) shouldAutorotate { + return YES; +} + + + + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/plugin/samples/HelloAnalytics/proj.ios/main.m b/plugin/samples/HelloAnalytics/proj.ios/main.m new file mode 100755 index 0000000000..bd2771a33d --- /dev/null +++ b/plugin/samples/HelloAnalytics/proj.ios/main.m @@ -0,0 +1,33 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); + [pool release]; + return retVal; +} diff --git a/plugin/samples/HelloIAP-JS/Classes/AppDelegate.cpp b/plugin/samples/HelloIAP-JS/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..03c29644b9 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Classes/AppDelegate.cpp @@ -0,0 +1,76 @@ +#include "AppDelegate.h" + +#include "cocos2d.h" +#include "SimpleAudioEngine.h" +#include "ScriptingCore.h" +#include "generated/jsb_cocos2dx_auto.hpp" +#include "generated/jsb_cocos2dx_extension_auto.hpp" +#include "cocos2d_specifics.hpp" +#include "js_bindings_chipmunk_registration.h" +#include "js_bindings_system_registration.h" +#include "js_bindings_ccbreader.h" +#include "jsb_opengl_registration.h" + +#include "jsb_pluginx_protocols_auto.hpp" +#include "jsb_pluginx_extension_registration.h" + +USING_NS_CC; +using namespace CocosDenshion; + +AppDelegate::AppDelegate() +{ +} + +AppDelegate::~AppDelegate() +{ + CCScriptEngineManager::sharedManager()->purgeSharedManager(); +} + +bool AppDelegate::applicationDidFinishLaunching() +{ + // initialize director + CCDirector *pDirector = CCDirector::sharedDirector(); + pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + + // turn on display FPS + pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + + ScriptingCore* sc = ScriptingCore::getInstance(); + + sc->addRegisterCallback(register_all_cocos2dx); + sc->addRegisterCallback(register_all_cocos2dx_extension); + sc->addRegisterCallback(register_cocos2dx_js_extensions); + sc->addRegisterCallback(jsb_register_chipmunk); + sc->addRegisterCallback(jsb_register_system); + sc->addRegisterCallback(JSB_register_opengl); + + sc->addRegisterCallback(register_all_pluginx_protocols); + sc->addRegisterCallback(register_pluginx_js_extensions); + + sc->start(); + + CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance(); + CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); + ScriptingCore::getInstance()->runScript("main.js"); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() +{ + CCDirector::sharedDirector()->stopAnimation(); + SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + SimpleAudioEngine::sharedEngine()->pauseAllEffects(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() +{ + CCDirector::sharedDirector()->startAnimation(); + SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); + SimpleAudioEngine::sharedEngine()->resumeAllEffects(); +} diff --git a/samples/Javascript/CocosPlayer/Classes/AppDelegate.h b/plugin/samples/HelloIAP-JS/Classes/AppDelegate.h similarity index 91% rename from samples/Javascript/CocosPlayer/Classes/AppDelegate.h rename to plugin/samples/HelloIAP-JS/Classes/AppDelegate.h index 1f4d5439a0..6bd9363493 100644 --- a/samples/Javascript/CocosPlayer/Classes/AppDelegate.h +++ b/plugin/samples/HelloIAP-JS/Classes/AppDelegate.h @@ -15,8 +15,6 @@ The reason for implement as private inheritance is to hide some interface call by CCDirector. */ - - class AppDelegate : private cocos2d::CCApplication { public: @@ -41,13 +39,7 @@ public: @param the pointer of the application */ virtual void applicationWillEnterForeground(); - }; - -void handle_ccb_run(); -void handle_ccb_stop(); -void handle_connected(); -void handle_disconnected(); #endif // _APP_DELEGATE_H_ diff --git a/plugin/samples/HelloIAP-JS/Resources/alipay_plugin.apk.REMOVED.git-id b/plugin/samples/HelloIAP-JS/Resources/alipay_plugin.apk.REMOVED.git-id new file mode 100644 index 0000000000..e7115f0d77 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Resources/alipay_plugin.apk.REMOVED.git-id @@ -0,0 +1 @@ +db46ceaf2554c8d9e48cdaec3a4cdf5519bb8896 \ No newline at end of file diff --git a/plugin/samples/HelloIAP-JS/Resources/main.js b/plugin/samples/HelloIAP-JS/Resources/main.js new file mode 100644 index 0000000000..c2bc0ff739 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Resources/main.js @@ -0,0 +1,53 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + + http://www.cocos2d-x.org + + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +// boot code needed for cocos2d + JS bindings. +// Not needed by cocos2d-html5 + +require("jsb.js"); + +var appFiles = [ + 'src/resource.js', + 'src/myApp.js' +]; + +cc.dumpConfig(); + +for( var i=0; i < appFiles.length; i++) { + require( appFiles[i] ); +} + +var director = cc.Director.getInstance(); +director.setDisplayStats(true); + +// set FPS. the default value is 1.0/60 if you don't call this +director.setAnimationInterval(1.0 / 60); + +// create a scene. it's an autorelease object +var myScene = new MyScene(); + +// run +director.runWithScene(myScene); + diff --git a/plugin/samples/HelloIAP-JS/Resources/res/background.png.REMOVED.git-id b/plugin/samples/HelloIAP-JS/Resources/res/background.png.REMOVED.git-id new file mode 100644 index 0000000000..15b10523a1 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Resources/res/background.png.REMOVED.git-id @@ -0,0 +1 @@ +b2e4ae6ce873ef4a74cf0230693ef26e939d2778 \ No newline at end of file diff --git a/plugin/samples/HelloIAP-JS/Resources/src/myApp.js b/plugin/samples/HelloIAP-JS/Resources/src/myApp.js new file mode 100644 index 0000000000..d07074d36d --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Resources/src/myApp.js @@ -0,0 +1,235 @@ +/**************************************************************************** + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2008-2010 Ricardo Quesada + Copyright (c) 2011 Zynga Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +eNoneMode = 0; +eAlipay = 1; +eND91 = 2; + + +var __iapInstance = null; + +var MyPurchase = cc.Class.extend({ + _pAlipay: null, + _pRetListener: null, + _pNd91: null, + + loadIAPPlugin: function() { + + // init alipay plugin + this._pAlipay = plugin.PluginManager.getInstance().loadPlugin("IAPAlipay"); + var pAlipayInfo = {}; + + if (Object.keys(pAlipayInfo).length == 0) + { + cc.log("Alipay Warning: Developer info is empty. PLZ fill your alipay info to pAlipayInfo)"); + } + + this._pAlipay.setDebugMode(true); + this._pAlipay.configDeveloperInfo(pAlipayInfo); + this._pAlipay.setResultListener(this); + + var pNdInfo = {}; + pNdInfo["Nd91AppId"] = "100010"; + pNdInfo["Nd91AppKey"] = "C28454605B9312157C2F76F27A9BCA2349434E546A6E9C75"; + pNdInfo["Nd91Orientation"] = "landscape"; + if (Object.keys(pNdInfo).length == 0) { + cc.log("Nd91 Warning: Developer info is empty. PLZ fill your alipay info to pAlipayInfo)"); + } + this._pNd91 = plugin.PluginManager.getInstance().loadPlugin("IAPNd91"); + this._pNd91.setDebugMode(true); + this._pNd91.configDeveloperInfo(pNdInfo); + this._pNd91.setResultListener(this); + }, + + unloadIAPPlugin: function() { + if (this._pAlipay) + { + plugin.PluginManager.getInstance().unloadPlugin("IAPAlipay"); + this._pAlipay = null; + } + + if (this._pNd91) + { + plugin.PluginManager.getInstance().unloadPlugin("IAPNd91"); + this._pNd91 = null; + } + }, + + payByMode:function(info, mode) { + var pIAP = null; + switch(mode) + { + case eAlipay: + pIAP = this._pAlipay; + break; + case eND91: + pIAP = this._pNd91; + break; + default: + break; + } + + if (pIAP) { + pIAP.payForProduct(info); + } + }, + + onPayResult: function(ret, msg, productInfo) { + cc.log("---------onPayResult callback begin-----------------"); + cc.log("onPayResult="+ ret + ";msg=" +msg + ";productinfo="+productInfo); + cc.log("---------onPayResult callback end-----------------"); + }, +}); + +MyPurchase.getInstance = function() { + if (__iapInstance == null) { + __iapInstance = new MyPurchase(); + } + return __iapInstance; +} + +TAG_PAY_BY_ALIPAY = 100; +TAG_PAY_BY_ND91 = 101; + +var _EventMenuItem = [ + {id: "BtnAlipay.png", tag: TAG_PAY_BY_ALIPAY}, + {id: "BtnND91.png", tag: TAG_PAY_BY_ND91} +]; + +var IAPTestLayer = cc.Layer.extend({ + + ctor:function() { + this._super(); + cc.associateWithNative( this, cc.Layer ); + }, + + menuCloseCallback: function() { + cc.log("menuCloseCallback"); + __jsc__.garbageCollect(); + }, + + eventMenuCallback: function(pSender) { + var pMenuItem = pSender; + var pInfo = {}; + var mode = 0; + + switch (pMenuItem.getTag()) + { + case TAG_PAY_BY_ALIPAY: + pInfo["productName"] = "100金币"; + pInfo["productPrice"] = "0.1"; + pInfo["productDesc"] = "100个金灿灿的游戏币哦"; + mode = eAlipay; + break; + case TAG_PAY_BY_ND91: + pInfo["productName"] = "100金币"; + pInfo["productPrice"] = "0.01"; + pInfo["productDesc"] = "100个金灿灿的游戏币哦"; + pInfo["Nd91ProductId"] = "685994"; + mode = eND91; + break; + default: + break; + } + cc.log("eventMenuCallback, item tag = "+pMenuItem.getTag()); + MyPurchase.getInstance().payByMode(pInfo, mode); + }, + + reloadPluginMenuCallback: function() { + MyPurchase.getInstance().unloadIAPPlugin(); + MyPurchase.getInstance().loadIAPPlugin(); + cc.log("reloadPluginMenuCallback"); + }, + + onEnter:function () { + this._super(); + MyPurchase.getInstance().loadIAPPlugin(); + + var director = cc.Director.getInstance(); + var size = director.getWinSize(); + + var background = cc.Sprite.create("res/background.png"); + background.setPosition(cc.p(size.width / 2, size.height / 2)); + this.addChild(background); + + var posBR = cc.p(director.getVisibleOrigin().x + director.getVisibleSize().width, director.getVisibleOrigin().y); + var posTL = cc.p(director.getVisibleOrigin().x, director.getVisibleOrigin().y + director.getVisibleSize().height); + + var pCloseItem = cc.MenuItemImage.create( + "res/CloseNormal.png", + "res/CloseSelected.png", + this.menuCloseCallback, + this ); + pCloseItem.setPosition( cc.p(posBR.x - 20, posBR.y + 20) ); + + // create menu, it's an autorelease object + var pMenu = cc.Menu.create(pCloseItem); + pMenu.setPosition( cc.p(0, 0) ); + this.addChild(pMenu, 1); + + var posStep = cc.p(220, -150); + var beginPos = cc.pAdd(posTL, cc.pMult(posStep, 0.5)); + var line = 0; + var row = 0; + for (var i = 0; i < _EventMenuItem.length; i++) { + var pMenuItem = cc.MenuItemImage.create(_EventMenuItem[i].id, _EventMenuItem[i].id, + this.eventMenuCallback, this); + + pMenu.addChild(pMenuItem, 0, _EventMenuItem[i].tag); + + var pos = cc.pAdd(beginPos, cc.p(posStep.x * row, posStep.y * line)); + var itemSize = pMenuItem.getContentSize(); + if ((pos.x + itemSize.width / 2) > posBR.x) + { + line += 1; + row = 0; + pos = cc.pAdd(beginPos, cc.p(posStep.x * row, posStep.y * line)); + } + row += 1; + pMenuItem.setPosition(pos); + } + + var label = cc.LabelTTF.create("reload all plugins", "Arial", 24); + var pMenuItem = cc.MenuItemLabel.create(label, this.reloadPluginMenuCallback, this); + pMenuItem.setAnchorPoint(cc.p(0.5, 0)); + pMenu.addChild(pMenuItem, 0); + pMenuItem.setPosition( cc.p(size.width / 2, 0)); + }, +}); + +var MyScene = cc.Scene.extend({ + ctor:function() { + this._super(); + cc.associateWithNative( this, cc.Scene ); + }, + + onEnter:function () { + this._super(); + var layer = new IAPTestLayer(); + layer.init(); + this.addChild(layer); + } +}); diff --git a/plugin/samples/HelloIAP-JS/Resources/src/resource.js b/plugin/samples/HelloIAP-JS/Resources/src/resource.js new file mode 100644 index 0000000000..145f7ac6ab --- /dev/null +++ b/plugin/samples/HelloIAP-JS/Resources/src/resource.js @@ -0,0 +1,20 @@ +var s_HelloWorld = "res/HelloWorld.png"; +var s_CloseNormal = "res/CloseNormal.png"; +var s_CloseSelected = "res/CloseSelected.png"; + +var g_ressources = [ + //image + {src:s_HelloWorld}, + {src:s_CloseNormal}, + {src:s_CloseSelected} + + //plist + + //fnt + + //tmx + + //bgm + + //effect +]; \ No newline at end of file diff --git a/plugin/samples/HelloIAP-JS/proj.android/.classpath b/plugin/samples/HelloIAP-JS/proj.android/.classpath new file mode 100755 index 0000000000..2519c88ef3 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP-JS/proj.android/.project b/plugin/samples/HelloIAP-JS/proj.android/.project new file mode 100755 index 0000000000..c595f90f43 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/.project @@ -0,0 +1,45 @@ + + + HelloIAP-JS + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + publish + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/plugin/samples/HelloIAP-JS/proj.android/AndroidManifest.xml b/plugin/samples/HelloIAP-JS/proj.android/AndroidManifest.xml new file mode 100755 index 0000000000..3c1db3bc21 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/AndroidManifest.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP-JS/proj.android/ant.properties b/plugin/samples/HelloIAP-JS/proj.android/ant.properties new file mode 100755 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloIAP-JS/proj.android/build.xml b/plugin/samples/HelloIAP-JS/proj.android/build.xml new file mode 100755 index 0000000000..80abad0ab0 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP-JS/proj.android/build_native.sh b/plugin/samples/HelloIAP-JS/proj.android/build_native.sh new file mode 100755 index 0000000000..2cdd8693a5 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/build_native.sh @@ -0,0 +1,85 @@ +APPNAME="HelloIAP-JS" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" +BINDINGS_JS_ROOT="$COCOS2DX_ROOT/scripting/javascript/bindings/js" + +echo "PLUGIN_ROOT = $PLUGIN_ROOT" +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "---------------------------------------------------------" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +# copy bindings/*.js into assets' root +cp -f "$BINDINGS_JS_ROOT"/* "$APP_ANDROID_ROOT"/assets + +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloIAP-JS/proj.android/jni/Android.mk b/plugin/samples/HelloIAP-JS/proj.android/jni/Android.mk new file mode 100644 index 0000000000..89a943463f --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/jni/Android.mk @@ -0,0 +1,39 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := game_shared + +LOCAL_MODULE_FILENAME := libgame + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../../../jsbindings/auto/jsb_pluginx_protocols_auto.cpp \ + ../../../../jsbindings/manual/pluginxUTF8.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_basic_conversions.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_manual_protocols.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_manual_callback.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_extension_registration.cpp \ + ../../../../jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \ + $(LOCAL_PATH)/../../../../jsbindings \ + $(LOCAL_PATH)/../../../../jsbindings/auto \ + $(LOCAL_PATH)/../../../../jsbindings/manual + +LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \ + PluginProtocolStatic + +LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static +LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static +LOCAL_WHOLE_STATIC_LIBRARIES += spidermonkey_static +LOCAL_WHOLE_STATIC_LIBRARIES += scriptingcore-spidermonkey + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) +$(call import-module,CocosDenshion/android) +$(call import-module,external/chipmunk) +$(call import-module,scripting/javascript/spidermonkey-android) +$(call import-module,scripting/javascript/bindings) +$(call import-module,protocols/android) diff --git a/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk new file mode 100755 index 0000000000..a1f26bfc9c --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk @@ -0,0 +1,3 @@ +APP_STL := gnustl_static +APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 +APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 \ No newline at end of file diff --git a/plugin/samples/HelloIAP-JS/proj.android/jni/hellocpp/main.cpp b/plugin/samples/HelloIAP-JS/proj.android/jni/hellocpp/main.cpp new file mode 100755 index 0000000000..861d869406 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,47 @@ +#include "AppDelegate.h" +#include "platform/android/jni/JniHelper.h" +#include "PluginJniHelper.h" +#include +#include + +#include "cocos2d.h" + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +extern "C" +{ + +jint JNI_OnLoad(JavaVM *vm, void *reserved) +{ + JniHelper::setJavaVM(vm); + PluginJniHelper::setJavaVM(vm); + + return JNI_VERSION_1_4; +} + +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) +{ + if (!CCDirector::sharedDirector()->getOpenGLView()) + { + CCEGLView *view = CCEGLView::sharedOpenGLView(); + view->setFrameSize(w, h); + + AppDelegate *pAppDelegate = new AppDelegate(); + CCApplication::sharedApplication()->run(); + } + else + { + ccDrawInit(); + ccGLInvalidateStateCache(); + + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); + CCTextureCache::reloadAllTextures(); + CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); + CCDirector::sharedDirector()->setGLDefaultValues(); + } +} + +} diff --git a/plugin/samples/HelloIAP-JS/proj.android/proguard-project.txt b/plugin/samples/HelloIAP-JS/proj.android/proguard-project.txt new file mode 100755 index 0000000000..b60ae7ea07 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugin/samples/HelloIAP-JS/proj.android/project.properties b/plugin/samples/HelloIAP-JS/proj.android/project.properties new file mode 100755 index 0000000000..3fa9c97766 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 +android.library.reference.1=../../../../cocos2dx/platform/android/java +android.library.reference.2=../../../publish/plugins/nd91/android/DependProject diff --git a/plugin/samples/HelloIAP-JS/proj.android/res/raw/opening_sound.mid.REMOVED.git-id b/plugin/samples/HelloIAP-JS/proj.android/res/raw/opening_sound.mid.REMOVED.git-id new file mode 100644 index 0000000000..53fd98e9ac --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/res/raw/opening_sound.mid.REMOVED.git-id @@ -0,0 +1 @@ +2d5f8bb9d084146cc4ec009da8b0a53a188d7cd5 \ No newline at end of file diff --git a/plugin/samples/HelloIAP-JS/proj.android/res/values/g_strings.xml b/plugin/samples/HelloIAP-JS/proj.android/res/values/g_strings.xml new file mode 100755 index 0000000000..e6c9d1b3f8 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/res/values/g_strings.xml @@ -0,0 +1,65 @@ + + + + cn.emagsoftware.sdk.example.BillingDemo + + + + + false + false + 中国移动手机游戏 + 感谢您支持正版游戏 + 正在发送激活短信! + 尊敬的{0}用户,您即将购买: + \r\n游戏名称:{0} + 游戏提供商:{0} + 客服电话:{0} + {0} + 共需支付话费{0}元(折合{1}点) + 请点击《确定》发送短信确认购买。 + 请点击《确定》确认购买。 + * 该道具不属于{0}权益,您可以选择取消购买并免费继续游戏,或确认购买该道具以获得更好的游戏体验。 + 网络连接失败!\r\n尊敬的用户,您正在使用中国移动{0}业务中的游戏,需要通过移动网络进行订购关系验证,如果您是中国移动{0}的订购用户,将可免费使用该游戏,如果不是,则需要付费后方可继续使用,请检查您的移动网络是否可用! + 付费成功! + 已付费成功! + 您的付费操作失败了,请稍后重试! + 不进行付费,您将无法获得更好的游戏体验,是否确认?\r\n\r\n点击《不购买》不进行付费,点击《返回》回到付费界面 + 短信激活失败,请检查SIM卡! + 没有可用中国移动SIM卡! + 找不到可用网络,请检查您当前的网络设置! + 当前设备处于飞行模式,无可用网络! + 当前设备存在重复网络,无可用网络! + 此游戏没有配置中国移动标识信息,不能继续使用! + 正在处理付费请求... + 请输入有效的手机号码! + 您的计费请求失败啦,请尝试输入手机号码进行计费! + 短信验证码获取失败 + 未找到计费信息! + 请输入您收到的短信验证码! + 未找到手机号码,请重试! + 感谢您支持正版游戏 + 游戏付费确认 + 您需要输入手机号码,以获取短信验证码,在进入确认界面输入正确验证码之前,不会产生费用。 + 短信验证码: + 请在确认游戏付费前,正确输入您手机上收到的随机短信验证码。 + 短信验证码在5分钟内有效,超过时间内仍未收到验证码,建议您稍后重试。 + 手机号码:(请输入正确的{0}) + 移动手机号码 + 您的付费请求太频繁,请稍后重试! + 好友代付 + 没有找到联系人,您可以手动输入付费手机号码 + + +  确定  +  取消  +  继续  +  退出  + 提示 + 确定 + 取消 + 不购买 + 继续 + 结束 + 返回 + diff --git a/plugin/samples/HelloIAP-JS/proj.android/res/values/strings.xml b/plugin/samples/HelloIAP-JS/proj.android/res/values/strings.xml new file mode 100755 index 0000000000..a68878525f --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + HelloIAP-JS + diff --git a/plugin/samples/HelloIAP-JS/proj.android/src/org/cocos2dx/helloIAPJS/HelloIAP.java b/plugin/samples/HelloIAP-JS/proj.android/src/org/cocos2dx/helloIAPJS/HelloIAP.java new file mode 100755 index 0000000000..910990d304 --- /dev/null +++ b/plugin/samples/HelloIAP-JS/proj.android/src/org/cocos2dx/helloIAPJS/HelloIAP.java @@ -0,0 +1,43 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.helloIAPJS; + +import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.lib.Cocos2dxGLSurfaceView; +import org.cocos2dx.plugin.PluginWrapper; + +import android.os.Bundle; + +public class HelloIAP extends Cocos2dxActivity{ + + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + PluginWrapper.init(this); + PluginWrapper.setGLSurfaceView(Cocos2dxGLSurfaceView.getInstance()); + } + + static { + System.loadLibrary("game"); + } +} diff --git a/plugin/samples/HelloIAP/Classes/AppDelegate.cpp b/plugin/samples/HelloIAP/Classes/AppDelegate.cpp new file mode 100644 index 0000000000..70b1b98233 --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/AppDelegate.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "AppDelegate.h" +#include "cocos2d.h" +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "MyPurchase.h" + +using namespace cocos2d::plugin; +USING_NS_CC; + +AppDelegate::AppDelegate() +{ + +} + +AppDelegate::~AppDelegate() +{ + +} + +bool AppDelegate::applicationDidFinishLaunching() +{ + MyPurchase::sharedPurchase()->loadIAPPlugin(); + + // initialize director + CCDirector *pDirector = CCDirector::sharedDirector(); + pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + pEGLView->setDesignResolutionSize(960.0f, 640.0f, kResolutionNoBorder); + // turn on display FPS + pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + + // create a scene. it's an autorelease object + CCScene *pScene = HelloWorld::scene(); + + // run + pDirector->runWithScene(pScene); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() +{ + CCDirector::sharedDirector()->pause(); + + // if you use SimpleAudioEngine, it must be pause + // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() +{ + CCDirector::sharedDirector()->resume(); + + // if you use SimpleAudioEngine, it must resume here + // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); +} diff --git a/plugin/samples/HelloIAP/Classes/AppDelegate.h b/plugin/samples/HelloIAP/Classes/AppDelegate.h new file mode 100644 index 0000000000..8be63283dc --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/AppDelegate.h @@ -0,0 +1,62 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "CCApplication.h" + +/** +@brief The cocos2d Application. + +The reason for implement as private inheritance is to hide some interface call by CCDirector. +*/ +class AppDelegate : private cocos2d::CCApplication +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + /** + @brief Implement CCDirector and CCScene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); + + static void loadAnalyticsPlugin(); +}; + +#endif // _APP_DELEGATE_H_ diff --git a/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp b/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp new file mode 100644 index 0000000000..d9fbfaa92a --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp @@ -0,0 +1,154 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "AppDelegate.h" +#include "MyPurchase.h" + +using namespace cocos2d; +using namespace cocos2d::plugin; + +enum { + TAG_PAY_BY_ALIPAY = 100, + TAG_PAY_BY_ND91, +}; + +typedef struct tagEventMenuItem { + std::string id; + int tag; +}EventMenuItem; + +static EventMenuItem s_EventMenuItem[] = { + {"BtnAlipay.png", TAG_PAY_BY_ALIPAY}, + {"BtnND91.png", TAG_PAY_BY_ND91}, +}; + +CCScene* HelloWorld::scene() +{ + // 'scene' is an autorelease object + CCScene *scene = CCScene::create(); + + // 'layer' is an autorelease object + HelloWorld *layer = HelloWorld::create(); + + // add layer as a child to scene + scene->addChild(layer); + + // return the scene + return scene; +} + +// on "init" you need to initialize your instance +bool HelloWorld::init() +{ + ////////////////////////////// + // 1. super init first + if ( !CCLayer::init() ) + { + return false; + } + + CCSize size = CCDirector::sharedDirector()->getWinSize(); + + CCSprite* pBackground = CCSprite::create("background.png"); + pBackground->setPosition(ccp(size.width / 2, size.height / 2)); + addChild(pBackground); + ///////////////////////////// + // 2. add a menu item with "X" image, which is clicked to quit the program + // you may modify it. + + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + CCPoint posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y); + CCPoint posTL = ccp(pEGLView->getVisibleOrigin().x, pEGLView->getVisibleOrigin().y + pEGLView->getVisibleSize().height); + + // add a "close" icon to exit the progress. it's an autorelease object + CCMenuItemImage *pCloseItem = CCMenuItemImage::create( + "CloseNormal.png", + "CloseSelected.png", + this, + menu_selector(HelloWorld::menuCloseCallback) ); + pCloseItem->setPosition( ccp(posBR.x - 20, posBR.y + 20) ); + + // create menu, it's an autorelease object + CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); + pMenu->setPosition( CCPointZero ); + this->addChild(pMenu, 1); + + CCPoint posStep = ccp(220, -150); + CCPoint beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f)); + int line = 0; + int row = 0; + for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) { + CCMenuItemImage* pMenuItem = CCMenuItemImage::create(s_EventMenuItem[i].id.c_str(), s_EventMenuItem[i].id.c_str(), + this, menu_selector(HelloWorld::eventMenuCallback)); + pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag); + + CCPoint pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line)); + CCSize itemSize = pMenuItem->getContentSize(); + if ((pos.x + itemSize.width / 2) > posBR.x) + { + line += 1; + row = 0; + pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line)); + } + row += 1; + pMenuItem->setPosition(pos); + } + + CCLabelTTF* label = CCLabelTTF::create("reload all plugins", "Arial", 24); + CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::reloadPluginMenuCallback)); + pMenuItem->setAnchorPoint(ccp(0.5f, 0)); + pMenu->addChild(pMenuItem, 0); + pMenuItem->setPosition( ccp(size.width / 2, 0)); + + return true; +} + +void HelloWorld::reloadPluginMenuCallback(CCObject* pSender) +{ + MyPurchase::sharedPurchase()->unloadIAPPlugin(); + MyPurchase::sharedPurchase()->loadIAPPlugin(); +} + +void HelloWorld::eventMenuCallback(CCObject* pSender) +{ + CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender; + TProductInfo pInfo; + MyPurchase::MyPayMode mode = (MyPurchase::MyPayMode) (pMenuItem->getTag() - TAG_PAY_BY_ALIPAY + 1); + pInfo["productName"] = "100金币"; + pInfo["productPrice"] = "0.01"; + pInfo["productDesc"] = "100个金灿灿的游戏币哦"; + pInfo["Nd91ProductId"] = "685994"; + MyPurchase::sharedPurchase()->payByMode(pInfo, mode); +} + +void HelloWorld::menuCloseCallback(CCObject* pSender) +{ + MyPurchase::purgePurchase(); + + CCDirector::sharedDirector()->end(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif +} diff --git a/plugin/samples/HelloIAP/Classes/HelloWorldScene.h b/plugin/samples/HelloIAP/Classes/HelloWorldScene.h new file mode 100644 index 0000000000..35352d5970 --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/HelloWorldScene.h @@ -0,0 +1,47 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __HELLOWORLD_SCENE_H__ +#define __HELLOWORLD_SCENE_H__ + +#include "cocos2d.h" + +class HelloWorld : public cocos2d::CCLayer +{ +public: + // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone + virtual bool init(); + + // there's no 'id' in cpp, so we recommand to return the exactly class pointer + static cocos2d::CCScene* scene(); + + // a selector callback + void menuCloseCallback(CCObject* pSender); + void eventMenuCallback(CCObject* pSender); + void reloadPluginMenuCallback(CCObject* pSender); + + // implement the "static node()" method manually + CREATE_FUNC(HelloWorld); +}; + +#endif // __HELLOWORLD_SCENE_H__ diff --git a/plugin/samples/HelloIAP/Classes/MyPurchase.cpp b/plugin/samples/HelloIAP/Classes/MyPurchase.cpp new file mode 100644 index 0000000000..49b7ac858d --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/MyPurchase.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "MyPurchase.h" +#include "PluginManager.h" +#include "cocos2d.h" + +using namespace cocos2d::plugin; +using namespace cocos2d; + +MyPurchase* MyPurchase::s_pPurchase = NULL; + +MyPurchase::MyPurchase() +: s_pAlipay(NULL) +, s_pRetListener(NULL) +, s_pNd91(NULL) +{ + +} + +MyPurchase::~MyPurchase() +{ + unloadIAPPlugin(); + if (s_pRetListener) + { + delete s_pRetListener; + s_pRetListener = NULL; + } +} + +MyPurchase* MyPurchase::sharedPurchase() +{ + if (s_pPurchase == NULL) { + s_pPurchase = new MyPurchase(); + } + return s_pPurchase; +} + +void MyPurchase::purgePurchase() +{ + if (s_pPurchase) + { + delete s_pPurchase; + s_pPurchase = NULL; + } + PluginManager::end(); +} + +void MyPurchase::loadIAPPlugin() +{ + if (s_pRetListener == NULL) + { + s_pRetListener = new MyPurchaseResult(); + } + + { + // init alipay plugin + s_pAlipay = dynamic_cast(PluginManager::getInstance()->loadPlugin("IAPAlipay")); + TIAPDeveloperInfo pAlipayInfo; + if (pAlipayInfo.empty()) + { + char msg[256] = { 0 }; + sprintf(msg, "Developer info is empty. PLZ fill your alipay info in %s(nearby line %d)", __FILE__, __LINE__); + CCMessageBox(msg, "Alipay Warning"); + } + s_pAlipay->setDebugMode(true); + s_pAlipay->configDeveloperInfo(pAlipayInfo); + s_pAlipay->setResultListener(s_pRetListener); + } + + { + TIAPDeveloperInfo pNdInfo; + pNdInfo["Nd91AppId"] = "100010"; + pNdInfo["Nd91AppKey"] = "C28454605B9312157C2F76F27A9BCA2349434E546A6E9C75"; + pNdInfo["Nd91Orientation"] = "landscape"; + if (pNdInfo.empty()) { + char msg[256] = { 0 }; + sprintf(msg, "Developer info is empty. PLZ fill your Nd91 info in %s(nearby line %d)", __FILE__, __LINE__); + CCMessageBox(msg, "Nd91 Warning"); + } + s_pNd91 = dynamic_cast(PluginManager::getInstance()->loadPlugin("IAPNd91")); + s_pNd91->setDebugMode(true); + s_pNd91->configDeveloperInfo(pNdInfo); + s_pNd91->setResultListener(s_pRetListener); + } +} + +void MyPurchase::unloadIAPPlugin() +{ + if (s_pAlipay) + { + PluginManager::getInstance()->unloadPlugin("IAPAlipay"); + s_pAlipay = NULL; + } + + if (s_pNd91) + { + PluginManager::getInstance()->unloadPlugin("IAPNd91"); + s_pNd91 = NULL; + } +} + +void MyPurchase::payByMode(TProductInfo info, MyPayMode mode) +{ + ProtocolIAP* pIAP = NULL; + switch(mode) + { + case eAlipay: + pIAP = s_pAlipay; + break; + case eND91: + pIAP = s_pNd91; + break; + default: + break; + } + + if (pIAP) { + pIAP->payForProduct(info); + } +} + +void MyPurchaseResult::onPayResult(PayResultCode ret, const char* msg, TProductInfo info) +{ + char goodInfo[1024] = { 0 }; + sprintf(goodInfo, "商品名称:%s\n商品价格:%s\n商品描述:%s", + info.find("productName")->second.c_str(), + info.find("productPrice")->second.c_str(), + info.find("productDesc")->second.c_str()); + CCMessageBox(goodInfo , msg); +} diff --git a/plugin/samples/HelloIAP/Classes/MyPurchase.h b/plugin/samples/HelloIAP/Classes/MyPurchase.h new file mode 100644 index 0000000000..a5d2048864 --- /dev/null +++ b/plugin/samples/HelloIAP/Classes/MyPurchase.h @@ -0,0 +1,62 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __MY_PURCHASE_H__ +#define __MY_PURCHASE_H__ + +#include "ProtocolIAP.h" + +class MyPurchaseResult : public cocos2d::plugin::PayResultListener +{ +public: + virtual void onPayResult(cocos2d::plugin::PayResultCode ret, const char* msg, cocos2d::plugin::TProductInfo info); +}; + +class MyPurchase +{ +public: + static MyPurchase* sharedPurchase(); + static void purgePurchase(); + + typedef enum { + eNoneMode = 0, + eAlipay, + eND91, + } MyPayMode; + + void unloadIAPPlugin(); + void loadIAPPlugin(); + void payByMode(cocos2d::plugin::TProductInfo info, MyPayMode mode); + +private: + MyPurchase(); + virtual ~MyPurchase(); + + static MyPurchase* s_pPurchase; + + cocos2d::plugin::ProtocolIAP* s_pAlipay; + cocos2d::plugin::ProtocolIAP* s_pNd91; + MyPurchaseResult* s_pRetListener; +}; + +#endif // __MY_PURCHASE_H__ diff --git a/plugin/samples/HelloIAP/Resources/alipay_plugin.apk.REMOVED.git-id b/plugin/samples/HelloIAP/Resources/alipay_plugin.apk.REMOVED.git-id new file mode 100644 index 0000000000..e7115f0d77 --- /dev/null +++ b/plugin/samples/HelloIAP/Resources/alipay_plugin.apk.REMOVED.git-id @@ -0,0 +1 @@ +db46ceaf2554c8d9e48cdaec3a4cdf5519bb8896 \ No newline at end of file diff --git a/plugin/samples/HelloIAP/Resources/background.png.REMOVED.git-id b/plugin/samples/HelloIAP/Resources/background.png.REMOVED.git-id new file mode 100644 index 0000000000..15b10523a1 --- /dev/null +++ b/plugin/samples/HelloIAP/Resources/background.png.REMOVED.git-id @@ -0,0 +1 @@ +b2e4ae6ce873ef4a74cf0230693ef26e939d2778 \ No newline at end of file diff --git a/plugin/samples/HelloIAP/proj.android/.classpath b/plugin/samples/HelloIAP/proj.android/.classpath new file mode 100644 index 0000000000..2519c88ef3 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP/proj.android/.project b/plugin/samples/HelloIAP/proj.android/.project new file mode 100644 index 0000000000..7bae797dfe --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/.project @@ -0,0 +1,45 @@ + + + HelloIAP + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + publish + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/plugin/samples/HelloIAP/proj.android/AndroidManifest.xml b/plugin/samples/HelloIAP/proj.android/AndroidManifest.xml new file mode 100644 index 0000000000..c6fb07ce2a --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/AndroidManifest.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP/proj.android/ant.properties b/plugin/samples/HelloIAP/proj.android/ant.properties new file mode 100644 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloIAP/proj.android/build.xml b/plugin/samples/HelloIAP/proj.android/build.xml new file mode 100644 index 0000000000..80abad0ab0 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloIAP/proj.android/build_native.sh b/plugin/samples/HelloIAP/proj.android/build_native.sh new file mode 100755 index 0000000000..7b388a1442 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/build_native.sh @@ -0,0 +1,81 @@ +APPNAME="HelloAnalytics" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" + +echo "PLUGIN_ROOT = $PLUGIN_ROOT" +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "---------------------------------------------------------" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + set -x + "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloIAP/proj.android/jni/Android.mk b/plugin/samples/HelloIAP/proj.android/jni/Android.mk new file mode 100644 index 0000000000..a51de9683d --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/jni/Android.mk @@ -0,0 +1,22 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := game_shared + +LOCAL_MODULE_FILENAME := libgame + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../Classes/HelloWorldScene.cpp \ + ../../Classes/MyPurchase.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes + +LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \ + PluginProtocolStatic + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) \ +$(call import-module,protocols/android) diff --git a/plugin/samples/HelloIAP/proj.android/jni/Application.mk b/plugin/samples/HelloIAP/proj.android/jni/Application.mk new file mode 100644 index 0000000000..d16d4facd2 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_CPPFLAGS += -frtti \ No newline at end of file diff --git a/plugin/samples/HelloIAP/proj.android/jni/hellocpp/main.cpp b/plugin/samples/HelloIAP/proj.android/jni/hellocpp/main.cpp new file mode 100644 index 0000000000..c10543c193 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "AppDelegate.h" +#include "platform/android/jni/JniHelper.h" +#include "PluginJniHelper.h" +#include +#include + +#include "HelloWorldScene.h" + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +extern "C" +{ + +jint JNI_OnLoad(JavaVM *vm, void *reserved) +{ + JniHelper::setJavaVM(vm); + PluginJniHelper::setJavaVM(vm); + + return JNI_VERSION_1_4; +} + +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) +{ + if (!CCDirector::sharedDirector()->getOpenGLView()) + { + CCEGLView *view = CCEGLView::sharedOpenGLView(); + view->setFrameSize(w, h); + + AppDelegate *pAppDelegate = new AppDelegate(); + CCApplication::sharedApplication()->run(); + } + else + { + ccDrawInit(); + ccGLInvalidateStateCache(); + + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); + CCTextureCache::reloadAllTextures(); + CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); + CCDirector::sharedDirector()->setGLDefaultValues(); + } +} + +} diff --git a/plugin/samples/HelloIAP/proj.android/proguard-project.txt b/plugin/samples/HelloIAP/proj.android/proguard-project.txt new file mode 100644 index 0000000000..b60ae7ea07 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugin/samples/HelloIAP/proj.android/project.properties b/plugin/samples/HelloIAP/proj.android/project.properties new file mode 100644 index 0000000000..3fa9c97766 --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/project.properties @@ -0,0 +1,16 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 +android.library.reference.1=../../../../cocos2dx/platform/android/java +android.library.reference.2=../../../publish/plugins/nd91/android/DependProject diff --git a/plugin/samples/HelloIAP/proj.android/res/values/strings.xml b/plugin/samples/HelloIAP/proj.android/res/values/strings.xml new file mode 100644 index 0000000000..1827f14e1a --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + HelloIAP + diff --git a/plugin/samples/HelloIAP/proj.android/src/org/cocos2dx/helloIAP/HelloIAP.java b/plugin/samples/HelloIAP/proj.android/src/org/cocos2dx/helloIAP/HelloIAP.java new file mode 100644 index 0000000000..f13450365d --- /dev/null +++ b/plugin/samples/HelloIAP/proj.android/src/org/cocos2dx/helloIAP/HelloIAP.java @@ -0,0 +1,43 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.helloIAP; + +import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.lib.Cocos2dxGLSurfaceView; +import org.cocos2dx.plugin.PluginWrapper; + +import android.os.Bundle; + +public class HelloIAP extends Cocos2dxActivity{ + + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + PluginWrapper.init(this); + PluginWrapper.setGLSurfaceView(Cocos2dxGLSurfaceView.getInstance()); + } + + static { + System.loadLibrary("game"); + } +} diff --git a/plugin/samples/HelloSocial/Classes/AppDelegate.cpp b/plugin/samples/HelloSocial/Classes/AppDelegate.cpp new file mode 100755 index 0000000000..69c643a5a1 --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/AppDelegate.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "AppDelegate.h" +#include "cocos2d.h" +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "MySocialManager.h" + +using namespace cocos2d::plugin; +USING_NS_CC; + +AppDelegate::AppDelegate() +{ + +} + +AppDelegate::~AppDelegate() +{ + +} + +bool AppDelegate::applicationDidFinishLaunching() +{ + MySocialManager::sharedSocialManager()->loadSocialPlugin(); + + // initialize director + CCDirector *pDirector = CCDirector::sharedDirector(); + pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + pEGLView->setDesignResolutionSize(960.0f, 640.0f, kResolutionNoBorder); + // turn on display FPS + pDirector->setDisplayStats(true); + + // set FPS. the default value is 1.0/60 if you don't call this + pDirector->setAnimationInterval(1.0 / 60); + + // create a scene. it's an autorelease object + CCScene *pScene = HelloWorld::scene(); + + // run + pDirector->runWithScene(pScene); + + return true; +} + +// This function will be called when the app is inactive. When comes a phone call,it's be invoked too +void AppDelegate::applicationDidEnterBackground() +{ + CCDirector::sharedDirector()->pause(); + + // if you use SimpleAudioEngine, it must be pause + // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); +} + +// this function will be called when the app is active again +void AppDelegate::applicationWillEnterForeground() +{ + CCDirector::sharedDirector()->resume(); + + // if you use SimpleAudioEngine, it must resume here + // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); +} diff --git a/plugin/samples/HelloSocial/Classes/AppDelegate.h b/plugin/samples/HelloSocial/Classes/AppDelegate.h new file mode 100755 index 0000000000..cb6c1f28dd --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/AppDelegate.h @@ -0,0 +1,63 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef _APP_DELEGATE_H_ +#define _APP_DELEGATE_H_ + +#include "CCApplication.h" + +/** +@brief The cocos2d Application. + +The reason for implement as private inheritance is to hide some interface call by CCDirector. +*/ +class AppDelegate : private cocos2d::CCApplication +{ +public: + AppDelegate(); + virtual ~AppDelegate(); + + /** + @brief Implement CCDirector and CCScene init code here. + @return true Initialize success, app continue. + @return false Initialize failed, app terminate. + */ + virtual bool applicationDidFinishLaunching(); + + /** + @brief The function be called when the application enter background + @param the pointer of the application + */ + virtual void applicationDidEnterBackground(); + + /** + @brief The function be called when the application enter foreground + @param the pointer of the application + */ + virtual void applicationWillEnterForeground(); + + static void loadAnalyticsPlugin(); +}; + +#endif // _APP_DELEGATE_H_ + diff --git a/plugin/samples/HelloSocial/Classes/HelloWorldScene.cpp b/plugin/samples/HelloSocial/Classes/HelloWorldScene.cpp new file mode 100755 index 0000000000..4352995364 --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/HelloWorldScene.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "HelloWorldScene.h" +#include "PluginManager.h" +#include "AppDelegate.h" +#include "MySocialManager.h" + +using namespace cocos2d; +using namespace cocos2d::plugin; + +enum { + TAG_SHARE_BY_TWWITER = 100, + TAG_SHARE_BY_WEIBO = 101, +}; + +typedef struct tagEventMenuItem { + std::string id; + int tag; +}EventMenuItem; + +static EventMenuItem s_EventMenuItem[] = { + {"twitter.jpeg", TAG_SHARE_BY_TWWITER}, + {"weibo.png", TAG_SHARE_BY_WEIBO} +}; + +CCScene* HelloWorld::scene() +{ + // 'scene' is an autorelease object + CCScene *scene = CCScene::create(); + + // 'layer' is an autorelease object + HelloWorld *layer = HelloWorld::create(); + + // add layer as a child to scene + scene->addChild(layer); + + // return the scene + return scene; +} + +// on "init" you need to initialize your instance +bool HelloWorld::init() +{ + ////////////////////////////// + // 1. super init first + if ( !CCLayer::init() ) + { + return false; + } + + CCSize size = CCDirector::sharedDirector()->getVisibleSize(); + + CCSprite* pBackground = CCSprite::create("background.png"); + pBackground->setPosition(ccp(size.width / 2, size.height / 2)); + addChild(pBackground); + ///////////////////////////// + // 2. add a menu item with "X" image, which is clicked to quit the program + // you may modify it. + + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + CCPoint posBR = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width, pEGLView->getVisibleOrigin().y); + CCPoint posBC = ccp(pEGLView->getVisibleOrigin().x + pEGLView->getVisibleSize().width/2, pEGLView->getVisibleOrigin().y); + CCPoint posTL = ccp(pEGLView->getVisibleOrigin().x, pEGLView->getVisibleOrigin().y + pEGLView->getVisibleSize().height); + + // add a "close" icon to exit the progress. it's an autorelease object + CCMenuItemImage *pCloseItem = CCMenuItemImage::create( + "CloseNormal.png", + "CloseSelected.png", + this, + menu_selector(HelloWorld::menuCloseCallback) ); + pCloseItem->setPosition( ccp(posBR.x - 20, posBR.y + 20) ); + + // create menu, it's an autorelease object + CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); + pMenu->setPosition( CCPointZero ); + this->addChild(pMenu, 1); + + CCPoint posStep = ccp(150, -150); + CCPoint beginPos = ccpAdd(posTL, ccpMult(posStep, 0.5f)); + int line = 0; + int row = 0; + for (int i = 0; i < sizeof(s_EventMenuItem)/sizeof(s_EventMenuItem[0]); i++) { + CCMenuItemImage* pMenuItem = CCMenuItemImage::create(s_EventMenuItem[i].id.c_str(), s_EventMenuItem[i].id.c_str(), + this, menu_selector(HelloWorld::eventMenuCallback)); + pMenu->addChild(pMenuItem, 0, s_EventMenuItem[i].tag); + + CCPoint pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line)); + CCSize itemSize = pMenuItem->getContentSize(); + if ((pos.x + itemSize.width / 2) > posBR.x) + { + line += 1; + row = 0; + pos = ccpAdd(beginPos, ccp(posStep.x * row, posStep.y * line)); + } + row += 1; + pMenuItem->setPosition(pos); + } + + CCLabelTTF* label = CCLabelTTF::create("Reload all plugins", "Arial", 24); + CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(HelloWorld::reloadPluginMenuCallback)); + pMenuItem->setAnchorPoint(ccp(0.5f, 0)); + pMenu->addChild(pMenuItem, 0); + pMenuItem->setPosition(posBC); + + return true; +} + +void HelloWorld::reloadPluginMenuCallback(CCObject* pSender) +{ + MySocialManager::sharedSocialManager()->unloadSocialPlugin(); + MySocialManager::sharedSocialManager()->loadSocialPlugin(); +} + +void HelloWorld::eventMenuCallback(CCObject* pSender) +{ + CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender; + TShareInfo pInfo; + pInfo["SharedText"] = "Share message : HelloSocial!"; + // pInfo["SharedImagePath"] = "Full/path/to/image"; + MySocialManager::MyShareMode mode = (MySocialManager::MyShareMode) (pMenuItem->getTag() - TAG_SHARE_BY_TWWITER + 1); + MySocialManager::sharedSocialManager()->shareByMode(pInfo, mode); +} + +void HelloWorld::menuCloseCallback(CCObject* pSender) +{ + MySocialManager::purgeManager(); + CCDirector::sharedDirector()->end(); +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif +} diff --git a/plugin/samples/HelloSocial/Classes/HelloWorldScene.h b/plugin/samples/HelloSocial/Classes/HelloWorldScene.h new file mode 100755 index 0000000000..35352d5970 --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/HelloWorldScene.h @@ -0,0 +1,47 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __HELLOWORLD_SCENE_H__ +#define __HELLOWORLD_SCENE_H__ + +#include "cocos2d.h" + +class HelloWorld : public cocos2d::CCLayer +{ +public: + // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone + virtual bool init(); + + // there's no 'id' in cpp, so we recommand to return the exactly class pointer + static cocos2d::CCScene* scene(); + + // a selector callback + void menuCloseCallback(CCObject* pSender); + void eventMenuCallback(CCObject* pSender); + void reloadPluginMenuCallback(CCObject* pSender); + + // implement the "static node()" method manually + CREATE_FUNC(HelloWorld); +}; + +#endif // __HELLOWORLD_SCENE_H__ diff --git a/plugin/samples/HelloSocial/Classes/MySocialManager.cpp b/plugin/samples/HelloSocial/Classes/MySocialManager.cpp new file mode 100755 index 0000000000..706766a702 --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/MySocialManager.cpp @@ -0,0 +1,162 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#include "MySocialManager.h" +#include "PluginManager.h" +#include "cocos2d.h" + +using namespace cocos2d::plugin; +using namespace cocos2d; + +MySocialManager* MySocialManager::s_pManager = NULL; + +MySocialManager::MySocialManager() +: s_pRetListener(NULL) +, s_pTwitter(NULL) +, s_pWeibo(NULL) +{ + +} + +MySocialManager::~MySocialManager() +{ + unloadSocialPlugin(); + if (s_pRetListener) + { + delete s_pRetListener; + s_pRetListener = NULL; + } +} + +MySocialManager* MySocialManager::sharedSocialManager() +{ + if (s_pManager == NULL) { + s_pManager = new MySocialManager(); + } + return s_pManager; +} + +void MySocialManager::purgeManager() +{ + if (s_pManager) + { + delete s_pManager; + s_pManager = NULL; + } + PluginManager::end(); +} + +void MySocialManager::loadSocialPlugin() +{ + if (s_pRetListener == NULL) + { + s_pRetListener = new MyShareResult(); + } + + { + // init twitter plugin + s_pTwitter = dynamic_cast(PluginManager::getInstance()->loadPlugin("SocialTwitter")); + if (NULL != s_pTwitter) + { + TSocialDeveloperInfo pTwitterInfo; + + /* Warning: must set your twiiter dev info here */ + // pTwitterInfo["TwitterKey"] = "your consumerkey"; + // pTwitterInfo["TwitterSecret"] = "your consumersecret"; + + if (pTwitterInfo.empty()) + { + char msg[256] = { 0 }; + sprintf(msg, "Developer info is empty. PLZ fill your twitter info in %s(nearby line %d)", __FILE__, __LINE__); + CCMessageBox(msg, "Twitter Warning"); + } + s_pTwitter->setDebugMode(true); + s_pTwitter->configDeveloperInfo(pTwitterInfo); + s_pTwitter->setResultListener(s_pRetListener); + } + } + + { + s_pWeibo = dynamic_cast(PluginManager::getInstance()->loadPlugin("SocialWeibo")); + if (NULL != s_pWeibo) + { + TSocialDeveloperInfo pWeiboInfo; + // pWeiboInfo["WeiboAppKey"] = "your app key"; + // pWeiboInfo["WeiboAppSecret"] = "your app secret"; + // pWeiboInfo["WeiboRedirectUrl"] = "your redirect url"; + + if (pWeiboInfo.empty()) + { + char msg[256] = { 0 }; + sprintf(msg, "Developer info is empty. PLZ fill your weibo info in %s(nearby line %d)", __FILE__, __LINE__); + CCMessageBox(msg, "Weibo Warning"); + } + + s_pWeibo->setDebugMode(true); + s_pWeibo->configDeveloperInfo(pWeiboInfo); + s_pWeibo->setResultListener(s_pRetListener); + } + } +} + +void MySocialManager::unloadSocialPlugin() +{ + if (s_pTwitter) + { + PluginManager::getInstance()->unloadPlugin("SocialTwitter"); + s_pTwitter = NULL; + } + + if (s_pWeibo) + { + PluginManager::getInstance()->unloadPlugin("SocialWeibo"); + s_pWeibo = NULL; + } +} + +void MySocialManager::shareByMode(TShareInfo info, MyShareMode mode) +{ + ProtocolSocial* pShare = NULL; + switch(mode) + { + case eTwitter: + pShare = s_pTwitter; + break; + case eWeibo: + pShare = s_pWeibo; + break; + default: + break; + } + + if (pShare) { + pShare->share(info); + } +} + +void MyShareResult::onShareResult(ShareResultCode ret, const char* msg) +{ + char shareStatus[1024] = { 0 }; + sprintf(shareStatus, "Share %s", (ret == kShareSuccess)? "Successed" : "Failed"); + CCMessageBox(msg, shareStatus); +} diff --git a/plugin/samples/HelloSocial/Classes/MySocialManager.h b/plugin/samples/HelloSocial/Classes/MySocialManager.h new file mode 100755 index 0000000000..cc647499b3 --- /dev/null +++ b/plugin/samples/HelloSocial/Classes/MySocialManager.h @@ -0,0 +1,62 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +#ifndef __MY_SOCIAL_MANAGER_H__ +#define __MY_SOCIAL_MANAGER_H__ + +#include "ProtocolSocial.h" + +class MyShareResult : public cocos2d::plugin::ShareResultListener +{ +public: + virtual void onShareResult(cocos2d::plugin::ShareResultCode ret, const char* msg); +}; + +class MySocialManager +{ +public: + static MySocialManager* sharedSocialManager(); + static void purgeManager(); + + typedef enum { + eNoneMode = 0, + eTwitter, + eWeibo, + } MyShareMode; + + void unloadSocialPlugin(); + void loadSocialPlugin(); + void shareByMode(cocos2d::plugin::TShareInfo info, MyShareMode mode); + +private: + MySocialManager(); + virtual ~MySocialManager(); + + static MySocialManager* s_pManager; + + cocos2d::plugin::ProtocolSocial* s_pTwitter; + cocos2d::plugin::ProtocolSocial* s_pWeibo; + MyShareResult* s_pRetListener; +}; + +#endif // __MY_SOCIAL_MANAGER_H__ diff --git a/plugin/samples/HelloSocial/Resources/background.png.REMOVED.git-id b/plugin/samples/HelloSocial/Resources/background.png.REMOVED.git-id new file mode 100644 index 0000000000..15b10523a1 --- /dev/null +++ b/plugin/samples/HelloSocial/Resources/background.png.REMOVED.git-id @@ -0,0 +1 @@ +b2e4ae6ce873ef4a74cf0230693ef26e939d2778 \ No newline at end of file diff --git a/plugin/samples/HelloSocial/proj.android/.classpath b/plugin/samples/HelloSocial/proj.android/.classpath new file mode 100755 index 0000000000..4ace7547e1 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/.classpath @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloSocial/proj.android/.project b/plugin/samples/HelloSocial/proj.android/.project new file mode 100755 index 0000000000..5227238c68 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/.project @@ -0,0 +1,45 @@ + + + HelloSocial + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + + + Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + plugin-x + 2 + PARENT-3-PROJECT_LOC/publish + + + diff --git a/samples/Javascript/CocosPlayer/proj.android/AndroidManifest.xml b/plugin/samples/HelloSocial/proj.android/AndroidManifest.xml old mode 100644 new mode 100755 similarity index 52% rename from samples/Javascript/CocosPlayer/proj.android/AndroidManifest.xml rename to plugin/samples/HelloSocial/proj.android/AndroidManifest.xml index 5a884a8c34..68fe456fce --- a/samples/Javascript/CocosPlayer/proj.android/AndroidManifest.xml +++ b/plugin/samples/HelloSocial/proj.android/AndroidManifest.xml @@ -1,21 +1,18 @@ - - - + + + android:debuggable="true" + android:icon="@drawable/icon"> - - - - @@ -23,9 +20,9 @@ - - + + + + + diff --git a/plugin/samples/HelloSocial/proj.android/ant.properties b/plugin/samples/HelloSocial/proj.android/ant.properties new file mode 100755 index 0000000000..b0971e891e --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/plugin/samples/HelloSocial/proj.android/build.xml b/plugin/samples/HelloSocial/proj.android/build.xml new file mode 100755 index 0000000000..b3f20e0181 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/samples/HelloSocial/proj.android/build_native.sh b/plugin/samples/HelloSocial/proj.android/build_native.sh new file mode 100755 index 0000000000..0e800b7d70 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/build_native.sh @@ -0,0 +1,81 @@ +APPNAME="HelloSocial" + +# options + +buildexternalsfromsource= + +usage(){ +cat << EOF +usage: $0 [options] + +Build C/C++ code for $APPNAME using Android NDK + +OPTIONS: +-s Build externals from source +-h this help +EOF +} + +while getopts "sh" OPTION; do +case "$OPTION" in +s) +buildexternalsfromsource=1 +;; +h) +usage +exit 0 +;; +esac +done + +# paths + +if [ -z "${NDK_ROOT+aaa}" ];then +echo "please define NDK_ROOT" +exit 1 +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../../.." +COCOS2DX_ROOT="$DIR/../../../.." +APP_ROOT="$DIR/.." +APP_ANDROID_ROOT="$DIR" + +echo "PLUGIN_ROOT = $PLUGIN_ROOT" +echo "NDK_ROOT = $NDK_ROOT" +echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" +echo "APP_ROOT = $APP_ROOT" +echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT" +echo "---------------------------------------------------------" + +# make sure assets is exist +if [ -d "$APP_ANDROID_ROOT"/assets ]; then + rm -rf "$APP_ANDROID_ROOT"/assets +fi + +mkdir "$APP_ANDROID_ROOT"/assets + +# copy resources +for file in "$APP_ROOT"/Resources/* +do +if [ -d "$file" ]; then + cp -rf "$file" "$APP_ANDROID_ROOT"/assets +fi + +if [ -f "$file" ]; then + cp "$file" "$APP_ANDROID_ROOT"/assets +fi +done + +if [[ "$buildexternalsfromsource" ]]; then + echo "Building external dependencies from source" + set -x + "$NDK_ROOT"/ndk-build -j 4 -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source" +else + echo "Using prebuilt externals" + set -x + "$NDK_ROOT"/ndk-build -j 4 -C "$APP_ANDROID_ROOT" $* \ + "NDK_MODULE_PATH=${PLUGIN_ROOT}/publish:${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" +fi diff --git a/plugin/samples/HelloSocial/proj.android/jni/Android.mk b/plugin/samples/HelloSocial/proj.android/jni/Android.mk new file mode 100755 index 0000000000..cf391cb2bf --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/jni/Android.mk @@ -0,0 +1,22 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := game_shared + +LOCAL_MODULE_FILENAME := libgame + +LOCAL_SRC_FILES := hellocpp/main.cpp \ + ../../Classes/AppDelegate.cpp \ + ../../Classes/HelloWorldScene.cpp \ + ../../Classes/MySocialManager.cpp + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes + +LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \ + PluginProtocolStatic + +include $(BUILD_SHARED_LIBRARY) + +$(call import-module,cocos2dx) +$(call import-module,protocols/android) diff --git a/plugin/samples/HelloSocial/proj.android/jni/Application.mk b/plugin/samples/HelloSocial/proj.android/jni/Application.mk new file mode 100755 index 0000000000..d16d4facd2 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/jni/Application.mk @@ -0,0 +1,2 @@ +APP_STL := gnustl_static +APP_CPPFLAGS += -frtti \ No newline at end of file diff --git a/plugin/samples/HelloSocial/proj.android/jni/hellocpp/main.cpp b/plugin/samples/HelloSocial/proj.android/jni/hellocpp/main.cpp new file mode 100755 index 0000000000..ee1079c797 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/jni/hellocpp/main.cpp @@ -0,0 +1,47 @@ +#include "AppDelegate.h" +#include "platform/android/jni/JniHelper.h" +#include "PluginJniHelper.h" +#include +#include + +#include "HelloWorldScene.h" + +#define LOG_TAG "main" +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) + +using namespace cocos2d; + +extern "C" +{ + +jint JNI_OnLoad(JavaVM *vm, void *reserved) +{ + JniHelper::setJavaVM(vm); + PluginJniHelper::setJavaVM(vm); + + return JNI_VERSION_1_4; +} + +void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) +{ + if (!CCDirector::sharedDirector()->getOpenGLView()) + { + CCEGLView *view = CCEGLView::sharedOpenGLView(); + view->setFrameSize(w, h); + + AppDelegate *pAppDelegate = new AppDelegate(); + CCApplication::sharedApplication()->run(); + } + else + { + ccDrawInit(); + ccGLInvalidateStateCache(); + + CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); + CCTextureCache::reloadAllTextures(); + CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); + CCDirector::sharedDirector()->setGLDefaultValues(); + } +} + +} diff --git a/plugin/samples/HelloSocial/proj.android/proguard-project.txt b/plugin/samples/HelloSocial/proj.android/proguard-project.txt new file mode 100755 index 0000000000..b60ae7ea07 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/plugin/samples/HelloSocial/proj.android/project.properties b/plugin/samples/HelloSocial/proj.android/project.properties new file mode 100755 index 0000000000..859630e465 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 +android.library.reference.1=../../../../cocos2dx/platform/android/java diff --git a/plugin/samples/HelloSocial/proj.android/res/values/strings.xml b/plugin/samples/HelloSocial/proj.android/res/values/strings.xml new file mode 100755 index 0000000000..320a39b235 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/res/values/strings.xml @@ -0,0 +1,4 @@ + + + HelloSocial + diff --git a/plugin/samples/HelloSocial/proj.android/src/org/cocos2dx/helloSocial/HelloSocial.java b/plugin/samples/HelloSocial/proj.android/src/org/cocos2dx/helloSocial/HelloSocial.java new file mode 100755 index 0000000000..cc2a90bf8e --- /dev/null +++ b/plugin/samples/HelloSocial/proj.android/src/org/cocos2dx/helloSocial/HelloSocial.java @@ -0,0 +1,43 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ +package org.cocos2dx.helloSocial; + +import org.cocos2dx.lib.Cocos2dxActivity; +import org.cocos2dx.lib.Cocos2dxGLSurfaceView; +import org.cocos2dx.plugin.PluginWrapper; + +import android.os.Bundle; + +public class HelloSocial extends Cocos2dxActivity{ + + protected void onCreate(Bundle savedInstanceState){ + super.onCreate(savedInstanceState); + PluginWrapper.init(this); + PluginWrapper.setGLSurfaceView(Cocos2dxGLSurfaceView.getInstance()); + } + + static { + System.loadLibrary("game"); + } +} diff --git a/plugin/samples/HelloSocial/proj.ios/AppController.h b/plugin/samples/HelloSocial/proj.ios/AppController.h new file mode 100644 index 0000000000..ab7abff7d2 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/AppController.h @@ -0,0 +1,35 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +@class RootViewController; + +@interface AppController : NSObject { + UIWindow *window; + RootViewController *viewController; +} + +@end + diff --git a/plugin/samples/HelloSocial/proj.ios/AppController.mm b/plugin/samples/HelloSocial/proj.ios/AppController.mm new file mode 100644 index 0000000000..b98c9e2fb1 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/AppController.mm @@ -0,0 +1,137 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import "AppController.h" +#import "EAGLView.h" +#import "cocos2d.h" +#import "AppDelegate.h" +#import "RootViewController.h" + +@implementation AppController + +#pragma mark - +#pragma mark Application lifecycle + +// cocos2d application instance +static AppDelegate s_sharedApplication; + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + // Override point for customization after application launch. + + // Add the view controller's view to the window and display. + window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; + + // Init the EAGLView + EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] + pixelFormat: kEAGLColorFormatRGB565 + depthFormat: GL_DEPTH24_STENCIL8_OES + preserveBackbuffer: NO + sharegroup: nil + multiSampling: NO + numberOfSamples: 0]; + [__glView setMultipleTouchEnabled:YES]; + + // Use RootViewController manage EAGLView + viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; + viewController.wantsFullScreenLayout = YES; + viewController.view = __glView; + + // Set RootViewController to window + if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0) + { + // warning: addSubView doesn't work on iOS6 + [window addSubview: viewController.view]; + } + else + { + // use this method on ios6 + [window setRootViewController:viewController]; + } + + [window makeKeyAndVisible]; + + [[UIApplication sharedApplication] setStatusBarHidden:true]; + + cocos2d::CCApplication::sharedApplication()->run(); + + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + /* + 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. + 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. + */ + cocos2d::CCDirector::sharedDirector()->pause(); +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + /* + 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. + */ + cocos2d::CCDirector::sharedDirector()->resume(); +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + /* + 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. + If your application supports background execution, called instead of applicationWillTerminate: when the user quits. + */ + cocos2d::CCApplication::sharedApplication()->applicationDidEnterBackground(); +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + /* + Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. + */ + cocos2d::CCApplication::sharedApplication()->applicationWillEnterForeground(); +} + +- (void)applicationWillTerminate:(UIApplication *)application { + /* + Called when the application is about to terminate. + See also applicationDidEnterBackground:. + */ +} + + +#pragma mark - +#pragma mark Memory management + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { + /* + Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later. + */ +} + + +- (void)dealloc { + [window release]; + [super dealloc]; +} + + +@end diff --git a/plugin/samples/HelloSocial/proj.ios/Default-568h@2x.png.REMOVED.git-id b/plugin/samples/HelloSocial/proj.ios/Default-568h@2x.png.REMOVED.git-id new file mode 100644 index 0000000000..8f5838f3a8 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/Default-568h@2x.png.REMOVED.git-id @@ -0,0 +1 @@ +66c6d1cead373b45218424f6a82f370897e443e4 \ No newline at end of file diff --git a/plugin/samples/HelloSocial/proj.ios/Default@2x.png.REMOVED.git-id b/plugin/samples/HelloSocial/proj.ios/Default@2x.png.REMOVED.git-id new file mode 100644 index 0000000000..8843505b20 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/Default@2x.png.REMOVED.git-id @@ -0,0 +1 @@ +84689888a14a2123d2b39f7f2f61be8c15207479 \ No newline at end of file diff --git a/plugin/samples/HelloSocial/proj.ios/HelloSocial.xcodeproj/project.pbxproj b/plugin/samples/HelloSocial/proj.ios/HelloSocial.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..567a9e2c85 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/HelloSocial.xcodeproj/project.pbxproj @@ -0,0 +1,575 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 15A3DAEB1682F8A6002FB0C5 /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A3DA861682F8A6002FB0C5 /* CDAudioManager.m */; }; + 15A3DAEC1682F8A6002FB0C5 /* CDOpenALSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A3DA891682F8A6002FB0C5 /* CDOpenALSupport.m */; }; + 15A3DAED1682F8A6002FB0C5 /* CocosDenshion.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A3DA8B1682F8A6002FB0C5 /* CocosDenshion.m */; }; + 15A3DAEE1682F8A6002FB0C5 /* SimpleAudioEngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15A3DA8C1682F8A6002FB0C5 /* SimpleAudioEngine.mm */; }; + 15A3DAEF1682F8A6002FB0C5 /* SimpleAudioEngine_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A3DA8E1682F8A6002FB0C5 /* SimpleAudioEngine_objc.m */; }; + 1AC3624916D4A1E8000847F2 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3624316D4A1E8000847F2 /* AppController.mm */; }; + 1AC3624B16D4A1E8000847F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3624516D4A1E8000847F2 /* main.m */; }; + 1AFAF8B716D35DE700DB1158 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */; }; + 1AFAF8B816D35DE700DB1158 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */; }; + 1AFAF8BC16D35E4900DB1158 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8B916D35E4900DB1158 /* CloseNormal.png */; }; + 1AFAF8BD16D35E4900DB1158 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */; }; + 1AFCDA8216D4A25900906EA6 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFCDA8116D4A25900906EA6 /* RootViewController.mm */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + 7855E0E1153FEF240059DD9A /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 7855E0DF153FEF240059DD9A /* Default.png */; }; + BF171245129291EC00B8313A /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB012928DE900B8313A /* OpenGLES.framework */; }; + BF1712461292920000B8313A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB212928DE900B8313A /* libxml2.dylib */; }; + BF1712471292920000B8313A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF170DB412928DE900B8313A /* libz.dylib */; }; + BF1C47F01293687400B63C5D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF1C47EA1293683800B63C5D /* QuartzCore.framework */; }; + D41A0AD1160F154A004552AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D41A0AD0160F154A004552AE /* Default-568h@2x.png */; }; + D446FD6E16102124000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD6D16102124000ADA7B /* Default@2x.png */; }; + D44C620C132DFF330009C878 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44C620B132DFF330009C878 /* OpenAL.framework */; }; + D44C620E132DFF430009C878 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D44C620D132DFF430009C878 /* AVFoundation.framework */; }; + D4EF949A15BD2D8B00D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949915BD2D8B00D803EB /* Icon-57.png */; }; + D4EF949C15BD2D8E00D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949B15BD2D8E00D803EB /* Icon-114.png */; }; + D4EF949E15BD2D9600D803EB /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949D15BD2D9600D803EB /* Icon-72.png */; }; + D4EF94A015BD2D9800D803EB /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF949F15BD2D9800D803EB /* Icon-144.png */; }; + FAE27583175DEC8600F5DA8E /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = FAE27580175DEC8600F5DA8E /* background.png */; }; + FAE27584175DEC8600F5DA8E /* twitter.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = FAE27581175DEC8600F5DA8E /* twitter.jpeg */; }; + FAE27585175DEC8600F5DA8E /* weibo.png in Resources */ = {isa = PBXBuildFile; fileRef = FAE27582175DEC8600F5DA8E /* weibo.png */; }; + FAE27598175DEE1900F5DA8E /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE2757F175DEC0D00F5DA8E /* libcocos2dx.a */; }; + FAE27599175DEE1900F5DA8E /* libPluginProtocol.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE2758E175DED1700F5DA8E /* libPluginProtocol.a */; }; + FAE2759A175DEE1900F5DA8E /* libPluginWeibo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE27597175DED2400F5DA8E /* libPluginWeibo.a */; }; + FAE2759D175DEE6E00F5DA8E /* MySocialManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE2759B175DEE6E00F5DA8E /* MySocialManager.cpp */; }; + FAE275A1175DEEF500F5DA8E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE275A0175DEEF500F5DA8E /* AudioToolbox.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + FAE2757E175DEC0D00F5DA8E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FAE27577175DEC0C00F5DA8E /* cocos2dx.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1551A33F158F2AB200E66CFE; + remoteInfo = cocos2dx; + }; + FAE2758D175DED1700F5DA8E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FAE27586175DED1700F5DA8E /* PluginProtocol.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA09A321168ADBC2008C1C7B; + remoteInfo = PluginProtocol; + }; + FAE27596175DED2400F5DA8E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = FAE2758F175DED2300F5DA8E /* PluginWeibo.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FAE27530175D9D2900F5DA8E; + remoteInfo = PluginWeibo; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 15A3DA821682F8A6002FB0C5 /* Export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = ""; }; + 15A3DA831682F8A6002FB0C5 /* SimpleAudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine.h; sourceTree = ""; }; + 15A3DA851682F8A6002FB0C5 /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = ""; }; + 15A3DA861682F8A6002FB0C5 /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = ""; }; + 15A3DA871682F8A6002FB0C5 /* CDConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDConfig.h; sourceTree = ""; }; + 15A3DA881682F8A6002FB0C5 /* CDOpenALSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDOpenALSupport.h; sourceTree = ""; }; + 15A3DA891682F8A6002FB0C5 /* CDOpenALSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDOpenALSupport.m; sourceTree = ""; }; + 15A3DA8A1682F8A6002FB0C5 /* CocosDenshion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosDenshion.h; sourceTree = ""; }; + 15A3DA8B1682F8A6002FB0C5 /* CocosDenshion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocosDenshion.m; sourceTree = ""; }; + 15A3DA8C1682F8A6002FB0C5 /* SimpleAudioEngine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleAudioEngine.mm; sourceTree = ""; }; + 15A3DA8D1682F8A6002FB0C5 /* SimpleAudioEngine_objc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine_objc.h; sourceTree = ""; }; + 15A3DA8E1682F8A6002FB0C5 /* SimpleAudioEngine_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleAudioEngine_objc.m; sourceTree = ""; }; + 1AC3624216D4A1E8000847F2 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = SOURCE_ROOT; }; + 1AC3624316D4A1E8000847F2 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = SOURCE_ROOT; }; + 1AC3624516D4A1E8000847F2 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; + 1AC3624616D4A1E8000847F2 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; }; + 1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppDelegate.cpp; path = ../Classes/AppDelegate.cpp; sourceTree = ""; }; + 1AFAF8B416D35DE700DB1158 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../Classes/AppDelegate.h; sourceTree = ""; }; + 1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelloWorldScene.cpp; path = ../Classes/HelloWorldScene.cpp; sourceTree = ""; }; + 1AFAF8B616D35DE700DB1158 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelloWorldScene.h; path = ../Classes/HelloWorldScene.h; sourceTree = ""; }; + 1AFAF8B916D35E4900DB1158 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseNormal.png; sourceTree = ""; }; + 1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseSelected.png; sourceTree = ""; }; + 1AFCDA8016D4A25900906EA6 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = SOURCE_ROOT; }; + 1AFCDA8116D4A25900906EA6 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = SOURCE_ROOT; }; + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* HelloSocial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloSocial.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 7855E0DF153FEF240059DD9A /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; }; + BF170DB012928DE900B8313A /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + BF170DB212928DE900B8313A /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + BF170DB412928DE900B8313A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + BF1C47EA1293683800B63C5D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + D41A0AD0160F154A004552AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = ""; }; + D446FD6D16102124000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = ""; }; + D44C620B132DFF330009C878 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; + D44C620D132DFF430009C878 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + D4EF949915BD2D8B00D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = ""; }; + D4EF949B15BD2D8E00D803EB /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-114.png"; path = "../proj.ios/Icon-114.png"; sourceTree = ""; }; + D4EF949D15BD2D9600D803EB /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-72.png"; path = "../proj.ios/Icon-72.png"; sourceTree = ""; }; + D4EF949F15BD2D9800D803EB /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-144.png"; path = "../proj.ios/Icon-144.png"; sourceTree = ""; }; + D4F9F37B12E54555005CA6D2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; + FAE27577175DEC0C00F5DA8E /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = ""; }; + FAE27580175DEC8600F5DA8E /* background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = background.png; sourceTree = ""; }; + FAE27581175DEC8600F5DA8E /* twitter.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = twitter.jpeg; sourceTree = ""; }; + FAE27582175DEC8600F5DA8E /* weibo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = weibo.png; sourceTree = ""; }; + FAE27586175DED1700F5DA8E /* PluginProtocol.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginProtocol.xcodeproj; path = ../../../protocols/proj.ios/PluginProtocol.xcodeproj; sourceTree = ""; }; + FAE2758F175DED2300F5DA8E /* PluginWeibo.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PluginWeibo.xcodeproj; path = ../../../plugins/weibo/proj.ios/PluginWeibo.xcodeproj; sourceTree = ""; }; + FAE2759B175DEE6E00F5DA8E /* MySocialManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MySocialManager.cpp; path = ../Classes/MySocialManager.cpp; sourceTree = ""; }; + FAE2759C175DEE6E00F5DA8E /* MySocialManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MySocialManager.h; path = ../Classes/MySocialManager.h; sourceTree = ""; }; + FAE275A0175DEEF500F5DA8E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FAE275A1175DEEF500F5DA8E /* AudioToolbox.framework in Frameworks */, + FAE27598175DEE1900F5DA8E /* libcocos2dx.a in Frameworks */, + FAE27599175DEE1900F5DA8E /* libPluginProtocol.a in Frameworks */, + FAE2759A175DEE1900F5DA8E /* libPluginWeibo.a in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + BF171245129291EC00B8313A /* OpenGLES.framework in Frameworks */, + BF1712461292920000B8313A /* libxml2.dylib in Frameworks */, + BF1712471292920000B8313A /* libz.dylib in Frameworks */, + BF1C47F01293687400B63C5D /* QuartzCore.framework in Frameworks */, + D44C620C132DFF330009C878 /* OpenAL.framework in Frameworks */, + D44C620E132DFF430009C878 /* AVFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* ios */ = { + isa = PBXGroup; + children = ( + 1AC3624216D4A1E8000847F2 /* AppController.h */, + 1AC3624316D4A1E8000847F2 /* AppController.mm */, + D4F9F37B12E54555005CA6D2 /* Info.plist */, + 1AC3624516D4A1E8000847F2 /* main.m */, + 1AC3624616D4A1E8000847F2 /* Prefix.pch */, + 1AFCDA8016D4A25900906EA6 /* RootViewController.h */, + 1AFCDA8116D4A25900906EA6 /* RootViewController.mm */, + ); + name = ios; + path = Classes; + sourceTree = ""; + }; + 15A3DA6B1682F8A6002FB0C5 /* CocosDenshion */ = { + isa = PBXGroup; + children = ( + 15A3DA811682F8A6002FB0C5 /* include */, + 15A3DA841682F8A6002FB0C5 /* ios */, + ); + name = CocosDenshion; + path = ../../../../CocosDenshion; + sourceTree = ""; + }; + 15A3DA811682F8A6002FB0C5 /* include */ = { + isa = PBXGroup; + children = ( + 15A3DA821682F8A6002FB0C5 /* Export.h */, + 15A3DA831682F8A6002FB0C5 /* SimpleAudioEngine.h */, + ); + path = include; + sourceTree = ""; + }; + 15A3DA841682F8A6002FB0C5 /* ios */ = { + isa = PBXGroup; + children = ( + 15A3DA851682F8A6002FB0C5 /* CDAudioManager.h */, + 15A3DA861682F8A6002FB0C5 /* CDAudioManager.m */, + 15A3DA871682F8A6002FB0C5 /* CDConfig.h */, + 15A3DA881682F8A6002FB0C5 /* CDOpenALSupport.h */, + 15A3DA891682F8A6002FB0C5 /* CDOpenALSupport.m */, + 15A3DA8A1682F8A6002FB0C5 /* CocosDenshion.h */, + 15A3DA8B1682F8A6002FB0C5 /* CocosDenshion.m */, + 15A3DA8C1682F8A6002FB0C5 /* SimpleAudioEngine.mm */, + 15A3DA8D1682F8A6002FB0C5 /* SimpleAudioEngine_objc.h */, + 15A3DA8E1682F8A6002FB0C5 /* SimpleAudioEngine_objc.m */, + ); + path = ios; + sourceTree = ""; + }; + 15AA9C4015B7EC450033D6C2 /* Classes */ = { + isa = PBXGroup; + children = ( + FAE2759B175DEE6E00F5DA8E /* MySocialManager.cpp */, + FAE2759C175DEE6E00F5DA8E /* MySocialManager.h */, + 1AFAF8B316D35DE700DB1158 /* AppDelegate.cpp */, + 1AFAF8B416D35DE700DB1158 /* AppDelegate.h */, + 1AFAF8B516D35DE700DB1158 /* HelloWorldScene.cpp */, + 1AFAF8B616D35DE700DB1158 /* HelloWorldScene.h */, + ); + name = Classes; + path = ../classes; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* HelloSocial.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + FAE2758F175DED2300F5DA8E /* PluginWeibo.xcodeproj */, + FAE27586175DED1700F5DA8E /* PluginProtocol.xcodeproj */, + FAE27577175DEC0C00F5DA8E /* cocos2dx.xcodeproj */, + 15AA9C4015B7EC450033D6C2 /* Classes */, + 15A3DA6B1682F8A6002FB0C5 /* CocosDenshion */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 080E96DDFE201D6D7F000001 /* ios */, + 19C28FACFE9D520D11CA2CBB /* Products */, + 78C7DDAA14EBA5050085D0C2 /* Resources */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + FAE275A0175DEEF500F5DA8E /* AudioToolbox.framework */, + BF170DB212928DE900B8313A /* libxml2.dylib */, + BF170DB412928DE900B8313A /* libz.dylib */, + D44C620D132DFF430009C878 /* AVFoundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + D44C620B132DFF330009C878 /* OpenAL.framework */, + BF170DB012928DE900B8313A /* OpenGLES.framework */, + BF1C47EA1293683800B63C5D /* QuartzCore.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 78C7DDAA14EBA5050085D0C2 /* Resources */ = { + isa = PBXGroup; + children = ( + FAE27580175DEC8600F5DA8E /* background.png */, + FAE27581175DEC8600F5DA8E /* twitter.jpeg */, + FAE27582175DEC8600F5DA8E /* weibo.png */, + 1AFAF8B916D35E4900DB1158 /* CloseNormal.png */, + 1AFAF8BA16D35E4900DB1158 /* CloseSelected.png */, + D41A0AD0160F154A004552AE /* Default-568h@2x.png */, + 7855E0DF153FEF240059DD9A /* Default.png */, + D446FD6D16102124000ADA7B /* Default@2x.png */, + D4EF949B15BD2D8E00D803EB /* Icon-114.png */, + D4EF949F15BD2D9800D803EB /* Icon-144.png */, + D4EF949915BD2D8B00D803EB /* Icon-57.png */, + D4EF949D15BD2D9600D803EB /* Icon-72.png */, + ); + name = Resources; + path = ../Resources; + sourceTree = ""; + }; + FAE27578175DEC0C00F5DA8E /* Products */ = { + isa = PBXGroup; + children = ( + FAE2757F175DEC0D00F5DA8E /* libcocos2dx.a */, + ); + name = Products; + sourceTree = ""; + }; + FAE27587175DED1700F5DA8E /* Products */ = { + isa = PBXGroup; + children = ( + FAE2758E175DED1700F5DA8E /* libPluginProtocol.a */, + ); + name = Products; + sourceTree = ""; + }; + FAE27590175DED2300F5DA8E /* Products */ = { + isa = PBXGroup; + children = ( + FAE27597175DED2400F5DA8E /* libPluginWeibo.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* HelloSocial */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloSocial" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HelloSocial; + productName = iphone; + productReference = 1D6058910D05DD3D006BFB54 /* HelloSocial.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloSocial" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = FAE27578175DEC0C00F5DA8E /* Products */; + ProjectRef = FAE27577175DEC0C00F5DA8E /* cocos2dx.xcodeproj */; + }, + { + ProductGroup = FAE27587175DED1700F5DA8E /* Products */; + ProjectRef = FAE27586175DED1700F5DA8E /* PluginProtocol.xcodeproj */; + }, + { + ProductGroup = FAE27590175DED2300F5DA8E /* Products */; + ProjectRef = FAE2758F175DED2300F5DA8E /* PluginWeibo.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* HelloSocial */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + FAE2757F175DEC0D00F5DA8E /* libcocos2dx.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcocos2dx.a; + remoteRef = FAE2757E175DEC0D00F5DA8E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FAE2758E175DED1700F5DA8E /* libPluginProtocol.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPluginProtocol.a; + remoteRef = FAE2758D175DED1700F5DA8E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FAE27597175DED2400F5DA8E /* libPluginWeibo.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPluginWeibo.a; + remoteRef = FAE27596175DED2400F5DA8E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7855E0E1153FEF240059DD9A /* Default.png in Resources */, + D4EF949A15BD2D8B00D803EB /* Icon-57.png in Resources */, + D4EF949C15BD2D8E00D803EB /* Icon-114.png in Resources */, + D4EF949E15BD2D9600D803EB /* Icon-72.png in Resources */, + D4EF94A015BD2D9800D803EB /* Icon-144.png in Resources */, + D41A0AD1160F154A004552AE /* Default-568h@2x.png in Resources */, + D446FD6E16102124000ADA7B /* Default@2x.png in Resources */, + 1AFAF8BC16D35E4900DB1158 /* CloseNormal.png in Resources */, + 1AFAF8BD16D35E4900DB1158 /* CloseSelected.png in Resources */, + FAE27583175DEC8600F5DA8E /* background.png in Resources */, + FAE27584175DEC8600F5DA8E /* twitter.jpeg in Resources */, + FAE27585175DEC8600F5DA8E /* weibo.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15A3DAEB1682F8A6002FB0C5 /* CDAudioManager.m in Sources */, + 15A3DAEC1682F8A6002FB0C5 /* CDOpenALSupport.m in Sources */, + 15A3DAED1682F8A6002FB0C5 /* CocosDenshion.m in Sources */, + 15A3DAEE1682F8A6002FB0C5 /* SimpleAudioEngine.mm in Sources */, + 15A3DAEF1682F8A6002FB0C5 /* SimpleAudioEngine_objc.m in Sources */, + 1AFAF8B716D35DE700DB1158 /* AppDelegate.cpp in Sources */, + 1AFAF8B816D35DE700DB1158 /* HelloWorldScene.cpp in Sources */, + 1AC3624916D4A1E8000847F2 /* AppController.mm in Sources */, + 1AC3624B16D4A1E8000847F2 /* main.m in Sources */, + 1AFCDA8216D4A25900906EA6 /* RootViewController.mm in Sources */, + FAE2759D175DEE6E00F5DA8E /* MySocialManager.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_FILE32API, + CC_TARGET_OS_IPHONE, + "COCOS2D_DEBUG=1", + CC_ENABLE_CHIPMUNK_INTEGRATION, + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../../CocosDenshion/include", + "\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../../cocos2dx\"", + "\"$(SRCROOT)/../../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios/Simulation\"", + "\"$(SRCROOT)/../../../protocols/include", + ); + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios/libraries\""; + OTHER_CFLAGS = "-O2"; + "OTHER_LDFLAGS[arch=*]" = "-ObjC"; + PRODUCT_NAME = HelloSocial; + PROVISIONING_PROFILE = ""; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + GCC_INLINES_ARE_PRIVATE_EXTERN = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = ( + USE_FILE32API, + CC_TARGET_OS_IPHONE, + CC_ENABLE_CHIPMUNK_INTEGRATION, + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/../../../../CocosDenshion/include", + "\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../../cocos2dx\"", + "\"$(SRCROOT)/../../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"", + "\"$(SRCROOT)/../../../../cocos2dx/platform/ios/Simulation\"", + "\"$(SRCROOT)/../../../protocols/include", + ); + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios/libraries\""; + "OTHER_LDFLAGS[arch=*]" = "-ObjC"; + PRODUCT_NAME = HelloSocial; + PROVISIONING_PROFILE = ""; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer: 小明 张 (L4ZF355VQS)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: 小明 张 (L4ZF355VQS)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PROVISIONING_PROFILE = "0C43CFE2-55C4-429A-9A03-BFB76D31630B"; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = "0C43CFE2-55C4-429A-9A03-BFB76D31630B"; + SDKROOT = iphoneos; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CODE_SIGN_IDENTITY = "iPhone Developer: 小明 张 (L4ZF355VQS)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: 小明 张 (L4ZF355VQS)"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = ""; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PROVISIONING_PROFILE = "0C43CFE2-55C4-429A-9A03-BFB76D31630B"; + "PROVISIONING_PROFILE[sdk=iphoneos*]" = "DB6844BA-2943-44DB-B10A-3A3F0E8A52B8"; + SDKROOT = iphoneos; + VALID_ARCHS = "armv6 armv7 i386"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloSocial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloSocial" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/plugin/samples/HelloSocial/proj.ios/Prefix.pch b/plugin/samples/HelloSocial/proj.ios/Prefix.pch new file mode 100644 index 0000000000..5b4e2fd9e1 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'iphone' target in the 'iphone' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/plugin/samples/HelloSocial/proj.ios/RootViewController.h b/plugin/samples/HelloSocial/proj.ios/RootViewController.h new file mode 100644 index 0000000000..b346fa122d --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/RootViewController.h @@ -0,0 +1,32 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + + +@interface RootViewController : UIViewController { + +} + +@end diff --git a/plugin/samples/HelloSocial/proj.ios/RootViewController.mm b/plugin/samples/HelloSocial/proj.ios/RootViewController.mm new file mode 100644 index 0000000000..bdadc9ced7 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/RootViewController.mm @@ -0,0 +1,89 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import "RootViewController.h" + + +@implementation RootViewController + +/* + // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { + // Custom initialization + } + return self; +} +*/ + +/* +// Implement loadView to create a view hierarchy programmatically, without using a nib. +- (void)loadView { +} +*/ + +/* +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad { + [super viewDidLoad]; +} + +*/ +// Override to allow orientations other than the default portrait orientation. +// This method is deprecated on ios6 +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + return UIInterfaceOrientationIsLandscape( interfaceOrientation ); +} + +// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead +- (NSUInteger) supportedInterfaceOrientations{ +#ifdef __IPHONE_6_0 + return UIInterfaceOrientationMaskAllButUpsideDown; +#endif +} + +- (BOOL) shouldAutorotate { + return YES; +} + +- (void)didReceiveMemoryWarning { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +- (void)viewDidUnload { + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@end diff --git a/plugin/samples/HelloSocial/proj.ios/main.m b/plugin/samples/HelloSocial/proj.ios/main.m new file mode 100644 index 0000000000..f607c969a3 --- /dev/null +++ b/plugin/samples/HelloSocial/proj.ios/main.m @@ -0,0 +1,36 @@ +/**************************************************************************** +Copyright (c) 2012-2013 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#import + +// Under iOS and the Simulator, we can use an alternate Accelerometer interface +#import "AccelerometerSimulation.h" + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); + [pool release]; + return retVal; +} diff --git a/plugin/tools/android/build_common.xml b/plugin/tools/android/build_common.xml new file mode 100755 index 0000000000..00f35e018c --- /dev/null +++ b/plugin/tools/android/build_common.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugin/tools/config.sh b/plugin/tools/config.sh new file mode 100755 index 0000000000..3f21a31b41 --- /dev/null +++ b/plugin/tools/config.sh @@ -0,0 +1,28 @@ +#define plugins array +export ALL_PLUGINS=("flurry" "umeng" \ +"alipay" "nd91" \ +"admob" \ +"twitter" "weibo") + +# define the plugin root directory & publish target directory +export TARGET_DIR_NAME="publish" +if [ ! ${PLUGIN_ROOT} ]; then + pushd ../ + export PLUGIN_ROOT=`pwd` + export TARGET_ROOT=${PLUGIN_ROOT}/${TARGET_DIR_NAME} + echo PLUGIN_ROOT = ${PLUGIN_ROOT} + echo TARGET_ROOT = ${TARGET_ROOT} + popd +fi + +# get a string include all plugins name(separate with ':') +export PLUGINS_CAN_SELECT="" +PLUGIN_NUM=${#ALL_PLUGINS[@]} +for ((i=0; i<${PLUGIN_NUM}; i++)) +do + plugin_name=${ALL_PLUGINS[$i]} + PLUGINS_CAN_SELECT=${PLUGINS_CAN_SELECT}${plugin_name} + if [ $i -ne $((${PLUGIN_NUM}-1)) ]; then + PLUGINS_CAN_SELECT=${PLUGINS_CAN_SELECT}":" + fi +done diff --git a/plugin/tools/gameDevGuide.sh b/plugin/tools/gameDevGuide.sh new file mode 100755 index 0000000000..e106524e8b --- /dev/null +++ b/plugin/tools/gameDevGuide.sh @@ -0,0 +1,10 @@ +SHELL_DIR=$(cd "$(dirname "$0")"; pwd) +pushd ${SHELL_DIR} + +# include the config +source ./config.sh + +# show dialog for continue +python ./toolsForGame/main.py ${PLUGINS_CAN_SELECT} + +popd diff --git a/plugin/tools/publish.sh b/plugin/tools/publish.sh new file mode 100755 index 0000000000..f7d2c72620 --- /dev/null +++ b/plugin/tools/publish.sh @@ -0,0 +1,47 @@ +SHELL_DIR=$(cd "$(dirname "$0")"; pwd) + +pushd ${SHELL_DIR} + +source ./config.sh + +if [ -d ${TARGET_ROOT} ]; then + rm -rf ${TARGET_ROOT} +fi +mkdir -p ${TARGET_ROOT} + +#check the environment +./toolsForPublish/checkEnvironment.sh +source ./toolsForPublish/environment.sh + +# output the number of plugins +if [ $1 ]; then + plugins=(${1//:/ }) +else + plugins=(`echo ${ALL_PLUGINS[@]}`) +fi + +length=${#plugins[@]} +echo +echo Now have ${length} plugins +echo + +#publish protocols +echo +echo Now publish protocols +echo --------------------------------- +./toolsForPublish/publishPlugin.sh "protocols" ${TARGET_ROOT} ${PLUGIN_ROOT} 1 +echo --------------------------------- + +#publish plugins +for plugin_name in ${plugins[@]} +do + echo + echo Now publish ${plugin_name} + echo --------------------------------- + ./toolsForPublish/publishPlugin.sh "plugins/"${plugin_name} ${TARGET_ROOT} ${PLUGIN_ROOT} + echo --------------------------------- +done + +echo + +popd diff --git a/plugin/tools/tojs/.gitignore b/plugin/tools/tojs/.gitignore new file mode 100644 index 0000000000..ee1f2425b8 --- /dev/null +++ b/plugin/tools/tojs/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +gen/ +*.pyc +user.cfg +userconf.ini diff --git a/plugin/tools/tojs/conversions.yaml b/plugin/tools/tojs/conversions.yaml new file mode 100644 index 0000000000..42cd3259bb --- /dev/null +++ b/plugin/tools/tojs/conversions.yaml @@ -0,0 +1,102 @@ +definitions: + # the names of the functions - we use this to generate the code and to register the functions in + # the javascript class + ifunction: "js_${generator.prefix}_${class_name}_${func_name}" + sfunction: "js_${generator.prefix}_${class_name}_${func_name}" + constructor: "js_${generator.prefix}_${class_name}_constructor" +conversions: + # some times you want to use a special native type when converting from spidermonkey to native + # the most common case would be from JS-boolean to bool. Using "bool" will fail here since we + # pass the address to the conversion method, and a JSBool is defined as an integer in spidermonkey + native_types: + bool: "JSBool" + float: "double" + short: "int32_t" + "unsigned char": "uint16_t" + "char": "int32_t" + to_native: + # jsval to int + int: "ok &= jsval_to_int32(cx, ${in_value}, (int32_t *)&${out_value})" + "unsigned int": "ok &= jsval_to_uint32(cx, ${in_value}, &${out_value})" + "unsigned char": "ok &= jsval_to_uint16(cx, ${in_value}, &${out_value})" + short: "ok &= jsval_to_int32(cx, ${in_value}, &${out_value})" + char: "ok &= jsval_to_int32(cx, ${in_value}, &${out_value})" + bool: "ok &= JS_ValueToBoolean(cx, ${in_value}, &${out_value})" + float: "ok &= JS_ValueToNumber(cx, ${in_value}, &${out_value})" + double: "ok &= JS_ValueToNumber(cx, ${in_value}, &${out_value})" + # jsval has to be a TypedArray, a UInt32Array with 2 elements + "long long": "ok &= jsval_to_long_long(cx, ${in_value}, &${out_value})" + "std::string": "ok &= jsval_to_std_string(cx, ${in_value}, &${out_value})" + "const char*": "std::string ${out_value}_tmp; ok &= jsval_to_std_string(cx, ${in_value}, &${out_value}_tmp); ${out_value} = ${out_value}_tmp.c_str()" + "CCPoint": "ok &= jsval_to_ccpoint(cx, ${in_value}, &${out_value})" + "CCRect": "ok &= jsval_to_ccrect(cx, ${in_value}, &${out_value})" + "CCSize": "ok &= jsval_to_ccsize(cx, ${in_value}, &${out_value})" + "const ccColor4B": "ok &= jsval_to_cccolor4b(cx, ${in_value}, &${out_value})" + "const ccColor4F": "ok &= jsval_to_cccolor4f(cx, ${in_value}, &${out_value})" + "const ccColor3B": "ok &= jsval_to_cccolor3b(cx, ${in_value}, &${out_value})" + "CCArray*": "ok &= jsval_to_ccarray(cx, ${in_value}, &${out_value})" + "CCDictionary*": "ok &= jsval_to_ccdictionary(cx, ${in_value}, &${out_value})" + object: | + do { + ${($level + 1) * '\t'}js_proxy_t *proxy; + ${($level + 1) * '\t'}JSObject *tmpObj = JSVAL_TO_OBJECT(${in_value}); + ${($level + 1) * '\t'}JS_GET_NATIVE_PROXY(proxy, tmpObj); + ${($level + 1) * '\t'}${out_value} = (${ntype})(proxy ? proxy->ptr : NULL); + ${($level + 1) * '\t'}JSB_PRECONDITION2( ${out_value}, cx, JS_FALSE, "Invalid Native Object"); + ${($level + 0) * '\t'}} while (0) + TProductInfo: "ok &= jsval_to_TProductInfo(cx, ${in_value}, &${out_value})" + TIAPDeveloperInfo: "ok &= jsval_to_TIAPDeveloperInfo(cx, ${in_value}, &${out_value})" + TPaymentInfo: "ok &= jsval_to_TPaymentInfo(cx, ${in_value}, &${out_value})" + TAdsDeveloperInfo: "ok &= jsval_to_TAdsDeveloperInfo(cx, ${in_value}, &${out_value})" + TSocialDeveloperInfo: "ok &= jsval_to_TSocialDeveloperInfo(cx, ${in_value}, &${out_value})" + TShareInfo: "ok &= jsval_to_TShareInfo(cx, ${in_value}, &${out_value})" + LogEventParamMap*: | + LogEventParamMap ${out_value}_tmp; + ${($level + 0) * '\t'}do { + ${($level + 1) * '\t'}ok &= jsval_to_LogEventParamMap(cx, ${in_value}, &${out_value}); + ${($level + 1) * '\t'}if (ok) { ${out_value}_tmp = *${out_value}; delete ${out_value}; ${out_value} = &${out_value}_tmp; } else { ${out_value} = NULL; } + ${($level + 0) * '\t'}} while(0) + long: "ok &= jsval_to_long(cx, ${in_value}, (long *)&${out_value})" + + from_native: + # int to jsval + int: "${out_value} = int32_to_jsval(cx, ${in_value})" + "unsigned int": "${out_value} = uint32_to_jsval(cx, ${in_value})" + "unsigned char": "${out_value} = uint32_to_jsval(cx, ${in_value})" + "long long": "${out_value} = long_long_to_jsval(cx, ${in_value})" + "std::string": "${out_value} = std_string_to_jsval(cx, ${in_value})" + "const char*": "${out_value} = c_string_to_jsval(cx, ${in_value})" + bool: "${out_value} = BOOLEAN_TO_JSVAL(${in_value})" + float: "${out_value} = DOUBLE_TO_JSVAL(${in_value})" + double: "${out_value} = DOUBLE_TO_JSVAL(${in_value})" + "CCPoint": "${out_value} = ccpoint_to_jsval(cx, ${in_value})" + "CCRect": "${out_value} = ccrect_to_jsval(cx, ${in_value})" + "CCSize": "${out_value} = ccsize_to_jsval(cx, ${in_value})" + "const ccGridSize": "${out_value} = ccgridsize_to_jsval(cx, ${in_value})" + "const ccColor4B": "${out_value} = cccolor4b_to_jsval(cx, ${in_value})" + "const ccColor4F": "${out_value} = cccolor4f_to_jsval(cx, ${in_value})" + "const ccColor3B": "${out_value} = cccolor3b_to_jsval(cx, ${in_value})" + "ccColor4B": "${out_value} = cccolor4b_to_jsval(cx, ${in_value})" + "ccColor4F": "${out_value} = cccolor4f_to_jsval(cx, ${in_value})" + "ccColor3B": "${out_value} = cccolor3b_to_jsval(cx, ${in_value})" + "CCArray*": "${out_value} = ccarray_to_jsval(cx, ${in_value})" + "CCDictionary*": "${out_value} = ccdictionary_to_jsval(cx, ${in_value})" + TProductInfo: "${out_value} = TProductInfo_to_jsval(cx, ${in_value})" + TIAPDeveloperInfo: "${out_value} = TIAPDeveloperInfo_to_jsval(cx, ${in_value})" + TPaymentInfo: "${out_value} = TPaymentInfo_to_jsval(cx, ${in_value})" + TAdsDeveloperInfo: "${out_value} = TAdsDeveloperInfo_to_jsval(cx, ${in_value})" + TSocialDeveloperInfo: "${out_value} = TSocialDeveloperInfo_to_jsval(cx, ${in_value})" + TShareInfo: "${out_value} = TShareInfo_to_jsval(cx, ${in_value})" + LogEventParamMap*: "${out_value} = LogEventParamMap_to_jsval(cx, ${in_value})" + long: "${out_value} = long_to_jsval(cx, ${in_value})" + + object: | + do { + ${($level + 1) * '\t'}if (${in_value}) { + ${($level + 2) * '\t'}js_proxy_t *proxy = js_get_or_create_proxy<${ntype.replace("*", "")}>(cx, ${in_value}); + ${($level + 2) * '\t'}${out_value} = OBJECT_TO_JSVAL(proxy->obj); + ${($level + 1) * '\t'}} else { + ${($level + 2) * '\t'}${out_value} = JSVAL_NULL; + ${($level + 1) * '\t'}} + ${($level) * '\t'}} while (0) + diff --git a/plugin/tools/tojs/genbindings-all.sh b/plugin/tools/tojs/genbindings-all.sh new file mode 100755 index 0000000000..39d90be2f4 --- /dev/null +++ b/plugin/tools/tojs/genbindings-all.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# ... use paths relative to current directory +PLUGIN_ROOT="$DIR/../.." +CXX_GENERATOR_ROOT="$DIR/../../../tools/bindings-generator" +# Delete the output directory +if [ -d $PLUGIN_ROOT/jsbindings/auto ]; then + echo "Delete the output directory." + rm -r $PLUGIN_ROOT/jsbindings/auto +else + echo "Output directory doesn't exist." +fi + +check_return_value() +{ + if [ $? -ne 0 ]; then + echo "*** genbindings plugin ( $1 ) jsbindings fails. ***" + if [ -e $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup ]; then + echo "Restoring conversions.yaml ..." + mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml + fi + exit 1 + else + echo "--- genbindings plugin ( $1 ) jsbindings succeed. ---" + fi +} + +./genbindings.sh "protocols" +check_return_value "protocols" + +echo "--- Generating all jsbindings glue codes for pluginx succeed. :) --- " diff --git a/plugin/tools/tojs/genbindings.sh b/plugin/tools/tojs/genbindings.sh new file mode 100755 index 0000000000..85414ff920 --- /dev/null +++ b/plugin/tools/tojs/genbindings.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +if [ -z $1 ]; then + echo "*** Please pass an argument which means plugin name. ***" + exit 1 +fi + +SUB_DIR="$2" +PLUGIN_NAME="$1" +INI_NAME="jsb_$PLUGIN_NAME.ini" +OUTPUT_FILENAME="jsb_pluginx_"$PLUGIN_NAME"_auto" + +echo "--------------" +echo "plugin name: $PLUGIN_NAME" +echo "ini filename: $INI_NAME" +echo "output filename: $OUTPUT_FILENAME" +echo "--------------" + +# exit this script if any commmand fails +set -e + +# read user.cfg if it exists and is readable + +_CFG_FILE=$(dirname "$0")"/user.cfg" +if [ -f "$_CFG_FILE" ] +then + [ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable" + . "$_CFG_FILE" +fi + +# paths + +if [ -z "${NDK_ROOT+aaa}" ]; then +# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk" + NDK_ROOT="$HOME/bin/android-ndk" +fi + +if [ -z "${CLANG_ROOT+aaa}" ]; then +# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.1" + CLANG_ROOT="$HOME/bin/clang+llvm-3.1" +fi + +if [ -z "${PYTHON_BIN+aaa}" ]; then +# ... if PYTHON_BIN is not set, use "/usr/bin/python2.7" + PYTHON_BIN="/usr/bin/python2.7" +fi + +# find current dir +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# paths with defaults hardcoded to relative paths + +if [ -z "${PLUGINX_ROOT+aaa}" ]; then + PLUGINX_ROOT="$DIR/../.." +fi + +if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then + CXX_GENERATOR_ROOT="$PLUGINX_ROOT/../tools/bindings-generator" +fi + +if [ -z "${TOJS_ROOT+aaa}" ]; then + TO_JS_ROOT="$PLUGINX_ROOT/tools/tojs" +fi + +echo "Paths" +echo " NDK_ROOT: $NDK_ROOT" +echo " CLANG_ROOT: $CLANG_ROOT" +echo " PYTHON_BIN: $PYTHON_BIN" +echo " PLUGINX_ROOT: $PLUGINX_ROOT" +echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT" +echo " TO_JS_ROOT: $TO_JS_ROOT" + +# write userconf.ini + +_CONF_INI_FILE="$PWD/userconf.ini" +if [ -f "$_CONF_INI_FILE" ] +then + rm "$_CONF_INI_FILE" +fi + +_CONTENTS="" +_CONTENTS+="[DEFAULT]"'\n' +_CONTENTS+="androidndkdir=$NDK_ROOT"'\n' +_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n' +_CONTENTS+="pluginxdir=$PLUGINX_ROOT"'\n' +_CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n' +echo +echo "generating userconf.ini..." +echo --- +echo -e "$_CONTENTS" +echo -e "$_CONTENTS" > "$_CONF_INI_FILE" +echo --- + +# Generate bindings for plugin-x $PLUGIN_NAME +echo "Generating bindings for plugin-x $PLUGIN_NAME..." +set -x +mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup +cp conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey + +LD_LIBRARY_PATH=${CLANG_ROOT}/lib +$PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${PLUGINX_ROOT}/${SUB_DIR}$PLUGIN_NAME/$INI_NAME -s $PLUGIN_NAME -o $PLUGINX_ROOT/jsbindings/auto -n $OUTPUT_FILENAME + +mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml + +# modify the include file +# #include "cocos2d_specifics.hpp" --> +# #include "jsb_pluginx_spidermonkey_specifics.h" +# #include "jsb_pluginx_basic_conversions.h" + +./modify_include.sed $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp > $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp.origin +mv $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp.origin $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp diff --git a/plugin/tools/tojs/modify_include.sed b/plugin/tools/tojs/modify_include.sed new file mode 100755 index 0000000000..62c49b917b --- /dev/null +++ b/plugin/tools/tojs/modify_include.sed @@ -0,0 +1,5 @@ +#!/usr/bin/sed -f +/#include "cocos2d_specifics.hpp"/c\ +#include "jsb_pluginx_spidermonkey_specifics.h"\ +#include "jsb_pluginx_basic_conversions.h"\ +using namespace pluginx; diff --git a/plugin/tools/toolsForGame/addPluginForGame.sh b/plugin/tools/toolsForGame/addPluginForGame.sh new file mode 100755 index 0000000000..2e117f1f5a --- /dev/null +++ b/plugin/tools/toolsForGame/addPluginForGame.sh @@ -0,0 +1,78 @@ +SHELL_DIR=$(cd "$(dirname "$0")"; pwd) + +GAME_PROJECT_DIR=$1 +SELECTED_PLUGINS=(${2//:/ }) + +# if project path is end with '/', delete it +END_CHAR=${GAME_PROJECT_DIR:$((${#GAME_PROJECT_DIR}-1)):1} +if [ ${END_CHAR} = "/" ]; then + GAME_PROJECT_DIR=${GAME_PROJECT_DIR%/} +fi + +# check the game project path +if [ -d "${GAME_PROJECT_DIR}" -a -f "${GAME_PROJECT_DIR}/AndroidManifest.xml" ]; then + echo "Game project path : ${GAME_PROJECT_DIR}" + echo "selected plugins : ${SELECTED_PLUGINS[@]}" +else + echo "Game project path is wrong.(Not an android project directory)" + exit 1 +fi + +getPathForSystem() +{ + START_WITH_CYGWIN=`echo $1 | grep '^/cygdrive/'` + if [ -z "${START_WITH_CYGWIN}" ]; then + echo "$1" + else + RET=${START_WITH_CYGWIN#/cygdrive/} + RET=${RET/\//:/} + echo "${RET}" + fi +} + +pushd ${SHELL_DIR}/../ + +source ./config.sh + +# check publish directory +if [ -d "${TARGET_ROOT}" ]; then + # add protocols name to build + export NEED_PUBLISH="protocols":$2 + + # Modify mk file + MK_FILE_PATH="${GAME_PROJECT_DIR}"/jni/Android.mk + ${SHELL_DIR}/modifyMk.sh "${MK_FILE_PATH}" + + # Modify Application.mk file (add stl & rtti configuration) + APP_MK_FILE_PATH="${GAME_PROJECT_DIR}"/jni/Application.mk + ${SHELL_DIR}/modifyAppMk.sh "${APP_MK_FILE_PATH}" + + # Combin ForRes directory to the res directory of game project + GAME_RES_DIR="${GAME_PROJECT_DIR}"/res + ${SHELL_DIR}/modifyRes.sh "${GAME_RES_DIR}" + + # get system dir + SYS_TARGET_ROOT=$(getPathForSystem ${TARGET_ROOT}) + SYS_SHELL_DIR=$(getPathForSystem ${SHELL_DIR}) + SYS_PROJ_DIR=$(getPathForSystem ${GAME_PROJECT_DIR}) + + # Modify .project file (link publish directory to the game project) + PROJECT_FILE_PATH="${SYS_PROJ_DIR}"/.project + python ${SYS_SHELL_DIR}/modifyProject.py "${PROJECT_FILE_PATH}" "${SYS_TARGET_ROOT}" + + # Modify .classpath file (link jar files for game project) + CLASSPATH_FILE="${SYS_PROJ_DIR}"/.classpath + python ${SYS_SHELL_DIR}/modifyClassPath.py "${CLASSPATH_FILE}" "${NEED_PUBLISH}" "${SYS_TARGET_ROOT}" + + # Modify AndroidManifest.xml file (add permission & add activity info) + MANIFEST_FILE="${SYS_PROJ_DIR}"/AndroidManifest.xml + python ${SYS_SHELL_DIR}/modifyManifest.py "${MANIFEST_FILE}" "$2" "${SYS_TARGET_ROOT}" +else + echo "PLZ run the publish.sh script first" + popd + exit 1 +fi + +popd + +exit 0 diff --git a/plugin/tools/toolsForGame/main.py b/plugin/tools/toolsForGame/main.py new file mode 100644 index 0000000000..ae3937359b --- /dev/null +++ b/plugin/tools/toolsForGame/main.py @@ -0,0 +1,139 @@ +import sys, string, os +from Tkinter import * +import steps + +Plugins = sys.argv[1] + +print Plugins + +pluginList = Plugins.split(':') +maxStep = 2 +curStep = 1 + +stepList = [] + +# functions +# show step on the num index +def showStep(num): + global stepList + stepNum = len(stepList) + if num >= stepNum or num <= 0 : + pass + + i = 0 + while i < stepNum: + if i == num: + stepList[i].stepFrame.pack(fill=BOTH, anchor='nw') + else: + stepList[i].stepFrame.pack_forget() + i += 1 + +# update the pre & next buttons status +def updateBtnState(): + global curStep + global btnNextStep + global btnPreStep + if curStep == 1: + btnPreStep['state'] = DISABLED + btnNextStep['state'] = NORMAL + btnNextStep['text'] = 'Next' + elif curStep == maxStep: + btnPreStep['state'] = NORMAL + btnNextStep['state'] = NORMAL + btnNextStep['text'] = 'Finish' + else: + btnPreStep['state'] = NORMAL + btnNextStep['state'] = NORMAL + btnNextStep['text'] = 'Next' + +# next button clicked +def nextStep(): + if btnNextStep['text'] == 'close': + root.quit() + return + + global curStep + nowStepObj = stepList[curStep - 1] + bRet = nowStepObj.checkStep() + if bRet != None: + stepError['text'] = bRet + return + else: + stepError['text'] = '' + + if curStep < maxStep: + curStep += 1 + showStep(curStep - 1) + updateBtnState() + elif curStep == maxStep: + # disable buttons when process + btnPreStep['state'] = DISABLED + btnNextStep['state'] = DISABLED + + # get user input arguments + projPath = stepList[0].getPath() + plugins = stepList[1].getSelectedPlugins() + strPlugins = '' + i = 0 + while i < len(plugins): + strPlugins += "plugins/" + strPlugins += plugins[i] + if i != (len(plugins) - 1): + strPlugins += ':' + i += 1 + + # process shell script to modify the game project + ret = os.system('bash ./toolsForGame/addPluginForGame.sh ' + projPath + ' ' + strPlugins) + + if ret != 0: + # enable buttons after process + btnPreStep['state'] = NORMAL + btnNextStep['state'] = NORMAL + stepError['text'] = 'Error during process' + else: + # enable next button & change text to close + btnNextStep['state'] = NORMAL + btnNextStep['text'] = 'close' + stepError['text'] = 'Process Successful!' + +# pre button clicked +def preStep(): + global curStep + global stepError + stepError['text'] = '' + if curStep > 1: + curStep -= 1 + showStep(curStep - 1) + + updateBtnState() + +# init root view +root = Tk() +root.title('Plugin-x Integration Guide') +root.geometry("600x400") +rootFrame = Frame(root) +rootFrame.pack(fill=BOTH) + +# steps view +MyStep1 = steps.step1() +MyStep1.initStep(rootFrame) +MyStep2 = steps.step2() +MyStep2.initStep(rootFrame, pluginList) +stepList.append(MyStep1) +stepList.append(MyStep2) + +MyStep1.stepFrame.pack(fill=BOTH, anchor='nw') + +# add step error message +controlFrame = Frame(root) +controlFrame.pack(side=BOTTOM, fill=X, anchor='s') +stepError = Label(controlFrame) +stepError.pack(side=LEFT, padx=30) + +# add step button +btnNextStep = Button(controlFrame, text='Next', command=nextStep) +btnPreStep = Button(controlFrame, text='Back', command=preStep, state=DISABLED) +btnNextStep.pack(side=RIGHT, padx=30) +btnPreStep.pack(side=RIGHT) + +root.mainloop() diff --git a/plugin/tools/toolsForGame/modifyAppMK.sh b/plugin/tools/toolsForGame/modifyAppMK.sh new file mode 100755 index 0000000000..fbcad742e4 --- /dev/null +++ b/plugin/tools/toolsForGame/modifyAppMK.sh @@ -0,0 +1,45 @@ +# Modify mk file +MK_FILE_PATH=$1 +TEMP_FILE_PATH=$(dirname ${MK_FILE_PATH})/tempAppMK.txt + +STL_CFG="gnustl_static" +CPP_FLAG="-frtti" + +# check if mk file existed or not +if [ -f ${MK_FILE_PATH} ]; then + gawk ' + BEGIN { addSTL = 1; addRTTI = 1; } + { + if (match($0, /^([\s]*[^#]*)APP_STL[\s]*/)) + { + printf "APP_STL := gnustl_static\n"; + addSTL = 0; + } else + if (match($0, /^([\s]*[^#]*)-frtti/)) + { + printf "%s\n",$0; + addRTTI = 0; + } else + { + printf "%s\n",$0; + } + } + END { + if (addSTL) + { + printf "APP_STL := gnustl_static\n"; + } + + if (addRTTI) + { + printf "APP_CPPFLAGS += -frtti\n"; + } + }' "${MK_FILE_PATH}" > "${TEMP_FILE_PATH}" + cp -rf ${TEMP_FILE_PATH} ${MK_FILE_PATH} + rm -rf ${TEMP_FILE_PATH} +else + echo "APP_STL := ${STL_CFG}" > ${MK_FILE_PATH} + echo "APP_CPPFLAGS += ${CPP_FLAG}" >> ${MK_FILE_PATH} +fi + +exit 0 diff --git a/plugin/tools/toolsForGame/modifyClassPath.py b/plugin/tools/toolsForGame/modifyClassPath.py new file mode 100644 index 0000000000..20c5644ed5 --- /dev/null +++ b/plugin/tools/toolsForGame/modifyClassPath.py @@ -0,0 +1,56 @@ +import sys, string, os +from xml.etree import ElementTree as ET +from xml.dom import minidom + +classPathFile = sys.argv[1] +pluginStr = sys.argv[2] +pluginsDir = sys.argv[3] + +def getLibElement(pathAttr): + ret = ET.Element('classpathentry') + ret.set('exported', 'true') + ret.set('kind', 'lib') + ret.set('path', pathAttr) + return ret + +def fomatTree(elem): + root_str = ET.tostring(elem, 'UTF-8') + reparse = minidom.parseString(root_str) + return reparse + +tree = ET.parse(classPathFile) +root = tree.getroot() +entryNodes = root.findall('classpathentry') +linkedLibs = [] +for node in entryNodes: + entryKind = node.get('kind') + entryPath = node.get('path') + entryKind = entryKind.strip(' \n\r\t') + entryPath = entryPath.strip(' \n\r\t') + if entryKind == 'lib' and entryPath.endswith('.jar'): + linkedLibs.append(entryPath) + +plugins = pluginStr.split(':') +modified = False +for pluginName in plugins: + pluginAndroidDir = pluginsDir + '/' + pluginName + '/android' + + for fileName in os.listdir(pluginAndroidDir): + if os.path.splitext(fileName)[1] == '.jar': + needAdd = True + for linkedJar in linkedLibs: + if -1 != linkedJar.find(fileName): + needAdd = False + break + + if needAdd: + modified = True + pathAttr = 'plugin-x/' + pluginName + '/android/' + fileName + root.append(getLibElement(pathAttr)) + linkedLibs.append(pathAttr) + +if modified: + f = open(classPathFile, 'w') + fomatDom = fomatTree(root) + fomatDom.writexml(f, '', '\t', '\n', 'UTF-8') + f.close() diff --git a/plugin/tools/toolsForGame/modifyMK.sh b/plugin/tools/toolsForGame/modifyMK.sh new file mode 100755 index 0000000000..df547e1ac0 --- /dev/null +++ b/plugin/tools/toolsForGame/modifyMK.sh @@ -0,0 +1,111 @@ +# Modify mk file +MK_FILE_PATH=$1 +TEMP_FILE_PATH=$(dirname ${MK_FILE_PATH})/temp.txt + +############################### +# functions used +############################### +getStaticModuleName() +{ + #get the library file name created by ndk build + #find line with LOCAL_MODULE + _FUN_DEFINED_LINE=`grep 'LOCAL_MODULE[ :]' ${TARGET_ROOT}/$1/android/Android.mk` + + if [ -n "${_FUN_DEFINED_LINE}" ]; then + _FUN_LIB_FILENAME=${_FUN_DEFINED_LINE#*\=} + fi + + _FUN_LIB_FILENAME=`echo ${_FUN_LIB_FILENAME} | sed 's/ //g'` + echo ${_FUN_LIB_FILENAME} +} + +# check if mk file existed or not +if [ -f ${MK_FILE_PATH} ]; then + ADD_MODULE_STR="" + ADD_IMPORT_STR="" + + plugin_name="protocols" + PLUGIN_MODULE_NAME="$(getStaticModuleName ${plugin_name})" + HAVE_PLUGIN=`grep "^\([\s]*[^#]*\)${PLUGIN_MODULE_NAME}" ${MK_FILE_PATH}` + if [ "${HAVE_PLUGIN}" ]; then + # already have this plugin + echo "Plugin ${plugin_name} have added in Android.mk" + continue + else + if [ -z "${ADD_MODULE_STR}" ]; then + ADD_MODULE_STR=${PLUGIN_MODULE_NAME} + else + ADD_MODULE_STR="${ADD_MODULE_STR} ${PLUGIN_MODULE_NAME}" + fi + + NEW_LINE="\$(call import-module,${plugin_name}/android)" + if [ -z "${ADD_IMPORT_STR}" ]; then + ADD_IMPORT_STR=${NEW_LINE} + else + ADD_IMPORT_STR="${ADD_IMPORT_STR}:${NEW_LINE}" + fi + fi + + # Modify the mk file if necessary + if [ "${ADD_MODULE_STR}" ]; then + gawk ' + { + ModuleStr="'"$ADD_MODULE_STR"'"; + ImportStr="'"$ADD_IMPORT_STR"'"; + if (match($0, /^([\s]*[^#]*)LOCAL_WHOLE_STATIC_LIBRARIES/) && ! PROC1) + { + PROC1 = 1; + if (match($0, /\\$/)) + { + printf "%s\n",$0; + printf "%s \\\n",ModuleStr; + } else + { + printf "%s \\\n",$0; + printf "%s\n",ModuleStr; + } + } else + if (match($0, /^([\s]*[^#]*)call[\s]*import-module/) && ! PROC2) + { + printf $0; + split(ImportStr,arr,":") + for (j=0; j ${TEMP_FILE_PATH} + cp -rf ${TEMP_FILE_PATH} ${MK_FILE_PATH} + rm -rf ${TEMP_FILE_PATH} + fi +else + echo "Can't find Android.mk file" +fi + +exit 0 diff --git a/plugin/tools/toolsForGame/modifyManifest.py b/plugin/tools/toolsForGame/modifyManifest.py new file mode 100644 index 0000000000..a66e71ed6a --- /dev/null +++ b/plugin/tools/toolsForGame/modifyManifest.py @@ -0,0 +1,64 @@ +import sys, string, os +from xml.etree import ElementTree as ET + +manifestFile = sys.argv[1] +pluginStr = sys.argv[2] +pluginsDir = sys.argv[3] + +androidNS = 'http://schemas.android.com/apk/res/android' +sourceCfgFile = '/android/ForManifest.xml' + +def doModify(sourceFile, root): + bRet = False + sourceTree = ET.parse(sourceFile) + sourceRoot = sourceTree.getroot() + + # get target content + f = open(manifestFile) + targetContent = f.read() + f.close() + + # check config for application + appCfgNode = sourceRoot.find('applicationCfg') + if appCfgNode is not None and len(appCfgNode) > 0: + appKeyWord = appCfgNode.get('keyword') + + if appKeyWord != None and len(appKeyWord) > 0: + keyIndex = targetContent.find(appKeyWord) + if -1 == keyIndex: + bRet = True + for node in list(appCfgNode): + root.find('application').append(node) + + # check permission config + perCfgNode = sourceRoot.find('permissionCfg') + if perCfgNode is not None and len(perCfgNode) > 0: + for oneNode in list(perCfgNode): + key = '{' + androidNS + '}name' + perAttr = oneNode.get(key) + if perAttr != None and len(perAttr) > 0: + attrIndex = targetContent.find(perAttr) + if -1 == attrIndex: + bRet = True + root.append(oneNode) + + return bRet + +# parse file AndroidManifest.xml of game project +ET.register_namespace("android", androidNS) +targetTree = ET.parse(manifestFile) +targetRoot = targetTree.getroot() + +# traverse all plugins +plugins = pluginStr.split(':') +for pluginName in plugins: + # find the file 'ForManifest.xml' + sourceXml = pluginsDir + '/' + pluginName + sourceCfgFile + if not os.path.exists(sourceXml): + continue + + # check & modify target xml + haveChanged = doModify(sourceXml, targetRoot) + if haveChanged: + print 'Modify AndroidManifest.xml for plugin ' + pluginName + targetTree.write(manifestFile, 'UTF-8') diff --git a/plugin/tools/toolsForGame/modifyProject.py b/plugin/tools/toolsForGame/modifyProject.py new file mode 100644 index 0000000000..9a4becc5b7 --- /dev/null +++ b/plugin/tools/toolsForGame/modifyProject.py @@ -0,0 +1,44 @@ +import sys, string, os +from xml.etree import ElementTree as ET +from xml.dom import minidom + +projFile = sys.argv[1] +targetPath = sys.argv[2] + +def getLinkElement(): + global targetPath + ret = ET.Element('link') + nameEle = ET.Element('name') + nameEle.text = 'plugin-x' + typeEle = ET.Element('type') + typeEle.text = '2' + locEle = ET.Element('locationURI') + locEle.text = targetPath + ret.append(nameEle) + ret.append(typeEle) + ret.append(locEle) + + return ret + +tree = ET.parse(projFile) +root = tree.getroot() +nodeLinkRes = root.find('linkedResources') +if nodeLinkRes != None: + linkNodes = nodeLinkRes.findall('link') + haveTarget = False + if linkNodes != None and len(linkNodes) > 0: + for node in linkNodes: + locNode = node.find('locationURI') + tempText = locNode.text + tempText = tempText.strip(' \n\r\t') + if tempText == targetPath: + haveTarget = True + break + if not haveTarget: + nodeLinkRes.append(getLinkElement()) + tree.write(projFile, 'UTF-8') +else: + linkResEle = ET.Element('linkedResources') + linkResEle.append(getLinkElement()) + root.append(linkResEle) + tree.write(projFile, 'UTF-8') diff --git a/plugin/tools/toolsForGame/modifyRes.sh b/plugin/tools/toolsForGame/modifyRes.sh new file mode 100755 index 0000000000..1ffcccc48d --- /dev/null +++ b/plugin/tools/toolsForGame/modifyRes.sh @@ -0,0 +1,10 @@ +SELECTED_PLUGINS=(${NEED_PUBLISH//:/ }) +for plugin_name in ${SELECTED_PLUGINS[@]} +do + SRC_RES_DIR=${TARGET_ROOT}/${plugin_name}/android/ForRes + if [ -d "${SRC_RES_DIR}" ]; then + cp -rf "${SRC_RES_DIR}"/* $1 + fi +done + +exit 0 diff --git a/plugin/tools/toolsForGame/steps.py b/plugin/tools/toolsForGame/steps.py new file mode 100644 index 0000000000..6f2013402b --- /dev/null +++ b/plugin/tools/toolsForGame/steps.py @@ -0,0 +1,75 @@ +import sys, string, os +from Tkinter import * + +# define class step +class step: + stepFrame = None + def initStep(self, root): + return + + def checkStep(self): + return None + +# define class step1 +class step1(step): + step_entry = None + def initStep(self, root): + self.stepFrame = Frame(root) + + step_tip = Label(self.stepFrame, text="Input the android project path of your game:") + step_tip.pack(anchor='nw', padx=30) + step_tip2 = Label(self.stepFrame, text="(Please keep your game project path away from spaces)") + step_tip2.pack(anchor='nw', padx=30) + self.step_entry = Entry(self.stepFrame) + self.step_entry.pack(anchor='nw', fill=X, padx=30) + return + + def checkStep(self): + tipStr = None + projPath = self.step_entry.get() + haveDir = os.path.exists(projPath) + isPorj = os.path.exists(projPath + '/AndroidManifest.xml') + if projPath == None or len(projPath) == 0 or haveDir == False or isPorj == False: + tipStr = 'The project path is wrong' + return tipStr + + def getPath(self): + return self.step_entry.get() + +# define class step2 +class step2(step): + checkBtns = [] + checkValues = [] + def initStep(self, root, pluginList): + self.stepFrame = Frame(root) + + step_tip = Label(self.stepFrame, text="Select plugins you needed:") + step_tip.pack(anchor='nw', padx=30) + + for plugin in pluginList: + var = StringVar() + self.checkValues.append(var) + btn = Checkbutton(self.stepFrame, text=plugin, variable=var, onvalue=plugin, offvalue='') + btn.pack(anchor='nw', padx=50) + self.checkBtns.append(btn) + return + + def checkStep(self): + tipStr = None + num = 0 + for var in self.checkValues: + if len(var.get()) != 0: + num += 1 + break + + if num == 0: + tipStr = 'At least select one plugin' + return tipStr + + def getSelectedPlugins(self): + selectPlugins = [] + for var in self.checkValues: + if len(var.get()) != 0: + plugin = var.get() + selectPlugins.append(plugin) + return selectPlugins diff --git a/plugin/tools/toolsForPublish/checkEnvironment.sh b/plugin/tools/toolsForPublish/checkEnvironment.sh new file mode 100755 index 0000000000..e4b50640c7 --- /dev/null +++ b/plugin/tools/toolsForPublish/checkEnvironment.sh @@ -0,0 +1,78 @@ +#set android_build_path.sh 's path +BUILD_PATH_FILE_DIR=$(cd "$(dirname "$0")"; pwd) +BUILD_PATH_FILE_NAME="environment.sh" +BUILD_PATH_FILE_PATH=$BUILD_PATH_FILE_DIR$BUILD_PATH_FILE_NAME + +changeDirFormat() +{ + TEMP="${1/:/}" + if [ $1 != $TEMP ]; then + RET=/cygdrive/$TEMP + else + RET=$1 + fi + + RET="${RET//\\//}" + END_CHAR=${RET:$((${#RET}-1)):1} + if [ ${END_CHAR} = "/" ]; then + RET=${RET%/} + fi + + echo "${RET}" +} + +pushd $BUILD_PATH_FILE_DIR +echo + +# if $BUILD_PATH_FILE is not exist, then create it. +if [ ! -f $BUILD_PATH_FILE_NAME ];then + + # read android ndk path from user input + while true + do + echo "Please input the android-ndk path:" + read ANDROID_NDK_PATH + ANDROID_NDK_PATH="$(changeDirFormat ${ANDROID_NDK_PATH})" + if [ -d "$ANDROID_NDK_PATH" ];then + echo "Get ANDROID_NDK_ROOT=$ANDROID_NDK_PATH" + echo + break + fi + echo "$ANDROID_NDK_PATH is not exist!!!" + done + + # read android sdk path from user input + while true + do + echo "Please input the andoid-sdk path:" + read ANDROID_SDK_PATH + INPUT_SDK_PATH=${ANDROID_SDK_PATH} + ANDROID_SDK_PATH="$(changeDirFormat ${ANDROID_SDK_PATH})" + if [ -d "$ANDROID_SDK_PATH" ];then + echo "Get ANDROID_SDK_ROOT=$ANDROID_SDK_PATH" + echo + break + fi + echo "$ANDROID_SDK_PATH is not exist!!!" + done + + while true + do + echo "Please input the ant tool path(such as '/Users/MyAccount/tools/ant/bin'):" + read ANT_PATH + ANT_PATH="$(changeDirFormat ${ANT_PATH})" + if [ -d "$ANT_PATH" ];then + echo "Get ANT_PATH=$ANT_PATH" + echo + break + fi + echo "$ANT_PATH is not exist!!!" + done + + echo export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH > $BUILD_PATH_FILE_NAME + echo export ANDROID_SDK_ROOT=$ANDROID_SDK_PATH >> $BUILD_PATH_FILE_NAME + echo export ANT_PATH=$ANT_PATH >> $BUILD_PATH_FILE_NAME + echo export INPUT_SDK_PATH=$INPUT_SDK_PATH >> $BUILD_PATH_FILE_NAME +fi + +popd diff --git a/plugin/tools/toolsForPublish/genPrebuildMK.sh b/plugin/tools/toolsForPublish/genPrebuildMK.sh new file mode 100755 index 0000000000..461d490620 --- /dev/null +++ b/plugin/tools/toolsForPublish/genPrebuildMK.sh @@ -0,0 +1,31 @@ +SOURCE_FILE_NAME=$1 +TARGET_FILE_NAME=$2 + +echo "LOCAL_PATH := \$(call my-dir)" > ${TARGET_FILE_NAME} +echo "" >> ${TARGET_FILE_NAME} +echo "include \$(CLEAR_VARS)" >> ${TARGET_FILE_NAME} + +MODULE_NAME=`cat ${SOURCE_FILE_NAME} | grep LOCAL_MODULE[^_]` +MODULE_FILENAME=`cat ${SOURCE_FILE_NAME} | grep LOCAL_MODULE_FILENAME` + +if [ -n "${MODULE_NAME}" ]; then +echo ${MODULE_NAME} >> ${TARGET_FILE_NAME} +fi + +if [ -n "${MODULE_FILENAME}" ]; then +echo ${MODULE_FILENAME} >> ${TARGET_FILE_NAME} +LIB_FILENAME=${MODULE_FILENAME#*\=} +else +LIB_FILENAME=${MODULE_NAME#*\=} +fi +LIB_FILENAME=`echo ${LIB_FILENAME} | sed 's/ //g'` +LIB_FILENAME=${LIB_FILENAME}.a + +echo "" >> ${TARGET_FILE_NAME} + +echo "LOCAL_SRC_FILES := ./"${LIB_FILENAME} >> ${TARGET_FILE_NAME} +echo "LOCAL_EXPORT_C_INCLUDES := \$(LOCAL_PATH)/../include \$(LOCAL_PATH)" >> ${TARGET_FILE_NAME} +echo "LOCAL_EXPORT_LDLIBS := -llog" >> ${TARGET_FILE_NAME} + +echo "" >> ${TARGET_FILE_NAME} +echo "include \$(PREBUILT_STATIC_LIBRARY)" >> ${TARGET_FILE_NAME} diff --git a/plugin/tools/toolsForPublish/publishPlugin.sh b/plugin/tools/toolsForPublish/publishPlugin.sh new file mode 100755 index 0000000000..82878c9646 --- /dev/null +++ b/plugin/tools/toolsForPublish/publishPlugin.sh @@ -0,0 +1,133 @@ +plugin_name=$1 +TARGET_DIR=$2/${plugin_name} +PLUGIN_ROOT=$3 + +ANDROID_PROJ_DIR=${PLUGIN_ROOT}/${plugin_name}/proj.android +echo target dir is ${TARGET_DIR} +echo android project dir is ${ANDROID_PROJ_DIR} + +#create directory for plugin +mkdir -p ${TARGET_DIR} + +############################### +# functions used +############################### +getLibraryFileName() +{ + #get the library file name created by ndk build + #fine line with LOCAL_MODULE_FILENAME + DEFINED_FILENAME_LINE=`cat ./jni/Android.mk | grep LOCAL_MODULE_FILENAME` + + if [ -n "${DEFINED_FILENAME_LINE}" ]; then + LIB_FILENAME=${DEFINED_FILENAME_LINE#*\=} + else + DEFINED_MODULE_LINE=`cat ./jni/Android.mk | grep LOCAL_MODULE ` + LIB_FILENAME=${DEFINED_MODULE_LINE#*\=} + LIB_FILENAME=lib${LIB_FILENAME} + fi + + LIB_FILENAME=`echo ${LIB_FILENAME} | sed 's/ //g'` + LIB_FILENAME=${LIB_FILENAME}.a + echo ${LIB_FILENAME} +} + +getPathForAnt() +{ + START_WITH_CYGWIN=`echo $1 | grep '^/cygdrive/'` + if [ -z "${START_WITH_CYGWIN}" ]; then + echo "$1" + else + RET=${START_WITH_CYGWIN#/cygdrive/} + RET=${RET/\//:/} + echo "${RET}" + fi +} + +echo +echo "Publish plugin for android" + +pushd ${ANDROID_PROJ_DIR} + +#check local.properties file +LOACL_FILE_NAME=local.properties +if [ -f ${LOACL_FILE_NAME} ]; then + DEFINED_SDK_DIR=`grep sdk.dir= ./${LOACL_FILE_NAME}` + if [ -z "${DEFINED_SDK_DIR}" ]; then + ANT_SDK_DIR="$(getPathForAnt ${INPUT_SDK_PATH})" + echo "sdk.dir=${ANT_SDK_DIR}" >> ${LOACL_FILE_NAME} + fi + + DEFINED_PLUGIN_DIR=`grep plugin.dir= ./${LOACL_FILE_NAME}` + if [ -z "${DEFINED_PLUGIN_DIR}" ]; then + ANT_PLUGIN_ROOT_DIR="$(getPathForAnt ${PLUGIN_ROOT})" + echo "plugin.dir=${ANT_PLUGIN_ROOT_DIR}" >> ${LOACL_FILE_NAME} + fi +else + ANT_SDK_DIR="$(getPathForAnt ${INPUT_SDK_PATH})" + echo "sdk.dir=${ANT_SDK_DIR}" > ${LOACL_FILE_NAME} + ANT_PLUGIN_ROOT_DIR="$(getPathForAnt ${PLUGIN_ROOT})" + echo "plugin.dir=${ANT_PLUGIN_ROOT_DIR}" >> ${LOACL_FILE_NAME} +fi + +#invoke ant build of plugin +${ANT_PATH}/ant -q clean +${ANT_PATH}/ant -q plugin-publish + +#copy .jar files to target directory +mkdir -p ${TARGET_DIR}/android +cp -rf ${ANDROID_PROJ_DIR}/bin/*.jar ${TARGET_DIR}/android +if [ -d ${ANDROID_PROJ_DIR}/sdk ]; then + cp -rf ${ANDROID_PROJ_DIR}/sdk/*.jar ${TARGET_DIR}/android +fi + +#copy android depend on project to publish directory +if [ -d "${ANDROID_PROJ_DIR}/DependProject" ]; then + cp -rf "${ANDROID_PROJ_DIR}/DependProject" "${TARGET_DIR}/android" +fi + +#copy ForManifest.xml file to publish directory +if [ -f "${ANDROID_PROJ_DIR}/ForManifest.xml" ]; then + cp -rf "${ANDROID_PROJ_DIR}/ForManifest.xml" "${TARGET_DIR}/android" +fi + +#copy ForRes directory to publish directory +if [ -d "${ANDROID_PROJ_DIR}/ForRes" ]; then + cp -rf "${ANDROID_PROJ_DIR}/ForRes" "${TARGET_DIR}/android" +fi + +#copy ForAssets directory to publish directory +if [ -d "${ANDROID_PROJ_DIR}/ForAssets" ]; then + cp -rf "${ANDROID_PROJ_DIR}/ForAssets" "${TARGET_DIR}/android" +fi + +#Build C++ code +BUILD_CPLUSPLUS=$4 +if [ $BUILD_CPLUSPLUS ]; then + + echo "Build C++ code" + + #create include directory + mkdir -p ${TARGET_DIR}/include + cp -rf ${PLUGIN_ROOT}/${plugin_name}/include/* ${TARGET_DIR}/include + + #copy android include files + ADNROID_SOURCE_DIR=${PLUGIN_ROOT}/${plugin_name}/platform/android + if [ -d ${ADNROID_SOURCE_DIR} ]; then + HAVE_HEADER_FILE=`find ${ADNROID_SOURCE_DIR} -name "*.h"` + if [ -n "${HAVE_HEADER_FILE}" ]; then + cp -rf ${ADNROID_SOURCE_DIR}/*.h "${TARGET_DIR}/android" + fi + fi + + #invoke ndk build for plugin project + if [ -f "${ANDROID_PROJ_DIR}/build_native.sh" ]; then + ./build_native.sh + LIB_FILE="$(getLibraryFileName)" + cp -rf "${ANDROID_PROJ_DIR}/obj/local/armeabi/${LIB_FILE}" "${TARGET_DIR}/android" + fi + + #generate mk file for prebuild + ${PLUGIN_ROOT}/tools/toolsForPublish/genPrebuildMK.sh ${ANDROID_PROJ_DIR}/jni/Android.mk ${TARGET_DIR}/android/Android.mk +fi + +popd diff --git a/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.cpp b/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.cpp index 5ee8baf50e..a55bc9a08c 100644 --- a/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.cpp +++ b/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.cpp @@ -77,6 +77,7 @@ UpdateLayer::UpdateLayer() : pItemEnter(NULL) , pItemReset(NULL) , pItemUpdate(NULL) +, pProgressLabel(NULL) , isUpdateItemClicked(false) { init(); @@ -90,6 +91,8 @@ UpdateLayer::~UpdateLayer() void UpdateLayer::update(cocos2d::CCObject *pSender) { + pProgressLabel->setString(""); + // update resources getAssetsManager()->update(); @@ -98,6 +101,8 @@ void UpdateLayer::update(cocos2d::CCObject *pSender) void UpdateLayer::reset(cocos2d::CCObject *pSender) { + pProgressLabel->setString(" "); + // Remove downloaded files #if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32) string command = "rm -r "; @@ -152,6 +157,10 @@ bool UpdateLayer::init() menu->setPosition(ccp(0,0)); addChild(menu); + pProgressLabel = CCLabelTTF::create("", "Arial", 20); + pProgressLabel->setPosition(ccp(100, 50)); + addChild(pProgressLabel); + return true; } @@ -164,6 +173,8 @@ AssetsManager* UpdateLayer::getAssetsManager() pAssetsManager = new AssetsManager("https://raw.github.com/minggo/AssetsManagerTest/master/package.zip", "https://raw.github.com/minggo/AssetsManagerTest/master/version", pathToSave.c_str()); + pAssetsManager->setDelegate(this); + pAssetsManager->setConnectionTimeout(3); } return pAssetsManager; @@ -190,3 +201,28 @@ void UpdateLayer::createDownloadedDir() } #endif } + +void UpdateLayer::onError(AssetsManager::ErrorCode errorCode) +{ + if (errorCode == AssetsManager::kNoNewVersion) + { + pProgressLabel->setString("no new version"); + } + + if (errorCode == AssetsManager::kNetwork) + { + pProgressLabel->setString("network error"); + } +} + +void UpdateLayer::onProgress(int percent) +{ + char progress[20]; + snprintf(progress, 20, "downloading %d%%", percent); + pProgressLabel->setString(progress); +} + +void UpdateLayer::onSuccess() +{ + pProgressLabel->setString("download ok"); +} diff --git a/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.h b/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.h index 2ba7962527..21b7dd0bf1 100644 --- a/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.h +++ b/samples/Cpp/AssetsManagerTest/Classes/AppDelegate.h @@ -44,7 +44,7 @@ public: virtual void applicationWillEnterForeground(); }; -class UpdateLayer : public cocos2d::CCLayer +class UpdateLayer : public cocos2d::CCLayer, public cocos2d::extension::AssetsManagerDelegateProtocol { public: UpdateLayer(); @@ -54,6 +54,10 @@ public: void enter(cocos2d::CCObject *pSender); void reset(cocos2d::CCObject *pSender); void update(cocos2d::CCObject *pSender); + + virtual void onError(cocos2d::extension::AssetsManager::ErrorCode errorCode); + virtual void onProgress(int percent); + virtual void onSuccess(); private: cocos2d::extension::AssetsManager* getAssetsManager(); @@ -62,6 +66,7 @@ private: cocos2d::CCMenuItemFont *pItemEnter; cocos2d::CCMenuItemFont *pItemReset; cocos2d::CCMenuItemFont *pItemUpdate; + cocos2d::CCLabelTTF *pProgressLabel; std::string pathToSave; bool isUpdateItemClicked; }; diff --git a/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp index 74f3364ff6..b24efba989 100644 --- a/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/AssetsManagerTest/proj.android/jni/hellocpp/main.cpp @@ -28,6 +28,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -38,6 +39,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/AssetsManagerTest/proj.ios/AssetsManagerTest.xcodeproj/project.pbxproj b/samples/Cpp/AssetsManagerTest/proj.ios/AssetsManagerTest.xcodeproj/project.pbxproj index 1063002b0e..844e0e7727 100644 --- a/samples/Cpp/AssetsManagerTest/proj.ios/AssetsManagerTest.xcodeproj/project.pbxproj +++ b/samples/Cpp/AssetsManagerTest/proj.ios/AssetsManagerTest.xcodeproj/project.pbxproj @@ -300,7 +300,6 @@ 46A2143916D4ABFD00723F2B /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = ""; }; 46A2143A16D4ABFD00723F2B /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = ""; }; 46A2143B16D4ABFD00723F2B /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = ""; }; - 46A2143C16D4ABFD00723F2B /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = ""; }; 46A2146016D4B04A00723F2B /* Background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Background.png; sourceTree = ""; }; /* End PBXFileReference section */ @@ -647,7 +646,6 @@ 46A2143916D4ABFD00723F2B /* ScriptingCore.cpp */, 46A2143A16D4ABFD00723F2B /* ScriptingCore.h */, 46A2143B16D4ABFD00723F2B /* spidermonkey_specifics.h */, - 46A2143C16D4ABFD00723F2B /* uthash.h */, ); name = bindings; path = ../../../../scripting/javascript/bindings; @@ -950,6 +948,7 @@ "$(SRCROOT)/../../../../extensions", ); INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../..//cocos2dx/platform/third_party/ios/libraries\"", @@ -958,7 +957,6 @@ "\"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/lib\"", ); OTHER_LDFLAGS = ( - "-lxml2", "-lz", "-lsqlite3", ); @@ -995,6 +993,7 @@ "$(SRCROOT)/../../../../extensions", ); INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/../../../..//cocos2dx/platform/third_party/ios/libraries\"", @@ -1003,7 +1002,6 @@ "\"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/lib\"", ); OTHER_LDFLAGS = ( - "-lxml2", "-lz", "-lsqlite3", ); diff --git a/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj b/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj index dc350472af..b5b85b5448 100644 --- a/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj +++ b/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj @@ -75,7 +75,7 @@ Disabled - $(ProjectDir)..\Classes;$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\..\extensions;$(ProjectDir)..\..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\..\cocos2dx;$(ProjectDir)..\..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\..\extensions;$(ProjectDir)..\..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\..\cocos2dx;$(ProjectDir)..\..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\pthread;$(ProjectDir)..\..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks diff --git a/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp index 035fb201c4..4cca6056b3 100644 --- a/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/HelloCpp/proj.android/jni/hellocpp/main.cpp @@ -3,7 +3,7 @@ #include #include -#include "HelloWorldScene.h" +#include "cocos2d.h" #define LOG_TAG "main" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/HelloCpp/proj.emscripten/Makefile b/samples/Cpp/HelloCpp/proj.emscripten/Makefile new file mode 100644 index 0000000000..02ba3439e1 --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.emscripten/Makefile @@ -0,0 +1,51 @@ +EXECUTABLE = HelloCpp + +INCLUDES = -I.. -I../Classes + +SOURCES = main.cpp \ + ../Classes/AppDelegate.cpp \ + ../Classes/HelloWorldScene.cpp + +RESOURCE_PATH = ../Resources/iphone + +RESOURCES = CloseNormal.png \ + CloseSelected.png \ + HelloWorld.png + +FONT_PATH = ../Resources/fonts + +COCOS_ROOT = ../../../.. +include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk + +SHAREDLIBS += -lcocos2d +COCOS_LIBS = $(LIB_DIR)/libcocos2d.so + +$(TARGET).js: $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) + +$(TARGET).data: + @mkdir -p $(@D) + $(eval RESTMP := $(shell mktemp -d /tmp/cocos-emscripten.XXXXXX)) + # Always need a font path, so ensure that it is created first. + mkdir -p $(RESTMP)/fonts + (cd $(RESOURCE_PATH) && cp -a $(RESOURCES) $(RESTMP)) + (cd $(FONT_PATH) && cp -a * $(RESTMP)/fonts) + # NOTE: we copy the system arial.ttf so that there is always a fallback. + cp /Library/Fonts/Arial.ttf $(RESTMP)/fonts/arial.ttf + (cd $(RESTMP); python $(PACKAGER) $(EXECUTABLE).data $(patsubst %,--preload %,$(RESOURCES)) --preload fonts --pre-run > $(EXECUTABLE).data.js) + mv $(RESTMP)/$(EXECUTABLE).data $@ + mv $(RESTMP)/$(EXECUTABLE).data.js $@.js + rm -rf $(RESTMP) + +$(BIN_DIR)/index.html: index.html + @mkdir -p $(@D) + cp index.html $(@D) + +$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ diff --git a/samples/Cpp/HelloCpp/proj.emscripten/index.html b/samples/Cpp/HelloCpp/proj.emscripten/index.html new file mode 100644 index 0000000000..b8befe726a --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.emscripten/index.html @@ -0,0 +1,93 @@ + + + + + + Emscripten-Generated Code + + + +


+
Downloading...
+
+ +
+
+ +
+
+
+ Resize canvas + Lock/hide mouse pointer +     + +
+ +
+ +
+ + + + + diff --git a/samples/Cpp/HelloCpp/proj.emscripten/main.cpp b/samples/Cpp/HelloCpp/proj.emscripten/main.cpp new file mode 100644 index 0000000000..380029e877 --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.emscripten/main.cpp @@ -0,0 +1,19 @@ +#include "../Classes/AppDelegate.h" +#include "cocos2d.h" + +#include +#include +#include +#include + +USING_NS_CC; + +int main(int argc, char **argv) +{ + // create the application instance + AppDelegate app; + + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + + return CCApplication::sharedApplication()->run(); +} diff --git a/samples/Cpp/HelloCpp/proj.tizen/.cproject b/samples/Cpp/HelloCpp/proj.tizen/.cproject new file mode 100644 index 0000000000..c145fac350 --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.tizen/.cproject @@ -0,0 +1,771 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/Cpp/HelloCpp/proj.tizen/.project b/samples/Cpp/HelloCpp/proj.tizen/.project new file mode 100644 index 0000000000..65d8f547ac --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.tizen/.project @@ -0,0 +1,95 @@ + + + HelloCpp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + sbi-make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/proj.tizen/Debug-Tizen-Emulator} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + org.tizen.nativecpp.apichecker.core.builder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecpp.apichecker.core.tizenCppNature + + + + src/Classes + 2 + PARENT-1-PROJECT_LOC/Classes + + + diff --git a/samples/Cpp/HelloCpp/proj.tizen/README.mdown b/samples/Cpp/HelloCpp/proj.tizen/README.mdown new file mode 100644 index 0000000000..f71f9abaad --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.tizen/README.mdown @@ -0,0 +1,6 @@ +HelloCpp for Tizen +================== + + * Create Tizen IDE workspace in cocos2d-x/samples/Cpp/HelloCpp + * Import proj.tizen + * Copy cocos2d-x/samples/Cpp/HelloCpp/Resources/*.* to cocos2d-x/samples/Cpp/HelloCpp/proj.tizen/res diff --git a/samples/Cpp/HelloCpp/proj.tizen/manifest.xml b/samples/Cpp/HelloCpp/proj.tizen/manifest.xml new file mode 100644 index 0000000000..47bac55e37 --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.tizen/manifest.xml @@ -0,0 +1,25 @@ + + + chzfHkPFS6 + 1.0.0 + C++App + + true + true + + + 2.1 + + + + + + HelloCpp + + + mainmenu.png + + + + + diff --git a/samples/Cpp/HelloCpp/proj.tizen/res/placeholder.txt b/samples/Cpp/HelloCpp/proj.tizen/res/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/samples/Cpp/HelloCpp/proj.tizen/src/HelloCppEntry.cpp b/samples/Cpp/HelloCpp/proj.tizen/src/HelloCppEntry.cpp new file mode 100644 index 0000000000..daf6c0a719 --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.tizen/src/HelloCppEntry.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +/** + * This file contains the Tizen C++ application entry point. + */ +#include "../../Classes/AppDelegate.h" +#include "cocos2d.h" + +USING_NS_CC; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +_EXPORT_ int OspMain(int argc, char* pArgv[]); +void ApplicationInitialized(void); + +/** + * The entry function of Tizen C++ application called by the operating system. + */ +int +OspMain(int argc, char* pArgv[]) +{ + AppLog("Application started."); + ArrayList args; + args.Construct(); + + for (int i = 0; i < argc; i++) + { + args.Add(*(new (std::nothrow) String(pArgv[i]))); + } + + CCOspApplication::SetApplicationInitializedCallback(ApplicationInitialized); + result r = Tizen::App::Application::Execute(CCOspApplication::CreateInstance, &args); + + TryLog(r == E_SUCCESS, "[%s] Application execution failed", GetErrorMessage(r)); + + args.RemoveAll(true); + AppLog("Application finished."); + + return static_cast(r); +} + +void +ApplicationInitialized(void) +{ + AppDelegate* pAppDelegate = new AppDelegate; + + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + eglView->setFrameSize(720, 1280); + + CCApplication::sharedApplication()->run(); +} + + +#ifdef __cplusplus +} +#endif // __cplusplus diff --git a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp index 24c83f4ab3..b164218924 100644 --- a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp +++ b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp @@ -58,7 +58,7 @@ void AppDelegate::applicationDidEnterBackground() { CCDirector::sharedDirector()->stopAnimation(); // if you use SimpleAudioEngine, it must be pause - // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + // CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); } // this function will be called when the app is active again @@ -66,5 +66,5 @@ void AppDelegate::applicationWillEnterForeground() { CCDirector::sharedDirector()->startAnimation(); // if you use SimpleAudioEngine, it must resume here - // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); + // CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); } diff --git a/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp b/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp index 035fb201c4..d2731fd336 100644 --- a/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp +++ b/samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp @@ -30,6 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } + /* else { ccDrawInit(); @@ -40,6 +41,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } + */ } } diff --git a/samples/Cpp/SimpleGame/proj.blackberry/.cproject b/samples/Cpp/SimpleGame/proj.blackberry/.cproject index 834e339dcd..bb35fdd0fd 100644 --- a/samples/Cpp/SimpleGame/proj.blackberry/.cproject +++ b/samples/Cpp/SimpleGame/proj.blackberry/.cproject @@ -25,6 +25,7 @@
- + - + - +