From 9eec2d69eedd2f8bb0aef47a10772faba23db285 Mon Sep 17 00:00:00 2001 From: Sergey Buravtsov Date: Mon, 1 Oct 2012 16:08:11 +0400 Subject: [PATCH 01/95] Fix removeTileAt crash corresponding this post: http://www.cocos2d-x.org/boards/6/topics/4336 --- cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 8683e9120b..3dd1d9b27b 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -641,9 +641,9 @@ void CCSpriteBatchNode::removeSpriteFromAtlas(CCSprite *pobSprite) m_pobDescendants->removeObjectAtIndex(uIndex); // update all sprites beyond this one - unsigned int count = m_pobDescendants->count(); + unsigned int count = uIndex; // we will update items from the beginning to uIndex as m_pobDescendants is in ascending order - for(; uIndex < count; ++uIndex) + for(uIndex = 0; uIndex < count; ++uIndex) { CCSprite* s = (CCSprite*)(m_pobDescendants->objectAtIndex(uIndex)); s->setAtlasIndex( s->getAtlasIndex() - 1 ); From 1c0240b5de2561704899508e555e2b88d852ffce Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 22 Oct 2012 13:48:11 +0800 Subject: [PATCH 02/95] fixed #1493: Added doxygen comments in CCNotificationCenter.h --- cocos2dx/support/CCNotificationCenter.cpp | 4 +- cocos2dx/support/CCNotificationCenter.h | 54 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/cocos2dx/support/CCNotificationCenter.cpp b/cocos2dx/support/CCNotificationCenter.cpp index 2fe860a129..0a9e63974e 100644 --- a/cocos2dx/support/CCNotificationCenter.cpp +++ b/cocos2dx/support/CCNotificationCenter.cpp @@ -29,7 +29,7 @@ THE SOFTWARE. using namespace std; -NS_CC_BEGIN; +NS_CC_BEGIN static CCNotificationCenter *s_sharedNotifCenter = NULL; @@ -214,4 +214,4 @@ CCObject *CCNotificationObserver::getObject() return m_object; } -NS_CC_END; +NS_CC_END diff --git a/cocos2dx/support/CCNotificationCenter.h b/cocos2dx/support/CCNotificationCenter.h index 183c5f7020..df0cd49cb5 100644 --- a/cocos2dx/support/CCNotificationCenter.h +++ b/cocos2dx/support/CCNotificationCenter.h @@ -28,38 +28,71 @@ THE SOFTWARE. #include "cocoa/CCObject.h" #include "cocoa/CCArray.h" -NS_CC_BEGIN; +NS_CC_BEGIN class CC_DLL CCNotificationCenter : public CCObject { public: + /* CCNotificationCenter constructor */ CCNotificationCenter(); + + /* CCNotificationCenter destructor */ ~CCNotificationCenter(); + /* Get the single instance of CCNotificationCenter. */ static CCNotificationCenter *sharedNotificationCenter(void); + + /* Destroy the single instance of CCNotificationCenter. */ static void purgeNotificationCenter(void); + /* @brief Add an observer for the specified target. + * @param target The target which want to be observed. + * @param selector The callback function which will be invoked when the specified notification event was posted. + * @param name The name of notification. + * @param obj The extra parameter which will be passed to the callback function. + */ void addObserver(CCObject *target, SEL_CallFuncO selector, const char *name, CCObject *obj); - + + /* @brief Remove the observer for the specified target. + * @param target The target which will not be observed any more. + * @param name The notification name which will not be observed any more. + */ void removeObserver(CCObject *target,const char *name); + /* @brief Register one hander for script binding. + * @note Only support Lua Binding now. + * @param handler The lua handler. + */ void registerScriptObserver(int handler); + + /* Unregister script observer */ void unregisterScriptObserver(void); + /* brief Post one notification event by name. + * param name The name of this notification. + */ void postNotification(const char *name); + + /* brief Post one notification event by name. + * param name The name of this notification. + * param object The extra parameter. + */ void postNotification(const char *name, CCObject *object); + /* brief Get script handler. + * note Only support Lua Binding now. + * return The script handle. + */ inline int getScriptHandler() { return m_scriptHandler; }; private: - // // internal functions - // + + // Check whether the observer exists by the specified target and name. bool observerExisted(CCObject *target,const char *name); - // // variables // CCArray *m_observers; @@ -69,12 +102,21 @@ private: class CC_DLL CCNotificationObserver : public CCObject { public: + /* brief Observer constructor + * @param target The target which want to be observed. + * @param selector The callback function which will be invoked when the specified notification event was posted. + * @param name The name of notification. + * @param obj The extra parameter which will be passed to the callback function. + */ CCNotificationObserver(CCObject *target, SEL_CallFuncO selector, const char *name, CCObject *obj); + + /* Observer destructor function */ ~CCNotificationObserver(); + /* Invoke the callback function of this observer */ void performSelector(CCObject *obj); private: CC_PROPERTY_READONLY(CCObject *, m_target, Target); @@ -83,6 +125,6 @@ private: CC_PROPERTY_READONLY(CCObject *, m_object, Object); }; -NS_CC_END; +NS_CC_END #endif//__CCNOTIFICATIONCENTER_H__ \ No newline at end of file From 6f4e56cd923c36828db15693b18b8e8c0c7c721c Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 22 Oct 2012 15:49:33 +0800 Subject: [PATCH 03/95] fixed #1493: Corrected some comments for CCNotificationCenter. --- cocos2dx/support/CCNotificationCenter.h | 62 ++++++++++++------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/cocos2dx/support/CCNotificationCenter.h b/cocos2dx/support/CCNotificationCenter.h index df0cd49cb5..c3aaea43ec 100644 --- a/cocos2dx/support/CCNotificationCenter.h +++ b/cocos2dx/support/CCNotificationCenter.h @@ -33,58 +33,58 @@ NS_CC_BEGIN class CC_DLL CCNotificationCenter : public CCObject { public: - /* CCNotificationCenter constructor */ + /** CCNotificationCenter constructor */ CCNotificationCenter(); - /* CCNotificationCenter destructor */ + /** CCNotificationCenter destructor */ ~CCNotificationCenter(); - /* Get the single instance of CCNotificationCenter. */ + /** Gets the single instance of CCNotificationCenter. */ static CCNotificationCenter *sharedNotificationCenter(void); - /* Destroy the single instance of CCNotificationCenter. */ + /** Destroys the single instance of CCNotificationCenter. */ static void purgeNotificationCenter(void); - /* @brief Add an observer for the specified target. - * @param target The target which want to be observed. - * @param selector The callback function which will be invoked when the specified notification event was posted. - * @param name The name of notification. - * @param obj The extra parameter which will be passed to the callback function. + /** @brief Adds an observer for the specified target. + * @param target The target which wants to observe notification events. + * @param selector The callback function which will be invoked when the specified notification event was posted. + * @param name The name of notification. + * @param obj The extra parameter which will be passed to the callback function. */ void addObserver(CCObject *target, SEL_CallFuncO selector, const char *name, CCObject *obj); - /* @brief Remove the observer for the specified target. - * @param target The target which will not be observed any more. - * @param name The notification name which will not be observed any more. + /** @brief Removes the observer by the specified target and name. + * @param target The target of this notification. + * @param name The name of this notification. */ void removeObserver(CCObject *target,const char *name); - /* @brief Register one hander for script binding. - * @note Only support Lua Binding now. - * @param handler The lua handler. + /** @brief Registers one hander for script binding. + * @note Only support Lua Binding now. + * @param handler The lua handler. */ void registerScriptObserver(int handler); - /* Unregister script observer */ + /** Unregisters script observer */ void unregisterScriptObserver(void); - /* brief Post one notification event by name. - * param name The name of this notification. + /** @brief Posts one notification event by name. + * @param name The name of this notification. */ void postNotification(const char *name); - /* brief Post one notification event by name. - * param name The name of this notification. - * param object The extra parameter. + /** @brief Posts one notification event by name. + * @param name The name of this notification. + * @param object The extra parameter. */ void postNotification(const char *name, CCObject *object); - /* brief Get script handler. - * note Only support Lua Binding now. - * return The script handle. + /** @brief Gets script handler. + * @note Only support Lua Binding now. + * @return The script handle. */ inline int getScriptHandler() { return m_scriptHandler; }; private: @@ -102,21 +102,21 @@ private: class CC_DLL CCNotificationObserver : public CCObject { public: - /* brief Observer constructor - * @param target The target which want to be observed. - * @param selector The callback function which will be invoked when the specified notification event was posted. - * @param name The name of notification. - * @param obj The extra parameter which will be passed to the callback function. + /** @brief CCNotificationObserver constructor + * @param target The target which wants to observer notification events. + * @param selector The callback function which will be invoked when the specified notification event was posted. + * @param name The name of this notification. + * @param obj The extra parameter which will be passed to the callback function. */ CCNotificationObserver(CCObject *target, SEL_CallFuncO selector, const char *name, CCObject *obj); - /* Observer destructor function */ + /** CCNotificationObserver destructor function */ ~CCNotificationObserver(); - /* Invoke the callback function of this observer */ + /** Invokes the callback function of this observer */ void performSelector(CCObject *obj); private: CC_PROPERTY_READONLY(CCObject *, m_target, Target); From 7af2f7c5ce2f7d4c037a07b55646acdfccd37abf Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 22 Oct 2012 15:51:06 +0800 Subject: [PATCH 04/95] fixed #1493: Updated one comment. --- cocos2dx/support/CCNotificationCenter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2dx/support/CCNotificationCenter.h b/cocos2dx/support/CCNotificationCenter.h index c3aaea43ec..4dd28f471d 100644 --- a/cocos2dx/support/CCNotificationCenter.h +++ b/cocos2dx/support/CCNotificationCenter.h @@ -48,7 +48,7 @@ public: /** @brief Adds an observer for the specified target. * @param target The target which wants to observe notification events. * @param selector The callback function which will be invoked when the specified notification event was posted. - * @param name The name of notification. + * @param name The name of this notification. * @param obj The extra parameter which will be passed to the callback function. */ void addObserver(CCObject *target, From 56cdb7686756edeeb05d38a2210d1470f97f672e Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 22 Oct 2012 15:52:11 +0800 Subject: [PATCH 05/95] fixed #1493: Updated one comment. --- cocos2dx/support/CCNotificationCenter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/support/CCNotificationCenter.h b/cocos2dx/support/CCNotificationCenter.h index 4dd28f471d..4d7201fcb9 100644 --- a/cocos2dx/support/CCNotificationCenter.h +++ b/cocos2dx/support/CCNotificationCenter.h @@ -63,7 +63,7 @@ public: void removeObserver(CCObject *target,const char *name); /** @brief Registers one hander for script binding. - * @note Only support Lua Binding now. + * @note Only supports Lua Binding now. * @param handler The lua handler. */ void registerScriptObserver(int handler); @@ -83,7 +83,7 @@ public: void postNotification(const char *name, CCObject *object); /** @brief Gets script handler. - * @note Only support Lua Binding now. + * @note Only supports Lua Binding now. * @return The script handle. */ inline int getScriptHandler() { return m_scriptHandler; }; From f4f63fd824a0d373534070877ba87e97375108dd Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 23 Oct 2012 10:50:47 +0800 Subject: [PATCH 06/95] fixed #1520: Added comments for using multiresolution in HelloCpp. --- cocos2dx/CCDirector.cpp | 33 +++++------- cocos2dx/CCDirector.h | 6 --- cocos2dx/platform/CCEGLViewProtocol.cpp | 5 +- cocos2dx/platform/CCEGLViewProtocol.h | 19 +++---- samples/HelloCpp/Classes/AppDelegate.cpp | 43 +++++++++------- samples/HelloCpp/Classes/AppMacros.h | 54 +++++++++++++++----- samples/HelloCpp/Classes/HelloWorldScene.cpp | 2 +- samples/HelloCpp/proj.win32/HelloCpp.vcproj | 4 ++ 8 files changed, 94 insertions(+), 72 deletions(-) diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 80c9a6f60b..638111a0b5 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -131,7 +131,7 @@ bool CCDirector::init(void) // purge ? m_bPurgeDirecotorInNextLoop = false; - m_obWinSizeInPixels = m_obWinSizeInPoints = CCSizeZero; + m_obWinSizeInPoints = CCSizeZero; m_pobOpenGLView = NULL; @@ -301,8 +301,7 @@ void CCDirector::setOpenGLView(CCEGLView *pobOpenGLView) m_pobOpenGLView = pobOpenGLView; // set size - m_obWinSizeInPoints = m_pobOpenGLView->getSize(); - m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor); + m_obWinSizeInPoints = m_pobOpenGLView->getDesignResolutionSize(); createStatsLabel(); @@ -454,7 +453,7 @@ CCSize CCDirector::getWinSize(void) CCSize CCDirector::getWinSizeInPixels() { - return m_obWinSizeInPixels; + return CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor); } CCSize CCDirector::getVisibleSize() @@ -481,20 +480,6 @@ CCPoint CCDirector::getVisibleOrigin() } } -void CCDirector::reshapeProjection(const CCSize& newWindowSize) -{ - CC_UNUSED_PARAM(newWindowSize); - if (m_pobOpenGLView) - { - m_obWinSizeInPoints = m_pobOpenGLView->getSize(); - m_obWinSizeInPixels = CCSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, - m_obWinSizeInPoints.height * m_fContentScaleFactor); - - setProjection(m_eProjection); - } - -} - // scene management void CCDirector::runWithScene(CCScene *pScene) @@ -775,7 +760,16 @@ void CCDirector::createStatsLabel() m_pDrawsLabel = new CCLabelAtlas(); m_pDrawsLabel->initWithString("000", "fps_images.png", 12, 32, '.'); */ - int fontSize = (int)(m_obWinSizeInPoints.height / 320.0f * 24); + 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); @@ -809,6 +803,7 @@ void CCDirector::setContentScaleFactor(float scaleFactor) if (scaleFactor != m_fContentScaleFactor) { m_fContentScaleFactor = scaleFactor; + createStatsLabel(); } } diff --git a/cocos2dx/CCDirector.h b/cocos2dx/CCDirector.h index 7b02fcb59b..1005003c77 100644 --- a/cocos2dx/CCDirector.h +++ b/cocos2dx/CCDirector.h @@ -180,9 +180,6 @@ public: */ CCPoint getVisibleOrigin(); - /** changes the projection size */ - void reshapeProjection(const CCSize& newWindowSize); - /** converts a UIKit coordinate to an OpenGL coordinate Useful to convert (multi) touches coordinates to the current layout (portrait or landscape) */ @@ -389,9 +386,6 @@ protected: /* window size in points */ CCSize m_obWinSizeInPoints; - - /* window size in pixels */ - CCSize m_obWinSizeInPixels; /* content scale factor */ float m_fContentScaleFactor; diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp index d1e8d90772..3a1a25266a 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.cpp +++ b/cocos2dx/platform/CCEGLViewProtocol.cpp @@ -88,13 +88,12 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol m_eResolutionPolicy = resolutionPolicy; // reset director's member variables to fit visible rect - CCDirector::sharedDirector()->m_obWinSizeInPoints = getSize(); - CCDirector::sharedDirector()->m_obWinSizeInPixels = CCSizeMake(m_obDesignResolutionSize.width*CC_CONTENT_SCALE_FACTOR(), m_obDesignResolutionSize.height*CC_CONTENT_SCALE_FACTOR()); + CCDirector::sharedDirector()->m_obWinSizeInPoints = getDesignResolutionSize(); CCDirector::sharedDirector()->createStatsLabel(); CCDirector::sharedDirector()->setGLDefaultValues(); } -const CCSize& CCEGLViewProtocol::getSize() const +const CCSize& CCEGLViewProtocol::getDesignResolutionSize() const { return m_obDesignResolutionSize; } diff --git a/cocos2dx/platform/CCEGLViewProtocol.h b/cocos2dx/platform/CCEGLViewProtocol.h index 0c710241c2..f76aa5161d 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.h +++ b/cocos2dx/platform/CCEGLViewProtocol.h @@ -48,13 +48,6 @@ public: /** Open or close IME keyboard , subclass must implement this method. */ virtual void setIMEKeyboardState(bool bOpen) = 0; - /** - * Get design resolution size. - * If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize' - */ - - virtual const CCSize& getSize() const; - /** * Get the frame size of EGL view. * In general, it returns the screen size since the EGL view is a fullscreen view. @@ -78,16 +71,20 @@ public: /** * Set the design resolution size. - * Behavior undefined when enableRetina == true. * @param width Design resolution width. * @param height Design resolution height. * @param resolutionPolicy The resolution policy desired, you may choose: - * [1] kCCResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. - * [2] kCCResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. - * [3] kCCResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown. + * [1] kResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. + * [2] kResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. + * [3] kResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown. */ virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy); + /** Get design resolution size. + * If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize' + */ + virtual const CCSize& getDesignResolutionSize() const; + /** Set touch delegate */ virtual void setTouchDelegate(EGLTouchDelegate * pDelegate); diff --git a/samples/HelloCpp/Classes/AppDelegate.cpp b/samples/HelloCpp/Classes/AppDelegate.cpp index 84e2527106..c3b597c085 100644 --- a/samples/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/HelloCpp/Classes/AppDelegate.cpp @@ -14,30 +14,37 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - CCDirector *pDirector = CCDirector::sharedDirector(); + CCDirector* pDirector = CCDirector::sharedDirector(); + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); - pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - //pDirector->setProjection(kCCDirectorProjection2D); - CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize(); - - if (screenSize.height > 768) - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd"); - pDirector->setContentScaleFactor(1536.0f/kDesignResolutionSize_height); + pDirector->setOpenGLView(pEGLView); + + // Set the design resolution + pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); + + CCSize frameSize = pEGLView->getFrameSize(); + // if the frame size is larger than medium resource size, select large resource. + if (frameSize.height > mediumResource.size.height) + { + CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory); + // The contentScaleFactor is set by the ratio of resource's height and design resolution's height when your game is in landscape. + // Oppositely, if your game is in portrait, it need to be set by width. + // This can make sure your game's status is in full screen. + pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height); } - else if (screenSize.height > 320) - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad"); - pDirector->setContentScaleFactor(768.0f/kDesignResolutionSize_height); + // if the frame size is larger than small resource size, select medium resource. + else if (frameSize.height > smallResource.size.height) + { + CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory); + pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height); } + // if the frame size is smaller than medium resource size, select small resource. else - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone"); - pDirector->setContentScaleFactor(320.0f/kDesignResolutionSize_height); + { + CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory); + pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height); } - CCEGLView::sharedOpenGLView()->setDesignResolutionSize(kDesignResolutionSize_width, kDesignResolutionSize_height, kResolutionNoBorder); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/HelloCpp/Classes/AppMacros.h b/samples/HelloCpp/Classes/AppMacros.h index 355f25a76f..b9ca794821 100644 --- a/samples/HelloCpp/Classes/AppMacros.h +++ b/samples/HelloCpp/Classes/AppMacros.h @@ -1,30 +1,56 @@ #ifndef __APPMACROS_H__ #define __APPMACROS_H__ +#include "cocos2d.h" -#define kDesignResolution_480x320 0 -#define kDesignResolution_1024x768 1 -#define kDesignResolution_2048x1536 2 +/* For demonstrating using one design resolution to match different resources, + or one resource to match different design resolutions. -#define kTargetDesignResolutionSize kDesignResolution_2048x1536 + [Situation 1] Using the same design resolution to match different resources. + Please look into Appdelegate::applicationDidFinishLaunching. + We check current device frame size to decide which resource need to be selected. + So if you want to test this situation which said in title '[Situation 1]', + you should change ios simulator to different device(e.g. iphone, iphone-retina3.5, iphone-retina4.0, ipad, ipad-retina), + or change the window size in "proj.XXX/main.cpp" by "CCEGLView::setFrameSize" if you are using win32 or linux plaform + and modify "proj.mac/AppController.mm" by changing the window rectangle. -#if (kTargetDesignResolutionSize == kDesignResolution_480x320) -#define kDesignResolutionSize_width 480.0f -#define kDesignResolutionSize_height 320.0f + [Situation 2] Using the same resource to match different design resolutions. + The coordinates in your codes is based on your current design resolution rather than resource size. + Therefore, your design resolution could be very large and your resource could be small. + To test this, just define the marco 'TARGET_DESIGN_RESOLUTION_SIZE' to 'DESIGN_RESOLUTION_2048X1536' + and open iphone simulator or create a window of 480x320 size. + [Note] Normally, developer just need to define one design resolution(e.g. 960x640) with one or more resources. + */ -#elif (kTargetDesignResolutionSize == kDesignResolution_1024x768) -#define kDesignResolutionSize_width 1024.0f -#define kDesignResolutionSize_height 768.0f +#define DESIGN_RESOLUTION_480X320 0 +#define DESIGN_RESOLUTION_1024X768 1 +#define DESIGN_RESOLUTION_2048X1536 2 -#elif (kTargetDesignResolutionSize == kDesignResolution_2048x1536) -#define kDesignResolutionSize_width 2048.0f -#define kDesignResolutionSize_height 1536.0f +/* If you want to switch design resolution, change next line */ +#define TARGET_DESIGN_RESOLUTION_SIZE DESIGN_RESOLUTION_2048X1536 +typedef struct tagResource +{ + cocos2d::CCSize size; + char directory[100]; +}Resource; + +static Resource smallResource = { cocos2d::CCSizeMake(480, 320), "iphone" }; +static Resource mediumResource = { cocos2d::CCSizeMake(1024, 768), "ipad" }; +static Resource largeResource = { cocos2d::CCSizeMake(2048, 1536), "ipadhd" }; + +#if (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_480X320) +static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(480, 320); +#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_1024X768) +static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(1024, 768); +#elif (TARGET_DESIGN_RESOLUTION_SIZE == DESIGN_RESOLUTION_2048X1536) +static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(2048, 1536); #else #error unknown target design resolution! #endif -#define kTitleFontSize (kDesignResolutionSize_width / 480.0f * 24) +// The font size 24 is designed for small resolution, so we should change it to fit for current design resolution +#define TITLE_FONT_SIZE (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 24) #endif /* __APPMACROS_H__ */ diff --git a/samples/HelloCpp/Classes/HelloWorldScene.cpp b/samples/HelloCpp/Classes/HelloWorldScene.cpp index 20f7bc6767..94c515a196 100644 --- a/samples/HelloCpp/Classes/HelloWorldScene.cpp +++ b/samples/HelloCpp/Classes/HelloWorldScene.cpp @@ -56,7 +56,7 @@ bool HelloWorld::init() // add a label shows "Hello World" // create and initialize a label - CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", kTitleFontSize); + CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE); // position the label on the center of the screen pLabel->setPosition(ccp(origin.x + visibleSize.width/2, diff --git a/samples/HelloCpp/proj.win32/HelloCpp.vcproj b/samples/HelloCpp/proj.win32/HelloCpp.vcproj index 3d9326ae5f..f854468dc9 100644 --- a/samples/HelloCpp/proj.win32/HelloCpp.vcproj +++ b/samples/HelloCpp/proj.win32/HelloCpp.vcproj @@ -190,6 +190,10 @@ RelativePath="..\Classes\AppDelegate.h" > + + From b3db7e91f89f0c0048bf689fc7b3b2a40c7e2323 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 23 Oct 2012 14:01:48 +0800 Subject: [PATCH 07/95] fixed #1520: Updated some comments. --- cocos2dx/platform/CCEGLViewProtocol.h | 2 +- samples/HelloCpp/Classes/AppDelegate.cpp | 15 +++++++++------ samples/HelloCpp/Classes/AppMacros.h | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cocos2dx/platform/CCEGLViewProtocol.h b/cocos2dx/platform/CCEGLViewProtocol.h index f76aa5161d..9cc1c65334 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.h +++ b/cocos2dx/platform/CCEGLViewProtocol.h @@ -81,7 +81,7 @@ public: virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy); /** Get design resolution size. - * If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize' + * Default resolution size is the same as 'getFrameSize'. */ virtual const CCSize& getDesignResolutionSize() const; diff --git a/samples/HelloCpp/Classes/AppDelegate.cpp b/samples/HelloCpp/Classes/AppDelegate.cpp index c3b597c085..86fb4632aa 100644 --- a/samples/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/HelloCpp/Classes/AppDelegate.cpp @@ -23,22 +23,25 @@ bool AppDelegate::applicationDidFinishLaunching() { pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); CCSize frameSize = pEGLView->getFrameSize(); - // if the frame size is larger than medium resource size, select large resource. + + // In this demo, we select resource according to the frame's height. + // If the resource size is different from design resolution size, you need to set contentScaleFactor. + // We use the ratio of resource's height to design resolution's height, + // this can make sure that the resource's height could fit for the height of design resolution. + + // if the frame's height is larger than the height of medium resource size, select large resource. if (frameSize.height > mediumResource.size.height) { CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory); - // The contentScaleFactor is set by the ratio of resource's height and design resolution's height when your game is in landscape. - // Oppositely, if your game is in portrait, it need to be set by width. - // This can make sure your game's status is in full screen. pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height); } - // if the frame size is larger than small resource size, select medium resource. + // if the frame's height is larger than the height of small resource size, select medium resource. else if (frameSize.height > smallResource.size.height) { CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory); pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height); } - // if the frame size is smaller than medium resource size, select small resource. + // if the frame's height is smaller than the height of medium resource size, select small resource. else { CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory); diff --git a/samples/HelloCpp/Classes/AppMacros.h b/samples/HelloCpp/Classes/AppMacros.h index b9ca794821..7223673b50 100644 --- a/samples/HelloCpp/Classes/AppMacros.h +++ b/samples/HelloCpp/Classes/AppMacros.h @@ -6,7 +6,7 @@ /* For demonstrating using one design resolution to match different resources, or one resource to match different design resolutions. - [Situation 1] Using the same design resolution to match different resources. + [Situation 1] Using one design resolution to match different resources. Please look into Appdelegate::applicationDidFinishLaunching. We check current device frame size to decide which resource need to be selected. So if you want to test this situation which said in title '[Situation 1]', @@ -14,9 +14,9 @@ or change the window size in "proj.XXX/main.cpp" by "CCEGLView::setFrameSize" if you are using win32 or linux plaform and modify "proj.mac/AppController.mm" by changing the window rectangle. - [Situation 2] Using the same resource to match different design resolutions. + [Situation 2] Using one resource to match different design resolutions. The coordinates in your codes is based on your current design resolution rather than resource size. - Therefore, your design resolution could be very large and your resource could be small. + Therefore, your design resolution could be very large and your resource size could be small. To test this, just define the marco 'TARGET_DESIGN_RESOLUTION_SIZE' to 'DESIGN_RESOLUTION_2048X1536' and open iphone simulator or create a window of 480x320 size. From b383704ebc9d02feeb5751f311ae4ef9750b39db Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 23 Oct 2012 14:04:35 +0800 Subject: [PATCH 08/95] fixed #1520: Updated one comment in HelloCpp. --- samples/HelloCpp/Classes/AppDelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/HelloCpp/Classes/AppDelegate.cpp b/samples/HelloCpp/Classes/AppDelegate.cpp index 86fb4632aa..329b962fee 100644 --- a/samples/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/HelloCpp/Classes/AppDelegate.cpp @@ -26,7 +26,7 @@ bool AppDelegate::applicationDidFinishLaunching() { // In this demo, we select resource according to the frame's height. // If the resource size is different from design resolution size, you need to set contentScaleFactor. - // We use the ratio of resource's height to design resolution's height, + // We use the ratio of resource's height to the height of design resolution, // this can make sure that the resource's height could fit for the height of design resolution. // if the frame's height is larger than the height of medium resource size, select large resource. From 62f7b25df237046b6ee070a1563c2335c9f4f2c6 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 23 Oct 2012 17:48:50 +0800 Subject: [PATCH 09/95] issue #1521: Using relative coordinates in TestCpp. --- samples/TestCpp/Android.mk | 3 +- .../AccelerometerTest/AccelerometerTest.cpp | 10 +- .../ActionManagerTest/ActionManagerTest.cpp | 37 +++-- .../ActionsEaseTest/ActionsEaseTest.cpp | 72 +++------- .../ActionsProgressTest.cpp | 22 +-- .../Classes/ActionsTest/ActionsTest.cpp | 126 +++++++++--------- samples/TestCpp/Classes/AppDelegate.cpp | 18 +-- .../TestCpp/Classes/Box2DTest/Box2dTest.cpp | 23 ++-- .../Classes/Box2DTestBed/Box2dView.cpp | 6 +- samples/TestCpp/Classes/BugsTest/BugsTest.cpp | 2 +- .../ChipmunkAccelTouchTest.cpp | 26 ++-- .../ClickAndMoveTest/ClickAndMoveTest.cpp | 6 +- .../CocosDenshionTest/CocosDenshionTest.cpp | 12 +- samples/TestCpp/Classes/CurlTest/CurlTest.cpp | 5 +- .../CurrentLanguageTest.cpp | 5 +- .../DrawPrimitivesTest/DrawPrimitivesTest.cpp | 16 +-- .../EffectsAdvancedTest.cpp | 21 ++- .../Classes/EffectsTest/EffectsTest.cpp | 26 ++-- .../ControlExtensionTest/CCControlScene.cpp | 19 ++- .../NetworkTest/HttpClientTest.cpp | 2 +- .../NotificationCenterTest.cpp | 2 +- .../TableViewTest/TableViewTestScene.cpp | 2 +- samples/TestCpp/Classes/FontTest/FontTest.cpp | 7 +- .../Classes/IntervalTest/IntervalTest.cpp | 18 +-- .../TestCpp/Classes/LabelTest/LabelTest.cpp | 19 ++- .../TestCpp/Classes/LayerTest/LayerTest.cpp | 18 +-- samples/TestCpp/Classes/MenuTest/MenuTest.cpp | 24 ++-- .../MotionStreakTest/MotionStreakTest.cpp | 12 +- samples/TestCpp/Classes/NodeTest/NodeTest.cpp | 70 +++++----- .../Classes/ParallaxTest/ParallaxTest.cpp | 6 +- .../Classes/ParticleTest/ParticleTest.cpp | 40 +++--- .../PerformanceTest/PerformanceTest.cpp | 8 +- .../RenderTextureTest/RenderTextureTest.cpp | 8 +- .../RotateWorldTest/RotateWorldTest.cpp | 16 +-- .../TestCpp/Classes/SceneTest/SceneTest.cpp | 6 +- .../Classes/SchedulerTest/SchedulerTest.cpp | 22 ++- .../TestCpp/Classes/ShaderTest/ShaderTest.cpp | 6 +- .../SpriteTest/SpriteTest.cpp.REMOVED.git-id | 2 +- .../Classes/TextInputTest/TextInputTest.cpp | 6 +- .../Classes/Texture2dTest/Texture2dTest.cpp | 6 +- .../TextureCacheTest/TextureCacheTest.cpp | 36 ++--- .../Classes/TileMapTest/TileMapTest.cpp | 6 +- samples/TestCpp/Classes/TouchesTest/Ball.cpp | 15 +-- .../TestCpp/Classes/TouchesTest/Paddle.cpp | 2 +- .../Classes/TouchesTest/TouchesTest.cpp | 20 ++- .../TestCpp/Classes/TouchesTest/TouchesTest.h | 1 - .../TransitionsTest/TransitionsTest.cpp | 24 ++-- samples/TestCpp/Classes/VisibleRect.cpp | 73 ++++++++++ samples/TestCpp/Classes/VisibleRect.h | 26 ++++ .../Classes/ZwoptexTest/ZwoptexTest.cpp | 6 +- samples/TestCpp/Classes/controller.cpp | 13 +- samples/TestCpp/Classes/testBasic.cpp | 4 +- samples/TestCpp/Classes/testBasic.h | 1 + samples/TestCpp/proj.linux/Makefile | 1 + samples/TestCpp/proj.win32/TestCpp.vcproj | 8 ++ samples/TestCpp/proj.win32/TestCpp.vcxproj | 2 + .../proj.win32/TestCpp.vcxproj.filters | 6 + 57 files changed, 516 insertions(+), 483 deletions(-) create mode 100644 samples/TestCpp/Classes/VisibleRect.cpp create mode 100644 samples/TestCpp/Classes/VisibleRect.h diff --git a/samples/TestCpp/Android.mk b/samples/TestCpp/Android.mk index 57c0d33223..be417237db 100644 --- a/samples/TestCpp/Android.mk +++ b/samples/TestCpp/Android.mk @@ -91,7 +91,8 @@ Classes/UserDefaultTest/UserDefaultTest.cpp \ Classes/ZwoptexTest/ZwoptexTest.cpp \ Classes/controller.cpp \ Classes/testBasic.cpp \ -Classes/AppDelegate.cpp +Classes/AppDelegate.cpp \ +Classes/VisibleRect.cpp LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static diff --git a/samples/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp b/samples/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp index 18e148507e..db5702e1af 100644 --- a/samples/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp +++ b/samples/TestCpp/Classes/AccelerometerTest/AccelerometerTest.cpp @@ -34,14 +34,13 @@ void AccelerometerTest::onEnter() setAccelerometerEnabled(true); - CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label, 1); - label->setPosition( CCPointMake(s.width/2, s.height-50) ); + label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) ); m_pBall = CCSprite::create("Images/ball.png"); - m_pBall->setPosition(ccp(s.width / 2, s.height / 2)); + m_pBall->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y)); addChild(m_pBall); m_pBall->retain(); @@ -59,7 +58,6 @@ void AccelerometerTest::didAccelerate(CCAcceleration* pAccelerationValue) // m_fLastTime = fNow; CCDirector* pDir = CCDirector::sharedDirector(); - CCSize winSize = pDir->getWinSize(); /*FIXME: Testing on the Nexus S sometimes m_pBall is NULL */ if ( m_pBall == NULL ) { @@ -75,8 +73,8 @@ void AccelerometerTest::didAccelerate(CCAcceleration* pAccelerationValue) ptTemp.y -= pAccelerationValue->y * 9.81f; CCPoint ptNext = pDir->convertToGL(ptTemp); - FIX_POS(ptNext.x, (ballSize.width / 2.0), (winSize.width - ballSize.width / 2.0)); - FIX_POS(ptNext.y, (ballSize.height / 2.0), (winSize.height - ballSize.height / 2.0)); + FIX_POS(ptNext.x, (VisibleRect::left().x+ballSize.width / 2.0), (VisibleRect::right().x - ballSize.width / 2.0)); + FIX_POS(ptNext.y, (VisibleRect::bottom().y+ballSize.height / 2.0), (VisibleRect::top().y - ballSize.height / 2.0)); m_pBall->setPosition(ptNext); } diff --git a/samples/TestCpp/Classes/ActionManagerTest/ActionManagerTest.cpp b/samples/TestCpp/Classes/ActionManagerTest/ActionManagerTest.cpp index a5090d6553..cae6ec05bd 100644 --- a/samples/TestCpp/Classes/ActionManagerTest/ActionManagerTest.cpp +++ b/samples/TestCpp/Classes/ActionManagerTest/ActionManagerTest.cpp @@ -86,11 +86,9 @@ void ActionManagerTest::onEnter() { CCLayer::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label, 1); - label->setPosition(CCPointMake(s.width/2, s.height-50)); + label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50)); CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ActionManagerTest::backCallback) ); CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ActionManagerTest::restartCallback) ); @@ -99,9 +97,9 @@ void ActionManagerTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2)); - item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2)); addChild(menu, 1); } @@ -142,7 +140,7 @@ void CrashTest::onEnter() ActionManagerTest::onEnter(); CCSprite* child = CCSprite::create(s_pPathGrossini); - child->setPosition( CCPointMake(200,200) ); + child->setPosition( VisibleRect::center() ); addChild(child, 1); //Sum of all action's duration is 1.5 second. @@ -184,10 +182,10 @@ void LogicTest::onEnter() CCSprite* grossini = CCSprite::create(s_pPathGrossini); addChild(grossini, 0, 2); - grossini->setPosition(CCPointMake(200,200)); + grossini->setPosition(VisibleRect::center()); grossini->runAction( CCSequence::create( - CCMoveBy::create(1, CCPointMake(150,0)), + CCMoveBy::create(1, ccp(150,0)), CCCallFuncN::create(this, callfuncN_selector(LogicTest::bugMe)), NULL) ); @@ -218,11 +216,10 @@ void PauseTest::onEnter() // ActionManagerTest::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* l = CCLabelTTF::create("After 5 seconds grossini should move", "Thonburi", 16); addChild(l); - l->setPosition( CCPointMake(s.width/2, 245) ); + l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-75) ); // @@ -230,9 +227,9 @@ void PauseTest::onEnter() // CCSprite* grossini = CCSprite::create(s_pPathGrossini); addChild(grossini, 0, kTagGrossini); - grossini->setPosition( CCPointMake(200,200) ); + grossini->setPosition(VisibleRect::center() ); - CCAction* action = CCMoveBy::create(1, CCPointMake(150,0)); + CCAction* action = CCMoveBy::create(1, ccp(150,0)); CCDirector* pDirector = CCDirector::sharedDirector(); pDirector->getActionManager()->addAction(action, grossini, true); @@ -262,19 +259,17 @@ void RemoveTest::onEnter() { ActionManagerTest::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCLabelTTF* l = CCLabelTTF::create("Should not crash", "Thonburi", 16); addChild(l); - l->setPosition( CCPointMake(s.width/2, 245) ); + l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 75) ); - CCMoveBy* pMove = CCMoveBy::create(2, CCPointMake(200, 0)); + CCMoveBy* pMove = CCMoveBy::create(2, ccp(200, 0)); CCCallFunc* pCallback = CCCallFunc::create(this, callfunc_selector(RemoveTest::stopAction)); CCActionInterval* pSequence = (CCActionInterval*) CCSequence::create(pMove, pCallback, NULL); pSequence->setTag(kTagSequence); CCSprite* pChild = CCSprite::create(s_pPathGrossini); - pChild->setPosition(CCPointMake(200, 200)); + pChild->setPosition( VisibleRect::center() ); addChild(pChild, 1, kTagGrossini); pChild->runAction(pSequence); @@ -305,15 +300,13 @@ void ResumeTest::onEnter() { ActionManagerTest::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCLabelTTF* l = CCLabelTTF::create("Grossini only rotate/scale in 3 seconds", "Thonburi", 16); addChild(l); - l->setPosition( CCPointMake(s.width/2, 245)); + l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 75)); CCSprite* pGrossini = CCSprite::create(s_pPathGrossini); addChild(pGrossini, 0, kTagGrossini); - pGrossini->setPosition(CCPointMake(s.width / 2, s.height / 2)); + pGrossini->setPosition(VisibleRect::center()); pGrossini->runAction(CCScaleBy::create(2, 2)); diff --git a/samples/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/samples/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp index 333af20dfb..320d683bae 100644 --- a/samples/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/samples/TestCpp/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -21,9 +21,7 @@ void SpriteEase::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseIn::create((CCActionInterval*)(move->copy()->autorelease()), 2.5f); @@ -74,10 +72,8 @@ std::string SpriteEase::title() void SpriteEaseInOut::onEnter() { EaseSpriteDemo::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0)); // id move_back = move->reverse(); CCActionInterval* move_ease_inout1 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.65f); @@ -116,9 +112,7 @@ void SpriteEaseExponential::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseExponentialIn::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -153,10 +147,8 @@ std::string SpriteEaseExponential::title() void SpriteEaseExponentialInOut::onEnter() { EaseSpriteDemo::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease = CCEaseExponentialInOut::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -188,10 +180,8 @@ std::string SpriteEaseExponentialInOut::title() void SpriteEaseSine::onEnter() { EaseSpriteDemo::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseSineIn::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -227,10 +217,8 @@ std::string SpriteEaseSine::title() void SpriteEaseSineInOut::onEnter() { EaseSpriteDemo::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease = CCEaseSineInOut::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -262,9 +250,7 @@ void SpriteEaseElastic::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseElasticIn::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -300,9 +286,7 @@ void SpriteEaseElasticInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.3f); CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse(); @@ -341,9 +325,7 @@ void SpriteEaseBounce::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseBounceIn::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -379,10 +361,8 @@ std::string SpriteEaseBounce::title() void SpriteEaseBounceInOut::onEnter() { EaseSpriteDemo::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease = CCEaseBounceInOut::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -415,9 +395,7 @@ void SpriteEaseBack::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease_in = CCEaseBackIn::create((CCActionInterval*)(move->copy()->autorelease())); @@ -453,9 +431,7 @@ void SpriteEaseBackInOut::onEnter() { EaseSpriteDemo::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0)); CCActionInterval* move_back = move->reverse(); CCActionInterval* move_ease = CCEaseBackInOut::create((CCActionInterval*)(move->copy()->autorelease()) ); @@ -491,7 +467,7 @@ void SpeedTest::onEnter() CCSize s = CCDirector::sharedDirector()->getWinSize(); // rotate and jump - CCActionInterval *jump1 = CCJumpBy::create(4, CCPointMake(-s.width+80, 0), 100, 4); + CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-s.width+80, 0), 100, 4); CCActionInterval *jump2 = jump1->reverse(); CCActionInterval *rot1 = CCRotateBy::create(4, 360*2); CCActionInterval *rot2 = rot1->reverse(); @@ -617,10 +593,8 @@ EaseSpriteDemo::~EaseSpriteDemo(void) void EaseSpriteDemo::positionForTwo() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - m_grossini->setPosition(CCPointMake(60, s.height*1/5)); - m_tamara->setPosition(CCPointMake( 60, s.height*4/5)); + m_grossini->setPosition(ccp(VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*1/5)); + m_tamara->setPosition(ccp( VisibleRect::left().x+60, VisibleRect::bottom().y + VisibleRect::getVisibleRect().size.height*4/5)); m_kathia->setVisible(false); } @@ -643,15 +617,13 @@ void EaseSpriteDemo::onEnter() addChild( m_kathia, 2); addChild( m_tamara, 1); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - m_grossini->setPosition(CCPointMake(60, s.height*1/5)); - m_kathia->setPosition(CCPointMake(60, s.height*2.5f/5)); - m_tamara->setPosition(CCPointMake(60, s.height*4/5)); + m_grossini->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*1/5)); + m_kathia->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2.5f/5)); + m_tamara->setPosition(ccp(VisibleRect::left().x + 60, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*4/5)); CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label); - label->setPosition(CCPointMake(s.width/2, s.height-50)); + label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50)); CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(EaseSpriteDemo::backCallback) ); CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(EaseSpriteDemo::restartCallback) ); @@ -660,9 +632,9 @@ void EaseSpriteDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2)); - item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y + item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/samples/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 3b050b11bd..25c90986a9 100644 --- a/samples/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/samples/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -96,14 +96,14 @@ void SpriteDemo::onEnter() CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 18); addChild(label, 1); - label->setPosition( CCPointMake(s.width/2, s.height-50) ); + label->setPosition( ccp(s.width/2, s.height-50) ); std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22); addChild(l, 1); - l->setPosition( CCPointMake(s.width/2, s.height-80) ); + l->setPosition( ccp(s.width/2, s.height-80) ); } CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(SpriteDemo::backCallback) ); @@ -112,9 +112,9 @@ void SpriteDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(CCPointMake( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2)); - item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); CCLayerColor *background = CCLayerColor::create(ccc4(255,0,0,255)); @@ -163,7 +163,7 @@ void SpriteProgressToRadial::onEnter() CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1)); left->setType( kCCProgressTimerTypeRadial ); addChild(left); - left->setPosition(CCPointMake(100, s.height/2)); + left->setPosition(ccp(100, s.height/2)); left->runAction( CCRepeatForever::create(to1)); CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock)); @@ -171,7 +171,7 @@ void SpriteProgressToRadial::onEnter() // Makes the ridial CCW right->setReverseProgress(true); addChild(right); - right->setPosition(CCPointMake(s.width-100, s.height/2)); + right->setPosition(ccp(s.width-100, s.height/2)); right->runAction( CCRepeatForever::create(to2)); } @@ -202,7 +202,7 @@ void SpriteProgressToHorizontal::onEnter() // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change left->setBarChangeRate(ccp(1, 0)); addChild(left); - left->setPosition(CCPointMake(100, s.height/2)); + left->setPosition(ccp(100, s.height/2)); left->runAction( CCRepeatForever::create(to1)); CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2)); @@ -212,7 +212,7 @@ void SpriteProgressToHorizontal::onEnter() // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change right->setBarChangeRate(ccp(1, 0)); addChild(right); - right->setPosition(CCPointMake(s.width-100, s.height/2)); + right->setPosition(ccp(s.width-100, s.height/2)); right->runAction( CCRepeatForever::create(to2)); } @@ -243,7 +243,7 @@ void SpriteProgressToVertical::onEnter() // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change left->setBarChangeRate(ccp(0, 1)); addChild(left); - left->setPosition(CCPointMake(100, s.height/2)); + left->setPosition(ccp(100, s.height/2)); left->runAction( CCRepeatForever::create(to1)); CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2)); @@ -253,7 +253,7 @@ void SpriteProgressToVertical::onEnter() // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change right->setBarChangeRate(ccp(0, 1)); addChild(right); - right->setPosition(CCPointMake(s.width-100, s.height/2)); + right->setPosition(ccp(s.width-100, s.height/2)); right->runAction( CCRepeatForever::create(to2)); } diff --git a/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp b/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp index 3c3c8f17ba..f51b48fe2d 100644 --- a/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp +++ b/samples/TestCpp/Classes/ActionsTest/ActionsTest.cpp @@ -164,27 +164,23 @@ void ActionsDemo::onEnter() addChild(m_tamara, 2); addChild(m_kathia, 3); - CCDirector* pDirector = CCDirector::sharedDirector(); - CCPoint visibleOrigin = pDirector->getVisibleOrigin(); - CCSize visibleSize = pDirector->getVisibleSize(); - - m_grossini->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3)); - m_tamara->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+2*visibleSize.height/3)); - m_kathia->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); + m_grossini->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/3)); + m_tamara->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height*2/3)); + m_kathia->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+VisibleRect::getVisibleRect().size.height/2)); // add title and subtitle std::string str = title(); const char * pTitle = str.c_str(); CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 18); addChild(label, 1); - label->setPosition( ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height - 30) ); + label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) ); std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 22); addChild(l, 1); - l->setPosition( ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height - 60) ); + l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) ); } // add menu @@ -195,9 +191,9 @@ void ActionsDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp(visibleOrigin.x+visibleSize.width/2 - item2->getContentSize().width*2, visibleOrigin.y+item2->getContentSize().height/2)); - item2->setPosition(ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+item2->getContentSize().height/2)); - item3->setPosition(ccp(visibleOrigin.x+visibleSize.width/2 + item2->getContentSize().width*2, visibleOrigin.y+item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } @@ -249,19 +245,19 @@ void ActionsDemo::centerSprites(unsigned int numberOfSprites) { m_tamara->setVisible(false); m_kathia->setVisible(false); - m_grossini->setPosition(CCPointMake(s.width/2, s.height/2)); + m_grossini->setPosition(ccp(s.width/2, s.height/2)); } else if( numberOfSprites == 2 ) { - m_kathia->setPosition( CCPointMake(s.width/3, s.height/2)); - m_tamara->setPosition( CCPointMake(2*s.width/3, s.height/2)); + m_kathia->setPosition( ccp(s.width/3, s.height/2)); + m_tamara->setPosition( ccp(2*s.width/3, s.height/2)); m_grossini->setVisible(false); } else if( numberOfSprites == 3 ) { - m_grossini->setPosition( CCPointMake(s.width/2, s.height/2)); - m_tamara->setPosition( CCPointMake(s.width/4, s.height/2)); - m_kathia->setPosition( CCPointMake(3 * s.width/4, s.height/2)); + m_grossini->setPosition( ccp(s.width/2, s.height/2)); + m_tamara->setPosition( ccp(s.width/4, s.height/2)); + m_kathia->setPosition( ccp(3 * s.width/4, s.height/2)); } } @@ -273,19 +269,19 @@ void ActionsDemo::alignSpritesLeft(unsigned int numberOfSprites) { m_tamara->setVisible(false); m_kathia->setVisible(false); - m_grossini->setPosition(CCPointMake(60, s.height/2)); + m_grossini->setPosition(ccp(60, s.height/2)); } else if( numberOfSprites == 2 ) { - m_kathia->setPosition( CCPointMake(60, s.height/3)); - m_tamara->setPosition( CCPointMake(60, 2*s.height/3)); + m_kathia->setPosition( ccp(60, s.height/3)); + m_tamara->setPosition( ccp(60, 2*s.height/3)); m_grossini->setVisible( false ); } else if( numberOfSprites == 3 ) { - m_grossini->setPosition( CCPointMake(60, s.height/2)); - m_tamara->setPosition( CCPointMake(60, 2*s.height/3)); - m_kathia->setPosition( CCPointMake(60, s.height/3)); + m_grossini->setPosition( ccp(60, s.height/2)); + m_tamara->setPosition( ccp(60, 2*s.height/3)); + m_kathia->setPosition( ccp(60, s.height/3)); } } @@ -302,14 +298,14 @@ void ActionManual::onEnter() m_tamara->setScaleX( 2.5f); m_tamara->setScaleY( -1.0f); - m_tamara->setPosition( CCPointMake(100,70) ); + m_tamara->setPosition( ccp(100,70) ); m_tamara->setOpacity( 128); m_grossini->setRotation( 120); - m_grossini->setPosition( CCPointMake(s.width/2, s.height/2)); + m_grossini->setPosition( ccp(s.width/2, s.height/2)); m_grossini->setColor( ccc3( 255,0,0)); - m_kathia->setPosition( CCPointMake(s.width-100, s.height/2)); + m_kathia->setPosition( ccp(s.width-100, s.height/2)); m_kathia->setColor( ccBLUE); } @@ -331,13 +327,13 @@ void ActionMove::onEnter() CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCActionInterval* actionTo = CCMoveTo::create(2, CCPointMake(s.width-40, s.height-40)); - CCActionInterval* actionBy = CCMoveBy::create(2, CCPointMake(80,80)); + CCActionInterval* actionTo = CCMoveTo::create(2, ccp(s.width-40, s.height-40)); + CCActionInterval* actionBy = CCMoveBy::create(2, ccp(80,80)); CCActionInterval* actionByBack = actionBy->reverse(); m_tamara->runAction( actionTo); m_grossini->runAction( CCSequence::create(actionBy, actionByBack, NULL)); - m_kathia->runAction(CCMoveTo::create(1, CCPointMake(40,40))); + m_kathia->runAction(CCMoveTo::create(1, ccp(40,40))); } std::string ActionMove::subtitle() @@ -484,9 +480,9 @@ void ActionJump::onEnter() centerSprites(3); - CCActionInterval* actionTo = CCJumpTo::create(2, CCPointMake(300,300), 50, 4); - CCActionInterval* actionBy = CCJumpBy::create(2, CCPointMake(300,0), 50, 4); - CCActionInterval* actionUp = CCJumpBy::create(2, CCPointMake(0,0), 80, 4); + CCActionInterval* actionTo = CCJumpTo::create(2, ccp(300,300), 50, 4); + CCActionInterval* actionBy = CCJumpBy::create(2, ccp(300,0), 50, 4); + CCActionInterval* actionUp = CCJumpBy::create(2, ccp(0,0), 80, 4); CCActionInterval* actionByBack = actionBy->reverse(); m_tamara->runAction( actionTo); @@ -518,9 +514,9 @@ void ActionBezier::onEnter() // sprite 1 ccBezierConfig bezier; - bezier.controlPoint_1 = CCPointMake(0, s.height/2); - bezier.controlPoint_2 = CCPointMake(300, -s.height/2); - bezier.endPosition = CCPointMake(300,100); + bezier.controlPoint_1 = ccp(0, s.height/2); + bezier.controlPoint_2 = ccp(300, -s.height/2); + bezier.endPosition = ccp(300,100); CCActionInterval* bezierForward = CCBezierBy::create(3, bezier); CCActionInterval* bezierBack = bezierForward->reverse(); @@ -528,16 +524,16 @@ void ActionBezier::onEnter() // sprite 2 - m_tamara->setPosition(CCPointMake(80,160)); + m_tamara->setPosition(ccp(80,160)); ccBezierConfig bezier2; - bezier2.controlPoint_1 = CCPointMake(100, s.height/2); - bezier2.controlPoint_2 = CCPointMake(200, -s.height/2); - bezier2.endPosition = CCPointMake(240,160); + bezier2.controlPoint_1 = ccp(100, s.height/2); + bezier2.controlPoint_2 = ccp(200, -s.height/2); + bezier2.endPosition = ccp(240,160); CCActionInterval* bezierTo1 = CCBezierTo::create(2, bezier2); // sprite 3 - m_kathia->setPosition(CCPointMake(400,160)); + m_kathia->setPosition(ccp(400,160)); CCActionInterval* bezierTo2 = CCBezierTo::create(2, bezier2); m_grossini->runAction( rep); @@ -714,7 +710,7 @@ void ActionSequence::onEnter() alignSpritesLeft(1); CCFiniteTimeAction* action = CCSequence::create( - CCMoveBy::create( 2, CCPointMake(240,0)), + CCMoveBy::create( 2, ccp(240,0)), CCRotateBy::create( 2, 540), NULL); @@ -740,9 +736,9 @@ void ActionSequence2::onEnter() m_grossini->setVisible(false); CCFiniteTimeAction* action = CCSequence::create( - CCPlace::create(CCPointMake(200,200)), + CCPlace::create(ccp(200,200)), CCShow::create(), - CCMoveBy::create(1, CCPointMake(100,0)), + CCMoveBy::create(1, ccp(100,0)), CCCallFunc::create(this, callfunc_selector(ActionSequence2::callback1)), CCCallFuncN::create(this, callfuncN_selector(ActionSequence2::callback2)), CCCallFuncND::create(this, callfuncND_selector(ActionSequence2::callback3), (void*)0xbebabeba), @@ -755,7 +751,7 @@ void ActionSequence2::callback1() { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 1 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*1,s.height/2)); + label->setPosition(ccp( s.width/4*1,s.height/2)); addChild(label); } @@ -764,7 +760,7 @@ void ActionSequence2::callback2(CCNode* sender) { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 2 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*2,s.height/2)); + label->setPosition(ccp( s.width/4*2,s.height/2)); addChild(label); } @@ -773,7 +769,7 @@ void ActionSequence2::callback3(CCNode* sender, void* data) { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 3 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*3,s.height/2)); + label->setPosition(ccp( s.width/4*3,s.height/2)); addChild(label); } @@ -795,7 +791,7 @@ void ActionCallFunc::onEnter() centerSprites(3); CCFiniteTimeAction* action = CCSequence::create( - CCMoveBy::create(2, CCPointMake(200,0)), + CCMoveBy::create(2, ccp(200,0)), CCCallFunc::create(this, callfunc_selector(ActionCallFunc::callback1)), NULL); @@ -821,7 +817,7 @@ void ActionCallFunc::callback1() { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 1 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*1,s.height/2)); + label->setPosition(ccp( s.width/4*1,s.height/2)); addChild(label); } @@ -830,7 +826,7 @@ void ActionCallFunc::callback2(CCNode* pSender) { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 2 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*2,s.height/2)); + label->setPosition(ccp( s.width/4*2,s.height/2)); addChild(label); } @@ -839,7 +835,7 @@ void ActionCallFunc::callback3(CCNode* pTarget, void* data) { CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF *label = CCLabelTTF::create("callback 3 called", "Marker Felt", 16); - label->setPosition(CCPointMake( s.width/4*3,s.height/2)); + label->setPosition(ccp( s.width/4*3,s.height/2)); addChild(label); } @@ -896,7 +892,7 @@ void ActionSpawn::onEnter() CCAction* action = CCSpawn::create( - CCJumpBy::create(2, CCPointMake(300,0), 50, 4), + CCJumpBy::create(2, ccp(300,0), 50, 4), CCRotateBy::create( 2, 720), NULL); @@ -1007,7 +1003,7 @@ void ActionReverse::onEnter() alignSpritesLeft(1); - CCActionInterval* jump = CCJumpBy::create(2, CCPointMake(300,0), 50, 4); + CCActionInterval* jump = CCJumpBy::create(2, ccp(300,0), 50, 4); CCFiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL); m_grossini->runAction(action); @@ -1030,7 +1026,7 @@ void ActionDelayTime::onEnter() alignSpritesLeft(1); - CCActionInterval* move = CCMoveBy::create(1, CCPointMake(150,0)); + CCActionInterval* move = CCMoveBy::create(1, ccp(150,0)); CCFiniteTimeAction* action = CCSequence::create( move, CCDelayTime::create(2), move, NULL); m_grossini->runAction(action); @@ -1053,8 +1049,8 @@ void ActionReverseSequence::onEnter() alignSpritesLeft(1); - CCActionInterval* move1 = CCMoveBy::create(1, CCPointMake(250,0)); - CCActionInterval* move2 = CCMoveBy::create(1, CCPointMake(0,50)); + CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0)); + CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50)); CCFiniteTimeAction* seq = CCSequence::create( move1, move2, move1->reverse(), NULL); CCFiniteTimeAction* action = CCSequence::create( seq, seq->reverse(), NULL); @@ -1081,8 +1077,8 @@ void ActionReverseSequence2::onEnter() // Test: // Sequence should work both with IntervalAction and InstantActions - CCActionInterval* move1 = CCMoveBy::create(1, CCPointMake(250,0)); - CCActionInterval* move2 = CCMoveBy::create(1, CCPointMake(0,50)); + CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0)); + CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50)); CCToggleVisibility* tog1 = new CCToggleVisibility(); CCToggleVisibility* tog2 = new CCToggleVisibility(); tog1->autorelease(); @@ -1096,8 +1092,8 @@ void ActionReverseSequence2::onEnter() // Also test that the reverse of Hide is Show, and vice-versa m_kathia->runAction(action); - CCActionInterval* move_tamara = CCMoveBy::create(1, CCPointMake(100,0)); - CCActionInterval* move_tamara2 = CCMoveBy::create(1, CCPointMake(50,0)); + CCActionInterval* move_tamara = CCMoveBy::create(1, ccp(100,0)); + CCActionInterval* move_tamara2 = CCMoveBy::create(1, ccp(50,0)); CCActionInstant* hide = new CCHide(); hide->autorelease(); CCFiniteTimeAction* seq_tamara = CCSequence::create( move_tamara, hide, move_tamara2, NULL); @@ -1121,9 +1117,9 @@ void ActionRepeat::onEnter() alignSpritesLeft(2); - CCActionInterval* a1 = CCMoveBy::create(1, CCPointMake(150,0)); + CCActionInterval* a1 = CCMoveBy::create(1, ccp(150,0)); CCActionInterval* action1 = CCRepeat::create( - CCSequence::create( CCPlace::create(CCPointMake(60,60)), a1, NULL) , + CCSequence::create( CCPlace::create(ccp(60,60)), a1, NULL) , 3); CCAction* action2 = CCRepeatForever::create( (CCActionInterval*)(CCSequence::create((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL)) @@ -1171,7 +1167,7 @@ void ActionOrbit::onEnter() m_tamara->runAction(CCRepeatForever::create((CCActionInterval*)action2)); m_grossini->runAction(CCRepeatForever::create((CCActionInterval*)action3)); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(100,-100)); + CCActionInterval* move = CCMoveBy::create(3, ccp(100,-100)); CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::create(move, move_back, NULL); CCAction* rfe = CCRepeatForever::create((CCActionInterval*)seq); @@ -1197,8 +1193,8 @@ void ActionFollow::onEnter() centerSprites(1); CCSize s = CCDirector::sharedDirector()->getWinSize(); - m_grossini->setPosition(CCPointMake(-200, s.height / 2)); - CCActionInterval* move = CCMoveBy::create(2, CCPointMake(s.width * 3, 0)); + m_grossini->setPosition(ccp(-200, s.height / 2)); + CCActionInterval* move = CCMoveBy::create(2, ccp(s.width * 3, 0)); CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::create(move, move_back, NULL); CCAction* rep = CCRepeatForever::create((CCActionInterval*)seq); diff --git a/samples/TestCpp/Classes/AppDelegate.cpp b/samples/TestCpp/Classes/AppDelegate.cpp index 01f76e4ecf..cd1f5d8a69 100644 --- a/samples/TestCpp/Classes/AppDelegate.cpp +++ b/samples/TestCpp/Classes/AppDelegate.cpp @@ -23,22 +23,14 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize(); - CCSize designSize = CCSizeMake(480, 320); - if (screenSize.height > 768) - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd"); - pDirector->setContentScaleFactor(1536.0f/designSize.height); - } - else if (screenSize.height > 640) - { - CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad"); - pDirector->setContentScaleFactor(768.0f/designSize.height); - } - else if (screenSize.height > 320) + CCSize designSize = CCSizeMake(480, 320); + + if (screenSize.height > 320) { + CCSize resourceSize = CCSizeMake(960, 640); CCFileUtils::sharedFileUtils()->setResourceDirectory("hd"); - pDirector->setContentScaleFactor(640.0f/designSize.height); + pDirector->setContentScaleFactor(resourceSize.height/designSize.height); } CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder); diff --git a/samples/TestCpp/Classes/Box2DTest/Box2dTest.cpp b/samples/TestCpp/Classes/Box2DTest/Box2dTest.cpp index e036425d15..9dc0ead0df 100644 --- a/samples/TestCpp/Classes/Box2DTest/Box2dTest.cpp +++ b/samples/TestCpp/Classes/Box2DTest/Box2dTest.cpp @@ -63,7 +63,6 @@ Box2DTestLayer::Box2DTestLayer() setTouchEnabled( true ); setAccelerometerEnabled( true ); - CCSize s = CCDirector::sharedDirector()->getWinSize(); // init physics this->initPhysics(); // create reset button @@ -82,12 +81,12 @@ Box2DTestLayer::Box2DTestLayer() addChild(parent, 0, kTagParentNode); - addNewSpriteAtPosition(ccp(s.width/2, s.height/2)); + addNewSpriteAtPosition(VisibleRect::center()); CCLabelTTF *label = CCLabelTTF::create("Tap screen", "Marker Felt", 32); addChild(label, 0); label->setColor(ccc3(0,0,255)); - label->setPosition(ccp( s.width/2, s.height-50)); + label->setPosition(ccp( VisibleRect::center().x, VisibleRect::top().y-50)); scheduleUpdate(); } @@ -102,9 +101,6 @@ Box2DTestLayer::~Box2DTestLayer() void Box2DTestLayer::initPhysics() { - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - b2Vec2 gravity; gravity.Set(0.0f, -10.0f); world = new b2World(gravity); @@ -139,20 +135,19 @@ void Box2DTestLayer::initPhysics() b2EdgeShape groundBox; // bottom - - groundBox.Set(b2Vec2(0,0), b2Vec2(s.width/PTM_RATIO,0)); + groundBox.Set(b2Vec2(VisibleRect::leftBottom().x/PTM_RATIO,VisibleRect::leftBottom().y/PTM_RATIO), b2Vec2(VisibleRect::rightBottom().x/PTM_RATIO,VisibleRect::rightBottom().y/PTM_RATIO)); groundBody->CreateFixture(&groundBox,0); // top - groundBox.Set(b2Vec2(0,s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,s.height/PTM_RATIO)); + groundBox.Set(b2Vec2(VisibleRect::leftTop().x/PTM_RATIO,VisibleRect::leftTop().y/PTM_RATIO), b2Vec2(VisibleRect::rightTop().x/PTM_RATIO,VisibleRect::rightTop().y/PTM_RATIO)); groundBody->CreateFixture(&groundBox,0); // left - groundBox.Set(b2Vec2(0,s.height/PTM_RATIO), b2Vec2(0,0)); + groundBox.Set(b2Vec2(VisibleRect::leftTop().x/PTM_RATIO,VisibleRect::leftTop().y/PTM_RATIO), b2Vec2(VisibleRect::leftBottom().x/PTM_RATIO,VisibleRect::leftBottom().y/PTM_RATIO)); groundBody->CreateFixture(&groundBox,0); // right - groundBox.Set(b2Vec2(s.width/PTM_RATIO,s.height/PTM_RATIO), b2Vec2(s.width/PTM_RATIO,0)); + groundBox.Set(b2Vec2(VisibleRect::rightBottom().x/PTM_RATIO,VisibleRect::rightBottom().y/PTM_RATIO), b2Vec2(VisibleRect::rightTop().x/PTM_RATIO,VisibleRect::rightTop().y/PTM_RATIO)); groundBody->CreateFixture(&groundBox,0); } @@ -162,9 +157,7 @@ void Box2DTestLayer::createResetButton() CCMenu *menu = CCMenu::create(reset, NULL); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - menu->setPosition(ccp(s.width/2, 30)); + menu->setPosition(ccp(VisibleRect::bottom().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); } @@ -212,7 +205,7 @@ void Box2DTestLayer::addNewSpriteAtPosition(CCPoint p) parent->addChild(sprite); - sprite->setPosition( CCPointMake( p.x, p.y) ); + sprite->setPosition( ccp( p.x, p.y) ); // Define the dynamic body. //Set up a 1m squared box in the physics world diff --git a/samples/TestCpp/Classes/Box2DTestBed/Box2dView.cpp b/samples/TestCpp/Classes/Box2DTestBed/Box2dView.cpp index 2d872f6b42..1fd9198e4f 100644 --- a/samples/TestCpp/Classes/Box2DTestBed/Box2dView.cpp +++ b/samples/TestCpp/Classes/Box2DTestBed/Box2dView.cpp @@ -74,9 +74,9 @@ bool MenuLayer::initWithEntryID(int entryId) CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( visibleOrigin.x+visibleSize.width/2 - 100,visibleOrigin.y+30) ); - item2->setPosition( ccp( visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+30) ); - item3->setPosition( ccp( visibleOrigin.x+visibleSize.width/2 + 100,visibleOrigin.y+30) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); diff --git a/samples/TestCpp/Classes/BugsTest/BugsTest.cpp b/samples/TestCpp/Classes/BugsTest/BugsTest.cpp index 020eafc061..87bdde4cb5 100644 --- a/samples/TestCpp/Classes/BugsTest/BugsTest.cpp +++ b/samples/TestCpp/Classes/BugsTest/BugsTest.cpp @@ -157,7 +157,7 @@ void BugsTestBaseLayer::onEnter() CCMenuItemFont::setFontSize(24); CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this, menu_selector(BugsTestBaseLayer::backCallback)); - pMainItem->setPosition(ccp(s.width - 50, 25)); + pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu* pMenu = CCMenu::create(pMainItem, NULL); pMenu->setPosition( CCPointZero ); addChild(pMenu); diff --git a/samples/TestCpp/Classes/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp b/samples/TestCpp/Classes/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp index e3dbc70719..3b4794d03b 100644 --- a/samples/TestCpp/Classes/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp +++ b/samples/TestCpp/Classes/ChipmunkAccelTouchTest/ChipmunkAccelTouchTest.cpp @@ -74,11 +74,9 @@ ChipmunkAccelTouchTestLayer::ChipmunkAccelTouchTestLayer() setTouchEnabled(true); setAccelerometerEnabled(true); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - // title CCLabelTTF *label = CCLabelTTF::create("Multi touch the screen", "Marker Felt", 36); - label->setPosition(ccp( s.width / 2, s.height - 30)); + label->setPosition(ccp( VisibleRect::center().x, VisibleRect::bottom().y - 30)); this->addChild(label, -1); // reset button @@ -116,8 +114,6 @@ ChipmunkAccelTouchTestLayer::~ChipmunkAccelTouchTestLayer() void ChipmunkAccelTouchTestLayer::initPhysics() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); - // init chipmunk //cpInitChipmunk(); @@ -130,16 +126,24 @@ void ChipmunkAccelTouchTestLayer::initPhysics() // We have to free them manually // // bottom - m_pWalls[0] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,0), cpv(s.width,0), 0.0f); + m_pWalls[0] = cpSegmentShapeNew( m_pSpace->staticBody, + cpv(VisibleRect::leftBottom().x,VisibleRect::leftBottom().y), + cpv(VisibleRect::rightBottom().x, VisibleRect::rightBottom().y), 0.0f); // top - m_pWalls[1] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,s.height), cpv(s.width,s.height), 0.0f); + m_pWalls[1] = cpSegmentShapeNew( m_pSpace->staticBody, + cpv(VisibleRect::leftTop().x, VisibleRect::leftTop().y), + cpv(VisibleRect::rightTop().x, VisibleRect::rightTop().y), 0.0f); // left - m_pWalls[2] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(0,0), cpv(0,s.height), 0.0f); + m_pWalls[2] = cpSegmentShapeNew( m_pSpace->staticBody, + cpv(VisibleRect::leftBottom().x,VisibleRect::leftBottom().y), + cpv(VisibleRect::leftTop().x,VisibleRect::leftTop().y), 0.0f); // right - m_pWalls[3] = cpSegmentShapeNew( m_pSpace->staticBody, cpv(s.width,0), cpv(s.width,s.height), 0.0f); + m_pWalls[3] = cpSegmentShapeNew( m_pSpace->staticBody, + cpv(VisibleRect::rightBottom().x, VisibleRect::rightBottom().y), + cpv(VisibleRect::rightTop().x, VisibleRect::rightTop().y), 0.0f); for( int i=0;i<4;i++) { m_pWalls[i]->e = 1.0f; @@ -165,9 +169,7 @@ void ChipmunkAccelTouchTestLayer::createResetButton() CCMenu *menu = CCMenu::create(reset, NULL); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - - menu->setPosition(ccp(s.width/2, 30)); + menu->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y + 30)); this->addChild(menu, -1); } diff --git a/samples/TestCpp/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp b/samples/TestCpp/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp index cf3d5654d0..c020d4c03a 100644 --- a/samples/TestCpp/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/samples/TestCpp/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -25,9 +25,9 @@ MainLayer::MainLayer() addChild(layer, -1); addChild(sprite, 0, kTagSprite); - sprite->setPosition( CCPointMake(20,150) ); + sprite->setPosition( ccp(20,150) ); - sprite->runAction( CCJumpTo::create(4, CCPointMake(300,48), 100, 4) ); + sprite->runAction( CCJumpTo::create(4, ccp(300,48), 100, 4) ); layer->runAction( CCRepeatForever::create( (CCActionInterval*)( CCSequence::create( @@ -46,7 +46,7 @@ void MainLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent) CCNode* s = getChildByTag(kTagSprite); s->stopAllActions(); - s->runAction( CCMoveTo::create(1, CCPointMake(location.x, location.y) ) ); + s->runAction( CCMoveTo::create(1, ccp(location.x, location.y) ) ); float o = location.x - s->getPosition().x; float a = location.y - s->getPosition().y; float at = (float) CC_RADIANS_TO_DEGREES( atanf( o/a) ); diff --git a/samples/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/samples/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp index d177f0aa90..461189dc9b 100644 --- a/samples/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/samples/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -53,7 +53,7 @@ m_nSoundId(0) // add menu items for tests m_pItmeMenu = CCMenu::create(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); + m_nTestCount = sizeof(testItems) / sizeof(testItems[0]); for (int i = 0; i < m_nTestCount; ++i) @@ -66,10 +66,10 @@ m_nSoundId(0) CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(CocosDenshionTest::menuCallback)); m_pItmeMenu->addChild(pMenuItem, i + 10000); - pMenuItem->setPosition( CCPointMake( s.width / 2, (s.height - (i + 1) * LINE_SPACE) )); + pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) )); } - m_pItmeMenu->setContentSize(CCSizeMake(s.width, (m_nTestCount + 1) * LINE_SPACE)); + m_pItmeMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (m_nTestCount + 1) * LINE_SPACE)); m_pItmeMenu->setPosition(CCPointZero); addChild(m_pItmeMenu); @@ -204,16 +204,16 @@ void CocosDenshionTest::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) CCPoint curPos = m_pItmeMenu->getPosition(); CCPoint nextPos = ccp(curPos.x, curPos.y + nMoveY); - CCSize winSize = CCDirector::sharedDirector()->getWinSize(); + if (nextPos.y < 0.0f) { m_pItmeMenu->setPosition(CCPointZero); return; } - if (nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - winSize.height)) + if (nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)) { - m_pItmeMenu->setPosition(ccp(0, ((m_nTestCount + 1)* LINE_SPACE - winSize.height))); + m_pItmeMenu->setPosition(ccp(0, ((m_nTestCount + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))); return; } diff --git a/samples/TestCpp/Classes/CurlTest/CurlTest.cpp b/samples/TestCpp/Classes/CurlTest/CurlTest.cpp index e4d47265ec..7972ab2353 100644 --- a/samples/TestCpp/Classes/CurlTest/CurlTest.cpp +++ b/samples/TestCpp/Classes/CurlTest/CurlTest.cpp @@ -5,16 +5,15 @@ CurlTest::CurlTest() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* label = CCLabelTTF::create("Curl Test", "Arial", 28); addChild(label, 0); - label->setPosition( ccp(s.width/2, s.height-50) ); + label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) ); setTouchEnabled(true); // create a label to display the tip string m_pLabel = CCLabelTTF::create("Touch the screen to connect", "Arial", 22); - m_pLabel->setPosition(ccp(s.width / 2, s.height / 2)); + m_pLabel->setPosition(VisibleRect::center()); addChild(m_pLabel, 0); m_pLabel->retain(); diff --git a/samples/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp b/samples/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp index 6a954b4971..0ef3d20c89 100644 --- a/samples/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp +++ b/samples/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp @@ -2,13 +2,12 @@ CurrentLanguageTest::CurrentLanguageTest() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* label = CCLabelTTF::create("Current language Test", "Arial", 28); addChild(label, 0); - label->setPosition( ccp(s.width/2, s.height-50) ); + label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y-50) ); CCLabelTTF *labelLanguage = CCLabelTTF::create("", "Arial", 20); - labelLanguage->setPosition(ccp(s.width/2, s.height/2)); + labelLanguage->setPosition(VisibleRect::center()); ccLanguageType currentLanguageType = CCApplication::sharedApplication()->getCurrentLanguage(); switch (currentLanguageType) diff --git a/samples/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/samples/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index a012a8bf57..1a446c5dcb 100644 --- a/samples/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/samples/TestCpp/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -6,8 +6,6 @@ DrawPrimitivesTest::DrawPrimitivesTest() void DrawPrimitivesTest::draw() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CHECK_GL_ERROR_DEBUG(); // draw a simple line @@ -16,7 +14,7 @@ void DrawPrimitivesTest::draw() // color: 255,255,255,255 (white, non-transparent) // Anti-Aliased // glEnable(GL_LINE_SMOOTH); - ccDrawLine( ccp(0, 0), ccp(s.width, s.height) ); + ccDrawLine( VisibleRect::leftBottom(), VisibleRect::rightTop() ); CHECK_GL_ERROR_DEBUG(); @@ -26,7 +24,7 @@ void DrawPrimitivesTest::draw() // glDisable(GL_LINE_SMOOTH); glLineWidth( 5.0f ); ccDrawColor4B(255,0,0,255); - ccDrawLine( ccp(0, s.height), ccp(s.width, 0) ); + ccDrawLine( VisibleRect::leftTop(), VisibleRect::rightBottom() ); CHECK_GL_ERROR_DEBUG(); @@ -39,7 +37,7 @@ void DrawPrimitivesTest::draw() // draw big point in the center ccPointSize(64); ccDrawColor4B(0,0,255,128); - ccDrawPoint( ccp(s.width / 2, s.height / 2) ); + ccDrawPoint( VisibleRect::center() ); CHECK_GL_ERROR_DEBUG(); @@ -54,14 +52,14 @@ void DrawPrimitivesTest::draw() // draw a green circle with 10 segments glLineWidth(16); ccDrawColor4B(0, 255, 0, 255); - ccDrawCircle( ccp(s.width/2, s.height/2), 100, 0, 10, false); + ccDrawCircle( VisibleRect::center(), 100, 0, 10, false); CHECK_GL_ERROR_DEBUG(); // draw a green circle with 50 segments with line to center glLineWidth(2); ccDrawColor4B(0, 255, 255, 255); - ccDrawCircle( ccp(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, true); + ccDrawCircle( VisibleRect::center(), 50, CC_DEGREES_TO_RADIANS(90), 50, true); CHECK_GL_ERROR_DEBUG(); @@ -87,12 +85,12 @@ void DrawPrimitivesTest::draw() CHECK_GL_ERROR_DEBUG(); // draw quad bezier path - ccDrawQuadBezier(ccp(0,s.height), ccp(s.width/2,s.height/2), ccp(s.width,s.height), 50); + ccDrawQuadBezier(VisibleRect::leftTop(), VisibleRect::center(), VisibleRect::rightTop(), 50); CHECK_GL_ERROR_DEBUG(); // draw cubic bezier path - ccDrawCubicBezier(ccp(s.width/2, s.height/2), ccp(s.width/2+30,s.height/2+50), ccp(s.width/2+60,s.height/2-50),ccp(s.width, s.height/2),100); + ccDrawCubicBezier(VisibleRect::center(), ccp(VisibleRect::center().x+30,VisibleRect::center().y+50), ccp(VisibleRect::center().x+60,VisibleRect::center().y-50),VisibleRect::right(),100); CHECK_GL_ERROR_DEBUG(); diff --git a/samples/TestCpp/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/samples/TestCpp/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp index 77971b6da1..e01e1fbecc 100644 --- a/samples/TestCpp/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/samples/TestCpp/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -329,33 +329,28 @@ CCLayer* restartEffectAdvanceAction() void EffectAdvanceTextLayer::onEnter(void) { CCLayer::onEnter(); - float x,y; - - CCSize size = CCDirector::sharedDirector()->getWinSize(); - x = size.width; - y = size.height; CCSprite *bg = CCSprite::create("Images/background3.png"); addChild(bg, 0, kTagBackground); - bg->setPosition( ccp(x/2,y/2) ); + bg->setPosition( VisibleRect::center() ); CCSprite* grossini = CCSprite::create("Images/grossinis_sister2.png"); bg->addChild(grossini, 1, kTagSprite1); - grossini->setPosition( ccp(x/3.0f,200) ); + grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3.0f, VisibleRect::bottom().y+ 200) ); CCActionInterval* sc = CCScaleBy::create(2, 5); CCActionInterval* sc_back = sc->reverse(); grossini->runAction( CCRepeatForever::create( (CCActionInterval*)(CCSequence::create(sc, sc_back, NULL)) ) ); CCSprite* tamara = CCSprite::create("Images/grossinis_sister1.png"); bg->addChild(tamara, 1, kTagSprite2); - tamara->setPosition( ccp(2*x/3.0f,200) ); + tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3.0f,VisibleRect::bottom().y+200) ); CCActionInterval* sc2 = CCScaleBy::create(2, 5); CCActionInterval* sc2_back = sc2->reverse(); tamara->runAction( CCRepeatForever::create( (CCActionInterval*)(CCSequence::create(sc2, sc2_back, NULL)) ) ); CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Marker Felt", 28); - label->setPosition( ccp(x/2,y-80) ); + label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) ); addChild(label); label->setTag( kTagLabel ); @@ -364,7 +359,7 @@ void EffectAdvanceTextLayer::onEnter(void) { CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16); addChild(l, 101); - l->setPosition( ccp(size.width/2, size.height-80) ); + l->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) ); } CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(EffectAdvanceTextLayer::backCallback) ); @@ -374,9 +369,9 @@ void EffectAdvanceTextLayer::onEnter(void) CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp(size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(ccp(size.width/2, item2->getContentSize().height/2)); - item3->setPosition(ccp(size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/EffectsTest/EffectsTest.cpp b/samples/TestCpp/Classes/EffectsTest/EffectsTest.cpp index 937e4602a1..aa6fdd33ac 100644 --- a/samples/TestCpp/Classes/EffectsTest/EffectsTest.cpp +++ b/samples/TestCpp/Classes/EffectsTest/EffectsTest.cpp @@ -86,7 +86,7 @@ public: static CCActionInterval* create(float t) { CCSize size = CCDirector::sharedDirector()->getWinSize(); - return CCLens3D::create(CCPointMake(size.width/2,size.height/2), 240, ccg(15,10), t); + return CCLens3D::create(ccp(size.width/2,size.height/2), 240, ccg(15,10), t); } }; @@ -97,7 +97,7 @@ public: static CCActionInterval* create(float t) { CCSize size = CCDirector::sharedDirector()->getWinSize(); - return CCRipple3D::create(CCPointMake(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t); + return CCRipple3D::create(ccp(size.width/2,size.height/2), 240, 4, 160, ccg(32,24), t); } }; @@ -128,7 +128,7 @@ public: static CCActionInterval* create(float t) { CCSize size = CCDirector::sharedDirector()->getWinSize(); - return CCTwirl::create(CCPointMake(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t); + return CCTwirl::create(ccp(size.width/2, size.height/2), 1, 2.5f, ccg(12,8), t); } }; @@ -340,12 +340,6 @@ void EffectTestScene::runThisTest() TextLayer::TextLayer(void) { initWithColor( ccc4(32,128,32,255) ); - - float x,y; - - CCSize s = CCDirector::sharedDirector()->getWinSize(); - x = s.width; - y = s.height; CCNode* node = CCNode::create(); CCActionInterval* effect = getAction(); @@ -355,25 +349,25 @@ TextLayer::TextLayer(void) CCSprite *bg = CCSprite::create(s_back3); node->addChild(bg, 0); // bg->setAnchorPoint( CCPointZero ); - bg->setPosition(ccp(s.width/2, s.height/2)); + bg->setPosition(VisibleRect::center()); CCSprite* grossini = CCSprite::create(s_pPathSister2); node->addChild(grossini, 1); - grossini->setPosition( CCPointMake(x/3,y/2) ); + grossini->setPosition( ccp(VisibleRect::left().x+VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); CCActionInterval* sc = CCScaleBy::create(2, 5); CCActionInterval* sc_back = sc->reverse(); grossini->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(sc, sc_back, NULL)) ) ); CCSprite* tamara = CCSprite::create(s_pPathSister1); node->addChild(tamara, 1); - tamara->setPosition( CCPointMake(2*x/3,y/2) ); + tamara->setPosition( ccp(VisibleRect::left().x+2*VisibleRect::getVisibleRect().size.width/3,VisibleRect::center().y) ); CCActionInterval* sc2 = CCScaleBy::create(2, 5); CCActionInterval* sc2_back = sc2->reverse(); tamara->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(sc2, sc2_back, NULL))) ); CCLabelTTF* label = CCLabelTTF::create((effectsList[actionIdx]).c_str(), "Marker Felt", 32); - label->setPosition( CCPointMake(x/2,y-80) ); + label->setPosition( ccp(VisibleRect::center().x,VisibleRect::top().y-80) ); addChild(label); label->setTag( kTagLabel ); @@ -384,9 +378,9 @@ TextLayer::TextLayer(void) CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(CCPointMake( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(CCPointMake( s.width/2, item2->getContentSize().height/2)); - item3->setPosition(CCPointMake( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); diff --git a/samples/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp b/samples/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp index fa4e477a67..549da85611 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/ControlExtensionTest/CCControlScene.cpp @@ -42,30 +42,27 @@ bool CCControlScene::init() { if (CCLayer::init()) { - // Get the sceensize - CCSize screensize = CCDirector::sharedDirector()->getWinSize(); - CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", this, menu_selector(CCControlScene::toExtensionsMainLayer)); - pBackItem->setPosition(ccp(screensize.width - 50, 25)); + pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL); pBackMenu->setPosition( CCPointZero ); addChild(pBackMenu, 10); // Add the generated background CCSprite *background = CCSprite::create("extensions/background.png"); - background->setPosition(ccp(screensize.width / 2, screensize.height / 2)); + background->setPosition(VisibleRect::center()); addChild(background); // Add the ribbon CCScale9Sprite *ribbon = CCScale9Sprite::create("extensions/ribbon.png", CCRectMake(1, 1, 48, 55)); - ribbon->setContentSize(CCSizeMake(screensize.width, 57)); - ribbon->setPosition(ccp(screensize.width / 2.0f, screensize.height - ribbon->getContentSize().height / 2.0f)); + ribbon->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, 57)); + ribbon->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y - ribbon->getContentSize().height / 2.0f)); addChild(ribbon); // Add the title setSceneTitleLabel(CCLabelTTF::create("Title", "Arial", 12)); - m_pSceneTitleLabel->setPosition(ccp (screensize.width / 2, screensize.height - m_pSceneTitleLabel->getContentSize().height / 2 - 5)); + m_pSceneTitleLabel->setPosition(ccp (VisibleRect::center().x, VisibleRect::top().y - m_pSceneTitleLabel->getContentSize().height / 2 - 5)); addChild(m_pSceneTitleLabel, 1); // Add the menu @@ -75,9 +72,9 @@ bool CCControlScene::init() CCMenu *menu = CCMenu::create(item1, item3, item2, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp(screensize.width / 2 - 100, 37)); - item2->setPosition(ccp(screensize.width / 2, 35)); - item3->setPosition(ccp(screensize.width / 2 + 100, 37)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu ,1); diff --git a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index abe50a6030..251439c2fa 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -43,7 +43,7 @@ HttpClientTest::HttpClientTest() // Back Menu CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(HttpClientTest::toExtensionsMainLayer)); - itemBack->setPosition(ccp(winSize.width - 50, 25)); + itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu *menuBack = CCMenu::create(itemBack, NULL); menuBack->setPosition(CCPointZero); addChild(menuBack); diff --git a/samples/TestCpp/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp b/samples/TestCpp/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp index ceb07b80b7..f3feef0716 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/NotificationCenterTest/NotificationCenterTest.cpp @@ -84,7 +84,7 @@ NotificationCenterTest::NotificationCenterTest() CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", this, menu_selector(NotificationCenterTest::toExtensionsMainLayer)); - pBackItem->setPosition(ccp(s.width - 50, 25)); + pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL); pBackMenu->setPosition( CCPointZero ); addChild(pBackMenu); diff --git a/samples/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/samples/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index daafeb6b38..7bbd2e691f 100644 --- a/samples/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/samples/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -40,7 +40,7 @@ bool TableViewTestLayer::init() // Back Menu CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(TableViewTestLayer::toExtensionsMainLayer)); - itemBack->setPosition(ccp(winSize.width - 50, 25)); + itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu *menuBack = CCMenu::create(itemBack, NULL); menuBack->setPosition(CCPointZero); addChild(menuBack); diff --git a/samples/TestCpp/Classes/FontTest/FontTest.cpp b/samples/TestCpp/Classes/FontTest/FontTest.cpp index 75a7be595c..3e8c9d46a2 100644 --- a/samples/TestCpp/Classes/FontTest/FontTest.cpp +++ b/samples/TestCpp/Classes/FontTest/FontTest.cpp @@ -74,16 +74,15 @@ static const char* restartAction(void) FontTest::FontTest() { - CCSize s = CCDirector::sharedDirector()->getWinSize(); CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(FontTest::backCallback)); CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(FontTest::restartCallback)); CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(FontTest::nextCallback)); CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(ccp( s.width/2, item2->getContentSize().height/2)); - item3->setPosition(ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); showFont(restartAction()); diff --git a/samples/TestCpp/Classes/IntervalTest/IntervalTest.cpp b/samples/TestCpp/Classes/IntervalTest/IntervalTest.cpp index 18f8173abd..166604e7c8 100644 --- a/samples/TestCpp/Classes/IntervalTest/IntervalTest.cpp +++ b/samples/TestCpp/Classes/IntervalTest/IntervalTest.cpp @@ -17,7 +17,7 @@ IntervalLayer::IntervalLayer() // sun CCParticleSystem* sun = CCParticleSun::create(); sun->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); - sun->setPosition( CCPointMake(s.width-32,s.height-32) ); + sun->setPosition( ccp(VisibleRect::rightTop().x-32,VisibleRect::rightTop().y-32) ); sun->setTotalParticles(130); sun->setLife(0.6f); @@ -36,11 +36,11 @@ IntervalLayer::IntervalLayer() schedule(schedule_selector(IntervalLayer::step3), 1.0f); schedule(schedule_selector(IntervalLayer::step4), 2.0f); - m_label0->setPosition(CCPointMake(s.width*1/6, s.height/2)); - m_label1->setPosition(CCPointMake(s.width*2/6, s.height/2)); - m_label2->setPosition(CCPointMake(s.width*3/6, s.height/2)); - m_label3->setPosition(CCPointMake(s.width*4/6, s.height/2)); - m_label4->setPosition(CCPointMake(s.width*5/6, s.height/2)); + m_label0->setPosition(ccp(s.width*1/6, s.height/2)); + m_label1->setPosition(ccp(s.width*2/6, s.height/2)); + m_label2->setPosition(ccp(s.width*3/6, s.height/2)); + m_label3->setPosition(ccp(s.width*4/6, s.height/2)); + m_label4->setPosition(ccp(s.width*5/6, s.height/2)); addChild(m_label0); addChild(m_label1); @@ -50,9 +50,9 @@ IntervalLayer::IntervalLayer() // Sprite CCSprite* sprite = CCSprite::create(s_pPathGrossini); - sprite->setPosition( CCPointMake(40,50) ); + sprite->setPosition( ccp(VisibleRect::left().x + 40, VisibleRect::bottom().y + 50) ); - CCJumpBy* jump = CCJumpBy::create(3, CCPointMake(s.width-80,0), 50, 4); + CCJumpBy* jump = CCJumpBy::create(3, ccp(s.width-80,0), 50, 4); addChild(sprite); sprite->runAction( CCRepeatForever::create( @@ -62,7 +62,7 @@ IntervalLayer::IntervalLayer() // pause button CCMenuItem* item1 = CCMenuItemFont::create("Pause", this, menu_selector(IntervalLayer::onPause) ); CCMenu* menu = CCMenu::create(item1, NULL); - menu->setPosition( CCPointMake(s.width/2, s.height-50) ); + menu->setPosition( ccp(s.width/2, s.height-50) ); addChild( menu ); } diff --git a/samples/TestCpp/Classes/LabelTest/LabelTest.cpp b/samples/TestCpp/Classes/LabelTest/LabelTest.cpp index 020d2a7e46..b583099621 100644 --- a/samples/TestCpp/Classes/LabelTest/LabelTest.cpp +++ b/samples/TestCpp/Classes/LabelTest/LabelTest.cpp @@ -155,9 +155,9 @@ void AtlasDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2)); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));; addChild(menu, 1); } @@ -447,9 +447,9 @@ Atlas3::Atlas3() CCSize s = CCDirector::sharedDirector()->getWinSize(); - label1->setPosition( ccp( 0,0) ); - label2->setPosition( ccp( s.width/2, s.height/2) ); - label3->setPosition( ccp( s.width, s.height) ); + label1->setPosition( VisibleRect::leftBottom() ); + label2->setPosition( VisibleRect::center() ); + label3->setPosition( VisibleRect::rightTop() ); schedule( schedule_selector(Atlas3::step) );//:@selector(step:)]; } @@ -776,10 +776,9 @@ BitmapFontMultiLine::BitmapFontMultiLine() s = label3->getContentSize(); CCLOG("content size: %.2fx%.2f", s.width, s.height); - s = CCDirector::sharedDirector()->getWinSize(); - label1->setPosition(ccp( 0,0)); - label2->setPosition(ccp( s.width/2, s.height/2)); - label3->setPosition(ccp( s.width, s.height)); + label1->setPosition(VisibleRect::leftBottom()); + label2->setPosition(VisibleRect::center()); + label3->setPosition(VisibleRect::rightTop()); } std::string BitmapFontMultiLine::title() diff --git a/samples/TestCpp/Classes/LayerTest/LayerTest.cpp b/samples/TestCpp/Classes/LayerTest/LayerTest.cpp index 55f8e61c3f..cfafc72df6 100644 --- a/samples/TestCpp/Classes/LayerTest/LayerTest.cpp +++ b/samples/TestCpp/Classes/LayerTest/LayerTest.cpp @@ -94,7 +94,7 @@ void LayerTest::onEnter() CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label, 1); - label->setPosition( CCPointMake(s.width/2, s.height-50) ); + label->setPosition( ccp(s.width/2, s.height-50) ); string subtitle_ = subtitle(); if (subtitle_.size() > 0) @@ -111,9 +111,9 @@ void LayerTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } @@ -158,7 +158,7 @@ void LayerTest1::onEnter() CCLayerColor* layer = CCLayerColor::create( ccc4(0xFF, 0x00, 0x00, 0x80), 200, 200); layer->ignoreAnchorPointForPosition(false); - layer->setPosition( CCPointMake(s.width/2, s.height/2) ); + layer->setPosition( ccp(s.width/2, s.height/2) ); addChild(layer, 1, kTagLayer); } @@ -218,12 +218,12 @@ void LayerTest2::onEnter() CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLayerColor* layer1 = CCLayerColor::create( ccc4(255, 255, 0, 80), 100, 300); - layer1->setPosition(CCPointMake(s.width/3, s.height/2)); + layer1->setPosition(ccp(s.width/3, s.height/2)); layer1->ignoreAnchorPointForPosition(false); addChild(layer1, 1); CCLayerColor* layer2 = CCLayerColor::create( ccc4(0, 0, 255, 255), 100, 300); - layer2->setPosition(CCPointMake((s.width/3)*2, s.height/2)); + layer2->setPosition(ccp((s.width/3)*2, s.height/2)); layer2->ignoreAnchorPointForPosition(false); addChild(layer2, 1); @@ -261,8 +261,8 @@ LayerTestBlend::LayerTestBlend() addChild(sister2); addChild(layer1, 100, kTagLayer); - sister1->setPosition( CCPointMake( 160, s.height/2) ); - sister2->setPosition( CCPointMake( 320, s.height/2) ); + sister1->setPosition( ccp( 160, s.height/2) ); + sister2->setPosition( ccp( 320, s.height/2) ); schedule( schedule_selector(LayerTestBlend::newBlend), 1.0f); } diff --git a/samples/TestCpp/Classes/MenuTest/MenuTest.cpp b/samples/TestCpp/Classes/MenuTest/MenuTest.cpp index 3b39b9b5a8..04dffd740e 100644 --- a/samples/TestCpp/Classes/MenuTest/MenuTest.cpp +++ b/samples/TestCpp/Classes/MenuTest/MenuTest.cpp @@ -97,11 +97,9 @@ MenuLayerMainMenu::MenuLayerMainMenu() if( i % 2 == 0) offset = -offset; - child->setPosition( CCPointMake( dstPoint.x + offset, dstPoint.y) ); + child->setPosition( ccp( dstPoint.x + offset, dstPoint.y) ); child->runAction( - CCEaseElasticOut::create( - CCMoveBy::create(2, CCPointMake(dstPoint.x - offset,0)), 0.35f - ) + CCEaseElasticOut::create(CCMoveBy::create(2, ccp(dstPoint.x - offset,0)), 0.35f) ); i++; } @@ -237,7 +235,7 @@ void MenuLayer2::alignMenusH() // TIP: if no padding, padding = 5 menu->alignItemsHorizontally(); CCPoint p = menu->getPosition(); - menu->setPosition( ccpAdd(p, CCPointMake(0,30)) ); + menu->setPosition( ccpAdd(p, ccp(0,30)) ); } else @@ -245,7 +243,7 @@ void MenuLayer2::alignMenusH() // TIP: but padding is configurable menu->alignItemsHorizontallyWithPadding(40); CCPoint p = menu->getPosition(); - menu->setPosition( ccpSub(p, CCPointMake(0,30)) ); + menu->setPosition( ccpSub(p, ccp(0,30)) ); } } } @@ -261,14 +259,14 @@ void MenuLayer2::alignMenusV() // TIP: if no padding, padding = 5 menu->alignItemsVertically(); CCPoint p = menu->getPosition(); - menu->setPosition( ccpAdd(p, CCPointMake(100,0)) ); + menu->setPosition( ccpAdd(p, ccp(100,0)) ); } else { // TIP: but padding is configurable menu->alignItemsVerticallyWithPadding(40); CCPoint p = menu->getPosition(); - menu->setPosition( ccpSub(p, CCPointMake(100,0)) ); + menu->setPosition( ccpSub(p, ccp(100,0)) ); } } } @@ -322,15 +320,15 @@ MenuLayer3::MenuLayer3() m_disabledItem->setEnabled( false ); CCMenu *menu = CCMenu::create( item1, item2, item3, NULL); - menu->setPosition( CCPointMake(0,0) ); + menu->setPosition( ccp(0,0) ); CCSize s = CCDirector::sharedDirector()->getWinSize(); - item1->setPosition( CCPointMake(s.width/2 - 150, s.height/2) ); - item2->setPosition( CCPointMake(s.width/2 - 200, s.height/2) ); - item3->setPosition( CCPointMake(s.width/2, s.height/2 - 100) ); + item1->setPosition( ccp(s.width/2 - 150, s.height/2) ); + item2->setPosition( ccp(s.width/2 - 200, s.height/2) ); + item3->setPosition( ccp(s.width/2, s.height/2 - 100) ); - CCJumpBy* jump = CCJumpBy::create(3, CCPointMake(400,0), 50, 4); + CCJumpBy* jump = CCJumpBy::create(3, ccp(400,0), 50, 4); item2->runAction( CCRepeatForever::create( (CCActionInterval*)(CCSequence::create( jump, jump->reverse(), NULL)) ) diff --git a/samples/TestCpp/Classes/MotionStreakTest/MotionStreakTest.cpp b/samples/TestCpp/Classes/MotionStreakTest/MotionStreakTest.cpp index c6851be64d..99194e1550 100644 --- a/samples/TestCpp/Classes/MotionStreakTest/MotionStreakTest.cpp +++ b/samples/TestCpp/Classes/MotionStreakTest/MotionStreakTest.cpp @@ -42,7 +42,7 @@ void MotionStreakTest1::onEnter() CCActionInterval* a1 = CCRotateBy::create(2, 360); CCAction* action1 = CCRepeatForever::create(a1); - CCActionInterval* motion = CCMoveBy::create(2, CCPointMake(100,0) ); + CCActionInterval* motion = CCMoveBy::create(2, ccp(100,0) ); m_root->runAction( CCRepeatForever::create((CCActionInterval*)(CCSequence::create(motion, motion->reverse(), NULL)) ) ); m_root->runAction( action1 ); @@ -87,7 +87,7 @@ void MotionStreakTest2::onEnter() streak = CCMotionStreak::create(3, 3, 64, ccWHITE, s_streak ); addChild(streak); - streak->setPosition( CCPointMake(s.width/2, s.height/2) ); + streak->setPosition( ccp(s.width/2, s.height/2) ); } void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event) @@ -234,7 +234,7 @@ void MotionStreakTest::onEnter() CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label, 0, kTagLabel); - label->setPosition(CCPointMake(s.width/2, s.height-50)); + label->setPosition(ccp(s.width/2, s.height-50)); string subTitle = this->subtitle(); if (subTitle.size() > 0) @@ -251,9 +251,9 @@ void MotionStreakTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(CCPointMake(s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(CCPointMake(s.width/2, item2->getContentSize().height/2)); - item3->setPosition(CCPointMake(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); diff --git a/samples/TestCpp/Classes/NodeTest/NodeTest.cpp b/samples/TestCpp/Classes/NodeTest/NodeTest.cpp index 82b6b8385d..2d02b84807 100644 --- a/samples/TestCpp/Classes/NodeTest/NodeTest.cpp +++ b/samples/TestCpp/Classes/NodeTest/NodeTest.cpp @@ -106,14 +106,14 @@ void TestCocosNodeDemo::onEnter() CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label, 10); - label->setPosition( CCPointMake(s.width/2, s.height-50) ); + label->setPosition( ccp(s.width/2, s.height-50) ); std::string strSubtitle = subtitle(); if( ! strSubtitle.empty() ) { CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Thonburi", 16); addChild(l, 1); - l->setPosition( CCPointMake(s.width/2, s.height-80) ); + l->setPosition( ccp(s.width/2, s.height-80) ); } CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TestCocosNodeDemo::backCallback) ); @@ -123,9 +123,9 @@ void TestCocosNodeDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 11); } @@ -172,8 +172,8 @@ void Test2::onEnter() CCSprite *sp3 = CCSprite::create(s_pPathSister1); CCSprite *sp4 = CCSprite::create(s_pPathSister2); - sp1->setPosition(CCPointMake(100, s.height /2 )); - sp2->setPosition(CCPointMake(380, s.height /2 )); + sp1->setPosition(ccp(100, s.height /2 )); + sp2->setPosition(ccp(380, s.height /2 )); addChild(sp1); addChild(sp2); @@ -197,7 +197,7 @@ void Test2::onEnter() NULL) ) ); - sp2->setAnchorPoint(CCPointMake(0,0)); + sp2->setAnchorPoint(ccp(0,0)); sp1->runAction(action1); sp2->runAction(action2); @@ -222,8 +222,8 @@ Test4::Test4() CCSprite *sp1 = CCSprite::create(s_pPathSister1); CCSprite *sp2 = CCSprite::create(s_pPathSister2); - sp1->setPosition( CCPointMake(100,160) ); - sp2->setPosition( CCPointMake(380,160) ); + sp1->setPosition( ccp(100,160) ); + sp2->setPosition( ccp(380,160) ); addChild(sp1, 0, 2); addChild(sp2, 0, 3); @@ -261,8 +261,8 @@ Test5::Test5() CCSprite* sp1 = CCSprite::create(s_pPathSister1); CCSprite* sp2 = CCSprite::create(s_pPathSister2); - sp1->setPosition(CCPointMake(100,160)); - sp2->setPosition(CCPointMake(380,160)); + sp1->setPosition(ccp(100,160)); + sp2->setPosition(ccp(380,160)); CCRotateBy* rot = CCRotateBy::create(2, 360); CCActionInterval* rot_back = rot->reverse(); @@ -318,8 +318,8 @@ Test6::Test6() CCSprite* sp2 = CCSprite::create(s_pPathSister2); CCSprite* sp21 = CCSprite::create(s_pPathSister2); - sp1->setPosition(CCPointMake(100,160)); - sp2->setPosition(CCPointMake(380,160)); + sp1->setPosition(ccp(100,160)); + sp2->setPosition(ccp(380,160)); CCActionInterval* rot = CCRotateBy::create(2, 360); CCActionInterval* rot_back = rot->reverse(); @@ -379,7 +379,7 @@ StressTest1::StressTest1() CCSprite *sp1 = CCSprite::create(s_pPathSister1); addChild(sp1, 0, kTagSprite1); - sp1->setPosition( CCPointMake(s.width/2, s.height/2) ); + sp1->setPosition( ccp(s.width/2, s.height/2) ); schedule( schedule_selector(StressTest1::shouldNotCrash), 1.0f); } @@ -397,7 +397,7 @@ void StressTest1::shouldNotCrash(float dt) // if it doesn't, it works Ok. // CocosNode *explosion = [Sprite create:@"grossinis_sister2.png"); - explosion->setPosition( CCPointMake(s.width/2, s.height/2) ); + explosion->setPosition( ccp(s.width/2, s.height/2) ); runAction( CCSequence::create( CCRotateBy::create(2, 360), @@ -432,9 +432,9 @@ StressTest2::StressTest2() CCLayer* sublayer = CCLayer::create(); CCSprite *sp1 = CCSprite::create(s_pPathSister1); - sp1->setPosition( CCPointMake(80, s.height/2) ); + sp1->setPosition( ccp(80, s.height/2) ); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(350,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(350,0)); CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 2.0f); CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse(); CCFiniteTimeAction* seq3 = CCSequence::create( move_ease_inout3, move_ease_inout_back3, NULL); @@ -443,7 +443,7 @@ StressTest2::StressTest2() CCParticleFire* fire = CCParticleFire::create(); fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); - fire->setPosition( CCPointMake(80, s.height/2-50) ); + fire->setPosition( ccp(80, s.height/2-50) ); CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease()); @@ -512,20 +512,20 @@ NodeToWorld::NodeToWorld() CCSprite *back = CCSprite::create(s_back3); addChild( back, -10); - back->setAnchorPoint( CCPointMake(0,0) ); + back->setAnchorPoint( ccp(0,0) ); CCSize backSize = back->getContentSize(); CCMenuItem *item = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect); CCMenu *menu = CCMenu::create(item, NULL); menu->alignItemsVertically(); - menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2)); + menu->setPosition( ccp(backSize.width/2, backSize.height/2)); back->addChild(menu); CCActionInterval* rot = CCRotateBy::create(5, 360); CCAction* fe = CCRepeatForever::create( rot); item->runAction( fe ); - CCActionInterval* move = CCMoveBy::create(3, CCPointMake(200,0)); + CCActionInterval* move = CCMoveBy::create(3, ccp(200,0)); CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::create( move, move_back, NULL); CCAction* fe2 = CCRepeatForever::create((CCActionInterval*)seq); @@ -560,7 +560,7 @@ CameraOrbitTest::CameraOrbitTest() CCSprite *p = CCSprite::create(s_back3); addChild( p, 0); - p->setPosition( CCPointMake(s.width/2, s.height/2) ); + p->setPosition( ccp(s.width/2, s.height/2) ); p->setOpacity( 128 ); CCSprite* sprite; @@ -573,7 +573,7 @@ CameraOrbitTest::CameraOrbitTest() sprite = CCSprite::create(s_pPathGrossini); sprite->setScale(0.5f); p->addChild(sprite, 0); - sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) ); + sprite->setPosition( ccp(s.width/4*1, s.height/2) ); cam = sprite->getCamera(); orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 0, 0); sprite->runAction( CCRepeatForever::create( orbit ) ); @@ -582,7 +582,7 @@ CameraOrbitTest::CameraOrbitTest() sprite = CCSprite::create(s_pPathGrossini); sprite->setScale( 1.0f ); p->addChild(sprite, 0); - sprite->setPosition( CCPointMake(s.width/4*2, s.height/2) ); + sprite->setPosition( ccp(s.width/4*2, s.height/2) ); orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 45, 0); sprite->runAction( CCRepeatForever::create( orbit ) ); @@ -591,7 +591,7 @@ CameraOrbitTest::CameraOrbitTest() sprite = CCSprite::create(s_pPathGrossini); sprite->setScale( 2.0f ); p->addChild(sprite, 0); - sprite->setPosition( CCPointMake(s.width/4*3, s.height/2) ); + sprite->setPosition( ccp(s.width/4*3, s.height/2) ); ss = sprite->getContentSize(); orbit = CCOrbitCamera::create(2, 1, 0, 0, 360, 90, -45), sprite->runAction( CCRepeatForever::create(orbit) ); @@ -638,7 +638,7 @@ CameraZoomTest::CameraZoomTest() // LEFT sprite = CCSprite::create(s_pPathGrossini); addChild( sprite, 0); - sprite->setPosition( CCPointMake(s.width/4*1, s.height/2) ); + sprite->setPosition( ccp(s.width/4*1, s.height/2) ); cam = sprite->getCamera(); cam->setEyeXYZ(0, 0, 415/2); cam->setCenterXYZ(0, 0, 0); @@ -646,12 +646,12 @@ CameraZoomTest::CameraZoomTest() // CENTER sprite = CCSprite::create(s_pPathGrossini); addChild( sprite, 0, 40); - sprite->setPosition(CCPointMake(s.width/4*2, s.height/2)); + sprite->setPosition(ccp(s.width/4*2, s.height/2)); // RIGHT sprite = CCSprite::create(s_pPathGrossini); addChild( sprite, 0, 20); - sprite->setPosition(CCPointMake(s.width/4*3, s.height/2)); + sprite->setPosition(ccp(s.width/4*3, s.height/2)); m_z = 0; scheduleUpdate(); @@ -693,19 +693,19 @@ CameraCenterTest::CameraCenterTest() // LEFT-TOP sprite = CCSprite::create("Images/white-512x512.png"); addChild( sprite, 0); - sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*1)); + sprite->setPosition(ccp(s.width/5*1, s.height/5*1)); sprite->setColor(ccRED); sprite->setTextureRect(CCRectMake(0, 0, 120, 50)); orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0); sprite->runAction(CCRepeatForever::create( orbit )); -// [sprite setAnchorPoint: CCPointMake(0,1)); +// [sprite setAnchorPoint: ccp(0,1)); // LEFT-BOTTOM sprite = CCSprite::create("Images/white-512x512.png"); addChild( sprite, 0, 40); - sprite->setPosition(CCPointMake(s.width/5*1, s.height/5*4)); + sprite->setPosition(ccp(s.width/5*1, s.height/5*4)); sprite->setColor(ccBLUE); sprite->setTextureRect(CCRectMake(0, 0, 120, 50)); orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0); @@ -715,7 +715,7 @@ CameraCenterTest::CameraCenterTest() // RIGHT-TOP sprite = CCSprite::create("Images/white-512x512.png"); addChild( sprite, 0); - sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*1)); + sprite->setPosition(ccp(s.width/5*4, s.height/5*1)); sprite->setColor(ccYELLOW); sprite->setTextureRect(CCRectMake(0, 0, 120, 50)); orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0); @@ -725,7 +725,7 @@ CameraCenterTest::CameraCenterTest() // RIGHT-BOTTOM sprite = CCSprite::create("Images/white-512x512.png"); addChild( sprite, 0, 40); - sprite->setPosition(CCPointMake(s.width/5*4, s.height/5*4)); + sprite->setPosition(ccp(s.width/5*4, s.height/5*4)); sprite->setColor(ccGREEN); sprite->setTextureRect(CCRectMake(0, 0, 120, 50)); orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0); @@ -734,7 +734,7 @@ CameraCenterTest::CameraCenterTest() // CENTER sprite = CCSprite::create("Images/white-512x512.png"); addChild( sprite, 0, 40); - sprite->setPosition(CCPointMake(s.width/2, s.height/2)); + sprite->setPosition(ccp(s.width/2, s.height/2)); sprite->setColor(ccWHITE); sprite->setTextureRect(CCRectMake(0, 0, 120, 50)); orbit = CCOrbitCamera::create(10, 1, 0, 0, 360, 0, 0); diff --git a/samples/TestCpp/Classes/ParallaxTest/ParallaxTest.cpp b/samples/TestCpp/Classes/ParallaxTest/ParallaxTest.cpp index 4f78f9f520..d2a647fcf3 100644 --- a/samples/TestCpp/Classes/ParallaxTest/ParallaxTest.cpp +++ b/samples/TestCpp/Classes/ParallaxTest/ParallaxTest.cpp @@ -249,9 +249,9 @@ void ParallaxDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/ParticleTest/ParticleTest.cpp b/samples/TestCpp/Classes/ParticleTest/ParticleTest.cpp index bf2122bd9b..eb22af4e64 100644 --- a/samples/TestCpp/Classes/ParticleTest/ParticleTest.cpp +++ b/samples/TestCpp/Classes/ParticleTest/ParticleTest.cpp @@ -54,7 +54,7 @@ void DemoFire::onEnter() m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );//.pvr"); CCPoint p = m_emitter->getPosition(); - m_emitter->setPosition( CCPointMake(p.x, 100) ); + m_emitter->setPosition( ccp(p.x, 100) ); setEmitterPosition(); } @@ -171,7 +171,7 @@ void DemoBigFlower::onEnter() m_emitter->setTangentialAccelVar(0); // emitter position - m_emitter->setPosition( CCPointMake(160,240) ); + m_emitter->setPosition( ccp(160,240) ); m_emitter->setPosVar(CCPointZero); // life of particles @@ -256,7 +256,7 @@ void DemoRotFlower::onEnter() m_emitter->setTangentialAccelVar(0); // emitter position - m_emitter->setPosition( CCPointMake(160,240) ); + m_emitter->setPosition( ccp(160,240) ); m_emitter->setPosVar(CCPointZero); // life of particles @@ -387,7 +387,7 @@ void DemoSmoke::onEnter() m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) ); CCPoint p = m_emitter->getPosition(); - m_emitter->setPosition( CCPointMake( p.x, 100) ); + m_emitter->setPosition( ccp( p.x, 100) ); setEmitterPosition(); } @@ -411,12 +411,12 @@ void DemoSnow::onEnter() m_background->addChild(m_emitter, 10); CCPoint p = m_emitter->getPosition(); - m_emitter->setPosition( CCPointMake( p.x, p.y-110) ); + m_emitter->setPosition( ccp( p.x, p.y-110) ); m_emitter->setLife(3); m_emitter->setLifeVar(1); // gravity - m_emitter->setGravity(CCPointMake(0,-10)); + m_emitter->setGravity(ccp(0,-10)); // speed of particles m_emitter->setSpeed(130); @@ -459,7 +459,7 @@ void DemoRain::onEnter() m_background->addChild(m_emitter, 10); CCPoint p = m_emitter->getPosition(); - m_emitter->setPosition( CCPointMake( p.x, p.y-100) ); + m_emitter->setPosition( ccp( p.x, p.y-100) ); m_emitter->setLife(4); m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) ); @@ -497,7 +497,7 @@ void DemoModernArt::onEnter() m_emitter->setDuration(-1); // gravity - m_emitter->setGravity(CCPointMake(0,0)); + m_emitter->setGravity(ccp(0,0)); // angle m_emitter->setAngle(0); @@ -516,7 +516,7 @@ void DemoModernArt::onEnter() m_emitter->setSpeedVar(10); // emitter position - m_emitter->setPosition( CCPointMake( s.width/2, s.height/2) ); + m_emitter->setPosition( ccp( s.width/2, s.height/2) ); m_emitter->setPosVar(CCPointZero); // life of particles @@ -606,21 +606,21 @@ void ParallaxParticle::onEnter() CCSprite *p1 = CCSprite::create(s_back3); CCSprite *p2 = CCSprite::create(s_back3); - p->addChild( p1, 1, CCPointMake(0.5f,1), CCPointMake(0,250) ); - p->addChild(p2, 2, CCPointMake(1.5f,1), CCPointMake(0,50) ); + p->addChild( p1, 1, ccp(0.5f,1), ccp(0,250) ); + p->addChild(p2, 2, ccp(1.5f,1), ccp(0,50) ); m_emitter = CCParticleFlower::create(); m_emitter->retain(); m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) ); p1->addChild(m_emitter, 10); - m_emitter->setPosition( CCPointMake(250,200) ); + m_emitter->setPosition( ccp(250,200) ); CCParticleSun* par = CCParticleSun::create(); p2->addChild(par, 10); par->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) ); - CCActionInterval* move = CCMoveBy::create(4, CCPointMake(300,0)); + CCActionInterval* move = CCMoveBy::create(4, ccp(300,0)); CCActionInterval* move_back = move->reverse(); CCFiniteTimeAction* seq = CCSequence::create( move, move_back, NULL); p->runAction(CCRepeatForever::create((CCActionInterval*)seq)); @@ -1077,11 +1077,11 @@ void ParticleDemo::onEnter(void) CCSize s = CCDirector::sharedDirector()->getWinSize(); CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 28); addChild(label, 100, 1000); - label->setPosition( CCPointMake(s.width/2, s.height-50) ); + label->setPosition( ccp(s.width/2, s.height-50) ); CCLabelTTF *sub = CCLabelTTF::create(subtitle().c_str(), "Arial", 16); addChild(sub, 100); - sub->setPosition(CCPointMake(s.width/2, s.height-80)); + sub->setPosition(ccp(s.width/2, s.height-80)); CCMenuItemImage* item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ParticleDemo::backCallback) ); @@ -1098,10 +1098,10 @@ void ParticleDemo::onEnter(void) CCMenu *menu = CCMenu::create(item1, item2, item3, item4, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item4->setPosition( ccp( 0, 100) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item4->setPosition( ccp( VisibleRect::left().x, VisibleRect::bottom().y+ 100) ); item4->setAnchorPoint( ccp(0,0) ); addChild( menu, 100 ); @@ -1222,7 +1222,7 @@ void ParticleDemo::setEmitterPosition() CCSize s = CCDirector::sharedDirector()->getWinSize(); if (m_emitter != NULL) { - m_emitter->setPosition( CCPointMake(s.width / 2, s.height / 2) ); + m_emitter->setPosition( ccp(s.width / 2, s.height / 2) ); } } diff --git a/samples/TestCpp/Classes/PerformanceTest/PerformanceTest.cpp b/samples/TestCpp/Classes/PerformanceTest/PerformanceTest.cpp index a4dee167c4..d0703cfafa 100644 --- a/samples/TestCpp/Classes/PerformanceTest/PerformanceTest.cpp +++ b/samples/TestCpp/Classes/PerformanceTest/PerformanceTest.cpp @@ -98,7 +98,7 @@ void PerformBasicLayer::onEnter() CCMenuItemFont::setFontSize(24); CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", this, menu_selector(PerformBasicLayer::toMainLayer)); - pMainItem->setPosition(ccp(s.width - 50, 25)); + pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25)); CCMenu* pMenu = CCMenu::create(pMainItem, NULL); pMenu->setPosition( CCPointZero ); @@ -107,9 +107,9 @@ void PerformBasicLayer::onEnter() CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(PerformBasicLayer::backCallback) ); CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(PerformBasicLayer::restartCallback) ); CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(PerformBasicLayer::nextCallback) ); - item1->setPosition( ccp( s.width/2 - 100,30) ); - item2->setPosition( ccp( s.width/2, 30) ); - item3->setPosition( ccp( s.width/2 + 100,30) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); pMenu->addChild(item1, kItemTagBasic); pMenu->addChild(item2, kItemTagBasic); diff --git a/samples/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp b/samples/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp index e699e26d95..8cc931d54d 100644 --- a/samples/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/samples/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -79,9 +79,9 @@ void RenderTextureTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } @@ -151,7 +151,7 @@ RenderTextureSave::RenderTextureSave() CCMenu *menu = CCMenu::create(item1, item2, NULL); this->addChild(menu); menu->alignItemsVertically(); - menu->setPosition(ccp(s.width - 80, s.height - 30)); + menu->setPosition(ccp(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); } string RenderTextureSave::title() diff --git a/samples/TestCpp/Classes/RotateWorldTest/RotateWorldTest.cpp b/samples/TestCpp/Classes/RotateWorldTest/RotateWorldTest.cpp index db97d16360..3dd1344e73 100644 --- a/samples/TestCpp/Classes/RotateWorldTest/RotateWorldTest.cpp +++ b/samples/TestCpp/Classes/RotateWorldTest/RotateWorldTest.cpp @@ -21,7 +21,7 @@ void TestLayer::onEnter() // NSLog( s ); CCLabelTTF* label = CCLabelTTF::create("cocos2d", "Tahoma", 64); - label->setPosition( CCPointMake(x/2,y/2) ); + label->setPosition( ccp(x/2,y/2) ); addChild(label); } @@ -49,9 +49,9 @@ void SpriteLayer::onEnter() spriteSister1->setScale(1.5f); spriteSister2->setScale(1.5f); - sprite->setPosition(CCPointMake(x/2,y/2)); - spriteSister1->setPosition(CCPointMake(40,y/2)); - spriteSister2->setPosition(CCPointMake(x-40,y/2)); + sprite->setPosition(ccp(x/2,y/2)); + spriteSister1->setPosition(ccp(40,y/2)); + spriteSister2->setPosition(ccp(x-40,y/2)); CCAction *rot = CCRotateBy::create(16, -3600); @@ -61,7 +61,7 @@ void SpriteLayer::onEnter() sprite->runAction(rot); - CCActionInterval *jump1 = CCJumpBy::create(4, CCPointMake(-400,0), 100, 4); + CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-400,0), 100, 4); CCActionInterval *jump2 = jump1->reverse(); CCActionInterval *rot1 = CCRotateBy::create(4, 360*2); @@ -96,14 +96,14 @@ void RotateWorldMainLayer::onEnter() CCNode* white = CCLayerColor::create(ccc4(255,255,255,255)); blue->setScale(0.5f); - blue->setPosition(CCPointMake(-x/4,-y/4)); + blue->setPosition(ccp(-x/4,-y/4)); blue->addChild( SpriteLayer::create() ); red->setScale(0.5f); - red->setPosition(CCPointMake(x/4,-y/4)); + red->setPosition(ccp(x/4,-y/4)); green->setScale(0.5f); - green->setPosition(CCPointMake(-x/4,y/4)); + green->setPosition(ccp(-x/4,y/4)); green->addChild(TestLayer::create()); white->setScale(0.5f); diff --git a/samples/TestCpp/Classes/SceneTest/SceneTest.cpp b/samples/TestCpp/Classes/SceneTest/SceneTest.cpp index f9096b87bd..dad2e641a5 100644 --- a/samples/TestCpp/Classes/SceneTest/SceneTest.cpp +++ b/samples/TestCpp/Classes/SceneTest/SceneTest.cpp @@ -30,7 +30,7 @@ SceneTestLayer1::SceneTestLayer1() CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSprite* sprite = CCSprite::create(s_pPathGrossini); addChild(sprite); - sprite->setPosition( CCPointMake(s.width-40, s.height/2) ); + sprite->setPosition( ccp(s.width-40, s.height/2) ); CCActionInterval* rotate = CCRotateBy::create(2, 360); CCAction* repeat = CCRepeatForever::create(rotate); sprite->runAction(repeat); @@ -115,7 +115,7 @@ SceneTestLayer2::SceneTestLayer2() CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSprite* sprite = CCSprite::create(s_pPathGrossini); addChild(sprite); - sprite->setPosition( CCPointMake(s.width-40, s.height/2) ); + sprite->setPosition( ccp(s.width-40, s.height/2) ); CCActionInterval* rotate = CCRotateBy::create(2, 360); CCAction* repeat = CCRepeatForever::create(rotate); sprite->runAction(repeat); @@ -184,7 +184,7 @@ bool SceneTestLayer3::init() CCSprite* sprite = CCSprite::create(s_pPathGrossini); addChild(sprite); - sprite->setPosition( CCPointMake(s.width/2, 40) ); + sprite->setPosition( ccp(s.width/2, 40) ); CCActionInterval* rotate = CCRotateBy::create(2, 360); CCAction* repeat = CCRepeatForever::create(rotate); sprite->runAction(repeat); diff --git a/samples/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp b/samples/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp index 4e5f4daa66..412c601ec2 100644 --- a/samples/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp +++ b/samples/TestCpp/Classes/SchedulerTest/SchedulerTest.cpp @@ -84,18 +84,16 @@ void SchedulerTestLayer::onEnter() { CCLayer::onEnter(); - CCSize s = CCDirector::sharedDirector()->getWinSize(); - CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32); addChild(label); - label->setPosition(ccp(s.width/2, s.height-50)); + label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50)); std::string subTitle = subtitle(); if(! subTitle.empty()) { CCLabelTTF* l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16); addChild(l, 1); - l->setPosition(ccp(s.width/2, s.height-80)); + l->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-80)); } CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(SchedulerTestLayer::backCallback)); @@ -104,9 +102,9 @@ void SchedulerTestLayer::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2)); - item2->setPosition(ccp( s.width/2, item2->getContentSize().height/2)); - item3->setPosition(ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } @@ -250,12 +248,10 @@ SchedulerPauseResumeAll::~SchedulerPauseResumeAll() void SchedulerPauseResumeAll::onEnter() { - SchedulerTestLayer::onEnter(); - - CCSize s = CCDirector::sharedDirector()->getWinSize(); + SchedulerTestLayer::onEnter(); CCSprite *sprite = CCSprite::create("Images/grossinis_sister1.png"); - sprite->setPosition(ccp(s.width/2, s.height/2)); + sprite->setPosition(VisibleRect::center()); this->addChild(sprite); sprite->runAction(CCRepeatForever::create(CCRotateBy::create(3.0, 360))); @@ -1058,12 +1054,12 @@ void TwoSchedulers::onEnter() sliderCtl1 = sliderCtl(); addChild(sliderCtl1); sliderCtl1->retain(); - sliderCtl1->setPosition(ccp(s.width / 4.0f, s.height - 20)); + sliderCtl1->setPosition(ccp(s.width / 4.0f, VisibleRect::top().y - 20)); sliderCtl2 = sliderCtl(); addChild(sliderCtl2); sliderCtl2->retain(); - sliderCtl2->setPosition(ccp(s.width / 4.0f*3.0f, s.height-20)); + sliderCtl2->setPosition(ccp(s.width / 4.0f*3.0f, VisibleRect::top().y-20)); } diff --git a/samples/TestCpp/Classes/ShaderTest/ShaderTest.cpp b/samples/TestCpp/Classes/ShaderTest/ShaderTest.cpp index 565fecf34f..35ce46668b 100644 --- a/samples/TestCpp/Classes/ShaderTest/ShaderTest.cpp +++ b/samples/TestCpp/Classes/ShaderTest/ShaderTest.cpp @@ -85,9 +85,9 @@ bool ShaderTestDemo::init() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(ccp(0, 0)); - item1->setPosition(s.width/2- item2->getContentSize().width*2, item2->getContentSize().height/2); - item2->setPosition(s.width/2, item2->getContentSize().height/2); - item3->setPosition(s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); return true; diff --git a/samples/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/samples/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id index 5ce9ed44e2..927b3c9026 100644 --- a/samples/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/samples/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -df160f753d51ed74299d3410c03f775116c9ba27 \ No newline at end of file +ce6df80aa5c6af9053f975aeb41f028bc9701f00 \ No newline at end of file diff --git a/samples/TestCpp/Classes/TextInputTest/TextInputTest.cpp b/samples/TestCpp/Classes/TextInputTest/TextInputTest.cpp index 10087ae7a1..fec9dcc15c 100644 --- a/samples/TestCpp/Classes/TextInputTest/TextInputTest.cpp +++ b/samples/TestCpp/Classes/TextInputTest/TextInputTest.cpp @@ -138,9 +138,9 @@ void TextInputTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp( s.width/2 - 100,30)); - item2->setPosition(ccp( s.width/2, 30)); - item3->setPosition(ccp( s.width/2 + 100,30)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp b/samples/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp index f504fe4239..e5a33b9174 100644 --- a/samples/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp +++ b/samples/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp @@ -154,9 +154,9 @@ void TextureDemo::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition(ccp( s.width/2 - 100,30)); - item2->setPosition(ccp( s.width/2, 30)); - item3->setPosition(ccp( s.width/2 + 100,30)); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo(); } diff --git a/samples/TestCpp/Classes/TextureCacheTest/TextureCacheTest.cpp b/samples/TestCpp/Classes/TextureCacheTest/TextureCacheTest.cpp index 3addc3d29f..e38dfff59f 100644 --- a/samples/TestCpp/Classes/TextureCacheTest/TextureCacheTest.cpp +++ b/samples/TestCpp/Classes/TextureCacheTest/TextureCacheTest.cpp @@ -14,8 +14,8 @@ TextureCacheTest::TextureCacheTest() m_pLabelLoading = CCLabelTTF::create("loading...", "Arial", 15); m_pLabelPercent = CCLabelTTF::create("%0", "Arial", 15); - m_pLabelLoading->setPosition(CCPointMake(size.width / 2, size.height / 2 - 20)); - m_pLabelPercent->setPosition(CCPointMake(size.width / 2, size.height / 2 + 20)); + m_pLabelLoading->setPosition(ccp(size.width / 2, size.height / 2 - 20)); + m_pLabelPercent->setPosition(ccp(size.width / 2, size.height / 2 + 20)); this->addChild(m_pLabelLoading); this->addChild(m_pLabelPercent); @@ -65,7 +65,7 @@ void TextureCacheTest::addSprite() // create sprites CCSprite *bg = CCSprite::create("Images/HelloWorld.png"); - bg->setPosition(CCPointMake(size.width / 2, size.height / 2)); + bg->setPosition(ccp(size.width / 2, size.height / 2)); CCSprite *s1 = CCSprite::create("Images/grossini.png"); CCSprite *s2 = CCSprite::create("Images/grossini_dance_01.png"); @@ -89,23 +89,23 @@ void TextureCacheTest::addSprite() CCSprite::create("Images/background3.png"); CCSprite::create("Images/blocks.png"); - s1->setPosition(CCPointMake(50, 50)); - s2->setPosition(CCPointMake(60, 50)); - s3->setPosition(CCPointMake(70, 50)); - s4->setPosition(CCPointMake(80, 50)); - s5->setPosition(CCPointMake(90, 50)); - s6->setPosition(CCPointMake(100, 50)); + s1->setPosition(ccp(50, 50)); + s2->setPosition(ccp(60, 50)); + s3->setPosition(ccp(70, 50)); + s4->setPosition(ccp(80, 50)); + s5->setPosition(ccp(90, 50)); + s6->setPosition(ccp(100, 50)); - s7->setPosition(CCPointMake(50, 180)); - s8->setPosition(CCPointMake(60, 180)); - s9->setPosition(CCPointMake(70, 180)); - s10->setPosition(CCPointMake(80, 180)); - s11->setPosition(CCPointMake(90, 180)); - s12->setPosition(CCPointMake(100, 180)); + s7->setPosition(ccp(50, 180)); + s8->setPosition(ccp(60, 180)); + s9->setPosition(ccp(70, 180)); + s10->setPosition(ccp(80, 180)); + s11->setPosition(ccp(90, 180)); + s12->setPosition(ccp(100, 180)); - s13->setPosition(CCPointMake(50, 270)); - s14->setPosition(CCPointMake(60, 270)); - s15->setPosition(CCPointMake(70, 270)); + s13->setPosition(ccp(50, 270)); + s14->setPosition(ccp(60, 270)); + s15->setPosition(ccp(70, 270)); this->addChild(bg); diff --git a/samples/TestCpp/Classes/TileMapTest/TileMapTest.cpp b/samples/TestCpp/Classes/TileMapTest/TileMapTest.cpp index 2d5f1bd7cb..372574d285 100644 --- a/samples/TestCpp/Classes/TileMapTest/TileMapTest.cpp +++ b/samples/TestCpp/Classes/TileMapTest/TileMapTest.cpp @@ -1456,9 +1456,9 @@ TileDemo::TileDemo(void) CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/TouchesTest/Ball.cpp b/samples/TestCpp/Classes/TouchesTest/Ball.cpp index 8295691f2b..84107bb219 100644 --- a/samples/TestCpp/Classes/TouchesTest/Ball.cpp +++ b/samples/TestCpp/Classes/TouchesTest/Ball.cpp @@ -1,5 +1,6 @@ #include "Ball.h" #include "Paddle.h" +#include "VisibleRect.h" Ball::Ball(void) { @@ -25,18 +26,16 @@ Ball* Ball::ballWithTexture(CCTexture2D* aTexture) void Ball::move(float delta) { - CCSize size = CCDirector::sharedDirector()->getWinSize(); - this->setPosition( ccpAdd(getPosition(), ccpMult(m_velocity, delta)) ); - if (getPosition().x > size.width - radius()) + if (getPosition().x > VisibleRect::right().x - radius()) { - setPosition( ccp( size.width - radius(), getPosition().y) ); + setPosition( ccp( VisibleRect::right().x - radius(), getPosition().y) ); m_velocity.x *= -1; } - else if (getPosition().x < radius()) + else if (getPosition().x < VisibleRect::left().x + radius()) { - setPosition( ccp(radius(), getPosition().y) ); + setPosition( ccp(VisibleRect::left().x + radius(), getPosition().y) ); m_velocity.x *= -1; } } @@ -61,13 +60,13 @@ void Ball::collideWithPaddle(Paddle* paddle) if (getPosition().y > midY && getPosition().y <= highY + radius()) { - setPosition( CCPointMake(getPosition().x, highY + radius()) ); + setPosition( ccp(getPosition().x, highY + radius()) ); hit = true; angleOffset = (float)M_PI / 2; } else if (getPosition().y < midY && getPosition().y >= lowY - radius()) { - setPosition( CCPointMake(getPosition().x, lowY - radius()) ); + setPosition( ccp(getPosition().x, lowY - radius()) ); hit = true; angleOffset = -(float)M_PI / 2; } diff --git a/samples/TestCpp/Classes/TouchesTest/Paddle.cpp b/samples/TestCpp/Classes/TouchesTest/Paddle.cpp index 491d21f8a6..f4e16d4b02 100644 --- a/samples/TestCpp/Classes/TouchesTest/Paddle.cpp +++ b/samples/TestCpp/Classes/TouchesTest/Paddle.cpp @@ -74,7 +74,7 @@ void Paddle::ccTouchMoved(CCTouch* touch, CCEvent* event) CCPoint touchPoint = touch->getLocation(); - setPosition( CCPointMake(touchPoint.x, getPosition().y) ); + setPosition( ccp(touchPoint.x, getPosition().y) ); } CCObject* Paddle::copyWithZone(CCZone *pZone) diff --git a/samples/TestCpp/Classes/TouchesTest/TouchesTest.cpp b/samples/TestCpp/Classes/TouchesTest/TouchesTest.cpp index cf7a472952..9b74cf4314 100644 --- a/samples/TestCpp/Classes/TouchesTest/TouchesTest.cpp +++ b/samples/TestCpp/Classes/TouchesTest/TouchesTest.cpp @@ -42,12 +42,10 @@ void PongScene::MainMenuCallback(CCObject* pSender) //------------------------------------------------------------------ PongLayer::PongLayer() { - m_tWinSize = CCDirector::sharedDirector()->getWinSize(); - - m_ballStartingVelocity = CCPointMake(20.0f, -100.0f); + m_ballStartingVelocity = ccp(20.0f, -100.0f); m_ball = Ball::ballWithTexture( CCTextureCache::sharedTextureCache()->addImage(s_Ball) ); - m_ball->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height/2) ); + m_ball->setPosition( VisibleRect::center() ); m_ball->setVelocity( m_ballStartingVelocity ); addChild( m_ball ); m_ball->retain(); @@ -57,19 +55,19 @@ PongLayer::PongLayer() CCArray *paddlesM = CCArray::createWithCapacity(4); Paddle* paddle = Paddle::paddleWithTexture(paddleTexture); - paddle->setPosition( CCPointMake(m_tWinSize.width/2, 15) ); + paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::bottom().y + 15) ); paddlesM->addObject( paddle ); paddle = Paddle::paddleWithTexture( paddleTexture ); - paddle->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height - kStatusBarHeight - 15) ); + paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - kStatusBarHeight - 15) ); paddlesM->addObject( paddle ); paddle = Paddle::paddleWithTexture( paddleTexture ); - paddle->setPosition( CCPointMake(m_tWinSize.width/2, 100) ); + paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::bottom().y + 100) ); paddlesM->addObject( paddle ); paddle = Paddle::paddleWithTexture( paddleTexture ); - paddle->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height - kStatusBarHeight - 100) ); + paddle->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - kStatusBarHeight - 100) ); paddlesM->addObject( paddle ); m_paddles = (CCArray*)paddlesM->copy(); @@ -98,7 +96,7 @@ void PongLayer::resetAndScoreBallForPlayer(int player) { m_ballStartingVelocity = ccpMult(m_ballStartingVelocity, -1.1f); m_ball->setVelocity( m_ballStartingVelocity ); - m_ball->setPosition( CCPointMake(m_tWinSize.width/2, m_tWinSize.height/2) ); + m_ball->setPosition( VisibleRect::center() ); // TODO -- scoring } @@ -119,9 +117,9 @@ void PongLayer::doStep(float delta) m_ball->collideWithPaddle( paddle ); } - if (m_ball->getPosition().y > m_tWinSize.height - kStatusBarHeight + m_ball->radius()) + if (m_ball->getPosition().y > VisibleRect::top().y - kStatusBarHeight + m_ball->radius()) resetAndScoreBallForPlayer( kLowPlayer ); - else if (m_ball->getPosition().y < -m_ball->radius()) + else if (m_ball->getPosition().y < VisibleRect::bottom().y-m_ball->radius()) resetAndScoreBallForPlayer( kHighPlayer ); m_ball->draw(); } diff --git a/samples/TestCpp/Classes/TouchesTest/TouchesTest.h b/samples/TestCpp/Classes/TouchesTest/TouchesTest.h index b7b6221d9f..971199ef22 100644 --- a/samples/TestCpp/Classes/TouchesTest/TouchesTest.h +++ b/samples/TestCpp/Classes/TouchesTest/TouchesTest.h @@ -20,7 +20,6 @@ class Ball; class PongLayer : public CCLayer { private: - CCSize m_tWinSize; Ball* m_ball; CCArray* m_paddles; CCPoint m_ballStartingVelocity; diff --git a/samples/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp b/samples/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp index d7e7c0297f..158e157d83 100644 --- a/samples/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp +++ b/samples/TestCpp/Classes/TransitionsTest/TransitionsTest.cpp @@ -283,17 +283,17 @@ TestLayer1::TestLayer1(void) y = size.height; CCSprite* bg1 = CCSprite::create(s_back1); - bg1->setPosition( CCPointMake(size.width/2, size.height/2) ); + bg1->setPosition( ccp(size.width/2, size.height/2) ); addChild(bg1, -1); CCLabelTTF* title = CCLabelTTF::create( (transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 ); addChild(title); title->setColor( ccc3(255,32,32) ); - title->setPosition( CCPointMake(x/2, y-100) ); + title->setPosition( ccp(x/2, y-100) ); CCLabelTTF* label = CCLabelTTF::create("SCENE 1", "Marker Felt", 38); label->setColor( ccc3(16,16,255)); - label->setPosition( CCPointMake(x/2,y/2)); + label->setPosition( ccp(x/2,y/2)); addChild( label); // menu @@ -304,9 +304,9 @@ TestLayer1::TestLayer1(void) CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( size.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); @@ -412,17 +412,17 @@ TestLayer2::TestLayer2() y = size.height; CCSprite* bg1 = CCSprite::create(s_back2); - bg1->setPosition( CCPointMake(size.width/2, size.height/2) ); + bg1->setPosition( ccp(size.width/2, size.height/2) ); addChild(bg1, -1); CCLabelTTF* title = CCLabelTTF::create((transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 ); addChild(title); title->setColor( ccc3(255,32,32) ); - title->setPosition( CCPointMake(x/2, y-100) ); + title->setPosition( ccp(x/2, y-100) ); CCLabelTTF* label = CCLabelTTF::create("SCENE 2", "Marker Felt", 38); label->setColor( ccc3(16,16,255)); - label->setPosition( CCPointMake(x/2,y/2)); + label->setPosition( ccp(x/2,y/2)); addChild( label); // menu @@ -433,9 +433,9 @@ TestLayer2::TestLayer2() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition( CCPointZero ); - item1->setPosition( ccp( size.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( size.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( size.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); diff --git a/samples/TestCpp/Classes/VisibleRect.cpp b/samples/TestCpp/Classes/VisibleRect.cpp new file mode 100644 index 0000000000..9595afa791 --- /dev/null +++ b/samples/TestCpp/Classes/VisibleRect.cpp @@ -0,0 +1,73 @@ +#include "VisibleRect.h" + +CCRect VisibleRect::s_visibleRect; + +void VisibleRect::lazyInit() +{ + if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f) + { + CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); + s_visibleRect.origin = pEGLView->getVisibleOrigin(); + s_visibleRect.size = pEGLView->getVisibleSize(); + } +} + +CCRect VisibleRect::getVisibleRect() +{ + lazyInit(); + return CCRectMake(s_visibleRect.origin.x, s_visibleRect.origin.y, s_visibleRect.size.width, s_visibleRect.size.height); +} + +CCPoint VisibleRect::left() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +CCPoint VisibleRect::right() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +CCPoint VisibleRect::top() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +CCPoint VisibleRect::bottom() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y); +} + +CCPoint VisibleRect::center() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width/2, s_visibleRect.origin.y+s_visibleRect.size.height/2); +} + +CCPoint VisibleRect::leftTop() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +CCPoint VisibleRect::rightTop() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y+s_visibleRect.size.height); +} + +CCPoint VisibleRect::leftBottom() +{ + lazyInit(); + return s_visibleRect.origin; +} + +CCPoint VisibleRect::rightBottom() +{ + lazyInit(); + return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y); +} diff --git a/samples/TestCpp/Classes/VisibleRect.h b/samples/TestCpp/Classes/VisibleRect.h new file mode 100644 index 0000000000..2f94da90a3 --- /dev/null +++ b/samples/TestCpp/Classes/VisibleRect.h @@ -0,0 +1,26 @@ +#ifndef __VISIBLERECT_H__ +#define __VISIBLERECT_H__ + +#include "cocos2d.h" +USING_NS_CC; + +class VisibleRect +{ +public: + static CCRect getVisibleRect(); + + static CCPoint left(); + static CCPoint right(); + static CCPoint top(); + static CCPoint bottom(); + static CCPoint center(); + static CCPoint leftTop(); + static CCPoint rightTop(); + static CCPoint leftBottom(); + static CCPoint rightBottom(); +private: + static void lazyInit(); + static CCRect s_visibleRect; +}; + +#endif /* __VISIBLERECT_H__ */ diff --git a/samples/TestCpp/Classes/ZwoptexTest/ZwoptexTest.cpp b/samples/TestCpp/Classes/ZwoptexTest/ZwoptexTest.cpp index bb143af603..dcb3139c5c 100644 --- a/samples/TestCpp/Classes/ZwoptexTest/ZwoptexTest.cpp +++ b/samples/TestCpp/Classes/ZwoptexTest/ZwoptexTest.cpp @@ -81,9 +81,9 @@ void ZwoptexTest::onEnter() CCMenu *menu = CCMenu::create(item1, item2, item3, NULL); menu->setPosition(CCPointZero); - item1->setPosition( ccp( s.width/2 - item2->getContentSize().width*2, item2->getContentSize().height/2) ); - item2->setPosition( ccp( s.width/2, item2->getContentSize().height/2) ); - item3->setPosition( ccp( s.width/2 + item2->getContentSize().width*2, item2->getContentSize().height/2) ); + item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2)); + item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2)); addChild(menu, 1); } diff --git a/samples/TestCpp/Classes/controller.cpp b/samples/TestCpp/Classes/controller.cpp index 74d91e5a8c..183772f85d 100644 --- a/samples/TestCpp/Classes/controller.cpp +++ b/samples/TestCpp/Classes/controller.cpp @@ -135,10 +135,9 @@ TestController::TestController() // add close menu CCMenuItemImage *pCloseItem = CCMenuItemImage::create(s_pPathClose, s_pPathClose, this, menu_selector(TestController::closeCallback) ); CCMenu* pMenu =CCMenu::create(pCloseItem, NULL); - CCSize s = CCDirector::sharedDirector()->getWinSize(); pMenu->setPosition( CCPointZero ); - pCloseItem->setPosition(CCPointMake( s.width - 30, s.height - 30)); + pCloseItem->setPosition(ccp( VisibleRect::right().x - 30, VisibleRect::top().y - 30)); // add menu items for tests m_pItemMenu = CCMenu::create(); @@ -152,10 +151,10 @@ TestController::TestController() CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestController::menuCallback)); m_pItemMenu->addChild(pMenuItem, i + 10000); - pMenuItem->setPosition( CCPointMake( s.width / 2, (s.height - (i + 1) * LINE_SPACE) )); + pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) )); } - m_pItemMenu->setContentSize(CCSizeMake(s.width, (TESTS_COUNT + 1) * (LINE_SPACE))); + m_pItemMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (TESTS_COUNT + 1) * (LINE_SPACE))); m_pItemMenu->setPosition(s_tCurPos); addChild(m_pItemMenu); @@ -210,16 +209,16 @@ void TestController::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent) CCPoint curPos = m_pItemMenu->getPosition(); CCPoint nextPos = ccp(curPos.x, curPos.y + nMoveY); - CCSize winSize = CCDirector::sharedDirector()->getWinSize(); + if (nextPos.y < 0.0f) { m_pItemMenu->setPosition(CCPointZero); return; } - if (nextPos.y > ((TESTS_COUNT + 1)* LINE_SPACE - winSize.height)) + if (nextPos.y > ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height)) { - m_pItemMenu->setPosition(ccp(0, ((TESTS_COUNT + 1)* LINE_SPACE - winSize.height))); + m_pItemMenu->setPosition(ccp(0, ((TESTS_COUNT + 1)* LINE_SPACE - VisibleRect::getVisibleRect().size.height))); return; } diff --git a/samples/TestCpp/Classes/testBasic.cpp b/samples/TestCpp/Classes/testBasic.cpp index a3ffca4967..e0c900df00 100644 --- a/samples/TestCpp/Classes/testBasic.cpp +++ b/samples/TestCpp/Classes/testBasic.cpp @@ -20,9 +20,9 @@ void TestScene::onEnter() CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestScene::MainMenuCallback)); CCMenu* pMenu =CCMenu::create(pMenuItem, NULL); - CCSize s = CCDirector::sharedDirector()->getWinSize(); + pMenu->setPosition( CCPointZero ); - pMenuItem->setPosition( CCPointMake( s.width - 50, 25) ); + pMenuItem->setPosition( ccp( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) ); addChild(pMenu, 1); } diff --git a/samples/TestCpp/Classes/testBasic.h b/samples/TestCpp/Classes/testBasic.h index fa4e77cc2b..38790c2c71 100644 --- a/samples/TestCpp/Classes/testBasic.h +++ b/samples/TestCpp/Classes/testBasic.h @@ -2,6 +2,7 @@ #define _TEST_BASIC_H_ #include "cocos2d.h" +#include "VisibleRect.h" USING_NS_CC; using namespace std; diff --git a/samples/TestCpp/proj.linux/Makefile b/samples/TestCpp/proj.linux/Makefile index f05c22528a..3cf5f55790 100644 --- a/samples/TestCpp/proj.linux/Makefile +++ b/samples/TestCpp/proj.linux/Makefile @@ -121,6 +121,7 @@ OBJECTS = ../Classes/AccelerometerTest/AccelerometerTest.o \ ../Classes/controller.o \ ../Classes/testBasic.o \ ../Classes/AppDelegate.o \ + ../Classes/VisibleRect.o \ ./main.o diff --git a/samples/TestCpp/proj.win32/TestCpp.vcproj b/samples/TestCpp/proj.win32/TestCpp.vcproj index ee8c75b63b..647dcac1bd 100644 --- a/samples/TestCpp/proj.win32/TestCpp.vcproj +++ b/samples/TestCpp/proj.win32/TestCpp.vcproj @@ -224,6 +224,14 @@ RelativePath="..\Classes\tests.h" > + + + + diff --git a/samples/TestCpp/proj.win32/TestCpp.vcxproj b/samples/TestCpp/proj.win32/TestCpp.vcxproj index 2b40ecd7c9..de07d0a9b9 100644 --- a/samples/TestCpp/proj.win32/TestCpp.vcxproj +++ b/samples/TestCpp/proj.win32/TestCpp.vcxproj @@ -113,6 +113,7 @@ + @@ -201,6 +202,7 @@ + diff --git a/samples/TestCpp/proj.win32/TestCpp.vcxproj.filters b/samples/TestCpp/proj.win32/TestCpp.vcxproj.filters index 79976ce976..44b21ac25e 100644 --- a/samples/TestCpp/proj.win32/TestCpp.vcxproj.filters +++ b/samples/TestCpp/proj.win32/TestCpp.vcxproj.filters @@ -459,6 +459,9 @@ Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest + + Classes + @@ -893,5 +896,8 @@ Classes\ExtensionsTest\ControlExtensionTest\CCControlStepperTest + + Classes + \ No newline at end of file From 0b381357b08fafc564267f2e3885b952e6425fee Mon Sep 17 00:00:00 2001 From: Sergey Buravtsov Date: Wed, 24 Oct 2012 03:14:40 +0400 Subject: [PATCH 10/95] Fix for correct unscheduling and instance destruction --- extensions/network/HttpClient.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/network/HttpClient.cpp b/extensions/network/HttpClient.cpp index 1fa241540c..6a5b0709db 100644 --- a/extensions/network/HttpClient.cpp +++ b/extensions/network/HttpClient.cpp @@ -354,9 +354,9 @@ CCHttpClient* CCHttpClient::getInstance() void CCHttpClient::destroyInstance() { - CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks), - CCHttpClient::getInstance()); - CC_SAFE_RELEASE_NULL(s_pHttpClient); + CC_ASSERT(s_pHttpClient); + CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks), s_pHttpClient); + s_pHttpClient->release(); } CCHttpClient::CCHttpClient() @@ -376,7 +376,7 @@ CCHttpClient::~CCHttpClient() sem_post(s_pSem); } - CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCHttpClient::dispatchResponseCallbacks), this); + s_pHttpClient = NULL; } //Lazy create semaphore & mutex & thread From c797af0fe9dcf0107bf7df559f865486678861f9 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 24 Oct 2012 10:03:19 +0800 Subject: [PATCH 11/95] fixed #1522: CCEGLView class of desktop platforms should override CCEGLViewProtocol::setScissorInPoints. --- cocos2dx/platform/linux/CCEGLView.cpp | 9 +++++++++ cocos2dx/platform/linux/CCEGLView.h | 2 ++ cocos2dx/platform/mac/CCEGLView.h | 1 + cocos2dx/platform/mac/CCEGLView.mm | 10 ++++++++++ cocos2dx/platform/win32/CCEGLView.cpp | 8 ++++++++ cocos2dx/platform/win32/CCEGLView.h | 2 ++ 6 files changed, 32 insertions(+) diff --git a/cocos2dx/platform/linux/CCEGLView.cpp b/cocos2dx/platform/linux/CCEGLView.cpp index 99744d378b..6cabdcb5ac 100644 --- a/cocos2dx/platform/linux/CCEGLView.cpp +++ b/cocos2dx/platform/linux/CCEGLView.cpp @@ -261,6 +261,15 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h) (GLsizei)(h * m_fScaleY * m_fFrameZoomFactor)); } +void CCEGLView::setScissorInPoints(float x , float y , float w , float h) +{ + glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor), + (GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor), + (GLsizei)(w * m_fScaleX * m_fFrameZoomFactor), + (GLsizei)(h * m_fScaleY * m_fFrameZoomFactor)); +} + + bool CCEGLView::isOpenGLReady() { return bIsInit; diff --git a/cocos2dx/platform/linux/CCEGLView.h b/cocos2dx/platform/linux/CCEGLView.h index 65cb82f7ff..c65489efdd 100644 --- a/cocos2dx/platform/linux/CCEGLView.h +++ b/cocos2dx/platform/linux/CCEGLView.h @@ -33,6 +33,8 @@ public: */ virtual void setFrameSize(float width, float height); virtual void setViewPortInPoints(float x , float y , float w , float h); + virtual void setScissorInPoints(float x , float y , float w , float h); + /* * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. */ diff --git a/cocos2dx/platform/mac/CCEGLView.h b/cocos2dx/platform/mac/CCEGLView.h index c0182b8bbd..3c1708cd82 100755 --- a/cocos2dx/platform/mac/CCEGLView.h +++ b/cocos2dx/platform/mac/CCEGLView.h @@ -49,6 +49,7 @@ public: * Set opengl view port rectangle with points. */ virtual void setViewPortInPoints(float x , float y , float w , float h); + virtual void setScissorInPoints(float x , float y , float w , float h); virtual void setIMEKeyboardState(bool bOpen); virtual void setMultiTouchMask(bool mask); diff --git a/cocos2dx/platform/mac/CCEGLView.mm b/cocos2dx/platform/mac/CCEGLView.mm index 92d22ab021..b098e8a1f8 100755 --- a/cocos2dx/platform/mac/CCEGLView.mm +++ b/cocos2dx/platform/mac/CCEGLView.mm @@ -98,6 +98,16 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h) (GLsizei)(h * m_fScaleY * frameZoomFactor)); } +void CCEGLView::setScissorInPoints(float x , float y , float w , float h) +{ + float frameZoomFactor = [[EAGLView sharedEGLView] frameZoomFactor]; + + glScissor((GLint)(x * m_fScaleX * frameZoomFactor + m_obViewPortRect.origin.x * frameZoomFactor), + (GLint)(y * m_fScaleY * frameZoomFactor + m_obViewPortRect.origin.y * frameZoomFactor), + (GLsizei)(w * m_fScaleX * frameZoomFactor), + (GLsizei)(h * m_fScaleY * frameZoomFactor)); +} + void CCEGLView::setMultiTouchMask(bool mask) { //EAGLView *glView = [EAGLView sharedEGLView]; diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index ed49e15a7b..3dc8a05be3 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -697,6 +697,14 @@ void CCEGLView::setViewPortInPoints(float x , float y , float w , float h) (GLsizei)(h * m_fScaleY * m_fFrameZoomFactor)); } +void CCEGLView::setScissorInPoints(float x , float y , float w , float h) +{ + glScissor((GLint)(x * m_fScaleX * m_fFrameZoomFactor + m_obViewPortRect.origin.x * m_fFrameZoomFactor), + (GLint)(y * m_fScaleY * m_fFrameZoomFactor + m_obViewPortRect.origin.y * m_fFrameZoomFactor), + (GLsizei)(w * m_fScaleX * m_fFrameZoomFactor), + (GLsizei)(h * m_fScaleY * m_fFrameZoomFactor)); +} + CCEGLView* CCEGLView::sharedOpenGLView() { static CCEGLView* s_pEglView = NULL; diff --git a/cocos2dx/platform/win32/CCEGLView.h b/cocos2dx/platform/win32/CCEGLView.h index 896ac939db..c1c3d475e2 100644 --- a/cocos2dx/platform/win32/CCEGLView.h +++ b/cocos2dx/platform/win32/CCEGLView.h @@ -73,6 +73,8 @@ public: void setAccelerometerKeyHook( LPFN_ACCELEROMETER_KEYHOOK lpfnAccelerometerKeyHook ); virtual void setViewPortInPoints(float x , float y , float w , float h); + virtual void setScissorInPoints(float x , float y , float w , float h); + // static function /** @brief get the shared main open gl window From 38cd1ecd4602a3bd3379ed6da06765b7dd999d31 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 24 Oct 2012 10:09:25 +0800 Subject: [PATCH 12/95] fixed #1512: add VisableRect.cpp/h into iOS and mac project --- .../proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- .../proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id index e56c8faf78..9916eb7ff8 100644 --- a/samples/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/TestCpp/proj.ios/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -ac3dd574a71d609ed13ae44389209e35f22d6392 \ No newline at end of file +5982545917607b9c428c7256b3c983b0526804a5 \ No newline at end of file diff --git a/samples/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id index 54d31e8db3..0995775fa4 100644 --- a/samples/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/TestCpp/proj.mac/TestCpp.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -bbbb2450a8de63794b1d5e2b00341086f5aee574 \ No newline at end of file +7150b3ae596f748ee383fb0fb7d59a8c317a7d08 \ No newline at end of file From ffe52a157f1424fa6bbf4756bf0f99d5690a07f1 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 24 Oct 2012 16:12:40 +0800 Subject: [PATCH 13/95] Removed some unused codes about "enableRetinaDisplay". --- samples/HelloLua/Classes/AppDelegate.cpp | 3 --- samples/MoonWarriors/Classes/AppDelegate.cpp | 6 +++--- samples/TestJavascript/Classes/AppDelegate.cpp | 3 --- samples/TestLua/Classes/AppDelegate.cpp | 3 --- template/android/Classes/AppDelegate.cpp | 3 --- .../CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp | 3 --- template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp | 3 --- .../cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp | 3 --- .../cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp | 3 --- .../xcode4/cocos2dx_js.xctemplate/Classes/AppDelegate.cpp | 3 --- .../xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp | 5 ----- 11 files changed, 3 insertions(+), 35 deletions(-) diff --git a/samples/HelloLua/Classes/AppDelegate.cpp b/samples/HelloLua/Classes/AppDelegate.cpp index c33c165795..666373c5a7 100644 --- a/samples/HelloLua/Classes/AppDelegate.cpp +++ b/samples/HelloLua/Classes/AppDelegate.cpp @@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionNoBorder); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/MoonWarriors/Classes/AppDelegate.cpp b/samples/MoonWarriors/Classes/AppDelegate.cpp index f4947cf2e5..ffc68f1efa 100644 --- a/samples/MoonWarriors/Classes/AppDelegate.cpp +++ b/samples/MoonWarriors/Classes/AppDelegate.cpp @@ -23,10 +23,10 @@ bool AppDelegate::applicationDidFinishLaunching() // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); + + // Set the design resolution CCEGLView::sharedOpenGLView()->setDesignResolutionSize(320, 480, kResolutionShowAll); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - + // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/TestJavascript/Classes/AppDelegate.cpp b/samples/TestJavascript/Classes/AppDelegate.cpp index 354a9db101..154d9db7ac 100644 --- a/samples/TestJavascript/Classes/AppDelegate.cpp +++ b/samples/TestJavascript/Classes/AppDelegate.cpp @@ -25,9 +25,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/TestLua/Classes/AppDelegate.cpp b/samples/TestLua/Classes/AppDelegate.cpp index e87925fc68..7ee7266ca7 100644 --- a/samples/TestLua/Classes/AppDelegate.cpp +++ b/samples/TestLua/Classes/AppDelegate.cpp @@ -23,9 +23,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. -// pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/android/Classes/AppDelegate.cpp b/template/android/Classes/AppDelegate.cpp index 447d84142f..61fb994cdb 100644 --- a/template/android/Classes/AppDelegate.cpp +++ b/template/android/Classes/AppDelegate.cpp @@ -20,9 +20,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp index 052cce558a..09c0a6af80 100644 --- a/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp +++ b/template/msvc/CCAppWiz.win32/Templates/1033/Classes/AppDelegate.cpp @@ -31,9 +31,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. -// pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp index 01eedc43ca..f9dd07bc43 100644 --- a/template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx.xctemplate/Classes/AppDelegate.cpp @@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/xcode4/cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp index 0a066f1849..142b992f45 100644 --- a/template/xcode4/cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx_box2d.xctemplate/Classes/AppDelegate.cpp @@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/xcode4/cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp index 41237a35e9..9b7ad94815 100644 --- a/template/xcode4/cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx_chipmunk.xctemplate/Classes/AppDelegate.cpp @@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/xcode4/cocos2dx_js.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx_js.xctemplate/Classes/AppDelegate.cpp index c0b3a774af..15b072046c 100644 --- a/template/xcode4/cocos2dx_js.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx_js.xctemplate/Classes/AppDelegate.cpp @@ -28,9 +28,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); diff --git a/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp b/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp index 21ca3dcefc..ba615ffad3 100644 --- a/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp +++ b/template/xcode4/cocos2dx_lua.xctemplate/Classes/AppDelegate.cpp @@ -26,11 +26,6 @@ bool AppDelegate::applicationDidFinishLaunching() CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); - CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionShowAll); - - // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. - // pDirector->enableRetinaDisplay(true); - // turn on display FPS pDirector->setDisplayStats(true); From e07ca43c3d33ebbb41f332a0ee8c3fb1c9684689 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 24 Oct 2012 16:28:54 +0800 Subject: [PATCH 14/95] fixes a compilation error in TestCpp. --- samples/TestCpp/Classes/TouchesTest/Ball.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TestCpp/Classes/TouchesTest/Ball.cpp b/samples/TestCpp/Classes/TouchesTest/Ball.cpp index 84107bb219..9fa2e56419 100644 --- a/samples/TestCpp/Classes/TouchesTest/Ball.cpp +++ b/samples/TestCpp/Classes/TouchesTest/Ball.cpp @@ -1,6 +1,6 @@ #include "Ball.h" #include "Paddle.h" -#include "VisibleRect.h" +#include "../VisibleRect.h" Ball::Ball(void) { From 463ae3118031b19f5b2e1deb32b89a20b86511f7 Mon Sep 17 00:00:00 2001 From: Rolando Abarca Date: Wed, 24 Oct 2012 11:14:15 -0700 Subject: [PATCH 15/95] upgrades to new spidermonkey API FF beta - this fixes the auto-compartment issue --- .../javascript/bindings/ScriptingCore.cpp | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index ca06e56149..6b5668debd 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -55,18 +55,17 @@ std::map globals; static void executeJSFunctionFromReservedSpot(JSContext *cx, JSObject *obj, jsval &dataVal, jsval &retval) { - // if(p->jsclass->JSCLASS_HAS_RESERVED_SLOTS(1)) { jsval func = JS_GetReservedSlot(obj, 0); if(func == JSVAL_VOID) { return; } jsval thisObj = JS_GetReservedSlot(obj, 1); + JSAutoCompartment ac(cx, obj); if(thisObj == JSVAL_VOID) { JS_CallFunctionValue(cx, obj, func, 1, &dataVal, &retval); } else { assert(!JSVAL_IS_PRIMITIVE(thisObj)); JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(thisObj), func, 1, &dataVal, &retval); } - // } } static void getTouchesFuncName(int eventType, std::string &funcName) { @@ -163,6 +162,7 @@ static void executeJSFunctionWithName(JSContext *cx, JSObject *obj, if(temp_retval == JSVAL_VOID) { return; } + JSAutoCompartment ac(cx, obj); JS_CallFunctionName(cx, obj, funcName, 1, &dataVal, &retval); } @@ -361,13 +361,11 @@ JSBool ScriptingCore::evalString(const char *string, jsval *outVal, const char * JSScript* script = JS_CompileScript(cx, global, string, strlen(string), filename, 1); if (script) { // JSAutoCompartment ac(cx, global); - JSAutoEnterCompartment ac; - ac.enter(cx, global); - JSBool evaluatedOK = JS_ExecuteScript(cx_, global_, script, &rval); + JSAutoCompartment ac(cx, global); + JSBool evaluatedOK = JS_ExecuteScript(cx, global, script, &rval); if (JS_FALSE == evaluatedOK) { fprintf(stderr, "(evaluatedOK == JS_FALSE)\n"); } - ac.leave(); return evaluatedOK; } return false; @@ -406,6 +404,7 @@ void ScriptingCore::createGlobalContext() { this->cx_ = NULL; this->rt_ = NULL; } + JS_SetCStringsAreUTF8(); this->rt_ = JS_NewRuntime(10 * 1024 * 1024); this->cx_ = JS_NewContext(rt_, 10240); JS_SetOptions(this->cx_, JSOPTION_TYPE_INFERENCE); @@ -455,13 +454,11 @@ JSBool ScriptingCore::runScript(const char *path, JSObject* global, JSContext* c if (script) { jsval rval; filename_script[path] = script; - JSAutoEnterCompartment ac; - ac.enter(cx, global); + JSAutoCompartment ac(cx, global); evaluatedOK = JS_ExecuteScript(cx, global, script, &rval); if (JS_FALSE == evaluatedOK) { fprintf(stderr, "(evaluatedOK == JS_FALSE)\n"); } - ac.leave(); } return evaluatedOK; } @@ -1120,15 +1117,13 @@ JSObject* NewGlobalObject(JSContext* cx) if (!glob) { return NULL; } - JSAutoEnterCompartment ac; - ac.enter(cx, glob); + JSAutoCompartment ac(cx, glob); JSBool ok = JS_TRUE; ok = JS_InitStandardClasses(cx, glob); if (ok) JS_InitReflect(cx, glob); if (ok) ok = JS_DefineDebuggerObject(cx, glob); - ac.leave(); if (!ok) return NULL; @@ -1148,6 +1143,7 @@ JSBool jsNewGlobal(JSContext* cx, unsigned argc, jsval* vp) JS_WrapObject(cx, global->address()); globals[key] = global; // register everything on the list on this new global object + JSAutoCompartment ac(cx, g); for (std::vector::iterator it = registrationList.begin(); it != registrationList.end(); it++) { sc_register_sth callback = *it; callback(cx, g); From 26f7b3679747117e67034877c8661fca9468e8e6 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 25 Oct 2012 11:40:24 +0800 Subject: [PATCH 16/95] update submodule for JS-Bindings auto-gen codes. --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index 79337ba58c..c38342f85f 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit 79337ba58c9b43e603a0ec41db6cdb968d7284f2 +Subproject commit c38342f85f58e3238a7597d973457ca03b4a79c4 From 84e48ed7e7c9f8ade1d3dc9edebc8e7f088772aa Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 25 Oct 2012 14:32:28 +0800 Subject: [PATCH 17/95] issue #1312:update libcurl for android and strip all libs --- .../prebuilt/libcurl/include/curl/curl.h | 196 +++++++++++++----- .../prebuilt/libcurl/include/curl/curlbuild.h | 22 +- .../prebuilt/libcurl/include/curl/curlver.h | 14 +- .../prebuilt/libcurl/include/curl/easy.h | 4 +- .../libcurl/include/curl/typecheck-gcc.h | 144 +++++++------ .../libs/armeabi-v7a/libcurl.a.REMOVED.git-id | 2 +- .../libs/armeabi/libcurl.a.REMOVED.git-id | 2 +- .../libcurl/libs/x86/libcurl.a.REMOVED.git-id | 2 +- .../libs/armeabi-v7a/libjpeg.a.REMOVED.git-id | 2 +- .../libs/armeabi/libjpeg.a.REMOVED.git-id | 2 +- .../libjpeg/libs/x86/libjpeg.a.REMOVED.git-id | 2 +- .../libs/armeabi-v7a/libpng.a.REMOVED.git-id | 2 +- .../libs/armeabi/libpng.a.REMOVED.git-id | 2 +- .../libpng/libs/x86/libpng.a.REMOVED.git-id | 2 +- .../libs/armeabi-v7a/libtiff.a.REMOVED.git-id | 2 +- .../libs/armeabi/libtiff.a.REMOVED.git-id | 2 +- .../libtiff/libs/x86/libtiff.a.REMOVED.git-id | 2 +- .../libs/armeabi-v7a/libxml2.a.REMOVED.git-id | 2 +- .../libs/armeabi/libxml2.a.REMOVED.git-id | 2 +- .../libxml2/libs/x86/libxml2.a.REMOVED.git-id | 2 +- 20 files changed, 260 insertions(+), 150 deletions(-) diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curl.h b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curl.h index 4744f48305..2cad28298e 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curl.h +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -55,34 +55,32 @@ #include #include -#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ - !defined(__CYGWIN__) || defined(__MINGW32__) -#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) /* The check above prevents the winsock2 inclusion if winsock.h already was included, since they can't co-exist without problems */ #include #include #endif -#else +#endif /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish - libc5-based Linux systems. Only include it on system that are known to + libc5-based Linux systems. Only include it on systems that are known to require it! */ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ - defined(ANDROID) || \ + defined(ANDROID) || defined(__ANDROID__) || \ (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) #include #endif -#ifndef _WIN32_WCE +#if !defined(WIN32) && !defined(_WIN32_WCE) #include #endif + #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) #include #endif -#include -#endif #ifdef __BEOS__ #include @@ -122,7 +120,7 @@ typedef void CURL; #ifndef curl_socket_typedef /* socket typedef */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__LWIP_OPT_H__) typedef SOCKET curl_socket_t; #define CURL_SOCKET_BAD INVALID_SOCKET #else @@ -189,10 +187,10 @@ typedef int (*curl_progress_callback)(void *clientp, #define CURL_MAX_HTTP_HEADER (100*1024) #endif - /* This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, @@ -315,6 +313,13 @@ typedef enum { CURLSOCKTYPE_LAST /* never use */ } curlsocktype; +/* The return code from the sockopt_callback can signal information back + to libcurl: */ +#define CURL_SOCKOPT_OK 0 +#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return + CURLE_ABORTED_BY_CALLBACK */ +#define CURL_SOCKOPT_ALREADY_CONNECTED 2 + typedef int (*curl_sockopt_callback)(void *clientp, curl_socket_t curlfd, curlsocktype purpose); @@ -334,6 +339,9 @@ typedef curl_socket_t curlsocktype purpose, struct curl_sockaddr *address); +typedef int +(*curl_closesocket_callback)(void *clientp, curl_socket_t item); + typedef enum { CURLIOE_OK, /* I/O operation successful */ CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ @@ -394,7 +402,8 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_OBSOLETE4, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for + 7.17.0, reused in April 2011 for 7.21.5] */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ @@ -402,9 +411,12 @@ typedef enum { CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server due to lack of access - when login fails this is not returned. */ - CURLE_OBSOLETE10, /* 10 - NOT USED */ + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for + 7.15.4, reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ - CURLE_OBSOLETE12, /* 12 - NOT USED */ + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server + [was obsoleted in August 2007 for 7.17.0, + reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ CURLE_FTP_CANT_GET_HOST, /* 15 */ @@ -444,7 +456,7 @@ typedef enum { CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ CURLE_OBSOLETE46, /* 46 - NOT USED */ CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ - CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ + CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ CURLE_OBSOLETE50, /* 50 - NOT USED */ CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint @@ -459,7 +471,7 @@ typedef enum { CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ - CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ @@ -499,17 +511,24 @@ typedef enum { 7.19.0) */ CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ - CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Identifiers */ + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ - CURL_LAST /* never use! */ } CURLcode; #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ -/* Backwards compatibility with older names */ +/* Previously obsoletes error codes re-used in 7.24.0 */ +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT + +/* compatibility with older names */ +#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING + +/* The following were added in 7.21.5, April 2011 */ +#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION /* The following were added in 7.17.1 */ /* These are scheduled to disappear by 2009 */ @@ -517,7 +536,7 @@ typedef enum { /* The following were added in 7.17.0 */ /* These are scheduled to disappear by 2009 */ -#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */ +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 @@ -529,7 +548,7 @@ typedef enum { #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 -#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4 +#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE @@ -579,17 +598,32 @@ typedef enum { in 7.18.0 */ } curl_proxytype; /* this enum was added in 7.10 */ -#define CURLAUTH_NONE 0 /* nothing */ -#define CURLAUTH_BASIC (1<<0) /* Basic (default) */ -#define CURLAUTH_DIGEST (1<<1) /* Digest */ -#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */ -#define CURLAUTH_NTLM (1<<3) /* NTLM */ -#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */ -#define CURLAUTH_ONLY (1<<31) /* used together with a single other - type to force no auth or just that - single type */ -#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */ -#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) +/* + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: + * + * CURLAUTH_NONE - No HTTP authentication + * CURLAUTH_BASIC - HTTP Basic authentication (default) + * CURLAUTH_DIGEST - HTTP Digest authentication + * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication + * CURLAUTH_NTLM - HTTP NTLM authentication + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper + * CURLAUTH_ONLY - Use together with a single other type to force no + * authentication or just that single type + * CURLAUTH_ANY - All fine types set + * CURLAUTH_ANYSAFE - All fine types except Basic + */ + +#define CURLAUTH_NONE ((unsigned long)0) +#define CURLAUTH_BASIC (((unsigned long)1)<<0) +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) +#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2) +#define CURLAUTH_NTLM (((unsigned long)1)<<3) +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) +#define CURLAUTH_ONLY (((unsigned long)1)<<31) +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ @@ -599,6 +633,10 @@ typedef enum { #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ + #define CURL_ERROR_SIZE 256 struct curl_khkey { @@ -649,6 +687,15 @@ typedef enum { CURLUSESSL_LAST /* not an option, never use */ } curl_usessl; +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ + +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the + name of improving interoperability with older servers. Some SSL libraries + have introduced work-arounds for this flaw but those work-arounds sometimes + make the SSL communication fail. To regain functionality with those broken + servers, a user can this way allow the vulnerability back. */ +#define CURLSSLOPT_ALLOW_BEAST (1<<0) + #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ @@ -743,7 +790,7 @@ typedef enum { #endif #ifdef CURL_ISOCPP -#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number +#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu #else /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ #define LONG CURLOPTTYPE_LONG @@ -901,9 +948,7 @@ typedef enum { /* send linked-list of post-transfer QUOTE commands */ CINIT(POSTQUOTE, OBJECTPOINT, 39), - /* Pass a pointer to string of the output using full variable-replacement - as described elsewhere. */ - CINIT(WRITEINFO, OBJECTPOINT, 40), + CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */ CINIT(VERBOSE, LONG, 41), /* talk a lot */ CINIT(HEADER, LONG, 42), /* throw the header out too */ @@ -912,7 +957,7 @@ typedef enum { CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ CINIT(UPLOAD, LONG, 46), /* this is an upload */ CINIT(POST, LONG, 47), /* HTTP POST method */ - CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */ + CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ @@ -979,9 +1024,7 @@ typedef enum { /* Max amount of cached alive connections */ CINIT(MAXCONNECTS, LONG, 71), - /* What policy to use when closing connections when the cache is filled - up */ - CINIT(CLOSEPOLICY, LONG, 72), + CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */ /* 73 = OBSOLETE */ @@ -1055,7 +1098,7 @@ typedef enum { CINIT(SSLENGINE_DEFAULT, LONG, 90), /* Non-zero value means to use the global dns cache */ - CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ /* DNS cache timeout */ CINIT(DNS_CACHE_TIMEOUT, LONG, 92), @@ -1092,8 +1135,9 @@ typedef enum { CINIT(PROXYTYPE, LONG, 101), /* Set the Accept-Encoding string. Use this to tell a server you would like - the response to be compressed. */ - CINIT(ENCODING, OBJECTPOINT, 102), + the response to be compressed. Before 7.21.6, this was known as + CURLOPT_ENCODING */ + CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), /* Set pointer to private data */ CINIT(PRIVATE, OBJECTPOINT, 103), @@ -1106,8 +1150,8 @@ typedef enum { and password to whatever host the server decides. */ CINIT(UNRESTRICTED_AUTH, LONG, 105), - /* Specifically switch on or off the FTP engine's use of the EPRT command ( it - also disables the LPRT attempt). By default, those ones will always be + /* Specifically switch on or off the FTP engine's use of the EPRT command ( + it also disables the LPRT attempt). By default, those ones will always be attempted before the good old traditional PORT command. */ CINIT(FTP_USE_EPRT, LONG, 106), @@ -1451,6 +1495,46 @@ typedef enum { /* Set authentication type for authenticated TLS */ CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), + /* Set to 1 to enable the "TE:" header in HTTP requests to ask for + compressed transfer-encoded responses. Set to 0 to disable the use of TE: + in outgoing requests. The current default is 0, but it might change in a + future libcurl release. + + libcurl will ask for the compressed methods it knows of, and if that + isn't any, it will not ask for transfer-encoding at all even if this + option is set to 1. + + */ + CINIT(TRANSFER_ENCODING, LONG, 207), + + /* Callback function for closing socket (instead of close(2)). The callback + should have type curl_closesocket_callback */ + CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), + CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), + + /* allow GSSAPI credential delegation */ + CINIT(GSSAPI_DELEGATION, LONG, 210), + + /* Set the name servers to use for DNS resolution */ + CINIT(DNS_SERVERS, OBJECTPOINT, 211), + + /* Time-out accept operations (currently for FTP only) after this amount + of miliseconds. */ + CINIT(ACCEPTTIMEOUT_MS, LONG, 212), + + /* Set TCP keepalive */ + CINIT(TCP_KEEPALIVE, LONG, 213), + + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ + CINIT(TCP_KEEPIDLE, LONG, 214), + CINIT(TCP_KEEPINTVL, LONG, 215), + + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ + CINIT(SSL_OPTIONS, LONG, 216), + + /* set the SMTP auth originator */ + CINIT(MAIL_AUTH, OBJECTPOINT, 217), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; @@ -1554,13 +1638,16 @@ enum CURL_TLSAUTH { }; /* symbols to use with CURLOPT_POSTREDIR. - CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that - CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ #define CURL_REDIR_GET_ALL 0 #define CURL_REDIR_POST_301 1 #define CURL_REDIR_POST_302 2 -#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302) +#define CURL_REDIR_POST_303 4 +#define CURL_REDIR_POST_ALL \ + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) typedef enum { CURL_TIMECOND_NONE, @@ -1679,7 +1766,8 @@ CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, * Should return the buffer length passed to it as the argument "len" on * success. */ -typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len); +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, + size_t len); /* * NAME curl_formget() @@ -1978,8 +2066,9 @@ typedef enum { CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ - CURLSHE_NOMEM, /* out of memory */ - CURLSHE_LAST /* never use */ + CURLSHE_NOMEM, /* 4 out of memory */ + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ + CURLSHE_LAST /* never use */ } CURLSHcode; typedef enum { @@ -2059,8 +2148,9 @@ typedef struct { #define CURL_VERSION_CONV (1<<12) /* character conversions supported */ #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */ -/* + /* * NAME curl_version_info() * * DESCRIPTION diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlbuild.h b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlbuild.h index 81f4a28547..98ede6eef7 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlbuild.h +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlbuild.h @@ -8,7 +8,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -59,52 +59,52 @@ /* ================================================================ */ #ifdef CURL_SIZEOF_LONG -# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" +#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined #endif #ifdef CURL_TYPEOF_CURL_SOCKLEN_T -# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" +#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined #endif #ifdef CURL_SIZEOF_CURL_SOCKLEN_T -# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" +#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined #endif #ifdef CURL_TYPEOF_CURL_OFF_T -# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" +#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined #endif #ifdef CURL_FORMAT_CURL_OFF_T -# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" +#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined #endif #ifdef CURL_FORMAT_CURL_OFF_TU -# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" +#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined #endif #ifdef CURL_FORMAT_OFF_T -# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" +#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined #endif #ifdef CURL_SIZEOF_CURL_OFF_T -# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" +#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined #endif #ifdef CURL_SUFFIX_CURL_OFF_T -# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" +#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined #endif #ifdef CURL_SUFFIX_CURL_OFF_TU -# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" +#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined #endif diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlver.h b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlver.h index c7c7238e8e..b7e8acf538 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlver.h +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/curlver.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,17 +26,17 @@ a script at release-time. This was made its own header file in 7.11.2 */ /* This is the global package copyright */ -#define LIBCURL_COPYRIGHT "1996 - 2010 Daniel Stenberg, ." +#define LIBCURL_COPYRIGHT "1996 - 2012 Daniel Stenberg, ." /* This is the version number of the libcurl package from which this header file origins: */ -#define LIBCURL_VERSION "7.21.4" +#define LIBCURL_VERSION "7.26.0" /* The numeric version number is also available "in parts" by using these defines: */ #define LIBCURL_VERSION_MAJOR 7 -#define LIBCURL_VERSION_MINOR 21 -#define LIBCURL_VERSION_PATCH 4 +#define LIBCURL_VERSION_MINOR 26 +#define LIBCURL_VERSION_PATCH 0 /* This is the numeric version of the libcurl version number, meant for easier parsing and comparions by programs. The LIBCURL_VERSION_NUM define will @@ -53,7 +53,7 @@ and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work. */ -#define LIBCURL_VERSION_NUM 0x071504 +#define LIBCURL_VERSION_NUM 0x071a00 /* * This is the date and time when the full source package was created. The @@ -64,6 +64,6 @@ * * "Mon Feb 12 11:35:33 UTC 2007" */ -#define LIBCURL_TIMESTAMP "Thu Feb 17 12:19:40 UTC 2011" +#define LIBCURL_TIMESTAMP "Thu May 24 16:05:42 UTC 2012" #endif /* __CURL_CURLVER_H */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/easy.h b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/easy.h index 1ddb4fe5a2..c1e3e76096 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/easy.h +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/easy.h @@ -53,8 +53,8 @@ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); * * Creates a new curl session handle with the same options set for the handle * passed in. Duplicating a handle could only be a matter of cloning data and - * options, internal state info and things like persistant connections cannot - * be transfered. It is useful in multithreaded applications when you can run + * options, internal state info and things like persistent connections cannot + * be transferred. It is useful in multithreaded applications when you can run * curl_easy_duphandle() for each new thread to avoid a series of identical * curl_easy_setopt() invokes in every thread. */ diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/typecheck-gcc.h b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/typecheck-gcc.h index e6f74a9584..f8917e8112 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/typecheck-gcc.h +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/include/curl/typecheck-gcc.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,66 +41,66 @@ #define curl_easy_setopt(handle, option, value) \ __extension__ ({ \ __typeof__ (option) _curl_opt = option; \ - if (__builtin_constant_p(_curl_opt)) { \ - if (_curl_is_long_option(_curl_opt)) \ - if (!_curl_is_long(value)) \ + if(__builtin_constant_p(_curl_opt)) { \ + if(_curl_is_long_option(_curl_opt)) \ + if(!_curl_is_long(value)) \ _curl_easy_setopt_err_long(); \ - if (_curl_is_off_t_option(_curl_opt)) \ - if (!_curl_is_off_t(value)) \ + if(_curl_is_off_t_option(_curl_opt)) \ + if(!_curl_is_off_t(value)) \ _curl_easy_setopt_err_curl_off_t(); \ - if (_curl_is_string_option(_curl_opt)) \ - if (!_curl_is_string(value)) \ + if(_curl_is_string_option(_curl_opt)) \ + if(!_curl_is_string(value)) \ _curl_easy_setopt_err_string(); \ - if (_curl_is_write_cb_option(_curl_opt)) \ - if (!_curl_is_write_cb(value)) \ + if(_curl_is_write_cb_option(_curl_opt)) \ + if(!_curl_is_write_cb(value)) \ _curl_easy_setopt_err_write_callback(); \ - if ((_curl_opt) == CURLOPT_READFUNCTION) \ - if (!_curl_is_read_cb(value)) \ + if((_curl_opt) == CURLOPT_READFUNCTION) \ + if(!_curl_is_read_cb(value)) \ _curl_easy_setopt_err_read_cb(); \ - if ((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ - if (!_curl_is_ioctl_cb(value)) \ + if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ + if(!_curl_is_ioctl_cb(value)) \ _curl_easy_setopt_err_ioctl_cb(); \ - if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ - if (!_curl_is_sockopt_cb(value)) \ + if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ + if(!_curl_is_sockopt_cb(value)) \ _curl_easy_setopt_err_sockopt_cb(); \ - if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ - if (!_curl_is_opensocket_cb(value)) \ + if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ + if(!_curl_is_opensocket_cb(value)) \ _curl_easy_setopt_err_opensocket_cb(); \ - if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ - if (!_curl_is_progress_cb(value)) \ + if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ + if(!_curl_is_progress_cb(value)) \ _curl_easy_setopt_err_progress_cb(); \ - if ((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ - if (!_curl_is_debug_cb(value)) \ + if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ + if(!_curl_is_debug_cb(value)) \ _curl_easy_setopt_err_debug_cb(); \ - if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ - if (!_curl_is_ssl_ctx_cb(value)) \ + if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ + if(!_curl_is_ssl_ctx_cb(value)) \ _curl_easy_setopt_err_ssl_ctx_cb(); \ - if (_curl_is_conv_cb_option(_curl_opt)) \ - if (!_curl_is_conv_cb(value)) \ + if(_curl_is_conv_cb_option(_curl_opt)) \ + if(!_curl_is_conv_cb(value)) \ _curl_easy_setopt_err_conv_cb(); \ - if ((_curl_opt) == CURLOPT_SEEKFUNCTION) \ - if (!_curl_is_seek_cb(value)) \ + if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ + if(!_curl_is_seek_cb(value)) \ _curl_easy_setopt_err_seek_cb(); \ - if (_curl_is_cb_data_option(_curl_opt)) \ - if (!_curl_is_cb_data(value)) \ + if(_curl_is_cb_data_option(_curl_opt)) \ + if(!_curl_is_cb_data(value)) \ _curl_easy_setopt_err_cb_data(); \ - if ((_curl_opt) == CURLOPT_ERRORBUFFER) \ - if (!_curl_is_error_buffer(value)) \ + if((_curl_opt) == CURLOPT_ERRORBUFFER) \ + if(!_curl_is_error_buffer(value)) \ _curl_easy_setopt_err_error_buffer(); \ - if ((_curl_opt) == CURLOPT_STDERR) \ - if (!_curl_is_FILE(value)) \ + if((_curl_opt) == CURLOPT_STDERR) \ + if(!_curl_is_FILE(value)) \ _curl_easy_setopt_err_FILE(); \ - if (_curl_is_postfields_option(_curl_opt)) \ - if (!_curl_is_postfields(value)) \ + if(_curl_is_postfields_option(_curl_opt)) \ + if(!_curl_is_postfields(value)) \ _curl_easy_setopt_err_postfields(); \ - if ((_curl_opt) == CURLOPT_HTTPPOST) \ - if (!_curl_is_arr((value), struct curl_httppost)) \ + if((_curl_opt) == CURLOPT_HTTPPOST) \ + if(!_curl_is_arr((value), struct curl_httppost)) \ _curl_easy_setopt_err_curl_httpost(); \ - if (_curl_is_slist_option(_curl_opt)) \ - if (!_curl_is_arr((value), struct curl_slist)) \ + if(_curl_is_slist_option(_curl_opt)) \ + if(!_curl_is_arr((value), struct curl_slist)) \ _curl_easy_setopt_err_curl_slist(); \ - if ((_curl_opt) == CURLOPT_SHARE) \ - if (!_curl_is_ptr((value), CURLSH)) \ + if((_curl_opt) == CURLOPT_SHARE) \ + if(!_curl_is_ptr((value), CURLSH)) \ _curl_easy_setopt_err_CURLSH(); \ } \ curl_easy_setopt(handle, _curl_opt, value); \ @@ -111,18 +111,18 @@ __extension__ ({ \ #define curl_easy_getinfo(handle, info, arg) \ __extension__ ({ \ __typeof__ (info) _curl_info = info; \ - if (__builtin_constant_p(_curl_info)) { \ - if (_curl_is_string_info(_curl_info)) \ - if (!_curl_is_arr((arg), char *)) \ + if(__builtin_constant_p(_curl_info)) { \ + if(_curl_is_string_info(_curl_info)) \ + if(!_curl_is_arr((arg), char *)) \ _curl_easy_getinfo_err_string(); \ - if (_curl_is_long_info(_curl_info)) \ - if (!_curl_is_arr((arg), long)) \ + if(_curl_is_long_info(_curl_info)) \ + if(!_curl_is_arr((arg), long)) \ _curl_easy_getinfo_err_long(); \ - if (_curl_is_double_info(_curl_info)) \ - if (!_curl_is_arr((arg), double)) \ + if(_curl_is_double_info(_curl_info)) \ + if(!_curl_is_arr((arg), double)) \ _curl_easy_getinfo_err_double(); \ - if (_curl_is_slist_info(_curl_info)) \ - if (!_curl_is_arr((arg), struct curl_slist *)) \ + if(_curl_is_slist_info(_curl_info)) \ + if(!_curl_is_arr((arg), struct curl_slist *)) \ _curl_easy_getinfo_err_curl_slist(); \ } \ curl_easy_getinfo(handle, _curl_info, arg); \ @@ -141,15 +141,17 @@ __extension__ ({ \ /* To define a new warning, use _CURL_WARNING(identifier, "message") */ #define _CURL_WARNING(id, message) \ - static void __attribute__((warning(message))) __attribute__((unused)) \ - __attribute__((noinline)) id(void) { __asm__(""); } + static void __attribute__((__warning__(message))) \ + __attribute__((__unused__)) __attribute__((__noinline__)) \ + id(void) { __asm__(""); } _CURL_WARNING(_curl_easy_setopt_err_long, "curl_easy_setopt expects a long argument for this option") _CURL_WARNING(_curl_easy_setopt_err_curl_off_t, "curl_easy_setopt expects a curl_off_t argument for this option") _CURL_WARNING(_curl_easy_setopt_err_string, - "curl_easy_setopt expects a string (char* or char[]) argument for this option" + "curl_easy_setopt expects a " + "string (char* or char[]) argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_write_callback, "curl_easy_setopt expects a curl_write_callback argument for this option") @@ -160,7 +162,8 @@ _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, "curl_easy_setopt expects a curl_sockopt_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, - "curl_easy_setopt expects a curl_opensocket_callback argument for this option" + "curl_easy_setopt expects a " + "curl_opensocket_callback argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_progress_cb, "curl_easy_setopt expects a curl_progress_callback argument for this option") @@ -173,9 +176,11 @@ _CURL_WARNING(_curl_easy_setopt_err_conv_cb, _CURL_WARNING(_curl_easy_setopt_err_seek_cb, "curl_easy_setopt expects a curl_seek_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_cb_data, - "curl_easy_setopt expects a private data pointer as argument for this option") + "curl_easy_setopt expects a " + "private data pointer as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_error_buffer, - "curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option") + "curl_easy_setopt expects a " + "char buffer of CURL_ERROR_SIZE as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_FILE, "curl_easy_setopt expects a FILE* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_postfields, @@ -224,7 +229,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, (option) == CURLOPT_PROXYUSERNAME || \ (option) == CURLOPT_PROXYPASSWORD || \ (option) == CURLOPT_NOPROXY || \ - (option) == CURLOPT_ENCODING || \ + (option) == CURLOPT_ACCEPT_ENCODING || \ (option) == CURLOPT_REFERER || \ (option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_COOKIE || \ @@ -388,7 +393,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ /* XXX: also check size of an char[] array? */ #define _curl_is_error_buffer(expr) \ - (__builtin_types_compatible_p(__typeof__(expr), char *) || \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), char *) || \ __builtin_types_compatible_p(__typeof__(expr), char[])) /* evaluates to true if expr is of type (const) void* or (const) FILE* */ @@ -481,7 +487,8 @@ typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, curlsocktype); -/* evaluates to true if expr is of type curl_opensocket_callback or "similar" */ +/* evaluates to true if expr is of type curl_opensocket_callback or + "similar" */ #define _curl_is_opensocket_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ @@ -516,7 +523,11 @@ typedef int (_curl_progress_callback2)(const void *, _curl_callback_compatible((expr), _curl_debug_callback1) || \ _curl_callback_compatible((expr), _curl_debug_callback2) || \ _curl_callback_compatible((expr), _curl_debug_callback3) || \ - _curl_callback_compatible((expr), _curl_debug_callback4)) + _curl_callback_compatible((expr), _curl_debug_callback4) || \ + _curl_callback_compatible((expr), _curl_debug_callback5) || \ + _curl_callback_compatible((expr), _curl_debug_callback6) || \ + _curl_callback_compatible((expr), _curl_debug_callback7) || \ + _curl_callback_compatible((expr), _curl_debug_callback8)) typedef int (_curl_debug_callback1) (CURL *, curl_infotype, char *, size_t, void *); typedef int (_curl_debug_callback2) (CURL *, @@ -525,6 +536,14 @@ typedef int (_curl_debug_callback3) (CURL *, curl_infotype, const char *, size_t, void *); typedef int (_curl_debug_callback4) (CURL *, curl_infotype, const char *, size_t, const void *); +typedef int (_curl_debug_callback5) (CURL *, + curl_infotype, unsigned char *, size_t, void *); +typedef int (_curl_debug_callback6) (CURL *, + curl_infotype, unsigned char *, size_t, const void *); +typedef int (_curl_debug_callback7) (CURL *, + curl_infotype, const unsigned char *, size_t, void *); +typedef int (_curl_debug_callback8) (CURL *, + curl_infotype, const unsigned char *, size_t, const void *); /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ /* this is getting even messier... */ @@ -550,7 +569,8 @@ typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); -typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *); +typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, + const void *); #else typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id index 85faa41a12..186bc6d3b2 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -89c49d395ece44cf2d891cd5c2a84f819e229d30 \ No newline at end of file +a23875412ca7660ea9bada038fd05f84534b2b85 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id index 2b4ee2dcf5..b874fdb868 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -4dc0690a9f8419b4aba821eeb739d6beb4242cda \ No newline at end of file +a04bd2973966590291accfdcd0624e015334652a \ No newline at end of file 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 9747da75e9..7144bc7322 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 @@ -fca1b81187a22728c6c352f121ac03f8abf2ae75 \ No newline at end of file +dbf2fdecca23632d13cf417e0a7e5412c4786a5c \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id index 78fc8dfc68..c41b4a903f 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -68aaf2639b745d8479ad875745409f9cf65f4b93 \ No newline at end of file +21cc0d62d0f8fb702fb49766e9bbc14ff54be5bf \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id index ff515f9e04..1698f90c51 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -0319233cc1a28ea568fdc4ced57f2d1cfe11e81f \ No newline at end of file +a28766b9e95f451e1743be3562ce2e5fb17da67a \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id index 17d5d4a48f..b155ac8f59 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -54d8098e43887d3bb3a773542d869491d77d8e45 \ No newline at end of file +4a9068c1be4b5e5143ec763db264efda1f455f6c \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id index 968b0d0810..b43e4bc0ba 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id @@ -1 +1 @@ -2f84bee7e68f8b6766688634d6a35221cd006a66 \ No newline at end of file +22e24082eae1ffb8482044a22300fb82abdbbf72 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id index f893d8f899..611488db2e 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id @@ -1 +1 @@ -67df2bca4c4bdf2c53f0ae219f55ad5efdd8dd48 \ No newline at end of file +b60c3d26c3a22525dd4c910f97e22885c3c3a4bd \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id index a0ec7b688d..8fa6854858 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id @@ -1 +1 @@ -03f601480de32bbcc70313b8afda1bbf0194944c \ No newline at end of file +c67e594f3c1e1583fa2c2db0a609865da6b01df8 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id index b6cae73302..ef45440b47 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -08568c709e115ac77d96705d4b5cb47c1f494514 \ No newline at end of file +847ed6f57adc00708211a427105807cd955179e3 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id index c88b1b6289..498bc34b54 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -8ae8c1465f02581e5f557c549ccbd31f77ac392e \ No newline at end of file +1d348a7593920f7706d1689a1d1d9530ed50cf00 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id index 85d964f2e2..145b64b2a3 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -829ad7281999aff0543b4aca6574779ef6c48644 \ No newline at end of file +15244fa0efa82876e4b4d525af784fac1ac358d4 \ No newline at end of file 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 index 38c23edc1f..89d674b4e0 100644 --- 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 @@ -1 +1 @@ -813164629a16c93ebc3ff20a39072f2cae2aee3a \ No newline at end of file +62051e2fe2e9a8d383d827f83c12321b7d3a83fe \ 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 index f3101146e8..06bae4982e 100644 --- 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 @@ -1 +1 @@ -936f891620a0dbe86ae34809f3472d57497a6098 \ No newline at end of file +9978214f8c9fe1a615368f222515d6a1badf1b23 \ 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 index ac8cf02993..cb2ab3b9b0 100644 --- 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 @@ -1 +1 @@ -e9908a726968236013dd4a7488211f936d1eb406 \ No newline at end of file +ca9e20ce632d8e0c45d40bd51ecce8dde8150fc1 \ No newline at end of file From 81ff3d349590db308fed195af011e29f73aa3dd5 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 25 Oct 2012 16:30:14 +0800 Subject: [PATCH 18/95] issue #1312: use --strip-unneeded parameter to strip lib --- .../prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id | 2 +- .../prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id | 2 +- .../android/prebuilt/libcurl/libs/x86/libcurl.a.REMOVED.git-id | 2 +- .../prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id | 2 +- .../prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id | 2 +- .../android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id | 2 +- .../prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id | 2 +- .../prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id | 2 +- .../android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id | 2 +- .../prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id | 2 +- .../prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id | 2 +- .../android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id | 2 +- .../prebuilt/libxml2/libs/armeabi-v7a/libxml2.a.REMOVED.git-id | 2 +- .../prebuilt/libxml2/libs/armeabi/libxml2.a.REMOVED.git-id | 2 +- .../android/prebuilt/libxml2/libs/x86/libxml2.a.REMOVED.git-id | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id index 186bc6d3b2..2f6af6f123 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi-v7a/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -a23875412ca7660ea9bada038fd05f84534b2b85 \ No newline at end of file +a62cf1a73b170a4fee840de349019fd33e9970f4 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id index b874fdb868..46336725d2 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libcurl/libs/armeabi/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -a04bd2973966590291accfdcd0624e015334652a \ No newline at end of file +e83a0838166d5ccccc914361fc7d98f2b6e12e1e \ No newline at end of file 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 7144bc7322..2aea0ff9e2 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 @@ -dbf2fdecca23632d13cf417e0a7e5412c4786a5c \ No newline at end of file +bfedd8e90d438c9fcf1c469fa7bb0ff2a59167af \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id index c41b4a903f..e6f2193250 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi-v7a/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -21cc0d62d0f8fb702fb49766e9bbc14ff54be5bf \ No newline at end of file +e3bc493ab52f7a8d3da445e15f43c0c775740192 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id index 1698f90c51..13239bd184 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/armeabi/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -a28766b9e95f451e1743be3562ce2e5fb17da67a \ No newline at end of file +78e9ef9f9794da2d2098e733fd90ecad403ed735 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id index b155ac8f59..2655455767 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libjpeg/libs/x86/libjpeg.a.REMOVED.git-id @@ -1 +1 @@ -4a9068c1be4b5e5143ec763db264efda1f455f6c \ No newline at end of file +e8d210cb8607af7aa98219fce89ea1e6c14f8fc2 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id index b43e4bc0ba..16e9c6924d 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi-v7a/libpng.a.REMOVED.git-id @@ -1 +1 @@ -22e24082eae1ffb8482044a22300fb82abdbbf72 \ No newline at end of file +527a6e940f83b5d54b37b193af2081647cea4e90 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id index 611488db2e..b4165dcf2c 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a.REMOVED.git-id @@ -1 +1 @@ -b60c3d26c3a22525dd4c910f97e22885c3c3a4bd \ No newline at end of file +7fc417297c12c4199a31febebb0e9c53abb5f762 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id index 8fa6854858..7f1854025a 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libpng/libs/x86/libpng.a.REMOVED.git-id @@ -1 +1 @@ -c67e594f3c1e1583fa2c2db0a609865da6b01df8 \ No newline at end of file +649d8a9d888a3368eeb0b63ac2832b9faebc3502 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id index ef45440b47..7e11081f2b 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi-v7a/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -847ed6f57adc00708211a427105807cd955179e3 \ No newline at end of file +ee2bf5ad51a3a637deeee985082760f9b843bbe7 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id index 498bc34b54..247ad6a921 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -1d348a7593920f7706d1689a1d1d9530ed50cf00 \ No newline at end of file +3e4d0de19a158758f19a5b65db8b7f14c314771a \ No newline at end of file diff --git a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id index 145b64b2a3..c038ab38fa 100644 --- a/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id @@ -1 +1 @@ -15244fa0efa82876e4b4d525af784fac1ac358d4 \ No newline at end of file +f14376ce9ace14d386cb5a3b2178454bad786fb6 \ No newline at end of file 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 index 89d674b4e0..6d74f742a1 100644 --- 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 @@ -1 +1 @@ -62051e2fe2e9a8d383d827f83c12321b7d3a83fe \ No newline at end of file +7a291da70df8112d8be685fd326a4171a9eff66c \ 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 index 06bae4982e..4275730ad2 100644 --- 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 @@ -1 +1 @@ -9978214f8c9fe1a615368f222515d6a1badf1b23 \ No newline at end of file +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 index cb2ab3b9b0..79dd036f57 100644 --- 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 @@ -1 +1 @@ -ca9e20ce632d8e0c45d40bd51ecce8dde8150fc1 \ No newline at end of file +22740a73cdc408d9a8557d0f462f0a49bd29e26e \ No newline at end of file From f1da845bf993477987421439a083ebbd12e45c1b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 25 Oct 2012 16:33:34 +0800 Subject: [PATCH 19/95] Updated the submodule of cocos2d-html5-test. --- samples/TestJavascript/cocos2d-html5-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TestJavascript/cocos2d-html5-tests b/samples/TestJavascript/cocos2d-html5-tests index ba897b31b3..01d0bb4e80 160000 --- a/samples/TestJavascript/cocos2d-html5-tests +++ b/samples/TestJavascript/cocos2d-html5-tests @@ -1 +1 @@ -Subproject commit ba897b31b3175afdfb88cd52f24cc7520fb9cf0b +Subproject commit 01d0bb4e8091382647f929cb734330970c67b089 From c99c9baf6d172d14ac2e6d926c7e2020e87425aa Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 25 Oct 2012 17:07:18 +0800 Subject: [PATCH 20/95] Update AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 8af4791fe9..dfdc779e83 100644 --- a/AUTHORS +++ b/AUTHORS @@ -12,6 +12,9 @@ Developers: Rolando Abarca Javascript Binding and testjs + sburavtsov + fix for correct unscheduling and instance destruction of extensions/network/HttpClient.cpp + wenbin wang add korean language support fix getDeviceModel bug in android CocosDenshion From 132d927f18a819df72aba3937ae75e12015f2d12 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 26 Oct 2012 09:57:01 +0800 Subject: [PATCH 21/95] Updated the submodule of tools/cxx-generator. --- tools/cxx-generator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cxx-generator b/tools/cxx-generator index 5486f5cb9a..6e14e97554 160000 --- a/tools/cxx-generator +++ b/tools/cxx-generator @@ -1 +1 @@ -Subproject commit 5486f5cb9aeeceb41882468cb7186b0740061cdd +Subproject commit 6e14e97554b3cd25a1a69eace05377ff7d58aded From 0ce4f61bb624ddf7e3b8494af18c76e5702272fd Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 26 Oct 2012 10:04:29 +0800 Subject: [PATCH 22/95] Updating submodule reference to latest autogenerated bindings. --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index c38342f85f..e1a713cbaf 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit c38342f85f58e3238a7597d973457ca03b4a79c4 +Subproject commit e1a713cbaf36b2de82b64ab148532b4c30fa2f20 From 77b69262c8c433e9818f5765c6da766b96520557 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 26 Oct 2012 10:10:34 +0800 Subject: [PATCH 23/95] not invoke CCDirector::reshapeProjection() in EAGLView::layoutSubViews --- cocos2dx/platform/ios/EAGLView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2dx/platform/ios/EAGLView.mm b/cocos2dx/platform/ios/EAGLView.mm index 46588c2a17..47eb9ff862 100755 --- a/cocos2dx/platform/ios/EAGLView.mm +++ b/cocos2dx/platform/ios/EAGLView.mm @@ -263,7 +263,7 @@ static EAGLView *view = 0; cocos2d::CCSize size; size.width = size_.width; size.height = size_.height; - cocos2d::CCDirector::sharedDirector()->reshapeProjection(size); + //cocos2d::CCDirector::sharedDirector()->reshapeProjection(size); // Avoid flicker. Issue #350 //[director performSelectorOnMainThread:@selector(drawScene) withObject:nil waitUntilDone:YES]; From 9d530c8d54411afe6b5e498c94fc03a8be94f358 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 26 Oct 2012 12:04:45 +0800 Subject: [PATCH 24/95] fix a compiling error --- cocos2dx/platform/mac/EAGLView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2dx/platform/mac/EAGLView.mm b/cocos2dx/platform/mac/EAGLView.mm index b10ff34cf6..37681020fe 100755 --- a/cocos2dx/platform/mac/EAGLView.mm +++ b/cocos2dx/platform/mac/EAGLView.mm @@ -158,7 +158,7 @@ static EAGLView *view; cocos2d::CCDirector *director = cocos2d::CCDirector::sharedDirector(); CGSize size = NSSizeToCGSize(rect.size); cocos2d::CCSize ccsize = cocos2d::CCSizeMake(size.width, size.height); - director->reshapeProjection(ccsize); + //director->reshapeProjection(ccsize); // avoid flicker director->drawScene(); From 138ea49b0e73a009c9587dc12568479e1fb843e7 Mon Sep 17 00:00:00 2001 From: Andrew Perrault Date: Sat, 27 Oct 2012 09:58:49 -0400 Subject: [PATCH 25/95] fixed a couple typos --- cocos2dx/platform/blackberry/CCEGLView.h | 2 +- cocos2dx/proj.blackberry/.project | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/platform/blackberry/CCEGLView.h b/cocos2dx/platform/blackberry/CCEGLView.h index 27e07421f0..dc9c9998bb 100644 --- a/cocos2dx/platform/blackberry/CCEGLView.h +++ b/cocos2dx/platform/blackberry/CCEGLView.h @@ -27,7 +27,7 @@ THE SOFTWARE. #include "cocoa/CCGeometry.h" #include "platform/CCEGLViewProtocol.h" -#include "platform/CCPlatFormMacros.h" +#include "platform/CCPlatformMacros.h" NS_CC_BEGIN diff --git a/cocos2dx/proj.blackberry/.project b/cocos2dx/proj.blackberry/.project index 70f91bd758..c504e72c35 100644 --- a/cocos2dx/proj.blackberry/.project +++ b/cocos2dx/proj.blackberry/.project @@ -208,7 +208,7 @@ tilemap_parallax_nodes 2 - PARENT-1-PROJECT_LOC/tileMap_parallax_nodes + PARENT-1-PROJECT_LOC/tilemap_parallax_nodes touch_dispatcher From 9673b2077573afe43f2e766a3d67352be3b92d2c Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 10:49:28 +0800 Subject: [PATCH 26/95] issue #1312: Upgraded libcurl to 7.26.0 for windows port. --- .../platform/third_party/win32/curl/curl.h | 196 +++++++++++++----- .../platform/third_party/win32/curl/curlver.h | 14 +- .../platform/third_party/win32/curl/easy.h | 4 +- .../third_party/win32/curl/typecheck-gcc.h | 144 +++++++------ .../platform/third_party/win32/curl/types.h | 1 - .../libraries/libcurl.dll.REMOVED.git-id | 2 +- 6 files changed, 235 insertions(+), 126 deletions(-) delete mode 100644 cocos2dx/platform/third_party/win32/curl/types.h diff --git a/cocos2dx/platform/third_party/win32/curl/curl.h b/cocos2dx/platform/third_party/win32/curl/curl.h index 4744f48305..2cad28298e 100644 --- a/cocos2dx/platform/third_party/win32/curl/curl.h +++ b/cocos2dx/platform/third_party/win32/curl/curl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -55,34 +55,32 @@ #include #include -#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ - !defined(__CYGWIN__) || defined(__MINGW32__) -#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) /* The check above prevents the winsock2 inclusion if winsock.h already was included, since they can't co-exist without problems */ #include #include #endif -#else +#endif /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish - libc5-based Linux systems. Only include it on system that are known to + libc5-based Linux systems. Only include it on systems that are known to require it! */ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ - defined(ANDROID) || \ + defined(ANDROID) || defined(__ANDROID__) || \ (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) #include #endif -#ifndef _WIN32_WCE +#if !defined(WIN32) && !defined(_WIN32_WCE) #include #endif + #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) #include #endif -#include -#endif #ifdef __BEOS__ #include @@ -122,7 +120,7 @@ typedef void CURL; #ifndef curl_socket_typedef /* socket typedef */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__LWIP_OPT_H__) typedef SOCKET curl_socket_t; #define CURL_SOCKET_BAD INVALID_SOCKET #else @@ -189,10 +187,10 @@ typedef int (*curl_progress_callback)(void *clientp, #define CURL_MAX_HTTP_HEADER (100*1024) #endif - /* This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, @@ -315,6 +313,13 @@ typedef enum { CURLSOCKTYPE_LAST /* never use */ } curlsocktype; +/* The return code from the sockopt_callback can signal information back + to libcurl: */ +#define CURL_SOCKOPT_OK 0 +#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return + CURLE_ABORTED_BY_CALLBACK */ +#define CURL_SOCKOPT_ALREADY_CONNECTED 2 + typedef int (*curl_sockopt_callback)(void *clientp, curl_socket_t curlfd, curlsocktype purpose); @@ -334,6 +339,9 @@ typedef curl_socket_t curlsocktype purpose, struct curl_sockaddr *address); +typedef int +(*curl_closesocket_callback)(void *clientp, curl_socket_t item); + typedef enum { CURLIOE_OK, /* I/O operation successful */ CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ @@ -394,7 +402,8 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_OBSOLETE4, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for + 7.17.0, reused in April 2011 for 7.21.5] */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ @@ -402,9 +411,12 @@ typedef enum { CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server due to lack of access - when login fails this is not returned. */ - CURLE_OBSOLETE10, /* 10 - NOT USED */ + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for + 7.15.4, reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ - CURLE_OBSOLETE12, /* 12 - NOT USED */ + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server + [was obsoleted in August 2007 for 7.17.0, + reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ CURLE_FTP_CANT_GET_HOST, /* 15 */ @@ -444,7 +456,7 @@ typedef enum { CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ CURLE_OBSOLETE46, /* 46 - NOT USED */ CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ - CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */ + CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ CURLE_OBSOLETE50, /* 50 - NOT USED */ CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint @@ -459,7 +471,7 @@ typedef enum { CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ - CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ @@ -499,17 +511,24 @@ typedef enum { 7.19.0) */ CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ - CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Identifiers */ + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ - CURL_LAST /* never use! */ } CURLcode; #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ -/* Backwards compatibility with older names */ +/* Previously obsoletes error codes re-used in 7.24.0 */ +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT + +/* compatibility with older names */ +#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING + +/* The following were added in 7.21.5, April 2011 */ +#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION /* The following were added in 7.17.1 */ /* These are scheduled to disappear by 2009 */ @@ -517,7 +536,7 @@ typedef enum { /* The following were added in 7.17.0 */ /* These are scheduled to disappear by 2009 */ -#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */ +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 @@ -529,7 +548,7 @@ typedef enum { #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 -#define CURLE_URL_MALFORMAT_USER CURLE_OBSOLETE4 +#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE @@ -579,17 +598,32 @@ typedef enum { in 7.18.0 */ } curl_proxytype; /* this enum was added in 7.10 */ -#define CURLAUTH_NONE 0 /* nothing */ -#define CURLAUTH_BASIC (1<<0) /* Basic (default) */ -#define CURLAUTH_DIGEST (1<<1) /* Digest */ -#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */ -#define CURLAUTH_NTLM (1<<3) /* NTLM */ -#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */ -#define CURLAUTH_ONLY (1<<31) /* used together with a single other - type to force no auth or just that - single type */ -#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */ -#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) +/* + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: + * + * CURLAUTH_NONE - No HTTP authentication + * CURLAUTH_BASIC - HTTP Basic authentication (default) + * CURLAUTH_DIGEST - HTTP Digest authentication + * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication + * CURLAUTH_NTLM - HTTP NTLM authentication + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper + * CURLAUTH_ONLY - Use together with a single other type to force no + * authentication or just that single type + * CURLAUTH_ANY - All fine types set + * CURLAUTH_ANYSAFE - All fine types except Basic + */ + +#define CURLAUTH_NONE ((unsigned long)0) +#define CURLAUTH_BASIC (((unsigned long)1)<<0) +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) +#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2) +#define CURLAUTH_NTLM (((unsigned long)1)<<3) +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) +#define CURLAUTH_ONLY (((unsigned long)1)<<31) +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ @@ -599,6 +633,10 @@ typedef enum { #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ + #define CURL_ERROR_SIZE 256 struct curl_khkey { @@ -649,6 +687,15 @@ typedef enum { CURLUSESSL_LAST /* not an option, never use */ } curl_usessl; +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ + +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the + name of improving interoperability with older servers. Some SSL libraries + have introduced work-arounds for this flaw but those work-arounds sometimes + make the SSL communication fail. To regain functionality with those broken + servers, a user can this way allow the vulnerability back. */ +#define CURLSSLOPT_ALLOW_BEAST (1<<0) + #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ @@ -743,7 +790,7 @@ typedef enum { #endif #ifdef CURL_ISOCPP -#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number +#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu #else /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ #define LONG CURLOPTTYPE_LONG @@ -901,9 +948,7 @@ typedef enum { /* send linked-list of post-transfer QUOTE commands */ CINIT(POSTQUOTE, OBJECTPOINT, 39), - /* Pass a pointer to string of the output using full variable-replacement - as described elsewhere. */ - CINIT(WRITEINFO, OBJECTPOINT, 40), + CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */ CINIT(VERBOSE, LONG, 41), /* talk a lot */ CINIT(HEADER, LONG, 42), /* throw the header out too */ @@ -912,7 +957,7 @@ typedef enum { CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ CINIT(UPLOAD, LONG, 46), /* this is an upload */ CINIT(POST, LONG, 47), /* HTTP POST method */ - CINIT(DIRLISTONLY, LONG, 48), /* return bare names when listing directories */ + CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ @@ -979,9 +1024,7 @@ typedef enum { /* Max amount of cached alive connections */ CINIT(MAXCONNECTS, LONG, 71), - /* What policy to use when closing connections when the cache is filled - up */ - CINIT(CLOSEPOLICY, LONG, 72), + CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */ /* 73 = OBSOLETE */ @@ -1055,7 +1098,7 @@ typedef enum { CINIT(SSLENGINE_DEFAULT, LONG, 90), /* Non-zero value means to use the global dns cache */ - CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ /* DNS cache timeout */ CINIT(DNS_CACHE_TIMEOUT, LONG, 92), @@ -1092,8 +1135,9 @@ typedef enum { CINIT(PROXYTYPE, LONG, 101), /* Set the Accept-Encoding string. Use this to tell a server you would like - the response to be compressed. */ - CINIT(ENCODING, OBJECTPOINT, 102), + the response to be compressed. Before 7.21.6, this was known as + CURLOPT_ENCODING */ + CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), /* Set pointer to private data */ CINIT(PRIVATE, OBJECTPOINT, 103), @@ -1106,8 +1150,8 @@ typedef enum { and password to whatever host the server decides. */ CINIT(UNRESTRICTED_AUTH, LONG, 105), - /* Specifically switch on or off the FTP engine's use of the EPRT command ( it - also disables the LPRT attempt). By default, those ones will always be + /* Specifically switch on or off the FTP engine's use of the EPRT command ( + it also disables the LPRT attempt). By default, those ones will always be attempted before the good old traditional PORT command. */ CINIT(FTP_USE_EPRT, LONG, 106), @@ -1451,6 +1495,46 @@ typedef enum { /* Set authentication type for authenticated TLS */ CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), + /* Set to 1 to enable the "TE:" header in HTTP requests to ask for + compressed transfer-encoded responses. Set to 0 to disable the use of TE: + in outgoing requests. The current default is 0, but it might change in a + future libcurl release. + + libcurl will ask for the compressed methods it knows of, and if that + isn't any, it will not ask for transfer-encoding at all even if this + option is set to 1. + + */ + CINIT(TRANSFER_ENCODING, LONG, 207), + + /* Callback function for closing socket (instead of close(2)). The callback + should have type curl_closesocket_callback */ + CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), + CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), + + /* allow GSSAPI credential delegation */ + CINIT(GSSAPI_DELEGATION, LONG, 210), + + /* Set the name servers to use for DNS resolution */ + CINIT(DNS_SERVERS, OBJECTPOINT, 211), + + /* Time-out accept operations (currently for FTP only) after this amount + of miliseconds. */ + CINIT(ACCEPTTIMEOUT_MS, LONG, 212), + + /* Set TCP keepalive */ + CINIT(TCP_KEEPALIVE, LONG, 213), + + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ + CINIT(TCP_KEEPIDLE, LONG, 214), + CINIT(TCP_KEEPINTVL, LONG, 215), + + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ + CINIT(SSL_OPTIONS, LONG, 216), + + /* set the SMTP auth originator */ + CINIT(MAIL_AUTH, OBJECTPOINT, 217), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; @@ -1554,13 +1638,16 @@ enum CURL_TLSAUTH { }; /* symbols to use with CURLOPT_POSTREDIR. - CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that - CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ #define CURL_REDIR_GET_ALL 0 #define CURL_REDIR_POST_301 1 #define CURL_REDIR_POST_302 2 -#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302) +#define CURL_REDIR_POST_303 4 +#define CURL_REDIR_POST_ALL \ + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) typedef enum { CURL_TIMECOND_NONE, @@ -1679,7 +1766,8 @@ CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, * Should return the buffer length passed to it as the argument "len" on * success. */ -typedef size_t (*curl_formget_callback)(void *arg, const char *buf, size_t len); +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, + size_t len); /* * NAME curl_formget() @@ -1978,8 +2066,9 @@ typedef enum { CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ - CURLSHE_NOMEM, /* out of memory */ - CURLSHE_LAST /* never use */ + CURLSHE_NOMEM, /* 4 out of memory */ + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ + CURLSHE_LAST /* never use */ } CURLSHcode; typedef enum { @@ -2059,8 +2148,9 @@ typedef struct { #define CURL_VERSION_CONV (1<<12) /* character conversions supported */ #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */ -/* + /* * NAME curl_version_info() * * DESCRIPTION diff --git a/cocos2dx/platform/third_party/win32/curl/curlver.h b/cocos2dx/platform/third_party/win32/curl/curlver.h index c7c7238e8e..b7e8acf538 100644 --- a/cocos2dx/platform/third_party/win32/curl/curlver.h +++ b/cocos2dx/platform/third_party/win32/curl/curlver.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,17 +26,17 @@ a script at release-time. This was made its own header file in 7.11.2 */ /* This is the global package copyright */ -#define LIBCURL_COPYRIGHT "1996 - 2010 Daniel Stenberg, ." +#define LIBCURL_COPYRIGHT "1996 - 2012 Daniel Stenberg, ." /* This is the version number of the libcurl package from which this header file origins: */ -#define LIBCURL_VERSION "7.21.4" +#define LIBCURL_VERSION "7.26.0" /* The numeric version number is also available "in parts" by using these defines: */ #define LIBCURL_VERSION_MAJOR 7 -#define LIBCURL_VERSION_MINOR 21 -#define LIBCURL_VERSION_PATCH 4 +#define LIBCURL_VERSION_MINOR 26 +#define LIBCURL_VERSION_PATCH 0 /* This is the numeric version of the libcurl version number, meant for easier parsing and comparions by programs. The LIBCURL_VERSION_NUM define will @@ -53,7 +53,7 @@ and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work. */ -#define LIBCURL_VERSION_NUM 0x071504 +#define LIBCURL_VERSION_NUM 0x071a00 /* * This is the date and time when the full source package was created. The @@ -64,6 +64,6 @@ * * "Mon Feb 12 11:35:33 UTC 2007" */ -#define LIBCURL_TIMESTAMP "Thu Feb 17 12:19:40 UTC 2011" +#define LIBCURL_TIMESTAMP "Thu May 24 16:05:42 UTC 2012" #endif /* __CURL_CURLVER_H */ diff --git a/cocos2dx/platform/third_party/win32/curl/easy.h b/cocos2dx/platform/third_party/win32/curl/easy.h index 1ddb4fe5a2..c1e3e76096 100644 --- a/cocos2dx/platform/third_party/win32/curl/easy.h +++ b/cocos2dx/platform/third_party/win32/curl/easy.h @@ -53,8 +53,8 @@ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); * * Creates a new curl session handle with the same options set for the handle * passed in. Duplicating a handle could only be a matter of cloning data and - * options, internal state info and things like persistant connections cannot - * be transfered. It is useful in multithreaded applications when you can run + * options, internal state info and things like persistent connections cannot + * be transferred. It is useful in multithreaded applications when you can run * curl_easy_duphandle() for each new thread to avoid a series of identical * curl_easy_setopt() invokes in every thread. */ diff --git a/cocos2dx/platform/third_party/win32/curl/typecheck-gcc.h b/cocos2dx/platform/third_party/win32/curl/typecheck-gcc.h index e6f74a9584..f8917e8112 100644 --- a/cocos2dx/platform/third_party/win32/curl/typecheck-gcc.h +++ b/cocos2dx/platform/third_party/win32/curl/typecheck-gcc.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,66 +41,66 @@ #define curl_easy_setopt(handle, option, value) \ __extension__ ({ \ __typeof__ (option) _curl_opt = option; \ - if (__builtin_constant_p(_curl_opt)) { \ - if (_curl_is_long_option(_curl_opt)) \ - if (!_curl_is_long(value)) \ + if(__builtin_constant_p(_curl_opt)) { \ + if(_curl_is_long_option(_curl_opt)) \ + if(!_curl_is_long(value)) \ _curl_easy_setopt_err_long(); \ - if (_curl_is_off_t_option(_curl_opt)) \ - if (!_curl_is_off_t(value)) \ + if(_curl_is_off_t_option(_curl_opt)) \ + if(!_curl_is_off_t(value)) \ _curl_easy_setopt_err_curl_off_t(); \ - if (_curl_is_string_option(_curl_opt)) \ - if (!_curl_is_string(value)) \ + if(_curl_is_string_option(_curl_opt)) \ + if(!_curl_is_string(value)) \ _curl_easy_setopt_err_string(); \ - if (_curl_is_write_cb_option(_curl_opt)) \ - if (!_curl_is_write_cb(value)) \ + if(_curl_is_write_cb_option(_curl_opt)) \ + if(!_curl_is_write_cb(value)) \ _curl_easy_setopt_err_write_callback(); \ - if ((_curl_opt) == CURLOPT_READFUNCTION) \ - if (!_curl_is_read_cb(value)) \ + if((_curl_opt) == CURLOPT_READFUNCTION) \ + if(!_curl_is_read_cb(value)) \ _curl_easy_setopt_err_read_cb(); \ - if ((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ - if (!_curl_is_ioctl_cb(value)) \ + if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \ + if(!_curl_is_ioctl_cb(value)) \ _curl_easy_setopt_err_ioctl_cb(); \ - if ((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ - if (!_curl_is_sockopt_cb(value)) \ + if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \ + if(!_curl_is_sockopt_cb(value)) \ _curl_easy_setopt_err_sockopt_cb(); \ - if ((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ - if (!_curl_is_opensocket_cb(value)) \ + if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \ + if(!_curl_is_opensocket_cb(value)) \ _curl_easy_setopt_err_opensocket_cb(); \ - if ((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ - if (!_curl_is_progress_cb(value)) \ + if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \ + if(!_curl_is_progress_cb(value)) \ _curl_easy_setopt_err_progress_cb(); \ - if ((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ - if (!_curl_is_debug_cb(value)) \ + if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \ + if(!_curl_is_debug_cb(value)) \ _curl_easy_setopt_err_debug_cb(); \ - if ((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ - if (!_curl_is_ssl_ctx_cb(value)) \ + if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \ + if(!_curl_is_ssl_ctx_cb(value)) \ _curl_easy_setopt_err_ssl_ctx_cb(); \ - if (_curl_is_conv_cb_option(_curl_opt)) \ - if (!_curl_is_conv_cb(value)) \ + if(_curl_is_conv_cb_option(_curl_opt)) \ + if(!_curl_is_conv_cb(value)) \ _curl_easy_setopt_err_conv_cb(); \ - if ((_curl_opt) == CURLOPT_SEEKFUNCTION) \ - if (!_curl_is_seek_cb(value)) \ + if((_curl_opt) == CURLOPT_SEEKFUNCTION) \ + if(!_curl_is_seek_cb(value)) \ _curl_easy_setopt_err_seek_cb(); \ - if (_curl_is_cb_data_option(_curl_opt)) \ - if (!_curl_is_cb_data(value)) \ + if(_curl_is_cb_data_option(_curl_opt)) \ + if(!_curl_is_cb_data(value)) \ _curl_easy_setopt_err_cb_data(); \ - if ((_curl_opt) == CURLOPT_ERRORBUFFER) \ - if (!_curl_is_error_buffer(value)) \ + if((_curl_opt) == CURLOPT_ERRORBUFFER) \ + if(!_curl_is_error_buffer(value)) \ _curl_easy_setopt_err_error_buffer(); \ - if ((_curl_opt) == CURLOPT_STDERR) \ - if (!_curl_is_FILE(value)) \ + if((_curl_opt) == CURLOPT_STDERR) \ + if(!_curl_is_FILE(value)) \ _curl_easy_setopt_err_FILE(); \ - if (_curl_is_postfields_option(_curl_opt)) \ - if (!_curl_is_postfields(value)) \ + if(_curl_is_postfields_option(_curl_opt)) \ + if(!_curl_is_postfields(value)) \ _curl_easy_setopt_err_postfields(); \ - if ((_curl_opt) == CURLOPT_HTTPPOST) \ - if (!_curl_is_arr((value), struct curl_httppost)) \ + if((_curl_opt) == CURLOPT_HTTPPOST) \ + if(!_curl_is_arr((value), struct curl_httppost)) \ _curl_easy_setopt_err_curl_httpost(); \ - if (_curl_is_slist_option(_curl_opt)) \ - if (!_curl_is_arr((value), struct curl_slist)) \ + if(_curl_is_slist_option(_curl_opt)) \ + if(!_curl_is_arr((value), struct curl_slist)) \ _curl_easy_setopt_err_curl_slist(); \ - if ((_curl_opt) == CURLOPT_SHARE) \ - if (!_curl_is_ptr((value), CURLSH)) \ + if((_curl_opt) == CURLOPT_SHARE) \ + if(!_curl_is_ptr((value), CURLSH)) \ _curl_easy_setopt_err_CURLSH(); \ } \ curl_easy_setopt(handle, _curl_opt, value); \ @@ -111,18 +111,18 @@ __extension__ ({ \ #define curl_easy_getinfo(handle, info, arg) \ __extension__ ({ \ __typeof__ (info) _curl_info = info; \ - if (__builtin_constant_p(_curl_info)) { \ - if (_curl_is_string_info(_curl_info)) \ - if (!_curl_is_arr((arg), char *)) \ + if(__builtin_constant_p(_curl_info)) { \ + if(_curl_is_string_info(_curl_info)) \ + if(!_curl_is_arr((arg), char *)) \ _curl_easy_getinfo_err_string(); \ - if (_curl_is_long_info(_curl_info)) \ - if (!_curl_is_arr((arg), long)) \ + if(_curl_is_long_info(_curl_info)) \ + if(!_curl_is_arr((arg), long)) \ _curl_easy_getinfo_err_long(); \ - if (_curl_is_double_info(_curl_info)) \ - if (!_curl_is_arr((arg), double)) \ + if(_curl_is_double_info(_curl_info)) \ + if(!_curl_is_arr((arg), double)) \ _curl_easy_getinfo_err_double(); \ - if (_curl_is_slist_info(_curl_info)) \ - if (!_curl_is_arr((arg), struct curl_slist *)) \ + if(_curl_is_slist_info(_curl_info)) \ + if(!_curl_is_arr((arg), struct curl_slist *)) \ _curl_easy_getinfo_err_curl_slist(); \ } \ curl_easy_getinfo(handle, _curl_info, arg); \ @@ -141,15 +141,17 @@ __extension__ ({ \ /* To define a new warning, use _CURL_WARNING(identifier, "message") */ #define _CURL_WARNING(id, message) \ - static void __attribute__((warning(message))) __attribute__((unused)) \ - __attribute__((noinline)) id(void) { __asm__(""); } + static void __attribute__((__warning__(message))) \ + __attribute__((__unused__)) __attribute__((__noinline__)) \ + id(void) { __asm__(""); } _CURL_WARNING(_curl_easy_setopt_err_long, "curl_easy_setopt expects a long argument for this option") _CURL_WARNING(_curl_easy_setopt_err_curl_off_t, "curl_easy_setopt expects a curl_off_t argument for this option") _CURL_WARNING(_curl_easy_setopt_err_string, - "curl_easy_setopt expects a string (char* or char[]) argument for this option" + "curl_easy_setopt expects a " + "string (char* or char[]) argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_write_callback, "curl_easy_setopt expects a curl_write_callback argument for this option") @@ -160,7 +162,8 @@ _CURL_WARNING(_curl_easy_setopt_err_ioctl_cb, _CURL_WARNING(_curl_easy_setopt_err_sockopt_cb, "curl_easy_setopt expects a curl_sockopt_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_opensocket_cb, - "curl_easy_setopt expects a curl_opensocket_callback argument for this option" + "curl_easy_setopt expects a " + "curl_opensocket_callback argument for this option" ) _CURL_WARNING(_curl_easy_setopt_err_progress_cb, "curl_easy_setopt expects a curl_progress_callback argument for this option") @@ -173,9 +176,11 @@ _CURL_WARNING(_curl_easy_setopt_err_conv_cb, _CURL_WARNING(_curl_easy_setopt_err_seek_cb, "curl_easy_setopt expects a curl_seek_callback argument for this option") _CURL_WARNING(_curl_easy_setopt_err_cb_data, - "curl_easy_setopt expects a private data pointer as argument for this option") + "curl_easy_setopt expects a " + "private data pointer as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_error_buffer, - "curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option") + "curl_easy_setopt expects a " + "char buffer of CURL_ERROR_SIZE as argument for this option") _CURL_WARNING(_curl_easy_setopt_err_FILE, "curl_easy_setopt expects a FILE* argument for this option") _CURL_WARNING(_curl_easy_setopt_err_postfields, @@ -224,7 +229,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, (option) == CURLOPT_PROXYUSERNAME || \ (option) == CURLOPT_PROXYPASSWORD || \ (option) == CURLOPT_NOPROXY || \ - (option) == CURLOPT_ENCODING || \ + (option) == CURLOPT_ACCEPT_ENCODING || \ (option) == CURLOPT_REFERER || \ (option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_COOKIE || \ @@ -388,7 +393,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ /* XXX: also check size of an char[] array? */ #define _curl_is_error_buffer(expr) \ - (__builtin_types_compatible_p(__typeof__(expr), char *) || \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), char *) || \ __builtin_types_compatible_p(__typeof__(expr), char[])) /* evaluates to true if expr is of type (const) void* or (const) FILE* */ @@ -481,7 +487,8 @@ typedef int (_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype); typedef int (_curl_sockopt_callback2)(const void *, curl_socket_t, curlsocktype); -/* evaluates to true if expr is of type curl_opensocket_callback or "similar" */ +/* evaluates to true if expr is of type curl_opensocket_callback or + "similar" */ #define _curl_is_opensocket_cb(expr) \ (_curl_is_NULL(expr) || \ __builtin_types_compatible_p(__typeof__(expr), curl_opensocket_callback) ||\ @@ -516,7 +523,11 @@ typedef int (_curl_progress_callback2)(const void *, _curl_callback_compatible((expr), _curl_debug_callback1) || \ _curl_callback_compatible((expr), _curl_debug_callback2) || \ _curl_callback_compatible((expr), _curl_debug_callback3) || \ - _curl_callback_compatible((expr), _curl_debug_callback4)) + _curl_callback_compatible((expr), _curl_debug_callback4) || \ + _curl_callback_compatible((expr), _curl_debug_callback5) || \ + _curl_callback_compatible((expr), _curl_debug_callback6) || \ + _curl_callback_compatible((expr), _curl_debug_callback7) || \ + _curl_callback_compatible((expr), _curl_debug_callback8)) typedef int (_curl_debug_callback1) (CURL *, curl_infotype, char *, size_t, void *); typedef int (_curl_debug_callback2) (CURL *, @@ -525,6 +536,14 @@ typedef int (_curl_debug_callback3) (CURL *, curl_infotype, const char *, size_t, void *); typedef int (_curl_debug_callback4) (CURL *, curl_infotype, const char *, size_t, const void *); +typedef int (_curl_debug_callback5) (CURL *, + curl_infotype, unsigned char *, size_t, void *); +typedef int (_curl_debug_callback6) (CURL *, + curl_infotype, unsigned char *, size_t, const void *); +typedef int (_curl_debug_callback7) (CURL *, + curl_infotype, const unsigned char *, size_t, void *); +typedef int (_curl_debug_callback8) (CURL *, + curl_infotype, const unsigned char *, size_t, const void *); /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ /* this is getting even messier... */ @@ -550,7 +569,8 @@ typedef CURLcode (_curl_ssl_ctx_callback4)(CURL *, const void *, const void *); typedef CURLcode (_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *); typedef CURLcode (_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *); typedef CURLcode (_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *); -typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, const void *); +typedef CURLcode (_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX, + const void *); #else typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5; typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6; diff --git a/cocos2dx/platform/third_party/win32/curl/types.h b/cocos2dx/platform/third_party/win32/curl/types.h deleted file mode 100644 index d37d6ae9e1..0000000000 --- a/cocos2dx/platform/third_party/win32/curl/types.h +++ /dev/null @@ -1 +0,0 @@ -/* not used */ diff --git a/cocos2dx/platform/third_party/win32/libraries/libcurl.dll.REMOVED.git-id b/cocos2dx/platform/third_party/win32/libraries/libcurl.dll.REMOVED.git-id index 169b14e76e..dab75cd721 100644 --- a/cocos2dx/platform/third_party/win32/libraries/libcurl.dll.REMOVED.git-id +++ b/cocos2dx/platform/third_party/win32/libraries/libcurl.dll.REMOVED.git-id @@ -1 +1 @@ -fa6c63eca77d50e8429ab658766c97f8f9b91ae5 \ No newline at end of file +b0c8a791905972b4daf96fcdf2e63a9c3ded0ef3 \ No newline at end of file From 45783574fd15b435a76a08d59f5ceef05029c48f Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 11:27:25 +0800 Subject: [PATCH 27/95] Upgraded libcurl to 7.26.0 for linux port(32bit). --- .../third_party/linux/curl/Makefile.in | 560 ------------------ .../platform/third_party/linux/curl/curl.h | 133 +++-- .../third_party/linux/curl/curlbuild.h | 6 - .../third_party/linux/curl/curlbuild.h.in | 190 ------ .../platform/third_party/linux/curl/curlver.h | 14 +- .../platform/third_party/linux/curl/stamp-h3 | 1 - .../third_party/linux/curl/typecheck-gcc.h | 24 +- .../linux/libraries/libcurl.a.REMOVED.git-id | 2 +- 8 files changed, 122 insertions(+), 808 deletions(-) delete mode 100644 cocos2dx/platform/third_party/linux/curl/Makefile.in delete mode 100644 cocos2dx/platform/third_party/linux/curl/curlbuild.h.in delete mode 100644 cocos2dx/platform/third_party/linux/curl/stamp-h3 diff --git a/cocos2dx/platform/third_party/linux/curl/Makefile.in b/cocos2dx/platform/third_party/linux/curl/Makefile.in deleted file mode 100644 index 62cf5fe80d..0000000000 --- a/cocos2dx/platform/third_party/linux/curl/Makefile.in +++ /dev/null @@ -1,560 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 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@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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/curl -DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/curlbuild.h.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/curl-compilers.m4 \ - $(top_srcdir)/m4/curl-confopts.m4 \ - $(top_srcdir)/m4/curl-functions.m4 \ - $(top_srcdir)/m4/curl-openssl.m4 \ - $(top_srcdir)/m4/curl-override.m4 \ - $(top_srcdir)/m4/curl-reentrant.m4 \ - $(top_srcdir)/m4/curl-system.m4 $(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)/m4/xc-translit.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/lib/curl_config.h \ - $(top_builddir)/src/curl_config.h curlbuild.h -CONFIG_CLEAN_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 = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgincludedir)" -pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(pkginclude_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -pkgincludedir = $(includedir)/curl -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_LIBHOSTNAME_FALSE = @BUILD_LIBHOSTNAME_FALSE@ -BUILD_LIBHOSTNAME_TRUE = @BUILD_LIBHOSTNAME_TRUE@ -BUILD_UNITTESTS_FALSE = @BUILD_UNITTESTS_FALSE@ -BUILD_UNITTESTS_TRUE = @BUILD_UNITTESTS_TRUE@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CROSSCOMPILING_FALSE = @CROSSCOMPILING_FALSE@ -CROSSCOMPILING_TRUE = @CROSSCOMPILING_TRUE@ -CURLDEBUG_FALSE = @CURLDEBUG_FALSE@ -CURLDEBUG_TRUE = @CURLDEBUG_TRUE@ -CURLVERSION = @CURLVERSION@ -CURL_CA_BUNDLE = @CURL_CA_BUNDLE@ -CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@ -CURL_DISABLE_DICT = @CURL_DISABLE_DICT@ -CURL_DISABLE_FILE = @CURL_DISABLE_FILE@ -CURL_DISABLE_FTP = @CURL_DISABLE_FTP@ -CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@ -CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@ -CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@ -CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@ -CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@ -CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@ -CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@ -CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@ -CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@ -CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@ -CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@ -CURL_LIBS = @CURL_LIBS@ -CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_SHARED = @ENABLE_SHARED@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@ -HAVE_LDAP_SSL = @HAVE_LDAP_SSL@ -HAVE_LIBZ = @HAVE_LIBZ@ -HAVE_LIBZ_FALSE = @HAVE_LIBZ_FALSE@ -HAVE_LIBZ_TRUE = @HAVE_LIBZ_TRUE@ -HAVE_PK11_CREATEGENERICOBJECT = @HAVE_PK11_CREATEGENERICOBJECT@ -HAVE_SSLEAY_SRP = @HAVE_SSLEAY_SRP@ -IDN_ENABLED = @IDN_ENABLED@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -IPV6_ENABLED = @IPV6_ENABLED@ -KRB4_ENABLED = @KRB4_ENABLED@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBCURL_LIBS = @LIBCURL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MANOPT = @MANOPT@ -MIMPURE_FALSE = @MIMPURE_FALSE@ -MIMPURE_TRUE = @MIMPURE_TRUE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NO_UNDEFINED_FALSE = @NO_UNDEFINED_FALSE@ -NO_UNDEFINED_TRUE = @NO_UNDEFINED_TRUE@ -NROFF = @NROFF@ -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 = @PATH@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKGADD_NAME = @PKGADD_NAME@ -PKGADD_PKG = @PKGADD_PKG@ -PKGADD_VENDOR = @PKGADD_VENDOR@ -PKGCONFIG = @PKGCONFIG@ -RANDOM_FILE = @RANDOM_FILE@ -RANLIB = @RANLIB@ -REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SONAME_BUMP_FALSE = @SONAME_BUMP_FALSE@ -SONAME_BUMP_TRUE = @SONAME_BUMP_TRUE@ -SSL_ENABLED = @SSL_ENABLED@ -STATICLIB_FALSE = @STATICLIB_FALSE@ -STATICLIB_TRUE = @STATICLIB_TRUE@ -STRIP = @STRIP@ -SUPPORT_FEATURES = @SUPPORT_FEATURES@ -SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@ -TEST_SERVER_LIBS = @TEST_SERVER_LIBS@ -USE_ARES = @USE_ARES@ -USE_AXTLS = @USE_AXTLS@ -USE_CYASSL = @USE_CYASSL@ -USE_EMBEDDED_ARES_FALSE = @USE_EMBEDDED_ARES_FALSE@ -USE_EMBEDDED_ARES_TRUE = @USE_EMBEDDED_ARES_TRUE@ -USE_GNUTLS = @USE_GNUTLS@ -USE_LIBRTMP = @USE_LIBRTMP@ -USE_LIBSSH2 = @USE_LIBSSH2@ -USE_MANUAL_FALSE = @USE_MANUAL_FALSE@ -USE_MANUAL_TRUE = @USE_MANUAL_TRUE@ -USE_NSS = @USE_NSS@ -USE_OPENLDAP = @USE_OPENLDAP@ -USE_POLARSSL = @USE_POLARSSL@ -USE_SSLEAY = @USE_SSLEAY@ -USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@ -VERSION = @VERSION@ -VERSIONNUM = @VERSIONNUM@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -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@ -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@ -libext = @libext@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### -pkginclude_HEADERS = \ - curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \ - typecheck-gcc.h curlbuild.h curlrules.h - - -# curlbuild.h does not exist in the git tree. When the original libcurl -# source code distribution archive file is created, curlbuild.h.dist is -# renamed to curlbuild.h and included in the tarball so that it can be -# used directly on non-configure systems. -# -# The distributed curlbuild.h will be overwritten on configure systems -# when the configure script runs, with one that is suitable and specific -# to the library being configured and built. -# -# curlbuild.h.in is the distributed template file from which the configure -# script creates curlbuild.h at library configuration time, overwiting the -# one included in the distribution archive. -# -# curlbuild.h.dist is not included in the source code distribution archive. -EXTRA_DIST = curlbuild.h.in -DISTCLEANFILES = curlbuild.h -all: curlbuild.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/curl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign include/curl/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -curlbuild.h: stamp-h3 - @if test ! -f $@; then \ - rm -f stamp-h3; \ - $(MAKE) stamp-h3; \ - else :; fi - -stamp-h3: $(srcdir)/curlbuild.h.in $(top_builddir)/config.status - @rm -f stamp-h3 - cd $(top_builddir) && $(SHELL) ./config.status include/curl/curlbuild.h -$(srcdir)/curlbuild.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h3 - touch $@ - -distclean-hdr: - -rm -f curlbuild.h stamp-h3 - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-pkgincludeHEADERS: $(pkginclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(pkgincludedir)" || $(mkdir_p) "$(DESTDIR)$(pkgincludedir)" - @list='$(pkginclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \ - $(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \ - done - -uninstall-pkgincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(pkginclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \ - done - -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; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) curlbuild.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) curlbuild.h.in $(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; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) curlbuild.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) curlbuild.h.in $(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; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && 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)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$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 -@CURLDEBUG_FALSE@all-local: -all-am: Makefile $(HEADERS) curlbuild.h all-local -installdirs: - for dir in "$(DESTDIR)$(pkgincludedir)"; 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 -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -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-hdr \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgincludeHEADERS - -install-exec-am: - -install-info: install-info-am - -install-man: - -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-info-am uninstall-pkgincludeHEADERS - -.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ - clean-generic clean-libtool ctags distclean distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man \ - install-pkgincludeHEADERS install-strip 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-info-am uninstall-pkgincludeHEADERS - - -checksrc: - @@PERL@ $(top_srcdir)/lib/checksrc.pl -Wcurlbuild.h -D$(top_srcdir)/include/curl $(pkginclude_HEADERS) $(EXTRA_DIST) - -# for debug builds, we scan the sources on all regular make invokes -@CURLDEBUG_TRUE@all-local: checksrc -# 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/curl/curl.h b/cocos2dx/platform/third_party/linux/curl/curl.h index a9d42fad69..2cad28298e 100644 --- a/cocos2dx/platform/third_party/linux/curl/curl.h +++ b/cocos2dx/platform/third_party/linux/curl/curl.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -55,34 +55,32 @@ #include #include -#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ - !defined(__CYGWIN__) || defined(__MINGW32__) -#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) /* The check above prevents the winsock2 inclusion if winsock.h already was included, since they can't co-exist without problems */ #include #include #endif -#else +#endif /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish - libc5-based Linux systems. Only include it on system that are known to + libc5-based Linux systems. Only include it on systems that are known to require it! */ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ - defined(ANDROID) || \ + defined(ANDROID) || defined(__ANDROID__) || \ (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) #include #endif -#ifndef _WIN32_WCE +#if !defined(WIN32) && !defined(_WIN32_WCE) #include #endif + #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) #include #endif -#include -#endif #ifdef __BEOS__ #include @@ -122,7 +120,7 @@ typedef void CURL; #ifndef curl_socket_typedef /* socket typedef */ -#ifdef WIN32 +#if defined(WIN32) && !defined(__LWIP_OPT_H__) typedef SOCKET curl_socket_t; #define CURL_SOCKET_BAD INVALID_SOCKET #else @@ -189,10 +187,10 @@ typedef int (*curl_progress_callback)(void *clientp, #define CURL_MAX_HTTP_HEADER (100*1024) #endif - /* This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer. */ #define CURL_WRITEFUNC_PAUSE 0x10000001 + typedef size_t (*curl_write_callback)(char *buffer, size_t size, size_t nitems, @@ -413,9 +411,12 @@ typedef enum { CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server due to lack of access - when login fails this is not returned. */ - CURLE_OBSOLETE10, /* 10 - NOT USED */ + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for + 7.15.4, reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ - CURLE_OBSOLETE12, /* 12 - NOT USED */ + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server + [was obsoleted in August 2007 for 7.17.0, + reused in Dec 2011 for 7.24.0]*/ CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ CURLE_FTP_CANT_GET_HOST, /* 15 */ @@ -513,13 +514,16 @@ typedef enum { CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ - CURL_LAST /* never use! */ } CURLcode; #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ +/* Previously obsoletes error codes re-used in 7.24.0 */ +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT + /* compatibility with older names */ #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING @@ -594,17 +598,32 @@ typedef enum { in 7.18.0 */ } curl_proxytype; /* this enum was added in 7.10 */ -#define CURLAUTH_NONE 0 /* nothing */ -#define CURLAUTH_BASIC (1<<0) /* Basic (default) */ -#define CURLAUTH_DIGEST (1<<1) /* Digest */ -#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */ -#define CURLAUTH_NTLM (1<<3) /* NTLM */ -#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */ -#define CURLAUTH_ONLY (1<<31) /* used together with a single other - type to force no auth or just that - single type */ -#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */ -#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) +/* + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: + * + * CURLAUTH_NONE - No HTTP authentication + * CURLAUTH_BASIC - HTTP Basic authentication (default) + * CURLAUTH_DIGEST - HTTP Digest authentication + * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication + * CURLAUTH_NTLM - HTTP NTLM authentication + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper + * CURLAUTH_ONLY - Use together with a single other type to force no + * authentication or just that single type + * CURLAUTH_ANY - All fine types set + * CURLAUTH_ANYSAFE - All fine types except Basic + */ + +#define CURLAUTH_NONE ((unsigned long)0) +#define CURLAUTH_BASIC (((unsigned long)1)<<0) +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) +#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2) +#define CURLAUTH_NTLM (((unsigned long)1)<<3) +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) +#define CURLAUTH_ONLY (((unsigned long)1)<<31) +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ @@ -614,6 +633,10 @@ typedef enum { #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ + #define CURL_ERROR_SIZE 256 struct curl_khkey { @@ -664,6 +687,15 @@ typedef enum { CURLUSESSL_LAST /* not an option, never use */ } curl_usessl; +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ + +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the + name of improving interoperability with older servers. Some SSL libraries + have introduced work-arounds for this flaw but those work-arounds sometimes + make the SSL communication fail. To regain functionality with those broken + servers, a user can this way allow the vulnerability back. */ +#define CURLSSLOPT_ALLOW_BEAST (1<<0) + #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all the obsolete stuff removed! */ @@ -916,9 +948,7 @@ typedef enum { /* send linked-list of post-transfer QUOTE commands */ CINIT(POSTQUOTE, OBJECTPOINT, 39), - /* Pass a pointer to string of the output using full variable-replacement - as described elsewhere. */ - CINIT(WRITEINFO, OBJECTPOINT, 40), + CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */ CINIT(VERBOSE, LONG, 41), /* talk a lot */ CINIT(HEADER, LONG, 42), /* throw the header out too */ @@ -994,8 +1024,7 @@ typedef enum { /* Max amount of cached alive connections */ CINIT(MAXCONNECTS, LONG, 71), - /* 72 - DEPRECATED */ - CINIT(CLOSEPOLICY, LONG, 72), + CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */ /* 73 = OBSOLETE */ @@ -1069,7 +1098,7 @@ typedef enum { CINIT(SSLENGINE_DEFAULT, LONG, 90), /* Non-zero value means to use the global dns cache */ - CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* To become OBSOLETE soon */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ /* DNS cache timeout */ CINIT(DNS_CACHE_TIMEOUT, LONG, 92), @@ -1483,6 +1512,29 @@ typedef enum { CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), + /* allow GSSAPI credential delegation */ + CINIT(GSSAPI_DELEGATION, LONG, 210), + + /* Set the name servers to use for DNS resolution */ + CINIT(DNS_SERVERS, OBJECTPOINT, 211), + + /* Time-out accept operations (currently for FTP only) after this amount + of miliseconds. */ + CINIT(ACCEPTTIMEOUT_MS, LONG, 212), + + /* Set TCP keepalive */ + CINIT(TCP_KEEPALIVE, LONG, 213), + + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ + CINIT(TCP_KEEPIDLE, LONG, 214), + CINIT(TCP_KEEPINTVL, LONG, 215), + + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ + CINIT(SSL_OPTIONS, LONG, 216), + + /* set the SMTP auth originator */ + CINIT(MAIL_AUTH, OBJECTPOINT, 217), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; @@ -1586,13 +1638,16 @@ enum CURL_TLSAUTH { }; /* symbols to use with CURLOPT_POSTREDIR. - CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that - CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ #define CURL_REDIR_GET_ALL 0 #define CURL_REDIR_POST_301 1 #define CURL_REDIR_POST_302 2 -#define CURL_REDIR_POST_ALL (CURL_REDIR_POST_301|CURL_REDIR_POST_302) +#define CURL_REDIR_POST_303 4 +#define CURL_REDIR_POST_ALL \ + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) typedef enum { CURL_TIMECOND_NONE, @@ -2011,8 +2066,9 @@ typedef enum { CURLSHE_BAD_OPTION, /* 1 */ CURLSHE_IN_USE, /* 2 */ CURLSHE_INVALID, /* 3 */ - CURLSHE_NOMEM, /* out of memory */ - CURLSHE_LAST /* never use */ + CURLSHE_NOMEM, /* 4 out of memory */ + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ + CURLSHE_LAST /* never use */ } CURLSHcode; typedef enum { @@ -2092,8 +2148,9 @@ typedef struct { #define CURL_VERSION_CONV (1<<12) /* character conversions supported */ #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */ -/* + /* * NAME curl_version_info() * * DESCRIPTION diff --git a/cocos2dx/platform/third_party/linux/curl/curlbuild.h b/cocos2dx/platform/third_party/linux/curl/curlbuild.h index a2f934e17b..98ede6eef7 100644 --- a/cocos2dx/platform/third_party/linux/curl/curlbuild.h +++ b/cocos2dx/platform/third_party/linux/curl/curlbuild.h @@ -153,13 +153,7 @@ #endif /* The size of `long', as computed by sizeof. */ -//#define CURL_SIZEOF_LONG 4 - -#ifdef __LP64__ -#define CURL_SIZEOF_LONG 8 -#else #define CURL_SIZEOF_LONG 4 -#endif /* Integral data type used for curl_socklen_t. */ #define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t diff --git a/cocos2dx/platform/third_party/linux/curl/curlbuild.h.in b/cocos2dx/platform/third_party/linux/curl/curlbuild.h.in deleted file mode 100644 index fe348f40da..0000000000 --- a/cocos2dx/platform/third_party/linux/curl/curlbuild.h.in +++ /dev/null @@ -1,190 +0,0 @@ -#ifndef __CURL_CURLBUILD_H -#define __CURL_CURLBUILD_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -/* ================================================================ */ -/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ -/* ================================================================ */ - -/* - * NOTE 1: - * ------- - * - * Nothing in this file is intended to be modified or adjusted by the - * curl library user nor by the curl library builder. - * - * If you think that something actually needs to be changed, adjusted - * or fixed in this file, then, report it on the libcurl development - * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ - * - * This header file shall only export symbols which are 'curl' or 'CURL' - * prefixed, otherwise public name space would be polluted. - * - * NOTE 2: - * ------- - * - * Right now you might be staring at file include/curl/curlbuild.h.in or - * at file include/curl/curlbuild.h, this is due to the following reason: - * - * On systems capable of running the configure script, the configure process - * will overwrite the distributed include/curl/curlbuild.h file with one that - * is suitable and specific to the library being configured and built, which - * is generated from the include/curl/curlbuild.h.in template file. - * - */ - -/* ================================================================ */ -/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ -/* ================================================================ */ - -#ifdef CURL_SIZEOF_LONG -#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined -#endif - -#ifdef CURL_TYPEOF_CURL_SOCKLEN_T -#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined -#endif - -#ifdef CURL_SIZEOF_CURL_SOCKLEN_T -#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined -#endif - -#ifdef CURL_TYPEOF_CURL_OFF_T -#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined -#endif - -#ifdef CURL_FORMAT_CURL_OFF_T -#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined -#endif - -#ifdef CURL_FORMAT_CURL_OFF_TU -#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined -#endif - -#ifdef CURL_FORMAT_OFF_T -#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined -#endif - -#ifdef CURL_SIZEOF_CURL_OFF_T -#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined -#endif - -#ifdef CURL_SUFFIX_CURL_OFF_T -#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined -#endif - -#ifdef CURL_SUFFIX_CURL_OFF_TU -#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" - Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined -#endif - -/* ================================================================ */ -/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ -/* ================================================================ */ - -/* Configure process defines this to 1 when it finds out that system */ -/* header file ws2tcpip.h must be included by the external interface. */ -#undef CURL_PULL_WS2TCPIP_H -#ifdef CURL_PULL_WS2TCPIP_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# include -# include -# include -#endif - -/* Configure process defines this to 1 when it finds out that system */ -/* header file sys/types.h must be included by the external interface. */ -#undef CURL_PULL_SYS_TYPES_H -#ifdef CURL_PULL_SYS_TYPES_H -# include -#endif - -/* Configure process defines this to 1 when it finds out that system */ -/* header file stdint.h must be included by the external interface. */ -#undef CURL_PULL_STDINT_H -#ifdef CURL_PULL_STDINT_H -# include -#endif - -/* Configure process defines this to 1 when it finds out that system */ -/* header file inttypes.h must be included by the external interface. */ -#undef CURL_PULL_INTTYPES_H -#ifdef CURL_PULL_INTTYPES_H -# include -#endif - -/* Configure process defines this to 1 when it finds out that system */ -/* header file sys/socket.h must be included by the external interface. */ -#undef CURL_PULL_SYS_SOCKET_H -#ifdef CURL_PULL_SYS_SOCKET_H -# include -#endif - -/* The size of `long', as computed by sizeof. */ -#undef CURL_SIZEOF_LONG - -/* Integral data type used for curl_socklen_t. */ -#undef CURL_TYPEOF_CURL_SOCKLEN_T - -/* The size of `curl_socklen_t', as computed by sizeof. */ -#undef CURL_SIZEOF_CURL_SOCKLEN_T - -/* Data type definition of curl_socklen_t. */ -typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; - -/* Signed integral data type used for curl_off_t. */ -#undef CURL_TYPEOF_CURL_OFF_T - -/* Data type definition of curl_off_t. */ -typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; - -/* curl_off_t formatting string directive without "%" conversion specifier. */ -#undef CURL_FORMAT_CURL_OFF_T - -/* unsigned curl_off_t formatting string without "%" conversion specifier. */ -#undef CURL_FORMAT_CURL_OFF_TU - -/* curl_off_t formatting string directive with "%" conversion specifier. */ -#undef CURL_FORMAT_OFF_T - -/* The size of `curl_off_t', as computed by sizeof. */ -#undef CURL_SIZEOF_CURL_OFF_T - -/* curl_off_t constant suffix. */ -#undef CURL_SUFFIX_CURL_OFF_T - -/* unsigned curl_off_t constant suffix. */ -#undef CURL_SUFFIX_CURL_OFF_TU - -#endif /* __CURL_CURLBUILD_H */ diff --git a/cocos2dx/platform/third_party/linux/curl/curlver.h b/cocos2dx/platform/third_party/linux/curl/curlver.h index bb90c8c0d9..b7e8acf538 100644 --- a/cocos2dx/platform/third_party/linux/curl/curlver.h +++ b/cocos2dx/platform/third_party/linux/curl/curlver.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,17 +26,17 @@ a script at release-time. This was made its own header file in 7.11.2 */ /* This is the global package copyright */ -#define LIBCURL_COPYRIGHT "1996 - 2011 Daniel Stenberg, ." +#define LIBCURL_COPYRIGHT "1996 - 2012 Daniel Stenberg, ." /* This is the version number of the libcurl package from which this header file origins: */ -#define LIBCURL_VERSION "7.21.7" +#define LIBCURL_VERSION "7.26.0" /* The numeric version number is also available "in parts" by using these defines: */ #define LIBCURL_VERSION_MAJOR 7 -#define LIBCURL_VERSION_MINOR 21 -#define LIBCURL_VERSION_PATCH 7 +#define LIBCURL_VERSION_MINOR 26 +#define LIBCURL_VERSION_PATCH 0 /* This is the numeric version of the libcurl version number, meant for easier parsing and comparions by programs. The LIBCURL_VERSION_NUM define will @@ -53,7 +53,7 @@ and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work. */ -#define LIBCURL_VERSION_NUM 0x071507 +#define LIBCURL_VERSION_NUM 0x071a00 /* * This is the date and time when the full source package was created. The @@ -64,6 +64,6 @@ * * "Mon Feb 12 11:35:33 UTC 2007" */ -#define LIBCURL_TIMESTAMP "Thu Jun 23 08:25:34 UTC 2011" +#define LIBCURL_TIMESTAMP "Thu May 24 16:05:42 UTC 2012" #endif /* __CURL_CURLVER_H */ diff --git a/cocos2dx/platform/third_party/linux/curl/stamp-h3 b/cocos2dx/platform/third_party/linux/curl/stamp-h3 deleted file mode 100644 index e4ea1b88ab..0000000000 --- a/cocos2dx/platform/third_party/linux/curl/stamp-h3 +++ /dev/null @@ -1 +0,0 @@ -timestamp for include/curl/curlbuild.h diff --git a/cocos2dx/platform/third_party/linux/curl/typecheck-gcc.h b/cocos2dx/platform/third_party/linux/curl/typecheck-gcc.h index f043a18e43..f8917e8112 100644 --- a/cocos2dx/platform/third_party/linux/curl/typecheck-gcc.h +++ b/cocos2dx/platform/third_party/linux/curl/typecheck-gcc.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -141,8 +141,9 @@ __extension__ ({ \ /* To define a new warning, use _CURL_WARNING(identifier, "message") */ #define _CURL_WARNING(id, message) \ - static void __attribute__((warning(message))) __attribute__((unused)) \ - __attribute__((noinline)) id(void) { __asm__(""); } + static void __attribute__((__warning__(message))) \ + __attribute__((__unused__)) __attribute__((__noinline__)) \ + id(void) { __asm__(""); } _CURL_WARNING(_curl_easy_setopt_err_long, "curl_easy_setopt expects a long argument for this option") @@ -392,7 +393,8 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist, /* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */ /* XXX: also check size of an char[] array? */ #define _curl_is_error_buffer(expr) \ - (__builtin_types_compatible_p(__typeof__(expr), char *) || \ + (_curl_is_NULL(expr) || \ + __builtin_types_compatible_p(__typeof__(expr), char *) || \ __builtin_types_compatible_p(__typeof__(expr), char[])) /* evaluates to true if expr is of type (const) void* or (const) FILE* */ @@ -521,7 +523,11 @@ typedef int (_curl_progress_callback2)(const void *, _curl_callback_compatible((expr), _curl_debug_callback1) || \ _curl_callback_compatible((expr), _curl_debug_callback2) || \ _curl_callback_compatible((expr), _curl_debug_callback3) || \ - _curl_callback_compatible((expr), _curl_debug_callback4)) + _curl_callback_compatible((expr), _curl_debug_callback4) || \ + _curl_callback_compatible((expr), _curl_debug_callback5) || \ + _curl_callback_compatible((expr), _curl_debug_callback6) || \ + _curl_callback_compatible((expr), _curl_debug_callback7) || \ + _curl_callback_compatible((expr), _curl_debug_callback8)) typedef int (_curl_debug_callback1) (CURL *, curl_infotype, char *, size_t, void *); typedef int (_curl_debug_callback2) (CURL *, @@ -530,6 +536,14 @@ typedef int (_curl_debug_callback3) (CURL *, curl_infotype, const char *, size_t, void *); typedef int (_curl_debug_callback4) (CURL *, curl_infotype, const char *, size_t, const void *); +typedef int (_curl_debug_callback5) (CURL *, + curl_infotype, unsigned char *, size_t, void *); +typedef int (_curl_debug_callback6) (CURL *, + curl_infotype, unsigned char *, size_t, const void *); +typedef int (_curl_debug_callback7) (CURL *, + curl_infotype, const unsigned char *, size_t, void *); +typedef int (_curl_debug_callback8) (CURL *, + curl_infotype, const unsigned char *, size_t, const void *); /* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */ /* this is getting even messier... */ diff --git a/cocos2dx/platform/third_party/linux/libraries/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/linux/libraries/libcurl.a.REMOVED.git-id index 03dcad5b23..c819edaa0a 100644 --- a/cocos2dx/platform/third_party/linux/libraries/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/linux/libraries/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -0059c979a994f1102d90b9f532a6687f2d4905c2 \ No newline at end of file +b4d7f374257b051c9241d6ef7fbc80bf6966ad3a \ No newline at end of file From e992408a86f82b28aa7badc4d38d761c2cd24cd2 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 29 Oct 2012 14:39:44 +0800 Subject: [PATCH 28/95] issue #1312:update libcurl for linux 64 --- .../libraries/lib64/libcurl.a.REMOVED.git-id | 2 +- .../libraries/lib64/libcurl.so.REMOVED.git-id | 1 - samples/HelloCpp/proj.linux/Makefile | 16 ++++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.so.REMOVED.git-id diff --git a/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.a.REMOVED.git-id b/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.a.REMOVED.git-id index b555f184c2..fb8cc8b545 100644 --- a/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.a.REMOVED.git-id +++ b/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.a.REMOVED.git-id @@ -1 +1 @@ -a485f5e235eab19953e38764652f50a60556d755 \ No newline at end of file +62d3069171e474ac720640f58c31cac4d312a2c9 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.so.REMOVED.git-id b/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.so.REMOVED.git-id deleted file mode 100644 index cade70d7e0..0000000000 --- a/cocos2dx/platform/third_party/linux/libraries/lib64/libcurl.so.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b76eb018f78af561dcc72e78f477c6b6233f4298 \ No newline at end of file diff --git a/samples/HelloCpp/proj.linux/Makefile b/samples/HelloCpp/proj.linux/Makefile index 581d1700e3..075553a949 100644 --- a/samples/HelloCpp/proj.linux/Makefile +++ b/samples/HelloCpp/proj.linux/Makefile @@ -41,9 +41,21 @@ STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ $(STATICLIBS_DIR)/libtiff.a \ # $(STATICLIBS_DIR)/libGLEW.a \ -SHAREDLIBS = -lglfw -lcurl -SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib +SHAREDLIBS = +ifeq ($(LBITS),64) +SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/lib64/api/lib +SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex64 +else +SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/api/lib +SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex +endif + +SHAREDLIBS += -lglfw -lGL +#SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/ +SHAREDLIBS += -Wl,-rpath,../../$(SHAREDLIBS_DIR) +#SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW +SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib #$(shell ../../build-linux.sh $<) From 16d5659b17c9b661d1e8e45cc0320cb7540ee50a Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 10:48:22 -0700 Subject: [PATCH 29/95] Adding ScriptingEngine callback for onCleanup event --- cocos2dx/base_nodes/CCNode.cpp | 11 +++++++++-- cocos2dx/base_nodes/CCNode.h | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 57c36a97f1..b16f1411c8 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -456,8 +456,13 @@ void CCNode::cleanup() { // actions this->stopAllActions(); - this->unscheduleAllSelectors(); - + this->unscheduleAllSelectors(); + + if ( m_eScriptType != kScriptTypeNone) + { + CCScriptEngineManager::sharedManager()->getScriptEngine()->executeNodeEvent(this, kCCNodeOnCleanup); + } + // timers arrayMakeObjectsPerformSelector(m_pChildren, cleanup, CCNode*); } @@ -838,6 +843,8 @@ void CCNode::onExit() } arrayMakeObjectsPerformSelector(m_pChildren, onExit, CCNode*); + + } void CCNode::registerScriptHandler(int nHandler) diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index e9595be0de..1fcb35bc27 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -62,7 +62,8 @@ enum { kCCNodeOnEnter, kCCNodeOnExit, kCCNodeOnEnterTransitionDidFinish, - kCCNodeOnExitTransitionDidStart + kCCNodeOnExitTransitionDidStart, + kCCNodeOnCleanup }; /** @brief CCNode is the main element. Anything that gets drawn or contains things that get drawn is a CCNode. From a2ee6c37613e7dc2a62f626bfc7bd8977823b0ae Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Fri, 26 Oct 2012 17:11:43 -0700 Subject: [PATCH 30/95] Changing Touch API in cocos2d-x. Also change ScriptEngine callbacks for targetted Touches --- .../CCLayer.cpp | 108 +++++++++++++++--- .../layers_scenes_transitions_nodes/CCLayer.h | 21 +++- 2 files changed, 110 insertions(+), 19 deletions(-) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index ac2966fecb..b41df21c3f 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -50,6 +50,8 @@ CCLayer::CCLayer() { setAnchorPoint(ccp(0.5f, 0.5f)); m_bIgnoreAnchorPointForPosition = true; + m_bTouchMode = kCCTouchesAllAtOnce; + m_bTouchPriority = 0; } CCLayer::~CCLayer() @@ -61,7 +63,7 @@ bool CCLayer::init() { bool bRet = false; do - { + { CCDirector * pDirector; CC_BREAK_IF(!(pDirector = CCDirector::sharedDirector())); this->setContentSize(pDirector->getWinSize()); @@ -99,24 +101,36 @@ void CCLayer::registerWithTouchDispatcher() { CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher(); - if (m_pScriptHandlerEntry) - { - if (m_pScriptHandlerEntry->isMultiTouches()) - { - pDispatcher->addStandardDelegate(this, 0); - LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); - } - else - { - pDispatcher->addTargetedDelegate(this, - m_pScriptHandlerEntry->getPriority(), - m_pScriptHandlerEntry->getSwallowsTouches()); - LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); - } - return; - } + if (m_pScriptHandlerEntry) + { + CCScriptEngineProtocol* pEngine = CCScriptEngineManager::sharedManager()->getScriptEngine(); + if(pEngine->getScriptType() == kScriptTypeJavascript) { - pDispatcher->addStandardDelegate(this, 0); + if( m_bTouchMode == kCCTouchesAllAtOnce ) { + pDispatcher->addStandardDelegate(this, 0); + } else { + pDispatcher->addTargetedDelegate(this, m_bTouchPriority, true); + } + return; + + } else { + if (m_pScriptHandlerEntry->isMultiTouches()) + { + pDispatcher->addStandardDelegate(this, 0); + LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); + } + else + { + pDispatcher->addTargetedDelegate(this, + m_pScriptHandlerEntry->getPriority(), + m_pScriptHandlerEntry->getSwallowsTouches()); + LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); + } + return; + } + } + + pDispatcher->addStandardDelegate(this, 0); } void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches) @@ -167,6 +181,40 @@ void CCLayer::setTouchEnabled(bool enabled) } } + +void CCLayer::setTouchMode(ccTouchesMode mode) { + if(m_bTouchMode != mode) { + m_bTouchMode = mode; + + if( m_bIsTouchEnabled) { + setTouchEnabled(false); + setTouchEnabled(true); + } + } +} + +void CCLayer::setTouchPriority(int priority) { + if(m_bTouchPriority != priority) { + m_bTouchPriority = priority; + + if( m_bIsTouchEnabled) { + setTouchEnabled(false); + setTouchEnabled(true); + } + } +} + +int CCLayer::getTouchPriority() { + return m_bTouchPriority; +} + +int CCLayer::getTouchMode() { + return m_bTouchMode; +} + + + + /// isAccelerometerEnabled getter bool CCLayer::isAccelerometerEnabled() { @@ -194,6 +242,30 @@ void CCLayer::setAccelerometerEnabled(bool enabled) } } + +void CCLayer::setAccelerometerInterval(double interval) { + if (m_bIsAccelerometerEnabled) + { + if (m_bIsRunning) + { + CCDirector* pDirector = CCDirector::sharedDirector(); +// pDirector->getAccelerometer()->setAccelerometerInterval(interval); + } + } +} + + +void CCLayer::didAccelerate(CCAcceleration* pAccelerationValue) { + CC_UNUSED_PARAM(pAccelerationValue); +// +// if ( m_eScriptType != kScriptTypeNone) +// { +// CCScriptEngineManager::sharedManager()->getScriptEngine()->executeAccelerometerEvent(this, pAccelerationValue); +// } + +} + + /// isKeypadEnabled getter bool CCLayer::isKeypadEnabled() { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index ecff165334..7c3caf0d96 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -36,6 +36,12 @@ THE SOFTWARE. NS_CC_BEGIN +typedef enum { + kCCTouchesAllAtOnce, + kCCTouchesOneByOne, +} ccTouchesMode; + + /** * @addtogroup layer * @{ @@ -80,7 +86,7 @@ public: virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent); virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent); - virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);} + virtual void didAccelerate(CCAcceleration* pAccelerationValue); /** If isTouchEnabled, this method is called onEnter. Override it to change the way CCLayer receives touch events. @@ -106,12 +112,21 @@ public: */ bool isTouchEnabled(); void setTouchEnabled(bool value); + + void setTouchMode(ccTouchesMode mode); + void setTouchPriority(int priority); + int getTouchPriority(); + int getTouchMode(); + + /** whether or not it will receive Accelerometer events You can enable / disable accelerometer events with this property. @since v0.8.1 */ bool isAccelerometerEnabled(); void setAccelerometerEnabled(bool value); + void setAccelerometerInterval(double interval); + /** whether or not it will receive keypad events You can enable / disable accelerometer events with this property. it's new in cocos2d-x @@ -128,6 +143,10 @@ protected: private: // Script touch events handler CCTouchScriptHandlerEntry* m_pScriptHandlerEntry; + + int m_bTouchPriority; + ccTouchesMode m_bTouchMode; + int excuteScriptTouchHandler(int nEventType, CCTouch *pTouch); int excuteScriptTouchHandler(int nEventType, CCSet *pTouches); }; From 7ede1373f7ceb8a3dde0e65809054c5343a3bf53 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 14:51:35 -0700 Subject: [PATCH 31/95] Adding function to cleanup actions and schedule to ScriptingCore --- scripting/javascript/bindings/ScriptingCore.cpp | 15 ++++++++++++++- scripting/javascript/bindings/ScriptingCore.h | 8 +++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index ca06e56149..7b701c8f32 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -620,6 +620,16 @@ void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { } } +void ScriptingCore::cleanupSchedulesAndActions(CCNode *node) { + + CCArray * arr = JSSchedule::getTargetForNativeNode(node); + if(! arr) return; + for(unsigned int i = 0; i < arr->count(); ++i) { + if(arr->objectAtIndex(i)) { + arr->removeObjectAtIndex(i); + } + } +} int ScriptingCore::executeNodeEvent(CCNode* pNode, int nAction) { @@ -651,6 +661,9 @@ int ScriptingCore::executeNodeEvent(CCNode* pNode, int nAction) { executeJSFunctionWithName(this->cx_, p->obj, "onExitTransitionDidStart", dataVal, retval); } + else if(nAction == kCCNodeOnCleanup) { + cleanupSchedulesAndActions(pNode); + } return 1; } @@ -1100,7 +1113,7 @@ jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v) { return JSVAL_NULL; } -jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v) { +jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v) { JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL); if (!tmp) return JSVAL_NULL; JSBool ok = JS_DefineProperty(cx, tmp, "r", INT_TO_JSVAL(v.r), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) && diff --git a/scripting/javascript/bindings/ScriptingCore.h b/scripting/javascript/bindings/ScriptingCore.h index dddd6a0482..825a585189 100644 --- a/scripting/javascript/bindings/ScriptingCore.h +++ b/scripting/javascript/bindings/ScriptingCore.h @@ -59,7 +59,8 @@ public: virtual int executeString(const char* codes) { return 0; } void pauseSchedulesAndActions(CCNode *node); void resumeSchedulesAndActions(CCNode *node); - + void cleanupSchedulesAndActions(CCNode *node); + /** @brief Execute a script file. @param filename String object holding the filename of the script file that is to be executed @@ -197,10 +198,7 @@ jsval ccsize_to_jsval(JSContext* cx, CCSize& v); jsval ccgridsize_to_jsval(JSContext* cx, ccGridSize& v); jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v); jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v); -jsval cccolor3b_to_jsval(JSContext* cx, ccColor3B& v); - -JSObject* NewGlobalObject(JSContext* cx); -JSBool jsNewGlobal(JSContext* cx, unsigned argc, jsval* vp); +jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v); JSBool jsSocketOpen(JSContext* cx, unsigned argc, jsval* vp); JSBool jsSocketRead(JSContext* cx, unsigned argc, jsval* vp); From c24acd47330c4f2e71060b1b02be34b58613b865 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 11:02:54 -0700 Subject: [PATCH 32/95] Changing ScriptingCore flow of execution of targetted Touch events --- .../javascript/bindings/ScriptingCore.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 7b701c8f32..05c596fba6 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -742,7 +742,23 @@ int ScriptingCore::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSe int ScriptingCore::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch) { - return 0; + std::string funcName = ""; + getTouchFuncName(eventType, funcName); + + JSObject *jsretArr = JS_NewArrayObject(this->cx, 0, NULL); + + JS_AddNamedObjectRoot(this->cx, &jsretArr, "touchObject"); + int count = 0; + jsval jsret; + getJSTouchObject(this->cx, pTouch, jsret); + JSObject *jsObj = JSVAL_TO_OBJECT(jsret); + executeFunctionWithObjectData(pLayer, funcName.c_str(), jsObj); + + JS_RemoveObjectRoot(this->cx, &jsObj); + + removeJSTouchObject(this->cx, pTouch, jsret); + + return 1; } int ScriptingCore::executeFunctionWithObjectData(CCNode *self, const char *name, JSObject *obj) { From f8fc7328d7e3f9b1952263b3c56a4d074af5ed39 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 11:03:57 -0700 Subject: [PATCH 33/95] Fixing bug in bindings for MenuItemImage --- scripting/javascript/bindings/cocos2d_specifics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index a37ad1aff7..ca2a6cf33c 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -273,9 +273,13 @@ JSBool js_cocos2dx_CCMenuItemImage_create(JSContext *cx, uint32_t argc, jsval *v last = 3; } cocos2d::CCMenuItemImage* ret = cocos2d::CCMenuItemImage::create(arg0, arg1, arg2); - jsval thisObj = argv[last++]; - jsval callback = argv[last]; - JSObject *obj = bind_menu_item(cx, ret, callback, thisObj); + jsval thisObj = JSVAL_VOID; + jsval callback = JSVAL_VOID; + if(argc > 3) { + thisObj = argv[last++]; + callback = argv[last]; + } + JSObject *obj = bind_menu_item(cx, ret, callback, thisObj); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return JS_TRUE; } From a409fc0164503b03f82c9d4b6f7294acf68bc5b0 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 11:07:23 -0700 Subject: [PATCH 34/95] Fixing CallFunc bindings to support easier cleanup --- .../javascript/bindings/cocos2d_specifics.cpp | 55 +++++++++++++++++-- .../javascript/bindings/cocos2d_specifics.hpp | 55 ++++++++++++------- 2 files changed, 85 insertions(+), 25 deletions(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index ca2a6cf33c..d603f70916 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -4,6 +4,7 @@ schedFunc_proxy_t *_schedFunc_target_ht = NULL; schedTarget_proxy_t *_schedTarget_native_ht = NULL; +callfuncTarget_proxy_t *_callfuncTarget_native_ht = NULL; void JSTouchDelegate::setJSObject(JSObject *obj) { _mObj = obj; @@ -372,6 +373,7 @@ JSBool js_cocos2dx_CCMenuItemToggle_create(JSContext *cx, uint32_t argc, jsval * return JS_FALSE; } +template JSBool js_cocos2dx_setCallback(JSContext *cx, uint32_t argc, jsval *vp) { if(argc == 2) { @@ -379,7 +381,7 @@ JSBool js_cocos2dx_setCallback(JSContext *cx, uint32_t argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); - cocos2d::CCMenuItem* item = (cocos2d::CCMenuItem*)(proxy ? proxy->ptr : NULL); + T* item = (T*)(proxy ? proxy->ptr : NULL); TEST_NATIVE_OBJECT(cx, item) bind_menu_item(cx, item, argv[1], argv[0]); return JS_TRUE; @@ -387,6 +389,10 @@ JSBool js_cocos2dx_setCallback(JSContext *cx, uint32_t argc, jsval *vp) { return JS_FALSE; } +JSBool js_cocos2dx_CCMenuItem_setCallback(JSContext *cx, uint32_t argc, jsval *vp) { + return js_cocos2dx_setCallback(cx, argc, vp); +} + JSBool js_cocos2dx_CCAnimation_create(JSContext *cx, uint32_t argc, jsval *vp) { @@ -396,7 +402,7 @@ JSBool js_cocos2dx_CCAnimation_create(JSContext *cx, uint32_t argc, jsval *vp) if (argc > 0) { arg0 = jsval_to_ccarray(cx, argv[0]); } - cocos2d::CCAnimation* ret = NULL; + cocos2d::CCAnimation* ret; double arg1 = 0.0f; if (argc > 0 && argc == 2) { if (argc == 2) { @@ -551,14 +557,48 @@ void JSCallFunc::setExtraDataField(jsval data) { *extraData = data; } +void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { + callfuncTarget_proxy_t *t; + HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); + + CCArray *arr; + if(!t) { + arr = new CCArray(); + } else { + arr = t->obj; + } + + arr->addObject(target); + + callfuncTarget_proxy_t *p = (callfuncTarget_proxy_t *)malloc(sizeof(callfuncTarget_proxy_t)); + assert(p); + p->ptr = (void *)pNode; + p->obj = arr; + HASH_ADD_PTR(_callfuncTarget_native_ht, ptr, p); +} + +CCArray * JSCallFunc::getTargetForNativeNode(CCNode *pNode) { + + schedTarget_proxy_t *t; + HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); + if(!t) { + return NULL; + } + return t->obj; + +} + + + JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) { if (argc >= 1) { jsval *argv = JS_ARGV(cx, vp); - JSCallFunc *tmpCobj = new JSCallFunc(); - + JSCallFunc *tmpCobj = new JSCallFunc(); + tmpCobj->autorelease(); + tmpCobj->setJSCallbackThis(argv[0]); if(argc >= 2) { tmpCobj->setJSCallbackFunc(argv[1]); @@ -571,6 +611,10 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(proxy->obj)); + + JS_SetReservedSlot(proxy->obj, 0, argv[0]); + JS_SetReservedSlot(proxy->obj, 1, argv[1]); + // test->execute(); } return JS_TRUE; @@ -1481,7 +1525,8 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, js_cocos2dx_CCAnimation_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCSpriteFrame_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCSpriteFrame_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineFunction(cx, js_cocos2dx_CCMenuItem_prototype, "setCallback", js_cocos2dx_setCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, js_cocos2dx_CCMenuItem_prototype, "setCallback", js_cocos2dx_CCMenuItem_setCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT); + tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, global, "(function () { return cc.Node.prototype; })()")); JS_DefineFunction(cx, tmpObj, "copy", js_cocos2dx_CCNode_copy, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, tmpObj, "schedule", js_CCNode_schedule, 1, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index bd02d040d8..b0f1d1799b 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -4,6 +4,31 @@ #include "jsapi.h" #include "ScriptingCore.h" +class JSSchedule; + +typedef struct jsScheduleFunc_proxy { + void * ptr; + JSSchedule *obj; + UT_hash_handle hh; +} schedFunc_proxy_t; + +typedef struct jsScheduleTarget_proxy { + void * ptr; + CCArray *obj; + UT_hash_handle hh; +} schedTarget_proxy_t; + + +typedef struct jsCallFuncTarget_proxy { + void * ptr; + CCArray *obj; + UT_hash_handle hh; +} callfuncTarget_proxy_t; + +extern schedFunc_proxy_t *_schedFunc_target_ht; +extern schedTarget_proxy_t *_schedTarget_native_ht; + +extern callfuncTarget_proxy_t *_callfuncTarget_native_ht; /** * You don't need to manage the returned pointer. They live for the whole life of @@ -58,12 +83,17 @@ class JSCallFunc: public CCObject { public: JSCallFunc(jsval func): jsCallback(func) {} JSCallFunc() { extraData = NULL; } - ~JSCallFunc(){} + virtual ~JSCallFunc() { + return; + } + void setJSCallbackFunc(jsval obj); void setJSCallbackThis(jsval thisObj); void setExtraDataField(jsval data); static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data); - + static void setTargetForNativeNode(CCNode *pNode, JSCallFunc *target); + static CCArray * getTargetForNativeNode(CCNode *pNode); + void callbackFunc(CCNode *node) const { jsval valArr[2]; @@ -91,30 +121,15 @@ private: jsval *extraData; }; -class JSSchedule; - -typedef struct jsScheduleFunc_proxy { - void * ptr; - JSSchedule *obj; - UT_hash_handle hh; -} schedFunc_proxy_t; - -typedef struct jsScheduleTarget_proxy { - void * ptr; - CCArray *obj; - UT_hash_handle hh; -} schedTarget_proxy_t; - - -extern schedFunc_proxy_t *_schedFunc_target_ht; -extern schedTarget_proxy_t *_schedTarget_native_ht; class JSSchedule: public CCObject { public: JSSchedule(jsval func): jsSchedule(func) {} JSSchedule() {} - ~JSSchedule(){} + virtual ~JSSchedule() { + return; + } static void setTargetForSchedule(jsval sched, JSSchedule *target); static JSSchedule * getTargetForSchedule(jsval sched); From ecee64d07c2679e87bd4351831cb8211362de663 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 11:12:56 -0700 Subject: [PATCH 35/95] Adding accelerometer setInterval support to iOS --- cocos2dx/platform/ios/AccelerometerDelegateWrapper.h | 1 + cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm | 5 +++++ cocos2dx/platform/ios/CCAccelerometer.h | 1 + cocos2dx/platform/ios/CCAccelerometer.mm | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h index 36e704e8b6..fc0c18bd29 100644 --- a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h +++ b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.h @@ -38,5 +38,6 @@ + (id) sharedAccelerometerDispather; - (id) init; - (void) addDelegate: (cocos2d::CCAccelerometerDelegate *) delegate; +- (void) setAccelerometerInterval:(float)interval; @end diff --git a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm index c6153b1fe3..f219e4cdb6 100644 --- a/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm +++ b/cocos2dx/platform/ios/AccelerometerDelegateWrapper.mm @@ -68,6 +68,11 @@ static AccelerometerDispatcher* s_pAccelerometerDispatcher; } } +-(void) setAccelerometerInterval:(float)interval +{ + [[UIAccelerometer sharedAccelerometer] setUpdateInterval:interval]; +} + - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { if (! delegate_) diff --git a/cocos2dx/platform/ios/CCAccelerometer.h b/cocos2dx/platform/ios/CCAccelerometer.h index 051a954b4e..c5274fb7cb 100644 --- a/cocos2dx/platform/ios/CCAccelerometer.h +++ b/cocos2dx/platform/ios/CCAccelerometer.h @@ -36,6 +36,7 @@ public: ~CCAccelerometer(); void setDelegate(CCAccelerometerDelegate* pDelegate); + void setAccelerometerInterval(float interval); }; NS_CC_END diff --git a/cocos2dx/platform/ios/CCAccelerometer.mm b/cocos2dx/platform/ios/CCAccelerometer.mm index 54de66445e..8ffaa4f2c4 100644 --- a/cocos2dx/platform/ios/CCAccelerometer.mm +++ b/cocos2dx/platform/ios/CCAccelerometer.mm @@ -40,5 +40,10 @@ void CCAccelerometer::setDelegate(CCAccelerometerDelegate* pDelegate) [[AccelerometerDispatcher sharedAccelerometerDispather] addDelegate:pDelegate]; } +void CCAccelerometer::setAccelerometerInterval(float interval) +{ + [[AccelerometerDispatcher sharedAccelerometerDispather] setAccelerometerInterval:interval]; +} + NS_CC_END From d6753f8a2f988eb9cce2a0a5c3ecb35aee285867 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Fri, 26 Oct 2012 16:21:49 -0700 Subject: [PATCH 36/95] Adding accelerometer setInterval support to Android --- cocos2dx/platform/android/CCAccelerometer.cpp | 6 ++++++ cocos2dx/platform/android/CCAccelerometer.h | 1 + .../src/org/cocos2dx/lib/Cocos2dxAccelerometer.java | 11 +++++++++++ .../java/src/org/cocos2dx/lib/Cocos2dxHelper.java | 5 +++++ .../jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp | 9 +++++++++ .../jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h | 1 + 6 files changed, 33 insertions(+) diff --git a/cocos2dx/platform/android/CCAccelerometer.cpp b/cocos2dx/platform/android/CCAccelerometer.cpp index 23aa11bd8e..758fa885a6 100644 --- a/cocos2dx/platform/android/CCAccelerometer.cpp +++ b/cocos2dx/platform/android/CCAccelerometer.cpp @@ -55,6 +55,12 @@ namespace cocos2d } } + void CCAccelerometer::setAccelerometerInterval(float interval) + { + setAccelerometerIntervalJNI(interval); + } + + void CCAccelerometer::update(float x, float y, float z, long sensorTimeStamp) { if (m_pAccelDelegate) diff --git a/cocos2dx/platform/android/CCAccelerometer.h b/cocos2dx/platform/android/CCAccelerometer.h index 542c8a375f..0ece35a151 100644 --- a/cocos2dx/platform/android/CCAccelerometer.h +++ b/cocos2dx/platform/android/CCAccelerometer.h @@ -37,6 +37,7 @@ public: ~CCAccelerometer(); void setDelegate(CCAccelerometerDelegate* pDelegate); + void setAccelerometerInterval(float interval); void update(float x, float y, float z, long sensorTimeStamp); private: diff --git a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java index 668675965a..fe2f676ce4 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAccelerometer.java @@ -33,6 +33,7 @@ import android.util.Log; import android.view.Display; import android.view.Surface; import android.view.WindowManager; +import android.os.Build.*; public class Cocos2dxAccelerometer implements SensorEventListener { // =========================================================== @@ -72,6 +73,16 @@ public class Cocos2dxAccelerometer implements SensorEventListener { this.mSensorManager.registerListener(this, this.mAccelerometer, SensorManager.SENSOR_DELAY_GAME); } + public void setInterval(float interval) { + // Honeycomb version is 11 + if(android.os.Build.VERSION.SDK_INT < 11) { + this.mSensorManager.registerListener(this, this.mAccelerometer, SensorManager.SENSOR_DELAY_GAME); + } else { + //convert seconds to microseconds + this.mSensorManager.registerListener(this, this.mAccelerometer, (int)(interval*100000)); + } + } + public void disable() { this.mSensorManager.unregisterListener(this); } 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 b3cd8dbf82..5b6c35aa9d 100644 --- a/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -109,6 +109,11 @@ public class Cocos2dxHelper { Cocos2dxHelper.sCocos2dxAccelerometer.enable(); } + + public static void setAccelerometerInterval(float interval) { + Cocos2dxHelper.sCocos2dxAccelerometer.setInterval(interval); + } + public static void disableAccelerometer() { Cocos2dxHelper.sAccelerometerEnabled = false; Cocos2dxHelper.sCocos2dxAccelerometer.disable(); 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 2e2216fe87..d7c1043a07 100644 --- a/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -156,6 +156,15 @@ extern "C" { } } + void setAccelerometerIntervalJNI(float interval) { + JniMethodInfo t; + + if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setAccelerometerInterval", "(I)V")) { + t.env->CallStaticVoidMethod(t.classID, t.methodID, interval); + t.env->DeleteLocalRef(t.classID); + } + } + void disableAccelerometerJNI() { JniMethodInfo t; diff --git a/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h b/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h index 722e8a18ef..aa6effd70b 100644 --- a/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h +++ b/cocos2dx/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h @@ -37,6 +37,7 @@ extern "C" { extern const char * getPackageNameJNI(); extern void enableAccelerometerJNI(); extern void disableAccelerometerJNI(); + extern void setAccelerometerIntervalJNI(float interval); } #endif From 1ede7b6434a05cc2912ffa07e2a820509ea966d9 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 15:10:13 +0800 Subject: [PATCH 37/95] Modifying action/schedules cleanup, ignoring libjs_static.a of debugging version. --- .../javascript/bindings/ScriptingCore.cpp | 24 ++++++++----------- scripting/javascript/bindings/ScriptingCore.h | 3 +++ .../javascript/bindings/cocos2d_specifics.hpp | 1 + 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 05c596fba6..2845b54a95 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -621,13 +621,15 @@ void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { } void ScriptingCore::cleanupSchedulesAndActions(CCNode *node) { + + CCArray * arr = JSCallFunc::getTargetForNativeNode(node); + if(arr) { + arr->removeAllObjects(); + } - CCArray * arr = JSSchedule::getTargetForNativeNode(node); - if(! arr) return; - for(unsigned int i = 0; i < arr->count(); ++i) { - if(arr->objectAtIndex(i)) { - arr->removeObjectAtIndex(i); - } + arr = JSSchedule::getTargetForNativeNode(node); + if(arr) { + arr->removeAllObjects(); } } @@ -745,18 +747,12 @@ int ScriptingCore::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouc std::string funcName = ""; getTouchFuncName(eventType, funcName); - JSObject *jsretArr = JS_NewArrayObject(this->cx, 0, NULL); - - JS_AddNamedObjectRoot(this->cx, &jsretArr, "touchObject"); - int count = 0; jsval jsret; - getJSTouchObject(this->cx, pTouch, jsret); + getJSTouchObject(this->getGlobalContext(), pTouch, jsret); JSObject *jsObj = JSVAL_TO_OBJECT(jsret); executeFunctionWithObjectData(pLayer, funcName.c_str(), jsObj); - JS_RemoveObjectRoot(this->cx, &jsObj); - - removeJSTouchObject(this->cx, pTouch, jsret); + removeJSTouchObject(this->getGlobalContext(), pTouch, jsret); return 1; } diff --git a/scripting/javascript/bindings/ScriptingCore.h b/scripting/javascript/bindings/ScriptingCore.h index 825a585189..9f8b4068de 100644 --- a/scripting/javascript/bindings/ScriptingCore.h +++ b/scripting/javascript/bindings/ScriptingCore.h @@ -200,6 +200,9 @@ jsval cccolor4b_to_jsval(JSContext* cx, ccColor4B& v); jsval cccolor4f_to_jsval(JSContext* cx, ccColor4F& v); jsval cccolor3b_to_jsval(JSContext* cx, const ccColor3B& v); +JSObject* NewGlobalObject(JSContext* cx); +JSBool jsNewGlobal(JSContext* cx, unsigned argc, jsval* vp); + JSBool jsSocketOpen(JSContext* cx, unsigned argc, jsval* vp); JSBool jsSocketRead(JSContext* cx, unsigned argc, jsval* vp); JSBool jsSocketWrite(JSContext* cx, unsigned argc, jsval* vp); diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index b0f1d1799b..9f6b82f6fb 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -113,6 +113,7 @@ public: if(jsCallback != JSVAL_VOID || jsThisObj != JSVAL_VOID) { JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 1, valArr, &retval); } + JSCallFunc::setTargetForNativeNode(node, (JSCallFunc *)this); } private: From 094d52664d7d2a7b5dd5f89b01a0da679b5f4bf0 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Tue, 23 Oct 2012 16:45:40 -0700 Subject: [PATCH 38/95] Fixing bug in CCNode::copy bindings. Fixes MoonWarriors crash --- scripting/javascript/bindings/cocos2d_specifics.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index d603f70916..b6a6406b3a 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -509,6 +509,7 @@ JSBool js_cocos2dx_CCNode_copy(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::CCObject *ret = node->copy(); if (ret && jsret) { JS_NEW_PROXY(proxy, ret, jsret); + JS_AddNamedObjectRoot(cx, &proxy->obj, typeid(*ret).name()); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsret)); return JS_TRUE; } From 5760ea305c1bf24967bb93a0a53e7a188aa6cb65 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 24 Oct 2012 14:05:29 -0700 Subject: [PATCH 39/95] Fixing CallFuncN bindings to properly pass optional third parameter --- samples/MoonWarriors/Resources/js/Bullet.js | 6 +- .../javascript/bindings/cocos2d_specifics.cpp | 95 +++++++++---------- .../javascript/bindings/cocos2d_specifics.hpp | 11 +-- 3 files changed, 57 insertions(+), 55 deletions(-) diff --git a/samples/MoonWarriors/Resources/js/Bullet.js b/samples/MoonWarriors/Resources/js/Bullet.js index d22c3b015a..81199494bd 100644 --- a/samples/MoonWarriors/Resources/js/Bullet.js +++ b/samples/MoonWarriors/Resources/js/Bullet.js @@ -48,7 +48,11 @@ var Bullet = cc.Sprite.extend({ cc.ArrayRemoveObject(MW.CONTAINER.ENEMY_BULLETS,this); cc.ArrayRemoveObject(MW.CONTAINER.PLAYER_BULLETS,this); this.removeFromParentAndCleanup(true); - var removeExplode = cc.CallFunc.create(explode,explode.removeFromParentAndCleanup); + + var removeExplode = cc.CallFunc.create(explode, function(sender) { + explode.removeFromParentAndCleanup(true); + }); + explode.runAction(cc.ScaleBy.create(0.3, 2,2)); explode.runAction(cc.Sequence.create(cc.FadeOut.create(0.3), removeExplode)); }, diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index b6a6406b3a..f58c3dc9bb 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -554,8 +554,7 @@ void JSCallFunc::setJSCallbackThis(jsval thisObj) { } void JSCallFunc::setExtraDataField(jsval data) { - extraData = new jsval(); - *extraData = data; + extraData = data; } void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { @@ -1400,63 +1399,63 @@ extern JSObject* js_cocos2dx_CCCardinalSplineBy_prototype; extern JSObject* js_cocos2dx_CCBezierTo_prototype; extern JSObject* js_cocos2dx_CCBezierBy_prototype; -// setBlendFunc -template -JSBool js_cocos2dx_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - jsval *argv = JS_ARGV(cx, vp); - JSObject *obj; - T* cobj; - obj = JS_THIS_OBJECT(cx, vp); - js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); - cobj = (T*)(proxy ? proxy->ptr : NULL); - TEST_NATIVE_OBJECT(cx, cobj) +// setBlendFunc +template +JSBool js_cocos2dx_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + JSObject *obj; + T* cobj; + obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); + cobj = (T*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, cobj) if (argc == 2) - { - GLenum src, dst; - JS_ValueToInt32(cx, argv[0], (int32_t*)&src); + { + GLenum src, dst; + JS_ValueToInt32(cx, argv[0], (int32_t*)&src); JS_ValueToInt32(cx, argv[1], (int32_t*)&dst); ccBlendFunc blendFunc = {src, dst}; cobj->setBlendFunc(blendFunc); return JS_TRUE; - } - JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2); - return JS_FALSE; -} - -JSBool js_cocos2dx_CCSprite_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); -} - -JSBool js_cocos2dx_CCSpriteBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); -} - + } + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2); + return JS_FALSE; +} + +JSBool js_cocos2dx_CCSprite_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); +} + +JSBool js_cocos2dx_CCSpriteBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); +} + // JSBool js_cocos2dx_CCMotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) // { // return js_cocos2dx_setBlendFunc(cx, argc, vp); // } - -JSBool js_cocos2dx_CCAtlasNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); -} - -JSBool js_cocos2dx_CCParticleBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); -} - -JSBool js_cocos2dx_CCLayerColor_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); + +JSBool js_cocos2dx_CCAtlasNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); } -JSBool js_cocos2dx_CCParticleSystem_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) -{ - return js_cocos2dx_setBlendFunc(cx, argc, vp); +JSBool js_cocos2dx_CCParticleBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); +} + +JSBool js_cocos2dx_CCLayerColor_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); +} + +JSBool js_cocos2dx_CCParticleSystem_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp) +{ + return js_cocos2dx_setBlendFunc(cx, argc, vp); } void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index 9f6b82f6fb..fe01eb4a20 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -82,7 +82,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj); class JSCallFunc: public CCObject { public: JSCallFunc(jsval func): jsCallback(func) {} - JSCallFunc() { extraData = NULL; } + JSCallFunc() {} virtual ~JSCallFunc() { return; } @@ -102,16 +102,15 @@ public: js_proxy_t *proxy = js_get_or_create_proxy(cx, node); valArr[0] = OBJECT_TO_JSVAL(proxy->obj); - - if(extraData != NULL) { - valArr[1] = *extraData; + if(!JSVAL_IS_NULL(extraData)) { + valArr[1] = extraData; } else { valArr[1] = JSVAL_NULL; } jsval retval; if(jsCallback != JSVAL_VOID || jsThisObj != JSVAL_VOID) { - JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 1, valArr, &retval); + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 2, valArr, &retval); } JSCallFunc::setTargetForNativeNode(node, (JSCallFunc *)this); @@ -119,7 +118,7 @@ public: private: jsval jsCallback; jsval jsThisObj; - jsval *extraData; + jsval extraData; }; From 6773dc41549bfdc2ac7aee13ab2303e3b7a4059b Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Fri, 26 Oct 2012 15:31:52 -0700 Subject: [PATCH 40/95] Adding object roots for extra parameter of CallFunc and schedule --- .../javascript/bindings/cocos2d_specifics.cpp | 34 +++++++++++++++++++ .../javascript/bindings/cocos2d_specifics.hpp | 25 ++++++++++---- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index f58c3dc9bb..a06aa71f2a 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -614,6 +614,9 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) JS_SetReservedSlot(proxy->obj, 0, argv[0]); JS_SetReservedSlot(proxy->obj, 1, argv[1]); +// if(argc == 3) { +// JS_SetReservedSlot(proxy->obj, 2, argv[2]); +// } // test->execute(); } @@ -744,6 +747,9 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) } JS_SET_RVAL(cx, vp, JSVAL_VOID); + + JS_SetReservedSlot(proxy->obj, 0, argv[0]); + } return JS_TRUE; } @@ -762,6 +768,7 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) cocos2d::CCNode *node = (cocos2d::CCNode *)(proxy ? proxy->ptr : NULL); CCScheduler *sched = node->getScheduler(); + js_proxy_t *p = js_get_or_create_proxy(cx, sched); JSSchedule *tmpCobj = new JSSchedule(); @@ -806,6 +813,8 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) } + JS_SetReservedSlot(p->obj, 0, argv[0]); + JS_SET_RVAL(cx, vp, JSVAL_VOID); } return JS_TRUE; @@ -1134,6 +1143,30 @@ JSBool js_cocos2dx_ccpAdd(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } +JSBool js_cocos2dx_ccpClamp(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + + if (argc == 3) { + cocos2d::CCPoint arg0; + arg0 = jsval_to_ccpoint(cx, argv[0]); + cocos2d::CCPoint arg1; + arg1 = jsval_to_ccpoint(cx, argv[1]); + cocos2d::CCPoint arg2; + arg1 = jsval_to_ccpoint(cx, argv[2]); + + CCPoint ret = ccpClamp(arg0, arg1, arg2); + + jsval jsret = ccpoint_to_jsval(cx, ret); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); + return JS_FALSE; +} + + JSBool js_cocos2dx_ccpNeg(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); @@ -1574,6 +1607,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, ns, "pProject", js_cocos2dx_ccpProject, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pRotate", js_cocos2dx_ccpRotate, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pNormalize", js_cocos2dx_ccpNormalize, 0, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, ns, "pClamp", js_cocos2dx_ccpClamp, 2, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index fe01eb4a20..c8c6b8c13b 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -82,7 +82,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj); class JSCallFunc: public CCObject { public: JSCallFunc(jsval func): jsCallback(func) {} - JSCallFunc() {} + JSCallFunc() {extraData = JSVAL_VOID;} virtual ~JSCallFunc() { return; } @@ -100,19 +100,24 @@ public: JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); js_proxy_t *proxy = js_get_or_create_proxy(cx, node); - + + JS_AddValueRoot(cx, valArr); + valArr[0] = OBJECT_TO_JSVAL(proxy->obj); - if(!JSVAL_IS_NULL(extraData)) { + if(!JSVAL_IS_VOID(extraData)) { valArr[1] = extraData; } else { valArr[1] = JSVAL_NULL; } jsval retval; - if(jsCallback != JSVAL_VOID || jsThisObj != JSVAL_VOID) { + if(jsCallback != JSVAL_VOID && jsThisObj != JSVAL_VOID) { JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 2, valArr, &retval); } + JSCallFunc::setTargetForNativeNode(node, (JSCallFunc *)this); + + JS_RemoveValueRoot(cx, valArr); } private: @@ -126,7 +131,7 @@ class JSSchedule: public CCObject { public: JSSchedule(jsval func): jsSchedule(func) {} - JSSchedule() {} + JSSchedule() {jsSchedule = JSVAL_VOID; jsThisObj = JSVAL_VOID;} virtual ~JSSchedule() { return; } @@ -146,10 +151,18 @@ public: jsval retval = JSVAL_NULL, data = DOUBLE_TO_JSVAL(dt); JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); - if(jsSchedule != JSVAL_VOID || jsThisObj != JSVAL_VOID) { + JSBool ok = JS_AddValueRoot(cx, &data); + if(!ok) { + return; + } + + if(!JSVAL_IS_VOID(jsSchedule) && !JSVAL_IS_VOID(jsThisObj)) { + ScriptingCore::dumpRoot(cx, 0, NULL); JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsSchedule, 1, &data, &retval); } + JS_RemoveValueRoot(cx, &data); + } private: From 8f026d0b215cc41c3f622b26eaf87b52decfe0c4 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Fri, 26 Oct 2012 17:14:36 -0700 Subject: [PATCH 41/95] Fixing Javascript bindings Android makefile to include extensions --- scripting/javascript/bindings/Android.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripting/javascript/bindings/Android.mk b/scripting/javascript/bindings/Android.mk index 2e5b995758..a9222992ca 100644 --- a/scripting/javascript/bindings/Android.mk +++ b/scripting/javascript/bindings/Android.mk @@ -27,6 +27,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \ LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static +LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static LOCAL_LDLIBS := -landroid @@ -36,4 +37,5 @@ include $(BUILD_STATIC_LIBRARY) $(call import-module,scripting/javascript/spidermonkey-android) $(call import-module,cocos2dx) +$(call import-module,extensions) $(call import-module,external/chipmunk) From 2cfad104faac5c26dbe4232cb4fc3ed7a1659510 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 15:38:44 +0800 Subject: [PATCH 42/95] issue #1530: Corrected the logic of CClayer::registerWithTouchDispatcher function. --- .../CCLayer.cpp | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index b41df21c3f..cbe60c15e3 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -101,36 +101,30 @@ void CCLayer::registerWithTouchDispatcher() { CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher(); - if (m_pScriptHandlerEntry) - { - CCScriptEngineProtocol* pEngine = CCScriptEngineManager::sharedManager()->getScriptEngine(); - if(pEngine->getScriptType() == kScriptTypeJavascript) { - - if( m_bTouchMode == kCCTouchesAllAtOnce ) { - pDispatcher->addStandardDelegate(this, 0); - } else { - pDispatcher->addTargetedDelegate(this, m_bTouchPriority, true); - } - return; - - } else { - if (m_pScriptHandlerEntry->isMultiTouches()) - { + // Using LuaBindings + if (m_pScriptHandlerEntry) + { + if (m_pScriptHandlerEntry->isMultiTouches()) + { pDispatcher->addStandardDelegate(this, 0); LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); - } - else - { + } + else + { pDispatcher->addTargetedDelegate(this, m_pScriptHandlerEntry->getPriority(), m_pScriptHandlerEntry->getSwallowsTouches()); LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); - } - return; - } - } - - pDispatcher->addStandardDelegate(this, 0); + } + } + else + { + if( m_bTouchMode == kCCTouchesAllAtOnce ) { + pDispatcher->addStandardDelegate(this, 0); + } else { + pDispatcher->addTargetedDelegate(this, m_bTouchPriority, true); + } + } } void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches) From d97ce3e7e958b655856c9ad13a7f74786d5a36d7 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 15:41:39 +0800 Subject: [PATCH 43/95] issue #1530: Removed the dependence of Chipmunk for MoonWarriors project setting. --- samples/MoonWarriors/proj.win32/MoonWarriors.vcproj | 4 ++-- samples/MoonWarriors/proj.win32/MoonWarriors.vcxproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/MoonWarriors/proj.win32/MoonWarriors.vcproj b/samples/MoonWarriors/proj.win32/MoonWarriors.vcproj index 781dbf449b..8fa28bb72c 100644 --- a/samples/MoonWarriors/proj.win32/MoonWarriors.vcproj +++ b/samples/MoonWarriors/proj.win32/MoonWarriors.vcproj @@ -74,7 +74,7 @@ /> - libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies) + libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) true Windows @@ -129,7 +129,7 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O - libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies) + libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) Windows MachineX86 From d4b7c55ce668887ac2f79e8730078ce72a74f426 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 29 Oct 2012 16:06:06 +0800 Subject: [PATCH 44/95] issue #1530: Added resources of cocos2d-html5-tests for TestJavascript project of IOS port. --- .../TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id index ecb7e68073..27c00e26d5 100644 --- a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -e92a199a2b2e5cd26e5d1e1c1b2846f4ba4f978f \ No newline at end of file +50ef6ba405247a2cf5b6e3bfc310660b3b821881 \ No newline at end of file From 2a118a417235590ba24408f58ce2a4f34401301f Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 29 Oct 2012 16:47:09 +0800 Subject: [PATCH 45/95] fixed #1527:re-create MoonWarriors xcode project to fix the bug that it will not run on simulator sometimes --- .../MoonWarriors.xcodeproj/project.pbxproj | 562 ------------------ .../project.pbxproj.REMOVED.git-id | 1 + 2 files changed, 1 insertion(+), 562 deletions(-) delete mode 100644 samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj create mode 100644 samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj deleted file mode 100644 index efe0a52e68..0000000000 --- a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj +++ /dev/null @@ -1,562 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1A1D97421625AFB400D5E31D /* js in Resources */ = {isa = PBXBuildFile; fileRef = 1A1D97401625AFB400D5E31D /* js */; }; - 1A1D97431625AFB400D5E31D /* res in Resources */ = {isa = PBXBuildFile; fileRef = 1A1D97411625AFB400D5E31D /* res */; }; - 1A7CC34016257DF6006B3D18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */; }; - 1A7CC34216257DF6006B3D18 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34116257DF6006B3D18 /* OpenGLES.framework */; }; - 1A7CC34416257DF6006B3D18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34316257DF6006B3D18 /* OpenAL.framework */; }; - 1A7CC34616257DF6006B3D18 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */; }; - 1A7CC34816257DF6006B3D18 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34716257DF6006B3D18 /* AVFoundation.framework */; }; - 1A7CC34A16257DF6006B3D18 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34916257DF6006B3D18 /* UIKit.framework */; }; - 1A7CC34C16257DF6006B3D18 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34B16257DF6006B3D18 /* Foundation.framework */; }; - 1A7CC34E16257DF6006B3D18 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */; }; - 1A7CC72116258056006B3D18 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC71F16258056006B3D18 /* AppDelegate.cpp */; }; - 1A7CC72816258081006B3D18 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72416258081006B3D18 /* AppController.mm */; }; - 1A7CC72916258081006B3D18 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72516258081006B3D18 /* main.m */; }; - 1A7CC72A16258081006B3D18 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72716258081006B3D18 /* RootViewController.mm */; }; - 1A7CC75F16258252006B3D18 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC75D16258252006B3D18 /* Info.plist */; }; - 1A7CC76716258283006B3D18 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76016258283006B3D18 /* Default-568h@2x.png */; }; - 1A7CC76816258283006B3D18 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76116258283006B3D18 /* Default.png */; }; - 1A7CC76916258283006B3D18 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76216258283006B3D18 /* Default@2x.png */; }; - 1A7CC76A16258283006B3D18 /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76316258283006B3D18 /* Icon-57.png */; }; - 1A7CC76B16258283006B3D18 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76416258283006B3D18 /* Icon-72.png */; }; - 1A7CC76C16258283006B3D18 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76516258283006B3D18 /* Icon-114.png */; }; - 1A7CC76D16258283006B3D18 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76616258283006B3D18 /* Icon-144.png */; }; - 1A7CC77C16258754006B3D18 /* cocos2d_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */; }; - 1A7CC77D16258754006B3D18 /* cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77116258754006B3D18 /* cocos2dx.cpp */; }; - 1A7CC77E16258754006B3D18 /* cocos2dxapi.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77316258754006B3D18 /* cocos2dxapi.js */; }; - 1A7CC77F16258754006B3D18 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC77416258754006B3D18 /* README */; }; - 1A7CC78016258754006B3D18 /* js_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */; }; - 1A7CC78116258754006B3D18 /* ScriptingCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77816258754006B3D18 /* ScriptingCore.cpp */; }; - 1A7CC782162587E0006B3D18 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC71D16257E75006B3D18 /* libcocos2dx.a */; }; - 1A7CC79216258828006B3D18 /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78916258828006B3D18 /* CDAudioManager.m */; }; - 1A7CC79316258828006B3D18 /* CDOpenALSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */; }; - 1A7CC79416258828006B3D18 /* CocosDenshion.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78E16258828006B3D18 /* CocosDenshion.m */; }; - 1A7CC79516258828006B3D18 /* SimpleAudioEngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */; }; - 1A7CC79616258828006B3D18 /* SimpleAudioEngine_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 1A7CC71C16257E75006B3D18 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 1551A33F158F2AB200E66CFE; - remoteInfo = cocos2dx; - }; - 1A7CC730162580CE006B3D18 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 1551A33E158F2AB200E66CFE; - remoteInfo = cocos2dx; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 1A1D97401625AFB400D5E31D /* js */ = {isa = PBXFileReference; lastKnownFileType = folder; name = js; path = ../Resources/js; sourceTree = ""; }; - 1A1D97411625AFB400D5E31D /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = res; path = ../Resources/res; sourceTree = ""; }; - 1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoonWarriors.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 1A7CC34116257DF6006B3D18 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; - 1A7CC34316257DF6006B3D18 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; - 1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - 1A7CC34716257DF6006B3D18 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 1A7CC34916257DF6006B3D18 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 1A7CC34B16257DF6006B3D18 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = ""; }; - 1A7CC71F16258056006B3D18 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; - 1A7CC72016258056006B3D18 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 1A7CC72316258081006B3D18 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; - 1A7CC72416258081006B3D18 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; - 1A7CC72516258081006B3D18 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 1A7CC72616258081006B3D18 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 1A7CC72716258081006B3D18 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; - 1A7CC75D16258252006B3D18 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 1A7CC75E16258252006B3D18 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; - 1A7CC76016258283006B3D18 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 1A7CC76116258283006B3D18 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - 1A7CC76216258283006B3D18 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; - 1A7CC76316258283006B3D18 /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = ""; }; - 1A7CC76416258283006B3D18 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; - 1A7CC76516258283006B3D18 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = ""; }; - 1A7CC76616258283006B3D18 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = ""; }; - 1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = ""; }; - 1A7CC76F16258754006B3D18 /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = ""; }; - 1A7CC77116258754006B3D18 /* cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2dx.cpp; sourceTree = ""; }; - 1A7CC77216258754006B3D18 /* cocos2dx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2dx.hpp; sourceTree = ""; }; - 1A7CC77316258754006B3D18 /* cocos2dxapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cocos2dxapi.js; sourceTree = ""; }; - 1A7CC77416258754006B3D18 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; - 1A7CC77516258754006B3D18 /* js_bindings_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_config.h; sourceTree = ""; }; - 1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_manual_conversions.cpp; sourceTree = ""; }; - 1A7CC77716258754006B3D18 /* js_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_manual_conversions.h; sourceTree = ""; }; - 1A7CC77816258754006B3D18 /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = ""; }; - 1A7CC77916258754006B3D18 /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = ""; }; - 1A7CC77A16258754006B3D18 /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = ""; }; - 1A7CC77B16258754006B3D18 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = ""; }; - 1A7CC78516258828006B3D18 /* Export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = ""; }; - 1A7CC78616258828006B3D18 /* SimpleAudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine.h; sourceTree = ""; }; - 1A7CC78816258828006B3D18 /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = ""; }; - 1A7CC78916258828006B3D18 /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = ""; }; - 1A7CC78A16258828006B3D18 /* CDConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDConfig.h; sourceTree = ""; }; - 1A7CC78B16258828006B3D18 /* CDOpenALSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDOpenALSupport.h; sourceTree = ""; }; - 1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDOpenALSupport.m; sourceTree = ""; }; - 1A7CC78D16258828006B3D18 /* CocosDenshion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosDenshion.h; sourceTree = ""; }; - 1A7CC78E16258828006B3D18 /* CocosDenshion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocosDenshion.m; sourceTree = ""; }; - 1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleAudioEngine.mm; sourceTree = ""; }; - 1A7CC79016258828006B3D18 /* SimpleAudioEngine_objc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine_objc.h; sourceTree = ""; }; - 1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleAudioEngine_objc.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1A7CC33816257DF5006B3D18 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1A7CC782162587E0006B3D18 /* libcocos2dx.a in Frameworks */, - 1A7CC34016257DF6006B3D18 /* QuartzCore.framework in Frameworks */, - 1A7CC34216257DF6006B3D18 /* OpenGLES.framework in Frameworks */, - 1A7CC34416257DF6006B3D18 /* OpenAL.framework in Frameworks */, - 1A7CC34616257DF6006B3D18 /* AudioToolbox.framework in Frameworks */, - 1A7CC34816257DF6006B3D18 /* AVFoundation.framework in Frameworks */, - 1A7CC34A16257DF6006B3D18 /* UIKit.framework in Frameworks */, - 1A7CC34C16257DF6006B3D18 /* Foundation.framework in Frameworks */, - 1A7CC34E16257DF6006B3D18 /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1A7CC33016257DF5006B3D18 = { - isa = PBXGroup; - children = ( - 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */, - 1A7CC732162580F9006B3D18 /* bindings */, - 1A7CC71E16258056006B3D18 /* Classes */, - 1A7CC78316258819006B3D18 /* CocosDenshion */, - 1A7CC33E16257DF5006B3D18 /* Frameworks */, - 1A7CC7221625806F006B3D18 /* ios */, - 1A7CC33C16257DF5006B3D18 /* Products */, - 1A7CC72B162580AD006B3D18 /* Resources */, - ); - sourceTree = ""; - }; - 1A7CC33C16257DF5006B3D18 /* Products */ = { - isa = PBXGroup; - children = ( - 1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */, - ); - name = Products; - sourceTree = ""; - }; - 1A7CC33E16257DF5006B3D18 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */, - 1A7CC34116257DF6006B3D18 /* OpenGLES.framework */, - 1A7CC34316257DF6006B3D18 /* OpenAL.framework */, - 1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */, - 1A7CC34716257DF6006B3D18 /* AVFoundation.framework */, - 1A7CC34916257DF6006B3D18 /* UIKit.framework */, - 1A7CC34B16257DF6006B3D18 /* Foundation.framework */, - 1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 1A7CC71616257E74006B3D18 /* Products */ = { - isa = PBXGroup; - children = ( - 1A7CC71D16257E75006B3D18 /* libcocos2dx.a */, - ); - name = Products; - sourceTree = ""; - }; - 1A7CC71E16258056006B3D18 /* Classes */ = { - isa = PBXGroup; - children = ( - 1A7CC71F16258056006B3D18 /* AppDelegate.cpp */, - 1A7CC72016258056006B3D18 /* AppDelegate.h */, - ); - name = Classes; - path = ../Classes; - sourceTree = ""; - }; - 1A7CC7221625806F006B3D18 /* ios */ = { - isa = PBXGroup; - children = ( - 1A7CC75D16258252006B3D18 /* Info.plist */, - 1A7CC75E16258252006B3D18 /* Prefix.pch */, - 1A7CC72316258081006B3D18 /* AppController.h */, - 1A7CC72416258081006B3D18 /* AppController.mm */, - 1A7CC72516258081006B3D18 /* main.m */, - 1A7CC72616258081006B3D18 /* RootViewController.h */, - 1A7CC72716258081006B3D18 /* RootViewController.mm */, - ); - name = ios; - sourceTree = ""; - }; - 1A7CC72B162580AD006B3D18 /* Resources */ = { - isa = PBXGroup; - children = ( - 1A1D97401625AFB400D5E31D /* js */, - 1A1D97411625AFB400D5E31D /* res */, - 1A7CC76016258283006B3D18 /* Default-568h@2x.png */, - 1A7CC76116258283006B3D18 /* Default.png */, - 1A7CC76216258283006B3D18 /* Default@2x.png */, - 1A7CC76316258283006B3D18 /* Icon-57.png */, - 1A7CC76416258283006B3D18 /* Icon-72.png */, - 1A7CC76516258283006B3D18 /* Icon-114.png */, - 1A7CC76616258283006B3D18 /* Icon-144.png */, - ); - name = Resources; - sourceTree = ""; - }; - 1A7CC732162580F9006B3D18 /* bindings */ = { - isa = PBXGroup; - children = ( - 1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */, - 1A7CC76F16258754006B3D18 /* cocos2d_specifics.hpp */, - 1A7CC77016258754006B3D18 /* generated */, - 1A7CC77516258754006B3D18 /* js_bindings_config.h */, - 1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */, - 1A7CC77716258754006B3D18 /* js_manual_conversions.h */, - 1A7CC77816258754006B3D18 /* ScriptingCore.cpp */, - 1A7CC77916258754006B3D18 /* ScriptingCore.h */, - 1A7CC77A16258754006B3D18 /* spidermonkey_specifics.h */, - 1A7CC77B16258754006B3D18 /* uthash.h */, - ); - name = bindings; - path = ../../../scripting/javascript/bindings; - sourceTree = ""; - }; - 1A7CC77016258754006B3D18 /* generated */ = { - isa = PBXGroup; - children = ( - 1A7CC77116258754006B3D18 /* cocos2dx.cpp */, - 1A7CC77216258754006B3D18 /* cocos2dx.hpp */, - 1A7CC77316258754006B3D18 /* cocos2dxapi.js */, - 1A7CC77416258754006B3D18 /* README */, - ); - path = generated; - sourceTree = ""; - }; - 1A7CC78316258819006B3D18 /* CocosDenshion */ = { - isa = PBXGroup; - children = ( - 1A7CC78416258828006B3D18 /* include */, - 1A7CC78716258828006B3D18 /* ios */, - ); - name = CocosDenshion; - sourceTree = ""; - }; - 1A7CC78416258828006B3D18 /* include */ = { - isa = PBXGroup; - children = ( - 1A7CC78516258828006B3D18 /* Export.h */, - 1A7CC78616258828006B3D18 /* SimpleAudioEngine.h */, - ); - name = include; - path = ../../../CocosDenshion/include; - sourceTree = ""; - }; - 1A7CC78716258828006B3D18 /* ios */ = { - isa = PBXGroup; - children = ( - 1A7CC78816258828006B3D18 /* CDAudioManager.h */, - 1A7CC78916258828006B3D18 /* CDAudioManager.m */, - 1A7CC78A16258828006B3D18 /* CDConfig.h */, - 1A7CC78B16258828006B3D18 /* CDOpenALSupport.h */, - 1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */, - 1A7CC78D16258828006B3D18 /* CocosDenshion.h */, - 1A7CC78E16258828006B3D18 /* CocosDenshion.m */, - 1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */, - 1A7CC79016258828006B3D18 /* SimpleAudioEngine_objc.h */, - 1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */, - ); - name = ios; - path = ../../../CocosDenshion/ios; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1A7CC33A16257DF5006B3D18 /* MoonWarriors */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1A7CC70D16257E02006B3D18 /* Build configuration list for PBXNativeTarget "MoonWarriors" */; - buildPhases = ( - 1A7CC33716257DF5006B3D18 /* Sources */, - 1A7CC33816257DF5006B3D18 /* Frameworks */, - 1A7CC33916257DF5006B3D18 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 1A7CC731162580CE006B3D18 /* PBXTargetDependency */, - ); - name = MoonWarriors; - productName = MoonWarriors; - productReference = 1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 1A7CC33216257DF5006B3D18 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0450; - }; - buildConfigurationList = 1A7CC33516257DF5006B3D18 /* Build configuration list for PBXProject "MoonWarriors" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 1A7CC33016257DF5006B3D18; - productRefGroup = 1A7CC33C16257DF5006B3D18 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 1A7CC71616257E74006B3D18 /* Products */; - ProjectRef = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 1A7CC33A16257DF5006B3D18 /* MoonWarriors */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 1A7CC71D16257E75006B3D18 /* libcocos2dx.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcocos2dx.a; - remoteRef = 1A7CC71C16257E75006B3D18 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 1A7CC33916257DF5006B3D18 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1A7CC75F16258252006B3D18 /* Info.plist in Resources */, - 1A7CC76716258283006B3D18 /* Default-568h@2x.png in Resources */, - 1A7CC76816258283006B3D18 /* Default.png in Resources */, - 1A7CC76916258283006B3D18 /* Default@2x.png in Resources */, - 1A7CC76A16258283006B3D18 /* Icon-57.png in Resources */, - 1A7CC76B16258283006B3D18 /* Icon-72.png in Resources */, - 1A7CC76C16258283006B3D18 /* Icon-114.png in Resources */, - 1A7CC76D16258283006B3D18 /* Icon-144.png in Resources */, - 1A7CC77F16258754006B3D18 /* README in Resources */, - 1A1D97421625AFB400D5E31D /* js in Resources */, - 1A1D97431625AFB400D5E31D /* res in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1A7CC33716257DF5006B3D18 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1A7CC72116258056006B3D18 /* AppDelegate.cpp in Sources */, - 1A7CC72816258081006B3D18 /* AppController.mm in Sources */, - 1A7CC72916258081006B3D18 /* main.m in Sources */, - 1A7CC72A16258081006B3D18 /* RootViewController.mm in Sources */, - 1A7CC77C16258754006B3D18 /* cocos2d_specifics.cpp in Sources */, - 1A7CC77D16258754006B3D18 /* cocos2dx.cpp in Sources */, - 1A7CC77E16258754006B3D18 /* cocos2dxapi.js in Sources */, - 1A7CC78016258754006B3D18 /* js_manual_conversions.cpp in Sources */, - 1A7CC78116258754006B3D18 /* ScriptingCore.cpp in Sources */, - 1A7CC79216258828006B3D18 /* CDAudioManager.m in Sources */, - 1A7CC79316258828006B3D18 /* CDOpenALSupport.m in Sources */, - 1A7CC79416258828006B3D18 /* CocosDenshion.m in Sources */, - 1A7CC79516258828006B3D18 /* SimpleAudioEngine.mm in Sources */, - 1A7CC79616258828006B3D18 /* SimpleAudioEngine_objc.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 1A7CC731162580CE006B3D18 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = cocos2dx; - targetProxy = 1A7CC730162580CE006B3D18 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 1A7CC70B16257E02006B3D18 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - DEBUG, - "COCOS2D_DEBUG=1", - USE_FILE32API, - TARGET_OS_IPHONE, - COCOS2D_JAVASCRIPT, - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"", - "\"$(PROJECT_NAME)/libs/cocos2dx\"", - "\"$(PROJECT_NAME)/libs/CocosDenshion/include\"", - "\"$(SDKROOT)/usr/include/libxml2\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/include\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 1A7CC70C16257E02006B3D18 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - NDEBUG, - USE_FILE32API, - TARGET_OS_IPHONE, - COCOS2D_JAVASCRIPT, - ); - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"", - "\"$(PROJECT_NAME)/libs/cocos2dx\"", - "\"$(PROJECT_NAME)/libs/CocosDenshion/include\"", - "\"$(SDKROOT)/usr/include/libxml2\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/include\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"", - "\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - }; - name = Release; - }; - 1A7CC70E16257E02006B3D18 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_DYNAMIC_NO_PIC = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Prefix.pch; - "GCC_THUMB_SUPPORT[arch=armv6]" = ""; - HEADER_SEARCH_PATHS = ( - "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", - "\"$(SRCROOT)/../../../cocos2dx\"", - "\"$(SRCROOT)/../../../CocosDenshion/include\"", - "\"$(SDKROOT)/usr/include/libxml2\"", - "\"$(SRCROOT)/../../../cocos2dx/include\"", - "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"", - "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", - "$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include", - "$(SRCROOT)/../../../scripting/javascript/bindings", - ); - INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\""; - OTHER_LDFLAGS = ( - "-lxml2", - "-lz", - "-ljs_static", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ""; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 1A7CC70F16257E02006B3D18 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Prefix.pch; - "GCC_THUMB_SUPPORT[arch=armv6]" = ""; - HEADER_SEARCH_PATHS = ( - "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", - "\"$(SRCROOT)/../../../cocos2dx\"", - "\"$(SRCROOT)/../../../CocosDenshion/include\"", - "\"$(SDKROOT)/usr/include/libxml2\"", - "\"$(SRCROOT)/../../../cocos2dx/include\"", - "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"", - "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", - "$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include", - "$(SRCROOT)/../../../scripting/javascript/bindings", - ); - INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\""; - OTHER_LDFLAGS = ( - "-lxml2", - "-lz", - "-ljs_static", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = ""; - VALIDATE_PRODUCT = YES; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1A7CC33516257DF5006B3D18 /* Build configuration list for PBXProject "MoonWarriors" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1A7CC70B16257E02006B3D18 /* Debug */, - 1A7CC70C16257E02006B3D18 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1A7CC70D16257E02006B3D18 /* Build configuration list for PBXNativeTarget "MoonWarriors" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1A7CC70E16257E02006B3D18 /* Debug */, - 1A7CC70F16257E02006B3D18 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 1A7CC33216257DF5006B3D18 /* Project object */; -} diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id new file mode 100644 index 0000000000..15bdbb1a06 --- /dev/null +++ b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id @@ -0,0 +1 @@ +8addca1c941d4ff32067adadc47c25a031d4e67f \ No newline at end of file From 9a2a535fef3074bc501df3488b8785fe323f8ea4 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 29 Oct 2012 16:59:23 +0800 Subject: [PATCH 46/95] fixed #1527:add correct icon for xcode project --- .../MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id index 15bdbb1a06..c90f26d314 100644 --- a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -8addca1c941d4ff32067adadc47c25a031d4e67f \ No newline at end of file +c6b50195e59e13921f987fbaeefcc0dc152216c9 \ No newline at end of file From 7073481077a45a53d9ab9ff8cacc3b80edb4c029 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 29 Oct 2012 17:54:31 +0800 Subject: [PATCH 47/95] fixed #1527: modify some project setting --- .../MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id index c90f26d314..e4f1ecffb5 100644 --- a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -c6b50195e59e13921f987fbaeefcc0dc152216c9 \ No newline at end of file +a772a4adde649b9a9820bdd03d5bc32c3796e28e \ No newline at end of file From e3304e44bad5f97523cd3c5599342d453a78cc6e Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Mon, 29 Oct 2012 18:22:46 +0800 Subject: [PATCH 48/95] cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated bindings --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index e1a713cbaf..c39ca31caf 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit e1a713cbaf36b2de82b64ab148532b4c30fa2f20 +Subproject commit c39ca31caf1e312485c0b9637a66645b438ed83d From bf255f616257f783436456f4d14d3472e0a08ee2 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Mon, 29 Oct 2012 18:47:03 +0800 Subject: [PATCH 49/95] Updated jenkins script for auto-gen jsbinding codes. --- .../mac/android/generate-js-cxx-bindings.sh | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh b/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh index 80d97dc601..fa9767a070 100755 --- a/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh +++ b/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh @@ -28,12 +28,32 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" COCOS2DX_ROOT="$DIR"/../../../.. +GENERATED_WORKTREE="$COCOS2DX_ROOT"/scripting/javascript/bindings/generated if [ -z "${HUB+aaa}" ]; then # ... if HUB is not set, use "$HOME/bin/hub" HUB="$HOME/bin/hub" fi +# Update local repo +pushd "$COCOS2DX_ROOT" + +git checkout -f +git checkout gles20 +git pull upstream gles20 +rm -rf "$GENERATED_WORKTREE" +git submodule update --init + +popd + +pushd "$GENERATED_WORKTREE" + +git checkout -f +git checkout master +git pull origin master + +popd + # Exit on error set -e @@ -71,7 +91,7 @@ ELAPSEDSECS=`date +%s` echo Using "$ELAPSEDSECS" in the branch names for pseudo-uniqueness GENERATED_BRANCH=autogeneratedbindings_"$ELAPSEDSECS" -GENERATED_WORKTREE="$COCOS2DX_ROOT"/scripting/javascript/bindings/generated + # 2. In JSBindings repo, Check if there are any files that are different from the index @@ -107,7 +127,7 @@ fi set -e # 3. In JSBindings repo, Check out a branch named "autogeneratedbindings" and commit the auto generated bindings to it -git checkout origin/master -b "$GENERATED_BRANCH" +git checkout -b "$GENERATED_BRANCH" git add --verbose README cocos2dx.cpp cocos2dx.hpp cocos2dxapi.js git commit --verbose -m "$COMMITTAG : autogenerated bindings" @@ -137,7 +157,7 @@ pushd "${DIR}" # 5. In Cocos2D-X repo, Checkout a branch named "updategeneratedsubmodule" Update the submodule reference to point to the commit with generated bindings cd "${COCOS2DX_ROOT}" git add scripting/javascript/bindings/generated -git checkout origin/gles20 -b "$COCOS_BRANCH" +git checkout -b "$COCOS_BRANCH" git commit -m "$COMMITTAG : updating submodule reference to latest autogenerated bindings" # 6. In Cocos2D-X repo, Push the commit with updated submodule to "gles20" of the cocos2d-x repository From 9f6d263c159a5f4ffd4986c81ae77a675e3d646c Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 30 Oct 2012 10:24:28 +0800 Subject: [PATCH 50/95] fixed #1531: The CCSprite::updateTransform() function needs to inherited from a base function on the CCNode. --- cocos2dx/base_nodes/CCNode.cpp | 7 +++++++ cocos2dx/base_nodes/CCNode.h | 3 +++ cocos2dx/sprite_nodes/CCSprite.cpp | 15 ++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index b16f1411c8..b7eb000b7a 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -1124,5 +1124,12 @@ CCPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch) return this->convertToNodeSpaceAR(point); } +// MARMALADE ADDED +void CCNode::updateTransform() +{ + // Recursively iterate over children + arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCNode*); +} + NS_CC_END diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 1fcb35bc27..ccd6fa0824 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -441,6 +441,9 @@ public: virtual void visit(void); // transformations + // MARMALADE ADDED THIS... SO IT IS NO LONGER SPECIFIC TO CCSprite + /** updates the quad according the the rotation, position, scale values. */ + virtual void updateTransform(void); /** performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes. */ void transform(void); diff --git a/cocos2dx/sprite_nodes/CCSprite.cpp b/cocos2dx/sprite_nodes/CCSprite.cpp index f77e140102..f51c261a3d 100644 --- a/cocos2dx/sprite_nodes/CCSprite.cpp +++ b/cocos2dx/sprite_nodes/CCSprite.cpp @@ -546,11 +546,16 @@ void CCSprite::updateTransform(void) setDirty(false); } - // recursively iterate over children - if( m_bHasChildren ) - { - arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); - } + // MARMALADE CHANGED + // recursively iterate over children +/* if( m_bHasChildren ) + { + // MARMALADE: CHANGED TO USE CCNode* + // NOTE THAT WE HAVE ALSO DEFINED virtual CCNode::updateTransform() + arrayMakeObjectsPerformSelector(m_pChildren, updateTransform, CCSprite*); + }*/ + CCNode::updateTransform(); + #if CC_SPRITE_DEBUG_DRAW // draw bounding box CCPoint vertices[4] = { From 8ed7d63309d0ded7a2de91ae34930720ee59693b Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 30 Oct 2012 10:35:19 +0800 Subject: [PATCH 51/95] Updated LuaBindings codes since CCEGLViewProtocol::getSize has been renamed to CCEGLViewProtocol::getDesignResolutionSize. --- .../LuaCocos2d.cpp.REMOVED.git-id | 2 +- tools/tolua++/CCEGLViewProtocol.pkg | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index f4dc6b9364..af907be967 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -e4c5f54d0a54b4473017366d09c364ede1078c90 \ No newline at end of file +fb55025330e8a2805460df5913b0a398c9120ed2 \ No newline at end of file diff --git a/tools/tolua++/CCEGLViewProtocol.pkg b/tools/tolua++/CCEGLViewProtocol.pkg index 3b5232a661..8dd78d0007 100644 --- a/tools/tolua++/CCEGLViewProtocol.pkg +++ b/tools/tolua++/CCEGLViewProtocol.pkg @@ -16,12 +16,6 @@ enum ResolutionPolicy class CCEGLViewProtocol { - /** - * Get design resolution size. - * If setDesignResolutionSize wasn't invoked, the result of this function return is the same as 'getFrameSize' - */ - const CCSize& getSize() const; - /** * Get the frame size of EGL view. * In general, it returns the screen size since the EGL view is a fullscreen view. @@ -49,11 +43,16 @@ class CCEGLViewProtocol * @param width Design resolution width. * @param height Design resolution height. * @param resolutionPolicy The resolution policy you need, there are: - * [1] kCCResolutionExactFit Fill screen, if the design resolution ratio of width and height is different from the screen resolution ratio, your game view will be stretched. - * [2] kCCResolutionNoBorder Full screen without black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two areas of your game view will be cut. - * [3] kCCResolutionShowAll Full screen with black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two black border will be shown on the screen; + * [1] kResolutionExactFit Fill screen, if the design resolution ratio of width and height is different from the screen resolution ratio, your game view will be stretched. + * [2] kResolutionNoBorder Full screen without black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two areas of your game view will be cut. + * [3] kResolutionShowAll Full screen with black border, if the design resolution ratio of width and height is different from the screen resolution ratio, two black border will be shown on the screen; */ void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy); + + /** Get design resolution size. + * Default resolution size is the same as 'getFrameSize'. + */ + virtual const CCSize& getDesignResolutionSize() const; /** Set touch delegate */ void setTouchDelegate(EGLTouchDelegate * pDelegate); From fe8c1573f25ac0f6751e5edd8edbaa0a467ac64b Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 30 Oct 2012 11:38:24 +0800 Subject: [PATCH 52/95] set MoonWarriors to be portrait on iOS 5.1 --- samples/MoonWarriors/proj.ios/RootViewController.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/MoonWarriors/proj.ios/RootViewController.mm b/samples/MoonWarriors/proj.ios/RootViewController.mm index 7a0d59ccc9..dfe7608c8d 100644 --- a/samples/MoonWarriors/proj.ios/RootViewController.mm +++ b/samples/MoonWarriors/proj.ios/RootViewController.mm @@ -37,7 +37,7 @@ // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return UIInterfaceOrientationIsLandscape( interfaceOrientation ); + return UIInterfaceOrientationIsPortrait(interfaceOrientation); } // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead From 1538ad4e782f9bfcc8a3ddf249da5f628f3f78d0 Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 30 Oct 2012 17:54:48 +0800 Subject: [PATCH 53/95] Updated jenkins_scripts/mac/android/generate-js-cxx-bindings.sh. The local repo needs to be updated in Jenkins command before executing this script. So commented some codes. --- .../mac/android/generate-js-cxx-bindings.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh b/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh index fa9767a070..8a3383ef48 100755 --- a/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh +++ b/tools/jenkins_scripts/mac/android/generate-js-cxx-bindings.sh @@ -35,17 +35,19 @@ if [ -z "${HUB+aaa}" ]; then HUB="$HOME/bin/hub" fi -# Update local repo -pushd "$COCOS2DX_ROOT" +# Update cocos2d-x repo +# It needs to be updated in Jenkins command before executing this script. +#pushd "$COCOS2DX_ROOT" -git checkout -f -git checkout gles20 -git pull upstream gles20 -rm -rf "$GENERATED_WORKTREE" -git submodule update --init +#git checkout -f +#git checkout gles20 +#git pull upstream gles20 +#rm -rf "$GENERATED_WORKTREE" +#git submodule update --init -popd +#popd +# Update submodule of auto-gen JSBinding repo. pushd "$GENERATED_WORKTREE" git checkout -f From af12b8dfc2edc39dd09e68d77a61a0eb42c32a56 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 30 Oct 2012 18:20:47 +0800 Subject: [PATCH 54/95] revert CCSpriteBatchNode::removeSpriteFromAtlas() --- cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp index 3dd1d9b27b..3001eb271a 100644 --- a/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp +++ b/cocos2dx/sprite_nodes/CCSpriteBatchNode.cpp @@ -641,9 +641,9 @@ void CCSpriteBatchNode::removeSpriteFromAtlas(CCSprite *pobSprite) m_pobDescendants->removeObjectAtIndex(uIndex); // update all sprites beyond this one - unsigned int count = uIndex; // we will update items from the beginning to uIndex as m_pobDescendants is in ascending order - - for(uIndex = 0; uIndex < count; ++uIndex) + unsigned int count = m_pobDescendants->count(); + + for(; uIndex < count; ++uIndex) { CCSprite* s = (CCSprite*)(m_pobDescendants->objectAtIndex(uIndex)); s->setAtlasIndex( s->getAtlasIndex() - 1 ); From 5141c83fd1e2a4d17019c8dc8dd021c897139651 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 10:33:43 +0800 Subject: [PATCH 55/95] issue #1537: Upgraded spiderMonkey library to FF17.0b3 for android port. --- .../spidermonkey-android/include/gc/Barrier.h | 85 +++- .../spidermonkey-android/include/gc/Heap.h | 77 +++- .../spidermonkey-android/include/gc/Root.h | 84 +++- .../include/gc/Statistics.h | 20 +- .../include/gc/StoreBuffer.h | 398 ++++++++++++++++++ .../spidermonkey-android/include/js-config.h | 3 +- .../spidermonkey-android/include/js.msg | 16 +- .../include/js/HashTable.h | 15 +- .../include/js/MemoryMetrics.h | 2 + .../spidermonkey-android/include/js/Utility.h | 95 ++++- .../include/jsapi.h.REMOVED.git-id | 2 +- .../spidermonkey-android/include/jsatom.h | 80 +--- .../spidermonkey-android/include/jsatom.tbl | 6 +- .../spidermonkey-android/include/jsclass.h | 47 ++- .../spidermonkey-android/include/jsdbgapi.h | 6 - .../include/jsfriendapi.h | 315 +++++++++++--- .../spidermonkey-android/include/jsgc.h | 178 ++++++-- .../spidermonkey-android/include/jshash.h | 120 ------ .../spidermonkey-android/include/jslock.h | 8 +- .../spidermonkey-android/include/json.h | 7 +- .../spidermonkey-android/include/jsperf.h | 2 +- .../spidermonkey-android/include/jsproto.tbl | 1 + .../spidermonkey-android/include/jsproxy.h | 58 ++- .../spidermonkey-android/include/jsprvtd.h | 44 +- .../spidermonkey-android/include/jspubtd.h | 15 + .../spidermonkey-android/include/jstypes.h | 2 - .../spidermonkey-android/include/jsutil.h | 66 +-- .../spidermonkey-android/include/jsval.h | 1 + .../spidermonkey-android/include/jswrapper.h | 81 +--- .../include/mozilla/Attributes.h | 171 ++++++++ .../include/mozilla/Constants.h | 15 + .../include/mozilla/HashFunctions.h | 8 + .../include/mozilla/MathAlgorithms.h | 47 +++ .../include/mozilla/NullPtr.h | 46 ++ .../include/mozilla/SHA1.h | 46 ++ .../include/mozilla/WeakPtr.h | 139 ++++++ .../lib/libjs_static.a.REMOVED.git-id | 2 +- 37 files changed, 1765 insertions(+), 543 deletions(-) create mode 100644 scripting/javascript/spidermonkey-android/include/gc/StoreBuffer.h delete mode 100644 scripting/javascript/spidermonkey-android/include/jshash.h create mode 100644 scripting/javascript/spidermonkey-android/include/mozilla/Constants.h create mode 100644 scripting/javascript/spidermonkey-android/include/mozilla/MathAlgorithms.h create mode 100644 scripting/javascript/spidermonkey-android/include/mozilla/NullPtr.h create mode 100644 scripting/javascript/spidermonkey-android/include/mozilla/SHA1.h create mode 100644 scripting/javascript/spidermonkey-android/include/mozilla/WeakPtr.h diff --git a/scripting/javascript/spidermonkey-android/include/gc/Barrier.h b/scripting/javascript/spidermonkey-android/include/gc/Barrier.h index 08c8de8f0d..bd33c5d1d4 100644 --- a/scripting/javascript/spidermonkey-android/include/gc/Barrier.h +++ b/scripting/javascript/spidermonkey-android/include/gc/Barrier.h @@ -129,7 +129,7 @@ class EncapsulatedPtr public: EncapsulatedPtr() : value(NULL) {} - explicit EncapsulatedPtr(T *v) : value(v) {} + EncapsulatedPtr(T *v) : value(v) {} explicit EncapsulatedPtr(const EncapsulatedPtr &v) : value(v.value) {} ~EncapsulatedPtr() { pre(); } @@ -222,34 +222,51 @@ class RelocatablePtr : public EncapsulatedPtr { public: RelocatablePtr() : EncapsulatedPtr(NULL) {} - explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { post(); } - explicit RelocatablePtr(const RelocatablePtr &v) - : EncapsulatedPtr(v) { post(); } + explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { + if (v) + post(); + } + explicit RelocatablePtr(const RelocatablePtr &v) : EncapsulatedPtr(v) { + if (this->value) + post(); + } ~RelocatablePtr() { - this->pre(); - relocate(); + if (this->value) + relocate(this->value->compartment()); } RelocatablePtr &operator=(T *v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); - this->value = v; - post(); + if (v) { + this->value = v; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } RelocatablePtr &operator=(const RelocatablePtr &v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); - this->value = v.value; - post(); + if (v.value) { + this->value = v.value; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } protected: - void post() { T::writeBarrierRelocPost(this->value, (void *)&this->value); } - void relocate() { T::writeBarrierRelocated(this->value, (void *)&this->value); } + inline void post(); + inline void relocate(JSCompartment *comp); }; /* @@ -276,6 +293,9 @@ struct Shape; class BaseShape; namespace types { struct TypeObject; } +typedef EncapsulatedPtr EncapsulatedPtrObject; +typedef EncapsulatedPtr EncapsulatedPtrScript; + typedef RelocatablePtr RelocatablePtrObject; typedef RelocatablePtr RelocatablePtrScript; @@ -303,6 +323,19 @@ struct HeapPtrHasher template struct DefaultHasher< HeapPtr > : HeapPtrHasher { }; +template +struct EncapsulatedPtrHasher +{ + typedef EncapsulatedPtr Key; + typedef T *Lookup; + + static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } + static bool match(const Key &k, Lookup l) { return k.get() == l; } +}; + +template +struct DefaultHasher< EncapsulatedPtr > : EncapsulatedPtrHasher { }; + class EncapsulatedValue : public ValueOperations { protected: @@ -379,7 +412,7 @@ class RelocatableValue : public EncapsulatedValue public: explicit inline RelocatableValue(); explicit inline RelocatableValue(const Value &v); - explicit inline RelocatableValue(const RelocatableValue &v); + inline RelocatableValue(const RelocatableValue &v); inline ~RelocatableValue(); inline RelocatableValue &operator=(const Value &v); @@ -414,7 +447,7 @@ class HeapSlot : public EncapsulatedValue inline void set(JSCompartment *comp, JSObject *owner, uint32_t slot, const Value &v); static inline void writeBarrierPost(JSObject *obj, uint32_t slot); - static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slotno); + static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slot); private: inline void post(JSObject *owner, uint32_t slot); @@ -428,8 +461,19 @@ class HeapSlot : public EncapsulatedValue * single step. */ inline void -SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count) +SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count); + +/* + * This is a post barrier for HashTables whose key can be moved during a GC. + */ +template +inline void +HashTableWriteBarrierPost(JSCompartment *comp, const Map *map, const Key &key) { +#ifdef JS_GCGENERATIONAL + if (key && comp->gcNursery.isInside(key)) + comp->gcStoreBuffer.putGeneric(HashKeyRef(map, key)); +#endif } static inline const Value * @@ -467,15 +511,16 @@ class EncapsulatedId protected: jsid value; - explicit EncapsulatedId() : value(JSID_VOID) {} - explicit inline EncapsulatedId(jsid id) : value(id) {} - ~EncapsulatedId() {} - private: EncapsulatedId(const EncapsulatedId &v) MOZ_DELETE; - EncapsulatedId &operator=(const EncapsulatedId &v) MOZ_DELETE; public: + explicit EncapsulatedId() : value(JSID_VOID) {} + explicit EncapsulatedId(jsid id) : value(id) {} + ~EncapsulatedId(); + + inline EncapsulatedId &operator=(const EncapsulatedId &v); + bool operator==(jsid id) const { return value == id; } bool operator!=(jsid id) const { return value != id; } diff --git a/scripting/javascript/spidermonkey-android/include/gc/Heap.h b/scripting/javascript/spidermonkey-android/include/gc/Heap.h index 5e9b939c12..b8f8c78925 100644 --- a/scripting/javascript/spidermonkey-android/include/gc/Heap.h +++ b/scripting/javascript/spidermonkey-android/include/gc/Heap.h @@ -423,38 +423,47 @@ struct ArenaHeader * chunk. The latter allows to quickly check if the arena is allocated * during the conservative GC scanning without searching the arena in the * list. + * + * We use 8 bits for the allocKind so the compiler can use byte-level memory + * instructions to access it. */ size_t allocKind : 8; /* - * When recursive marking uses too much stack the marking is delayed and - * the corresponding arenas are put into a stack using the following field - * as a linkage. To distinguish the bottom of the stack from the arenas - * not present in the stack we use an extra flag to tag arenas on the - * stack. + * When collecting we sometimes need to keep an auxillary list of arenas, + * for which we use the following fields. This happens for several reasons: + * + * When recursive marking uses too much stack the marking is delayed and the + * corresponding arenas are put into a stack. To distinguish the bottom of + * the stack from the arenas not present in the stack we use the + * markOverflow flag to tag arenas on the stack. * * Delayed marking is also used for arenas that we allocate into during an * incremental GC. In this case, we intend to mark all the objects in the * arena, and it's faster to do this marking in bulk. * - * To minimize the ArenaHeader size we record the next delayed marking - * linkage as arenaAddress() >> ArenaShift and pack it with the allocKind - * field and hasDelayedMarking flag. We use 8 bits for the allocKind, not - * ArenaShift - 1, so the compiler can use byte-level memory instructions - * to access it. + * When sweeping we keep track of which arenas have been allocated since the + * end of the mark phase. This allows us to tell whether a pointer to an + * unmarked object is yet to be finalized or has already been reallocated. + * We set the allocatedDuringIncremental flag for this and clear it at the + * end of the sweep phase. + * + * To minimize the ArenaHeader size we record the next linkage as + * arenaAddress() >> ArenaShift and pack it with the allocKind field and the + * flags. */ public: size_t hasDelayedMarking : 1; size_t allocatedDuringIncremental : 1; size_t markOverflow : 1; - size_t nextDelayedMarking : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; + size_t auxNextLink : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; static void staticAsserts() { /* We must be able to fit the allockind into uint8_t. */ JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255); /* - * nextDelayedMarkingpacking assumes that ArenaShift has enough bits + * auxNextLink packing assumes that ArenaShift has enough bits * to cover allocKind and hasDelayedMarking. */ JS_STATIC_ASSERT(ArenaShift >= 8 + 1 + 1 + 1); @@ -487,7 +496,7 @@ struct ArenaHeader markOverflow = 0; allocatedDuringIncremental = 0; hasDelayedMarking = 0; - nextDelayedMarking = 0; + auxNextLink = 0; } inline uintptr_t arenaAddress() const; @@ -519,6 +528,11 @@ struct ArenaHeader inline ArenaHeader *getNextDelayedMarking() const; inline void setNextDelayedMarking(ArenaHeader *aheader); + inline void unsetDelayedMarking(); + + inline ArenaHeader *getNextAllocDuringSweep() const; + inline void setNextAllocDuringSweep(ArenaHeader *aheader); + inline void unsetAllocDuringSweep(); }; struct Arena @@ -882,15 +896,48 @@ ArenaHeader::setFirstFreeSpan(const FreeSpan *span) inline ArenaHeader * ArenaHeader::getNextDelayedMarking() const { - return &reinterpret_cast(nextDelayedMarking << ArenaShift)->aheader; + JS_ASSERT(hasDelayedMarking); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) { JS_ASSERT(!(uintptr_t(aheader) & ArenaMask)); + JS_ASSERT(!auxNextLink && !hasDelayedMarking); hasDelayedMarking = 1; - nextDelayedMarking = aheader->arenaAddress() >> ArenaShift; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetDelayedMarking() +{ + JS_ASSERT(hasDelayedMarking); + hasDelayedMarking = 0; + auxNextLink = 0; +} + +inline ArenaHeader * +ArenaHeader::getNextAllocDuringSweep() const +{ + JS_ASSERT(allocatedDuringIncremental); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; +} + +inline void +ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) +{ + JS_ASSERT(!auxNextLink && !allocatedDuringIncremental); + allocatedDuringIncremental = 1; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetAllocDuringSweep() +{ + JS_ASSERT(allocatedDuringIncremental); + allocatedDuringIncremental = 0; + auxNextLink = 0; } JS_ALWAYS_INLINE void diff --git a/scripting/javascript/spidermonkey-android/include/gc/Root.h b/scripting/javascript/spidermonkey-android/include/gc/Root.h index 4ada9966b8..551be92a8c 100644 --- a/scripting/javascript/spidermonkey-android/include/gc/Root.h +++ b/scripting/javascript/spidermonkey-android/include/gc/Root.h @@ -62,6 +62,7 @@ namespace JS { * separate rooting analysis. */ +template class MutableHandle; template class Rooted; template @@ -79,6 +80,9 @@ struct NullPtr static void * const constNullValue; }; +template +class MutableHandle; + template class HandleBase {}; @@ -108,6 +112,11 @@ class Handle : public HandleBase ptr = reinterpret_cast(&NullPtr::constNullValue); } + friend class MutableHandle; + Handle(MutableHandle handle) { + ptr = handle.address(); + } + /* * This may be called only if the location of the T is guaranteed * to be marked (for some reason other than being a Rooted), @@ -130,6 +139,12 @@ class Handle : public HandleBase Handle(Rooted &root, typename mozilla::EnableIf::value, int>::Type dummy = 0); + /* Construct a read only handle from a mutable handle. */ + template + inline + Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy = 0); + const T *address() const { return ptr; } T get() const { return *ptr; } @@ -185,6 +200,19 @@ class MutableHandle : public MutableHandleBase *ptr = v; } + /* + * This may be called only if the location of the T is guaranteed + * to be marked (for some reason other than being a Rooted), + * e.g., if it is guaranteed to be reachable from an implicit root. + * + * Create a MutableHandle from a raw location of a T. + */ + static MutableHandle fromMarkedLocation(T *p) { + MutableHandle h; + h.ptr = p; + return h; + } + T *address() const { return ptr; } T get() const { return *ptr; } @@ -195,16 +223,33 @@ class MutableHandle : public MutableHandleBase MutableHandle() {} T *ptr; + + template + void operator =(S v) MOZ_DELETE; }; typedef MutableHandle MutableHandleObject; typedef MutableHandle MutableHandleValue; +/* + * Raw pointer used as documentation that a parameter does not need to be + * rooted. + */ +typedef JSObject * RawObject; + +/* + * By default, pointers should use the inheritance hierarchy to find their + * ThingRootKind. Some pointer types are explicitly set in jspubtd.h so that + * Rooted may be used without the class definition being available. + */ +template +struct RootKind { static ThingRootKind rootKind() { return T::rootKind(); }; }; + template struct RootMethods { static T *initial() { return NULL; } - static ThingRootKind kind() { return T::rootKind(); } + static ThingRootKind kind() { return RootKind::rootKind(); } static bool poisoned(T *v) { return IsPoisonedPtr(v); } }; @@ -291,6 +336,14 @@ Handle::Handle(Rooted &root, ptr = reinterpret_cast(root.address()); } +template template +inline +Handle::Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy) +{ + ptr = reinterpret_cast(root.address()); +} + template template inline MutableHandle::MutableHandle(Rooted *root, @@ -332,15 +385,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - init(ContextFriendFields::get(cx), ptr, 1); - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { init(ContextFriendFields::get(cx), ptr, count); @@ -363,14 +408,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { JS_GUARD_OBJECT_NOTIFIER_INIT; @@ -381,6 +419,12 @@ class SkipRoot JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +/* + * This typedef is to annotate parameters that we have manually verified do not + * need rooting, as opposed to parameters that have not yet been considered. + */ +typedef JSObject *RawObject; + #ifdef DEBUG JS_FRIEND_API(bool) IsRootingUnnecessaryForContext(JSContext *cx); JS_FRIEND_API(void) SetRootingUnnecessaryForContext(JSContext *cx, bool value); @@ -389,14 +433,16 @@ JS_FRIEND_API(bool) RelaxRootChecksForContext(JSContext *cx); class AssertRootingUnnecessary { JS_DECL_USE_GUARD_OBJECT_NOTIFIER +#ifdef DEBUG JSContext *cx; bool prev; +#endif public: AssertRootingUnnecessary(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) - : cx(cx) { JS_GUARD_OBJECT_NOTIFIER_INIT; #ifdef DEBUG + this->cx = cx; prev = IsRootingUnnecessaryForContext(cx); SetRootingUnnecessaryForContext(cx, true); #endif diff --git a/scripting/javascript/spidermonkey-android/include/gc/Statistics.h b/scripting/javascript/spidermonkey-android/include/gc/Statistics.h index 5b4e355f0b..dfd00dbc94 100644 --- a/scripting/javascript/spidermonkey-android/include/gc/Statistics.h +++ b/scripting/javascript/spidermonkey-android/include/gc/Statistics.h @@ -80,6 +80,9 @@ struct Statistics { counts[s]++; } + int64_t beginSCC(); + void endSCC(unsigned scc, int64_t start); + jschar *formatMessage(); jschar *formatJSON(uint64_t timestamp); @@ -134,10 +137,14 @@ struct Statistics { /* Allocated space before the GC started. */ size_t preBytes; + /* Sweep times for SCCs of compartments. */ + Vector sccTimes; + void beginGC(); void endGC(); - int64_t gcDuration(); + void gcDuration(int64_t *total, int64_t *maxPause); + void sccDurations(int64_t *total, int64_t *maxPause); void printStats(); bool formatData(StatisticsSerializer &ss, uint64_t timestamp); @@ -168,6 +175,17 @@ struct AutoPhase { JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +struct AutoSCC { + AutoSCC(Statistics &stats, unsigned scc JS_GUARD_OBJECT_NOTIFIER_PARAM) + : stats(stats), scc(scc) { JS_GUARD_OBJECT_NOTIFIER_INIT; start = stats.beginSCC(); } + ~AutoSCC() { stats.endSCC(scc, start); } + + Statistics &stats; + unsigned scc; + int64_t start; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + } /* namespace gcstats */ } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-android/include/gc/StoreBuffer.h b/scripting/javascript/spidermonkey-android/include/gc/StoreBuffer.h new file mode 100644 index 0000000000..9240e93f10 --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/gc/StoreBuffer.h @@ -0,0 +1,398 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifdef JSGC_GENERATIONAL +#ifndef jsgc_storebuffer_h___ +#define jsgc_storebuffer_h___ + +#include "jsgc.h" +#include "jsalloc.h" + +#include "gc/Marking.h" + +namespace js { +namespace gc { + +/* + * Note: this is a stub Nursery that does not actually contain a heap, just a + * set of pointers which are "inside" the nursery to implement verification. + */ +class Nursery +{ + HashSet, SystemAllocPolicy> nursery; + + public: + Nursery() : nursery() {} + + bool enable() { + if (!nursery.initialized()) + return nursery.init(); + return true; + } + + void disable() { + if (!nursery.initialized()) + return; + nursery.finish(); + } + + bool isInside(void *cell) const { + JS_ASSERT((uintptr_t(cell) & 0x3) == 0); + return nursery.initialized() && nursery.has(cell); + } + + void insertPointer(void *cell) { + nursery.putNew(cell); + } +}; + +/* + * BufferableRef represents an abstract reference for use in the generational + * GC's remembered set. Entries in the store buffer that cannot be represented + * with the simple pointer-to-a-pointer scheme must derive from this class and + * use the generic store buffer interface. + */ +class BufferableRef +{ + public: + virtual bool match(void *location) = 0; + virtual void mark(JSTracer *trc) = 0; +}; + +/* + * HashKeyRef represents a reference to a HashTable key. Manual HashTable + * barriers should should instantiate this template with their own table/key + * type to insert into the generic buffer with putGeneric. + */ +template +class HashKeyRef : public BufferableRef +{ + Map *map; + Key key; + + typedef typename Map::Ptr Ptr; + + public: + HashKeyRef(Map *m, const Key &k) : map(m), key(k) {} + + bool match(void *location) { + Ptr p = map->lookup(key); + if (!p) + return false; + return &p->key == location; + } + + void mark(JSTracer *trc) {} +}; + +/* + * The StoreBuffer observes all writes that occur in the system and performs + * efficient filtering of them to derive a remembered set for nursery GC. + */ +class StoreBuffer +{ + /* TODO: profile to find the ideal size for these. */ + static const size_t ValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t CellBufferSize = 2 * 1024 * sizeof(Cell **); + static const size_t SlotBufferSize = 2 * 1024 * (sizeof(JSObject *) + sizeof(uint32_t)); + static const size_t RelocValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t RelocCellBufferSize = 1 * 1024 * sizeof(Cell **); + static const size_t GenericBufferSize = 1 * 1024 * sizeof(int); + static const size_t TotalSize = ValueBufferSize + CellBufferSize + + SlotBufferSize + RelocValueBufferSize + RelocCellBufferSize + + GenericBufferSize; + + typedef HashSet, SystemAllocPolicy> EdgeSet; + + /* + * This buffer holds only a single type of edge. Using this buffer is more + * efficient than the generic buffer when many writes will be to the same + * type of edge: e.g. Value or Cell*. + */ + template + class MonoTypeBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + T *base; /* Pointer to the start of the buffer. */ + T *pos; /* Pointer to the current insertion position. */ + T *top; /* Pointer to one element after the end. */ + + MonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery), base(NULL), pos(NULL), top(NULL) + {} + + MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + bool isEmpty() const { return pos == base; } + bool isFull() const { JS_ASSERT(pos <= top); return pos == top; } + + /* Compaction algorithms. */ + void compactNotInSet(); + + /* + * Attempts to reduce the usage of the buffer by removing unnecessary + * entries. + */ + virtual void compact(); + + /* Add one item to the buffer. */ + void put(const T &v); + + /* For verification. */ + bool accumulateEdges(EdgeSet &edges); + }; + + /* + * Overrides the MonoTypeBuffer to support pointers that may be moved in + * memory outside of the GC's control. + */ + template + class RelocatableMonoTypeBuffer : public MonoTypeBuffer + { + friend class StoreBuffer; + + RelocatableMonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : MonoTypeBuffer(owner, nursery) + {} + + /* Override compaction to filter out removed items. */ + void compactMoved(); + virtual void compact(); + + /* Record a removal from the buffer. */ + void unput(const T &v); + }; + + class GenericBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + uint8_t *base; /* Pointer to start of buffer. */ + uint8_t *pos; /* Pointer to current buffer position. */ + uint8_t *top; /* Pointer to one past the last entry. */ + + GenericBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery) + {} + + GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + /* Check if a pointer is present in the buffer. */ + bool containsEdge(void *location) const; + + template + void put(const T &t) { + /* Check if we have been enabled. */ + if (!pos) + return; + + /* Check for overflow. */ + if (top - pos < (unsigned)(sizeof(unsigned) + sizeof(T))) { + owner->setOverflowed(); + return; + } + + *((unsigned *)pos) = sizeof(T); + pos += sizeof(unsigned); + + T *p = (T *)pos; + new (p) T(t); + pos += sizeof(T); + } + }; + + class CellPtrEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Cell **edge; + + CellPtrEdge(Cell **v) : edge(v) {} + bool operator==(const CellPtrEdge &other) const { return edge == other.edge; } + bool operator!=(const CellPtrEdge &other) const { return edge != other.edge; } + + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(*edge); + } + + bool isNullEdge() const { + return !*edge; + } + + CellPtrEdge tagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) | 1)); } + CellPtrEdge untagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + class ValueEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Value *edge; + + ValueEdge(Value *v) : edge(v) {} + bool operator==(const ValueEdge &other) const { return edge == other.edge; } + bool operator!=(const ValueEdge &other) const { return edge != other.edge; } + + void *deref() const { return edge->isGCThing() ? edge->toGCThing() : NULL; } + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + + ValueEdge tagged() const { return ValueEdge((Value *)(uintptr_t(edge) | 1)); } + ValueEdge untagged() const { return ValueEdge((Value *)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + struct SlotEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + + JSObject *object; + uint32_t offset; + + SlotEdge(JSObject *object, uint32_t offset) : object(object), offset(offset) {} + + bool operator==(const SlotEdge &other) const { + return object == other.object && offset == other.offset; + } + + bool operator!=(const SlotEdge &other) const { + return object != other.object || offset != other.offset; + } + + HeapSlot *slotLocation() const { + if (object->isDenseArray()) { + if (offset >= object->getDenseArrayInitializedLength()) + return NULL; + return (HeapSlot *)&object->getDenseArrayElement(offset); + } + if (offset >= object->slotSpan()) + return NULL; + return &object->getSlotRef(offset); + } + + void *deref() const { + HeapSlot *loc = slotLocation(); + return (loc && loc->isGCThing()) ? loc->toGCThing() : NULL; + } + + void *location() const { + return (void *)slotLocation(); + } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(object) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + }; + + MonoTypeBuffer bufferVal; + MonoTypeBuffer bufferCell; + MonoTypeBuffer bufferSlot; + RelocatableMonoTypeBuffer bufferRelocVal; + RelocatableMonoTypeBuffer bufferRelocCell; + GenericBuffer bufferGeneric; + + Nursery *nursery; + + void *buffer; + + bool overflowed; + bool enabled; + + /* For the verifier. */ + EdgeSet edgeSet; + + /* For use by our owned buffers. */ + void setOverflowed() { overflowed = true; } + + public: + StoreBuffer(Nursery *n) + : bufferVal(this, n), bufferCell(this, n), bufferSlot(this, n), + bufferRelocVal(this, n), bufferRelocCell(this, n), bufferGeneric(this, n), + nursery(n), buffer(NULL), overflowed(false), enabled(false) + {} + + bool enable(); + void disable(); + bool isEnabled() { return enabled; } + + /* Get the overflowed status. */ + bool hasOverflowed() const { return overflowed; } + + /* Insert a single edge into the buffer/remembered set. */ + void putValue(Value *v) { + bufferVal.put(v); + } + void putCell(Cell **o) { + bufferCell.put(o); + } + void putSlot(JSObject *obj, uint32_t slot) { + bufferSlot.put(SlotEdge(obj, slot)); + } + + /* Insert or update a single edge in the Relocatable buffer. */ + void putRelocatableValue(Value *v) { + bufferRelocVal.put(v); + } + void putRelocatableCell(Cell **c) { + bufferRelocCell.put(c); + } + void removeRelocatableValue(Value *v) { + bufferRelocVal.unput(v); + } + void removeRelocatableCell(Cell **c) { + bufferRelocCell.unput(c); + } + + /* Insert an entry into the generic buffer. */ + template + void putGeneric(const T &t) { + bufferGeneric.put(t); + } + + /* For the verifier. */ + bool coalesceForVerification(); + void releaseVerificationData(); + bool containsEdgeAt(void *loc) const; +}; + +} /* namespace gc */ +} /* namespace js */ + +#endif /* jsgc_storebuffer_h___ */ +#endif /* JSGC_GENERATIONAL */ diff --git a/scripting/javascript/spidermonkey-android/include/js-config.h b/scripting/javascript/spidermonkey-android/include/js-config.h index 87155a91fa..a543aedf25 100644 --- a/scripting/javascript/spidermonkey-android/include/js-config.h +++ b/scripting/javascript/spidermonkey-android/include/js-config.h @@ -1,4 +1,3 @@ -/* js-config.h. Generated automatically by configure. */ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=78: * @@ -61,7 +60,7 @@ /* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being correct. */ -/* #undef JS_METHODJIT */ +#define JS_METHODJIT 1 /* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */ #define JS_HAS_XML_SUPPORT 1 diff --git a/scripting/javascript/spidermonkey-android/include/js.msg b/scripting/javascript/spidermonkey-android/include/js.msg index e30c87b1f0..e3d8e9830d 100644 --- a/scripting/javascript/spidermonkey-android/include/js.msg +++ b/scripting/javascript/spidermonkey-android/include/js.msg @@ -116,8 +116,8 @@ MSG_DEF(JSMSG_UNMATCHED_RIGHT_PAREN, 62, 0, JSEXN_SYNTAXERR, "unmatched ) in r MSG_DEF(JSMSG_TOO_BIG_TO_ENCODE, 63, 0, JSEXN_INTERNALERR, "data are to big to encode") MSG_DEF(JSMSG_ARG_INDEX_OUT_OF_RANGE, 64, 1, JSEXN_RANGEERR, "argument {0} accesses an index that is out of range") MSG_DEF(JSMSG_SPREAD_TOO_LARGE, 65, 0, JSEXN_RANGEERR, "array too large due to spread operand(s)") -MSG_DEF(JSMSG_UNUSED66, 66, 0, JSEXN_NONE, "") -MSG_DEF(JSMSG_UNUSED67, 67, 0, JSEXN_NONE, "") +MSG_DEF(JSMSG_SOURCE_TOO_LONG, 66, 0, JSEXN_RANGEERR, "source is too long") +MSG_DEF(JSMSG_BAD_WEAKMAP_KEY, 67, 0, JSEXN_TYPEERR, "cannot use the given object as a weak map key") MSG_DEF(JSMSG_BAD_SCRIPT_MAGIC, 68, 0, JSEXN_INTERNALERR, "bad script XDR magic number") MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 69, 0, JSEXN_SYNTAXERR, "missing ( before formal parameters") MSG_DEF(JSMSG_MISSING_FORMAL, 70, 0, JSEXN_SYNTAXERR, "missing formal parameter") @@ -126,7 +126,7 @@ MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body") MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition") MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition") -MSG_DEF(JSMSG_DESTRUCT_DUP_ARG, 76, 0, JSEXN_SYNTAXERR, "duplicate argument is mixed with destructuring pattern") +MSG_DEF(JSMSG_BAD_DUP_ARGS, 76, 0, JSEXN_SYNTAXERR, "duplicate argument names not allowed in this context") MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator") MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression") MSG_DEF(JSMSG_XML_WHOLE_PROGRAM, 79, 0, JSEXN_SYNTAXERR, "XML can't be the whole program") @@ -196,7 +196,7 @@ MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned functio MSG_DEF(JSMSG_SHARPVAR_TOO_BIG, 143, 0, JSEXN_SYNTAXERR, "overlarge sharp variable number") MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character") MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant") -MSG_DEF(JSMSG_BAD_INDIRECT_CALL, 146, 1, JSEXN_EVALERR, "function {0} must be called directly, and not by way of a function of another name") +MSG_DEF(JSMSG_UNUSED146, 146, 0, JSEXN_NONE, "") MSG_DEF(JSMSG_UNCAUGHT_EXCEPTION, 147, 1, JSEXN_INTERNALERR, "uncaught exception: {0}") MSG_DEF(JSMSG_INVALID_BACKREF, 148, 0, JSEXN_SYNTAXERR, "non-octal digit in an escape sequence that doesn't match a back-reference") MSG_DEF(JSMSG_BAD_BACKREF, 149, 0, JSEXN_SYNTAXERR, "back-reference exceeds number of capturing parentheses") @@ -352,3 +352,11 @@ MSG_DEF(JSMSG_FUNCTION_ARGUMENTS_AND_REST, 298, 0, JSEXN_ERR, "the 'arguments' p MSG_DEF(JSMSG_REST_WITH_DEFAULT, 299, 0, JSEXN_SYNTAXERR, "rest parameter may not have a default") MSG_DEF(JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT, 300, 0, JSEXN_SYNTAXERR, "parameter(s) with default followed by parameter without default") MSG_DEF(JSMSG_YIELD_IN_DEFAULT, 301, 0, JSEXN_SYNTAXERR, "yield in default expression") +MSG_DEF(JSMSG_INTRINSIC_NOT_DEFINED, 302, 1, JSEXN_REFERENCEERR, "no intrinsic function {0}") +MSG_DEF(JSMSG_ALREADY_HAS_SOURCEMAP, 303, 1, JSEXN_ERR, "{0} is being assigned a source map, yet already has one") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_ARG, 304, 1, JSEXN_TYPEERR, "invalid ParallelArray{0} argument") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_PARTITION, 305, 0, JSEXN_ERR, "argument must be divisible by outermost dimension") +MSG_DEF(JSMSG_PAR_ARRAY_REDUCE_EMPTY, 306, 0, JSEXN_ERR, "cannot reduce empty ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_ALREADY_FLAT, 307, 0, JSEXN_ERR, "cannot flatten 1-dimensional ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_CONFLICT, 308, 0, JSEXN_ERR, "no conflict resolution function provided") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_BOUNDS, 309, 0, JSEXN_ERR, "index in scatter vector out of bounds") diff --git a/scripting/javascript/spidermonkey-android/include/js/HashTable.h b/scripting/javascript/spidermonkey-android/include/js/HashTable.h index bc1f446b1a..0e8d9bf63c 100644 --- a/scripting/javascript/spidermonkey-android/include/js/HashTable.h +++ b/scripting/javascript/spidermonkey-android/include/js/HashTable.h @@ -15,9 +15,6 @@ namespace js { class TempAllocPolicy; -/* Integral types for all hash functions. */ -typedef uint32_t HashNumber; - /*****************************************************************************/ namespace detail { @@ -217,9 +214,6 @@ class HashTable : private AllocPolicy * this operation until the next call to |popFront()|. */ void rekeyFront(const Lookup &l, const Key &k) { - JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); - if (match(*this->cur, l)) - return; typename HashTableEntry::NonConstT t = this->cur->t; HashPolicy::setKey(t, const_cast(k)); table.remove(*this->cur); @@ -288,7 +282,6 @@ class HashTable : private AllocPolicy static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */ static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */ static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */ - static const HashNumber sGoldenRatio = 0x9E3779B9U; /* taken from jsdhash.h */ static const HashNumber sFreeKey = Entry::sFreeKey; static const HashNumber sRemovedKey = Entry::sRemovedKey; static const HashNumber sCollisionBit = Entry::sCollisionBit; @@ -308,10 +301,7 @@ class HashTable : private AllocPolicy static HashNumber prepareHash(const Lookup& l) { - HashNumber keyHash = HashPolicy::hash(l); - - /* Improve keyHash distribution. */ - keyHash *= sGoldenRatio; + HashNumber keyHash = ScrambleHashCode(HashPolicy::hash(l)); /* Avoid reserved hash codes. */ if (!isLiveHash(keyHash)) @@ -1003,6 +993,9 @@ template class HashMap { + typedef typename tl::StaticAssert::result>::result keyAssert; + typedef typename tl::StaticAssert::result>::result valAssert; + public: typedef typename HashPolicy::Lookup Lookup; diff --git a/scripting/javascript/spidermonkey-android/include/js/MemoryMetrics.h b/scripting/javascript/spidermonkey-android/include/js/MemoryMetrics.h index 20edc08705..6942823c22 100644 --- a/scripting/javascript/spidermonkey-android/include/js/MemoryMetrics.h +++ b/scripting/javascript/spidermonkey-android/include/js/MemoryMetrics.h @@ -56,6 +56,7 @@ struct RuntimeSizes , gcMarker(0) , mathCache(0) , scriptFilenames(0) + , scriptSources(0) , compartmentObjects(0) {} @@ -71,6 +72,7 @@ struct RuntimeSizes size_t gcMarker; size_t mathCache; size_t scriptFilenames; + size_t scriptSources; // This is the exception to the "RuntimeSizes doesn't measure things within // compartments" rule. We combine the sizes of all the JSCompartment diff --git a/scripting/javascript/spidermonkey-android/include/js/Utility.h b/scripting/javascript/spidermonkey-android/include/js/Utility.h index 327fce3e99..5c845e1183 100644 --- a/scripting/javascript/spidermonkey-android/include/js/Utility.h +++ b/scripting/javascript/spidermonkey-android/include/js/Utility.h @@ -355,6 +355,26 @@ JS_FLOOR_LOG2W(size_t n) return js_FloorLog2wImpl(n); } +/* + * JS_ROTATE_LEFT32 + * + * There is no rotate operation in the C Language so the construct (a << 4) | + * (a >> 28) is used instead. Most compilers convert this to a rotate + * instruction but some versions of MSVC don't without a little help. To get + * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic + * and use a pragma to make _rotl inline. + * + * MSVC in VS2005 will do an inline rotate instruction on the above construct. + */ +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ + defined(_M_X64)) +#include +#pragma intrinsic(_rotl) +#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) +#else +#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +#endif + JS_END_EXTERN_C #ifdef __cplusplus @@ -599,11 +619,18 @@ public: class UnwantedForeground : public Foreground { }; -template -struct ScopedDeletePtrTraits +template +struct ScopedFreePtrTraits +{ + typedef T* type; + static T* empty() { return NULL; } + static void release(T* ptr) { Foreground::free_(ptr); } +}; +SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) + +template +struct ScopedDeletePtrTraits : public ScopedFreePtrTraits { - typedef T *type; - static T *empty() { return NULL; } static void release(T *ptr) { Foreground::delete_(ptr); } }; SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits) @@ -829,20 +856,7 @@ class MoveRef { explicit MoveRef(T &t) : pointer(&t) { } T &operator*() const { return *pointer; } T *operator->() const { return pointer; } -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(__clang__) - /* - * If MoveRef is used in a rvalue position (which is expected), we can - * end up in a situation where, without this ifdef, we would try to pass - * a T& to a move constructor, which fails. It is not clear if the compiler - * should instead use the copy constructor, but for now this lets us build - * with clang. See bug 689066 and llvm.org/pr11003 for the details. - * Note: We can probably remove MoveRef completely once we are comfortable - * using c++11. - */ - operator T&& () const { return static_cast(*pointer); } -#else operator T& () const { return *pointer; } -#endif private: T *pointer; }; @@ -895,6 +909,51 @@ RoundUpPow2(size_t x) return size_t(1) << JS_CEILING_LOG2W(x); } +/* Integral types for all hash functions. */ +typedef uint32_t HashNumber; +const unsigned HashNumberSizeBits = 32; + +namespace detail { + +/* + * Given a raw hash code, h, return a number that can be used to select a hash + * bucket. + * + * This function aims to produce as uniform an output distribution as possible, + * especially in the most significant (leftmost) bits, even though the input + * distribution may be highly nonrandom, given the constraints that this must + * be deterministic and quick to compute. + * + * Since the leftmost bits of the result are best, the hash bucket index is + * computed by doing ScrambleHashCode(h) / (2^32/N) or the equivalent + * right-shift, not ScrambleHashCode(h) % N or the equivalent bit-mask. + * + * FIXME: OrderedHashTable uses a bit-mask; see bug 775896. + */ +inline HashNumber +ScrambleHashCode(HashNumber h) +{ + /* + * Simply returning h would not cause any hash tables to produce wrong + * answers. But it can produce pathologically bad performance: The caller + * right-shifts the result, keeping only the highest bits. The high bits of + * hash codes are very often completely entropy-free. (So are the lowest + * bits.) + * + * So we use Fibonacci hashing, as described in Knuth, The Art of Computer + * Programming, 6.4. This mixes all the bits of the input hash code h. + * + * The value of goldenRatio is taken from the hex + * expansion of the golden ratio, which starts 1.9E3779B9.... + * This value is especially good if values with consecutive hash codes + * are stored in a hash table; see Knuth for details. + */ + static const HashNumber goldenRatio = 0x9E3779B9U; + return h * goldenRatio; +} + +} /* namespace detail */ + } /* namespace js */ namespace JS { @@ -910,7 +969,7 @@ namespace JS { * a live integer value. */ -inline void PoisonPtr(uintptr_t *v) +inline void PoisonPtr(void *v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) uint8_t *ptr = (uint8_t *) v + 3; diff --git a/scripting/javascript/spidermonkey-android/include/jsapi.h.REMOVED.git-id b/scripting/javascript/spidermonkey-android/include/jsapi.h.REMOVED.git-id index 5c56f3b1fe..cb870fb789 100644 --- a/scripting/javascript/spidermonkey-android/include/jsapi.h.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-android/include/jsapi.h.REMOVED.git-id @@ -1 +1 @@ -37b6af08d1e6059f152ae515d8d7422a346cf7ed \ No newline at end of file +8a03481ec145a3a0e532637dd52bf80605b7a713 \ No newline at end of file diff --git a/scripting/javascript/spidermonkey-android/include/jsatom.h b/scripting/javascript/spidermonkey-android/include/jsatom.h index a3447e06b4..cc9a23f49b 100644 --- a/scripting/javascript/spidermonkey-android/include/jsatom.h +++ b/scripting/javascript/spidermonkey-android/include/jsatom.h @@ -12,12 +12,12 @@ #include "jsalloc.h" #include "jsapi.h" #include "jsprvtd.h" -#include "jshash.h" #include "jspubtd.h" #include "jslock.h" #include "gc/Barrier.h" #include "js/HashTable.h" +#include "mozilla/HashFunctions.h" struct JSIdArray { int length; @@ -83,23 +83,15 @@ JSID_TO_ATOM(jsid id) return (JSAtom *)JSID_TO_STRING(id); } -JS_STATIC_ASSERT(sizeof(JSHashNumber) == 4); +JS_STATIC_ASSERT(sizeof(js::HashNumber) == 4); JS_STATIC_ASSERT(sizeof(jsid) == JS_BYTES_PER_WORD); namespace js { -static JS_ALWAYS_INLINE JSHashNumber +static JS_ALWAYS_INLINE js::HashNumber HashId(jsid id) { - JSHashNumber n = -#if JS_BYTES_PER_WORD == 4 - JSHashNumber(JSID_BITS(id)); -#elif JS_BYTES_PER_WORD == 8 - JSHashNumber(JSID_BITS(id)) ^ JSHashNumber(JSID_BITS(id) >> 32); -#else -# error "Unsupported configuration" -#endif - return n * JS_GOLDEN_RATIO; + return HashGeneric(JSID_BITS(id)); } static JS_ALWAYS_INLINE Value @@ -135,15 +127,6 @@ struct DefaultHasher } -#if JS_BYTES_PER_WORD == 4 -# define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2) -#elif JS_BYTES_PER_WORD == 8 -# define ATOM_HASH(atom) (((JSHashNumber)(uintptr_t)(atom) >> 3) ^ \ - (JSHashNumber)((uintptr_t)(atom) >> 32)) -#else -# error "Unsupported configuration" -#endif - /* * Return a printable, lossless char[] representation of a string-type atom. * The lifetime of the result matches the lifetime of bytes. @@ -342,29 +325,28 @@ extern const char js_send_str[]; extern const char js_getter_str[]; extern const char js_setter_str[]; +namespace js { + /* * Initialize atom state. Return true on success, false on failure to allocate * memory. The caller must zero rt->atomState before calling this function and * only call it after js_InitGC successfully returns. */ extern JSBool -js_InitAtomState(JSRuntime *rt); +InitAtomState(JSRuntime *rt); /* * Free and clear atom state including any interned string atoms. This * function must be called before js_FinishGC. */ extern void -js_FinishAtomState(JSRuntime *rt); +FinishAtomState(JSRuntime *rt); /* * Atom tracing and garbage collection hooks. */ - -namespace js { - extern void -MarkAtomState(JSTracer *trc, bool markAll); +MarkAtomState(JSTracer *trc); extern void SweepAtomState(JSRuntime *rt); @@ -382,58 +364,32 @@ enum InternBehavior InternAtom = true }; -} /* namespace js */ +extern JSAtom * +Atomize(JSContext *cx, const char *bytes, size_t length, + js::InternBehavior ib = js::DoNotInternAtom, + js::FlationCoding fc = js::NormalEncoding); extern JSAtom * -js_Atomize(JSContext *cx, const char *bytes, size_t length, - js::InternBehavior ib = js::DoNotInternAtom, - js::FlationCoding fc = js::NormalEncoding); +AtomizeChars(JSContext *cx, const jschar *chars, size_t length, + js::InternBehavior ib = js::DoNotInternAtom); extern JSAtom * -js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, - js::InternBehavior ib = js::DoNotInternAtom); - -extern JSAtom * -js_AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); - -/* - * Return an existing atom for the given char array or null if the char - * sequence is currently not atomized. - */ -extern JSAtom * -js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length); - -#ifdef DEBUG - -extern JS_FRIEND_API(void) -js_DumpAtoms(JSContext *cx, FILE *fp); - -#endif - -namespace js { +AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); inline JSAtom * ToAtom(JSContext *cx, const js::Value &v); bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, - jsid *idp, Value *vp); + jsid *idp, MutableHandleValue vp); inline bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid *idp) { - Value dummy; + RootedValue dummy(cx); return InternNonIntElementId(cx, obj, idval, idp, &dummy); } -/* - * For all unmapped atoms recorded in al, add a mapping from the atom's index - * to its address. map->length must already be set to the number of atoms in - * the list and map->vector must point to pre-allocated memory. - */ -extern void -InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtr *atoms); - template bool XDRAtom(XDRState *xdr, JSAtom **atomp); diff --git a/scripting/javascript/spidermonkey-android/include/jsatom.tbl b/scripting/javascript/spidermonkey-android/include/jsatom.tbl index 3c2e47f450..969790f047 100644 --- a/scripting/javascript/spidermonkey-android/include/jsatom.tbl +++ b/scripting/javascript/spidermonkey-android/include/jsatom.tbl @@ -43,6 +43,7 @@ DEFINE_ATOM(call, "call") DEFINE_ATOM(callee, "callee") DEFINE_ATOM(caller, "caller") DEFINE_ATOM(classPrototype, "prototype") +DEFINE_ATOM(columnNumber, "columnNumber") DEFINE_ATOM(constructor, "constructor") DEFINE_ATOM(each, "each") DEFINE_ATOM(eval, "eval") @@ -53,7 +54,8 @@ DEFINE_ATOM(ignoreCase, "ignoreCase") DEFINE_ATOM(index, "index") DEFINE_ATOM(input, "input") DEFINE_ATOM(toISOString, "toISOString") -DEFINE_ATOM(iterator, "__iterator__") +DEFINE_ATOM(iterator, "iterator") +DEFINE_ATOM(iteratorIntrinsic, "__iterator__") DEFINE_ATOM(join, "join") DEFINE_ATOM(lastIndex, "lastIndex") DEFINE_ATOM(length, "length") @@ -121,6 +123,7 @@ DEFINE_PROTOTYPE_ATOM(WeakMap) DEFINE_ATOM(buffer, "buffer") DEFINE_ATOM(byteLength, "byteLength") DEFINE_ATOM(byteOffset, "byteOffset") +DEFINE_ATOM(shape, "shape") DEFINE_KEYWORD_ATOM(return) DEFINE_KEYWORD_ATOM(throw) DEFINE_ATOM(url, "url") @@ -148,3 +151,4 @@ DEFINE_ATOM(unescape, "unescape") DEFINE_ATOM(uneval, "uneval") DEFINE_ATOM(unwatch, "unwatch") DEFINE_ATOM(watch, "watch") +DEFINE_ATOM(_CallFunction, "_CallFunction") diff --git a/scripting/javascript/spidermonkey-android/include/jsclass.h b/scripting/javascript/spidermonkey-android/include/jsclass.h index e5bcacc05e..3da83a633e 100644 --- a/scripting/javascript/spidermonkey-android/include/jsclass.h +++ b/scripting/javascript/spidermonkey-android/include/jsclass.h @@ -161,35 +161,35 @@ typedef JSBool (* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp, MutableHandleShape propp); typedef JSBool -(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, const Value *value, +(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, const Value *value, +(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, const Value *value, +(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, const Value *value, +(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, Value *vp); +(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); typedef JSBool -(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, Value *vp); +(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp); typedef JSBool -(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp); +(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); typedef JSBool -(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp, bool* present); +(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool* present); typedef JSBool -(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, Value *vp); +(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp); typedef JSBool -(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool strict); +(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSBool (* GenericAttributesOp)(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp); typedef JSBool @@ -199,11 +199,11 @@ typedef JSBool typedef JSBool (* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp); typedef JSBool -(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSType (* TypeOfOp)(JSContext *cx, HandleObject obj); @@ -257,9 +257,22 @@ struct ClassExtension * WeakMaps use this to override the wrapper disposal optimization. */ bool isWrappedNative; + + /* + * If an object is used as a key in a weakmap, it may be desirable for the + * garbage collector to keep that object around longer than it otherwise + * would. A common case is when the key is a wrapper around an object in + * another compartment, and we want to avoid collecting the wrapper (and + * removing the weakmap entry) as long as the wrapped object is alive. In + * that case, the wrapped object is returned by the wrapper's + * weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap + * key, it will not be collected (and remain in the weakmap) until the + * wrapped object is collected. + */ + JSWeakmapKeyDelegateOp weakmapKeyDelegateOp; }; -#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false} +#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false,NULL} struct ObjectOps { diff --git a/scripting/javascript/spidermonkey-android/include/jsdbgapi.h b/scripting/javascript/spidermonkey-android/include/jsdbgapi.h index 1382b0779a..af326e28b0 100644 --- a/scripting/javascript/spidermonkey-android/include/jsdbgapi.h +++ b/scripting/javascript/spidermonkey-android/include/jsdbgapi.h @@ -221,12 +221,6 @@ JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); extern JS_PUBLIC_API(void) JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation); -extern JS_PUBLIC_API(JSPrincipals*) -JS_GetPrincipalIfDummyFrame(JSContext *cx, JSStackFrame *fpArg); - -extern JS_PUBLIC_API(JSBool) -JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp); - extern JS_PUBLIC_API(JSObject *) JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp); diff --git a/scripting/javascript/spidermonkey-android/include/jsfriendapi.h b/scripting/javascript/spidermonkey-android/include/jsfriendapi.h index 3e28bcaa63..63b9c96604 100644 --- a/scripting/javascript/spidermonkey-android/include/jsfriendapi.h +++ b/scripting/javascript/spidermonkey-android/include/jsfriendapi.h @@ -22,10 +22,10 @@ extern JS_FRIEND_API(JSString *) JS_GetAnonymousString(JSRuntime *rt); extern JS_FRIEND_API(JSObject *) -JS_FindCompilationScope(JSContext *cx, JSObject *obj); +JS_FindCompilationScope(JSContext *cx, JSRawObject obj); extern JS_FRIEND_API(JSFunction *) -JS_GetObjectFunction(JSObject *obj); +JS_GetObjectFunction(JSRawObject obj); extern JS_FRIEND_API(JSObject *) JS_GetGlobalForFrame(JSStackFrame *fp); @@ -37,7 +37,7 @@ extern JS_FRIEND_API(JSObject *) JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(uint32_t) -JS_ObjectCountDynamicSlots(JSObject *obj); +JS_ObjectCountDynamicSlots(JSHandleObject obj); extern JS_FRIEND_API(void) JS_ShrinkGCBuffers(JSRuntime *rt); @@ -75,13 +75,18 @@ enum { JS_TELEMETRY_GC_REASON, JS_TELEMETRY_GC_IS_COMPARTMENTAL, JS_TELEMETRY_GC_MS, + JS_TELEMETRY_GC_MAX_PAUSE_MS, JS_TELEMETRY_GC_MARK_MS, JS_TELEMETRY_GC_SWEEP_MS, + JS_TELEMETRY_GC_MARK_ROOTS_MS, + JS_TELEMETRY_GC_MARK_GRAY_MS, JS_TELEMETRY_GC_SLICE_MS, JS_TELEMETRY_GC_MMU_50, JS_TELEMETRY_GC_RESET, JS_TELEMETRY_GC_INCREMENTAL_DISABLED, - JS_TELEMETRY_GC_NON_INCREMENTAL + JS_TELEMETRY_GC_NON_INCREMENTAL, + JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS, + JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS }; typedef void @@ -108,7 +113,7 @@ extern JS_FRIEND_API(JSObject *) JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(JSBool) -js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, jsval *vp); +js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp); JS_FRIEND_API(void) js_ReportOverRecursed(JSContext *maybecx); @@ -159,6 +164,8 @@ struct JSFunctionSpecWithHelp { #define JS_FN_HELP(name,call,nargs,flags,usage,help) \ {name, call, nargs, (flags) | JSPROP_ENUMERATE | JSFUN_STUB_GSOPS, usage, help} +#define JS_FS_HELP_END \ + {NULL, NULL, 0, 0, NULL, NULL} extern JS_FRIEND_API(bool) JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSpecWithHelp *fs); @@ -169,6 +176,11 @@ JS_END_EXTERN_C #ifdef __cplusplus +typedef bool (* JS_SourceHook)(JSContext *cx, JSScript *script, jschar **src, uint32_t *length); + +extern JS_FRIEND_API(void) +JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook); + namespace js { struct RuntimeFriendFields { @@ -213,7 +225,7 @@ class JS_FRIEND_API(AutoSwitchCompartment) { public: AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment JS_GUARD_OBJECT_NOTIFIER_PARAM); - AutoSwitchCompartment(JSContext *cx, JSObject *target JS_GUARD_OBJECT_NOTIFIER_PARAM); + AutoSwitchCompartment(JSContext *cx, JSHandleObject target JS_GUARD_OBJECT_NOTIFIER_PARAM); ~AutoSwitchCompartment(); JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; @@ -274,6 +286,9 @@ typedef void extern JS_FRIEND_API(void) VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void *closure); +extern JS_FRIEND_API(JSObject *) +GetWeakmapKeyDelegate(JSObject *key); + /* * Shadow declarations of JS internal structures, for access by inline access * functions below. Do not use these structures in any other way. When adding @@ -318,6 +333,16 @@ struct Object { } }; +struct Function { + Object base; + uint16_t nargs; + uint16_t flags; + /* Used only for natives */ + Native native; + const JSJitInfo *jitinfo; + void *_1; +}; + struct Atom { size_t _; const jschar *chars; @@ -339,35 +364,35 @@ extern JS_FRIEND_DATA(js::Class) XMLClass; extern JS_FRIEND_DATA(js::Class) ObjectClass; inline js::Class * -GetObjectClass(const JSObject *obj) +GetObjectClass(RawObject obj) { return reinterpret_cast(obj)->shape->base->clasp; } inline JSClass * -GetObjectJSClass(const JSObject *obj) +GetObjectJSClass(RawObject obj) { return js::Jsvalify(GetObjectClass(obj)); } JS_FRIEND_API(bool) -IsScopeObject(JSObject *obj); +IsScopeObject(RawObject obj); inline JSObject * -GetObjectParent(JSObject *obj) +GetObjectParent(RawObject obj) { JS_ASSERT(!IsScopeObject(obj)); return reinterpret_cast(obj)->shape->base->parent; } JS_FRIEND_API(JSObject *) -GetObjectParentMaybeScope(JSObject *obj); +GetObjectParentMaybeScope(RawObject obj); JS_FRIEND_API(JSObject *) -GetGlobalForObjectCrossCompartment(JSObject *obj); +GetGlobalForObjectCrossCompartment(RawObject obj); JS_FRIEND_API(void) -NotifyAnimationActivity(JSObject *obj); +NotifyAnimationActivity(RawObject obj); JS_FRIEND_API(bool) IsOriginalScriptFunction(JSFunction *fun); @@ -391,19 +416,19 @@ InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto, JSPropertySpec *static_ps, JSFunctionSpec *static_fs); JS_FRIEND_API(const Value &) -GetFunctionNativeReserved(JSObject *fun, size_t which); +GetFunctionNativeReserved(RawObject fun, size_t which); JS_FRIEND_API(void) -SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val); +SetFunctionNativeReserved(RawObject fun, size_t which, const Value &val); inline JSObject * -GetObjectProto(JSObject *obj) +GetObjectProto(RawObject obj) { return reinterpret_cast(obj)->type->proto; } inline void * -GetObjectPrivate(JSObject *obj) +GetObjectPrivate(RawObject obj) { const shadow::Object *nobj = reinterpret_cast(obj); void **addr = reinterpret_cast(&nobj->fixedSlots()[nobj->numFixedSlots()]); @@ -415,17 +440,17 @@ GetObjectPrivate(JSObject *obj) * within the maximum capacity for the object's fixed slots). */ inline const Value & -GetReservedSlot(const JSObject *obj, size_t slot) +GetReservedSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); return reinterpret_cast(obj)->slotRef(slot); } JS_FRIEND_API(void) -SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const Value &value); +SetReservedSlotWithBarrier(RawObject obj, size_t slot, const Value &value); inline void -SetReservedSlot(JSObject *obj, size_t slot, const Value &value) +SetReservedSlot(RawObject obj, size_t slot, const Value &value) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); shadow::Object *sobj = reinterpret_cast(obj); @@ -436,22 +461,15 @@ SetReservedSlot(JSObject *obj, size_t slot, const Value &value) } JS_FRIEND_API(uint32_t) -GetObjectSlotSpan(JSObject *obj); +GetObjectSlotSpan(RawObject obj); inline const Value & -GetObjectSlot(JSObject *obj, size_t slot) +GetObjectSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < GetObjectSlotSpan(obj)); return reinterpret_cast(obj)->slotRef(slot); } -inline Shape * -GetObjectShape(JSObject *obj) -{ - shadow::Shape *shape = reinterpret_cast(obj)->shape; - return reinterpret_cast(shape); -} - inline const jschar * GetAtomChars(JSAtom *atom) { @@ -465,19 +483,19 @@ AtomToLinearString(JSAtom *atom) } static inline js::PropertyOp -CastAsJSPropertyOp(JSObject *object) +CastAsJSPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::PropertyOp, object); } static inline js::StrictPropertyOp -CastAsJSStrictPropertyOp(JSObject *object) +CastAsJSStrictPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::StrictPropertyOp, object); } JS_FRIEND_API(bool) -GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props); +GetPropertyNames(JSContext *cx, RawObject obj, unsigned flags, js::AutoIdVector *props); JS_FRIEND_API(bool) GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp); @@ -489,7 +507,7 @@ JS_FRIEND_API(void) SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback); JS_FRIEND_API(bool) -IsObjectInContextCompartment(const JSObject *obj, const JSContext *cx); +IsObjectInContextCompartment(RawObject obj, const JSContext *cx); /* * NB: these flag bits are encoded into the bytecode stream in the immediate @@ -542,19 +560,66 @@ GetPCCountScriptContents(JSContext *cx, size_t script); * * For more detailed information, see vm/SPSProfiler.h */ -struct ProfileEntry { +class ProfileEntry +{ /* - * These two fields are marked as 'volatile' so that the compiler doesn't - * re-order instructions which modify them. The operation in question is: + * All fields are marked volatile to prevent the compiler from re-ordering + * instructions. Namely this sequence: * - * stack[i].string = str; - * (*size)++; + * entry[size] = ...; + * size++; * - * If the size increment were re-ordered before the store of the string, - * then if sampling occurred there would be a bogus entry on the stack. + * If the size modification were somehow reordered before the stores, then + * if a sample were taken it would be examining bogus information. + * + * A ProfileEntry represents both a C++ profile entry and a JS one. Both use + * the string as a description, but JS uses the sp as NULL to indicate that + * it is a JS entry. The script_ is then only ever examined for a JS entry, + * and the idx is used by both, but with different meanings. */ - const char * volatile string; - void * volatile sp; + const char * volatile string; // Descriptive string of this entry + void * volatile sp; // Relevant stack pointer for the entry + JSScript * volatile script_; // if js(), non-null script which is running + int32_t volatile idx; // if js(), idx of pc, otherwise line number + + public: + /* + * All of these methods are marked with the 'volatile' keyword because SPS's + * representation of the stack is stored such that all ProfileEntry + * instances are volatile. These methods would not be available unless they + * were marked as volatile as well + */ + + bool js() volatile { + JS_ASSERT_IF(sp == NULL, script_ != NULL); + return sp == NULL; + } + + uint32_t line() volatile { JS_ASSERT(!js()); return idx; } + JSScript *script() volatile { JS_ASSERT(js()); return script_; } + void *stackAddress() volatile { return sp; } + const char *label() volatile { return string; } + + void setLine(uint32_t line) volatile { JS_ASSERT(!js()); idx = line; } + void setLabel(const char *string) volatile { this->string = string; } + void setStackAddress(void *sp) volatile { this->sp = sp; } + void setScript(JSScript *script) volatile { script_ = script; } + + /* we can't know the layout of JSScript, so look in vm/SPSProfiler.cpp */ + JS_FRIEND_API(jsbytecode *) pc() volatile; + JS_FRIEND_API(void) setPC(jsbytecode *pc) volatile; + + static size_t offsetOfString() { return offsetof(ProfileEntry, string); } + static size_t offsetOfStackAddress() { return offsetof(ProfileEntry, sp); } + static size_t offsetOfPCIdx() { return offsetof(ProfileEntry, idx); } + static size_t offsetOfScript() { return offsetof(ProfileEntry, script_); } + + /* + * The index used in the entry can either be a line number or the offset of + * a pc into a script's code. To signify a NULL pc, use a -1 index. This is + * checked against in pc() and setPC() to set/get the right pc. + */ + static const int32_t NullPCIndex = -1; }; JS_FRIEND_API(void) @@ -564,6 +629,9 @@ SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size, JS_FRIEND_API(void) EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled); +JS_FRIEND_API(jsbytecode*) +ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip); + #ifdef JS_THREADSAFE JS_FRIEND_API(void *) GetOwnerThread(const JSContext *cx); @@ -624,6 +692,7 @@ SizeOfJSContext(); D(DEBUG_GC) \ D(DEBUG_MODE_GC) \ D(TRANSPLANT) \ + D(RESET) \ \ /* Reasons from Firefox */ \ D(DOM_WINDOW_UTILS) \ @@ -695,7 +764,7 @@ extern JS_FRIEND_API(void) ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); extern JS_FRIEND_API(void) -IncrementalGC(JSRuntime *rt, gcreason::Reason reason); +IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0); extern JS_FRIEND_API(void) FinishIncrementalGC(JSRuntime *rt, gcreason::Reason reason); @@ -733,6 +802,30 @@ typedef void extern JS_FRIEND_API(GCSliceCallback) SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); +typedef void +(* AnalysisPurgeCallback)(JSRuntime *rt, JSFlatString *desc); + +extern JS_FRIEND_API(AnalysisPurgeCallback) +SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback); + +/* Was the most recent GC run incrementally? */ +extern JS_FRIEND_API(bool) +WasIncrementalGC(JSRuntime *rt); + +typedef JSBool +(* DOMInstanceClassMatchesProto)(JSHandleObject protoObject, uint32_t protoID, + uint32_t depth); +struct JSDOMCallbacks { + DOMInstanceClassMatchesProto instanceClassMatchesProto; +}; +typedef struct JSDOMCallbacks DOMCallbacks; + +extern JS_FRIEND_API(void) +SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks); + +extern JS_FRIEND_API(const DOMCallbacks *) +GetDOMCallbacks(JSRuntime *rt); + /* * Signals a good place to do an incremental slice, because the browser is * drawing a frame. @@ -753,7 +846,7 @@ extern JS_FRIEND_API(bool) IsIncrementalBarrierNeeded(JSContext *cx); extern JS_FRIEND_API(bool) -IsIncrementalBarrierNeededOnObject(JSObject *obj); +IsIncrementalBarrierNeededOnObject(RawObject obj); extern JS_FRIEND_API(bool) IsIncrementalBarrierNeededOnScript(JSScript *obj); @@ -821,21 +914,68 @@ CastToJSFreeOp(FreeOp *fop) /* Implemented in jsexn.cpp. */ /* - * Get an error type name from a number. - * If no exception is associated, return NULL. + * Get an error type name from a JSExnType constant. + * Returns NULL for invalid arguments and JSEXN_INTERNALERR */ extern JS_FRIEND_API(const jschar*) -GetErrorTypeNameFromNumber(JSContext* cx, const unsigned errorNumber); +GetErrorTypeName(JSContext* cx, int16_t exnType); /* Implemented in jswrapper.cpp. */ -typedef enum NukedGlobalHandling { - NukeForGlobalObject, - DontNukeForGlobalObject -} NukedGlobalHandling; +typedef enum NukeReferencesToWindow { + NukeWindowReferences, + DontNukeWindowReferences +} NukeReferencesToWindow; + +/* + * These filters are designed to be ephemeral stack classes, and thus don't + * do any rooting or holding of their members. + */ +struct CompartmentFilter { + virtual bool match(JSCompartment *c) const = 0; +}; + +struct AllCompartments : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { return true; } +}; + +struct ContentCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return !IsSystemCompartment(c); + } +}; + +struct ChromeCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return IsSystemCompartment(c); + } +}; + +struct SingleCompartment : public CompartmentFilter { + JSCompartment *ours; + SingleCompartment(JSCompartment *c) : ours(c) {} + virtual bool match(JSCompartment *c) const { return c == ours; } +}; + +struct CompartmentsWithPrincipals : public CompartmentFilter { + JSPrincipals *principals; + CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} + virtual bool match(JSCompartment *c) const { + return JS_GetCompartmentPrincipals(c) == principals; + } +}; extern JS_FRIEND_API(JSBool) -NukeChromeCrossCompartmentWrappersForGlobal(JSContext *cx, JSObject *obj, - NukedGlobalHandling nukeGlobal); +NukeCrossCompartmentWrappers(JSContext* cx, + const CompartmentFilter& sourceFilter, + const CompartmentFilter& targetFilter, + NukeReferencesToWindow nukeReferencesToWindow); + +/* Specify information about ListBase proxies in the DOM, for use by ICs. */ +JS_FRIEND_API(void) +SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot); + +void *GetListBaseHandlerFamily(); +uint32_t GetListBaseExpandoSlot(); } /* namespace js */ @@ -851,7 +991,7 @@ extern JS_FRIEND_API(JSBool) js_DateIsValid(JSContext *cx, JSObject* obj); extern JS_FRIEND_API(double) -js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj); +js_DateGetMsecSinceEpoch(JSContext *cx, JSRawObject obj); /* Implemented in jscntxt.cpp. */ @@ -1043,6 +1183,35 @@ JS_IsFloat32Array(JSObject *obj, JSContext *cx); extern JS_FRIEND_API(JSBool) JS_IsFloat64Array(JSObject *obj, JSContext *cx); + +/* + * Unwrap Typed arrays all at once. Return NULL without throwing if the object + * cannot be viewed as the correct typed array, or the typed array object on + * success, filling both outparameters. + */ +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt8Array(JSContext *cx, JSObject *obj, uint32_t *length, int8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8Array(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8ClampedArray(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt16Array(JSContext *cx, JSObject *obj, uint32_t *length, int16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint16Array(JSContext *cx, JSObject *obj, uint32_t *length, uint16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt32Array(JSContext *cx, JSObject *obj, uint32_t *length, int32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint32Array(JSContext *cx, JSObject *obj, uint32_t *length, uint32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat32Array(JSContext *cx, JSObject *obj, uint32_t *length, float **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat64Array(JSContext *cx, JSObject *obj, uint32_t *length, double **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBufferView(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBuffer(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); + /* * Get the type of elements in a typed array. * @@ -1213,4 +1382,42 @@ JS_GetDataViewByteLength(JSObject *obj, JSContext *cx); JS_FRIEND_API(void *) JS_GetDataViewData(JSObject *obj, JSContext *cx); +#ifdef __cplusplus +/* + * This struct contains metadata passed from the DOM to the JS Engine for JIT + * optimizations on DOM property accessors. Eventually, this should be made + * available to general JSAPI users, but we are not currently ready to do so. + */ +typedef bool +(* JSJitPropertyOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, JS::Value *vp); +typedef bool +(* JSJitMethodOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, unsigned argc, JS::Value *vp); + +struct JSJitInfo { + JSJitPropertyOp op; + uint32_t protoID; + uint32_t depth; + bool isInfallible; /* Is op fallible? Getters only */ + bool isConstant; /* Getting a construction-time constant? */ +}; + +static JS_ALWAYS_INLINE const JSJitInfo * +FUNCTION_VALUE_TO_JITINFO(const JS::Value& v) +{ + JS_ASSERT(js::GetObjectClass(&v.toObject()) == &js::FunctionClass); + return reinterpret_cast(&v.toObject())->jitinfo; +} + +static JS_ALWAYS_INLINE void +SET_JITINFO(JSFunction * func, const JSJitInfo *info) +{ + js::shadow::Function *fun = reinterpret_cast(func); + /* JS_ASSERT(func->isNative()). 0x4000 is JSFUN_INTERPRETED */ + JS_ASSERT(!(fun->flags & 0x4000)); + fun->jitinfo = info; +} +#endif /* __cplusplus */ + #endif /* jsfriendapi_h___ */ diff --git a/scripting/javascript/spidermonkey-android/include/jsgc.h b/scripting/javascript/spidermonkey-android/include/jsgc.h index 0cb842505c..13b2e4678c 100644 --- a/scripting/javascript/spidermonkey-android/include/jsgc.h +++ b/scripting/javascript/spidermonkey-android/include/jsgc.h @@ -41,6 +41,7 @@ namespace js { class GCHelperThread; struct Shape; +struct SliceBudget; namespace gc { @@ -48,6 +49,8 @@ enum State { NO_INCREMENTAL, MARK_ROOTS, MARK, + SWEEP, + SWEEP_END, INVALID }; @@ -112,36 +115,100 @@ MapAllocToTraceKind(AllocKind thingKind) return map[thingKind]; } +static inline bool +IsNurseryAllocable(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + +static inline bool +IsBackgroundFinalized(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + inline JSGCTraceKind GetGCThingTraceKind(const void *thing); +/* + * ArenaList::head points to the start of the list. Normally cursor points + * to the first arena in the list with some free things and all arenas + * before cursor are fully allocated. However, as the arena currently being + * allocated from is considered full while its list of free spans is moved + * into the freeList, during the GC or cell enumeration, when an + * unallocated freeList is moved back to the arena, we can see an arena + * with some free cells before the cursor. The cursor is an indirect + * pointer to allow for efficient list insertion at the cursor point and + * other list manipulations. + */ +struct ArenaList { + ArenaHeader *head; + ArenaHeader **cursor; + + ArenaList() { + clear(); + } + + void clear() { + head = NULL; + cursor = &head; + } + + void insert(ArenaHeader *arena); +}; + struct ArenaLists { - /* - * ArenaList::head points to the start of the list. Normally cursor points - * to the first arena in the list with some free things and all arenas - * before cursor are fully allocated. However, as the arena currently being - * allocated from is considered full while its list of free spans is moved - * into the freeList, during the GC or cell enumeration, when an - * unallocated freeList is moved back to the arena, we can see an arena - * with some free cells before the cursor. The cursor is an indirect - * pointer to allow for efficient list insertion at the cursor point and - * other list manipulations. - */ - struct ArenaList { - ArenaHeader *head; - ArenaHeader **cursor; - - ArenaList() { - clear(); - } - - void clear() { - head = NULL; - cursor = &head; - } - }; - private: /* * For each arena kind its free list is represented as the first span with @@ -180,12 +247,18 @@ struct ArenaLists { volatile uintptr_t backgroundFinalizeState[FINALIZE_LIMIT]; + public: + /* For each arena kind, a list of arenas remaining to be swept. */ + ArenaHeader *arenaListsToSweep[FINALIZE_LIMIT]; + public: ArenaLists() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) freeLists[i].initAsEmpty(); for (size_t i = 0; i != FINALIZE_LIMIT; ++i) backgroundFinalizeState[i] = BFS_DONE; + for (size_t i = 0; i != FINALIZE_LIMIT; ++i) + arenaListsToSweep[i] = NULL; } ~ArenaLists() { @@ -211,6 +284,10 @@ struct ArenaLists { return arenaLists[thingKind].head; } + ArenaHeader *getFirstArenaToSweep(AllocKind thingKind) const { + return arenaListsToSweep[thingKind]; + } + bool arenaListsAreEmpty() const { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* @@ -225,6 +302,10 @@ struct ArenaLists { return true; } + bool arenasAreFull(AllocKind thingKind) const { + return !*arenaLists[thingKind].cursor; + } + void unmarkAll() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* The background finalization must have stopped at this point. */ @@ -238,7 +319,8 @@ struct ArenaLists { } bool doneBackgroundFinalize(AllocKind kind) const { - return backgroundFinalizeState[kind] == BFS_DONE; + return backgroundFinalizeState[kind] == BFS_DONE || + backgroundFinalizeState[kind] == BFS_JUST_FINISHED; } /* @@ -333,16 +415,18 @@ struct ArenaLists { JS_ASSERT(freeLists[kind].isEmpty()); } - void finalizeObjects(FreeOp *fop); - void finalizeStrings(FreeOp *fop); - void finalizeShapes(FreeOp *fop); - void finalizeScripts(FreeOp *fop); + void queueObjectsForSweep(FreeOp *fop); + void queueStringsForSweep(FreeOp *fop); + void queueShapesForSweep(FreeOp *fop); + void queueScriptsForSweep(FreeOp *fop); - static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead); + bool foregroundFinalize(FreeOp *fop, AllocKind thingKind, SliceBudget &sliceBudget); + static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgroundThread); private: inline void finalizeNow(FreeOp *fop, AllocKind thingKind); - inline void finalizeLater(FreeOp *fop, AllocKind thingKind); + inline void queueForForegroundSweep(FreeOp *fop, AllocKind thingKind); + inline void queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind); inline void *allocateFromArena(JSCompartment *comp, AllocKind thingKind); }; @@ -478,7 +562,7 @@ extern void GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); extern void -GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); +GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason, int64_t millis = 0); extern void GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); @@ -539,8 +623,6 @@ class GCHelperThread { void **freeCursor; void **freeCursorEnd; - Vector finalizeVector; - bool backgroundAllocation; friend struct js::gc::ArenaLists; @@ -584,10 +666,10 @@ class GCHelperThread { /* Must be called with the GC lock taken. */ void startBackgroundShrink(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepEnd(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepOrAllocEnd(); /* Must be called with the GC lock taken. */ @@ -625,9 +707,6 @@ class GCHelperThread { else replenishAndFreeLater(ptr); } - - /* Must be called with the GC lock taken. */ - bool prepareForBackgroundSweep(); }; @@ -1071,22 +1150,33 @@ RunDebugGC(JSContext *cx); void SetDeterministicGC(JSContext *cx, bool enabled); +void +SetValidateGC(JSContext *cx, bool enabled); + const int ZealPokeValue = 1; const int ZealAllocValue = 2; const int ZealFrameGCValue = 3; -const int ZealVerifierValue = 4; -const int ZealFrameVerifierValue = 5; +const int ZealVerifierPreValue = 4; +const int ZealFrameVerifierPreValue = 5; const int ZealStackRootingSafeValue = 6; const int ZealStackRootingValue = 7; const int ZealIncrementalRootsThenFinish = 8; const int ZealIncrementalMarkAllThenFinish = 9; const int ZealIncrementalMultipleSlices = 10; +const int ZealVerifierPostValue = 11; +const int ZealFrameVerifierPostValue = 12; +const int ZealPurgeAnalysisValue = 13; + +enum VerifierType { + PreBarrierVerifier, + PostBarrierVerifier +}; #ifdef JS_GC_ZEAL /* Check that write barriers have been used correctly. See jsgc.cpp. */ void -VerifyBarriers(JSRuntime *rt); +VerifyBarriers(JSRuntime *rt, VerifierType type); void MaybeVerifyBarriers(JSContext *cx, bool always = false); @@ -1094,7 +1184,7 @@ MaybeVerifyBarriers(JSContext *cx, bool always = false); #else static inline void -VerifyBarriers(JSRuntime *rt) +VerifyBarriers(JSRuntime *rt, VerifierType type) { } diff --git a/scripting/javascript/spidermonkey-android/include/jshash.h b/scripting/javascript/spidermonkey-android/include/jshash.h deleted file mode 100644 index 2b9f8a9e39..0000000000 --- a/scripting/javascript/spidermonkey-android/include/jshash.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef jshash_h___ -#define jshash_h___ - -/* - * API to portable hash table code. - */ -#include -#include -#include "jstypes.h" - -JS_BEGIN_EXTERN_C - -typedef uint32_t JSHashNumber; -typedef struct JSHashEntry JSHashEntry; -typedef struct JSHashTable JSHashTable; - -#define JS_HASH_BITS 32 -#define JS_GOLDEN_RATIO 0x9E3779B9U - -typedef JSHashNumber (* JSHashFunction)(const void *key); -typedef int (* JSHashComparator)(const void *v1, const void *v2); -typedef int (* JSHashEnumerator)(JSHashEntry *he, int i, void *arg); - -/* Flag bits in JSHashEnumerator's return value */ -#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */ -#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */ -#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */ - -typedef struct JSHashAllocOps { - void * (*allocTable)(void *pool, size_t size); - void (*freeTable)(void *pool, void *item, size_t size); - JSHashEntry * (*allocEntry)(void *pool, const void *key); - void (*freeEntry)(void *pool, JSHashEntry *he, unsigned flag); -} JSHashAllocOps; - -#define HT_FREE_VALUE 0 /* just free the entry's value */ -#define HT_FREE_ENTRY 1 /* free value and entire entry */ - -struct JSHashEntry { - JSHashEntry *next; /* hash chain linkage */ - JSHashNumber keyHash; /* key hash function result */ - const void *key; /* ptr to opaque key */ - void *value; /* ptr to opaque value */ -}; - -struct JSHashTable { - JSHashEntry **buckets; /* vector of hash buckets */ - uint32_t nentries; /* number of entries in table */ - uint32_t shift; /* multiplicative hash shift */ - JSHashFunction keyHash; /* key hash function */ - JSHashComparator keyCompare; /* key comparison function */ - JSHashComparator valueCompare; /* value comparison function */ - JSHashAllocOps *allocOps; /* allocation operations */ - void *allocPriv; /* allocation private data */ -#ifdef JS_HASHMETER - uint32_t nlookups; /* total number of lookups */ - uint32_t nsteps; /* number of hash chains traversed */ - uint32_t ngrows; /* number of table expansions */ - uint32_t nshrinks; /* number of table contractions */ -#endif -}; - -/* - * Create a new hash table. - * If allocOps is null, use default allocator ops built on top of malloc(). - */ -extern JS_PUBLIC_API(JSHashTable *) -JS_NewHashTable(uint32_t n, JSHashFunction keyHash, - JSHashComparator keyCompare, JSHashComparator valueCompare, - JSHashAllocOps *allocOps, void *allocPriv); - -extern JS_PUBLIC_API(void) -JS_HashTableDestroy(JSHashTable *ht); - -/* Low level access methods */ -extern JS_PUBLIC_API(JSHashEntry **) -JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key); - -#ifdef __cplusplus -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep, JSHashNumber keyHash, - const void *key, void *value); -#endif - -extern JS_PUBLIC_API(void) -JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he); - -/* Higher level access methods */ -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableAdd(JSHashTable *ht, const void *key, void *value); - -extern JS_PUBLIC_API(JSBool) -JS_HashTableRemove(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg); - -extern JS_PUBLIC_API(void *) -JS_HashTableLookup(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp); - -/* General-purpose C string hash function. */ -extern JS_PUBLIC_API(JSHashNumber) -JS_HashString(const void *key); - -/* Stub function just returns v1 == v2 */ -extern JS_PUBLIC_API(int) -JS_CompareValues(const void *v1, const void *v2); - -JS_END_EXTERN_C - -#endif /* jshash_h___ */ diff --git a/scripting/javascript/spidermonkey-android/include/jslock.h b/scripting/javascript/spidermonkey-android/include/jslock.h index 15a0e73806..b5202cb32c 100644 --- a/scripting/javascript/spidermonkey-android/include/jslock.h +++ b/scripting/javascript/spidermonkey-android/include/jslock.h @@ -16,10 +16,10 @@ # include "prthread.h" # include "prinit.h" -# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((PRInt32 *)(p), (PRInt32)(v)) -# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((PRInt32 *)(p), (PRInt32)(v)) +# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((int32_t *)(p)) +# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((int32_t *)(p)) +# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((int32_t *)(p), (int32_t)(v)) +# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v)) #else /* JS_THREADSAFE */ diff --git a/scripting/javascript/spidermonkey-android/include/json.h b/scripting/javascript/spidermonkey-android/include/json.h index af11f9f89c..69b0072d3f 100644 --- a/scripting/javascript/spidermonkey-android/include/json.h +++ b/scripting/javascript/spidermonkey-android/include/json.h @@ -7,6 +7,7 @@ #include "jsprvtd.h" #include "jspubtd.h" +#include "jsapi.h" #include "js/Vector.h" @@ -18,7 +19,7 @@ js_InitJSONClass(JSContext *cx, JSObject *obj); extern JSBool js_Stringify(JSContext *cx, js::MutableHandleValue vp, - JSObject *replacer, js::Value space, + JSObject *replacer, js::Value space, js::StringBuffer &sb); // Avoid build errors on certain platforms that define these names as constants @@ -37,8 +38,8 @@ enum DecodingMode { STRICT, LEGACY }; namespace js { extern JS_FRIEND_API(JSBool) -ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, const Value &filter, - Value *vp, DecodingMode decodingMode = STRICT); +ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleValue filter, + MutableHandleValue vp, DecodingMode decodingMode = STRICT); } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-android/include/jsperf.h b/scripting/javascript/spidermonkey-android/include/jsperf.h index 0438bc518e..265478c33e 100644 --- a/scripting/javascript/spidermonkey-android/include/jsperf.h +++ b/scripting/javascript/spidermonkey-android/include/jsperf.h @@ -115,7 +115,7 @@ class JS_FRIEND_API(PerfMeasurement) * global object). The JS-visible API is identical to the C++ API. */ extern JS_FRIEND_API(JSObject*) - RegisterPerfMeasurement(JSContext *cx, JSObject *global); + RegisterPerfMeasurement(JSContext *cx, JSRawObject global); /* * Given a jsval which contains an instance of the aforementioned diff --git a/scripting/javascript/spidermonkey-android/include/jsproto.tbl b/scripting/javascript/spidermonkey-android/include/jsproto.tbl index 5e37999fac..ff357bda7d 100644 --- a/scripting/javascript/spidermonkey-android/include/jsproto.tbl +++ b/scripting/javascript/spidermonkey-android/include/jsproto.tbl @@ -64,6 +64,7 @@ JS_PROTO(WeakMap, 36, js_InitWeakMapClass) JS_PROTO(Map, 37, js_InitMapClass) JS_PROTO(Set, 38, js_InitSetClass) JS_PROTO(DataView, 39, js_InitTypedArrayClasses) +JS_PROTO(ParallelArray, 40, js_InitParallelArrayClass) #undef XML_INIT #undef NAMESPACE_INIT diff --git a/scripting/javascript/spidermonkey-android/include/jsproxy.h b/scripting/javascript/spidermonkey-android/include/jsproxy.h index 5fd5848377..aaf9de45e7 100644 --- a/scripting/javascript/spidermonkey-android/include/jsproxy.h +++ b/scripting/javascript/spidermonkey-android/include/jsproxy.h @@ -13,7 +13,7 @@ namespace js { -class Wrapper; +class JS_FRIEND_API(Wrapper); /* * A proxy is a JSObject that implements generic behavior by providing custom @@ -48,10 +48,19 @@ class Wrapper; */ class JS_FRIEND_API(BaseProxyHandler) { void *mFamily; + bool mHasPrototype; + protected: + // Subclasses may set this in their constructor. + void setHasPrototype(bool hasPrototype) { mHasPrototype = hasPrototype; }; + public: explicit BaseProxyHandler(void *family); virtual ~BaseProxyHandler(); + bool hasPrototype() { + return mHasPrototype; + } + inline void *family() { return mFamily; } @@ -102,7 +111,7 @@ class JS_FRIEND_API(BaseProxyHandler) { /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -114,6 +123,10 @@ class JS_FRIEND_API(BaseProxyHandler) { virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp, bool *present); + virtual bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **proto); + + /* See comment for weakmapKeyDelegateOp in jsclass.h. */ + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -150,8 +163,8 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, - Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; @@ -166,6 +179,7 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp) MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -215,18 +229,18 @@ class Proxy { /* ES5 Harmony derived proxy traps. */ static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); - static bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp); - static bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver, - uint32_t index, Value *vp, bool *present); - static bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, - Value *vp); + static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp); + static bool getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver, + uint32_t index, MutableHandleValue vp, bool *present); + static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, + MutableHandleValue vp); static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); - static bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp); + static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); /* Spidermonkey extensions. */ static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - static bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); static bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); static JSType typeOf(JSContext *cx, JSObject *proxy); static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -247,17 +261,17 @@ inline bool IsFunctionProxyClass(const Class *clasp) return clasp == &js::FunctionProxyClass; } -inline bool IsObjectProxy(const JSObject *obj) +inline bool IsObjectProxy(RawObject obj) { return IsObjectProxyClass(GetObjectClass(obj)); } -inline bool IsFunctionProxy(const JSObject *obj) +inline bool IsFunctionProxy(RawObject obj) { return IsFunctionProxyClass(GetObjectClass(obj)); } -inline bool IsProxy(const JSObject *obj) +inline bool IsProxy(RawObject obj) { Class *clasp = GetObjectClass(obj); return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); @@ -272,56 +286,56 @@ const uint32_t JSSLOT_PROXY_CALL = 4; const uint32_t JSSLOT_PROXY_CONSTRUCT = 5; inline BaseProxyHandler * -GetProxyHandler(const JSObject *obj) +GetProxyHandler(RawObject obj) { JS_ASSERT(IsProxy(obj)); return (BaseProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER).toPrivate(); } inline const Value & -GetProxyPrivate(const JSObject *obj) +GetProxyPrivate(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE); } inline JSObject * -GetProxyTargetObject(const JSObject *obj) +GetProxyTargetObject(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetProxyPrivate(obj).toObjectOrNull(); } inline const Value & -GetProxyCall(const JSObject *obj) +GetProxyCall(RawObject obj) { JS_ASSERT(IsFunctionProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_CALL); } inline const Value & -GetProxyExtra(const JSObject *obj, size_t n) +GetProxyExtra(RawObject obj, size_t n) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n); } inline void -SetProxyHandler(JSObject *obj, BaseProxyHandler *handler) +SetProxyHandler(RawObject obj, BaseProxyHandler *handler) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); } inline void -SetProxyPrivate(JSObject *obj, const Value &value) +SetProxyPrivate(RawObject obj, const Value &value) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value); } inline void -SetProxyExtra(JSObject *obj, size_t n, const Value &extra) +SetProxyExtra(RawObject obj, size_t n, const Value &extra) { JS_ASSERT(IsProxy(obj)); JS_ASSERT(n <= 1); diff --git a/scripting/javascript/spidermonkey-android/include/jsprvtd.h b/scripting/javascript/spidermonkey-android/include/jsprvtd.h index 19b5aef3c2..f41d05d37f 100644 --- a/scripting/javascript/spidermonkey-android/include/jsprvtd.h +++ b/scripting/javascript/spidermonkey-android/include/jsprvtd.h @@ -82,7 +82,6 @@ class JSExtensibleString; class JSExternalString; class JSLinearString; class JSFixedString; -class JSStaticAtom; class JSRope; class JSAtom; class JSWrapper; @@ -131,24 +130,10 @@ class StackSpace; class ContextStack; class ScriptFrameIter; -struct BytecodeEmitter; -struct Definition; -struct FunctionBox; -struct ObjectBox; -struct ParseNode; -struct Parser; -struct SharedContext; -class TokenStream; -struct Token; -struct TokenPos; -struct TokenPtr; -struct TreeContext; -class UpvarCookie; - class Proxy; -class BaseProxyHandler; -class DirectWrapper; -class CrossCompartmentWrapper; +class JS_FRIEND_API(BaseProxyHandler); +class JS_FRIEND_API(DirectWrapper); +class JS_FRIEND_API(CrossCompartmentWrapper); class TempAllocPolicy; class RuntimeAllocPolicy; @@ -172,13 +157,6 @@ class Bindings; struct StackBaseShape; struct StackShape; -class MultiDeclRange; -class ParseMapPool; -class DefinitionList; -typedef InlineMap AtomDefnMap; -typedef InlineMap AtomIndexMap; -typedef Vector UpvarCookies; - class Breakpoint; class BreakpointSite; class Debugger; @@ -197,6 +175,22 @@ typedef JSPropertyOp PropertyOp; typedef JSStrictPropertyOp StrictPropertyOp; typedef JSPropertyDescriptor PropertyDescriptor; +namespace frontend { + +struct BytecodeEmitter; +struct Definition; +struct FunctionBox; +struct ObjectBox; +struct Token; +struct TokenPos; +struct TokenPtr; +class TokenStream; +struct Parser; +class ParseMapPool; +struct ParseNode; + +} /* namespace frontend */ + namespace analyze { struct LifetimeVariable; diff --git a/scripting/javascript/spidermonkey-android/include/jspubtd.h b/scripting/javascript/spidermonkey-android/include/jspubtd.h index 45864ca0d6..a154b9ceed 100644 --- a/scripting/javascript/spidermonkey-android/include/jspubtd.h +++ b/scripting/javascript/spidermonkey-android/include/jspubtd.h @@ -240,6 +240,21 @@ enum ThingRootKind THING_ROOT_LIMIT }; +template +struct RootKind; + +/* + * Specifically mark the ThingRootKind of externally visible types, so that + * JSAPI users may use JSRooted... types without having the class definition + * available. + */ +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_STRING; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_SCRIPT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_ID; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_VALUE; }; }; + struct ContextFriendFields { JSRuntime *const runtime; diff --git a/scripting/javascript/spidermonkey-android/include/jstypes.h b/scripting/javascript/spidermonkey-android/include/jstypes.h index 8f0489f6f0..d0cf183e0f 100644 --- a/scripting/javascript/spidermonkey-android/include/jstypes.h +++ b/scripting/javascript/spidermonkey-android/include/jstypes.h @@ -147,8 +147,6 @@ ***********************************************************************/ #define JS_HOWMANY(x,y) (((x)+(y)-1)/(y)) #define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y)) -#define JS_MIN(x,y) ((x)<(y)?(x):(y)) -#define JS_MAX(x,y) ((x)>(y)?(x):(y)) #include "jscpucfg.h" diff --git a/scripting/javascript/spidermonkey-android/include/jsutil.h b/scripting/javascript/spidermonkey-android/include/jsutil.h index 10debde90b..8838b6f70b 100644 --- a/scripting/javascript/spidermonkey-android/include/jsutil.h +++ b/scripting/javascript/spidermonkey-android/include/jsutil.h @@ -15,6 +15,10 @@ #include "js/Utility.h" +#ifdef USE_ZLIB +#include "zlib.h" +#endif + /* Forward declarations. */ struct JSContext; @@ -335,41 +339,43 @@ ClearAllBitArrayElements(size_t *array, size_t length) array[i] = 0; } -} /* namespace js */ -#endif /* __cplusplus */ +#ifdef USE_ZLIB +class Compressor +{ + /* Number of bytes we should hand to zlib each compressMore() call. */ + static const size_t CHUNKSIZE = 2048; + z_stream zs; + const unsigned char *inp; + size_t inplen; + public: + Compressor(const unsigned char *inp, size_t inplen, unsigned char *out) + : inp(inp), + inplen(inplen) + { + JS_ASSERT(inplen > 0); + zs.opaque = NULL; + zs.next_in = (Bytef *)inp; + zs.avail_in = 0; + zs.next_out = out; + zs.avail_out = inplen; + } + bool init(); + /* Compress some of the input. Return true if it should be called again. */ + bool compressMore(); + /* Finalize compression. Return the length of the compressed input. */ + size_t finish(); +}; /* - * JS_ROTATE_LEFT32 - * - * There is no rotate operation in the C Language so the construct (a << 4) | - * (a >> 28) is used instead. Most compilers convert this to a rotate - * instruction but some versions of MSVC don't without a little help. To get - * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic - * and use a pragma to make _rotl inline. - * - * MSVC in VS2005 will do an inline rotate instruction on the above construct. + * Decompress a string. The caller must know the length of the output and + * allocate |out| to a string of that length. */ -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ - defined(_M_X64)) -#include -#pragma intrinsic(_rotl) -#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) -#else -#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +bool DecompressString(const unsigned char *inp, size_t inplen, + unsigned char *out, size_t outlen); #endif -/* Static control-flow checks. */ -#ifdef NS_STATIC_CHECKING -/* Trigger a control flow check to make sure that code flows through label */ -inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {} - -/* Avoid unused goto-label warnings. */ -# define MUST_FLOW_LABEL(label) goto label; label: - -#else -# define MUST_FLOW_THROUGH(label) ((void) 0) -# define MUST_FLOW_LABEL(label) -#endif +} /* namespace js */ +#endif /* __cplusplus */ /* Crash diagnostics */ #ifdef DEBUG diff --git a/scripting/javascript/spidermonkey-android/include/jsval.h b/scripting/javascript/spidermonkey-android/include/jsval.h index 2ee90a8e4f..187f1b9627 100644 --- a/scripting/javascript/spidermonkey-android/include/jsval.h +++ b/scripting/javascript/spidermonkey-android/include/jsval.h @@ -218,6 +218,7 @@ typedef enum JSWhyMagic JS_OVERWRITTEN_CALLEE, /* arguments.callee has been overwritten */ JS_FORWARD_TO_CALL_OBJECT, /* args object element stored in call object */ JS_BLOCK_NEEDS_CLONE, /* value of static block object slot */ + JS_HASH_KEY_EMPTY, /* see class js::HashableValue */ JS_GENERIC_MAGIC /* for local use */ } JSWhyMagic; diff --git a/scripting/javascript/spidermonkey-android/include/jswrapper.h b/scripting/javascript/spidermonkey-android/include/jswrapper.h index aa0e80ad16..2af181b74a 100644 --- a/scripting/javascript/spidermonkey-android/include/jswrapper.h +++ b/scripting/javascript/spidermonkey-android/include/jswrapper.h @@ -64,9 +64,9 @@ class JS_FRIEND_API(Wrapper) static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent, Wrapper *handler); - static Wrapper *wrapperHandler(const JSObject *wrapper); + static Wrapper *wrapperHandler(RawObject wrapper); - static JSObject *wrappedObject(const JSObject *wrapper); + static JSObject *wrappedObject(RawObject wrapper); explicit Wrapper(unsigned flags); @@ -166,7 +166,7 @@ class JS_FRIEND_API(IndirectWrapper) : public Wrapper, class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler { public: - explicit DirectWrapper(unsigned flags); + explicit DirectWrapper(unsigned flags, bool hasPrototype = false); virtual ~DirectWrapper(); @@ -206,7 +206,8 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -214,6 +215,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler Value *vp) MOZ_OVERRIDE; static DirectWrapper singleton; + static DirectWrapper singletonWithPrototype; static void *getWrapperFamily(); }; @@ -222,7 +224,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper { public: - CrossCompartmentWrapper(unsigned flags); + CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false); virtual ~CrossCompartmentWrapper(); @@ -249,7 +251,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -258,6 +261,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp); static CrossCompartmentWrapper singleton; + static CrossCompartmentWrapper singletonWithPrototype; }; /* @@ -275,7 +279,8 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: SecurityWrapper(unsigned flags); - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g) MOZ_OVERRIDE; }; @@ -283,25 +288,6 @@ class JS_FRIEND_API(SecurityWrapper) : public Base typedef SecurityWrapper SameCompartmentSecurityWrapper; typedef SecurityWrapper CrossCompartmentSecurityWrapper; -/* - * A hacky class that lets a friend force a fake frame. We must already be - * in the compartment of |target| when we enter the forced frame. - */ -class JS_FRIEND_API(ForceFrame) -{ - public: - JSContext * const context; - JSObject * const target; - private: - DummyFrameGuard *frame; - - public: - ForceFrame(JSContext *cx, JSObject *target); - ~ForceFrame(); - bool enter(); -}; - - class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler { public: @@ -323,7 +309,8 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); virtual JSString *obj_toString(JSContext *cx, JSObject *proxy); @@ -347,7 +334,7 @@ TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedProto, J extern JS_FRIEND_DATA(int) sWrapperFamily; inline bool -IsWrapper(const JSObject *obj) +IsWrapper(RawObject obj) { return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamily; } @@ -366,8 +353,13 @@ UnwrapObject(JSObject *obj, bool stopAtOuter = true, unsigned *flagsp = NULL); JS_FRIEND_API(JSObject *) UnwrapObjectChecked(JSContext *cx, JSObject *obj); +// Unwrap only the outermost security wrapper, with the same semantics as +// above. This is the checked version of Wrapper::wrappedObject. +JS_FRIEND_API(JSObject *) +UnwrapOneChecked(JSContext *cx, JSObject *obj); + JS_FRIEND_API(bool) -IsCrossCompartmentWrapper(const JSObject *obj); +IsCrossCompartmentWrapper(RawObject obj); JSObject * NewDeadProxyObject(JSContext *cx, JSObject *parent); @@ -384,37 +376,6 @@ RemapAllWrappersForObject(JSContext *cx, JSObject *oldTarget, // API to recompute all cross-compartment wrappers whose source and target // match the given filters. -// -// These filters are designed to be ephemeral stack classes, and thus don't -// do any rooting or holding of their members. -struct CompartmentFilter { - virtual bool match(JSCompartment *c) const = 0; -}; - -struct AllCompartments : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { return true; } -}; - -struct ContentCompartmentsOnly : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { - return !IsSystemCompartment(c); - } -}; - -struct SingleCompartment : public CompartmentFilter { - JSCompartment *ours; - SingleCompartment(JSCompartment *c) : ours(c) {} - virtual bool match(JSCompartment *c) const { return c == ours; } -}; - -struct CompartmentsWithPrincipals : public CompartmentFilter { - JSPrincipals *principals; - CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} - virtual bool match(JSCompartment *c) const { - return JS_GetCompartmentPrincipals(c) == principals; - } -}; - JS_FRIEND_API(bool) RecomputeWrappers(JSContext *cx, const CompartmentFilter &sourceFilter, const CompartmentFilter &targetFilter); diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/Attributes.h b/scripting/javascript/spidermonkey-android/include/mozilla/Attributes.h index 0cfcd60336..6b4e81612c 100644 --- a/scripting/javascript/spidermonkey-android/include/mozilla/Attributes.h +++ b/scripting/javascript/spidermonkey-android/include/mozilla/Attributes.h @@ -70,6 +70,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_FINAL final # endif +# if __has_extension(cxx_strong_enums) +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS +# endif # if __has_attribute(noinline) # define MOZ_HAVE_NEVER_INLINE __attribute__((noinline)) # endif @@ -89,6 +93,8 @@ # endif # if __GNUC_MINOR__ >= 4 # define MOZ_HAVE_CXX11_DELETE +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # endif # else @@ -108,6 +114,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE /* MSVC currently spells "final" as "sealed". */ # define MOZ_HAVE_CXX11_FINAL sealed +# define MOZ_HAVE_CXX11_ENUM_TYPE +# endif +# if _MSC_VER >= 1700 +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # define MOZ_HAVE_NEVER_INLINE __declspec(noinline) # define MOZ_HAVE_NORETURN __declspec(noreturn) @@ -298,6 +308,167 @@ # define MOZ_FINAL /* no support */ #endif +/** + * MOZ_ENUM_TYPE specifies the underlying numeric type for an enum. It's + * specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name in + * its declaration, and before the opening curly brace, like + * + * enum MyEnum MOZ_ENUM_TYPE(uint16_t) + * { + * A, + * B = 7, + * C + * }; + * + * In supporting compilers, the macro will expand to ": uint16_t". The + * compiler will allocate exactly two bytes for MyEnum, and will require all + * enumerators to have values between 0 and 65535. (Thus specifying "B = + * 100000" instead of "B = 7" would fail to compile.) In old compilers, the + * macro expands to the empty string, and the underlying type is generally + * undefined. + */ +#ifdef MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_ENUM_TYPE(type) : type +#else +# define MOZ_ENUM_TYPE(type) /* no support */ +#endif + +/** + * MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the + * strongly-typed enumeration feature of C++11 ("enum class"). If supported + * by the compiler, an enum defined using these macros will not be implicitly + * converted to any other type, and its enumerators will be scoped using the + * enumeration name. Place MOZ_BEGIN_ENUM_CLASS(EnumName, type) in place of + * "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the closing + * "};". For example, + * + * MOZ_BEGIN_ENUM_CLASS(Enum, int32_t) + * A, B = 6 + * MOZ_END_ENUM_CLASS(Enum) + * + * This will make "Enum::A" and "Enum::B" appear in the global scope, but "A" + * and "B" will not. In compilers that support C++11 strongly-typed + * enumerations, implicit conversions of Enum values to numeric types will + * fail. In other compilers, Enum itself will actually be defined as a class, + * and some implicit conversions will fail while others will succeed. + * + * The type argument specifies the underlying type for the enum where + * supported, as with MOZ_ENUM_TYPE(). For simplicity, it is currently + * mandatory. As with MOZ_ENUM_TYPE(), it will do nothing on compilers that do + * not support it. + */ +#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) + /* All compilers that support strong enums also support an explicit + * underlying type, so no extra check is needed */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) enum class Name : type { +# define MOZ_END_ENUM_CLASS(Name) }; +#else + /** + * We need Name to both name a type, and scope the provided enumerator + * names. Namespaces and classes both provide scoping, but namespaces + * aren't types, so we need to use a class that wraps the enum values. We + * have an implicit conversion from the inner enum type to the class, so + * statements like + * + * Enum x = Enum::A; + * + * will still work. We need to define an implicit conversion from the class + * to the inner enum as well, so that (for instance) switch statements will + * work. This means that the class can be implicitly converted to a numeric + * value as well via the enum type, since C++ allows an implicit + * user-defined conversion followed by a standard conversion to still be + * implicit. + * + * We have an explicit constructor from int defined, so that casts like + * (Enum)7 will still work. We also have a zero-argument constructor with + * no arguments, so declaration without initialization (like "Enum foo;") + * will work. + * + * Additionally, we'll delete as many operators as possible for the inner + * enum type, so statements like this will still fail: + * + * f(5 + Enum::B); // deleted operator+ + * + * But we can't prevent things like this, because C++ doesn't allow + * overriding conversions or assignment operators for enums: + * + * int x = Enum::A; + * int f() + * { + * return Enum::A; + * } + */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) \ + class Name \ + { \ + public: \ + enum Enum MOZ_ENUM_TYPE(type) \ + { +# define MOZ_END_ENUM_CLASS(Name) \ + }; \ + Name() {} \ + Name(Enum aEnum) : mEnum(aEnum) {} \ + explicit Name(int num) : mEnum((Enum)num) {} \ + operator Enum() const { return mEnum; } \ + private: \ + Enum mEnum; \ + }; \ + inline int operator+(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator-(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator*(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator*(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator/(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator/(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator%(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator%(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&) MOZ_DELETE; \ + inline int& operator++(Name::Enum&) MOZ_DELETE; \ + inline int operator++(Name::Enum&, int) MOZ_DELETE; \ + inline int& operator--(Name::Enum&) MOZ_DELETE; \ + inline int operator--(Name::Enum&, int) MOZ_DELETE; \ + inline bool operator==(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator==(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator!=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!(const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline bool operator||(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator||(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline int operator~(const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator|(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator|(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator^(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator^(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator<<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator<<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator>>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator>>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int& operator+=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator-=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator*=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator/=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator%=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator&=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator|=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator^=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator<<=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator>>=(int&, const Name::Enum&) MOZ_DELETE; +#endif + /** * MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's * return value is not used by the caller. diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/Constants.h b/scripting/javascript/spidermonkey-android/include/mozilla/Constants.h new file mode 100644 index 0000000000..904b30145a --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/mozilla/Constants.h @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt math constants. */ + +#ifndef mozilla_Constants_h_ +#define mozilla_Constants_h_ + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#endif /* mozilla_Constants_h_ */ diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/HashFunctions.h b/scripting/javascript/spidermonkey-android/include/mozilla/HashFunctions.h index 7a19749e55..badfc3c808 100644 --- a/scripting/javascript/spidermonkey-android/include/mozilla/HashFunctions.h +++ b/scripting/javascript/spidermonkey-android/include/mozilla/HashFunctions.h @@ -179,6 +179,14 @@ AddToHash(uint32_t hash, A* a) return detail::AddUintptrToHash(hash, uintptr_t(a)); } +template<> +MOZ_WARN_UNUSED_RESULT +inline uint32_t +AddToHash(uint32_t hash, uintptr_t a) +{ + return detail::AddUintptrToHash(hash, a); +} + template MOZ_WARN_UNUSED_RESULT uint32_t diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/MathAlgorithms.h b/scripting/javascript/spidermonkey-android/include/mozilla/MathAlgorithms.h new file mode 100644 index 0000000000..b545fa544b --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/mozilla/MathAlgorithms.h @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt maths algorithms. */ + +#ifndef mozilla_MathAlgorithms_h_ +#define mozilla_MathAlgorithms_h_ + +#include "mozilla/Assertions.h" + +namespace mozilla { + +// Greatest Common Divisor +template +MOZ_ALWAYS_INLINE IntegerType +EuclidGCD(IntegerType a, IntegerType b) +{ + // Euclid's algorithm; O(N) in the worst case. (There are better + // ways, but we don't need them for the current use of this algo.) + MOZ_ASSERT(a > 0); + MOZ_ASSERT(b > 0); + + while (a != b) { + if (a > b) { + a = a - b; + } else { + b = b - a; + } + } + + return a; +} + +// Least Common Multiple +template +MOZ_ALWAYS_INLINE IntegerType +EuclidLCM(IntegerType a, IntegerType b) +{ + // Divide first to reduce overflow risk. + return (a / EuclidGCD(a, b)) * b; +} + +} /* namespace mozilla */ + +#endif /* mozilla_MathAlgorithms_h_ */ diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/NullPtr.h b/scripting/javascript/spidermonkey-android/include/mozilla/NullPtr.h new file mode 100644 index 0000000000..e6fc892759 --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/mozilla/NullPtr.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Implements a workaround for compilers which do not support the C++11 nullptr + * constant. + */ + +#ifndef mozilla_NullPtr_h_ +#define mozilla_NullPtr_h_ + +#if defined(__clang__) +# ifndef __has_extension +# define __has_extension __has_feature +# endif +# if __has_extension(cxx_nullptr) +# define MOZ_HAVE_CXX11_NULLPTR +# endif +#elif defined(__GNUC__) +# if defined(_GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if (__GNUC__ * 1000 + __GNU_MINOR__) >= 4006 +# define MOZ_HAVE_CXX11_NULLPTR +# endif +# endif +#elif _MSC_VER >= 1600 +# define MOZ_HAVE_CXX11_NULLPTR +#endif + +/** + * Use C++11 nullptr if available; otherwise use __null for gcc, or a 0 literal + * with the correct size to match the size of a pointer on a given platform. + */ + +#ifndef MOZ_HAVE_CXX11_NULLPTR +# if defined(__GNUC__) +# define nullptr __null +# elif defined(_WIN64) +# define nullptr 0LL +# else +# define nullptr 0L +# endif +#endif + +#endif /* mozilla_NullPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/SHA1.h b/scripting/javascript/spidermonkey-android/include/mozilla/SHA1.h new file mode 100644 index 0000000000..fdb2150dc2 --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/mozilla/SHA1.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Simple class for computing SHA1. */ + +/* + * To compute the SHA1 of a buffer using this class you should write something + * like: + * void SHA1(const uint8_t* buf, unsigned size, uint8_t hash[20]) + * { + * SHA1Sum S; + * S.update(buf, size); + * S.finish(hash); + * } + * If there are multiple buffers or chunks, the update method can be called + * multiple times and the SHA1 is computed on the concatenation of all the + * buffers passed to it. + * The finish method may only be called once and cannot be followed by calls + * to update. + */ + +#ifndef mozilla_SHA1_h_ +#define mozilla_SHA1_h_ + +#include "mozilla/StandardInteger.h" +namespace mozilla { +class SHA1Sum { + union { + uint32_t w[16]; /* input buffer */ + uint8_t b[64]; + } u; + uint64_t size; /* count of hashed bytes. */ + unsigned H[22]; /* 5 state variables, 16 tmp values, 1 extra */ + bool mDone; + +public: + static const unsigned int HashSize = 20; + SHA1Sum(); + void update(const uint8_t *dataIn, uint32_t len); + void finish(uint8_t hashout[20]); +}; +} + +#endif /* mozilla_SHA1_h_ */ diff --git a/scripting/javascript/spidermonkey-android/include/mozilla/WeakPtr.h b/scripting/javascript/spidermonkey-android/include/mozilla/WeakPtr.h new file mode 100644 index 0000000000..e20767141e --- /dev/null +++ b/scripting/javascript/spidermonkey-android/include/mozilla/WeakPtr.h @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Weak pointer functionality, implemented as a mixin for use with any class. */ + +/** + * SupportsWeakPtr lets you have a pointer to an object 'Foo' without affecting + * its lifetime. It works by creating a single shared reference counted object + * (WeakReference) that each WeakPtr will access 'Foo' through. This lets 'Foo' + * clear the pointer in the WeakReference without having to know about all of + * the WeakPtrs to it and allows the WeakReference to live beyond the lifetime + * of 'Foo'. + * + * The overhead of WeakPtr is that accesses to 'Foo' becomes an additional + * dereference, and an additional heap allocated pointer sized object shared + * between all of the WeakPtrs. + * + * Example of usage: + * + * // To have a class C support weak pointers, inherit from SupportsWeakPtr. + * class C : public SupportsWeakPtr + * { + * public: + * int num; + * void act(); + * }; + * + * C* ptr = new C(); + * + * // Get weak pointers to ptr. The first time asWeakPtr is called + * // a reference counted WeakReference object is created that + * // can live beyond the lifetime of 'ptr'. The WeakReference + * // object will be notified of 'ptr's destruction. + * WeakPtr weak = ptr->asWeakPtr(); + * WeakPtr other = ptr->asWeakPtr(); + * + * // Test a weak pointer for validity before using it. + * if (weak) { + * weak->num = 17; + * weak->act(); + * } + * + * // Destroying the underlying object clears weak pointers to it. + * delete ptr; + * + * MOZ_ASSERT(!weak, "Deleting |ptr| clears weak pointers to it."); + * MOZ_ASSERT(!other, "Deleting |ptr| clears all weak pointers to it."); + * + * WeakPtr is typesafe and may be used with any class. It is not required that + * the class be reference-counted or allocated in any particular way. + * + * The API was loosely inspired by Chromium's weak_ptr.h: + * http://src.chromium.org/svn/trunk/src/base/memory/weak_ptr.h + */ + +#ifndef mozilla_WeakPtr_h_ +#define mozilla_WeakPtr_h_ + +#include "mozilla/Assertions.h" +#include "mozilla/NullPtr.h" +#include "mozilla/RefPtr.h" +#include "mozilla/TypeTraits.h" + +namespace mozilla { + +template class WeakPtr; + +template +class SupportsWeakPtr +{ + public: + WeakPtr asWeakPtr() { + if (!weakRef) + weakRef = new WeakReference(static_cast(this)); + return WeakPtr(weakRef); + } + + protected: + ~SupportsWeakPtr() { + MOZ_STATIC_ASSERT((IsBaseOf, T>::value), "T must derive from SupportsWeakPtr"); + if (weakRef) + weakRef->detach(); + } + + private: + friend class WeakPtr; + + // This can live beyond the lifetime of the class derived from SupportsWeakPtr. + class WeakReference : public RefCounted + { + public: + explicit WeakReference(T* ptr) : ptr(ptr) {} + T* get() const { + return ptr; + } + + private: + friend class WeakPtr; + friend class SupportsWeakPtr; + void detach() { + ptr = nullptr; + } + T* ptr; + }; + + RefPtr weakRef; +}; + +template +class WeakPtr +{ + public: + WeakPtr(const WeakPtr& o) : ref(o.ref) {} + WeakPtr() : ref(nullptr) {} + + operator T*() const { + return ref->get(); + } + T& operator*() const { + return *ref->get(); + } + + T* operator->() const { + return ref->get(); + } + + private: + friend class SupportsWeakPtr; + + explicit WeakPtr(const RefPtr::WeakReference> &o) : ref(o) {} + + RefPtr::WeakReference> ref; +}; + +} // namespace mozilla + +#endif /* ifdef mozilla_WeakPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-android/lib/libjs_static.a.REMOVED.git-id b/scripting/javascript/spidermonkey-android/lib/libjs_static.a.REMOVED.git-id index 6f6b44ff18..1c6eba37c5 100644 --- a/scripting/javascript/spidermonkey-android/lib/libjs_static.a.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-android/lib/libjs_static.a.REMOVED.git-id @@ -1 +1 @@ -4b6a92efb0e694d8aee845c9c7fcd1c2e63adab6 \ No newline at end of file +22a636cde41437897d9f7dbccdbcb871065f48ec \ No newline at end of file From 8edf9826b14e88c5e83a54549d9f4fe55d7859ea Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 10:40:42 +0800 Subject: [PATCH 56/95] issue #1537: Made samples/MoonWarriors/proj.android/build_native.sh executable. --- samples/MoonWarriors/proj.android/build_native.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 samples/MoonWarriors/proj.android/build_native.sh diff --git a/samples/MoonWarriors/proj.android/build_native.sh b/samples/MoonWarriors/proj.android/build_native.sh old mode 100644 new mode 100755 From 01866ddc95c70dd29055ba44a2a2cfe892ee18f6 Mon Sep 17 00:00:00 2001 From: YuLei Liao Date: Wed, 31 Oct 2012 11:02:36 +0800 Subject: [PATCH 57/95] fix win32 CCLuaLog memory leaks, and invalid Console UTF8 output --- cocos2dx/platform/win32/CCCommon.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/cocos2dx/platform/win32/CCCommon.cpp b/cocos2dx/platform/win32/CCCommon.cpp index 6beb9b83c8..85a5663dda 100644 --- a/cocos2dx/platform/win32/CCCommon.cpp +++ b/cocos2dx/platform/win32/CCCommon.cpp @@ -55,16 +55,21 @@ void CCMessageBox(const char * pszMsg, const char * pszTitle) void CCLuaLog(const char *pszMsg) { int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, NULL, 0); - ++bufflen; - WCHAR* buff = new WCHAR[bufflen]; - memset(buff, 0, sizeof(WCHAR) * bufflen); - MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, buff, bufflen - 1); + WCHAR* widebuff = new WCHAR[bufflen + 1]; + memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1)); + MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen); - OutputDebugStringW(buff); + OutputDebugStringW(widebuff); OutputDebugStringA("\n"); - puts(pszMsg); + bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, NULL, 0, NULL, NULL); + char* buff = new char[bufflen + 1]; + memset(buff, 0, sizeof(char) * (bufflen + 1)); + WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, NULL, NULL); + puts(buff); + + delete widebuff; + delete buff; } NS_CC_END - From b1ec3c8ab5f0463f4e10d90c060ef2f8887aa804 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 11:03:42 +0800 Subject: [PATCH 58/95] fixed #1537: Upgraded spidermonkey to FF17.0beta3 for win32 and iOS ports. --- .../spidermonkey-ios/include/gc/Barrier.h | 85 +++- .../spidermonkey-ios/include/gc/Heap.h | 77 +++- .../spidermonkey-ios/include/gc/Root.h | 84 +++- .../spidermonkey-ios/include/gc/Statistics.h | 20 +- .../spidermonkey-ios/include/gc/StoreBuffer.h | 398 ++++++++++++++++++ .../spidermonkey-ios/include/js-config.h | 1 - .../spidermonkey-ios/include/js.msg | 16 +- .../spidermonkey-ios/include/js/HashTable.h | 15 +- .../include/js/MemoryMetrics.h | 2 + .../spidermonkey-ios/include/js/Utility.h | 95 ++++- .../include/jsapi.h.REMOVED.git-id | 2 +- .../spidermonkey-ios/include/jsatom.h | 80 +--- .../spidermonkey-ios/include/jsatom.tbl | 6 +- .../spidermonkey-ios/include/jsclass.h | 47 ++- .../spidermonkey-ios/include/jsdbgapi.h | 6 - .../spidermonkey-ios/include/jsfriendapi.h | 315 +++++++++++--- .../spidermonkey-ios/include/jsgc.h | 178 ++++++-- .../spidermonkey-ios/include/jshash.h | 120 ------ .../spidermonkey-ios/include/jslock.h | 8 +- .../spidermonkey-ios/include/json.h | 7 +- .../spidermonkey-ios/include/jsperf.h | 2 +- .../spidermonkey-ios/include/jsproto.tbl | 1 + .../spidermonkey-ios/include/jsproxy.h | 58 ++- .../spidermonkey-ios/include/jsprvtd.h | 44 +- .../spidermonkey-ios/include/jspubtd.h | 15 + .../spidermonkey-ios/include/jstypes.h | 2 - .../spidermonkey-ios/include/jsutil.h | 66 +-- .../spidermonkey-ios/include/jsval.h | 1 + .../spidermonkey-ios/include/jswrapper.h | 81 +--- .../include/mozilla/Attributes.h | 171 ++++++++ .../include/mozilla/Constants.h | 15 + .../include/mozilla/HashFunctions.h | 8 + .../include/mozilla/MathAlgorithms.h | 47 +++ .../include/mozilla/NullPtr.h | 46 ++ .../spidermonkey-ios/include/mozilla/SHA1.h | 46 ++ .../include/mozilla/WeakPtr.h | 139 ++++++ .../lib/libjs_static.a.REMOVED.git-id | 2 +- .../spidermonkey-win32/include/ds/BitArray.h | 0 .../spidermonkey-win32/include/gc/Barrier.h | 85 +++- .../spidermonkey-win32/include/gc/Heap.h | 77 +++- .../spidermonkey-win32/include/gc/Root.h | 84 +++- .../include/gc/Statistics.h | 20 +- .../include/gc/StoreBuffer.h | 398 ++++++++++++++++++ .../spidermonkey-win32/include/js-config.h | 137 +++--- .../spidermonkey-win32/include/js.msg | 16 +- .../spidermonkey-win32/include/js/HashTable.h | 15 +- .../include/js/LegacyIntTypes.h | 0 .../include/js/MemoryMetrics.h | 2 + .../include/js/TemplateLib.h | 0 .../spidermonkey-win32/include/js/Utility.h | 95 ++++- .../spidermonkey-win32/include/js/Vector.h | 0 .../spidermonkey-win32/include/jsalloc.h | 0 .../include/jsapi.h.REMOVED.git-id | 2 +- .../spidermonkey-win32/include/jsatom.h | 80 +--- .../spidermonkey-win32/include/jsatom.tbl | 6 +- .../spidermonkey-win32/include/jsclass.h | 47 ++- .../spidermonkey-win32/include/jsclist.h | 0 .../spidermonkey-win32/include/jscpucfg.h | 0 .../spidermonkey-win32/include/jsdbgapi.h | 6 - .../spidermonkey-win32/include/jsdhash.h | 0 .../spidermonkey-win32/include/jsfriendapi.h | 315 +++++++++++--- .../spidermonkey-win32/include/jsgc.h | 178 ++++++-- .../spidermonkey-win32/include/jshash.h | 120 ------ .../spidermonkey-win32/include/jslock.h | 8 +- .../spidermonkey-win32/include/json.h | 7 +- .../spidermonkey-win32/include/jsperf.h | 2 +- .../spidermonkey-win32/include/jsprf.h | 0 .../spidermonkey-win32/include/jsproto.tbl | 1 + .../spidermonkey-win32/include/jsproxy.h | 58 ++- .../spidermonkey-win32/include/jsprvtd.h | 44 +- .../spidermonkey-win32/include/jspubtd.h | 15 + .../spidermonkey-win32/include/jstypes.h | 2 - .../spidermonkey-win32/include/jsutil.h | 66 +-- .../spidermonkey-win32/include/jsval.h | 1 + .../spidermonkey-win32/include/jsversion.h | 0 .../spidermonkey-win32/include/jswrapper.h | 81 +--- .../include/mozilla/Assertions.h | 0 .../include/mozilla/Attributes.h | 171 ++++++++ .../include/mozilla/BloomFilter.h | 0 .../include/mozilla/CheckedInt.h | 0 .../include/mozilla/Constants.h | 15 + .../include/mozilla/FloatingPoint.h | 0 .../include/mozilla/GuardObjects.h | 0 .../include/mozilla/HashFunctions.h | 8 + .../include/mozilla/Likely.h | 0 .../include/mozilla/LinkedList.h | 0 .../include/mozilla/MSStdInt.h | 0 .../include/mozilla/MathAlgorithms.h | 47 +++ .../include/mozilla/NullPtr.h | 46 ++ .../include/mozilla/RangedPtr.h | 0 .../include/mozilla/RefPtr.h | 0 .../spidermonkey-win32/include/mozilla/SHA1.h | 46 ++ .../include/mozilla/Scoped.h | 0 .../include/mozilla/StandardInteger.h | 0 .../include/mozilla/ThreadLocal.h | 0 .../include/mozilla/TypeTraits.h | 0 .../include/mozilla/Types.h | 0 .../spidermonkey-win32/include/mozilla/Util.h | 0 .../include/mozilla/WeakPtr.h | 139 ++++++ .../lib/mozjs.dll.REMOVED.git-id | 2 +- .../lib/mozjs.lib.REMOVED.git-id | 2 +- 101 files changed, 3597 insertions(+), 1153 deletions(-) create mode 100644 scripting/javascript/spidermonkey-ios/include/gc/StoreBuffer.h delete mode 100644 scripting/javascript/spidermonkey-ios/include/jshash.h create mode 100644 scripting/javascript/spidermonkey-ios/include/mozilla/Constants.h create mode 100644 scripting/javascript/spidermonkey-ios/include/mozilla/MathAlgorithms.h create mode 100644 scripting/javascript/spidermonkey-ios/include/mozilla/NullPtr.h create mode 100644 scripting/javascript/spidermonkey-ios/include/mozilla/SHA1.h create mode 100644 scripting/javascript/spidermonkey-ios/include/mozilla/WeakPtr.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/ds/BitArray.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/gc/Barrier.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/gc/Heap.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/gc/Root.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/gc/Statistics.h create mode 100755 scripting/javascript/spidermonkey-win32/include/gc/StoreBuffer.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js-config.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js.msg mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/HashTable.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/LegacyIntTypes.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/MemoryMetrics.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/TemplateLib.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/Utility.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/js/Vector.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsalloc.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsatom.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsatom.tbl mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsclass.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsclist.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jscpucfg.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsdbgapi.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsdhash.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsfriendapi.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsgc.h delete mode 100644 scripting/javascript/spidermonkey-win32/include/jshash.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jslock.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/json.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsperf.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsprf.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsproto.tbl mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsproxy.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsprvtd.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jspubtd.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jstypes.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsutil.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsval.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jsversion.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/jswrapper.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Assertions.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Attributes.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/BloomFilter.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/CheckedInt.h create mode 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Constants.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/FloatingPoint.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/GuardObjects.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/HashFunctions.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Likely.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/LinkedList.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/MSStdInt.h create mode 100755 scripting/javascript/spidermonkey-win32/include/mozilla/MathAlgorithms.h create mode 100755 scripting/javascript/spidermonkey-win32/include/mozilla/NullPtr.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/RangedPtr.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/RefPtr.h create mode 100755 scripting/javascript/spidermonkey-win32/include/mozilla/SHA1.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Scoped.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/StandardInteger.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/ThreadLocal.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/TypeTraits.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Types.h mode change 100644 => 100755 scripting/javascript/spidermonkey-win32/include/mozilla/Util.h create mode 100755 scripting/javascript/spidermonkey-win32/include/mozilla/WeakPtr.h diff --git a/scripting/javascript/spidermonkey-ios/include/gc/Barrier.h b/scripting/javascript/spidermonkey-ios/include/gc/Barrier.h index 08c8de8f0d..bd33c5d1d4 100644 --- a/scripting/javascript/spidermonkey-ios/include/gc/Barrier.h +++ b/scripting/javascript/spidermonkey-ios/include/gc/Barrier.h @@ -129,7 +129,7 @@ class EncapsulatedPtr public: EncapsulatedPtr() : value(NULL) {} - explicit EncapsulatedPtr(T *v) : value(v) {} + EncapsulatedPtr(T *v) : value(v) {} explicit EncapsulatedPtr(const EncapsulatedPtr &v) : value(v.value) {} ~EncapsulatedPtr() { pre(); } @@ -222,34 +222,51 @@ class RelocatablePtr : public EncapsulatedPtr { public: RelocatablePtr() : EncapsulatedPtr(NULL) {} - explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { post(); } - explicit RelocatablePtr(const RelocatablePtr &v) - : EncapsulatedPtr(v) { post(); } + explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { + if (v) + post(); + } + explicit RelocatablePtr(const RelocatablePtr &v) : EncapsulatedPtr(v) { + if (this->value) + post(); + } ~RelocatablePtr() { - this->pre(); - relocate(); + if (this->value) + relocate(this->value->compartment()); } RelocatablePtr &operator=(T *v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); - this->value = v; - post(); + if (v) { + this->value = v; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } RelocatablePtr &operator=(const RelocatablePtr &v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); - this->value = v.value; - post(); + if (v.value) { + this->value = v.value; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } protected: - void post() { T::writeBarrierRelocPost(this->value, (void *)&this->value); } - void relocate() { T::writeBarrierRelocated(this->value, (void *)&this->value); } + inline void post(); + inline void relocate(JSCompartment *comp); }; /* @@ -276,6 +293,9 @@ struct Shape; class BaseShape; namespace types { struct TypeObject; } +typedef EncapsulatedPtr EncapsulatedPtrObject; +typedef EncapsulatedPtr EncapsulatedPtrScript; + typedef RelocatablePtr RelocatablePtrObject; typedef RelocatablePtr RelocatablePtrScript; @@ -303,6 +323,19 @@ struct HeapPtrHasher template struct DefaultHasher< HeapPtr > : HeapPtrHasher { }; +template +struct EncapsulatedPtrHasher +{ + typedef EncapsulatedPtr Key; + typedef T *Lookup; + + static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } + static bool match(const Key &k, Lookup l) { return k.get() == l; } +}; + +template +struct DefaultHasher< EncapsulatedPtr > : EncapsulatedPtrHasher { }; + class EncapsulatedValue : public ValueOperations { protected: @@ -379,7 +412,7 @@ class RelocatableValue : public EncapsulatedValue public: explicit inline RelocatableValue(); explicit inline RelocatableValue(const Value &v); - explicit inline RelocatableValue(const RelocatableValue &v); + inline RelocatableValue(const RelocatableValue &v); inline ~RelocatableValue(); inline RelocatableValue &operator=(const Value &v); @@ -414,7 +447,7 @@ class HeapSlot : public EncapsulatedValue inline void set(JSCompartment *comp, JSObject *owner, uint32_t slot, const Value &v); static inline void writeBarrierPost(JSObject *obj, uint32_t slot); - static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slotno); + static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slot); private: inline void post(JSObject *owner, uint32_t slot); @@ -428,8 +461,19 @@ class HeapSlot : public EncapsulatedValue * single step. */ inline void -SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count) +SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count); + +/* + * This is a post barrier for HashTables whose key can be moved during a GC. + */ +template +inline void +HashTableWriteBarrierPost(JSCompartment *comp, const Map *map, const Key &key) { +#ifdef JS_GCGENERATIONAL + if (key && comp->gcNursery.isInside(key)) + comp->gcStoreBuffer.putGeneric(HashKeyRef(map, key)); +#endif } static inline const Value * @@ -467,15 +511,16 @@ class EncapsulatedId protected: jsid value; - explicit EncapsulatedId() : value(JSID_VOID) {} - explicit inline EncapsulatedId(jsid id) : value(id) {} - ~EncapsulatedId() {} - private: EncapsulatedId(const EncapsulatedId &v) MOZ_DELETE; - EncapsulatedId &operator=(const EncapsulatedId &v) MOZ_DELETE; public: + explicit EncapsulatedId() : value(JSID_VOID) {} + explicit EncapsulatedId(jsid id) : value(id) {} + ~EncapsulatedId(); + + inline EncapsulatedId &operator=(const EncapsulatedId &v); + bool operator==(jsid id) const { return value == id; } bool operator!=(jsid id) const { return value != id; } diff --git a/scripting/javascript/spidermonkey-ios/include/gc/Heap.h b/scripting/javascript/spidermonkey-ios/include/gc/Heap.h index 5e9b939c12..b8f8c78925 100644 --- a/scripting/javascript/spidermonkey-ios/include/gc/Heap.h +++ b/scripting/javascript/spidermonkey-ios/include/gc/Heap.h @@ -423,38 +423,47 @@ struct ArenaHeader * chunk. The latter allows to quickly check if the arena is allocated * during the conservative GC scanning without searching the arena in the * list. + * + * We use 8 bits for the allocKind so the compiler can use byte-level memory + * instructions to access it. */ size_t allocKind : 8; /* - * When recursive marking uses too much stack the marking is delayed and - * the corresponding arenas are put into a stack using the following field - * as a linkage. To distinguish the bottom of the stack from the arenas - * not present in the stack we use an extra flag to tag arenas on the - * stack. + * When collecting we sometimes need to keep an auxillary list of arenas, + * for which we use the following fields. This happens for several reasons: + * + * When recursive marking uses too much stack the marking is delayed and the + * corresponding arenas are put into a stack. To distinguish the bottom of + * the stack from the arenas not present in the stack we use the + * markOverflow flag to tag arenas on the stack. * * Delayed marking is also used for arenas that we allocate into during an * incremental GC. In this case, we intend to mark all the objects in the * arena, and it's faster to do this marking in bulk. * - * To minimize the ArenaHeader size we record the next delayed marking - * linkage as arenaAddress() >> ArenaShift and pack it with the allocKind - * field and hasDelayedMarking flag. We use 8 bits for the allocKind, not - * ArenaShift - 1, so the compiler can use byte-level memory instructions - * to access it. + * When sweeping we keep track of which arenas have been allocated since the + * end of the mark phase. This allows us to tell whether a pointer to an + * unmarked object is yet to be finalized or has already been reallocated. + * We set the allocatedDuringIncremental flag for this and clear it at the + * end of the sweep phase. + * + * To minimize the ArenaHeader size we record the next linkage as + * arenaAddress() >> ArenaShift and pack it with the allocKind field and the + * flags. */ public: size_t hasDelayedMarking : 1; size_t allocatedDuringIncremental : 1; size_t markOverflow : 1; - size_t nextDelayedMarking : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; + size_t auxNextLink : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; static void staticAsserts() { /* We must be able to fit the allockind into uint8_t. */ JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255); /* - * nextDelayedMarkingpacking assumes that ArenaShift has enough bits + * auxNextLink packing assumes that ArenaShift has enough bits * to cover allocKind and hasDelayedMarking. */ JS_STATIC_ASSERT(ArenaShift >= 8 + 1 + 1 + 1); @@ -487,7 +496,7 @@ struct ArenaHeader markOverflow = 0; allocatedDuringIncremental = 0; hasDelayedMarking = 0; - nextDelayedMarking = 0; + auxNextLink = 0; } inline uintptr_t arenaAddress() const; @@ -519,6 +528,11 @@ struct ArenaHeader inline ArenaHeader *getNextDelayedMarking() const; inline void setNextDelayedMarking(ArenaHeader *aheader); + inline void unsetDelayedMarking(); + + inline ArenaHeader *getNextAllocDuringSweep() const; + inline void setNextAllocDuringSweep(ArenaHeader *aheader); + inline void unsetAllocDuringSweep(); }; struct Arena @@ -882,15 +896,48 @@ ArenaHeader::setFirstFreeSpan(const FreeSpan *span) inline ArenaHeader * ArenaHeader::getNextDelayedMarking() const { - return &reinterpret_cast(nextDelayedMarking << ArenaShift)->aheader; + JS_ASSERT(hasDelayedMarking); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) { JS_ASSERT(!(uintptr_t(aheader) & ArenaMask)); + JS_ASSERT(!auxNextLink && !hasDelayedMarking); hasDelayedMarking = 1; - nextDelayedMarking = aheader->arenaAddress() >> ArenaShift; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetDelayedMarking() +{ + JS_ASSERT(hasDelayedMarking); + hasDelayedMarking = 0; + auxNextLink = 0; +} + +inline ArenaHeader * +ArenaHeader::getNextAllocDuringSweep() const +{ + JS_ASSERT(allocatedDuringIncremental); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; +} + +inline void +ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) +{ + JS_ASSERT(!auxNextLink && !allocatedDuringIncremental); + allocatedDuringIncremental = 1; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetAllocDuringSweep() +{ + JS_ASSERT(allocatedDuringIncremental); + allocatedDuringIncremental = 0; + auxNextLink = 0; } JS_ALWAYS_INLINE void diff --git a/scripting/javascript/spidermonkey-ios/include/gc/Root.h b/scripting/javascript/spidermonkey-ios/include/gc/Root.h index 4ada9966b8..551be92a8c 100644 --- a/scripting/javascript/spidermonkey-ios/include/gc/Root.h +++ b/scripting/javascript/spidermonkey-ios/include/gc/Root.h @@ -62,6 +62,7 @@ namespace JS { * separate rooting analysis. */ +template class MutableHandle; template class Rooted; template @@ -79,6 +80,9 @@ struct NullPtr static void * const constNullValue; }; +template +class MutableHandle; + template class HandleBase {}; @@ -108,6 +112,11 @@ class Handle : public HandleBase ptr = reinterpret_cast(&NullPtr::constNullValue); } + friend class MutableHandle; + Handle(MutableHandle handle) { + ptr = handle.address(); + } + /* * This may be called only if the location of the T is guaranteed * to be marked (for some reason other than being a Rooted), @@ -130,6 +139,12 @@ class Handle : public HandleBase Handle(Rooted &root, typename mozilla::EnableIf::value, int>::Type dummy = 0); + /* Construct a read only handle from a mutable handle. */ + template + inline + Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy = 0); + const T *address() const { return ptr; } T get() const { return *ptr; } @@ -185,6 +200,19 @@ class MutableHandle : public MutableHandleBase *ptr = v; } + /* + * This may be called only if the location of the T is guaranteed + * to be marked (for some reason other than being a Rooted), + * e.g., if it is guaranteed to be reachable from an implicit root. + * + * Create a MutableHandle from a raw location of a T. + */ + static MutableHandle fromMarkedLocation(T *p) { + MutableHandle h; + h.ptr = p; + return h; + } + T *address() const { return ptr; } T get() const { return *ptr; } @@ -195,16 +223,33 @@ class MutableHandle : public MutableHandleBase MutableHandle() {} T *ptr; + + template + void operator =(S v) MOZ_DELETE; }; typedef MutableHandle MutableHandleObject; typedef MutableHandle MutableHandleValue; +/* + * Raw pointer used as documentation that a parameter does not need to be + * rooted. + */ +typedef JSObject * RawObject; + +/* + * By default, pointers should use the inheritance hierarchy to find their + * ThingRootKind. Some pointer types are explicitly set in jspubtd.h so that + * Rooted may be used without the class definition being available. + */ +template +struct RootKind { static ThingRootKind rootKind() { return T::rootKind(); }; }; + template struct RootMethods { static T *initial() { return NULL; } - static ThingRootKind kind() { return T::rootKind(); } + static ThingRootKind kind() { return RootKind::rootKind(); } static bool poisoned(T *v) { return IsPoisonedPtr(v); } }; @@ -291,6 +336,14 @@ Handle::Handle(Rooted &root, ptr = reinterpret_cast(root.address()); } +template template +inline +Handle::Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy) +{ + ptr = reinterpret_cast(root.address()); +} + template template inline MutableHandle::MutableHandle(Rooted *root, @@ -332,15 +385,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - init(ContextFriendFields::get(cx), ptr, 1); - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { init(ContextFriendFields::get(cx), ptr, count); @@ -363,14 +408,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { JS_GUARD_OBJECT_NOTIFIER_INIT; @@ -381,6 +419,12 @@ class SkipRoot JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +/* + * This typedef is to annotate parameters that we have manually verified do not + * need rooting, as opposed to parameters that have not yet been considered. + */ +typedef JSObject *RawObject; + #ifdef DEBUG JS_FRIEND_API(bool) IsRootingUnnecessaryForContext(JSContext *cx); JS_FRIEND_API(void) SetRootingUnnecessaryForContext(JSContext *cx, bool value); @@ -389,14 +433,16 @@ JS_FRIEND_API(bool) RelaxRootChecksForContext(JSContext *cx); class AssertRootingUnnecessary { JS_DECL_USE_GUARD_OBJECT_NOTIFIER +#ifdef DEBUG JSContext *cx; bool prev; +#endif public: AssertRootingUnnecessary(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) - : cx(cx) { JS_GUARD_OBJECT_NOTIFIER_INIT; #ifdef DEBUG + this->cx = cx; prev = IsRootingUnnecessaryForContext(cx); SetRootingUnnecessaryForContext(cx, true); #endif diff --git a/scripting/javascript/spidermonkey-ios/include/gc/Statistics.h b/scripting/javascript/spidermonkey-ios/include/gc/Statistics.h index 5b4e355f0b..dfd00dbc94 100644 --- a/scripting/javascript/spidermonkey-ios/include/gc/Statistics.h +++ b/scripting/javascript/spidermonkey-ios/include/gc/Statistics.h @@ -80,6 +80,9 @@ struct Statistics { counts[s]++; } + int64_t beginSCC(); + void endSCC(unsigned scc, int64_t start); + jschar *formatMessage(); jschar *formatJSON(uint64_t timestamp); @@ -134,10 +137,14 @@ struct Statistics { /* Allocated space before the GC started. */ size_t preBytes; + /* Sweep times for SCCs of compartments. */ + Vector sccTimes; + void beginGC(); void endGC(); - int64_t gcDuration(); + void gcDuration(int64_t *total, int64_t *maxPause); + void sccDurations(int64_t *total, int64_t *maxPause); void printStats(); bool formatData(StatisticsSerializer &ss, uint64_t timestamp); @@ -168,6 +175,17 @@ struct AutoPhase { JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +struct AutoSCC { + AutoSCC(Statistics &stats, unsigned scc JS_GUARD_OBJECT_NOTIFIER_PARAM) + : stats(stats), scc(scc) { JS_GUARD_OBJECT_NOTIFIER_INIT; start = stats.beginSCC(); } + ~AutoSCC() { stats.endSCC(scc, start); } + + Statistics &stats; + unsigned scc; + int64_t start; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + } /* namespace gcstats */ } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-ios/include/gc/StoreBuffer.h b/scripting/javascript/spidermonkey-ios/include/gc/StoreBuffer.h new file mode 100644 index 0000000000..9240e93f10 --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/gc/StoreBuffer.h @@ -0,0 +1,398 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifdef JSGC_GENERATIONAL +#ifndef jsgc_storebuffer_h___ +#define jsgc_storebuffer_h___ + +#include "jsgc.h" +#include "jsalloc.h" + +#include "gc/Marking.h" + +namespace js { +namespace gc { + +/* + * Note: this is a stub Nursery that does not actually contain a heap, just a + * set of pointers which are "inside" the nursery to implement verification. + */ +class Nursery +{ + HashSet, SystemAllocPolicy> nursery; + + public: + Nursery() : nursery() {} + + bool enable() { + if (!nursery.initialized()) + return nursery.init(); + return true; + } + + void disable() { + if (!nursery.initialized()) + return; + nursery.finish(); + } + + bool isInside(void *cell) const { + JS_ASSERT((uintptr_t(cell) & 0x3) == 0); + return nursery.initialized() && nursery.has(cell); + } + + void insertPointer(void *cell) { + nursery.putNew(cell); + } +}; + +/* + * BufferableRef represents an abstract reference for use in the generational + * GC's remembered set. Entries in the store buffer that cannot be represented + * with the simple pointer-to-a-pointer scheme must derive from this class and + * use the generic store buffer interface. + */ +class BufferableRef +{ + public: + virtual bool match(void *location) = 0; + virtual void mark(JSTracer *trc) = 0; +}; + +/* + * HashKeyRef represents a reference to a HashTable key. Manual HashTable + * barriers should should instantiate this template with their own table/key + * type to insert into the generic buffer with putGeneric. + */ +template +class HashKeyRef : public BufferableRef +{ + Map *map; + Key key; + + typedef typename Map::Ptr Ptr; + + public: + HashKeyRef(Map *m, const Key &k) : map(m), key(k) {} + + bool match(void *location) { + Ptr p = map->lookup(key); + if (!p) + return false; + return &p->key == location; + } + + void mark(JSTracer *trc) {} +}; + +/* + * The StoreBuffer observes all writes that occur in the system and performs + * efficient filtering of them to derive a remembered set for nursery GC. + */ +class StoreBuffer +{ + /* TODO: profile to find the ideal size for these. */ + static const size_t ValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t CellBufferSize = 2 * 1024 * sizeof(Cell **); + static const size_t SlotBufferSize = 2 * 1024 * (sizeof(JSObject *) + sizeof(uint32_t)); + static const size_t RelocValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t RelocCellBufferSize = 1 * 1024 * sizeof(Cell **); + static const size_t GenericBufferSize = 1 * 1024 * sizeof(int); + static const size_t TotalSize = ValueBufferSize + CellBufferSize + + SlotBufferSize + RelocValueBufferSize + RelocCellBufferSize + + GenericBufferSize; + + typedef HashSet, SystemAllocPolicy> EdgeSet; + + /* + * This buffer holds only a single type of edge. Using this buffer is more + * efficient than the generic buffer when many writes will be to the same + * type of edge: e.g. Value or Cell*. + */ + template + class MonoTypeBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + T *base; /* Pointer to the start of the buffer. */ + T *pos; /* Pointer to the current insertion position. */ + T *top; /* Pointer to one element after the end. */ + + MonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery), base(NULL), pos(NULL), top(NULL) + {} + + MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + bool isEmpty() const { return pos == base; } + bool isFull() const { JS_ASSERT(pos <= top); return pos == top; } + + /* Compaction algorithms. */ + void compactNotInSet(); + + /* + * Attempts to reduce the usage of the buffer by removing unnecessary + * entries. + */ + virtual void compact(); + + /* Add one item to the buffer. */ + void put(const T &v); + + /* For verification. */ + bool accumulateEdges(EdgeSet &edges); + }; + + /* + * Overrides the MonoTypeBuffer to support pointers that may be moved in + * memory outside of the GC's control. + */ + template + class RelocatableMonoTypeBuffer : public MonoTypeBuffer + { + friend class StoreBuffer; + + RelocatableMonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : MonoTypeBuffer(owner, nursery) + {} + + /* Override compaction to filter out removed items. */ + void compactMoved(); + virtual void compact(); + + /* Record a removal from the buffer. */ + void unput(const T &v); + }; + + class GenericBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + uint8_t *base; /* Pointer to start of buffer. */ + uint8_t *pos; /* Pointer to current buffer position. */ + uint8_t *top; /* Pointer to one past the last entry. */ + + GenericBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery) + {} + + GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + /* Check if a pointer is present in the buffer. */ + bool containsEdge(void *location) const; + + template + void put(const T &t) { + /* Check if we have been enabled. */ + if (!pos) + return; + + /* Check for overflow. */ + if (top - pos < (unsigned)(sizeof(unsigned) + sizeof(T))) { + owner->setOverflowed(); + return; + } + + *((unsigned *)pos) = sizeof(T); + pos += sizeof(unsigned); + + T *p = (T *)pos; + new (p) T(t); + pos += sizeof(T); + } + }; + + class CellPtrEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Cell **edge; + + CellPtrEdge(Cell **v) : edge(v) {} + bool operator==(const CellPtrEdge &other) const { return edge == other.edge; } + bool operator!=(const CellPtrEdge &other) const { return edge != other.edge; } + + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(*edge); + } + + bool isNullEdge() const { + return !*edge; + } + + CellPtrEdge tagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) | 1)); } + CellPtrEdge untagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + class ValueEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Value *edge; + + ValueEdge(Value *v) : edge(v) {} + bool operator==(const ValueEdge &other) const { return edge == other.edge; } + bool operator!=(const ValueEdge &other) const { return edge != other.edge; } + + void *deref() const { return edge->isGCThing() ? edge->toGCThing() : NULL; } + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + + ValueEdge tagged() const { return ValueEdge((Value *)(uintptr_t(edge) | 1)); } + ValueEdge untagged() const { return ValueEdge((Value *)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + struct SlotEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + + JSObject *object; + uint32_t offset; + + SlotEdge(JSObject *object, uint32_t offset) : object(object), offset(offset) {} + + bool operator==(const SlotEdge &other) const { + return object == other.object && offset == other.offset; + } + + bool operator!=(const SlotEdge &other) const { + return object != other.object || offset != other.offset; + } + + HeapSlot *slotLocation() const { + if (object->isDenseArray()) { + if (offset >= object->getDenseArrayInitializedLength()) + return NULL; + return (HeapSlot *)&object->getDenseArrayElement(offset); + } + if (offset >= object->slotSpan()) + return NULL; + return &object->getSlotRef(offset); + } + + void *deref() const { + HeapSlot *loc = slotLocation(); + return (loc && loc->isGCThing()) ? loc->toGCThing() : NULL; + } + + void *location() const { + return (void *)slotLocation(); + } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(object) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + }; + + MonoTypeBuffer bufferVal; + MonoTypeBuffer bufferCell; + MonoTypeBuffer bufferSlot; + RelocatableMonoTypeBuffer bufferRelocVal; + RelocatableMonoTypeBuffer bufferRelocCell; + GenericBuffer bufferGeneric; + + Nursery *nursery; + + void *buffer; + + bool overflowed; + bool enabled; + + /* For the verifier. */ + EdgeSet edgeSet; + + /* For use by our owned buffers. */ + void setOverflowed() { overflowed = true; } + + public: + StoreBuffer(Nursery *n) + : bufferVal(this, n), bufferCell(this, n), bufferSlot(this, n), + bufferRelocVal(this, n), bufferRelocCell(this, n), bufferGeneric(this, n), + nursery(n), buffer(NULL), overflowed(false), enabled(false) + {} + + bool enable(); + void disable(); + bool isEnabled() { return enabled; } + + /* Get the overflowed status. */ + bool hasOverflowed() const { return overflowed; } + + /* Insert a single edge into the buffer/remembered set. */ + void putValue(Value *v) { + bufferVal.put(v); + } + void putCell(Cell **o) { + bufferCell.put(o); + } + void putSlot(JSObject *obj, uint32_t slot) { + bufferSlot.put(SlotEdge(obj, slot)); + } + + /* Insert or update a single edge in the Relocatable buffer. */ + void putRelocatableValue(Value *v) { + bufferRelocVal.put(v); + } + void putRelocatableCell(Cell **c) { + bufferRelocCell.put(c); + } + void removeRelocatableValue(Value *v) { + bufferRelocVal.unput(v); + } + void removeRelocatableCell(Cell **c) { + bufferRelocCell.unput(c); + } + + /* Insert an entry into the generic buffer. */ + template + void putGeneric(const T &t) { + bufferGeneric.put(t); + } + + /* For the verifier. */ + bool coalesceForVerification(); + void releaseVerificationData(); + bool containsEdgeAt(void *loc) const; +}; + +} /* namespace gc */ +} /* namespace js */ + +#endif /* jsgc_storebuffer_h___ */ +#endif /* JSGC_GENERATIONAL */ diff --git a/scripting/javascript/spidermonkey-ios/include/js-config.h b/scripting/javascript/spidermonkey-ios/include/js-config.h index d2585e93a7..c98a0830d8 100644 --- a/scripting/javascript/spidermonkey-ios/include/js-config.h +++ b/scripting/javascript/spidermonkey-ios/include/js-config.h @@ -1,4 +1,3 @@ -/* js-config.h. Generated automatically by configure. */ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sw=4 et tw=78: * diff --git a/scripting/javascript/spidermonkey-ios/include/js.msg b/scripting/javascript/spidermonkey-ios/include/js.msg index e30c87b1f0..e3d8e9830d 100644 --- a/scripting/javascript/spidermonkey-ios/include/js.msg +++ b/scripting/javascript/spidermonkey-ios/include/js.msg @@ -116,8 +116,8 @@ MSG_DEF(JSMSG_UNMATCHED_RIGHT_PAREN, 62, 0, JSEXN_SYNTAXERR, "unmatched ) in r MSG_DEF(JSMSG_TOO_BIG_TO_ENCODE, 63, 0, JSEXN_INTERNALERR, "data are to big to encode") MSG_DEF(JSMSG_ARG_INDEX_OUT_OF_RANGE, 64, 1, JSEXN_RANGEERR, "argument {0} accesses an index that is out of range") MSG_DEF(JSMSG_SPREAD_TOO_LARGE, 65, 0, JSEXN_RANGEERR, "array too large due to spread operand(s)") -MSG_DEF(JSMSG_UNUSED66, 66, 0, JSEXN_NONE, "") -MSG_DEF(JSMSG_UNUSED67, 67, 0, JSEXN_NONE, "") +MSG_DEF(JSMSG_SOURCE_TOO_LONG, 66, 0, JSEXN_RANGEERR, "source is too long") +MSG_DEF(JSMSG_BAD_WEAKMAP_KEY, 67, 0, JSEXN_TYPEERR, "cannot use the given object as a weak map key") MSG_DEF(JSMSG_BAD_SCRIPT_MAGIC, 68, 0, JSEXN_INTERNALERR, "bad script XDR magic number") MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 69, 0, JSEXN_SYNTAXERR, "missing ( before formal parameters") MSG_DEF(JSMSG_MISSING_FORMAL, 70, 0, JSEXN_SYNTAXERR, "missing formal parameter") @@ -126,7 +126,7 @@ MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body") MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition") MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition") -MSG_DEF(JSMSG_DESTRUCT_DUP_ARG, 76, 0, JSEXN_SYNTAXERR, "duplicate argument is mixed with destructuring pattern") +MSG_DEF(JSMSG_BAD_DUP_ARGS, 76, 0, JSEXN_SYNTAXERR, "duplicate argument names not allowed in this context") MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator") MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression") MSG_DEF(JSMSG_XML_WHOLE_PROGRAM, 79, 0, JSEXN_SYNTAXERR, "XML can't be the whole program") @@ -196,7 +196,7 @@ MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned functio MSG_DEF(JSMSG_SHARPVAR_TOO_BIG, 143, 0, JSEXN_SYNTAXERR, "overlarge sharp variable number") MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character") MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant") -MSG_DEF(JSMSG_BAD_INDIRECT_CALL, 146, 1, JSEXN_EVALERR, "function {0} must be called directly, and not by way of a function of another name") +MSG_DEF(JSMSG_UNUSED146, 146, 0, JSEXN_NONE, "") MSG_DEF(JSMSG_UNCAUGHT_EXCEPTION, 147, 1, JSEXN_INTERNALERR, "uncaught exception: {0}") MSG_DEF(JSMSG_INVALID_BACKREF, 148, 0, JSEXN_SYNTAXERR, "non-octal digit in an escape sequence that doesn't match a back-reference") MSG_DEF(JSMSG_BAD_BACKREF, 149, 0, JSEXN_SYNTAXERR, "back-reference exceeds number of capturing parentheses") @@ -352,3 +352,11 @@ MSG_DEF(JSMSG_FUNCTION_ARGUMENTS_AND_REST, 298, 0, JSEXN_ERR, "the 'arguments' p MSG_DEF(JSMSG_REST_WITH_DEFAULT, 299, 0, JSEXN_SYNTAXERR, "rest parameter may not have a default") MSG_DEF(JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT, 300, 0, JSEXN_SYNTAXERR, "parameter(s) with default followed by parameter without default") MSG_DEF(JSMSG_YIELD_IN_DEFAULT, 301, 0, JSEXN_SYNTAXERR, "yield in default expression") +MSG_DEF(JSMSG_INTRINSIC_NOT_DEFINED, 302, 1, JSEXN_REFERENCEERR, "no intrinsic function {0}") +MSG_DEF(JSMSG_ALREADY_HAS_SOURCEMAP, 303, 1, JSEXN_ERR, "{0} is being assigned a source map, yet already has one") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_ARG, 304, 1, JSEXN_TYPEERR, "invalid ParallelArray{0} argument") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_PARTITION, 305, 0, JSEXN_ERR, "argument must be divisible by outermost dimension") +MSG_DEF(JSMSG_PAR_ARRAY_REDUCE_EMPTY, 306, 0, JSEXN_ERR, "cannot reduce empty ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_ALREADY_FLAT, 307, 0, JSEXN_ERR, "cannot flatten 1-dimensional ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_CONFLICT, 308, 0, JSEXN_ERR, "no conflict resolution function provided") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_BOUNDS, 309, 0, JSEXN_ERR, "index in scatter vector out of bounds") diff --git a/scripting/javascript/spidermonkey-ios/include/js/HashTable.h b/scripting/javascript/spidermonkey-ios/include/js/HashTable.h index bc1f446b1a..0e8d9bf63c 100644 --- a/scripting/javascript/spidermonkey-ios/include/js/HashTable.h +++ b/scripting/javascript/spidermonkey-ios/include/js/HashTable.h @@ -15,9 +15,6 @@ namespace js { class TempAllocPolicy; -/* Integral types for all hash functions. */ -typedef uint32_t HashNumber; - /*****************************************************************************/ namespace detail { @@ -217,9 +214,6 @@ class HashTable : private AllocPolicy * this operation until the next call to |popFront()|. */ void rekeyFront(const Lookup &l, const Key &k) { - JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); - if (match(*this->cur, l)) - return; typename HashTableEntry::NonConstT t = this->cur->t; HashPolicy::setKey(t, const_cast(k)); table.remove(*this->cur); @@ -288,7 +282,6 @@ class HashTable : private AllocPolicy static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */ static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */ static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */ - static const HashNumber sGoldenRatio = 0x9E3779B9U; /* taken from jsdhash.h */ static const HashNumber sFreeKey = Entry::sFreeKey; static const HashNumber sRemovedKey = Entry::sRemovedKey; static const HashNumber sCollisionBit = Entry::sCollisionBit; @@ -308,10 +301,7 @@ class HashTable : private AllocPolicy static HashNumber prepareHash(const Lookup& l) { - HashNumber keyHash = HashPolicy::hash(l); - - /* Improve keyHash distribution. */ - keyHash *= sGoldenRatio; + HashNumber keyHash = ScrambleHashCode(HashPolicy::hash(l)); /* Avoid reserved hash codes. */ if (!isLiveHash(keyHash)) @@ -1003,6 +993,9 @@ template class HashMap { + typedef typename tl::StaticAssert::result>::result keyAssert; + typedef typename tl::StaticAssert::result>::result valAssert; + public: typedef typename HashPolicy::Lookup Lookup; diff --git a/scripting/javascript/spidermonkey-ios/include/js/MemoryMetrics.h b/scripting/javascript/spidermonkey-ios/include/js/MemoryMetrics.h index 20edc08705..6942823c22 100644 --- a/scripting/javascript/spidermonkey-ios/include/js/MemoryMetrics.h +++ b/scripting/javascript/spidermonkey-ios/include/js/MemoryMetrics.h @@ -56,6 +56,7 @@ struct RuntimeSizes , gcMarker(0) , mathCache(0) , scriptFilenames(0) + , scriptSources(0) , compartmentObjects(0) {} @@ -71,6 +72,7 @@ struct RuntimeSizes size_t gcMarker; size_t mathCache; size_t scriptFilenames; + size_t scriptSources; // This is the exception to the "RuntimeSizes doesn't measure things within // compartments" rule. We combine the sizes of all the JSCompartment diff --git a/scripting/javascript/spidermonkey-ios/include/js/Utility.h b/scripting/javascript/spidermonkey-ios/include/js/Utility.h index 327fce3e99..5c845e1183 100644 --- a/scripting/javascript/spidermonkey-ios/include/js/Utility.h +++ b/scripting/javascript/spidermonkey-ios/include/js/Utility.h @@ -355,6 +355,26 @@ JS_FLOOR_LOG2W(size_t n) return js_FloorLog2wImpl(n); } +/* + * JS_ROTATE_LEFT32 + * + * There is no rotate operation in the C Language so the construct (a << 4) | + * (a >> 28) is used instead. Most compilers convert this to a rotate + * instruction but some versions of MSVC don't without a little help. To get + * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic + * and use a pragma to make _rotl inline. + * + * MSVC in VS2005 will do an inline rotate instruction on the above construct. + */ +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ + defined(_M_X64)) +#include +#pragma intrinsic(_rotl) +#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) +#else +#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +#endif + JS_END_EXTERN_C #ifdef __cplusplus @@ -599,11 +619,18 @@ public: class UnwantedForeground : public Foreground { }; -template -struct ScopedDeletePtrTraits +template +struct ScopedFreePtrTraits +{ + typedef T* type; + static T* empty() { return NULL; } + static void release(T* ptr) { Foreground::free_(ptr); } +}; +SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) + +template +struct ScopedDeletePtrTraits : public ScopedFreePtrTraits { - typedef T *type; - static T *empty() { return NULL; } static void release(T *ptr) { Foreground::delete_(ptr); } }; SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits) @@ -829,20 +856,7 @@ class MoveRef { explicit MoveRef(T &t) : pointer(&t) { } T &operator*() const { return *pointer; } T *operator->() const { return pointer; } -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(__clang__) - /* - * If MoveRef is used in a rvalue position (which is expected), we can - * end up in a situation where, without this ifdef, we would try to pass - * a T& to a move constructor, which fails. It is not clear if the compiler - * should instead use the copy constructor, but for now this lets us build - * with clang. See bug 689066 and llvm.org/pr11003 for the details. - * Note: We can probably remove MoveRef completely once we are comfortable - * using c++11. - */ - operator T&& () const { return static_cast(*pointer); } -#else operator T& () const { return *pointer; } -#endif private: T *pointer; }; @@ -895,6 +909,51 @@ RoundUpPow2(size_t x) return size_t(1) << JS_CEILING_LOG2W(x); } +/* Integral types for all hash functions. */ +typedef uint32_t HashNumber; +const unsigned HashNumberSizeBits = 32; + +namespace detail { + +/* + * Given a raw hash code, h, return a number that can be used to select a hash + * bucket. + * + * This function aims to produce as uniform an output distribution as possible, + * especially in the most significant (leftmost) bits, even though the input + * distribution may be highly nonrandom, given the constraints that this must + * be deterministic and quick to compute. + * + * Since the leftmost bits of the result are best, the hash bucket index is + * computed by doing ScrambleHashCode(h) / (2^32/N) or the equivalent + * right-shift, not ScrambleHashCode(h) % N or the equivalent bit-mask. + * + * FIXME: OrderedHashTable uses a bit-mask; see bug 775896. + */ +inline HashNumber +ScrambleHashCode(HashNumber h) +{ + /* + * Simply returning h would not cause any hash tables to produce wrong + * answers. But it can produce pathologically bad performance: The caller + * right-shifts the result, keeping only the highest bits. The high bits of + * hash codes are very often completely entropy-free. (So are the lowest + * bits.) + * + * So we use Fibonacci hashing, as described in Knuth, The Art of Computer + * Programming, 6.4. This mixes all the bits of the input hash code h. + * + * The value of goldenRatio is taken from the hex + * expansion of the golden ratio, which starts 1.9E3779B9.... + * This value is especially good if values with consecutive hash codes + * are stored in a hash table; see Knuth for details. + */ + static const HashNumber goldenRatio = 0x9E3779B9U; + return h * goldenRatio; +} + +} /* namespace detail */ + } /* namespace js */ namespace JS { @@ -910,7 +969,7 @@ namespace JS { * a live integer value. */ -inline void PoisonPtr(uintptr_t *v) +inline void PoisonPtr(void *v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) uint8_t *ptr = (uint8_t *) v + 3; diff --git a/scripting/javascript/spidermonkey-ios/include/jsapi.h.REMOVED.git-id b/scripting/javascript/spidermonkey-ios/include/jsapi.h.REMOVED.git-id index 5c56f3b1fe..cb870fb789 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsapi.h.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-ios/include/jsapi.h.REMOVED.git-id @@ -1 +1 @@ -37b6af08d1e6059f152ae515d8d7422a346cf7ed \ No newline at end of file +8a03481ec145a3a0e532637dd52bf80605b7a713 \ No newline at end of file diff --git a/scripting/javascript/spidermonkey-ios/include/jsatom.h b/scripting/javascript/spidermonkey-ios/include/jsatom.h index a3447e06b4..cc9a23f49b 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsatom.h +++ b/scripting/javascript/spidermonkey-ios/include/jsatom.h @@ -12,12 +12,12 @@ #include "jsalloc.h" #include "jsapi.h" #include "jsprvtd.h" -#include "jshash.h" #include "jspubtd.h" #include "jslock.h" #include "gc/Barrier.h" #include "js/HashTable.h" +#include "mozilla/HashFunctions.h" struct JSIdArray { int length; @@ -83,23 +83,15 @@ JSID_TO_ATOM(jsid id) return (JSAtom *)JSID_TO_STRING(id); } -JS_STATIC_ASSERT(sizeof(JSHashNumber) == 4); +JS_STATIC_ASSERT(sizeof(js::HashNumber) == 4); JS_STATIC_ASSERT(sizeof(jsid) == JS_BYTES_PER_WORD); namespace js { -static JS_ALWAYS_INLINE JSHashNumber +static JS_ALWAYS_INLINE js::HashNumber HashId(jsid id) { - JSHashNumber n = -#if JS_BYTES_PER_WORD == 4 - JSHashNumber(JSID_BITS(id)); -#elif JS_BYTES_PER_WORD == 8 - JSHashNumber(JSID_BITS(id)) ^ JSHashNumber(JSID_BITS(id) >> 32); -#else -# error "Unsupported configuration" -#endif - return n * JS_GOLDEN_RATIO; + return HashGeneric(JSID_BITS(id)); } static JS_ALWAYS_INLINE Value @@ -135,15 +127,6 @@ struct DefaultHasher } -#if JS_BYTES_PER_WORD == 4 -# define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2) -#elif JS_BYTES_PER_WORD == 8 -# define ATOM_HASH(atom) (((JSHashNumber)(uintptr_t)(atom) >> 3) ^ \ - (JSHashNumber)((uintptr_t)(atom) >> 32)) -#else -# error "Unsupported configuration" -#endif - /* * Return a printable, lossless char[] representation of a string-type atom. * The lifetime of the result matches the lifetime of bytes. @@ -342,29 +325,28 @@ extern const char js_send_str[]; extern const char js_getter_str[]; extern const char js_setter_str[]; +namespace js { + /* * Initialize atom state. Return true on success, false on failure to allocate * memory. The caller must zero rt->atomState before calling this function and * only call it after js_InitGC successfully returns. */ extern JSBool -js_InitAtomState(JSRuntime *rt); +InitAtomState(JSRuntime *rt); /* * Free and clear atom state including any interned string atoms. This * function must be called before js_FinishGC. */ extern void -js_FinishAtomState(JSRuntime *rt); +FinishAtomState(JSRuntime *rt); /* * Atom tracing and garbage collection hooks. */ - -namespace js { - extern void -MarkAtomState(JSTracer *trc, bool markAll); +MarkAtomState(JSTracer *trc); extern void SweepAtomState(JSRuntime *rt); @@ -382,58 +364,32 @@ enum InternBehavior InternAtom = true }; -} /* namespace js */ +extern JSAtom * +Atomize(JSContext *cx, const char *bytes, size_t length, + js::InternBehavior ib = js::DoNotInternAtom, + js::FlationCoding fc = js::NormalEncoding); extern JSAtom * -js_Atomize(JSContext *cx, const char *bytes, size_t length, - js::InternBehavior ib = js::DoNotInternAtom, - js::FlationCoding fc = js::NormalEncoding); +AtomizeChars(JSContext *cx, const jschar *chars, size_t length, + js::InternBehavior ib = js::DoNotInternAtom); extern JSAtom * -js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, - js::InternBehavior ib = js::DoNotInternAtom); - -extern JSAtom * -js_AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); - -/* - * Return an existing atom for the given char array or null if the char - * sequence is currently not atomized. - */ -extern JSAtom * -js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length); - -#ifdef DEBUG - -extern JS_FRIEND_API(void) -js_DumpAtoms(JSContext *cx, FILE *fp); - -#endif - -namespace js { +AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); inline JSAtom * ToAtom(JSContext *cx, const js::Value &v); bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, - jsid *idp, Value *vp); + jsid *idp, MutableHandleValue vp); inline bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid *idp) { - Value dummy; + RootedValue dummy(cx); return InternNonIntElementId(cx, obj, idval, idp, &dummy); } -/* - * For all unmapped atoms recorded in al, add a mapping from the atom's index - * to its address. map->length must already be set to the number of atoms in - * the list and map->vector must point to pre-allocated memory. - */ -extern void -InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtr *atoms); - template bool XDRAtom(XDRState *xdr, JSAtom **atomp); diff --git a/scripting/javascript/spidermonkey-ios/include/jsatom.tbl b/scripting/javascript/spidermonkey-ios/include/jsatom.tbl index 3c2e47f450..969790f047 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsatom.tbl +++ b/scripting/javascript/spidermonkey-ios/include/jsatom.tbl @@ -43,6 +43,7 @@ DEFINE_ATOM(call, "call") DEFINE_ATOM(callee, "callee") DEFINE_ATOM(caller, "caller") DEFINE_ATOM(classPrototype, "prototype") +DEFINE_ATOM(columnNumber, "columnNumber") DEFINE_ATOM(constructor, "constructor") DEFINE_ATOM(each, "each") DEFINE_ATOM(eval, "eval") @@ -53,7 +54,8 @@ DEFINE_ATOM(ignoreCase, "ignoreCase") DEFINE_ATOM(index, "index") DEFINE_ATOM(input, "input") DEFINE_ATOM(toISOString, "toISOString") -DEFINE_ATOM(iterator, "__iterator__") +DEFINE_ATOM(iterator, "iterator") +DEFINE_ATOM(iteratorIntrinsic, "__iterator__") DEFINE_ATOM(join, "join") DEFINE_ATOM(lastIndex, "lastIndex") DEFINE_ATOM(length, "length") @@ -121,6 +123,7 @@ DEFINE_PROTOTYPE_ATOM(WeakMap) DEFINE_ATOM(buffer, "buffer") DEFINE_ATOM(byteLength, "byteLength") DEFINE_ATOM(byteOffset, "byteOffset") +DEFINE_ATOM(shape, "shape") DEFINE_KEYWORD_ATOM(return) DEFINE_KEYWORD_ATOM(throw) DEFINE_ATOM(url, "url") @@ -148,3 +151,4 @@ DEFINE_ATOM(unescape, "unescape") DEFINE_ATOM(uneval, "uneval") DEFINE_ATOM(unwatch, "unwatch") DEFINE_ATOM(watch, "watch") +DEFINE_ATOM(_CallFunction, "_CallFunction") diff --git a/scripting/javascript/spidermonkey-ios/include/jsclass.h b/scripting/javascript/spidermonkey-ios/include/jsclass.h index e5bcacc05e..3da83a633e 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsclass.h +++ b/scripting/javascript/spidermonkey-ios/include/jsclass.h @@ -161,35 +161,35 @@ typedef JSBool (* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp, MutableHandleShape propp); typedef JSBool -(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, const Value *value, +(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, const Value *value, +(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, const Value *value, +(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, const Value *value, +(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, Value *vp); +(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); typedef JSBool -(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, Value *vp); +(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp); typedef JSBool -(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp); +(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); typedef JSBool -(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp, bool* present); +(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool* present); typedef JSBool -(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, Value *vp); +(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp); typedef JSBool -(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool strict); +(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSBool (* GenericAttributesOp)(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp); typedef JSBool @@ -199,11 +199,11 @@ typedef JSBool typedef JSBool (* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp); typedef JSBool -(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSType (* TypeOfOp)(JSContext *cx, HandleObject obj); @@ -257,9 +257,22 @@ struct ClassExtension * WeakMaps use this to override the wrapper disposal optimization. */ bool isWrappedNative; + + /* + * If an object is used as a key in a weakmap, it may be desirable for the + * garbage collector to keep that object around longer than it otherwise + * would. A common case is when the key is a wrapper around an object in + * another compartment, and we want to avoid collecting the wrapper (and + * removing the weakmap entry) as long as the wrapped object is alive. In + * that case, the wrapped object is returned by the wrapper's + * weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap + * key, it will not be collected (and remain in the weakmap) until the + * wrapped object is collected. + */ + JSWeakmapKeyDelegateOp weakmapKeyDelegateOp; }; -#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false} +#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false,NULL} struct ObjectOps { diff --git a/scripting/javascript/spidermonkey-ios/include/jsdbgapi.h b/scripting/javascript/spidermonkey-ios/include/jsdbgapi.h index 1382b0779a..af326e28b0 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsdbgapi.h +++ b/scripting/javascript/spidermonkey-ios/include/jsdbgapi.h @@ -221,12 +221,6 @@ JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); extern JS_PUBLIC_API(void) JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation); -extern JS_PUBLIC_API(JSPrincipals*) -JS_GetPrincipalIfDummyFrame(JSContext *cx, JSStackFrame *fpArg); - -extern JS_PUBLIC_API(JSBool) -JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp); - extern JS_PUBLIC_API(JSObject *) JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp); diff --git a/scripting/javascript/spidermonkey-ios/include/jsfriendapi.h b/scripting/javascript/spidermonkey-ios/include/jsfriendapi.h index 3e28bcaa63..63b9c96604 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsfriendapi.h +++ b/scripting/javascript/spidermonkey-ios/include/jsfriendapi.h @@ -22,10 +22,10 @@ extern JS_FRIEND_API(JSString *) JS_GetAnonymousString(JSRuntime *rt); extern JS_FRIEND_API(JSObject *) -JS_FindCompilationScope(JSContext *cx, JSObject *obj); +JS_FindCompilationScope(JSContext *cx, JSRawObject obj); extern JS_FRIEND_API(JSFunction *) -JS_GetObjectFunction(JSObject *obj); +JS_GetObjectFunction(JSRawObject obj); extern JS_FRIEND_API(JSObject *) JS_GetGlobalForFrame(JSStackFrame *fp); @@ -37,7 +37,7 @@ extern JS_FRIEND_API(JSObject *) JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(uint32_t) -JS_ObjectCountDynamicSlots(JSObject *obj); +JS_ObjectCountDynamicSlots(JSHandleObject obj); extern JS_FRIEND_API(void) JS_ShrinkGCBuffers(JSRuntime *rt); @@ -75,13 +75,18 @@ enum { JS_TELEMETRY_GC_REASON, JS_TELEMETRY_GC_IS_COMPARTMENTAL, JS_TELEMETRY_GC_MS, + JS_TELEMETRY_GC_MAX_PAUSE_MS, JS_TELEMETRY_GC_MARK_MS, JS_TELEMETRY_GC_SWEEP_MS, + JS_TELEMETRY_GC_MARK_ROOTS_MS, + JS_TELEMETRY_GC_MARK_GRAY_MS, JS_TELEMETRY_GC_SLICE_MS, JS_TELEMETRY_GC_MMU_50, JS_TELEMETRY_GC_RESET, JS_TELEMETRY_GC_INCREMENTAL_DISABLED, - JS_TELEMETRY_GC_NON_INCREMENTAL + JS_TELEMETRY_GC_NON_INCREMENTAL, + JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS, + JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS }; typedef void @@ -108,7 +113,7 @@ extern JS_FRIEND_API(JSObject *) JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(JSBool) -js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, jsval *vp); +js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp); JS_FRIEND_API(void) js_ReportOverRecursed(JSContext *maybecx); @@ -159,6 +164,8 @@ struct JSFunctionSpecWithHelp { #define JS_FN_HELP(name,call,nargs,flags,usage,help) \ {name, call, nargs, (flags) | JSPROP_ENUMERATE | JSFUN_STUB_GSOPS, usage, help} +#define JS_FS_HELP_END \ + {NULL, NULL, 0, 0, NULL, NULL} extern JS_FRIEND_API(bool) JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSpecWithHelp *fs); @@ -169,6 +176,11 @@ JS_END_EXTERN_C #ifdef __cplusplus +typedef bool (* JS_SourceHook)(JSContext *cx, JSScript *script, jschar **src, uint32_t *length); + +extern JS_FRIEND_API(void) +JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook); + namespace js { struct RuntimeFriendFields { @@ -213,7 +225,7 @@ class JS_FRIEND_API(AutoSwitchCompartment) { public: AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment JS_GUARD_OBJECT_NOTIFIER_PARAM); - AutoSwitchCompartment(JSContext *cx, JSObject *target JS_GUARD_OBJECT_NOTIFIER_PARAM); + AutoSwitchCompartment(JSContext *cx, JSHandleObject target JS_GUARD_OBJECT_NOTIFIER_PARAM); ~AutoSwitchCompartment(); JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; @@ -274,6 +286,9 @@ typedef void extern JS_FRIEND_API(void) VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void *closure); +extern JS_FRIEND_API(JSObject *) +GetWeakmapKeyDelegate(JSObject *key); + /* * Shadow declarations of JS internal structures, for access by inline access * functions below. Do not use these structures in any other way. When adding @@ -318,6 +333,16 @@ struct Object { } }; +struct Function { + Object base; + uint16_t nargs; + uint16_t flags; + /* Used only for natives */ + Native native; + const JSJitInfo *jitinfo; + void *_1; +}; + struct Atom { size_t _; const jschar *chars; @@ -339,35 +364,35 @@ extern JS_FRIEND_DATA(js::Class) XMLClass; extern JS_FRIEND_DATA(js::Class) ObjectClass; inline js::Class * -GetObjectClass(const JSObject *obj) +GetObjectClass(RawObject obj) { return reinterpret_cast(obj)->shape->base->clasp; } inline JSClass * -GetObjectJSClass(const JSObject *obj) +GetObjectJSClass(RawObject obj) { return js::Jsvalify(GetObjectClass(obj)); } JS_FRIEND_API(bool) -IsScopeObject(JSObject *obj); +IsScopeObject(RawObject obj); inline JSObject * -GetObjectParent(JSObject *obj) +GetObjectParent(RawObject obj) { JS_ASSERT(!IsScopeObject(obj)); return reinterpret_cast(obj)->shape->base->parent; } JS_FRIEND_API(JSObject *) -GetObjectParentMaybeScope(JSObject *obj); +GetObjectParentMaybeScope(RawObject obj); JS_FRIEND_API(JSObject *) -GetGlobalForObjectCrossCompartment(JSObject *obj); +GetGlobalForObjectCrossCompartment(RawObject obj); JS_FRIEND_API(void) -NotifyAnimationActivity(JSObject *obj); +NotifyAnimationActivity(RawObject obj); JS_FRIEND_API(bool) IsOriginalScriptFunction(JSFunction *fun); @@ -391,19 +416,19 @@ InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto, JSPropertySpec *static_ps, JSFunctionSpec *static_fs); JS_FRIEND_API(const Value &) -GetFunctionNativeReserved(JSObject *fun, size_t which); +GetFunctionNativeReserved(RawObject fun, size_t which); JS_FRIEND_API(void) -SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val); +SetFunctionNativeReserved(RawObject fun, size_t which, const Value &val); inline JSObject * -GetObjectProto(JSObject *obj) +GetObjectProto(RawObject obj) { return reinterpret_cast(obj)->type->proto; } inline void * -GetObjectPrivate(JSObject *obj) +GetObjectPrivate(RawObject obj) { const shadow::Object *nobj = reinterpret_cast(obj); void **addr = reinterpret_cast(&nobj->fixedSlots()[nobj->numFixedSlots()]); @@ -415,17 +440,17 @@ GetObjectPrivate(JSObject *obj) * within the maximum capacity for the object's fixed slots). */ inline const Value & -GetReservedSlot(const JSObject *obj, size_t slot) +GetReservedSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); return reinterpret_cast(obj)->slotRef(slot); } JS_FRIEND_API(void) -SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const Value &value); +SetReservedSlotWithBarrier(RawObject obj, size_t slot, const Value &value); inline void -SetReservedSlot(JSObject *obj, size_t slot, const Value &value) +SetReservedSlot(RawObject obj, size_t slot, const Value &value) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); shadow::Object *sobj = reinterpret_cast(obj); @@ -436,22 +461,15 @@ SetReservedSlot(JSObject *obj, size_t slot, const Value &value) } JS_FRIEND_API(uint32_t) -GetObjectSlotSpan(JSObject *obj); +GetObjectSlotSpan(RawObject obj); inline const Value & -GetObjectSlot(JSObject *obj, size_t slot) +GetObjectSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < GetObjectSlotSpan(obj)); return reinterpret_cast(obj)->slotRef(slot); } -inline Shape * -GetObjectShape(JSObject *obj) -{ - shadow::Shape *shape = reinterpret_cast(obj)->shape; - return reinterpret_cast(shape); -} - inline const jschar * GetAtomChars(JSAtom *atom) { @@ -465,19 +483,19 @@ AtomToLinearString(JSAtom *atom) } static inline js::PropertyOp -CastAsJSPropertyOp(JSObject *object) +CastAsJSPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::PropertyOp, object); } static inline js::StrictPropertyOp -CastAsJSStrictPropertyOp(JSObject *object) +CastAsJSStrictPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::StrictPropertyOp, object); } JS_FRIEND_API(bool) -GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props); +GetPropertyNames(JSContext *cx, RawObject obj, unsigned flags, js::AutoIdVector *props); JS_FRIEND_API(bool) GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp); @@ -489,7 +507,7 @@ JS_FRIEND_API(void) SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback); JS_FRIEND_API(bool) -IsObjectInContextCompartment(const JSObject *obj, const JSContext *cx); +IsObjectInContextCompartment(RawObject obj, const JSContext *cx); /* * NB: these flag bits are encoded into the bytecode stream in the immediate @@ -542,19 +560,66 @@ GetPCCountScriptContents(JSContext *cx, size_t script); * * For more detailed information, see vm/SPSProfiler.h */ -struct ProfileEntry { +class ProfileEntry +{ /* - * These two fields are marked as 'volatile' so that the compiler doesn't - * re-order instructions which modify them. The operation in question is: + * All fields are marked volatile to prevent the compiler from re-ordering + * instructions. Namely this sequence: * - * stack[i].string = str; - * (*size)++; + * entry[size] = ...; + * size++; * - * If the size increment were re-ordered before the store of the string, - * then if sampling occurred there would be a bogus entry on the stack. + * If the size modification were somehow reordered before the stores, then + * if a sample were taken it would be examining bogus information. + * + * A ProfileEntry represents both a C++ profile entry and a JS one. Both use + * the string as a description, but JS uses the sp as NULL to indicate that + * it is a JS entry. The script_ is then only ever examined for a JS entry, + * and the idx is used by both, but with different meanings. */ - const char * volatile string; - void * volatile sp; + const char * volatile string; // Descriptive string of this entry + void * volatile sp; // Relevant stack pointer for the entry + JSScript * volatile script_; // if js(), non-null script which is running + int32_t volatile idx; // if js(), idx of pc, otherwise line number + + public: + /* + * All of these methods are marked with the 'volatile' keyword because SPS's + * representation of the stack is stored such that all ProfileEntry + * instances are volatile. These methods would not be available unless they + * were marked as volatile as well + */ + + bool js() volatile { + JS_ASSERT_IF(sp == NULL, script_ != NULL); + return sp == NULL; + } + + uint32_t line() volatile { JS_ASSERT(!js()); return idx; } + JSScript *script() volatile { JS_ASSERT(js()); return script_; } + void *stackAddress() volatile { return sp; } + const char *label() volatile { return string; } + + void setLine(uint32_t line) volatile { JS_ASSERT(!js()); idx = line; } + void setLabel(const char *string) volatile { this->string = string; } + void setStackAddress(void *sp) volatile { this->sp = sp; } + void setScript(JSScript *script) volatile { script_ = script; } + + /* we can't know the layout of JSScript, so look in vm/SPSProfiler.cpp */ + JS_FRIEND_API(jsbytecode *) pc() volatile; + JS_FRIEND_API(void) setPC(jsbytecode *pc) volatile; + + static size_t offsetOfString() { return offsetof(ProfileEntry, string); } + static size_t offsetOfStackAddress() { return offsetof(ProfileEntry, sp); } + static size_t offsetOfPCIdx() { return offsetof(ProfileEntry, idx); } + static size_t offsetOfScript() { return offsetof(ProfileEntry, script_); } + + /* + * The index used in the entry can either be a line number or the offset of + * a pc into a script's code. To signify a NULL pc, use a -1 index. This is + * checked against in pc() and setPC() to set/get the right pc. + */ + static const int32_t NullPCIndex = -1; }; JS_FRIEND_API(void) @@ -564,6 +629,9 @@ SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size, JS_FRIEND_API(void) EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled); +JS_FRIEND_API(jsbytecode*) +ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip); + #ifdef JS_THREADSAFE JS_FRIEND_API(void *) GetOwnerThread(const JSContext *cx); @@ -624,6 +692,7 @@ SizeOfJSContext(); D(DEBUG_GC) \ D(DEBUG_MODE_GC) \ D(TRANSPLANT) \ + D(RESET) \ \ /* Reasons from Firefox */ \ D(DOM_WINDOW_UTILS) \ @@ -695,7 +764,7 @@ extern JS_FRIEND_API(void) ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); extern JS_FRIEND_API(void) -IncrementalGC(JSRuntime *rt, gcreason::Reason reason); +IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0); extern JS_FRIEND_API(void) FinishIncrementalGC(JSRuntime *rt, gcreason::Reason reason); @@ -733,6 +802,30 @@ typedef void extern JS_FRIEND_API(GCSliceCallback) SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); +typedef void +(* AnalysisPurgeCallback)(JSRuntime *rt, JSFlatString *desc); + +extern JS_FRIEND_API(AnalysisPurgeCallback) +SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback); + +/* Was the most recent GC run incrementally? */ +extern JS_FRIEND_API(bool) +WasIncrementalGC(JSRuntime *rt); + +typedef JSBool +(* DOMInstanceClassMatchesProto)(JSHandleObject protoObject, uint32_t protoID, + uint32_t depth); +struct JSDOMCallbacks { + DOMInstanceClassMatchesProto instanceClassMatchesProto; +}; +typedef struct JSDOMCallbacks DOMCallbacks; + +extern JS_FRIEND_API(void) +SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks); + +extern JS_FRIEND_API(const DOMCallbacks *) +GetDOMCallbacks(JSRuntime *rt); + /* * Signals a good place to do an incremental slice, because the browser is * drawing a frame. @@ -753,7 +846,7 @@ extern JS_FRIEND_API(bool) IsIncrementalBarrierNeeded(JSContext *cx); extern JS_FRIEND_API(bool) -IsIncrementalBarrierNeededOnObject(JSObject *obj); +IsIncrementalBarrierNeededOnObject(RawObject obj); extern JS_FRIEND_API(bool) IsIncrementalBarrierNeededOnScript(JSScript *obj); @@ -821,21 +914,68 @@ CastToJSFreeOp(FreeOp *fop) /* Implemented in jsexn.cpp. */ /* - * Get an error type name from a number. - * If no exception is associated, return NULL. + * Get an error type name from a JSExnType constant. + * Returns NULL for invalid arguments and JSEXN_INTERNALERR */ extern JS_FRIEND_API(const jschar*) -GetErrorTypeNameFromNumber(JSContext* cx, const unsigned errorNumber); +GetErrorTypeName(JSContext* cx, int16_t exnType); /* Implemented in jswrapper.cpp. */ -typedef enum NukedGlobalHandling { - NukeForGlobalObject, - DontNukeForGlobalObject -} NukedGlobalHandling; +typedef enum NukeReferencesToWindow { + NukeWindowReferences, + DontNukeWindowReferences +} NukeReferencesToWindow; + +/* + * These filters are designed to be ephemeral stack classes, and thus don't + * do any rooting or holding of their members. + */ +struct CompartmentFilter { + virtual bool match(JSCompartment *c) const = 0; +}; + +struct AllCompartments : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { return true; } +}; + +struct ContentCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return !IsSystemCompartment(c); + } +}; + +struct ChromeCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return IsSystemCompartment(c); + } +}; + +struct SingleCompartment : public CompartmentFilter { + JSCompartment *ours; + SingleCompartment(JSCompartment *c) : ours(c) {} + virtual bool match(JSCompartment *c) const { return c == ours; } +}; + +struct CompartmentsWithPrincipals : public CompartmentFilter { + JSPrincipals *principals; + CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} + virtual bool match(JSCompartment *c) const { + return JS_GetCompartmentPrincipals(c) == principals; + } +}; extern JS_FRIEND_API(JSBool) -NukeChromeCrossCompartmentWrappersForGlobal(JSContext *cx, JSObject *obj, - NukedGlobalHandling nukeGlobal); +NukeCrossCompartmentWrappers(JSContext* cx, + const CompartmentFilter& sourceFilter, + const CompartmentFilter& targetFilter, + NukeReferencesToWindow nukeReferencesToWindow); + +/* Specify information about ListBase proxies in the DOM, for use by ICs. */ +JS_FRIEND_API(void) +SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot); + +void *GetListBaseHandlerFamily(); +uint32_t GetListBaseExpandoSlot(); } /* namespace js */ @@ -851,7 +991,7 @@ extern JS_FRIEND_API(JSBool) js_DateIsValid(JSContext *cx, JSObject* obj); extern JS_FRIEND_API(double) -js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj); +js_DateGetMsecSinceEpoch(JSContext *cx, JSRawObject obj); /* Implemented in jscntxt.cpp. */ @@ -1043,6 +1183,35 @@ JS_IsFloat32Array(JSObject *obj, JSContext *cx); extern JS_FRIEND_API(JSBool) JS_IsFloat64Array(JSObject *obj, JSContext *cx); + +/* + * Unwrap Typed arrays all at once. Return NULL without throwing if the object + * cannot be viewed as the correct typed array, or the typed array object on + * success, filling both outparameters. + */ +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt8Array(JSContext *cx, JSObject *obj, uint32_t *length, int8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8Array(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8ClampedArray(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt16Array(JSContext *cx, JSObject *obj, uint32_t *length, int16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint16Array(JSContext *cx, JSObject *obj, uint32_t *length, uint16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt32Array(JSContext *cx, JSObject *obj, uint32_t *length, int32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint32Array(JSContext *cx, JSObject *obj, uint32_t *length, uint32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat32Array(JSContext *cx, JSObject *obj, uint32_t *length, float **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat64Array(JSContext *cx, JSObject *obj, uint32_t *length, double **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBufferView(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBuffer(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); + /* * Get the type of elements in a typed array. * @@ -1213,4 +1382,42 @@ JS_GetDataViewByteLength(JSObject *obj, JSContext *cx); JS_FRIEND_API(void *) JS_GetDataViewData(JSObject *obj, JSContext *cx); +#ifdef __cplusplus +/* + * This struct contains metadata passed from the DOM to the JS Engine for JIT + * optimizations on DOM property accessors. Eventually, this should be made + * available to general JSAPI users, but we are not currently ready to do so. + */ +typedef bool +(* JSJitPropertyOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, JS::Value *vp); +typedef bool +(* JSJitMethodOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, unsigned argc, JS::Value *vp); + +struct JSJitInfo { + JSJitPropertyOp op; + uint32_t protoID; + uint32_t depth; + bool isInfallible; /* Is op fallible? Getters only */ + bool isConstant; /* Getting a construction-time constant? */ +}; + +static JS_ALWAYS_INLINE const JSJitInfo * +FUNCTION_VALUE_TO_JITINFO(const JS::Value& v) +{ + JS_ASSERT(js::GetObjectClass(&v.toObject()) == &js::FunctionClass); + return reinterpret_cast(&v.toObject())->jitinfo; +} + +static JS_ALWAYS_INLINE void +SET_JITINFO(JSFunction * func, const JSJitInfo *info) +{ + js::shadow::Function *fun = reinterpret_cast(func); + /* JS_ASSERT(func->isNative()). 0x4000 is JSFUN_INTERPRETED */ + JS_ASSERT(!(fun->flags & 0x4000)); + fun->jitinfo = info; +} +#endif /* __cplusplus */ + #endif /* jsfriendapi_h___ */ diff --git a/scripting/javascript/spidermonkey-ios/include/jsgc.h b/scripting/javascript/spidermonkey-ios/include/jsgc.h index 0cb842505c..13b2e4678c 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsgc.h +++ b/scripting/javascript/spidermonkey-ios/include/jsgc.h @@ -41,6 +41,7 @@ namespace js { class GCHelperThread; struct Shape; +struct SliceBudget; namespace gc { @@ -48,6 +49,8 @@ enum State { NO_INCREMENTAL, MARK_ROOTS, MARK, + SWEEP, + SWEEP_END, INVALID }; @@ -112,36 +115,100 @@ MapAllocToTraceKind(AllocKind thingKind) return map[thingKind]; } +static inline bool +IsNurseryAllocable(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + +static inline bool +IsBackgroundFinalized(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + inline JSGCTraceKind GetGCThingTraceKind(const void *thing); +/* + * ArenaList::head points to the start of the list. Normally cursor points + * to the first arena in the list with some free things and all arenas + * before cursor are fully allocated. However, as the arena currently being + * allocated from is considered full while its list of free spans is moved + * into the freeList, during the GC or cell enumeration, when an + * unallocated freeList is moved back to the arena, we can see an arena + * with some free cells before the cursor. The cursor is an indirect + * pointer to allow for efficient list insertion at the cursor point and + * other list manipulations. + */ +struct ArenaList { + ArenaHeader *head; + ArenaHeader **cursor; + + ArenaList() { + clear(); + } + + void clear() { + head = NULL; + cursor = &head; + } + + void insert(ArenaHeader *arena); +}; + struct ArenaLists { - /* - * ArenaList::head points to the start of the list. Normally cursor points - * to the first arena in the list with some free things and all arenas - * before cursor are fully allocated. However, as the arena currently being - * allocated from is considered full while its list of free spans is moved - * into the freeList, during the GC or cell enumeration, when an - * unallocated freeList is moved back to the arena, we can see an arena - * with some free cells before the cursor. The cursor is an indirect - * pointer to allow for efficient list insertion at the cursor point and - * other list manipulations. - */ - struct ArenaList { - ArenaHeader *head; - ArenaHeader **cursor; - - ArenaList() { - clear(); - } - - void clear() { - head = NULL; - cursor = &head; - } - }; - private: /* * For each arena kind its free list is represented as the first span with @@ -180,12 +247,18 @@ struct ArenaLists { volatile uintptr_t backgroundFinalizeState[FINALIZE_LIMIT]; + public: + /* For each arena kind, a list of arenas remaining to be swept. */ + ArenaHeader *arenaListsToSweep[FINALIZE_LIMIT]; + public: ArenaLists() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) freeLists[i].initAsEmpty(); for (size_t i = 0; i != FINALIZE_LIMIT; ++i) backgroundFinalizeState[i] = BFS_DONE; + for (size_t i = 0; i != FINALIZE_LIMIT; ++i) + arenaListsToSweep[i] = NULL; } ~ArenaLists() { @@ -211,6 +284,10 @@ struct ArenaLists { return arenaLists[thingKind].head; } + ArenaHeader *getFirstArenaToSweep(AllocKind thingKind) const { + return arenaListsToSweep[thingKind]; + } + bool arenaListsAreEmpty() const { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* @@ -225,6 +302,10 @@ struct ArenaLists { return true; } + bool arenasAreFull(AllocKind thingKind) const { + return !*arenaLists[thingKind].cursor; + } + void unmarkAll() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* The background finalization must have stopped at this point. */ @@ -238,7 +319,8 @@ struct ArenaLists { } bool doneBackgroundFinalize(AllocKind kind) const { - return backgroundFinalizeState[kind] == BFS_DONE; + return backgroundFinalizeState[kind] == BFS_DONE || + backgroundFinalizeState[kind] == BFS_JUST_FINISHED; } /* @@ -333,16 +415,18 @@ struct ArenaLists { JS_ASSERT(freeLists[kind].isEmpty()); } - void finalizeObjects(FreeOp *fop); - void finalizeStrings(FreeOp *fop); - void finalizeShapes(FreeOp *fop); - void finalizeScripts(FreeOp *fop); + void queueObjectsForSweep(FreeOp *fop); + void queueStringsForSweep(FreeOp *fop); + void queueShapesForSweep(FreeOp *fop); + void queueScriptsForSweep(FreeOp *fop); - static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead); + bool foregroundFinalize(FreeOp *fop, AllocKind thingKind, SliceBudget &sliceBudget); + static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgroundThread); private: inline void finalizeNow(FreeOp *fop, AllocKind thingKind); - inline void finalizeLater(FreeOp *fop, AllocKind thingKind); + inline void queueForForegroundSweep(FreeOp *fop, AllocKind thingKind); + inline void queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind); inline void *allocateFromArena(JSCompartment *comp, AllocKind thingKind); }; @@ -478,7 +562,7 @@ extern void GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); extern void -GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); +GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason, int64_t millis = 0); extern void GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); @@ -539,8 +623,6 @@ class GCHelperThread { void **freeCursor; void **freeCursorEnd; - Vector finalizeVector; - bool backgroundAllocation; friend struct js::gc::ArenaLists; @@ -584,10 +666,10 @@ class GCHelperThread { /* Must be called with the GC lock taken. */ void startBackgroundShrink(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepEnd(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepOrAllocEnd(); /* Must be called with the GC lock taken. */ @@ -625,9 +707,6 @@ class GCHelperThread { else replenishAndFreeLater(ptr); } - - /* Must be called with the GC lock taken. */ - bool prepareForBackgroundSweep(); }; @@ -1071,22 +1150,33 @@ RunDebugGC(JSContext *cx); void SetDeterministicGC(JSContext *cx, bool enabled); +void +SetValidateGC(JSContext *cx, bool enabled); + const int ZealPokeValue = 1; const int ZealAllocValue = 2; const int ZealFrameGCValue = 3; -const int ZealVerifierValue = 4; -const int ZealFrameVerifierValue = 5; +const int ZealVerifierPreValue = 4; +const int ZealFrameVerifierPreValue = 5; const int ZealStackRootingSafeValue = 6; const int ZealStackRootingValue = 7; const int ZealIncrementalRootsThenFinish = 8; const int ZealIncrementalMarkAllThenFinish = 9; const int ZealIncrementalMultipleSlices = 10; +const int ZealVerifierPostValue = 11; +const int ZealFrameVerifierPostValue = 12; +const int ZealPurgeAnalysisValue = 13; + +enum VerifierType { + PreBarrierVerifier, + PostBarrierVerifier +}; #ifdef JS_GC_ZEAL /* Check that write barriers have been used correctly. See jsgc.cpp. */ void -VerifyBarriers(JSRuntime *rt); +VerifyBarriers(JSRuntime *rt, VerifierType type); void MaybeVerifyBarriers(JSContext *cx, bool always = false); @@ -1094,7 +1184,7 @@ MaybeVerifyBarriers(JSContext *cx, bool always = false); #else static inline void -VerifyBarriers(JSRuntime *rt) +VerifyBarriers(JSRuntime *rt, VerifierType type) { } diff --git a/scripting/javascript/spidermonkey-ios/include/jshash.h b/scripting/javascript/spidermonkey-ios/include/jshash.h deleted file mode 100644 index 2b9f8a9e39..0000000000 --- a/scripting/javascript/spidermonkey-ios/include/jshash.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef jshash_h___ -#define jshash_h___ - -/* - * API to portable hash table code. - */ -#include -#include -#include "jstypes.h" - -JS_BEGIN_EXTERN_C - -typedef uint32_t JSHashNumber; -typedef struct JSHashEntry JSHashEntry; -typedef struct JSHashTable JSHashTable; - -#define JS_HASH_BITS 32 -#define JS_GOLDEN_RATIO 0x9E3779B9U - -typedef JSHashNumber (* JSHashFunction)(const void *key); -typedef int (* JSHashComparator)(const void *v1, const void *v2); -typedef int (* JSHashEnumerator)(JSHashEntry *he, int i, void *arg); - -/* Flag bits in JSHashEnumerator's return value */ -#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */ -#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */ -#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */ - -typedef struct JSHashAllocOps { - void * (*allocTable)(void *pool, size_t size); - void (*freeTable)(void *pool, void *item, size_t size); - JSHashEntry * (*allocEntry)(void *pool, const void *key); - void (*freeEntry)(void *pool, JSHashEntry *he, unsigned flag); -} JSHashAllocOps; - -#define HT_FREE_VALUE 0 /* just free the entry's value */ -#define HT_FREE_ENTRY 1 /* free value and entire entry */ - -struct JSHashEntry { - JSHashEntry *next; /* hash chain linkage */ - JSHashNumber keyHash; /* key hash function result */ - const void *key; /* ptr to opaque key */ - void *value; /* ptr to opaque value */ -}; - -struct JSHashTable { - JSHashEntry **buckets; /* vector of hash buckets */ - uint32_t nentries; /* number of entries in table */ - uint32_t shift; /* multiplicative hash shift */ - JSHashFunction keyHash; /* key hash function */ - JSHashComparator keyCompare; /* key comparison function */ - JSHashComparator valueCompare; /* value comparison function */ - JSHashAllocOps *allocOps; /* allocation operations */ - void *allocPriv; /* allocation private data */ -#ifdef JS_HASHMETER - uint32_t nlookups; /* total number of lookups */ - uint32_t nsteps; /* number of hash chains traversed */ - uint32_t ngrows; /* number of table expansions */ - uint32_t nshrinks; /* number of table contractions */ -#endif -}; - -/* - * Create a new hash table. - * If allocOps is null, use default allocator ops built on top of malloc(). - */ -extern JS_PUBLIC_API(JSHashTable *) -JS_NewHashTable(uint32_t n, JSHashFunction keyHash, - JSHashComparator keyCompare, JSHashComparator valueCompare, - JSHashAllocOps *allocOps, void *allocPriv); - -extern JS_PUBLIC_API(void) -JS_HashTableDestroy(JSHashTable *ht); - -/* Low level access methods */ -extern JS_PUBLIC_API(JSHashEntry **) -JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key); - -#ifdef __cplusplus -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep, JSHashNumber keyHash, - const void *key, void *value); -#endif - -extern JS_PUBLIC_API(void) -JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he); - -/* Higher level access methods */ -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableAdd(JSHashTable *ht, const void *key, void *value); - -extern JS_PUBLIC_API(JSBool) -JS_HashTableRemove(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg); - -extern JS_PUBLIC_API(void *) -JS_HashTableLookup(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp); - -/* General-purpose C string hash function. */ -extern JS_PUBLIC_API(JSHashNumber) -JS_HashString(const void *key); - -/* Stub function just returns v1 == v2 */ -extern JS_PUBLIC_API(int) -JS_CompareValues(const void *v1, const void *v2); - -JS_END_EXTERN_C - -#endif /* jshash_h___ */ diff --git a/scripting/javascript/spidermonkey-ios/include/jslock.h b/scripting/javascript/spidermonkey-ios/include/jslock.h index 15a0e73806..b5202cb32c 100644 --- a/scripting/javascript/spidermonkey-ios/include/jslock.h +++ b/scripting/javascript/spidermonkey-ios/include/jslock.h @@ -16,10 +16,10 @@ # include "prthread.h" # include "prinit.h" -# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((PRInt32 *)(p), (PRInt32)(v)) -# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((PRInt32 *)(p), (PRInt32)(v)) +# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((int32_t *)(p)) +# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((int32_t *)(p)) +# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((int32_t *)(p), (int32_t)(v)) +# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v)) #else /* JS_THREADSAFE */ diff --git a/scripting/javascript/spidermonkey-ios/include/json.h b/scripting/javascript/spidermonkey-ios/include/json.h index af11f9f89c..69b0072d3f 100644 --- a/scripting/javascript/spidermonkey-ios/include/json.h +++ b/scripting/javascript/spidermonkey-ios/include/json.h @@ -7,6 +7,7 @@ #include "jsprvtd.h" #include "jspubtd.h" +#include "jsapi.h" #include "js/Vector.h" @@ -18,7 +19,7 @@ js_InitJSONClass(JSContext *cx, JSObject *obj); extern JSBool js_Stringify(JSContext *cx, js::MutableHandleValue vp, - JSObject *replacer, js::Value space, + JSObject *replacer, js::Value space, js::StringBuffer &sb); // Avoid build errors on certain platforms that define these names as constants @@ -37,8 +38,8 @@ enum DecodingMode { STRICT, LEGACY }; namespace js { extern JS_FRIEND_API(JSBool) -ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, const Value &filter, - Value *vp, DecodingMode decodingMode = STRICT); +ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleValue filter, + MutableHandleValue vp, DecodingMode decodingMode = STRICT); } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-ios/include/jsperf.h b/scripting/javascript/spidermonkey-ios/include/jsperf.h index 0438bc518e..265478c33e 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsperf.h +++ b/scripting/javascript/spidermonkey-ios/include/jsperf.h @@ -115,7 +115,7 @@ class JS_FRIEND_API(PerfMeasurement) * global object). The JS-visible API is identical to the C++ API. */ extern JS_FRIEND_API(JSObject*) - RegisterPerfMeasurement(JSContext *cx, JSObject *global); + RegisterPerfMeasurement(JSContext *cx, JSRawObject global); /* * Given a jsval which contains an instance of the aforementioned diff --git a/scripting/javascript/spidermonkey-ios/include/jsproto.tbl b/scripting/javascript/spidermonkey-ios/include/jsproto.tbl index 5e37999fac..ff357bda7d 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsproto.tbl +++ b/scripting/javascript/spidermonkey-ios/include/jsproto.tbl @@ -64,6 +64,7 @@ JS_PROTO(WeakMap, 36, js_InitWeakMapClass) JS_PROTO(Map, 37, js_InitMapClass) JS_PROTO(Set, 38, js_InitSetClass) JS_PROTO(DataView, 39, js_InitTypedArrayClasses) +JS_PROTO(ParallelArray, 40, js_InitParallelArrayClass) #undef XML_INIT #undef NAMESPACE_INIT diff --git a/scripting/javascript/spidermonkey-ios/include/jsproxy.h b/scripting/javascript/spidermonkey-ios/include/jsproxy.h index 5fd5848377..aaf9de45e7 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsproxy.h +++ b/scripting/javascript/spidermonkey-ios/include/jsproxy.h @@ -13,7 +13,7 @@ namespace js { -class Wrapper; +class JS_FRIEND_API(Wrapper); /* * A proxy is a JSObject that implements generic behavior by providing custom @@ -48,10 +48,19 @@ class Wrapper; */ class JS_FRIEND_API(BaseProxyHandler) { void *mFamily; + bool mHasPrototype; + protected: + // Subclasses may set this in their constructor. + void setHasPrototype(bool hasPrototype) { mHasPrototype = hasPrototype; }; + public: explicit BaseProxyHandler(void *family); virtual ~BaseProxyHandler(); + bool hasPrototype() { + return mHasPrototype; + } + inline void *family() { return mFamily; } @@ -102,7 +111,7 @@ class JS_FRIEND_API(BaseProxyHandler) { /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -114,6 +123,10 @@ class JS_FRIEND_API(BaseProxyHandler) { virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp, bool *present); + virtual bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **proto); + + /* See comment for weakmapKeyDelegateOp in jsclass.h. */ + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -150,8 +163,8 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, - Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; @@ -166,6 +179,7 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp) MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -215,18 +229,18 @@ class Proxy { /* ES5 Harmony derived proxy traps. */ static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); - static bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp); - static bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver, - uint32_t index, Value *vp, bool *present); - static bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, - Value *vp); + static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp); + static bool getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver, + uint32_t index, MutableHandleValue vp, bool *present); + static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, + MutableHandleValue vp); static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); - static bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp); + static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); /* Spidermonkey extensions. */ static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - static bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); static bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); static JSType typeOf(JSContext *cx, JSObject *proxy); static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -247,17 +261,17 @@ inline bool IsFunctionProxyClass(const Class *clasp) return clasp == &js::FunctionProxyClass; } -inline bool IsObjectProxy(const JSObject *obj) +inline bool IsObjectProxy(RawObject obj) { return IsObjectProxyClass(GetObjectClass(obj)); } -inline bool IsFunctionProxy(const JSObject *obj) +inline bool IsFunctionProxy(RawObject obj) { return IsFunctionProxyClass(GetObjectClass(obj)); } -inline bool IsProxy(const JSObject *obj) +inline bool IsProxy(RawObject obj) { Class *clasp = GetObjectClass(obj); return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); @@ -272,56 +286,56 @@ const uint32_t JSSLOT_PROXY_CALL = 4; const uint32_t JSSLOT_PROXY_CONSTRUCT = 5; inline BaseProxyHandler * -GetProxyHandler(const JSObject *obj) +GetProxyHandler(RawObject obj) { JS_ASSERT(IsProxy(obj)); return (BaseProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER).toPrivate(); } inline const Value & -GetProxyPrivate(const JSObject *obj) +GetProxyPrivate(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE); } inline JSObject * -GetProxyTargetObject(const JSObject *obj) +GetProxyTargetObject(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetProxyPrivate(obj).toObjectOrNull(); } inline const Value & -GetProxyCall(const JSObject *obj) +GetProxyCall(RawObject obj) { JS_ASSERT(IsFunctionProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_CALL); } inline const Value & -GetProxyExtra(const JSObject *obj, size_t n) +GetProxyExtra(RawObject obj, size_t n) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n); } inline void -SetProxyHandler(JSObject *obj, BaseProxyHandler *handler) +SetProxyHandler(RawObject obj, BaseProxyHandler *handler) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); } inline void -SetProxyPrivate(JSObject *obj, const Value &value) +SetProxyPrivate(RawObject obj, const Value &value) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value); } inline void -SetProxyExtra(JSObject *obj, size_t n, const Value &extra) +SetProxyExtra(RawObject obj, size_t n, const Value &extra) { JS_ASSERT(IsProxy(obj)); JS_ASSERT(n <= 1); diff --git a/scripting/javascript/spidermonkey-ios/include/jsprvtd.h b/scripting/javascript/spidermonkey-ios/include/jsprvtd.h index 19b5aef3c2..f41d05d37f 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsprvtd.h +++ b/scripting/javascript/spidermonkey-ios/include/jsprvtd.h @@ -82,7 +82,6 @@ class JSExtensibleString; class JSExternalString; class JSLinearString; class JSFixedString; -class JSStaticAtom; class JSRope; class JSAtom; class JSWrapper; @@ -131,24 +130,10 @@ class StackSpace; class ContextStack; class ScriptFrameIter; -struct BytecodeEmitter; -struct Definition; -struct FunctionBox; -struct ObjectBox; -struct ParseNode; -struct Parser; -struct SharedContext; -class TokenStream; -struct Token; -struct TokenPos; -struct TokenPtr; -struct TreeContext; -class UpvarCookie; - class Proxy; -class BaseProxyHandler; -class DirectWrapper; -class CrossCompartmentWrapper; +class JS_FRIEND_API(BaseProxyHandler); +class JS_FRIEND_API(DirectWrapper); +class JS_FRIEND_API(CrossCompartmentWrapper); class TempAllocPolicy; class RuntimeAllocPolicy; @@ -172,13 +157,6 @@ class Bindings; struct StackBaseShape; struct StackShape; -class MultiDeclRange; -class ParseMapPool; -class DefinitionList; -typedef InlineMap AtomDefnMap; -typedef InlineMap AtomIndexMap; -typedef Vector UpvarCookies; - class Breakpoint; class BreakpointSite; class Debugger; @@ -197,6 +175,22 @@ typedef JSPropertyOp PropertyOp; typedef JSStrictPropertyOp StrictPropertyOp; typedef JSPropertyDescriptor PropertyDescriptor; +namespace frontend { + +struct BytecodeEmitter; +struct Definition; +struct FunctionBox; +struct ObjectBox; +struct Token; +struct TokenPos; +struct TokenPtr; +class TokenStream; +struct Parser; +class ParseMapPool; +struct ParseNode; + +} /* namespace frontend */ + namespace analyze { struct LifetimeVariable; diff --git a/scripting/javascript/spidermonkey-ios/include/jspubtd.h b/scripting/javascript/spidermonkey-ios/include/jspubtd.h index 45864ca0d6..a154b9ceed 100644 --- a/scripting/javascript/spidermonkey-ios/include/jspubtd.h +++ b/scripting/javascript/spidermonkey-ios/include/jspubtd.h @@ -240,6 +240,21 @@ enum ThingRootKind THING_ROOT_LIMIT }; +template +struct RootKind; + +/* + * Specifically mark the ThingRootKind of externally visible types, so that + * JSAPI users may use JSRooted... types without having the class definition + * available. + */ +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_STRING; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_SCRIPT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_ID; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_VALUE; }; }; + struct ContextFriendFields { JSRuntime *const runtime; diff --git a/scripting/javascript/spidermonkey-ios/include/jstypes.h b/scripting/javascript/spidermonkey-ios/include/jstypes.h index 8f0489f6f0..d0cf183e0f 100644 --- a/scripting/javascript/spidermonkey-ios/include/jstypes.h +++ b/scripting/javascript/spidermonkey-ios/include/jstypes.h @@ -147,8 +147,6 @@ ***********************************************************************/ #define JS_HOWMANY(x,y) (((x)+(y)-1)/(y)) #define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y)) -#define JS_MIN(x,y) ((x)<(y)?(x):(y)) -#define JS_MAX(x,y) ((x)>(y)?(x):(y)) #include "jscpucfg.h" diff --git a/scripting/javascript/spidermonkey-ios/include/jsutil.h b/scripting/javascript/spidermonkey-ios/include/jsutil.h index 10debde90b..8838b6f70b 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsutil.h +++ b/scripting/javascript/spidermonkey-ios/include/jsutil.h @@ -15,6 +15,10 @@ #include "js/Utility.h" +#ifdef USE_ZLIB +#include "zlib.h" +#endif + /* Forward declarations. */ struct JSContext; @@ -335,41 +339,43 @@ ClearAllBitArrayElements(size_t *array, size_t length) array[i] = 0; } -} /* namespace js */ -#endif /* __cplusplus */ +#ifdef USE_ZLIB +class Compressor +{ + /* Number of bytes we should hand to zlib each compressMore() call. */ + static const size_t CHUNKSIZE = 2048; + z_stream zs; + const unsigned char *inp; + size_t inplen; + public: + Compressor(const unsigned char *inp, size_t inplen, unsigned char *out) + : inp(inp), + inplen(inplen) + { + JS_ASSERT(inplen > 0); + zs.opaque = NULL; + zs.next_in = (Bytef *)inp; + zs.avail_in = 0; + zs.next_out = out; + zs.avail_out = inplen; + } + bool init(); + /* Compress some of the input. Return true if it should be called again. */ + bool compressMore(); + /* Finalize compression. Return the length of the compressed input. */ + size_t finish(); +}; /* - * JS_ROTATE_LEFT32 - * - * There is no rotate operation in the C Language so the construct (a << 4) | - * (a >> 28) is used instead. Most compilers convert this to a rotate - * instruction but some versions of MSVC don't without a little help. To get - * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic - * and use a pragma to make _rotl inline. - * - * MSVC in VS2005 will do an inline rotate instruction on the above construct. + * Decompress a string. The caller must know the length of the output and + * allocate |out| to a string of that length. */ -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ - defined(_M_X64)) -#include -#pragma intrinsic(_rotl) -#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) -#else -#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +bool DecompressString(const unsigned char *inp, size_t inplen, + unsigned char *out, size_t outlen); #endif -/* Static control-flow checks. */ -#ifdef NS_STATIC_CHECKING -/* Trigger a control flow check to make sure that code flows through label */ -inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {} - -/* Avoid unused goto-label warnings. */ -# define MUST_FLOW_LABEL(label) goto label; label: - -#else -# define MUST_FLOW_THROUGH(label) ((void) 0) -# define MUST_FLOW_LABEL(label) -#endif +} /* namespace js */ +#endif /* __cplusplus */ /* Crash diagnostics */ #ifdef DEBUG diff --git a/scripting/javascript/spidermonkey-ios/include/jsval.h b/scripting/javascript/spidermonkey-ios/include/jsval.h index 2ee90a8e4f..187f1b9627 100644 --- a/scripting/javascript/spidermonkey-ios/include/jsval.h +++ b/scripting/javascript/spidermonkey-ios/include/jsval.h @@ -218,6 +218,7 @@ typedef enum JSWhyMagic JS_OVERWRITTEN_CALLEE, /* arguments.callee has been overwritten */ JS_FORWARD_TO_CALL_OBJECT, /* args object element stored in call object */ JS_BLOCK_NEEDS_CLONE, /* value of static block object slot */ + JS_HASH_KEY_EMPTY, /* see class js::HashableValue */ JS_GENERIC_MAGIC /* for local use */ } JSWhyMagic; diff --git a/scripting/javascript/spidermonkey-ios/include/jswrapper.h b/scripting/javascript/spidermonkey-ios/include/jswrapper.h index aa0e80ad16..2af181b74a 100644 --- a/scripting/javascript/spidermonkey-ios/include/jswrapper.h +++ b/scripting/javascript/spidermonkey-ios/include/jswrapper.h @@ -64,9 +64,9 @@ class JS_FRIEND_API(Wrapper) static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent, Wrapper *handler); - static Wrapper *wrapperHandler(const JSObject *wrapper); + static Wrapper *wrapperHandler(RawObject wrapper); - static JSObject *wrappedObject(const JSObject *wrapper); + static JSObject *wrappedObject(RawObject wrapper); explicit Wrapper(unsigned flags); @@ -166,7 +166,7 @@ class JS_FRIEND_API(IndirectWrapper) : public Wrapper, class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler { public: - explicit DirectWrapper(unsigned flags); + explicit DirectWrapper(unsigned flags, bool hasPrototype = false); virtual ~DirectWrapper(); @@ -206,7 +206,8 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -214,6 +215,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler Value *vp) MOZ_OVERRIDE; static DirectWrapper singleton; + static DirectWrapper singletonWithPrototype; static void *getWrapperFamily(); }; @@ -222,7 +224,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper { public: - CrossCompartmentWrapper(unsigned flags); + CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false); virtual ~CrossCompartmentWrapper(); @@ -249,7 +251,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -258,6 +261,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp); static CrossCompartmentWrapper singleton; + static CrossCompartmentWrapper singletonWithPrototype; }; /* @@ -275,7 +279,8 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: SecurityWrapper(unsigned flags); - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g) MOZ_OVERRIDE; }; @@ -283,25 +288,6 @@ class JS_FRIEND_API(SecurityWrapper) : public Base typedef SecurityWrapper SameCompartmentSecurityWrapper; typedef SecurityWrapper CrossCompartmentSecurityWrapper; -/* - * A hacky class that lets a friend force a fake frame. We must already be - * in the compartment of |target| when we enter the forced frame. - */ -class JS_FRIEND_API(ForceFrame) -{ - public: - JSContext * const context; - JSObject * const target; - private: - DummyFrameGuard *frame; - - public: - ForceFrame(JSContext *cx, JSObject *target); - ~ForceFrame(); - bool enter(); -}; - - class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler { public: @@ -323,7 +309,8 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); virtual JSString *obj_toString(JSContext *cx, JSObject *proxy); @@ -347,7 +334,7 @@ TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedProto, J extern JS_FRIEND_DATA(int) sWrapperFamily; inline bool -IsWrapper(const JSObject *obj) +IsWrapper(RawObject obj) { return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamily; } @@ -366,8 +353,13 @@ UnwrapObject(JSObject *obj, bool stopAtOuter = true, unsigned *flagsp = NULL); JS_FRIEND_API(JSObject *) UnwrapObjectChecked(JSContext *cx, JSObject *obj); +// Unwrap only the outermost security wrapper, with the same semantics as +// above. This is the checked version of Wrapper::wrappedObject. +JS_FRIEND_API(JSObject *) +UnwrapOneChecked(JSContext *cx, JSObject *obj); + JS_FRIEND_API(bool) -IsCrossCompartmentWrapper(const JSObject *obj); +IsCrossCompartmentWrapper(RawObject obj); JSObject * NewDeadProxyObject(JSContext *cx, JSObject *parent); @@ -384,37 +376,6 @@ RemapAllWrappersForObject(JSContext *cx, JSObject *oldTarget, // API to recompute all cross-compartment wrappers whose source and target // match the given filters. -// -// These filters are designed to be ephemeral stack classes, and thus don't -// do any rooting or holding of their members. -struct CompartmentFilter { - virtual bool match(JSCompartment *c) const = 0; -}; - -struct AllCompartments : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { return true; } -}; - -struct ContentCompartmentsOnly : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { - return !IsSystemCompartment(c); - } -}; - -struct SingleCompartment : public CompartmentFilter { - JSCompartment *ours; - SingleCompartment(JSCompartment *c) : ours(c) {} - virtual bool match(JSCompartment *c) const { return c == ours; } -}; - -struct CompartmentsWithPrincipals : public CompartmentFilter { - JSPrincipals *principals; - CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} - virtual bool match(JSCompartment *c) const { - return JS_GetCompartmentPrincipals(c) == principals; - } -}; - JS_FRIEND_API(bool) RecomputeWrappers(JSContext *cx, const CompartmentFilter &sourceFilter, const CompartmentFilter &targetFilter); diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/Attributes.h b/scripting/javascript/spidermonkey-ios/include/mozilla/Attributes.h index 0cfcd60336..6b4e81612c 100644 --- a/scripting/javascript/spidermonkey-ios/include/mozilla/Attributes.h +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/Attributes.h @@ -70,6 +70,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_FINAL final # endif +# if __has_extension(cxx_strong_enums) +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS +# endif # if __has_attribute(noinline) # define MOZ_HAVE_NEVER_INLINE __attribute__((noinline)) # endif @@ -89,6 +93,8 @@ # endif # if __GNUC_MINOR__ >= 4 # define MOZ_HAVE_CXX11_DELETE +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # endif # else @@ -108,6 +114,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE /* MSVC currently spells "final" as "sealed". */ # define MOZ_HAVE_CXX11_FINAL sealed +# define MOZ_HAVE_CXX11_ENUM_TYPE +# endif +# if _MSC_VER >= 1700 +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # define MOZ_HAVE_NEVER_INLINE __declspec(noinline) # define MOZ_HAVE_NORETURN __declspec(noreturn) @@ -298,6 +308,167 @@ # define MOZ_FINAL /* no support */ #endif +/** + * MOZ_ENUM_TYPE specifies the underlying numeric type for an enum. It's + * specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name in + * its declaration, and before the opening curly brace, like + * + * enum MyEnum MOZ_ENUM_TYPE(uint16_t) + * { + * A, + * B = 7, + * C + * }; + * + * In supporting compilers, the macro will expand to ": uint16_t". The + * compiler will allocate exactly two bytes for MyEnum, and will require all + * enumerators to have values between 0 and 65535. (Thus specifying "B = + * 100000" instead of "B = 7" would fail to compile.) In old compilers, the + * macro expands to the empty string, and the underlying type is generally + * undefined. + */ +#ifdef MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_ENUM_TYPE(type) : type +#else +# define MOZ_ENUM_TYPE(type) /* no support */ +#endif + +/** + * MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the + * strongly-typed enumeration feature of C++11 ("enum class"). If supported + * by the compiler, an enum defined using these macros will not be implicitly + * converted to any other type, and its enumerators will be scoped using the + * enumeration name. Place MOZ_BEGIN_ENUM_CLASS(EnumName, type) in place of + * "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the closing + * "};". For example, + * + * MOZ_BEGIN_ENUM_CLASS(Enum, int32_t) + * A, B = 6 + * MOZ_END_ENUM_CLASS(Enum) + * + * This will make "Enum::A" and "Enum::B" appear in the global scope, but "A" + * and "B" will not. In compilers that support C++11 strongly-typed + * enumerations, implicit conversions of Enum values to numeric types will + * fail. In other compilers, Enum itself will actually be defined as a class, + * and some implicit conversions will fail while others will succeed. + * + * The type argument specifies the underlying type for the enum where + * supported, as with MOZ_ENUM_TYPE(). For simplicity, it is currently + * mandatory. As with MOZ_ENUM_TYPE(), it will do nothing on compilers that do + * not support it. + */ +#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) + /* All compilers that support strong enums also support an explicit + * underlying type, so no extra check is needed */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) enum class Name : type { +# define MOZ_END_ENUM_CLASS(Name) }; +#else + /** + * We need Name to both name a type, and scope the provided enumerator + * names. Namespaces and classes both provide scoping, but namespaces + * aren't types, so we need to use a class that wraps the enum values. We + * have an implicit conversion from the inner enum type to the class, so + * statements like + * + * Enum x = Enum::A; + * + * will still work. We need to define an implicit conversion from the class + * to the inner enum as well, so that (for instance) switch statements will + * work. This means that the class can be implicitly converted to a numeric + * value as well via the enum type, since C++ allows an implicit + * user-defined conversion followed by a standard conversion to still be + * implicit. + * + * We have an explicit constructor from int defined, so that casts like + * (Enum)7 will still work. We also have a zero-argument constructor with + * no arguments, so declaration without initialization (like "Enum foo;") + * will work. + * + * Additionally, we'll delete as many operators as possible for the inner + * enum type, so statements like this will still fail: + * + * f(5 + Enum::B); // deleted operator+ + * + * But we can't prevent things like this, because C++ doesn't allow + * overriding conversions or assignment operators for enums: + * + * int x = Enum::A; + * int f() + * { + * return Enum::A; + * } + */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) \ + class Name \ + { \ + public: \ + enum Enum MOZ_ENUM_TYPE(type) \ + { +# define MOZ_END_ENUM_CLASS(Name) \ + }; \ + Name() {} \ + Name(Enum aEnum) : mEnum(aEnum) {} \ + explicit Name(int num) : mEnum((Enum)num) {} \ + operator Enum() const { return mEnum; } \ + private: \ + Enum mEnum; \ + }; \ + inline int operator+(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator-(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator*(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator*(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator/(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator/(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator%(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator%(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&) MOZ_DELETE; \ + inline int& operator++(Name::Enum&) MOZ_DELETE; \ + inline int operator++(Name::Enum&, int) MOZ_DELETE; \ + inline int& operator--(Name::Enum&) MOZ_DELETE; \ + inline int operator--(Name::Enum&, int) MOZ_DELETE; \ + inline bool operator==(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator==(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator!=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!(const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline bool operator||(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator||(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline int operator~(const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator|(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator|(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator^(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator^(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator<<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator<<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator>>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator>>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int& operator+=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator-=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator*=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator/=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator%=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator&=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator|=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator^=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator<<=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator>>=(int&, const Name::Enum&) MOZ_DELETE; +#endif + /** * MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's * return value is not used by the caller. diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/Constants.h b/scripting/javascript/spidermonkey-ios/include/mozilla/Constants.h new file mode 100644 index 0000000000..904b30145a --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/Constants.h @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt math constants. */ + +#ifndef mozilla_Constants_h_ +#define mozilla_Constants_h_ + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#endif /* mozilla_Constants_h_ */ diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/HashFunctions.h b/scripting/javascript/spidermonkey-ios/include/mozilla/HashFunctions.h index 7a19749e55..badfc3c808 100644 --- a/scripting/javascript/spidermonkey-ios/include/mozilla/HashFunctions.h +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/HashFunctions.h @@ -179,6 +179,14 @@ AddToHash(uint32_t hash, A* a) return detail::AddUintptrToHash(hash, uintptr_t(a)); } +template<> +MOZ_WARN_UNUSED_RESULT +inline uint32_t +AddToHash(uint32_t hash, uintptr_t a) +{ + return detail::AddUintptrToHash(hash, a); +} + template MOZ_WARN_UNUSED_RESULT uint32_t diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/MathAlgorithms.h b/scripting/javascript/spidermonkey-ios/include/mozilla/MathAlgorithms.h new file mode 100644 index 0000000000..b545fa544b --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/MathAlgorithms.h @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt maths algorithms. */ + +#ifndef mozilla_MathAlgorithms_h_ +#define mozilla_MathAlgorithms_h_ + +#include "mozilla/Assertions.h" + +namespace mozilla { + +// Greatest Common Divisor +template +MOZ_ALWAYS_INLINE IntegerType +EuclidGCD(IntegerType a, IntegerType b) +{ + // Euclid's algorithm; O(N) in the worst case. (There are better + // ways, but we don't need them for the current use of this algo.) + MOZ_ASSERT(a > 0); + MOZ_ASSERT(b > 0); + + while (a != b) { + if (a > b) { + a = a - b; + } else { + b = b - a; + } + } + + return a; +} + +// Least Common Multiple +template +MOZ_ALWAYS_INLINE IntegerType +EuclidLCM(IntegerType a, IntegerType b) +{ + // Divide first to reduce overflow risk. + return (a / EuclidGCD(a, b)) * b; +} + +} /* namespace mozilla */ + +#endif /* mozilla_MathAlgorithms_h_ */ diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/NullPtr.h b/scripting/javascript/spidermonkey-ios/include/mozilla/NullPtr.h new file mode 100644 index 0000000000..e6fc892759 --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/NullPtr.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Implements a workaround for compilers which do not support the C++11 nullptr + * constant. + */ + +#ifndef mozilla_NullPtr_h_ +#define mozilla_NullPtr_h_ + +#if defined(__clang__) +# ifndef __has_extension +# define __has_extension __has_feature +# endif +# if __has_extension(cxx_nullptr) +# define MOZ_HAVE_CXX11_NULLPTR +# endif +#elif defined(__GNUC__) +# if defined(_GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if (__GNUC__ * 1000 + __GNU_MINOR__) >= 4006 +# define MOZ_HAVE_CXX11_NULLPTR +# endif +# endif +#elif _MSC_VER >= 1600 +# define MOZ_HAVE_CXX11_NULLPTR +#endif + +/** + * Use C++11 nullptr if available; otherwise use __null for gcc, or a 0 literal + * with the correct size to match the size of a pointer on a given platform. + */ + +#ifndef MOZ_HAVE_CXX11_NULLPTR +# if defined(__GNUC__) +# define nullptr __null +# elif defined(_WIN64) +# define nullptr 0LL +# else +# define nullptr 0L +# endif +#endif + +#endif /* mozilla_NullPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/SHA1.h b/scripting/javascript/spidermonkey-ios/include/mozilla/SHA1.h new file mode 100644 index 0000000000..fdb2150dc2 --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/SHA1.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Simple class for computing SHA1. */ + +/* + * To compute the SHA1 of a buffer using this class you should write something + * like: + * void SHA1(const uint8_t* buf, unsigned size, uint8_t hash[20]) + * { + * SHA1Sum S; + * S.update(buf, size); + * S.finish(hash); + * } + * If there are multiple buffers or chunks, the update method can be called + * multiple times and the SHA1 is computed on the concatenation of all the + * buffers passed to it. + * The finish method may only be called once and cannot be followed by calls + * to update. + */ + +#ifndef mozilla_SHA1_h_ +#define mozilla_SHA1_h_ + +#include "mozilla/StandardInteger.h" +namespace mozilla { +class SHA1Sum { + union { + uint32_t w[16]; /* input buffer */ + uint8_t b[64]; + } u; + uint64_t size; /* count of hashed bytes. */ + unsigned H[22]; /* 5 state variables, 16 tmp values, 1 extra */ + bool mDone; + +public: + static const unsigned int HashSize = 20; + SHA1Sum(); + void update(const uint8_t *dataIn, uint32_t len); + void finish(uint8_t hashout[20]); +}; +} + +#endif /* mozilla_SHA1_h_ */ diff --git a/scripting/javascript/spidermonkey-ios/include/mozilla/WeakPtr.h b/scripting/javascript/spidermonkey-ios/include/mozilla/WeakPtr.h new file mode 100644 index 0000000000..e20767141e --- /dev/null +++ b/scripting/javascript/spidermonkey-ios/include/mozilla/WeakPtr.h @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Weak pointer functionality, implemented as a mixin for use with any class. */ + +/** + * SupportsWeakPtr lets you have a pointer to an object 'Foo' without affecting + * its lifetime. It works by creating a single shared reference counted object + * (WeakReference) that each WeakPtr will access 'Foo' through. This lets 'Foo' + * clear the pointer in the WeakReference without having to know about all of + * the WeakPtrs to it and allows the WeakReference to live beyond the lifetime + * of 'Foo'. + * + * The overhead of WeakPtr is that accesses to 'Foo' becomes an additional + * dereference, and an additional heap allocated pointer sized object shared + * between all of the WeakPtrs. + * + * Example of usage: + * + * // To have a class C support weak pointers, inherit from SupportsWeakPtr. + * class C : public SupportsWeakPtr + * { + * public: + * int num; + * void act(); + * }; + * + * C* ptr = new C(); + * + * // Get weak pointers to ptr. The first time asWeakPtr is called + * // a reference counted WeakReference object is created that + * // can live beyond the lifetime of 'ptr'. The WeakReference + * // object will be notified of 'ptr's destruction. + * WeakPtr weak = ptr->asWeakPtr(); + * WeakPtr other = ptr->asWeakPtr(); + * + * // Test a weak pointer for validity before using it. + * if (weak) { + * weak->num = 17; + * weak->act(); + * } + * + * // Destroying the underlying object clears weak pointers to it. + * delete ptr; + * + * MOZ_ASSERT(!weak, "Deleting |ptr| clears weak pointers to it."); + * MOZ_ASSERT(!other, "Deleting |ptr| clears all weak pointers to it."); + * + * WeakPtr is typesafe and may be used with any class. It is not required that + * the class be reference-counted or allocated in any particular way. + * + * The API was loosely inspired by Chromium's weak_ptr.h: + * http://src.chromium.org/svn/trunk/src/base/memory/weak_ptr.h + */ + +#ifndef mozilla_WeakPtr_h_ +#define mozilla_WeakPtr_h_ + +#include "mozilla/Assertions.h" +#include "mozilla/NullPtr.h" +#include "mozilla/RefPtr.h" +#include "mozilla/TypeTraits.h" + +namespace mozilla { + +template class WeakPtr; + +template +class SupportsWeakPtr +{ + public: + WeakPtr asWeakPtr() { + if (!weakRef) + weakRef = new WeakReference(static_cast(this)); + return WeakPtr(weakRef); + } + + protected: + ~SupportsWeakPtr() { + MOZ_STATIC_ASSERT((IsBaseOf, T>::value), "T must derive from SupportsWeakPtr"); + if (weakRef) + weakRef->detach(); + } + + private: + friend class WeakPtr; + + // This can live beyond the lifetime of the class derived from SupportsWeakPtr. + class WeakReference : public RefCounted + { + public: + explicit WeakReference(T* ptr) : ptr(ptr) {} + T* get() const { + return ptr; + } + + private: + friend class WeakPtr; + friend class SupportsWeakPtr; + void detach() { + ptr = nullptr; + } + T* ptr; + }; + + RefPtr weakRef; +}; + +template +class WeakPtr +{ + public: + WeakPtr(const WeakPtr& o) : ref(o.ref) {} + WeakPtr() : ref(nullptr) {} + + operator T*() const { + return ref->get(); + } + T& operator*() const { + return *ref->get(); + } + + T* operator->() const { + return ref->get(); + } + + private: + friend class SupportsWeakPtr; + + explicit WeakPtr(const RefPtr::WeakReference> &o) : ref(o) {} + + RefPtr::WeakReference> ref; +}; + +} // namespace mozilla + +#endif /* ifdef mozilla_WeakPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id b/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id index 1feaaaeb67..a56f43d2cd 100644 --- a/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id @@ -1 +1 @@ -013d16a49272220cc82f430c2cf72039b2abd4c3 \ No newline at end of file +2559ff4626d1357e05dd1f64c9875b2a51c26957 \ No newline at end of file diff --git a/scripting/javascript/spidermonkey-win32/include/ds/BitArray.h b/scripting/javascript/spidermonkey-win32/include/ds/BitArray.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/gc/Barrier.h b/scripting/javascript/spidermonkey-win32/include/gc/Barrier.h old mode 100644 new mode 100755 index 08c8de8f0d..bd33c5d1d4 --- a/scripting/javascript/spidermonkey-win32/include/gc/Barrier.h +++ b/scripting/javascript/spidermonkey-win32/include/gc/Barrier.h @@ -129,7 +129,7 @@ class EncapsulatedPtr public: EncapsulatedPtr() : value(NULL) {} - explicit EncapsulatedPtr(T *v) : value(v) {} + EncapsulatedPtr(T *v) : value(v) {} explicit EncapsulatedPtr(const EncapsulatedPtr &v) : value(v.value) {} ~EncapsulatedPtr() { pre(); } @@ -222,34 +222,51 @@ class RelocatablePtr : public EncapsulatedPtr { public: RelocatablePtr() : EncapsulatedPtr(NULL) {} - explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { post(); } - explicit RelocatablePtr(const RelocatablePtr &v) - : EncapsulatedPtr(v) { post(); } + explicit RelocatablePtr(T *v) : EncapsulatedPtr(v) { + if (v) + post(); + } + explicit RelocatablePtr(const RelocatablePtr &v) : EncapsulatedPtr(v) { + if (this->value) + post(); + } ~RelocatablePtr() { - this->pre(); - relocate(); + if (this->value) + relocate(this->value->compartment()); } RelocatablePtr &operator=(T *v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); - this->value = v; - post(); + if (v) { + this->value = v; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } RelocatablePtr &operator=(const RelocatablePtr &v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); - this->value = v.value; - post(); + if (v.value) { + this->value = v.value; + post(); + } else if (this->value) { + JSCompartment *comp = this->value->compartment(); + this->value = v; + relocate(comp); + } return *this; } protected: - void post() { T::writeBarrierRelocPost(this->value, (void *)&this->value); } - void relocate() { T::writeBarrierRelocated(this->value, (void *)&this->value); } + inline void post(); + inline void relocate(JSCompartment *comp); }; /* @@ -276,6 +293,9 @@ struct Shape; class BaseShape; namespace types { struct TypeObject; } +typedef EncapsulatedPtr EncapsulatedPtrObject; +typedef EncapsulatedPtr EncapsulatedPtrScript; + typedef RelocatablePtr RelocatablePtrObject; typedef RelocatablePtr RelocatablePtrScript; @@ -303,6 +323,19 @@ struct HeapPtrHasher template struct DefaultHasher< HeapPtr > : HeapPtrHasher { }; +template +struct EncapsulatedPtrHasher +{ + typedef EncapsulatedPtr Key; + typedef T *Lookup; + + static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } + static bool match(const Key &k, Lookup l) { return k.get() == l; } +}; + +template +struct DefaultHasher< EncapsulatedPtr > : EncapsulatedPtrHasher { }; + class EncapsulatedValue : public ValueOperations { protected: @@ -379,7 +412,7 @@ class RelocatableValue : public EncapsulatedValue public: explicit inline RelocatableValue(); explicit inline RelocatableValue(const Value &v); - explicit inline RelocatableValue(const RelocatableValue &v); + inline RelocatableValue(const RelocatableValue &v); inline ~RelocatableValue(); inline RelocatableValue &operator=(const Value &v); @@ -414,7 +447,7 @@ class HeapSlot : public EncapsulatedValue inline void set(JSCompartment *comp, JSObject *owner, uint32_t slot, const Value &v); static inline void writeBarrierPost(JSObject *obj, uint32_t slot); - static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slotno); + static inline void writeBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t slot); private: inline void post(JSObject *owner, uint32_t slot); @@ -428,8 +461,19 @@ class HeapSlot : public EncapsulatedValue * single step. */ inline void -SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count) +SlotRangeWriteBarrierPost(JSCompartment *comp, JSObject *obj, uint32_t start, uint32_t count); + +/* + * This is a post barrier for HashTables whose key can be moved during a GC. + */ +template +inline void +HashTableWriteBarrierPost(JSCompartment *comp, const Map *map, const Key &key) { +#ifdef JS_GCGENERATIONAL + if (key && comp->gcNursery.isInside(key)) + comp->gcStoreBuffer.putGeneric(HashKeyRef(map, key)); +#endif } static inline const Value * @@ -467,15 +511,16 @@ class EncapsulatedId protected: jsid value; - explicit EncapsulatedId() : value(JSID_VOID) {} - explicit inline EncapsulatedId(jsid id) : value(id) {} - ~EncapsulatedId() {} - private: EncapsulatedId(const EncapsulatedId &v) MOZ_DELETE; - EncapsulatedId &operator=(const EncapsulatedId &v) MOZ_DELETE; public: + explicit EncapsulatedId() : value(JSID_VOID) {} + explicit EncapsulatedId(jsid id) : value(id) {} + ~EncapsulatedId(); + + inline EncapsulatedId &operator=(const EncapsulatedId &v); + bool operator==(jsid id) const { return value == id; } bool operator!=(jsid id) const { return value != id; } diff --git a/scripting/javascript/spidermonkey-win32/include/gc/Heap.h b/scripting/javascript/spidermonkey-win32/include/gc/Heap.h old mode 100644 new mode 100755 index 5e9b939c12..b8f8c78925 --- a/scripting/javascript/spidermonkey-win32/include/gc/Heap.h +++ b/scripting/javascript/spidermonkey-win32/include/gc/Heap.h @@ -423,38 +423,47 @@ struct ArenaHeader * chunk. The latter allows to quickly check if the arena is allocated * during the conservative GC scanning without searching the arena in the * list. + * + * We use 8 bits for the allocKind so the compiler can use byte-level memory + * instructions to access it. */ size_t allocKind : 8; /* - * When recursive marking uses too much stack the marking is delayed and - * the corresponding arenas are put into a stack using the following field - * as a linkage. To distinguish the bottom of the stack from the arenas - * not present in the stack we use an extra flag to tag arenas on the - * stack. + * When collecting we sometimes need to keep an auxillary list of arenas, + * for which we use the following fields. This happens for several reasons: + * + * When recursive marking uses too much stack the marking is delayed and the + * corresponding arenas are put into a stack. To distinguish the bottom of + * the stack from the arenas not present in the stack we use the + * markOverflow flag to tag arenas on the stack. * * Delayed marking is also used for arenas that we allocate into during an * incremental GC. In this case, we intend to mark all the objects in the * arena, and it's faster to do this marking in bulk. * - * To minimize the ArenaHeader size we record the next delayed marking - * linkage as arenaAddress() >> ArenaShift and pack it with the allocKind - * field and hasDelayedMarking flag. We use 8 bits for the allocKind, not - * ArenaShift - 1, so the compiler can use byte-level memory instructions - * to access it. + * When sweeping we keep track of which arenas have been allocated since the + * end of the mark phase. This allows us to tell whether a pointer to an + * unmarked object is yet to be finalized or has already been reallocated. + * We set the allocatedDuringIncremental flag for this and clear it at the + * end of the sweep phase. + * + * To minimize the ArenaHeader size we record the next linkage as + * arenaAddress() >> ArenaShift and pack it with the allocKind field and the + * flags. */ public: size_t hasDelayedMarking : 1; size_t allocatedDuringIncremental : 1; size_t markOverflow : 1; - size_t nextDelayedMarking : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; + size_t auxNextLink : JS_BITS_PER_WORD - 8 - 1 - 1 - 1; static void staticAsserts() { /* We must be able to fit the allockind into uint8_t. */ JS_STATIC_ASSERT(FINALIZE_LIMIT <= 255); /* - * nextDelayedMarkingpacking assumes that ArenaShift has enough bits + * auxNextLink packing assumes that ArenaShift has enough bits * to cover allocKind and hasDelayedMarking. */ JS_STATIC_ASSERT(ArenaShift >= 8 + 1 + 1 + 1); @@ -487,7 +496,7 @@ struct ArenaHeader markOverflow = 0; allocatedDuringIncremental = 0; hasDelayedMarking = 0; - nextDelayedMarking = 0; + auxNextLink = 0; } inline uintptr_t arenaAddress() const; @@ -519,6 +528,11 @@ struct ArenaHeader inline ArenaHeader *getNextDelayedMarking() const; inline void setNextDelayedMarking(ArenaHeader *aheader); + inline void unsetDelayedMarking(); + + inline ArenaHeader *getNextAllocDuringSweep() const; + inline void setNextAllocDuringSweep(ArenaHeader *aheader); + inline void unsetAllocDuringSweep(); }; struct Arena @@ -882,15 +896,48 @@ ArenaHeader::setFirstFreeSpan(const FreeSpan *span) inline ArenaHeader * ArenaHeader::getNextDelayedMarking() const { - return &reinterpret_cast(nextDelayedMarking << ArenaShift)->aheader; + JS_ASSERT(hasDelayedMarking); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) { JS_ASSERT(!(uintptr_t(aheader) & ArenaMask)); + JS_ASSERT(!auxNextLink && !hasDelayedMarking); hasDelayedMarking = 1; - nextDelayedMarking = aheader->arenaAddress() >> ArenaShift; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetDelayedMarking() +{ + JS_ASSERT(hasDelayedMarking); + hasDelayedMarking = 0; + auxNextLink = 0; +} + +inline ArenaHeader * +ArenaHeader::getNextAllocDuringSweep() const +{ + JS_ASSERT(allocatedDuringIncremental); + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; +} + +inline void +ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) +{ + JS_ASSERT(!auxNextLink && !allocatedDuringIncremental); + allocatedDuringIncremental = 1; + auxNextLink = aheader->arenaAddress() >> ArenaShift; +} + +inline void +ArenaHeader::unsetAllocDuringSweep() +{ + JS_ASSERT(allocatedDuringIncremental); + allocatedDuringIncremental = 0; + auxNextLink = 0; } JS_ALWAYS_INLINE void diff --git a/scripting/javascript/spidermonkey-win32/include/gc/Root.h b/scripting/javascript/spidermonkey-win32/include/gc/Root.h old mode 100644 new mode 100755 index 4ada9966b8..551be92a8c --- a/scripting/javascript/spidermonkey-win32/include/gc/Root.h +++ b/scripting/javascript/spidermonkey-win32/include/gc/Root.h @@ -62,6 +62,7 @@ namespace JS { * separate rooting analysis. */ +template class MutableHandle; template class Rooted; template @@ -79,6 +80,9 @@ struct NullPtr static void * const constNullValue; }; +template +class MutableHandle; + template class HandleBase {}; @@ -108,6 +112,11 @@ class Handle : public HandleBase ptr = reinterpret_cast(&NullPtr::constNullValue); } + friend class MutableHandle; + Handle(MutableHandle handle) { + ptr = handle.address(); + } + /* * This may be called only if the location of the T is guaranteed * to be marked (for some reason other than being a Rooted), @@ -130,6 +139,12 @@ class Handle : public HandleBase Handle(Rooted &root, typename mozilla::EnableIf::value, int>::Type dummy = 0); + /* Construct a read only handle from a mutable handle. */ + template + inline + Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy = 0); + const T *address() const { return ptr; } T get() const { return *ptr; } @@ -185,6 +200,19 @@ class MutableHandle : public MutableHandleBase *ptr = v; } + /* + * This may be called only if the location of the T is guaranteed + * to be marked (for some reason other than being a Rooted), + * e.g., if it is guaranteed to be reachable from an implicit root. + * + * Create a MutableHandle from a raw location of a T. + */ + static MutableHandle fromMarkedLocation(T *p) { + MutableHandle h; + h.ptr = p; + return h; + } + T *address() const { return ptr; } T get() const { return *ptr; } @@ -195,16 +223,33 @@ class MutableHandle : public MutableHandleBase MutableHandle() {} T *ptr; + + template + void operator =(S v) MOZ_DELETE; }; typedef MutableHandle MutableHandleObject; typedef MutableHandle MutableHandleValue; +/* + * Raw pointer used as documentation that a parameter does not need to be + * rooted. + */ +typedef JSObject * RawObject; + +/* + * By default, pointers should use the inheritance hierarchy to find their + * ThingRootKind. Some pointer types are explicitly set in jspubtd.h so that + * Rooted may be used without the class definition being available. + */ +template +struct RootKind { static ThingRootKind rootKind() { return T::rootKind(); }; }; + template struct RootMethods { static T *initial() { return NULL; } - static ThingRootKind kind() { return T::rootKind(); } + static ThingRootKind kind() { return RootKind::rootKind(); } static bool poisoned(T *v) { return IsPoisonedPtr(v); } }; @@ -291,6 +336,14 @@ Handle::Handle(Rooted &root, ptr = reinterpret_cast(root.address()); } +template template +inline +Handle::Handle(MutableHandle &root, + typename mozilla::EnableIf::value, int>::Type dummy) +{ + ptr = reinterpret_cast(root.address()); +} + template template inline MutableHandle::MutableHandle(Rooted *root, @@ -332,15 +385,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - init(ContextFriendFields::get(cx), ptr, 1); - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { init(ContextFriendFields::get(cx), ptr, count); @@ -363,14 +408,7 @@ class SkipRoot public: template - SkipRoot(JSContext *cx, const T *ptr - JS_GUARD_OBJECT_NOTIFIER_PARAM) - { - JS_GUARD_OBJECT_NOTIFIER_INIT; - } - - template - SkipRoot(JSContext *cx, const T *ptr, size_t count + SkipRoot(JSContext *cx, const T *ptr, size_t count = 1 JS_GUARD_OBJECT_NOTIFIER_PARAM) { JS_GUARD_OBJECT_NOTIFIER_INIT; @@ -381,6 +419,12 @@ class SkipRoot JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +/* + * This typedef is to annotate parameters that we have manually verified do not + * need rooting, as opposed to parameters that have not yet been considered. + */ +typedef JSObject *RawObject; + #ifdef DEBUG JS_FRIEND_API(bool) IsRootingUnnecessaryForContext(JSContext *cx); JS_FRIEND_API(void) SetRootingUnnecessaryForContext(JSContext *cx, bool value); @@ -389,14 +433,16 @@ JS_FRIEND_API(bool) RelaxRootChecksForContext(JSContext *cx); class AssertRootingUnnecessary { JS_DECL_USE_GUARD_OBJECT_NOTIFIER +#ifdef DEBUG JSContext *cx; bool prev; +#endif public: AssertRootingUnnecessary(JSContext *cx JS_GUARD_OBJECT_NOTIFIER_PARAM) - : cx(cx) { JS_GUARD_OBJECT_NOTIFIER_INIT; #ifdef DEBUG + this->cx = cx; prev = IsRootingUnnecessaryForContext(cx); SetRootingUnnecessaryForContext(cx, true); #endif diff --git a/scripting/javascript/spidermonkey-win32/include/gc/Statistics.h b/scripting/javascript/spidermonkey-win32/include/gc/Statistics.h old mode 100644 new mode 100755 index 5b4e355f0b..dfd00dbc94 --- a/scripting/javascript/spidermonkey-win32/include/gc/Statistics.h +++ b/scripting/javascript/spidermonkey-win32/include/gc/Statistics.h @@ -80,6 +80,9 @@ struct Statistics { counts[s]++; } + int64_t beginSCC(); + void endSCC(unsigned scc, int64_t start); + jschar *formatMessage(); jschar *formatJSON(uint64_t timestamp); @@ -134,10 +137,14 @@ struct Statistics { /* Allocated space before the GC started. */ size_t preBytes; + /* Sweep times for SCCs of compartments. */ + Vector sccTimes; + void beginGC(); void endGC(); - int64_t gcDuration(); + void gcDuration(int64_t *total, int64_t *maxPause); + void sccDurations(int64_t *total, int64_t *maxPause); void printStats(); bool formatData(StatisticsSerializer &ss, uint64_t timestamp); @@ -168,6 +175,17 @@ struct AutoPhase { JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; +struct AutoSCC { + AutoSCC(Statistics &stats, unsigned scc JS_GUARD_OBJECT_NOTIFIER_PARAM) + : stats(stats), scc(scc) { JS_GUARD_OBJECT_NOTIFIER_INIT; start = stats.beginSCC(); } + ~AutoSCC() { stats.endSCC(scc, start); } + + Statistics &stats; + unsigned scc; + int64_t start; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + } /* namespace gcstats */ } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-win32/include/gc/StoreBuffer.h b/scripting/javascript/spidermonkey-win32/include/gc/StoreBuffer.h new file mode 100755 index 0000000000..9240e93f10 --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/gc/StoreBuffer.h @@ -0,0 +1,398 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifdef JSGC_GENERATIONAL +#ifndef jsgc_storebuffer_h___ +#define jsgc_storebuffer_h___ + +#include "jsgc.h" +#include "jsalloc.h" + +#include "gc/Marking.h" + +namespace js { +namespace gc { + +/* + * Note: this is a stub Nursery that does not actually contain a heap, just a + * set of pointers which are "inside" the nursery to implement verification. + */ +class Nursery +{ + HashSet, SystemAllocPolicy> nursery; + + public: + Nursery() : nursery() {} + + bool enable() { + if (!nursery.initialized()) + return nursery.init(); + return true; + } + + void disable() { + if (!nursery.initialized()) + return; + nursery.finish(); + } + + bool isInside(void *cell) const { + JS_ASSERT((uintptr_t(cell) & 0x3) == 0); + return nursery.initialized() && nursery.has(cell); + } + + void insertPointer(void *cell) { + nursery.putNew(cell); + } +}; + +/* + * BufferableRef represents an abstract reference for use in the generational + * GC's remembered set. Entries in the store buffer that cannot be represented + * with the simple pointer-to-a-pointer scheme must derive from this class and + * use the generic store buffer interface. + */ +class BufferableRef +{ + public: + virtual bool match(void *location) = 0; + virtual void mark(JSTracer *trc) = 0; +}; + +/* + * HashKeyRef represents a reference to a HashTable key. Manual HashTable + * barriers should should instantiate this template with their own table/key + * type to insert into the generic buffer with putGeneric. + */ +template +class HashKeyRef : public BufferableRef +{ + Map *map; + Key key; + + typedef typename Map::Ptr Ptr; + + public: + HashKeyRef(Map *m, const Key &k) : map(m), key(k) {} + + bool match(void *location) { + Ptr p = map->lookup(key); + if (!p) + return false; + return &p->key == location; + } + + void mark(JSTracer *trc) {} +}; + +/* + * The StoreBuffer observes all writes that occur in the system and performs + * efficient filtering of them to derive a remembered set for nursery GC. + */ +class StoreBuffer +{ + /* TODO: profile to find the ideal size for these. */ + static const size_t ValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t CellBufferSize = 2 * 1024 * sizeof(Cell **); + static const size_t SlotBufferSize = 2 * 1024 * (sizeof(JSObject *) + sizeof(uint32_t)); + static const size_t RelocValueBufferSize = 1 * 1024 * sizeof(Value *); + static const size_t RelocCellBufferSize = 1 * 1024 * sizeof(Cell **); + static const size_t GenericBufferSize = 1 * 1024 * sizeof(int); + static const size_t TotalSize = ValueBufferSize + CellBufferSize + + SlotBufferSize + RelocValueBufferSize + RelocCellBufferSize + + GenericBufferSize; + + typedef HashSet, SystemAllocPolicy> EdgeSet; + + /* + * This buffer holds only a single type of edge. Using this buffer is more + * efficient than the generic buffer when many writes will be to the same + * type of edge: e.g. Value or Cell*. + */ + template + class MonoTypeBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + T *base; /* Pointer to the start of the buffer. */ + T *pos; /* Pointer to the current insertion position. */ + T *top; /* Pointer to one element after the end. */ + + MonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery), base(NULL), pos(NULL), top(NULL) + {} + + MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + bool isEmpty() const { return pos == base; } + bool isFull() const { JS_ASSERT(pos <= top); return pos == top; } + + /* Compaction algorithms. */ + void compactNotInSet(); + + /* + * Attempts to reduce the usage of the buffer by removing unnecessary + * entries. + */ + virtual void compact(); + + /* Add one item to the buffer. */ + void put(const T &v); + + /* For verification. */ + bool accumulateEdges(EdgeSet &edges); + }; + + /* + * Overrides the MonoTypeBuffer to support pointers that may be moved in + * memory outside of the GC's control. + */ + template + class RelocatableMonoTypeBuffer : public MonoTypeBuffer + { + friend class StoreBuffer; + + RelocatableMonoTypeBuffer(StoreBuffer *owner, Nursery *nursery) + : MonoTypeBuffer(owner, nursery) + {} + + /* Override compaction to filter out removed items. */ + void compactMoved(); + virtual void compact(); + + /* Record a removal from the buffer. */ + void unput(const T &v); + }; + + class GenericBuffer + { + friend class StoreBuffer; + + StoreBuffer *owner; + Nursery *nursery; + + uint8_t *base; /* Pointer to start of buffer. */ + uint8_t *pos; /* Pointer to current buffer position. */ + uint8_t *top; /* Pointer to one past the last entry. */ + + GenericBuffer(StoreBuffer *owner, Nursery *nursery) + : owner(owner), nursery(nursery) + {} + + GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE; + + bool enable(uint8_t *region, size_t len); + void disable(); + + /* Check if a pointer is present in the buffer. */ + bool containsEdge(void *location) const; + + template + void put(const T &t) { + /* Check if we have been enabled. */ + if (!pos) + return; + + /* Check for overflow. */ + if (top - pos < (unsigned)(sizeof(unsigned) + sizeof(T))) { + owner->setOverflowed(); + return; + } + + *((unsigned *)pos) = sizeof(T); + pos += sizeof(unsigned); + + T *p = (T *)pos; + new (p) T(t); + pos += sizeof(T); + } + }; + + class CellPtrEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Cell **edge; + + CellPtrEdge(Cell **v) : edge(v) {} + bool operator==(const CellPtrEdge &other) const { return edge == other.edge; } + bool operator!=(const CellPtrEdge &other) const { return edge != other.edge; } + + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(*edge); + } + + bool isNullEdge() const { + return !*edge; + } + + CellPtrEdge tagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) | 1)); } + CellPtrEdge untagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + class ValueEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + friend class StoreBuffer::RelocatableMonoTypeBuffer; + + Value *edge; + + ValueEdge(Value *v) : edge(v) {} + bool operator==(const ValueEdge &other) const { return edge == other.edge; } + bool operator!=(const ValueEdge &other) const { return edge != other.edge; } + + void *deref() const { return edge->isGCThing() ? edge->toGCThing() : NULL; } + void *location() const { return (void *)edge; } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(edge) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + + ValueEdge tagged() const { return ValueEdge((Value *)(uintptr_t(edge) | 1)); } + ValueEdge untagged() const { return ValueEdge((Value *)(uintptr_t(edge) & ~1)); } + bool isTagged() const { return bool(uintptr_t(edge) & 1); } + }; + + struct SlotEdge + { + friend class StoreBuffer; + friend class StoreBuffer::MonoTypeBuffer; + + JSObject *object; + uint32_t offset; + + SlotEdge(JSObject *object, uint32_t offset) : object(object), offset(offset) {} + + bool operator==(const SlotEdge &other) const { + return object == other.object && offset == other.offset; + } + + bool operator!=(const SlotEdge &other) const { + return object != other.object || offset != other.offset; + } + + HeapSlot *slotLocation() const { + if (object->isDenseArray()) { + if (offset >= object->getDenseArrayInitializedLength()) + return NULL; + return (HeapSlot *)&object->getDenseArrayElement(offset); + } + if (offset >= object->slotSpan()) + return NULL; + return &object->getSlotRef(offset); + } + + void *deref() const { + HeapSlot *loc = slotLocation(); + return (loc && loc->isGCThing()) ? loc->toGCThing() : NULL; + } + + void *location() const { + return (void *)slotLocation(); + } + + bool inRememberedSet(Nursery *n) { + return !n->isInside(object) && n->isInside(deref()); + } + + bool isNullEdge() const { + return !deref(); + } + }; + + MonoTypeBuffer bufferVal; + MonoTypeBuffer bufferCell; + MonoTypeBuffer bufferSlot; + RelocatableMonoTypeBuffer bufferRelocVal; + RelocatableMonoTypeBuffer bufferRelocCell; + GenericBuffer bufferGeneric; + + Nursery *nursery; + + void *buffer; + + bool overflowed; + bool enabled; + + /* For the verifier. */ + EdgeSet edgeSet; + + /* For use by our owned buffers. */ + void setOverflowed() { overflowed = true; } + + public: + StoreBuffer(Nursery *n) + : bufferVal(this, n), bufferCell(this, n), bufferSlot(this, n), + bufferRelocVal(this, n), bufferRelocCell(this, n), bufferGeneric(this, n), + nursery(n), buffer(NULL), overflowed(false), enabled(false) + {} + + bool enable(); + void disable(); + bool isEnabled() { return enabled; } + + /* Get the overflowed status. */ + bool hasOverflowed() const { return overflowed; } + + /* Insert a single edge into the buffer/remembered set. */ + void putValue(Value *v) { + bufferVal.put(v); + } + void putCell(Cell **o) { + bufferCell.put(o); + } + void putSlot(JSObject *obj, uint32_t slot) { + bufferSlot.put(SlotEdge(obj, slot)); + } + + /* Insert or update a single edge in the Relocatable buffer. */ + void putRelocatableValue(Value *v) { + bufferRelocVal.put(v); + } + void putRelocatableCell(Cell **c) { + bufferRelocCell.put(c); + } + void removeRelocatableValue(Value *v) { + bufferRelocVal.unput(v); + } + void removeRelocatableCell(Cell **c) { + bufferRelocCell.unput(c); + } + + /* Insert an entry into the generic buffer. */ + template + void putGeneric(const T &t) { + bufferGeneric.put(t); + } + + /* For the verifier. */ + bool coalesceForVerification(); + void releaseVerificationData(); + bool containsEdgeAt(void *loc) const; +}; + +} /* namespace gc */ +} /* namespace js */ + +#endif /* jsgc_storebuffer_h___ */ +#endif /* JSGC_GENERATIONAL */ diff --git a/scripting/javascript/spidermonkey-win32/include/js-config.h b/scripting/javascript/spidermonkey-win32/include/js-config.h old mode 100644 new mode 100755 index 94e806e108..dfb0f39115 --- a/scripting/javascript/spidermonkey-win32/include/js-config.h +++ b/scripting/javascript/spidermonkey-win32/include/js-config.h @@ -1,69 +1,68 @@ -/* js-config.h. Generated automatically by configure. */ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sw=4 et tw=78: - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef js_config_h___ -#define js_config_h___ - -/* Definitions set at build time that affect SpiderMonkey's public API. - This header file is generated by the SpiderMonkey configure script, - and installed along with jsapi.h. */ - -/* Define to 1 if SpiderMonkey should support multi-threaded clients. */ -/* #undef JS_THREADSAFE */ - -/* Define to 1 if SpiderMonkey should include ctypes support. */ -/* #undef JS_HAS_CTYPES */ - -/* Define to 1 if SpiderMonkey should support the ability to perform - entirely too much GC. */ -/* #undef JS_GC_ZEAL */ - -/* Define to 1 if the header is present and - useable. See jscpucfg.h. */ -/* #undef JS_HAVE_ENDIAN_H */ - -/* Define to 1 if the header is present and - useable. See jscpucfg.h. */ -/* #undef JS_HAVE_MACHINE_ENDIAN_H */ - -/* Define to 1 if the header is present and - useable. See jscpucfg.h. */ -/* #undef JS_HAVE_SYS_ISA_DEFS_H */ - -/* Define to 1 if the defines int8_t, etc. */ -/* #undef JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES */ - -/* Define to 1 if the N-byte __intN types are defined by the - compiler. */ -#define JS_HAVE___INTN 1 - -/* Define to 1 if #including provides definitions for - intptr_t and uintptr_t. */ -#define JS_STDDEF_H_HAS_INTPTR_T 1 - -/* Define to 1 if #including provides definitions for - intptr_t and uintptr_t. */ -/* #undef JS_CRTDEFS_H_HAS_INTPTR_T */ - -/* The configure script defines these if it doesn't #define - JS_HAVE_STDINT_H. */ -/* #undef JS_INT8_TYPE */ -/* #undef JS_INT16_TYPE */ -/* #undef JS_INT32_TYPE */ -/* #undef JS_INT64_TYPE */ -/* #undef JS_INTPTR_TYPE */ -/* #undef JS_BYTES_PER_WORD */ - -/* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being - correct. */ -/* #undef JS_METHODJIT */ - -/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */ -#define JS_HAS_XML_SUPPORT 1 - -#endif /* js_config_h___ */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef js_config_h___ +#define js_config_h___ + +/* Definitions set at build time that affect SpiderMonkey's public API. + This header file is generated by the SpiderMonkey configure script, + and installed along with jsapi.h. */ + +/* Define to 1 if SpiderMonkey should support multi-threaded clients. */ +/* #undef JS_THREADSAFE */ + +/* Define to 1 if SpiderMonkey should include ctypes support. */ +/* #undef JS_HAS_CTYPES */ + +/* Define to 1 if SpiderMonkey should support the ability to perform + entirely too much GC. */ +/* #undef JS_GC_ZEAL */ + +/* Define to 1 if the header is present and + useable. See jscpucfg.h. */ +/* #undef JS_HAVE_ENDIAN_H */ + +/* Define to 1 if the header is present and + useable. See jscpucfg.h. */ +/* #undef JS_HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if the header is present and + useable. See jscpucfg.h. */ +/* #undef JS_HAVE_SYS_ISA_DEFS_H */ + +/* Define to 1 if the defines int8_t, etc. */ +/* #undef JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES */ + +/* Define to 1 if the N-byte __intN types are defined by the + compiler. */ +#define JS_HAVE___INTN 1 + +/* Define to 1 if #including provides definitions for + intptr_t and uintptr_t. */ +#define JS_STDDEF_H_HAS_INTPTR_T 1 + +/* Define to 1 if #including provides definitions for + intptr_t and uintptr_t. */ +/* #undef JS_CRTDEFS_H_HAS_INTPTR_T */ + +/* The configure script defines these if it doesn't #define + JS_HAVE_STDINT_H. */ +/* #undef JS_INT8_TYPE */ +/* #undef JS_INT16_TYPE */ +/* #undef JS_INT32_TYPE */ +/* #undef JS_INT64_TYPE */ +/* #undef JS_INTPTR_TYPE */ +/* #undef JS_BYTES_PER_WORD */ + +/* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being + correct. */ +/* #undef JS_METHODJIT */ + +/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */ +#define JS_HAS_XML_SUPPORT 1 + +#endif /* js_config_h___ */ diff --git a/scripting/javascript/spidermonkey-win32/include/js.msg b/scripting/javascript/spidermonkey-win32/include/js.msg old mode 100644 new mode 100755 index e30c87b1f0..e3d8e9830d --- a/scripting/javascript/spidermonkey-win32/include/js.msg +++ b/scripting/javascript/spidermonkey-win32/include/js.msg @@ -116,8 +116,8 @@ MSG_DEF(JSMSG_UNMATCHED_RIGHT_PAREN, 62, 0, JSEXN_SYNTAXERR, "unmatched ) in r MSG_DEF(JSMSG_TOO_BIG_TO_ENCODE, 63, 0, JSEXN_INTERNALERR, "data are to big to encode") MSG_DEF(JSMSG_ARG_INDEX_OUT_OF_RANGE, 64, 1, JSEXN_RANGEERR, "argument {0} accesses an index that is out of range") MSG_DEF(JSMSG_SPREAD_TOO_LARGE, 65, 0, JSEXN_RANGEERR, "array too large due to spread operand(s)") -MSG_DEF(JSMSG_UNUSED66, 66, 0, JSEXN_NONE, "") -MSG_DEF(JSMSG_UNUSED67, 67, 0, JSEXN_NONE, "") +MSG_DEF(JSMSG_SOURCE_TOO_LONG, 66, 0, JSEXN_RANGEERR, "source is too long") +MSG_DEF(JSMSG_BAD_WEAKMAP_KEY, 67, 0, JSEXN_TYPEERR, "cannot use the given object as a weak map key") MSG_DEF(JSMSG_BAD_SCRIPT_MAGIC, 68, 0, JSEXN_INTERNALERR, "bad script XDR magic number") MSG_DEF(JSMSG_PAREN_BEFORE_FORMAL, 69, 0, JSEXN_SYNTAXERR, "missing ( before formal parameters") MSG_DEF(JSMSG_MISSING_FORMAL, 70, 0, JSEXN_SYNTAXERR, "missing formal parameter") @@ -126,7 +126,7 @@ MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body") MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition") MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition") -MSG_DEF(JSMSG_DESTRUCT_DUP_ARG, 76, 0, JSEXN_SYNTAXERR, "duplicate argument is mixed with destructuring pattern") +MSG_DEF(JSMSG_BAD_DUP_ARGS, 76, 0, JSEXN_SYNTAXERR, "duplicate argument names not allowed in this context") MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator") MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression") MSG_DEF(JSMSG_XML_WHOLE_PROGRAM, 79, 0, JSEXN_SYNTAXERR, "XML can't be the whole program") @@ -196,7 +196,7 @@ MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned functio MSG_DEF(JSMSG_SHARPVAR_TOO_BIG, 143, 0, JSEXN_SYNTAXERR, "overlarge sharp variable number") MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character") MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant") -MSG_DEF(JSMSG_BAD_INDIRECT_CALL, 146, 1, JSEXN_EVALERR, "function {0} must be called directly, and not by way of a function of another name") +MSG_DEF(JSMSG_UNUSED146, 146, 0, JSEXN_NONE, "") MSG_DEF(JSMSG_UNCAUGHT_EXCEPTION, 147, 1, JSEXN_INTERNALERR, "uncaught exception: {0}") MSG_DEF(JSMSG_INVALID_BACKREF, 148, 0, JSEXN_SYNTAXERR, "non-octal digit in an escape sequence that doesn't match a back-reference") MSG_DEF(JSMSG_BAD_BACKREF, 149, 0, JSEXN_SYNTAXERR, "back-reference exceeds number of capturing parentheses") @@ -352,3 +352,11 @@ MSG_DEF(JSMSG_FUNCTION_ARGUMENTS_AND_REST, 298, 0, JSEXN_ERR, "the 'arguments' p MSG_DEF(JSMSG_REST_WITH_DEFAULT, 299, 0, JSEXN_SYNTAXERR, "rest parameter may not have a default") MSG_DEF(JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT, 300, 0, JSEXN_SYNTAXERR, "parameter(s) with default followed by parameter without default") MSG_DEF(JSMSG_YIELD_IN_DEFAULT, 301, 0, JSEXN_SYNTAXERR, "yield in default expression") +MSG_DEF(JSMSG_INTRINSIC_NOT_DEFINED, 302, 1, JSEXN_REFERENCEERR, "no intrinsic function {0}") +MSG_DEF(JSMSG_ALREADY_HAS_SOURCEMAP, 303, 1, JSEXN_ERR, "{0} is being assigned a source map, yet already has one") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_ARG, 304, 1, JSEXN_TYPEERR, "invalid ParallelArray{0} argument") +MSG_DEF(JSMSG_PAR_ARRAY_BAD_PARTITION, 305, 0, JSEXN_ERR, "argument must be divisible by outermost dimension") +MSG_DEF(JSMSG_PAR_ARRAY_REDUCE_EMPTY, 306, 0, JSEXN_ERR, "cannot reduce empty ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_ALREADY_FLAT, 307, 0, JSEXN_ERR, "cannot flatten 1-dimensional ParallelArray object") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_CONFLICT, 308, 0, JSEXN_ERR, "no conflict resolution function provided") +MSG_DEF(JSMSG_PAR_ARRAY_SCATTER_BOUNDS, 309, 0, JSEXN_ERR, "index in scatter vector out of bounds") diff --git a/scripting/javascript/spidermonkey-win32/include/js/HashTable.h b/scripting/javascript/spidermonkey-win32/include/js/HashTable.h old mode 100644 new mode 100755 index bc1f446b1a..0e8d9bf63c --- a/scripting/javascript/spidermonkey-win32/include/js/HashTable.h +++ b/scripting/javascript/spidermonkey-win32/include/js/HashTable.h @@ -15,9 +15,6 @@ namespace js { class TempAllocPolicy; -/* Integral types for all hash functions. */ -typedef uint32_t HashNumber; - /*****************************************************************************/ namespace detail { @@ -217,9 +214,6 @@ class HashTable : private AllocPolicy * this operation until the next call to |popFront()|. */ void rekeyFront(const Lookup &l, const Key &k) { - JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); - if (match(*this->cur, l)) - return; typename HashTableEntry::NonConstT t = this->cur->t; HashPolicy::setKey(t, const_cast(k)); table.remove(*this->cur); @@ -288,7 +282,6 @@ class HashTable : private AllocPolicy static const uint8_t sMinAlphaFrac = 64; /* (0x100 * .25) taken from jsdhash.h */ static const uint8_t sMaxAlphaFrac = 192; /* (0x100 * .75) taken from jsdhash.h */ static const uint8_t sInvMaxAlpha = 171; /* (ceil(0x100 / .75) >> 1) */ - static const HashNumber sGoldenRatio = 0x9E3779B9U; /* taken from jsdhash.h */ static const HashNumber sFreeKey = Entry::sFreeKey; static const HashNumber sRemovedKey = Entry::sRemovedKey; static const HashNumber sCollisionBit = Entry::sCollisionBit; @@ -308,10 +301,7 @@ class HashTable : private AllocPolicy static HashNumber prepareHash(const Lookup& l) { - HashNumber keyHash = HashPolicy::hash(l); - - /* Improve keyHash distribution. */ - keyHash *= sGoldenRatio; + HashNumber keyHash = ScrambleHashCode(HashPolicy::hash(l)); /* Avoid reserved hash codes. */ if (!isLiveHash(keyHash)) @@ -1003,6 +993,9 @@ template class HashMap { + typedef typename tl::StaticAssert::result>::result keyAssert; + typedef typename tl::StaticAssert::result>::result valAssert; + public: typedef typename HashPolicy::Lookup Lookup; diff --git a/scripting/javascript/spidermonkey-win32/include/js/LegacyIntTypes.h b/scripting/javascript/spidermonkey-win32/include/js/LegacyIntTypes.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/js/MemoryMetrics.h b/scripting/javascript/spidermonkey-win32/include/js/MemoryMetrics.h old mode 100644 new mode 100755 index 20edc08705..6942823c22 --- a/scripting/javascript/spidermonkey-win32/include/js/MemoryMetrics.h +++ b/scripting/javascript/spidermonkey-win32/include/js/MemoryMetrics.h @@ -56,6 +56,7 @@ struct RuntimeSizes , gcMarker(0) , mathCache(0) , scriptFilenames(0) + , scriptSources(0) , compartmentObjects(0) {} @@ -71,6 +72,7 @@ struct RuntimeSizes size_t gcMarker; size_t mathCache; size_t scriptFilenames; + size_t scriptSources; // This is the exception to the "RuntimeSizes doesn't measure things within // compartments" rule. We combine the sizes of all the JSCompartment diff --git a/scripting/javascript/spidermonkey-win32/include/js/TemplateLib.h b/scripting/javascript/spidermonkey-win32/include/js/TemplateLib.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/js/Utility.h b/scripting/javascript/spidermonkey-win32/include/js/Utility.h old mode 100644 new mode 100755 index 327fce3e99..5c845e1183 --- a/scripting/javascript/spidermonkey-win32/include/js/Utility.h +++ b/scripting/javascript/spidermonkey-win32/include/js/Utility.h @@ -355,6 +355,26 @@ JS_FLOOR_LOG2W(size_t n) return js_FloorLog2wImpl(n); } +/* + * JS_ROTATE_LEFT32 + * + * There is no rotate operation in the C Language so the construct (a << 4) | + * (a >> 28) is used instead. Most compilers convert this to a rotate + * instruction but some versions of MSVC don't without a little help. To get + * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic + * and use a pragma to make _rotl inline. + * + * MSVC in VS2005 will do an inline rotate instruction on the above construct. + */ +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ + defined(_M_X64)) +#include +#pragma intrinsic(_rotl) +#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) +#else +#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +#endif + JS_END_EXTERN_C #ifdef __cplusplus @@ -599,11 +619,18 @@ public: class UnwantedForeground : public Foreground { }; -template -struct ScopedDeletePtrTraits +template +struct ScopedFreePtrTraits +{ + typedef T* type; + static T* empty() { return NULL; } + static void release(T* ptr) { Foreground::free_(ptr); } +}; +SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) + +template +struct ScopedDeletePtrTraits : public ScopedFreePtrTraits { - typedef T *type; - static T *empty() { return NULL; } static void release(T *ptr) { Foreground::delete_(ptr); } }; SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits) @@ -829,20 +856,7 @@ class MoveRef { explicit MoveRef(T &t) : pointer(&t) { } T &operator*() const { return *pointer; } T *operator->() const { return pointer; } -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(__clang__) - /* - * If MoveRef is used in a rvalue position (which is expected), we can - * end up in a situation where, without this ifdef, we would try to pass - * a T& to a move constructor, which fails. It is not clear if the compiler - * should instead use the copy constructor, but for now this lets us build - * with clang. See bug 689066 and llvm.org/pr11003 for the details. - * Note: We can probably remove MoveRef completely once we are comfortable - * using c++11. - */ - operator T&& () const { return static_cast(*pointer); } -#else operator T& () const { return *pointer; } -#endif private: T *pointer; }; @@ -895,6 +909,51 @@ RoundUpPow2(size_t x) return size_t(1) << JS_CEILING_LOG2W(x); } +/* Integral types for all hash functions. */ +typedef uint32_t HashNumber; +const unsigned HashNumberSizeBits = 32; + +namespace detail { + +/* + * Given a raw hash code, h, return a number that can be used to select a hash + * bucket. + * + * This function aims to produce as uniform an output distribution as possible, + * especially in the most significant (leftmost) bits, even though the input + * distribution may be highly nonrandom, given the constraints that this must + * be deterministic and quick to compute. + * + * Since the leftmost bits of the result are best, the hash bucket index is + * computed by doing ScrambleHashCode(h) / (2^32/N) or the equivalent + * right-shift, not ScrambleHashCode(h) % N or the equivalent bit-mask. + * + * FIXME: OrderedHashTable uses a bit-mask; see bug 775896. + */ +inline HashNumber +ScrambleHashCode(HashNumber h) +{ + /* + * Simply returning h would not cause any hash tables to produce wrong + * answers. But it can produce pathologically bad performance: The caller + * right-shifts the result, keeping only the highest bits. The high bits of + * hash codes are very often completely entropy-free. (So are the lowest + * bits.) + * + * So we use Fibonacci hashing, as described in Knuth, The Art of Computer + * Programming, 6.4. This mixes all the bits of the input hash code h. + * + * The value of goldenRatio is taken from the hex + * expansion of the golden ratio, which starts 1.9E3779B9.... + * This value is especially good if values with consecutive hash codes + * are stored in a hash table; see Knuth for details. + */ + static const HashNumber goldenRatio = 0x9E3779B9U; + return h * goldenRatio; +} + +} /* namespace detail */ + } /* namespace js */ namespace JS { @@ -910,7 +969,7 @@ namespace JS { * a live integer value. */ -inline void PoisonPtr(uintptr_t *v) +inline void PoisonPtr(void *v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG) uint8_t *ptr = (uint8_t *) v + 3; diff --git a/scripting/javascript/spidermonkey-win32/include/js/Vector.h b/scripting/javascript/spidermonkey-win32/include/js/Vector.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jsalloc.h b/scripting/javascript/spidermonkey-win32/include/jsalloc.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jsapi.h.REMOVED.git-id b/scripting/javascript/spidermonkey-win32/include/jsapi.h.REMOVED.git-id index 5c56f3b1fe..cb870fb789 100644 --- a/scripting/javascript/spidermonkey-win32/include/jsapi.h.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-win32/include/jsapi.h.REMOVED.git-id @@ -1 +1 @@ -37b6af08d1e6059f152ae515d8d7422a346cf7ed \ No newline at end of file +8a03481ec145a3a0e532637dd52bf80605b7a713 \ No newline at end of file diff --git a/scripting/javascript/spidermonkey-win32/include/jsatom.h b/scripting/javascript/spidermonkey-win32/include/jsatom.h old mode 100644 new mode 100755 index a3447e06b4..cc9a23f49b --- a/scripting/javascript/spidermonkey-win32/include/jsatom.h +++ b/scripting/javascript/spidermonkey-win32/include/jsatom.h @@ -12,12 +12,12 @@ #include "jsalloc.h" #include "jsapi.h" #include "jsprvtd.h" -#include "jshash.h" #include "jspubtd.h" #include "jslock.h" #include "gc/Barrier.h" #include "js/HashTable.h" +#include "mozilla/HashFunctions.h" struct JSIdArray { int length; @@ -83,23 +83,15 @@ JSID_TO_ATOM(jsid id) return (JSAtom *)JSID_TO_STRING(id); } -JS_STATIC_ASSERT(sizeof(JSHashNumber) == 4); +JS_STATIC_ASSERT(sizeof(js::HashNumber) == 4); JS_STATIC_ASSERT(sizeof(jsid) == JS_BYTES_PER_WORD); namespace js { -static JS_ALWAYS_INLINE JSHashNumber +static JS_ALWAYS_INLINE js::HashNumber HashId(jsid id) { - JSHashNumber n = -#if JS_BYTES_PER_WORD == 4 - JSHashNumber(JSID_BITS(id)); -#elif JS_BYTES_PER_WORD == 8 - JSHashNumber(JSID_BITS(id)) ^ JSHashNumber(JSID_BITS(id) >> 32); -#else -# error "Unsupported configuration" -#endif - return n * JS_GOLDEN_RATIO; + return HashGeneric(JSID_BITS(id)); } static JS_ALWAYS_INLINE Value @@ -135,15 +127,6 @@ struct DefaultHasher } -#if JS_BYTES_PER_WORD == 4 -# define ATOM_HASH(atom) ((JSHashNumber)(atom) >> 2) -#elif JS_BYTES_PER_WORD == 8 -# define ATOM_HASH(atom) (((JSHashNumber)(uintptr_t)(atom) >> 3) ^ \ - (JSHashNumber)((uintptr_t)(atom) >> 32)) -#else -# error "Unsupported configuration" -#endif - /* * Return a printable, lossless char[] representation of a string-type atom. * The lifetime of the result matches the lifetime of bytes. @@ -342,29 +325,28 @@ extern const char js_send_str[]; extern const char js_getter_str[]; extern const char js_setter_str[]; +namespace js { + /* * Initialize atom state. Return true on success, false on failure to allocate * memory. The caller must zero rt->atomState before calling this function and * only call it after js_InitGC successfully returns. */ extern JSBool -js_InitAtomState(JSRuntime *rt); +InitAtomState(JSRuntime *rt); /* * Free and clear atom state including any interned string atoms. This * function must be called before js_FinishGC. */ extern void -js_FinishAtomState(JSRuntime *rt); +FinishAtomState(JSRuntime *rt); /* * Atom tracing and garbage collection hooks. */ - -namespace js { - extern void -MarkAtomState(JSTracer *trc, bool markAll); +MarkAtomState(JSTracer *trc); extern void SweepAtomState(JSRuntime *rt); @@ -382,58 +364,32 @@ enum InternBehavior InternAtom = true }; -} /* namespace js */ +extern JSAtom * +Atomize(JSContext *cx, const char *bytes, size_t length, + js::InternBehavior ib = js::DoNotInternAtom, + js::FlationCoding fc = js::NormalEncoding); extern JSAtom * -js_Atomize(JSContext *cx, const char *bytes, size_t length, - js::InternBehavior ib = js::DoNotInternAtom, - js::FlationCoding fc = js::NormalEncoding); +AtomizeChars(JSContext *cx, const jschar *chars, size_t length, + js::InternBehavior ib = js::DoNotInternAtom); extern JSAtom * -js_AtomizeChars(JSContext *cx, const jschar *chars, size_t length, - js::InternBehavior ib = js::DoNotInternAtom); - -extern JSAtom * -js_AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); - -/* - * Return an existing atom for the given char array or null if the char - * sequence is currently not atomized. - */ -extern JSAtom * -js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length); - -#ifdef DEBUG - -extern JS_FRIEND_API(void) -js_DumpAtoms(JSContext *cx, FILE *fp); - -#endif - -namespace js { +AtomizeString(JSContext *cx, JSString *str, js::InternBehavior ib = js::DoNotInternAtom); inline JSAtom * ToAtom(JSContext *cx, const js::Value &v); bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, - jsid *idp, Value *vp); + jsid *idp, MutableHandleValue vp); inline bool InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid *idp) { - Value dummy; + RootedValue dummy(cx); return InternNonIntElementId(cx, obj, idval, idp, &dummy); } -/* - * For all unmapped atoms recorded in al, add a mapping from the atom's index - * to its address. map->length must already be set to the number of atoms in - * the list and map->vector must point to pre-allocated memory. - */ -extern void -InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtr *atoms); - template bool XDRAtom(XDRState *xdr, JSAtom **atomp); diff --git a/scripting/javascript/spidermonkey-win32/include/jsatom.tbl b/scripting/javascript/spidermonkey-win32/include/jsatom.tbl old mode 100644 new mode 100755 index 3c2e47f450..969790f047 --- a/scripting/javascript/spidermonkey-win32/include/jsatom.tbl +++ b/scripting/javascript/spidermonkey-win32/include/jsatom.tbl @@ -43,6 +43,7 @@ DEFINE_ATOM(call, "call") DEFINE_ATOM(callee, "callee") DEFINE_ATOM(caller, "caller") DEFINE_ATOM(classPrototype, "prototype") +DEFINE_ATOM(columnNumber, "columnNumber") DEFINE_ATOM(constructor, "constructor") DEFINE_ATOM(each, "each") DEFINE_ATOM(eval, "eval") @@ -53,7 +54,8 @@ DEFINE_ATOM(ignoreCase, "ignoreCase") DEFINE_ATOM(index, "index") DEFINE_ATOM(input, "input") DEFINE_ATOM(toISOString, "toISOString") -DEFINE_ATOM(iterator, "__iterator__") +DEFINE_ATOM(iterator, "iterator") +DEFINE_ATOM(iteratorIntrinsic, "__iterator__") DEFINE_ATOM(join, "join") DEFINE_ATOM(lastIndex, "lastIndex") DEFINE_ATOM(length, "length") @@ -121,6 +123,7 @@ DEFINE_PROTOTYPE_ATOM(WeakMap) DEFINE_ATOM(buffer, "buffer") DEFINE_ATOM(byteLength, "byteLength") DEFINE_ATOM(byteOffset, "byteOffset") +DEFINE_ATOM(shape, "shape") DEFINE_KEYWORD_ATOM(return) DEFINE_KEYWORD_ATOM(throw) DEFINE_ATOM(url, "url") @@ -148,3 +151,4 @@ DEFINE_ATOM(unescape, "unescape") DEFINE_ATOM(uneval, "uneval") DEFINE_ATOM(unwatch, "unwatch") DEFINE_ATOM(watch, "watch") +DEFINE_ATOM(_CallFunction, "_CallFunction") diff --git a/scripting/javascript/spidermonkey-win32/include/jsclass.h b/scripting/javascript/spidermonkey-win32/include/jsclass.h old mode 100644 new mode 100755 index e5bcacc05e..3da83a633e --- a/scripting/javascript/spidermonkey-win32/include/jsclass.h +++ b/scripting/javascript/spidermonkey-win32/include/jsclass.h @@ -161,35 +161,35 @@ typedef JSBool (* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp, MutableHandleShape propp); typedef JSBool -(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, const Value *value, +(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, const Value *value, +(* DefinePropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, const Value *value, +(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, const Value *value, +(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); typedef JSBool -(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, Value *vp); +(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); typedef JSBool -(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, Value *vp); +(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp); typedef JSBool -(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp); +(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); typedef JSBool -(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, Value *vp, bool* present); +(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool* present); typedef JSBool -(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, Value *vp); +(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp); typedef JSBool -(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, Value *vp, JSBool strict); +(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSBool (* GenericAttributesOp)(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp); typedef JSBool @@ -199,11 +199,11 @@ typedef JSBool typedef JSBool (* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp); typedef JSBool -(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, Value *vp, JSBool strict); +(* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, Value *vp, JSBool strict); +(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool -(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, Value *vp, JSBool strict); +(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); typedef JSType (* TypeOfOp)(JSContext *cx, HandleObject obj); @@ -257,9 +257,22 @@ struct ClassExtension * WeakMaps use this to override the wrapper disposal optimization. */ bool isWrappedNative; + + /* + * If an object is used as a key in a weakmap, it may be desirable for the + * garbage collector to keep that object around longer than it otherwise + * would. A common case is when the key is a wrapper around an object in + * another compartment, and we want to avoid collecting the wrapper (and + * removing the weakmap entry) as long as the wrapped object is alive. In + * that case, the wrapped object is returned by the wrapper's + * weakmapKeyDelegateOp hook. As long as the wrapper is used as a weakmap + * key, it will not be collected (and remain in the weakmap) until the + * wrapped object is collected. + */ + JSWeakmapKeyDelegateOp weakmapKeyDelegateOp; }; -#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false} +#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL,false,NULL} struct ObjectOps { diff --git a/scripting/javascript/spidermonkey-win32/include/jsclist.h b/scripting/javascript/spidermonkey-win32/include/jsclist.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jscpucfg.h b/scripting/javascript/spidermonkey-win32/include/jscpucfg.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jsdbgapi.h b/scripting/javascript/spidermonkey-win32/include/jsdbgapi.h old mode 100644 new mode 100755 index 1382b0779a..af326e28b0 --- a/scripting/javascript/spidermonkey-win32/include/jsdbgapi.h +++ b/scripting/javascript/spidermonkey-win32/include/jsdbgapi.h @@ -221,12 +221,6 @@ JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp); extern JS_PUBLIC_API(void) JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation); -extern JS_PUBLIC_API(JSPrincipals*) -JS_GetPrincipalIfDummyFrame(JSContext *cx, JSStackFrame *fpArg); - -extern JS_PUBLIC_API(JSBool) -JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp); - extern JS_PUBLIC_API(JSObject *) JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp); diff --git a/scripting/javascript/spidermonkey-win32/include/jsdhash.h b/scripting/javascript/spidermonkey-win32/include/jsdhash.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jsfriendapi.h b/scripting/javascript/spidermonkey-win32/include/jsfriendapi.h old mode 100644 new mode 100755 index 3e28bcaa63..63b9c96604 --- a/scripting/javascript/spidermonkey-win32/include/jsfriendapi.h +++ b/scripting/javascript/spidermonkey-win32/include/jsfriendapi.h @@ -22,10 +22,10 @@ extern JS_FRIEND_API(JSString *) JS_GetAnonymousString(JSRuntime *rt); extern JS_FRIEND_API(JSObject *) -JS_FindCompilationScope(JSContext *cx, JSObject *obj); +JS_FindCompilationScope(JSContext *cx, JSRawObject obj); extern JS_FRIEND_API(JSFunction *) -JS_GetObjectFunction(JSObject *obj); +JS_GetObjectFunction(JSRawObject obj); extern JS_FRIEND_API(JSObject *) JS_GetGlobalForFrame(JSStackFrame *fp); @@ -37,7 +37,7 @@ extern JS_FRIEND_API(JSObject *) JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(uint32_t) -JS_ObjectCountDynamicSlots(JSObject *obj); +JS_ObjectCountDynamicSlots(JSHandleObject obj); extern JS_FRIEND_API(void) JS_ShrinkGCBuffers(JSRuntime *rt); @@ -75,13 +75,18 @@ enum { JS_TELEMETRY_GC_REASON, JS_TELEMETRY_GC_IS_COMPARTMENTAL, JS_TELEMETRY_GC_MS, + JS_TELEMETRY_GC_MAX_PAUSE_MS, JS_TELEMETRY_GC_MARK_MS, JS_TELEMETRY_GC_SWEEP_MS, + JS_TELEMETRY_GC_MARK_ROOTS_MS, + JS_TELEMETRY_GC_MARK_GRAY_MS, JS_TELEMETRY_GC_SLICE_MS, JS_TELEMETRY_GC_MMU_50, JS_TELEMETRY_GC_RESET, JS_TELEMETRY_GC_INCREMENTAL_DISABLED, - JS_TELEMETRY_GC_NON_INCREMENTAL + JS_TELEMETRY_GC_NON_INCREMENTAL, + JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS, + JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS }; typedef void @@ -108,7 +113,7 @@ extern JS_FRIEND_API(JSObject *) JS_CloneObject(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent); extern JS_FRIEND_API(JSBool) -js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, jsval *vp); +js_GetterOnlyPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict, JSMutableHandleValue vp); JS_FRIEND_API(void) js_ReportOverRecursed(JSContext *maybecx); @@ -159,6 +164,8 @@ struct JSFunctionSpecWithHelp { #define JS_FN_HELP(name,call,nargs,flags,usage,help) \ {name, call, nargs, (flags) | JSPROP_ENUMERATE | JSFUN_STUB_GSOPS, usage, help} +#define JS_FS_HELP_END \ + {NULL, NULL, 0, 0, NULL, NULL} extern JS_FRIEND_API(bool) JS_DefineFunctionsWithHelp(JSContext *cx, JSObject *obj, const JSFunctionSpecWithHelp *fs); @@ -169,6 +176,11 @@ JS_END_EXTERN_C #ifdef __cplusplus +typedef bool (* JS_SourceHook)(JSContext *cx, JSScript *script, jschar **src, uint32_t *length); + +extern JS_FRIEND_API(void) +JS_SetSourceHook(JSRuntime *rt, JS_SourceHook hook); + namespace js { struct RuntimeFriendFields { @@ -213,7 +225,7 @@ class JS_FRIEND_API(AutoSwitchCompartment) { public: AutoSwitchCompartment(JSContext *cx, JSCompartment *newCompartment JS_GUARD_OBJECT_NOTIFIER_PARAM); - AutoSwitchCompartment(JSContext *cx, JSObject *target JS_GUARD_OBJECT_NOTIFIER_PARAM); + AutoSwitchCompartment(JSContext *cx, JSHandleObject target JS_GUARD_OBJECT_NOTIFIER_PARAM); ~AutoSwitchCompartment(); JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; @@ -274,6 +286,9 @@ typedef void extern JS_FRIEND_API(void) VisitGrayWrapperTargets(JSCompartment *comp, GCThingCallback *callback, void *closure); +extern JS_FRIEND_API(JSObject *) +GetWeakmapKeyDelegate(JSObject *key); + /* * Shadow declarations of JS internal structures, for access by inline access * functions below. Do not use these structures in any other way. When adding @@ -318,6 +333,16 @@ struct Object { } }; +struct Function { + Object base; + uint16_t nargs; + uint16_t flags; + /* Used only for natives */ + Native native; + const JSJitInfo *jitinfo; + void *_1; +}; + struct Atom { size_t _; const jschar *chars; @@ -339,35 +364,35 @@ extern JS_FRIEND_DATA(js::Class) XMLClass; extern JS_FRIEND_DATA(js::Class) ObjectClass; inline js::Class * -GetObjectClass(const JSObject *obj) +GetObjectClass(RawObject obj) { return reinterpret_cast(obj)->shape->base->clasp; } inline JSClass * -GetObjectJSClass(const JSObject *obj) +GetObjectJSClass(RawObject obj) { return js::Jsvalify(GetObjectClass(obj)); } JS_FRIEND_API(bool) -IsScopeObject(JSObject *obj); +IsScopeObject(RawObject obj); inline JSObject * -GetObjectParent(JSObject *obj) +GetObjectParent(RawObject obj) { JS_ASSERT(!IsScopeObject(obj)); return reinterpret_cast(obj)->shape->base->parent; } JS_FRIEND_API(JSObject *) -GetObjectParentMaybeScope(JSObject *obj); +GetObjectParentMaybeScope(RawObject obj); JS_FRIEND_API(JSObject *) -GetGlobalForObjectCrossCompartment(JSObject *obj); +GetGlobalForObjectCrossCompartment(RawObject obj); JS_FRIEND_API(void) -NotifyAnimationActivity(JSObject *obj); +NotifyAnimationActivity(RawObject obj); JS_FRIEND_API(bool) IsOriginalScriptFunction(JSFunction *fun); @@ -391,19 +416,19 @@ InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto, JSPropertySpec *static_ps, JSFunctionSpec *static_fs); JS_FRIEND_API(const Value &) -GetFunctionNativeReserved(JSObject *fun, size_t which); +GetFunctionNativeReserved(RawObject fun, size_t which); JS_FRIEND_API(void) -SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val); +SetFunctionNativeReserved(RawObject fun, size_t which, const Value &val); inline JSObject * -GetObjectProto(JSObject *obj) +GetObjectProto(RawObject obj) { return reinterpret_cast(obj)->type->proto; } inline void * -GetObjectPrivate(JSObject *obj) +GetObjectPrivate(RawObject obj) { const shadow::Object *nobj = reinterpret_cast(obj); void **addr = reinterpret_cast(&nobj->fixedSlots()[nobj->numFixedSlots()]); @@ -415,17 +440,17 @@ GetObjectPrivate(JSObject *obj) * within the maximum capacity for the object's fixed slots). */ inline const Value & -GetReservedSlot(const JSObject *obj, size_t slot) +GetReservedSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); return reinterpret_cast(obj)->slotRef(slot); } JS_FRIEND_API(void) -SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const Value &value); +SetReservedSlotWithBarrier(RawObject obj, size_t slot, const Value &value); inline void -SetReservedSlot(JSObject *obj, size_t slot, const Value &value) +SetReservedSlot(RawObject obj, size_t slot, const Value &value) { JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); shadow::Object *sobj = reinterpret_cast(obj); @@ -436,22 +461,15 @@ SetReservedSlot(JSObject *obj, size_t slot, const Value &value) } JS_FRIEND_API(uint32_t) -GetObjectSlotSpan(JSObject *obj); +GetObjectSlotSpan(RawObject obj); inline const Value & -GetObjectSlot(JSObject *obj, size_t slot) +GetObjectSlot(RawObject obj, size_t slot) { JS_ASSERT(slot < GetObjectSlotSpan(obj)); return reinterpret_cast(obj)->slotRef(slot); } -inline Shape * -GetObjectShape(JSObject *obj) -{ - shadow::Shape *shape = reinterpret_cast(obj)->shape; - return reinterpret_cast(shape); -} - inline const jschar * GetAtomChars(JSAtom *atom) { @@ -465,19 +483,19 @@ AtomToLinearString(JSAtom *atom) } static inline js::PropertyOp -CastAsJSPropertyOp(JSObject *object) +CastAsJSPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::PropertyOp, object); } static inline js::StrictPropertyOp -CastAsJSStrictPropertyOp(JSObject *object) +CastAsJSStrictPropertyOp(RawObject object) { return JS_DATA_TO_FUNC_PTR(js::StrictPropertyOp, object); } JS_FRIEND_API(bool) -GetPropertyNames(JSContext *cx, JSObject *obj, unsigned flags, js::AutoIdVector *props); +GetPropertyNames(JSContext *cx, RawObject obj, unsigned flags, js::AutoIdVector *props); JS_FRIEND_API(bool) GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp); @@ -489,7 +507,7 @@ JS_FRIEND_API(void) SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback); JS_FRIEND_API(bool) -IsObjectInContextCompartment(const JSObject *obj, const JSContext *cx); +IsObjectInContextCompartment(RawObject obj, const JSContext *cx); /* * NB: these flag bits are encoded into the bytecode stream in the immediate @@ -542,19 +560,66 @@ GetPCCountScriptContents(JSContext *cx, size_t script); * * For more detailed information, see vm/SPSProfiler.h */ -struct ProfileEntry { +class ProfileEntry +{ /* - * These two fields are marked as 'volatile' so that the compiler doesn't - * re-order instructions which modify them. The operation in question is: + * All fields are marked volatile to prevent the compiler from re-ordering + * instructions. Namely this sequence: * - * stack[i].string = str; - * (*size)++; + * entry[size] = ...; + * size++; * - * If the size increment were re-ordered before the store of the string, - * then if sampling occurred there would be a bogus entry on the stack. + * If the size modification were somehow reordered before the stores, then + * if a sample were taken it would be examining bogus information. + * + * A ProfileEntry represents both a C++ profile entry and a JS one. Both use + * the string as a description, but JS uses the sp as NULL to indicate that + * it is a JS entry. The script_ is then only ever examined for a JS entry, + * and the idx is used by both, but with different meanings. */ - const char * volatile string; - void * volatile sp; + const char * volatile string; // Descriptive string of this entry + void * volatile sp; // Relevant stack pointer for the entry + JSScript * volatile script_; // if js(), non-null script which is running + int32_t volatile idx; // if js(), idx of pc, otherwise line number + + public: + /* + * All of these methods are marked with the 'volatile' keyword because SPS's + * representation of the stack is stored such that all ProfileEntry + * instances are volatile. These methods would not be available unless they + * were marked as volatile as well + */ + + bool js() volatile { + JS_ASSERT_IF(sp == NULL, script_ != NULL); + return sp == NULL; + } + + uint32_t line() volatile { JS_ASSERT(!js()); return idx; } + JSScript *script() volatile { JS_ASSERT(js()); return script_; } + void *stackAddress() volatile { return sp; } + const char *label() volatile { return string; } + + void setLine(uint32_t line) volatile { JS_ASSERT(!js()); idx = line; } + void setLabel(const char *string) volatile { this->string = string; } + void setStackAddress(void *sp) volatile { this->sp = sp; } + void setScript(JSScript *script) volatile { script_ = script; } + + /* we can't know the layout of JSScript, so look in vm/SPSProfiler.cpp */ + JS_FRIEND_API(jsbytecode *) pc() volatile; + JS_FRIEND_API(void) setPC(jsbytecode *pc) volatile; + + static size_t offsetOfString() { return offsetof(ProfileEntry, string); } + static size_t offsetOfStackAddress() { return offsetof(ProfileEntry, sp); } + static size_t offsetOfPCIdx() { return offsetof(ProfileEntry, idx); } + static size_t offsetOfScript() { return offsetof(ProfileEntry, script_); } + + /* + * The index used in the entry can either be a line number or the offset of + * a pc into a script's code. To signify a NULL pc, use a -1 index. This is + * checked against in pc() and setPC() to set/get the right pc. + */ + static const int32_t NullPCIndex = -1; }; JS_FRIEND_API(void) @@ -564,6 +629,9 @@ SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size, JS_FRIEND_API(void) EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled); +JS_FRIEND_API(jsbytecode*) +ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip); + #ifdef JS_THREADSAFE JS_FRIEND_API(void *) GetOwnerThread(const JSContext *cx); @@ -624,6 +692,7 @@ SizeOfJSContext(); D(DEBUG_GC) \ D(DEBUG_MODE_GC) \ D(TRANSPLANT) \ + D(RESET) \ \ /* Reasons from Firefox */ \ D(DOM_WINDOW_UTILS) \ @@ -695,7 +764,7 @@ extern JS_FRIEND_API(void) ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); extern JS_FRIEND_API(void) -IncrementalGC(JSRuntime *rt, gcreason::Reason reason); +IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0); extern JS_FRIEND_API(void) FinishIncrementalGC(JSRuntime *rt, gcreason::Reason reason); @@ -733,6 +802,30 @@ typedef void extern JS_FRIEND_API(GCSliceCallback) SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); +typedef void +(* AnalysisPurgeCallback)(JSRuntime *rt, JSFlatString *desc); + +extern JS_FRIEND_API(AnalysisPurgeCallback) +SetAnalysisPurgeCallback(JSRuntime *rt, AnalysisPurgeCallback callback); + +/* Was the most recent GC run incrementally? */ +extern JS_FRIEND_API(bool) +WasIncrementalGC(JSRuntime *rt); + +typedef JSBool +(* DOMInstanceClassMatchesProto)(JSHandleObject protoObject, uint32_t protoID, + uint32_t depth); +struct JSDOMCallbacks { + DOMInstanceClassMatchesProto instanceClassMatchesProto; +}; +typedef struct JSDOMCallbacks DOMCallbacks; + +extern JS_FRIEND_API(void) +SetDOMCallbacks(JSRuntime *rt, const DOMCallbacks *callbacks); + +extern JS_FRIEND_API(const DOMCallbacks *) +GetDOMCallbacks(JSRuntime *rt); + /* * Signals a good place to do an incremental slice, because the browser is * drawing a frame. @@ -753,7 +846,7 @@ extern JS_FRIEND_API(bool) IsIncrementalBarrierNeeded(JSContext *cx); extern JS_FRIEND_API(bool) -IsIncrementalBarrierNeededOnObject(JSObject *obj); +IsIncrementalBarrierNeededOnObject(RawObject obj); extern JS_FRIEND_API(bool) IsIncrementalBarrierNeededOnScript(JSScript *obj); @@ -821,21 +914,68 @@ CastToJSFreeOp(FreeOp *fop) /* Implemented in jsexn.cpp. */ /* - * Get an error type name from a number. - * If no exception is associated, return NULL. + * Get an error type name from a JSExnType constant. + * Returns NULL for invalid arguments and JSEXN_INTERNALERR */ extern JS_FRIEND_API(const jschar*) -GetErrorTypeNameFromNumber(JSContext* cx, const unsigned errorNumber); +GetErrorTypeName(JSContext* cx, int16_t exnType); /* Implemented in jswrapper.cpp. */ -typedef enum NukedGlobalHandling { - NukeForGlobalObject, - DontNukeForGlobalObject -} NukedGlobalHandling; +typedef enum NukeReferencesToWindow { + NukeWindowReferences, + DontNukeWindowReferences +} NukeReferencesToWindow; + +/* + * These filters are designed to be ephemeral stack classes, and thus don't + * do any rooting or holding of their members. + */ +struct CompartmentFilter { + virtual bool match(JSCompartment *c) const = 0; +}; + +struct AllCompartments : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { return true; } +}; + +struct ContentCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return !IsSystemCompartment(c); + } +}; + +struct ChromeCompartmentsOnly : public CompartmentFilter { + virtual bool match(JSCompartment *c) const { + return IsSystemCompartment(c); + } +}; + +struct SingleCompartment : public CompartmentFilter { + JSCompartment *ours; + SingleCompartment(JSCompartment *c) : ours(c) {} + virtual bool match(JSCompartment *c) const { return c == ours; } +}; + +struct CompartmentsWithPrincipals : public CompartmentFilter { + JSPrincipals *principals; + CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} + virtual bool match(JSCompartment *c) const { + return JS_GetCompartmentPrincipals(c) == principals; + } +}; extern JS_FRIEND_API(JSBool) -NukeChromeCrossCompartmentWrappersForGlobal(JSContext *cx, JSObject *obj, - NukedGlobalHandling nukeGlobal); +NukeCrossCompartmentWrappers(JSContext* cx, + const CompartmentFilter& sourceFilter, + const CompartmentFilter& targetFilter, + NukeReferencesToWindow nukeReferencesToWindow); + +/* Specify information about ListBase proxies in the DOM, for use by ICs. */ +JS_FRIEND_API(void) +SetListBaseInformation(void *listBaseHandlerFamily, uint32_t listBaseExpandoSlot); + +void *GetListBaseHandlerFamily(); +uint32_t GetListBaseExpandoSlot(); } /* namespace js */ @@ -851,7 +991,7 @@ extern JS_FRIEND_API(JSBool) js_DateIsValid(JSContext *cx, JSObject* obj); extern JS_FRIEND_API(double) -js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj); +js_DateGetMsecSinceEpoch(JSContext *cx, JSRawObject obj); /* Implemented in jscntxt.cpp. */ @@ -1043,6 +1183,35 @@ JS_IsFloat32Array(JSObject *obj, JSContext *cx); extern JS_FRIEND_API(JSBool) JS_IsFloat64Array(JSObject *obj, JSContext *cx); + +/* + * Unwrap Typed arrays all at once. Return NULL without throwing if the object + * cannot be viewed as the correct typed array, or the typed array object on + * success, filling both outparameters. + */ +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt8Array(JSContext *cx, JSObject *obj, uint32_t *length, int8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8Array(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint8ClampedArray(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt16Array(JSContext *cx, JSObject *obj, uint32_t *length, int16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint16Array(JSContext *cx, JSObject *obj, uint32_t *length, uint16_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsInt32Array(JSContext *cx, JSObject *obj, uint32_t *length, int32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsUint32Array(JSContext *cx, JSObject *obj, uint32_t *length, uint32_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat32Array(JSContext *cx, JSObject *obj, uint32_t *length, float **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsFloat64Array(JSContext *cx, JSObject *obj, uint32_t *length, double **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBufferView(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); +extern JS_FRIEND_API(JSObject *) +JS_GetObjectAsArrayBuffer(JSContext *cx, JSObject *obj, uint32_t *length, uint8_t **data); + /* * Get the type of elements in a typed array. * @@ -1213,4 +1382,42 @@ JS_GetDataViewByteLength(JSObject *obj, JSContext *cx); JS_FRIEND_API(void *) JS_GetDataViewData(JSObject *obj, JSContext *cx); +#ifdef __cplusplus +/* + * This struct contains metadata passed from the DOM to the JS Engine for JIT + * optimizations on DOM property accessors. Eventually, this should be made + * available to general JSAPI users, but we are not currently ready to do so. + */ +typedef bool +(* JSJitPropertyOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, JS::Value *vp); +typedef bool +(* JSJitMethodOp)(JSContext *cx, JSHandleObject thisObj, + void *specializedThis, unsigned argc, JS::Value *vp); + +struct JSJitInfo { + JSJitPropertyOp op; + uint32_t protoID; + uint32_t depth; + bool isInfallible; /* Is op fallible? Getters only */ + bool isConstant; /* Getting a construction-time constant? */ +}; + +static JS_ALWAYS_INLINE const JSJitInfo * +FUNCTION_VALUE_TO_JITINFO(const JS::Value& v) +{ + JS_ASSERT(js::GetObjectClass(&v.toObject()) == &js::FunctionClass); + return reinterpret_cast(&v.toObject())->jitinfo; +} + +static JS_ALWAYS_INLINE void +SET_JITINFO(JSFunction * func, const JSJitInfo *info) +{ + js::shadow::Function *fun = reinterpret_cast(func); + /* JS_ASSERT(func->isNative()). 0x4000 is JSFUN_INTERPRETED */ + JS_ASSERT(!(fun->flags & 0x4000)); + fun->jitinfo = info; +} +#endif /* __cplusplus */ + #endif /* jsfriendapi_h___ */ diff --git a/scripting/javascript/spidermonkey-win32/include/jsgc.h b/scripting/javascript/spidermonkey-win32/include/jsgc.h old mode 100644 new mode 100755 index 0cb842505c..13b2e4678c --- a/scripting/javascript/spidermonkey-win32/include/jsgc.h +++ b/scripting/javascript/spidermonkey-win32/include/jsgc.h @@ -41,6 +41,7 @@ namespace js { class GCHelperThread; struct Shape; +struct SliceBudget; namespace gc { @@ -48,6 +49,8 @@ enum State { NO_INCREMENTAL, MARK_ROOTS, MARK, + SWEEP, + SWEEP_END, INVALID }; @@ -112,36 +115,100 @@ MapAllocToTraceKind(AllocKind thingKind) return map[thingKind]; } +static inline bool +IsNurseryAllocable(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + +static inline bool +IsBackgroundFinalized(AllocKind kind) +{ + JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + static const bool map[FINALIZE_LIMIT] = { + false, /* FINALIZE_OBJECT0 */ + true, /* FINALIZE_OBJECT0_BACKGROUND */ + false, /* FINALIZE_OBJECT2 */ + true, /* FINALIZE_OBJECT2_BACKGROUND */ + false, /* FINALIZE_OBJECT4 */ + true, /* FINALIZE_OBJECT4_BACKGROUND */ + false, /* FINALIZE_OBJECT8 */ + true, /* FINALIZE_OBJECT8_BACKGROUND */ + false, /* FINALIZE_OBJECT12 */ + true, /* FINALIZE_OBJECT12_BACKGROUND */ + false, /* FINALIZE_OBJECT16 */ + true, /* FINALIZE_OBJECT16_BACKGROUND */ + false, /* FINALIZE_SCRIPT */ + false, /* FINALIZE_SHAPE */ + false, /* FINALIZE_BASE_SHAPE */ + false, /* FINALIZE_TYPE_OBJECT */ +#if JS_HAS_XML_SUPPORT + false, /* FINALIZE_XML */ +#endif + true, /* FINALIZE_SHORT_STRING */ + true, /* FINALIZE_STRING */ + false /* FINALIZE_EXTERNAL_STRING */ + }; + return map[kind]; +} + inline JSGCTraceKind GetGCThingTraceKind(const void *thing); +/* + * ArenaList::head points to the start of the list. Normally cursor points + * to the first arena in the list with some free things and all arenas + * before cursor are fully allocated. However, as the arena currently being + * allocated from is considered full while its list of free spans is moved + * into the freeList, during the GC or cell enumeration, when an + * unallocated freeList is moved back to the arena, we can see an arena + * with some free cells before the cursor. The cursor is an indirect + * pointer to allow for efficient list insertion at the cursor point and + * other list manipulations. + */ +struct ArenaList { + ArenaHeader *head; + ArenaHeader **cursor; + + ArenaList() { + clear(); + } + + void clear() { + head = NULL; + cursor = &head; + } + + void insert(ArenaHeader *arena); +}; + struct ArenaLists { - /* - * ArenaList::head points to the start of the list. Normally cursor points - * to the first arena in the list with some free things and all arenas - * before cursor are fully allocated. However, as the arena currently being - * allocated from is considered full while its list of free spans is moved - * into the freeList, during the GC or cell enumeration, when an - * unallocated freeList is moved back to the arena, we can see an arena - * with some free cells before the cursor. The cursor is an indirect - * pointer to allow for efficient list insertion at the cursor point and - * other list manipulations. - */ - struct ArenaList { - ArenaHeader *head; - ArenaHeader **cursor; - - ArenaList() { - clear(); - } - - void clear() { - head = NULL; - cursor = &head; - } - }; - private: /* * For each arena kind its free list is represented as the first span with @@ -180,12 +247,18 @@ struct ArenaLists { volatile uintptr_t backgroundFinalizeState[FINALIZE_LIMIT]; + public: + /* For each arena kind, a list of arenas remaining to be swept. */ + ArenaHeader *arenaListsToSweep[FINALIZE_LIMIT]; + public: ArenaLists() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) freeLists[i].initAsEmpty(); for (size_t i = 0; i != FINALIZE_LIMIT; ++i) backgroundFinalizeState[i] = BFS_DONE; + for (size_t i = 0; i != FINALIZE_LIMIT; ++i) + arenaListsToSweep[i] = NULL; } ~ArenaLists() { @@ -211,6 +284,10 @@ struct ArenaLists { return arenaLists[thingKind].head; } + ArenaHeader *getFirstArenaToSweep(AllocKind thingKind) const { + return arenaListsToSweep[thingKind]; + } + bool arenaListsAreEmpty() const { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* @@ -225,6 +302,10 @@ struct ArenaLists { return true; } + bool arenasAreFull(AllocKind thingKind) const { + return !*arenaLists[thingKind].cursor; + } + void unmarkAll() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* The background finalization must have stopped at this point. */ @@ -238,7 +319,8 @@ struct ArenaLists { } bool doneBackgroundFinalize(AllocKind kind) const { - return backgroundFinalizeState[kind] == BFS_DONE; + return backgroundFinalizeState[kind] == BFS_DONE || + backgroundFinalizeState[kind] == BFS_JUST_FINISHED; } /* @@ -333,16 +415,18 @@ struct ArenaLists { JS_ASSERT(freeLists[kind].isEmpty()); } - void finalizeObjects(FreeOp *fop); - void finalizeStrings(FreeOp *fop); - void finalizeShapes(FreeOp *fop); - void finalizeScripts(FreeOp *fop); + void queueObjectsForSweep(FreeOp *fop); + void queueStringsForSweep(FreeOp *fop); + void queueShapesForSweep(FreeOp *fop); + void queueScriptsForSweep(FreeOp *fop); - static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead); + bool foregroundFinalize(FreeOp *fop, AllocKind thingKind, SliceBudget &sliceBudget); + static void backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgroundThread); private: inline void finalizeNow(FreeOp *fop, AllocKind thingKind); - inline void finalizeLater(FreeOp *fop, AllocKind thingKind); + inline void queueForForegroundSweep(FreeOp *fop, AllocKind thingKind); + inline void queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind); inline void *allocateFromArena(JSCompartment *comp, AllocKind thingKind); }; @@ -478,7 +562,7 @@ extern void GC(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); extern void -GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); +GCSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason, int64_t millis = 0); extern void GCFinalSlice(JSRuntime *rt, JSGCInvocationKind gckind, js::gcreason::Reason reason); @@ -539,8 +623,6 @@ class GCHelperThread { void **freeCursor; void **freeCursorEnd; - Vector finalizeVector; - bool backgroundAllocation; friend struct js::gc::ArenaLists; @@ -584,10 +666,10 @@ class GCHelperThread { /* Must be called with the GC lock taken. */ void startBackgroundShrink(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepEnd(); - /* Must be called with the GC lock taken. */ + /* Must be called without the GC lock taken. */ void waitBackgroundSweepOrAllocEnd(); /* Must be called with the GC lock taken. */ @@ -625,9 +707,6 @@ class GCHelperThread { else replenishAndFreeLater(ptr); } - - /* Must be called with the GC lock taken. */ - bool prepareForBackgroundSweep(); }; @@ -1071,22 +1150,33 @@ RunDebugGC(JSContext *cx); void SetDeterministicGC(JSContext *cx, bool enabled); +void +SetValidateGC(JSContext *cx, bool enabled); + const int ZealPokeValue = 1; const int ZealAllocValue = 2; const int ZealFrameGCValue = 3; -const int ZealVerifierValue = 4; -const int ZealFrameVerifierValue = 5; +const int ZealVerifierPreValue = 4; +const int ZealFrameVerifierPreValue = 5; const int ZealStackRootingSafeValue = 6; const int ZealStackRootingValue = 7; const int ZealIncrementalRootsThenFinish = 8; const int ZealIncrementalMarkAllThenFinish = 9; const int ZealIncrementalMultipleSlices = 10; +const int ZealVerifierPostValue = 11; +const int ZealFrameVerifierPostValue = 12; +const int ZealPurgeAnalysisValue = 13; + +enum VerifierType { + PreBarrierVerifier, + PostBarrierVerifier +}; #ifdef JS_GC_ZEAL /* Check that write barriers have been used correctly. See jsgc.cpp. */ void -VerifyBarriers(JSRuntime *rt); +VerifyBarriers(JSRuntime *rt, VerifierType type); void MaybeVerifyBarriers(JSContext *cx, bool always = false); @@ -1094,7 +1184,7 @@ MaybeVerifyBarriers(JSContext *cx, bool always = false); #else static inline void -VerifyBarriers(JSRuntime *rt) +VerifyBarriers(JSRuntime *rt, VerifierType type) { } diff --git a/scripting/javascript/spidermonkey-win32/include/jshash.h b/scripting/javascript/spidermonkey-win32/include/jshash.h deleted file mode 100644 index 2b9f8a9e39..0000000000 --- a/scripting/javascript/spidermonkey-win32/include/jshash.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef jshash_h___ -#define jshash_h___ - -/* - * API to portable hash table code. - */ -#include -#include -#include "jstypes.h" - -JS_BEGIN_EXTERN_C - -typedef uint32_t JSHashNumber; -typedef struct JSHashEntry JSHashEntry; -typedef struct JSHashTable JSHashTable; - -#define JS_HASH_BITS 32 -#define JS_GOLDEN_RATIO 0x9E3779B9U - -typedef JSHashNumber (* JSHashFunction)(const void *key); -typedef int (* JSHashComparator)(const void *v1, const void *v2); -typedef int (* JSHashEnumerator)(JSHashEntry *he, int i, void *arg); - -/* Flag bits in JSHashEnumerator's return value */ -#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */ -#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */ -#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */ - -typedef struct JSHashAllocOps { - void * (*allocTable)(void *pool, size_t size); - void (*freeTable)(void *pool, void *item, size_t size); - JSHashEntry * (*allocEntry)(void *pool, const void *key); - void (*freeEntry)(void *pool, JSHashEntry *he, unsigned flag); -} JSHashAllocOps; - -#define HT_FREE_VALUE 0 /* just free the entry's value */ -#define HT_FREE_ENTRY 1 /* free value and entire entry */ - -struct JSHashEntry { - JSHashEntry *next; /* hash chain linkage */ - JSHashNumber keyHash; /* key hash function result */ - const void *key; /* ptr to opaque key */ - void *value; /* ptr to opaque value */ -}; - -struct JSHashTable { - JSHashEntry **buckets; /* vector of hash buckets */ - uint32_t nentries; /* number of entries in table */ - uint32_t shift; /* multiplicative hash shift */ - JSHashFunction keyHash; /* key hash function */ - JSHashComparator keyCompare; /* key comparison function */ - JSHashComparator valueCompare; /* value comparison function */ - JSHashAllocOps *allocOps; /* allocation operations */ - void *allocPriv; /* allocation private data */ -#ifdef JS_HASHMETER - uint32_t nlookups; /* total number of lookups */ - uint32_t nsteps; /* number of hash chains traversed */ - uint32_t ngrows; /* number of table expansions */ - uint32_t nshrinks; /* number of table contractions */ -#endif -}; - -/* - * Create a new hash table. - * If allocOps is null, use default allocator ops built on top of malloc(). - */ -extern JS_PUBLIC_API(JSHashTable *) -JS_NewHashTable(uint32_t n, JSHashFunction keyHash, - JSHashComparator keyCompare, JSHashComparator valueCompare, - JSHashAllocOps *allocOps, void *allocPriv); - -extern JS_PUBLIC_API(void) -JS_HashTableDestroy(JSHashTable *ht); - -/* Low level access methods */ -extern JS_PUBLIC_API(JSHashEntry **) -JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key); - -#ifdef __cplusplus -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep, JSHashNumber keyHash, - const void *key, void *value); -#endif - -extern JS_PUBLIC_API(void) -JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he); - -/* Higher level access methods */ -extern JS_PUBLIC_API(JSHashEntry *) -JS_HashTableAdd(JSHashTable *ht, const void *key, void *value); - -extern JS_PUBLIC_API(JSBool) -JS_HashTableRemove(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg); - -extern JS_PUBLIC_API(void *) -JS_HashTableLookup(JSHashTable *ht, const void *key); - -extern JS_PUBLIC_API(int) -JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp); - -/* General-purpose C string hash function. */ -extern JS_PUBLIC_API(JSHashNumber) -JS_HashString(const void *key); - -/* Stub function just returns v1 == v2 */ -extern JS_PUBLIC_API(int) -JS_CompareValues(const void *v1, const void *v2); - -JS_END_EXTERN_C - -#endif /* jshash_h___ */ diff --git a/scripting/javascript/spidermonkey-win32/include/jslock.h b/scripting/javascript/spidermonkey-win32/include/jslock.h old mode 100644 new mode 100755 index 15a0e73806..b5202cb32c --- a/scripting/javascript/spidermonkey-win32/include/jslock.h +++ b/scripting/javascript/spidermonkey-win32/include/jslock.h @@ -16,10 +16,10 @@ # include "prthread.h" # include "prinit.h" -# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((PRInt32 *)(p)) -# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((PRInt32 *)(p), (PRInt32)(v)) -# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((PRInt32 *)(p), (PRInt32)(v)) +# define JS_ATOMIC_INCREMENT(p) PR_ATOMIC_INCREMENT((int32_t *)(p)) +# define JS_ATOMIC_DECREMENT(p) PR_ATOMIC_DECREMENT((int32_t *)(p)) +# define JS_ATOMIC_ADD(p,v) PR_ATOMIC_ADD((int32_t *)(p), (int32_t)(v)) +# define JS_ATOMIC_SET(p,v) PR_ATOMIC_SET((int32_t *)(p), (int32_t)(v)) #else /* JS_THREADSAFE */ diff --git a/scripting/javascript/spidermonkey-win32/include/json.h b/scripting/javascript/spidermonkey-win32/include/json.h old mode 100644 new mode 100755 index af11f9f89c..69b0072d3f --- a/scripting/javascript/spidermonkey-win32/include/json.h +++ b/scripting/javascript/spidermonkey-win32/include/json.h @@ -7,6 +7,7 @@ #include "jsprvtd.h" #include "jspubtd.h" +#include "jsapi.h" #include "js/Vector.h" @@ -18,7 +19,7 @@ js_InitJSONClass(JSContext *cx, JSObject *obj); extern JSBool js_Stringify(JSContext *cx, js::MutableHandleValue vp, - JSObject *replacer, js::Value space, + JSObject *replacer, js::Value space, js::StringBuffer &sb); // Avoid build errors on certain platforms that define these names as constants @@ -37,8 +38,8 @@ enum DecodingMode { STRICT, LEGACY }; namespace js { extern JS_FRIEND_API(JSBool) -ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, const Value &filter, - Value *vp, DecodingMode decodingMode = STRICT); +ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleValue filter, + MutableHandleValue vp, DecodingMode decodingMode = STRICT); } /* namespace js */ diff --git a/scripting/javascript/spidermonkey-win32/include/jsperf.h b/scripting/javascript/spidermonkey-win32/include/jsperf.h old mode 100644 new mode 100755 index 0438bc518e..265478c33e --- a/scripting/javascript/spidermonkey-win32/include/jsperf.h +++ b/scripting/javascript/spidermonkey-win32/include/jsperf.h @@ -115,7 +115,7 @@ class JS_FRIEND_API(PerfMeasurement) * global object). The JS-visible API is identical to the C++ API. */ extern JS_FRIEND_API(JSObject*) - RegisterPerfMeasurement(JSContext *cx, JSObject *global); + RegisterPerfMeasurement(JSContext *cx, JSRawObject global); /* * Given a jsval which contains an instance of the aforementioned diff --git a/scripting/javascript/spidermonkey-win32/include/jsprf.h b/scripting/javascript/spidermonkey-win32/include/jsprf.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jsproto.tbl b/scripting/javascript/spidermonkey-win32/include/jsproto.tbl old mode 100644 new mode 100755 index 5e37999fac..ff357bda7d --- a/scripting/javascript/spidermonkey-win32/include/jsproto.tbl +++ b/scripting/javascript/spidermonkey-win32/include/jsproto.tbl @@ -64,6 +64,7 @@ JS_PROTO(WeakMap, 36, js_InitWeakMapClass) JS_PROTO(Map, 37, js_InitMapClass) JS_PROTO(Set, 38, js_InitSetClass) JS_PROTO(DataView, 39, js_InitTypedArrayClasses) +JS_PROTO(ParallelArray, 40, js_InitParallelArrayClass) #undef XML_INIT #undef NAMESPACE_INIT diff --git a/scripting/javascript/spidermonkey-win32/include/jsproxy.h b/scripting/javascript/spidermonkey-win32/include/jsproxy.h old mode 100644 new mode 100755 index 5fd5848377..aaf9de45e7 --- a/scripting/javascript/spidermonkey-win32/include/jsproxy.h +++ b/scripting/javascript/spidermonkey-win32/include/jsproxy.h @@ -13,7 +13,7 @@ namespace js { -class Wrapper; +class JS_FRIEND_API(Wrapper); /* * A proxy is a JSObject that implements generic behavior by providing custom @@ -48,10 +48,19 @@ class Wrapper; */ class JS_FRIEND_API(BaseProxyHandler) { void *mFamily; + bool mHasPrototype; + protected: + // Subclasses may set this in their constructor. + void setHasPrototype(bool hasPrototype) { mHasPrototype = hasPrototype; }; + public: explicit BaseProxyHandler(void *family); virtual ~BaseProxyHandler(); + bool hasPrototype() { + return mHasPrototype; + } + inline void *family() { return mFamily; } @@ -102,7 +111,7 @@ class JS_FRIEND_API(BaseProxyHandler) { /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -114,6 +123,10 @@ class JS_FRIEND_API(BaseProxyHandler) { virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp, bool *present); + virtual bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **proto); + + /* See comment for weakmapKeyDelegateOp in jsclass.h. */ + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -150,8 +163,8 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, - Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; @@ -166,6 +179,7 @@ class JS_PUBLIC_API(IndirectProxyHandler) : public BaseProxyHandler { Value *vp) MOZ_OVERRIDE; virtual bool iteratorNext(JSContext *cx, JSObject *proxy, Value *vp) MOZ_OVERRIDE; + virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* @@ -215,18 +229,18 @@ class Proxy { /* ES5 Harmony derived proxy traps. */ static bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp); static bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp); - static bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, Value *vp); - static bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver, - uint32_t index, Value *vp, bool *present); - static bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, - Value *vp); + static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp); + static bool getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver, + uint32_t index, MutableHandleValue vp, bool *present); + static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, bool strict, + MutableHandleValue vp); static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); - static bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp); + static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); /* Spidermonkey extensions. */ static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - static bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); static bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); static JSType typeOf(JSContext *cx, JSObject *proxy); static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); @@ -247,17 +261,17 @@ inline bool IsFunctionProxyClass(const Class *clasp) return clasp == &js::FunctionProxyClass; } -inline bool IsObjectProxy(const JSObject *obj) +inline bool IsObjectProxy(RawObject obj) { return IsObjectProxyClass(GetObjectClass(obj)); } -inline bool IsFunctionProxy(const JSObject *obj) +inline bool IsFunctionProxy(RawObject obj) { return IsFunctionProxyClass(GetObjectClass(obj)); } -inline bool IsProxy(const JSObject *obj) +inline bool IsProxy(RawObject obj) { Class *clasp = GetObjectClass(obj); return IsObjectProxyClass(clasp) || IsFunctionProxyClass(clasp); @@ -272,56 +286,56 @@ const uint32_t JSSLOT_PROXY_CALL = 4; const uint32_t JSSLOT_PROXY_CONSTRUCT = 5; inline BaseProxyHandler * -GetProxyHandler(const JSObject *obj) +GetProxyHandler(RawObject obj) { JS_ASSERT(IsProxy(obj)); return (BaseProxyHandler *) GetReservedSlot(obj, JSSLOT_PROXY_HANDLER).toPrivate(); } inline const Value & -GetProxyPrivate(const JSObject *obj) +GetProxyPrivate(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE); } inline JSObject * -GetProxyTargetObject(const JSObject *obj) +GetProxyTargetObject(RawObject obj) { JS_ASSERT(IsProxy(obj)); return GetProxyPrivate(obj).toObjectOrNull(); } inline const Value & -GetProxyCall(const JSObject *obj) +GetProxyCall(RawObject obj) { JS_ASSERT(IsFunctionProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_CALL); } inline const Value & -GetProxyExtra(const JSObject *obj, size_t n) +GetProxyExtra(RawObject obj, size_t n) { JS_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n); } inline void -SetProxyHandler(JSObject *obj, BaseProxyHandler *handler) +SetProxyHandler(RawObject obj, BaseProxyHandler *handler) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_HANDLER, PrivateValue(handler)); } inline void -SetProxyPrivate(JSObject *obj, const Value &value) +SetProxyPrivate(RawObject obj, const Value &value) { JS_ASSERT(IsProxy(obj)); SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, value); } inline void -SetProxyExtra(JSObject *obj, size_t n, const Value &extra) +SetProxyExtra(RawObject obj, size_t n, const Value &extra) { JS_ASSERT(IsProxy(obj)); JS_ASSERT(n <= 1); diff --git a/scripting/javascript/spidermonkey-win32/include/jsprvtd.h b/scripting/javascript/spidermonkey-win32/include/jsprvtd.h old mode 100644 new mode 100755 index 19b5aef3c2..f41d05d37f --- a/scripting/javascript/spidermonkey-win32/include/jsprvtd.h +++ b/scripting/javascript/spidermonkey-win32/include/jsprvtd.h @@ -82,7 +82,6 @@ class JSExtensibleString; class JSExternalString; class JSLinearString; class JSFixedString; -class JSStaticAtom; class JSRope; class JSAtom; class JSWrapper; @@ -131,24 +130,10 @@ class StackSpace; class ContextStack; class ScriptFrameIter; -struct BytecodeEmitter; -struct Definition; -struct FunctionBox; -struct ObjectBox; -struct ParseNode; -struct Parser; -struct SharedContext; -class TokenStream; -struct Token; -struct TokenPos; -struct TokenPtr; -struct TreeContext; -class UpvarCookie; - class Proxy; -class BaseProxyHandler; -class DirectWrapper; -class CrossCompartmentWrapper; +class JS_FRIEND_API(BaseProxyHandler); +class JS_FRIEND_API(DirectWrapper); +class JS_FRIEND_API(CrossCompartmentWrapper); class TempAllocPolicy; class RuntimeAllocPolicy; @@ -172,13 +157,6 @@ class Bindings; struct StackBaseShape; struct StackShape; -class MultiDeclRange; -class ParseMapPool; -class DefinitionList; -typedef InlineMap AtomDefnMap; -typedef InlineMap AtomIndexMap; -typedef Vector UpvarCookies; - class Breakpoint; class BreakpointSite; class Debugger; @@ -197,6 +175,22 @@ typedef JSPropertyOp PropertyOp; typedef JSStrictPropertyOp StrictPropertyOp; typedef JSPropertyDescriptor PropertyDescriptor; +namespace frontend { + +struct BytecodeEmitter; +struct Definition; +struct FunctionBox; +struct ObjectBox; +struct Token; +struct TokenPos; +struct TokenPtr; +class TokenStream; +struct Parser; +class ParseMapPool; +struct ParseNode; + +} /* namespace frontend */ + namespace analyze { struct LifetimeVariable; diff --git a/scripting/javascript/spidermonkey-win32/include/jspubtd.h b/scripting/javascript/spidermonkey-win32/include/jspubtd.h old mode 100644 new mode 100755 index 45864ca0d6..a154b9ceed --- a/scripting/javascript/spidermonkey-win32/include/jspubtd.h +++ b/scripting/javascript/spidermonkey-win32/include/jspubtd.h @@ -240,6 +240,21 @@ enum ThingRootKind THING_ROOT_LIMIT }; +template +struct RootKind; + +/* + * Specifically mark the ThingRootKind of externally visible types, so that + * JSAPI users may use JSRooted... types without having the class definition + * available. + */ +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_OBJECT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_STRING; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_SCRIPT; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_ID; }; }; +template <> struct RootKind { static ThingRootKind rootKind() { return THING_ROOT_VALUE; }; }; + struct ContextFriendFields { JSRuntime *const runtime; diff --git a/scripting/javascript/spidermonkey-win32/include/jstypes.h b/scripting/javascript/spidermonkey-win32/include/jstypes.h old mode 100644 new mode 100755 index 8f0489f6f0..d0cf183e0f --- a/scripting/javascript/spidermonkey-win32/include/jstypes.h +++ b/scripting/javascript/spidermonkey-win32/include/jstypes.h @@ -147,8 +147,6 @@ ***********************************************************************/ #define JS_HOWMANY(x,y) (((x)+(y)-1)/(y)) #define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y)) -#define JS_MIN(x,y) ((x)<(y)?(x):(y)) -#define JS_MAX(x,y) ((x)>(y)?(x):(y)) #include "jscpucfg.h" diff --git a/scripting/javascript/spidermonkey-win32/include/jsutil.h b/scripting/javascript/spidermonkey-win32/include/jsutil.h old mode 100644 new mode 100755 index 10debde90b..8838b6f70b --- a/scripting/javascript/spidermonkey-win32/include/jsutil.h +++ b/scripting/javascript/spidermonkey-win32/include/jsutil.h @@ -15,6 +15,10 @@ #include "js/Utility.h" +#ifdef USE_ZLIB +#include "zlib.h" +#endif + /* Forward declarations. */ struct JSContext; @@ -335,41 +339,43 @@ ClearAllBitArrayElements(size_t *array, size_t length) array[i] = 0; } -} /* namespace js */ -#endif /* __cplusplus */ +#ifdef USE_ZLIB +class Compressor +{ + /* Number of bytes we should hand to zlib each compressMore() call. */ + static const size_t CHUNKSIZE = 2048; + z_stream zs; + const unsigned char *inp; + size_t inplen; + public: + Compressor(const unsigned char *inp, size_t inplen, unsigned char *out) + : inp(inp), + inplen(inplen) + { + JS_ASSERT(inplen > 0); + zs.opaque = NULL; + zs.next_in = (Bytef *)inp; + zs.avail_in = 0; + zs.next_out = out; + zs.avail_out = inplen; + } + bool init(); + /* Compress some of the input. Return true if it should be called again. */ + bool compressMore(); + /* Finalize compression. Return the length of the compressed input. */ + size_t finish(); +}; /* - * JS_ROTATE_LEFT32 - * - * There is no rotate operation in the C Language so the construct (a << 4) | - * (a >> 28) is used instead. Most compilers convert this to a rotate - * instruction but some versions of MSVC don't without a little help. To get - * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic - * and use a pragma to make _rotl inline. - * - * MSVC in VS2005 will do an inline rotate instruction on the above construct. + * Decompress a string. The caller must know the length of the output and + * allocate |out| to a string of that length. */ -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ - defined(_M_X64)) -#include -#pragma intrinsic(_rotl) -#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) -#else -#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) +bool DecompressString(const unsigned char *inp, size_t inplen, + unsigned char *out, size_t outlen); #endif -/* Static control-flow checks. */ -#ifdef NS_STATIC_CHECKING -/* Trigger a control flow check to make sure that code flows through label */ -inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {} - -/* Avoid unused goto-label warnings. */ -# define MUST_FLOW_LABEL(label) goto label; label: - -#else -# define MUST_FLOW_THROUGH(label) ((void) 0) -# define MUST_FLOW_LABEL(label) -#endif +} /* namespace js */ +#endif /* __cplusplus */ /* Crash diagnostics */ #ifdef DEBUG diff --git a/scripting/javascript/spidermonkey-win32/include/jsval.h b/scripting/javascript/spidermonkey-win32/include/jsval.h old mode 100644 new mode 100755 index 2ee90a8e4f..187f1b9627 --- a/scripting/javascript/spidermonkey-win32/include/jsval.h +++ b/scripting/javascript/spidermonkey-win32/include/jsval.h @@ -218,6 +218,7 @@ typedef enum JSWhyMagic JS_OVERWRITTEN_CALLEE, /* arguments.callee has been overwritten */ JS_FORWARD_TO_CALL_OBJECT, /* args object element stored in call object */ JS_BLOCK_NEEDS_CLONE, /* value of static block object slot */ + JS_HASH_KEY_EMPTY, /* see class js::HashableValue */ JS_GENERIC_MAGIC /* for local use */ } JSWhyMagic; diff --git a/scripting/javascript/spidermonkey-win32/include/jsversion.h b/scripting/javascript/spidermonkey-win32/include/jsversion.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/jswrapper.h b/scripting/javascript/spidermonkey-win32/include/jswrapper.h old mode 100644 new mode 100755 index aa0e80ad16..2af181b74a --- a/scripting/javascript/spidermonkey-win32/include/jswrapper.h +++ b/scripting/javascript/spidermonkey-win32/include/jswrapper.h @@ -64,9 +64,9 @@ class JS_FRIEND_API(Wrapper) static JSObject *New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent, Wrapper *handler); - static Wrapper *wrapperHandler(const JSObject *wrapper); + static Wrapper *wrapperHandler(RawObject wrapper); - static JSObject *wrappedObject(const JSObject *wrapper); + static JSObject *wrappedObject(RawObject wrapper); explicit Wrapper(unsigned flags); @@ -166,7 +166,7 @@ class JS_FRIEND_API(IndirectWrapper) : public Wrapper, class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler { public: - explicit DirectWrapper(unsigned flags); + explicit DirectWrapper(unsigned flags, bool hasPrototype = false); virtual ~DirectWrapper(); @@ -206,7 +206,8 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -214,6 +215,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler Value *vp) MOZ_OVERRIDE; static DirectWrapper singleton; + static DirectWrapper singletonWithPrototype; static void *getWrapperFamily(); }; @@ -222,7 +224,7 @@ class JS_FRIEND_API(DirectWrapper) : public Wrapper, public DirectProxyHandler class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper { public: - CrossCompartmentWrapper(unsigned flags); + CrossCompartmentWrapper(unsigned flags, bool hasPrototype = false); virtual ~CrossCompartmentWrapper(); @@ -249,7 +251,8 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *wrapper, unsigned argc, Value *vp) MOZ_OVERRIDE; virtual bool construct(JSContext *cx, JSObject *wrapper, unsigned argc, Value *argv, Value *rval) MOZ_OVERRIDE; - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *wrapper) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *wrapper, unsigned indent) MOZ_OVERRIDE; @@ -258,6 +261,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public DirectWrapper virtual bool iteratorNext(JSContext *cx, JSObject *wrapper, Value *vp); static CrossCompartmentWrapper singleton; + static CrossCompartmentWrapper singletonWithPrototype; }; /* @@ -275,7 +279,8 @@ class JS_FRIEND_API(SecurityWrapper) : public Base public: SecurityWrapper(unsigned flags); - virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) MOZ_OVERRIDE; + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g) MOZ_OVERRIDE; }; @@ -283,25 +288,6 @@ class JS_FRIEND_API(SecurityWrapper) : public Base typedef SecurityWrapper SameCompartmentSecurityWrapper; typedef SecurityWrapper CrossCompartmentSecurityWrapper; -/* - * A hacky class that lets a friend force a fake frame. We must already be - * in the compartment of |target| when we enter the forced frame. - */ -class JS_FRIEND_API(ForceFrame) -{ - public: - JSContext * const context; - JSObject * const target; - private: - DummyFrameGuard *frame; - - public: - ForceFrame(JSContext *cx, JSObject *target); - ~ForceFrame(); - bool enter(); -}; - - class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler { public: @@ -323,7 +309,8 @@ class JS_FRIEND_API(DeadObjectProxy) : public BaseProxyHandler /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); - virtual bool nativeCall(JSContext *cx, JSObject *proxy, Class *clasp, Native native, CallArgs args); + virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, + CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, JSObject *proxy, const Value *vp, bool *bp); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); virtual JSString *obj_toString(JSContext *cx, JSObject *proxy); @@ -347,7 +334,7 @@ TransparentObjectWrapper(JSContext *cx, JSObject *obj, JSObject *wrappedProto, J extern JS_FRIEND_DATA(int) sWrapperFamily; inline bool -IsWrapper(const JSObject *obj) +IsWrapper(RawObject obj) { return IsProxy(obj) && GetProxyHandler(obj)->family() == &sWrapperFamily; } @@ -366,8 +353,13 @@ UnwrapObject(JSObject *obj, bool stopAtOuter = true, unsigned *flagsp = NULL); JS_FRIEND_API(JSObject *) UnwrapObjectChecked(JSContext *cx, JSObject *obj); +// Unwrap only the outermost security wrapper, with the same semantics as +// above. This is the checked version of Wrapper::wrappedObject. +JS_FRIEND_API(JSObject *) +UnwrapOneChecked(JSContext *cx, JSObject *obj); + JS_FRIEND_API(bool) -IsCrossCompartmentWrapper(const JSObject *obj); +IsCrossCompartmentWrapper(RawObject obj); JSObject * NewDeadProxyObject(JSContext *cx, JSObject *parent); @@ -384,37 +376,6 @@ RemapAllWrappersForObject(JSContext *cx, JSObject *oldTarget, // API to recompute all cross-compartment wrappers whose source and target // match the given filters. -// -// These filters are designed to be ephemeral stack classes, and thus don't -// do any rooting or holding of their members. -struct CompartmentFilter { - virtual bool match(JSCompartment *c) const = 0; -}; - -struct AllCompartments : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { return true; } -}; - -struct ContentCompartmentsOnly : public CompartmentFilter { - virtual bool match(JSCompartment *c) const { - return !IsSystemCompartment(c); - } -}; - -struct SingleCompartment : public CompartmentFilter { - JSCompartment *ours; - SingleCompartment(JSCompartment *c) : ours(c) {} - virtual bool match(JSCompartment *c) const { return c == ours; } -}; - -struct CompartmentsWithPrincipals : public CompartmentFilter { - JSPrincipals *principals; - CompartmentsWithPrincipals(JSPrincipals *p) : principals(p) {} - virtual bool match(JSCompartment *c) const { - return JS_GetCompartmentPrincipals(c) == principals; - } -}; - JS_FRIEND_API(bool) RecomputeWrappers(JSContext *cx, const CompartmentFilter &sourceFilter, const CompartmentFilter &targetFilter); diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Assertions.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Assertions.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Attributes.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Attributes.h old mode 100644 new mode 100755 index 0cfcd60336..6b4e81612c --- a/scripting/javascript/spidermonkey-win32/include/mozilla/Attributes.h +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/Attributes.h @@ -70,6 +70,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE # define MOZ_HAVE_CXX11_FINAL final # endif +# if __has_extension(cxx_strong_enums) +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS +# endif # if __has_attribute(noinline) # define MOZ_HAVE_NEVER_INLINE __attribute__((noinline)) # endif @@ -89,6 +93,8 @@ # endif # if __GNUC_MINOR__ >= 4 # define MOZ_HAVE_CXX11_DELETE +# define MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # endif # else @@ -108,6 +114,10 @@ # define MOZ_HAVE_CXX11_OVERRIDE /* MSVC currently spells "final" as "sealed". */ # define MOZ_HAVE_CXX11_FINAL sealed +# define MOZ_HAVE_CXX11_ENUM_TYPE +# endif +# if _MSC_VER >= 1700 +# define MOZ_HAVE_CXX11_STRONG_ENUMS # endif # define MOZ_HAVE_NEVER_INLINE __declspec(noinline) # define MOZ_HAVE_NORETURN __declspec(noreturn) @@ -298,6 +308,167 @@ # define MOZ_FINAL /* no support */ #endif +/** + * MOZ_ENUM_TYPE specifies the underlying numeric type for an enum. It's + * specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name in + * its declaration, and before the opening curly brace, like + * + * enum MyEnum MOZ_ENUM_TYPE(uint16_t) + * { + * A, + * B = 7, + * C + * }; + * + * In supporting compilers, the macro will expand to ": uint16_t". The + * compiler will allocate exactly two bytes for MyEnum, and will require all + * enumerators to have values between 0 and 65535. (Thus specifying "B = + * 100000" instead of "B = 7" would fail to compile.) In old compilers, the + * macro expands to the empty string, and the underlying type is generally + * undefined. + */ +#ifdef MOZ_HAVE_CXX11_ENUM_TYPE +# define MOZ_ENUM_TYPE(type) : type +#else +# define MOZ_ENUM_TYPE(type) /* no support */ +#endif + +/** + * MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the + * strongly-typed enumeration feature of C++11 ("enum class"). If supported + * by the compiler, an enum defined using these macros will not be implicitly + * converted to any other type, and its enumerators will be scoped using the + * enumeration name. Place MOZ_BEGIN_ENUM_CLASS(EnumName, type) in place of + * "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the closing + * "};". For example, + * + * MOZ_BEGIN_ENUM_CLASS(Enum, int32_t) + * A, B = 6 + * MOZ_END_ENUM_CLASS(Enum) + * + * This will make "Enum::A" and "Enum::B" appear in the global scope, but "A" + * and "B" will not. In compilers that support C++11 strongly-typed + * enumerations, implicit conversions of Enum values to numeric types will + * fail. In other compilers, Enum itself will actually be defined as a class, + * and some implicit conversions will fail while others will succeed. + * + * The type argument specifies the underlying type for the enum where + * supported, as with MOZ_ENUM_TYPE(). For simplicity, it is currently + * mandatory. As with MOZ_ENUM_TYPE(), it will do nothing on compilers that do + * not support it. + */ +#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) + /* All compilers that support strong enums also support an explicit + * underlying type, so no extra check is needed */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) enum class Name : type { +# define MOZ_END_ENUM_CLASS(Name) }; +#else + /** + * We need Name to both name a type, and scope the provided enumerator + * names. Namespaces and classes both provide scoping, but namespaces + * aren't types, so we need to use a class that wraps the enum values. We + * have an implicit conversion from the inner enum type to the class, so + * statements like + * + * Enum x = Enum::A; + * + * will still work. We need to define an implicit conversion from the class + * to the inner enum as well, so that (for instance) switch statements will + * work. This means that the class can be implicitly converted to a numeric + * value as well via the enum type, since C++ allows an implicit + * user-defined conversion followed by a standard conversion to still be + * implicit. + * + * We have an explicit constructor from int defined, so that casts like + * (Enum)7 will still work. We also have a zero-argument constructor with + * no arguments, so declaration without initialization (like "Enum foo;") + * will work. + * + * Additionally, we'll delete as many operators as possible for the inner + * enum type, so statements like this will still fail: + * + * f(5 + Enum::B); // deleted operator+ + * + * But we can't prevent things like this, because C++ doesn't allow + * overriding conversions or assignment operators for enums: + * + * int x = Enum::A; + * int f() + * { + * return Enum::A; + * } + */ +# define MOZ_BEGIN_ENUM_CLASS(Name, type) \ + class Name \ + { \ + public: \ + enum Enum MOZ_ENUM_TYPE(type) \ + { +# define MOZ_END_ENUM_CLASS(Name) \ + }; \ + Name() {} \ + Name(Enum aEnum) : mEnum(aEnum) {} \ + explicit Name(int num) : mEnum((Enum)num) {} \ + operator Enum() const { return mEnum; } \ + private: \ + Enum mEnum; \ + }; \ + inline int operator+(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator-(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator*(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator*(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator/(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator/(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator%(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator%(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator+(const Name::Enum&) MOZ_DELETE; \ + inline int operator-(const Name::Enum&) MOZ_DELETE; \ + inline int& operator++(Name::Enum&) MOZ_DELETE; \ + inline int operator++(Name::Enum&, int) MOZ_DELETE; \ + inline int& operator--(Name::Enum&) MOZ_DELETE; \ + inline int operator--(Name::Enum&, int) MOZ_DELETE; \ + inline bool operator==(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator==(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator!=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator>=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator>=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator<=(const int&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator<=(const Name::Enum&, const int&) MOZ_DELETE; \ + inline bool operator!(const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator&&(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline bool operator||(const bool&, const Name::Enum&) MOZ_DELETE; \ + inline bool operator||(const Name::Enum&, const bool&) MOZ_DELETE; \ + inline int operator~(const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator&(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator|(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator|(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator^(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator^(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator<<(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator<<(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int operator>>(const int&, const Name::Enum&) MOZ_DELETE; \ + inline int operator>>(const Name::Enum&, const int&) MOZ_DELETE; \ + inline int& operator+=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator-=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator*=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator/=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator%=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator&=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator|=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator^=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator<<=(int&, const Name::Enum&) MOZ_DELETE; \ + inline int& operator>>=(int&, const Name::Enum&) MOZ_DELETE; +#endif + /** * MOZ_WARN_UNUSED_RESULT tells the compiler to emit a warning if a function's * return value is not used by the caller. diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/BloomFilter.h b/scripting/javascript/spidermonkey-win32/include/mozilla/BloomFilter.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/CheckedInt.h b/scripting/javascript/spidermonkey-win32/include/mozilla/CheckedInt.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Constants.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Constants.h new file mode 100755 index 0000000000..904b30145a --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/Constants.h @@ -0,0 +1,15 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt math constants. */ + +#ifndef mozilla_Constants_h_ +#define mozilla_Constants_h_ + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#endif /* mozilla_Constants_h_ */ diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/FloatingPoint.h b/scripting/javascript/spidermonkey-win32/include/mozilla/FloatingPoint.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/GuardObjects.h b/scripting/javascript/spidermonkey-win32/include/mozilla/GuardObjects.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/HashFunctions.h b/scripting/javascript/spidermonkey-win32/include/mozilla/HashFunctions.h old mode 100644 new mode 100755 index 7a19749e55..badfc3c808 --- a/scripting/javascript/spidermonkey-win32/include/mozilla/HashFunctions.h +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/HashFunctions.h @@ -179,6 +179,14 @@ AddToHash(uint32_t hash, A* a) return detail::AddUintptrToHash(hash, uintptr_t(a)); } +template<> +MOZ_WARN_UNUSED_RESULT +inline uint32_t +AddToHash(uint32_t hash, uintptr_t a) +{ + return detail::AddUintptrToHash(hash, a); +} + template MOZ_WARN_UNUSED_RESULT uint32_t diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Likely.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Likely.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/LinkedList.h b/scripting/javascript/spidermonkey-win32/include/mozilla/LinkedList.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/MSStdInt.h b/scripting/javascript/spidermonkey-win32/include/mozilla/MSStdInt.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/MathAlgorithms.h b/scripting/javascript/spidermonkey-win32/include/mozilla/MathAlgorithms.h new file mode 100755 index 0000000000..b545fa544b --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/MathAlgorithms.h @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* mfbt maths algorithms. */ + +#ifndef mozilla_MathAlgorithms_h_ +#define mozilla_MathAlgorithms_h_ + +#include "mozilla/Assertions.h" + +namespace mozilla { + +// Greatest Common Divisor +template +MOZ_ALWAYS_INLINE IntegerType +EuclidGCD(IntegerType a, IntegerType b) +{ + // Euclid's algorithm; O(N) in the worst case. (There are better + // ways, but we don't need them for the current use of this algo.) + MOZ_ASSERT(a > 0); + MOZ_ASSERT(b > 0); + + while (a != b) { + if (a > b) { + a = a - b; + } else { + b = b - a; + } + } + + return a; +} + +// Least Common Multiple +template +MOZ_ALWAYS_INLINE IntegerType +EuclidLCM(IntegerType a, IntegerType b) +{ + // Divide first to reduce overflow risk. + return (a / EuclidGCD(a, b)) * b; +} + +} /* namespace mozilla */ + +#endif /* mozilla_MathAlgorithms_h_ */ diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/NullPtr.h b/scripting/javascript/spidermonkey-win32/include/mozilla/NullPtr.h new file mode 100755 index 0000000000..e6fc892759 --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/NullPtr.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Implements a workaround for compilers which do not support the C++11 nullptr + * constant. + */ + +#ifndef mozilla_NullPtr_h_ +#define mozilla_NullPtr_h_ + +#if defined(__clang__) +# ifndef __has_extension +# define __has_extension __has_feature +# endif +# if __has_extension(cxx_nullptr) +# define MOZ_HAVE_CXX11_NULLPTR +# endif +#elif defined(__GNUC__) +# if defined(_GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# if (__GNUC__ * 1000 + __GNU_MINOR__) >= 4006 +# define MOZ_HAVE_CXX11_NULLPTR +# endif +# endif +#elif _MSC_VER >= 1600 +# define MOZ_HAVE_CXX11_NULLPTR +#endif + +/** + * Use C++11 nullptr if available; otherwise use __null for gcc, or a 0 literal + * with the correct size to match the size of a pointer on a given platform. + */ + +#ifndef MOZ_HAVE_CXX11_NULLPTR +# if defined(__GNUC__) +# define nullptr __null +# elif defined(_WIN64) +# define nullptr 0LL +# else +# define nullptr 0L +# endif +#endif + +#endif /* mozilla_NullPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/RangedPtr.h b/scripting/javascript/spidermonkey-win32/include/mozilla/RangedPtr.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/RefPtr.h b/scripting/javascript/spidermonkey-win32/include/mozilla/RefPtr.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/SHA1.h b/scripting/javascript/spidermonkey-win32/include/mozilla/SHA1.h new file mode 100755 index 0000000000..fdb2150dc2 --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/SHA1.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Simple class for computing SHA1. */ + +/* + * To compute the SHA1 of a buffer using this class you should write something + * like: + * void SHA1(const uint8_t* buf, unsigned size, uint8_t hash[20]) + * { + * SHA1Sum S; + * S.update(buf, size); + * S.finish(hash); + * } + * If there are multiple buffers or chunks, the update method can be called + * multiple times and the SHA1 is computed on the concatenation of all the + * buffers passed to it. + * The finish method may only be called once and cannot be followed by calls + * to update. + */ + +#ifndef mozilla_SHA1_h_ +#define mozilla_SHA1_h_ + +#include "mozilla/StandardInteger.h" +namespace mozilla { +class SHA1Sum { + union { + uint32_t w[16]; /* input buffer */ + uint8_t b[64]; + } u; + uint64_t size; /* count of hashed bytes. */ + unsigned H[22]; /* 5 state variables, 16 tmp values, 1 extra */ + bool mDone; + +public: + static const unsigned int HashSize = 20; + SHA1Sum(); + void update(const uint8_t *dataIn, uint32_t len); + void finish(uint8_t hashout[20]); +}; +} + +#endif /* mozilla_SHA1_h_ */ diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Scoped.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Scoped.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/StandardInteger.h b/scripting/javascript/spidermonkey-win32/include/mozilla/StandardInteger.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/ThreadLocal.h b/scripting/javascript/spidermonkey-win32/include/mozilla/ThreadLocal.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/TypeTraits.h b/scripting/javascript/spidermonkey-win32/include/mozilla/TypeTraits.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Types.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Types.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/Util.h b/scripting/javascript/spidermonkey-win32/include/mozilla/Util.h old mode 100644 new mode 100755 diff --git a/scripting/javascript/spidermonkey-win32/include/mozilla/WeakPtr.h b/scripting/javascript/spidermonkey-win32/include/mozilla/WeakPtr.h new file mode 100755 index 0000000000..e20767141e --- /dev/null +++ b/scripting/javascript/spidermonkey-win32/include/mozilla/WeakPtr.h @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Weak pointer functionality, implemented as a mixin for use with any class. */ + +/** + * SupportsWeakPtr lets you have a pointer to an object 'Foo' without affecting + * its lifetime. It works by creating a single shared reference counted object + * (WeakReference) that each WeakPtr will access 'Foo' through. This lets 'Foo' + * clear the pointer in the WeakReference without having to know about all of + * the WeakPtrs to it and allows the WeakReference to live beyond the lifetime + * of 'Foo'. + * + * The overhead of WeakPtr is that accesses to 'Foo' becomes an additional + * dereference, and an additional heap allocated pointer sized object shared + * between all of the WeakPtrs. + * + * Example of usage: + * + * // To have a class C support weak pointers, inherit from SupportsWeakPtr. + * class C : public SupportsWeakPtr + * { + * public: + * int num; + * void act(); + * }; + * + * C* ptr = new C(); + * + * // Get weak pointers to ptr. The first time asWeakPtr is called + * // a reference counted WeakReference object is created that + * // can live beyond the lifetime of 'ptr'. The WeakReference + * // object will be notified of 'ptr's destruction. + * WeakPtr weak = ptr->asWeakPtr(); + * WeakPtr other = ptr->asWeakPtr(); + * + * // Test a weak pointer for validity before using it. + * if (weak) { + * weak->num = 17; + * weak->act(); + * } + * + * // Destroying the underlying object clears weak pointers to it. + * delete ptr; + * + * MOZ_ASSERT(!weak, "Deleting |ptr| clears weak pointers to it."); + * MOZ_ASSERT(!other, "Deleting |ptr| clears all weak pointers to it."); + * + * WeakPtr is typesafe and may be used with any class. It is not required that + * the class be reference-counted or allocated in any particular way. + * + * The API was loosely inspired by Chromium's weak_ptr.h: + * http://src.chromium.org/svn/trunk/src/base/memory/weak_ptr.h + */ + +#ifndef mozilla_WeakPtr_h_ +#define mozilla_WeakPtr_h_ + +#include "mozilla/Assertions.h" +#include "mozilla/NullPtr.h" +#include "mozilla/RefPtr.h" +#include "mozilla/TypeTraits.h" + +namespace mozilla { + +template class WeakPtr; + +template +class SupportsWeakPtr +{ + public: + WeakPtr asWeakPtr() { + if (!weakRef) + weakRef = new WeakReference(static_cast(this)); + return WeakPtr(weakRef); + } + + protected: + ~SupportsWeakPtr() { + MOZ_STATIC_ASSERT((IsBaseOf, T>::value), "T must derive from SupportsWeakPtr"); + if (weakRef) + weakRef->detach(); + } + + private: + friend class WeakPtr; + + // This can live beyond the lifetime of the class derived from SupportsWeakPtr. + class WeakReference : public RefCounted + { + public: + explicit WeakReference(T* ptr) : ptr(ptr) {} + T* get() const { + return ptr; + } + + private: + friend class WeakPtr; + friend class SupportsWeakPtr; + void detach() { + ptr = nullptr; + } + T* ptr; + }; + + RefPtr weakRef; +}; + +template +class WeakPtr +{ + public: + WeakPtr(const WeakPtr& o) : ref(o.ref) {} + WeakPtr() : ref(nullptr) {} + + operator T*() const { + return ref->get(); + } + T& operator*() const { + return *ref->get(); + } + + T* operator->() const { + return ref->get(); + } + + private: + friend class SupportsWeakPtr; + + explicit WeakPtr(const RefPtr::WeakReference> &o) : ref(o) {} + + RefPtr::WeakReference> ref; +}; + +} // namespace mozilla + +#endif /* ifdef mozilla_WeakPtr_h_ */ diff --git a/scripting/javascript/spidermonkey-win32/lib/mozjs.dll.REMOVED.git-id b/scripting/javascript/spidermonkey-win32/lib/mozjs.dll.REMOVED.git-id index dff5549b82..475323979b 100644 --- a/scripting/javascript/spidermonkey-win32/lib/mozjs.dll.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-win32/lib/mozjs.dll.REMOVED.git-id @@ -1 +1 @@ -520bea66db801ee6ba7a86ca8974c3999fdc0a30 \ No newline at end of file +da504065669dce359843f03a46e60f49be6d156b \ No newline at end of file diff --git a/scripting/javascript/spidermonkey-win32/lib/mozjs.lib.REMOVED.git-id b/scripting/javascript/spidermonkey-win32/lib/mozjs.lib.REMOVED.git-id index 92230c30f6..8fdaf0200b 100644 --- a/scripting/javascript/spidermonkey-win32/lib/mozjs.lib.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-win32/lib/mozjs.lib.REMOVED.git-id @@ -1 +1 @@ -3fc46b3f219996b838b31afe55827e2803dd1f48 \ No newline at end of file +93e1d9a90e40ffa0608ad24dff1ba734d8413375 \ No newline at end of file From ad64beb769684b885b3d47e948a5a428d7605b85 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 31 Oct 2012 11:33:53 +0800 Subject: [PATCH 59/95] invoke base class's onExit() to avoid memory leak --- samples/TestCpp/Classes/BugsTest/Bug-1159.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/TestCpp/Classes/BugsTest/Bug-1159.cpp b/samples/TestCpp/Classes/BugsTest/Bug-1159.cpp index 480c1d1b0d..7e56fa92ef 100644 --- a/samples/TestCpp/Classes/BugsTest/Bug-1159.cpp +++ b/samples/TestCpp/Classes/BugsTest/Bug-1159.cpp @@ -64,4 +64,5 @@ void Bug1159Layer::callBack(CCObject* pSender) void Bug1159Layer::onExit() { CCDirector::sharedDirector()->setDepthTest(false); + BugsTestBaseLayer::onExit(); } From 4fe16a262b0d1822055818eeca78b256236d6942 Mon Sep 17 00:00:00 2001 From: YuLei Liao Date: Wed, 31 Oct 2012 14:08:28 +0800 Subject: [PATCH 60/95] fix incorrect delete --- cocos2dx/platform/win32/CCCommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/platform/win32/CCCommon.cpp b/cocos2dx/platform/win32/CCCommon.cpp index 85a5663dda..a889ffb84a 100644 --- a/cocos2dx/platform/win32/CCCommon.cpp +++ b/cocos2dx/platform/win32/CCCommon.cpp @@ -68,8 +68,8 @@ void CCLuaLog(const char *pszMsg) WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, NULL, NULL); puts(buff); - delete widebuff; - delete buff; + delete[] widebuff; + delete[] buff; } NS_CC_END From 1a512488fada8f0ed21c52b249229fba84ebb69f Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 14:32:24 +0800 Subject: [PATCH 61/95] fixed #1538: Logic error in CCControlHuePicker::checkSliderPosition. The distance between current location and center should compare with radius rather than dimension. --- extensions/GUI/CCControlExtension/CCControlHuePicker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp index 54b9b643fa..846762ab07 100644 --- a/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlHuePicker.cpp @@ -162,7 +162,7 @@ bool CCControlHuePicker::checkSliderPosition(CCPoint location) double distance = sqrt(pow (location.x + 10, 2) + pow(location.y, 2)); // check that the touch location is within the circle - if (160 > distance && distance > 118) + if (80 > distance && distance > 59) { updateSliderPosition(location); return true; From 6f8187a20e08d02da4d7afcd895abf5c86de874d Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 15:15:37 +0800 Subject: [PATCH 62/95] Updated AUTHORS. --- AUTHORS | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index dfdc779e83..51ed72db79 100644 --- a/AUTHORS +++ b/AUTHORS @@ -31,6 +31,7 @@ Developers: edbartley update MSVS and MAC projects to use project-relative path + CCControl* should not respond to touches if the control is not visible Weeds use fontconfig to enhance font rendering on linux @@ -54,14 +55,20 @@ Developers: Nicolas Gramlich (nicolasgramlich, Zynga) fixed CCDirector to use CCLabelBMFont instead of CCLabelTTF - added CCBReader (CCBI format) - + added CCBReader (CCBI format) + + Rohan Kuruvilla (rohankuruvilla, Zynga) + Improvements to JS Bindings. + Jianfeng Zhou (NetGragon Inc) contributes CCListView and CCTextureWatcher. dducharme author of blackberry port - + + ImperialPenguin + Added TTF support for blackberry port. + HuaXu Cai (Kongzhong Corporation) author of linux port @@ -77,7 +84,7 @@ Developers: Eli Yukelzon (reflog) add a helper method to draw filled polygons - improvements to CCUserDefaults + improvements to CCUserDefaults ZhuoShi Shun contribute the lua binding of CocosDenshion @@ -129,6 +136,12 @@ Developers: Dongyang Cai(John-cdy) add automatically test tools + Sergey Vikhirev(BorMor) + Remove retina specific methods and logic. + + johnangel + OpenGL framebuffer access violation fix. + Retired Core Developers: WenSheng Yang Author of windows port, CCTextField, From e8bf21e6a6899028ca029d2dd8238989a9562484 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 31 Oct 2012 18:00:51 +0800 Subject: [PATCH 64/95] fixed #1543: The CCLayerGradient background of CocosBuilderTest can't be shown. --- cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp | 5 +++++ cocos2dx/layers_scenes_transitions_nodes/CCLayer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index cbe60c15e3..a670abb7ec 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -667,6 +667,11 @@ CCLayerGradient* CCLayerGradient::create(const ccColor4B& start, const ccColor4B return NULL; } +bool CCLayerGradient::init() +{ + return initWithColor(ccc4(0, 0, 0, 255), ccc4(0, 0, 0, 255)); +} + bool CCLayerGradient::initWithColor(const ccColor4B& start, const ccColor4B& end) { return initWithColor(start, end, ccp(0, -1)); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index 7c3caf0d96..e166ff8c8a 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -262,6 +262,7 @@ public: /** Creates a full-screen CCLayer with a gradient between start and end in the direction of v. */ static CCLayerGradient* create(const ccColor4B& start, const ccColor4B& end, const CCPoint& v); + virtual bool init(); /** Initializes the CCLayer with a gradient between start and end. */ virtual bool initWithColor(const ccColor4B& start, const ccColor4B& end); From 21900c26db50cc56e1514ce09db86decf5b7f56d Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 1 Nov 2012 12:06:15 +0800 Subject: [PATCH 65/95] update xcode template and version string --- cocos2dx/cocos2d.cpp | 2 +- template/xcode4/base_ios.xctemplate/ios/RootViewController.mm | 2 +- .../lib_cocos2dx.xctemplate/TemplateInfo.plist.REMOVED.git-id | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index 3d374740de..8098d77eca 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "cocos2d-2.0-x-2.0.3"; + return "cocos2d-2.0-x-2.0.4"; } NS_CC_END diff --git a/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm b/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm index 4c6f6f9224..ae0bf611c2 100644 --- a/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm +++ b/template/xcode4/base_ios.xctemplate/ios/RootViewController.mm @@ -43,7 +43,7 @@ // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead - (NSUInteger) supportedInterfaceOrientations{ #ifdef __IPHONE_6_0 - return UIInterfaceOrientationMaskAllButUpsideDown; + return UIInterfaceOrientationMaskLandscape; #endif } diff --git a/template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist.REMOVED.git-id b/template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist.REMOVED.git-id index 5fac254010..fd36abefe7 100644 --- a/template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist.REMOVED.git-id +++ b/template/xcode4/lib_cocos2dx.xctemplate/TemplateInfo.plist.REMOVED.git-id @@ -1 +1 @@ -e21d47625e1d0fac0c02ae37e976a4935d307012 \ No newline at end of file +7cf9610a6d9c4fc01d7d0cf0558a9d4ef0a2461e \ No newline at end of file From 2fbb748b7c3241e32fd1fa3bf7eac25966c9a738 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Mon, 22 Oct 2012 11:08:56 -0700 Subject: [PATCH 66/95] Adding sections for CCBReader bindings generation as well as renaming other bindings --- .../bindings/js_bindings_ccbreader.h | 1 - tools/tojs/cocos2dx.ini | 21 ++++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/scripting/javascript/bindings/js_bindings_ccbreader.h b/scripting/javascript/bindings/js_bindings_ccbreader.h index a847cf3e44..df12fd99cd 100644 --- a/scripting/javascript/bindings/js_bindings_ccbreader.h +++ b/scripting/javascript/bindings/js_bindings_ccbreader.h @@ -14,7 +14,6 @@ class CCBScriptCallbackProxy: public cocos2d::CCLayer -, public cocos2d::extension::CCBScriptOwnerProtocol , public cocos2d::extension::CCBSelectorResolver , public cocos2d::extension::CCBMemberVariableAssigner { diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 7b2f312cc3..bd1a856a37 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -13,7 +13,7 @@ android_flags = -D_SIZE_T_DEFINED_ clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include clang_flags = -nostdinc -x c++ -cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include +cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include -I%(cocosdir)s/extensions -I%(cocosdir)s/extensions/CCBReader cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common @@ -22,11 +22,11 @@ cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common 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 = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/include/SimpleAudioEngine.h +headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/include/SimpleAudioEngine.h %(cocosdir)s/extensions/cocos-ext.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 = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCSequence CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* +classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCSequence CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCBReader.* CCBAnimationManager.* CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* CCControlButton.* CCCamera.* # 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 @@ -35,7 +35,7 @@ classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Ac # will apply to all class names. This is a convenience wildcard to be able to skip similar named # functions from all classes. -skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid setGLServerState description getCamera getShaderProgram getUserObject .*UserData getGLServerState], +skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid setGLServerState description getShaderProgram getUserObject .*UserData getGLServerState], CCSprite::[getQuad displayFrame getTexture getBlendFunc setPosition setBlendFunc getTextureAtlas setSpriteBatchNode getSpriteBatchNode], CCSpriteBatchNode::[getBlendFunc setBlendFunc], CCMotionStreak::[getBlendFunc setBlendFunc], @@ -91,8 +91,10 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid CCLayerMultiplex::[*], CCCatmullRom.*::[create actionWithDuration], CCBezier.*::[create actionWithDuration], + CCBReader::[^CCBReader$ addOwnerCallbackName isJSControlled readByte getCCBMemberVariableAssigner readFloat getCCBSelectorResolver toLowerCase lastPathComponent deletePathExtension endsWith concat getResolutionScale getAnimatedProperties readBool readInt addOwnerCallbackNode addDocumentCallbackName readCachedString readNodeGraphFromData addDocumentCallbackNode getLoadedSpriteSheet initWithData readFileWithCleanUp getOwner$ readNodeGraphFromFile createSceneWithNodeGraphFromFile], CCCardinalSpline.*::[create actionWithDuration setPoints], CCTextureCache::[addPVRTCImage], + CC.*Loader$::[*], *::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*] rename_functions = CCDirector::[sharedDirector=getInstance], @@ -105,9 +107,14 @@ rename_functions = CCDirector::[sharedDirector=getInstance], CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation], CCLayerGradient::[initWithColor=init], CCNode::[boundingBox=getBoundingBox], - SimpleAudioEngine::[sharedEngine=getInstance] + SimpleAudioEngine::[sharedEngine=getInstance], + CCCamera.*::[setUpXYZ=setUp getUpXYZ=getUp setEyeXYZ=setEye getEyeXYZ=getEye setCenterXYZ=setCenter getCenterXYZ=getCenter], + CCBReader::[getAnimationManager=getActionManager setAnimationManager=setActionManager] -rename_classes = CCParticleSystemQuad::CCParticleSystem +rename_classes = CCParticleSystemQuad::CCParticleSystem, + SimpleAudioEngine::AudioEngine, + CCBReader::CC_Reader, + CCBAnimationManager::CCAnimation # for all class names, should we remove something when registering in the target VM? remove_prefix = CC @@ -118,5 +125,3 @@ base_objects = CCNode CCDirector SimpleAudioEngine # classes that create no constructor # CCSet is special and we will use a hand-written constructor abstract_classes = CCDirector CCSpriteFrameCache CCTransitionEaseScene CCSet SimpleAudioEngine - -rename_classes = SimpleAudioEngine::AudioEngine From dc51a7898185c26fa8edde08f5074cc17882ed51 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 24 Oct 2012 11:32:42 -0700 Subject: [PATCH 67/95] Updating bindings for CCBReader. It is now very similar to cocos2d-iphone CCBReader bindings --- extensions/CCBReader/CCNodeLoader.cpp | 6 +- .../bindings/js_bindings_ccbreader.cpp | 238 +++++++++++++----- 2 files changed, 185 insertions(+), 59 deletions(-) diff --git a/extensions/CCBReader/CCNodeLoader.cpp b/extensions/CCBReader/CCNodeLoader.cpp index c5729b7aa2..be797f748c 100644 --- a/extensions/CCBReader/CCNodeLoader.cpp +++ b/extensions/CCBReader/CCNodeLoader.cpp @@ -804,9 +804,13 @@ CCNode * CCNodeLoader::parsePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CC ccbReader->initWithData(data, pCCBReader->getOwner()); data->release(); ccbReader->getAnimationManager()->setRootContainerSize(pParent->getContentSize()); - + + ccbReader->setAnimationManagers(pCCBReader->getAnimationManagers()); + CCNode * ccbFileNode = ccbReader->readFileWithCleanUp(false); + pCCBReader->setAnimationManagers(ccbReader->getAnimationManagers()); + if (ccbFileNode && ccbReader->getAnimationManager()->getAutoPlaySequenceId() != -1) { // Auto play animations diff --git a/scripting/javascript/bindings/js_bindings_ccbreader.cpp b/scripting/javascript/bindings/js_bindings_ccbreader.cpp index e107b00bc9..b4213e878b 100644 --- a/scripting/javascript/bindings/js_bindings_ccbreader.cpp +++ b/scripting/javascript/bindings/js_bindings_ccbreader.cpp @@ -71,70 +71,191 @@ jsval CCBScriptCallbackProxy::getJSOwner() { return owner; } - -static CCNode* loadReader(const char *file, jsval owner) { - /* Create an autorelease CCNodeLoaderLibrary. */ +JSBool js_cocos2dx_CCBReader_readNodeGraphFromFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + JSObject *obj; + cocos2d::extension::CCBReader* cobj; + obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); + cobj = (cocos2d::extension::CCBReader *)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, cobj) + + if (argc == 2) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCObject* arg1; + do { + js_proxy_t *proxy; + JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]); + JS_GET_NATIVE_PROXY(proxy, tmpObj); + arg1 = (cocos2d::CCObject*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, arg1) + } while (0); + cocos2d::CCNode* ret = cobj->readNodeGraphFromFile(arg0, arg1); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + if (argc == 1) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCNode* ret = cobj->readNodeGraphFromFile(arg0); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + if (argc == 3) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCObject* arg1; + do { + js_proxy_t *proxy; + JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]); + JS_GET_NATIVE_PROXY(proxy, tmpObj); + arg1 = (cocos2d::CCObject*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, arg1) + } while (0); + cocos2d::CCSize arg2; + arg2 = jsval_to_ccsize(cx, argv[2]); + cocos2d::CCNode* ret = cobj->readNodeGraphFromFile(arg0, arg1, arg2); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + return JS_FALSE; +} + +JSBool js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + JSObject *obj; + cocos2d::extension::CCBReader* cobj; + obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); + cobj = (cocos2d::extension::CCBReader *)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, cobj) + + if (argc == 2) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCObject* arg1; + do { + js_proxy_t *proxy; + JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]); + JS_GET_NATIVE_PROXY(proxy, tmpObj); + arg1 = (cocos2d::CCObject*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, arg1) + } while (0); + cocos2d::CCScene* ret = cobj->createSceneWithNodeGraphFromFile(arg0, arg1); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + if (argc == 1) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCScene* ret = cobj->createSceneWithNodeGraphFromFile(arg0); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + if (argc == 3) { + const char* arg0; + std::string arg0_tmp = jsval_to_std_string(cx, argv[0]); arg0 = arg0_tmp.c_str(); + cocos2d::CCObject* arg1; + do { + js_proxy_t *proxy; + JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]); + JS_GET_NATIVE_PROXY(proxy, tmpObj); + arg1 = (cocos2d::CCObject*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, arg1) + } while (0); + cocos2d::CCSize arg2; + arg2 = jsval_to_ccsize(cx, argv[2]); + cocos2d::CCScene* ret = cobj->createSceneWithNodeGraphFromFile(arg0, arg1, arg2); + jsval jsret; do { + if (ret) { + js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + jsret = JSVAL_NULL; + } + } while (0); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + + return JS_FALSE; +} + + +JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp) +{ - /* Create an autorelease CCBReader. */ CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); ccNodeLoaderLibrary->registerCCNodeLoader("", JSLayerLoader::loader()); - cocos2d::extension::CCBReader * ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary); - ccbReader->autorelease(); + cocos2d::extension::CCBReader * ret = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary); + ret->autorelease(); - /* Read a ccbi file. */ - ccbReader->hasScriptingOwner = true; - - CCBScriptCallbackProxy *ccBCallbackProxy = new CCBScriptCallbackProxy(); - ccBCallbackProxy->setJSOwner(owner); - //ccbReader->setOwner(dynamic_cast(ccBCallbackProxy)); - - //CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(ccBCallbackProxy); - - CCNode * node = ccbReader->readNodeGraphFromFile(file, dynamic_cast(ccBCallbackProxy)); - - return node; -} - - -JSBool js_CocosBuilder_Run(JSContext *cx, uint32_t argc, jsval *vp) -{ - if (argc >= 1) { - jsval *argv = JS_ARGV(cx, vp); - const char *arg0; - do { - JSString *tmp = JS_ValueToString(cx, argv[0]); - arg0 = JS_EncodeString(cx, tmp); + jsval jsret; + if (ret) { + js_proxy_t *proxy; + JS_GET_PROXY(proxy, ret); + if (proxy) { + jsret = OBJECT_TO_JSVAL(proxy->obj); + } else { + // create a new js obj of that class + proxy = js_get_or_create_proxy(cx, ret); + jsret = OBJECT_TO_JSVAL(proxy->obj); } - while (0); - - jsval obj = argc >= 2 ? argv[1] : JSVAL_NULL; - if (obj.isObject()) { - CCLOG("%p: + ", JSVAL_TO_OBJECT(obj)); - } - CCNode * ret = loadReader(arg0, obj); - jsval jsret; - if (ret) { - js_proxy_t *proxy; - JS_GET_PROXY(proxy, ret); - if (proxy) { - jsret = OBJECT_TO_JSVAL(proxy->obj); - } else { - // create a new js obj of that class - proxy = js_get_or_create_proxy(cx, ret); - jsret = OBJECT_TO_JSVAL(proxy->obj); - } - } else { - jsret = JSVAL_NULL; - } - JS_SET_RVAL(cx, vp, jsret); - return JS_TRUE; - + } else { + jsret = JSVAL_NULL; } - return JS_FALSE; + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } +extern JSObject* js_cocos2dx_CCBReader_prototype; + void register_CCBuilderReader(JSContext *cx, JSObject *obj) { jsval nsval; @@ -149,9 +270,10 @@ void register_CCBuilderReader(JSContext *cx, JSObject *obj) { } obj = ns; - JSObject *ccReader = JS_NewObject(cx, NULL, NULL, NULL); - jsval valObj = OBJECT_TO_JSVAL(ccReader); - JS_SetProperty(cx, ns, "Reader", &valObj); + JSObject *tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, obj, "(function () { return cc._Reader; })()")); + JS_DefineFunction(cx, tmpObj, "create", js_CocosBuilder_create, 2, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, tmpObj, "loadScene", js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT); + + JS_DefineFunction(cx, js_cocos2dx_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT); - JS_DefineFunction(cx, ccReader, "load", js_CocosBuilder_Run, 2, JSPROP_READONLY | JSPROP_PERMANENT); } From a9473f1e8a86f8b739de7ec9914a65415126cf5d Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 31 Oct 2012 11:06:56 -0700 Subject: [PATCH 69/95] Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader --- extensions/CCBReader/CCBReader.cpp | 99 +++++++++++++++++++++++++++++- extensions/CCBReader/CCBReader.h | 25 ++++++++ 2 files changed, 123 insertions(+), 1 deletion(-) diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index 7b43222d40..0ac2719021 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -91,6 +91,11 @@ CCBReader::CCBReader(CCBReader * pCCBReader) this->mCCBMemberVariableAssigner = pCCBReader->mCCBMemberVariableAssigner; this->mCCBSelectorResolver = pCCBReader->mCCBSelectorResolver; this->mCCNodeLoaderListener = pCCBReader->mCCNodeLoaderListener; + + this->mOwnerCallbackNames = pCCBReader->mOwnerCallbackNames; + this->mOwnerCallbackNodes = pCCBReader->mOwnerCallbackNodes; + this->mOwnerOutletNames = pCCBReader->mOwnerOutletNames; + this->mOwnerOutletNodes = pCCBReader->mOwnerOutletNodes; } CCBReader::CCBReader() @@ -227,6 +232,12 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const initWithData(pData, pOwner); mActionManager->setRootContainerSize(parentSize); + mOwnerOutletNames = CCArray::create(); + mOwnerOutletNodes = CCArray::create(); + + mOwnerCallbackNames = CCArray::create(); + mOwnerCallbackNodes = CCArray::create(); + CCNode *pNodeGraph = readFileWithCleanUp(true); if (pNodeGraph && mActionManager->getAutoPlaySequenceId() != -1) @@ -234,7 +245,20 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const // Auto play animations mActionManager->runAnimations(mActionManager->getAutoPlaySequenceId(), 0); } + + if(jsControlled) { + mNodesWithAnimationManagers = CCArray::create(); + mAnimationManagerForNodes = CCArray::create(); + } + for(int i = 0; i < mAnimationManagers.size(); ++i) { + if(jsControlled) { + mNodesWithAnimationManagers->addObject(mAnimationManagers[i].first); + mAnimationManagerForNodes->addObject(mAnimationManagers[i].second); + } + + } + // Return action manager by reference if (ppAnimationManager) { @@ -321,7 +345,13 @@ CCNode* CCBReader::readFileWithCleanUp(bool bCleanUp) } CCNode *pNode = readNodeGraph(); +<<<<<<< HEAD +======= + + mAnimationManagers.push_back(std::make_pair(pNode, mActionManager)); + +>>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader if (bCleanUp) { cleanUpNodeGraph(pNode); @@ -481,6 +511,13 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { mActionManager->setRootNode(node); } +<<<<<<< HEAD +======= + if(jsControlled && node == mActionManager->getRootNode()) { + mActionManager->setDocumentControllerName(jsControlledName->getCString()); + } + +>>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader // Read animated properties CCDictionary *seqs = CCDictionary::create(); mAnimatedProps = new set(); @@ -536,8 +573,10 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { embeddedNode->setScale(ccbFileNode->getScale()); embeddedNode->setTag(ccbFileNode->getTag()); embeddedNode->setVisible(true); - embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition()); + //embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition()); + mActionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode); + ccbFileNode->setCCBFileNode(NULL); node = embeddedNode; @@ -759,6 +798,64 @@ bool CCBReader::endsWith(CCString * pString, CCString * pEnding) { } } +<<<<<<< HEAD +======= +bool CCBReader::isJSControlled() { + return jsControlled; +} + +void CCBReader::addOwnerCallbackName(std::string name) { + mOwnerCallbackNames->addObject(CCString::create(name)); +} + +void CCBReader::addOwnerCallbackNode(CCNode *node) { + mOwnerCallbackNodes->addObject(node); +} + + +void CCBReader::addDocumentCallbackName(std::string name) { + mActionManager->addDocumentCallbackName(name); +} + +void CCBReader::addDocumentCallbackNode(CCNode *node) { + mActionManager->addDocumentCallbackNode(node); +} + + +CCArray* CCBReader::getOwnerCallbackNames() { + return mOwnerCallbackNames; +} + +CCArray* CCBReader::getOwnerCallbackNodes() { + return mOwnerCallbackNodes; +} + +CCArray* CCBReader::getOwnerOutletNames() { + return mOwnerOutletNames; +} + +CCArray* CCBReader::getOwnerOutletNodes() { + return mOwnerOutletNodes; +} + +CCArray* CCBReader::getNodesWithAnimationManagers() { + return mNodesWithAnimationManagers; +} + +CCArray* CCBReader::getAnimationManagerForNodes() { + return mAnimationManagerForNodes; +} + +std::vector > CCBReader::getAnimationManagers() { + return mAnimationManagers; +} + +void CCBReader::setAnimationManagers(std::vector > x) { + mAnimationManagers = x; +} + + +>>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader /************************************************************************ Static functions ************************************************************************/ diff --git a/extensions/CCBReader/CCBReader.h b/extensions/CCBReader/CCBReader.h index 406b128663..d9c462e25e 100644 --- a/extensions/CCBReader/CCBReader.h +++ b/extensions/CCBReader/CCBReader.h @@ -177,6 +177,9 @@ private: CCObject *mOwner; CCBAnimationManager *mActionManager; + + std::vector > mAnimationManagers; + std::set *mAnimatedProps; CCNodeLoaderLibrary *mCCNodeLoaderLibrary; @@ -231,6 +234,28 @@ public: bool readBool(); float readFloat(); CCString* readCachedString(); +<<<<<<< HEAD +======= + bool isJSControlled(); + + + CCArray *getOwnerCallbackNames(); + CCArray *getOwnerCallbackNodes(); + CCArray* getOwnerOutletNames(); + CCArray* getOwnerOutletNodes(); + CCArray* getNodesWithAnimationManagers(); + CCArray* getAnimationManagerForNodes(); + std::vector > getAnimationManagers(); + void setAnimationManagers(std::vector > x); + + + + void addOwnerCallbackName(std::string name); + void addOwnerCallbackNode(CCNode *node); + + void addDocumentCallbackName(std::string name); + void addDocumentCallbackNode(CCNode *node); +>>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader static float getResolutionScale(); From 89e40a2c98f37615441665c2964b6c59ab5f8092 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 31 Oct 2012 11:07:33 -0700 Subject: [PATCH 70/95] Adding support for animationCompletedJSCallback in CCBReader --- extensions/CCBReader/CCBAnimationManager.cpp | 62 ++++++++++++++++++-- extensions/CCBReader/CCBAnimationManager.h | 15 ++++- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index 3af62ea22e..099ea069a2 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -33,6 +33,14 @@ bool CCBAnimationManager::init() mNodeSequences = new CCDictionary(); mBaseValues = new CCDictionary(); + mDocumentOutletNames = CCArray::create(); + mDocumentOutletNodes = CCArray::create(); + mDocumentCallbackNames = CCArray::create(); + mDocumentCallbackNodes = CCArray::create(); + + mTarget = NULL; + mAnimationCompleteCallbackFunc = NULL; + return true; } @@ -181,6 +189,24 @@ CCBSequence* CCBAnimationManager::getSequence(int nSequenceId) return NULL; } + +void CCBAnimationManager::moveAnimationsFromNode(CCNode* fromNode, CCNode* toNode) { + + // Move base values + CCObject* baseValue = mBaseValues->objectForKey((intptr_t)fromNode); + if(baseValue) { + mBaseValues->setObject(baseValue, (intptr_t)toNode); + mBaseValues->removeObjectForKey((intptr_t)fromNode); + } + + // Move seqs + CCObject *seqs = mNodeSequences->objectForKey((intptr_t)fromNode); + if(seqs) { + mNodeSequences->setObject(seqs, (intptr_t)toNode); + mNodeSequences->removeObjectForKey((intptr_t)fromNode); + } +} + // Refer to CCBReader::readKeyframe() for the real type of value CCActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, CCNode *pNode) { @@ -265,15 +291,15 @@ CCActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKey return NULL; } -void CCBAnimationManager::setAnimatedProperty(const char *pPropName, CCNode *pNode, CCObject *pValue, float fTweenDuraion) +void CCBAnimationManager::setAnimatedProperty(const char *pPropName, CCNode *pNode, CCObject *pValue, float fTweenDuration) { - if (fTweenDuraion > 0) + if (fTweenDuration > 0) { // Create a fake keyframe to generate the action from CCBKeyframe *kf1 = new CCBKeyframe(); kf1->autorelease(); kf1->setValue(pValue); - kf1->setTime(fTweenDuraion); + kf1->setTime(fTweenDuration); kf1->setEasingType(kCCBKeyframeEasingLinear); // Animate @@ -334,7 +360,16 @@ void CCBAnimationManager::setAnimatedProperty(const char *pPropName, CCNode *pNo ccColor3BWapper *color = (ccColor3BWapper*)pValue; ((CCSprite*)pNode)->setColor(color->getColor()); } - else + else if (strcmp(pPropName, "visible") == 0) + { + bool x = (bool)pValue; + if(x) { + CCSequence::createWithTwoActions(CCDelayTime::create(fTweenDuration), CCShow::create()); + } else { + CCSequence::createWithTwoActions(CCDelayTime::create(fTweenDuration), CCHide::create()); + } + } + else { CCLog("unsupported property name is %s", pPropName); CCAssert(false, "unsupported property now"); @@ -540,6 +575,21 @@ void CCBAnimationManager::debug() } +void CCBAnimationManager::setAnimationCompletedCallback(CCObject *target, SEL_CallFunc callbackFunc) { + if (target) + { + target->retain(); + } + + if (mTarget) + { + mTarget->release(); + } + + mTarget = target; + mAnimationCompleteCallbackFunc = callbackFunc; +} + void CCBAnimationManager::sequenceCompleted() { if (mDelegate) @@ -547,6 +597,10 @@ void CCBAnimationManager::sequenceCompleted() mDelegate->completedAnimationSequenceNamed(mRunningSequence->getName()); } + if (mTarget && mAnimationCompleteCallbackFunc) { + (mTarget->*mAnimationCompleteCallbackFunc)(); + } + int nextSeqId = mRunningSequence->getChainedSequenceId(); mRunningSequence = NULL; diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index 1c6aa0db88..ff7b96f857 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -29,6 +29,15 @@ private: CCBAnimationManagerDelegate *mDelegate; CCBSequence *mRunningSequence; + CCArray *mDocumentOutletNames; + CCArray *mDocumentOutletNodes; + CCArray *mDocumentCallbackNames; + CCArray *mDocumentCallbackNodes; + std::string mDocumentControllerName; + std::string lastCompletedSequenceName; + SEL_CallFunc mAnimationCompleteCallbackFunc; + CCObject *mTarget; + public: CCBAnimationManager(); ~CCBAnimationManager(); @@ -55,11 +64,13 @@ public: void addNode(CCNode *pNode, CCDictionary *pSeq); void setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName); - + void moveAnimationsFromNode(CCNode* fromNode, CCNode* toNode); + void runAnimations(const char *pName, float fTweenDuration); void runAnimations(const char *pName); void runAnimations(int nSeqId, float fTweenDuraiton); - + void setAnimationCompletedCallback(CCObject *target, SEL_CallFunc callbackFunc); + void debug(); private: From ea92936c1fdd0f9277900c7a6be52705ddaa6b89 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 31 Oct 2012 11:08:37 -0700 Subject: [PATCH 71/95] Adding bindings for CCBReader and other improvements. 1. Added additional CCBReader bindings, including callback support for animationCompleted 2. Improved design for JS CallbackWrappers 3. Added bindings for pDistance 4. Updating cocos2dx.ini --- .../javascript/bindings/ScriptingCore.cpp | 40 ++++---- .../javascript/bindings/cocos2d_specifics.cpp | 92 +++++++++++-------- .../javascript/bindings/cocos2d_specifics.hpp | 87 ++++++++++-------- .../bindings/js_bindings_ccbreader.cpp | 31 ++++++- tools/tojs/cocos2dx.ini | 3 +- 5 files changed, 159 insertions(+), 94 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index d2b19da945..5a294deefe 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -597,7 +597,7 @@ JSBool ScriptingCore::removeRootJS(JSContext *cx, uint32_t argc, jsval *vp) void ScriptingCore::pauseSchedulesAndActions(CCNode *node) { - CCArray * arr = JSSchedule::getTargetForNativeNode(node); + CCArray * arr = JSScheduleWrapper::getTargetForNativeNode(node); if(! arr) return; for(unsigned int i = 0; i < arr->count(); ++i) { if(arr->objectAtIndex(i)) { @@ -609,7 +609,7 @@ void ScriptingCore::pauseSchedulesAndActions(CCNode *node) { void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { - CCArray * arr = JSSchedule::getTargetForNativeNode(node); + CCArray * arr = JSScheduleWrapper::getTargetForNativeNode(node); if(!arr) return; for(unsigned int i = 0; i < arr->count(); ++i) { if(!arr->objectAtIndex(i)) continue; @@ -619,12 +619,12 @@ void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { void ScriptingCore::cleanupSchedulesAndActions(CCNode *node) { - CCArray * arr = JSCallFunc::getTargetForNativeNode(node); + CCArray * arr = JSCallFuncWrapper::getTargetForNativeNode(node); if(arr) { arr->removeAllObjects(); } - arr = JSSchedule::getTargetForNativeNode(node); + arr = JSScheduleWrapper::getTargetForNativeNode(node); if(arr) { arr->removeAllObjects(); } @@ -1016,20 +1016,26 @@ CCArray* jsval_to_ccarray(JSContext* cx, jsval v) { jsval ccarray_to_jsval(JSContext* cx, CCArray *arr) { - - JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL); - - for(int i = 0; i < arr->count(); ++i) { - - CCObject *obj = arr->objectAtIndex(i); - js_proxy_t *proxy = js_get_or_create_proxy(cx, obj); - jsval arrElement = OBJECT_TO_JSVAL(proxy->obj); - - if(!JS_SetElement(cx, jsretArr, i, &arrElement)) { - break; + + JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL); + + for(int i = 0; i < arr->count(); ++i) { + jsval arrElement; + CCObject *obj = arr->objectAtIndex(i); + + CCString *testString = dynamic_cast(obj); + if(testString) { + arrElement = c_string_to_jsval(cx, testString->getCString()); + } else { + js_proxy_t *proxy = js_get_or_create_proxy(cx, obj); + arrElement = OBJECT_TO_JSVAL(proxy->obj); + } + + if(!JS_SetElement(cx, jsretArr, i, &arrElement)) { + break; + } } - } - return OBJECT_TO_JSVAL(jsretArr); + return OBJECT_TO_JSVAL(jsretArr); } jsval long_long_to_jsval(JSContext* cx, long long v) { diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index a06aa71f2a..e6d2f784fe 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -545,19 +545,19 @@ JSBool js_platform(JSContext *cx, uint32_t argc, jsval *vp) } -void JSCallFunc::setJSCallbackFunc(jsval func) { +void JSCallbackWrapper::setJSCallbackFunc(jsval func) { jsCallback = func; } -void JSCallFunc::setJSCallbackThis(jsval thisObj) { +void JSCallbackWrapper::setJSCallbackThis(jsval thisObj) { jsThisObj = thisObj; } -void JSCallFunc::setExtraDataField(jsval data) { +void JSCallbackWrapper::setJSExtraData(jsval data) { extraData = data; } -void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { +void JSCallFuncWrapper::setTargetForNativeNode(CCNode *pNode, JSCallFuncWrapper *target) { callfuncTarget_proxy_t *t; HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); @@ -577,7 +577,7 @@ void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { HASH_ADD_PTR(_callfuncTarget_native_ht, ptr, p); } -CCArray * JSCallFunc::getTargetForNativeNode(CCNode *pNode) { +CCArray * JSCallFuncWrapper::getTargetForNativeNode(CCNode *pNode) { schedTarget_proxy_t *t; HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); @@ -596,18 +596,18 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) if (argc >= 1) { jsval *argv = JS_ARGV(cx, vp); - JSCallFunc *tmpCobj = new JSCallFunc(); + JSCallFuncWrapper *tmpCobj = new JSCallFuncWrapper(); tmpCobj->autorelease(); tmpCobj->setJSCallbackThis(argv[0]); if(argc >= 2) { tmpCobj->setJSCallbackFunc(argv[1]); } if(argc == 3) { - tmpCobj->setExtraDataField(argv[2]); + tmpCobj->setJSExtraData(argv[2]); } CCCallFunc *ret = (CCCallFunc *)CCCallFuncN::create((CCObject *)tmpCobj, - callfuncN_selector(JSCallFunc::callbackFunc)); + callfuncN_selector(JSCallFuncWrapper::callbackFunc)); js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(proxy->obj)); @@ -624,7 +624,8 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) } -void JSSchedule::setTargetForSchedule(jsval sched, JSSchedule *target) { + +void JSScheduleWrapper::setTargetForSchedule(jsval sched, JSScheduleWrapper *target) { do { schedFunc_proxy_t *p = (schedFunc_proxy_t *)malloc(sizeof(schedFunc_proxy_t)); assert(p); @@ -634,7 +635,7 @@ void JSSchedule::setTargetForSchedule(jsval sched, JSSchedule *target) { } while(0); } -JSSchedule * JSSchedule::getTargetForSchedule(jsval sched) { +JSScheduleWrapper * JSScheduleWrapper::getTargetForSchedule(jsval sched) { schedFunc_proxy_t *t; JSObject *o = JSVAL_TO_OBJECT(sched); HASH_FIND_PTR(_schedFunc_target_ht, &o, t); @@ -642,7 +643,7 @@ JSSchedule * JSSchedule::getTargetForSchedule(jsval sched) { } -void JSSchedule::setTargetForNativeNode(CCNode *pNode, JSSchedule *target) { +void JSScheduleWrapper::setTargetForNativeNode(CCNode *pNode, JSScheduleWrapper *target) { schedTarget_proxy_t *t; HASH_FIND_PTR(_schedTarget_native_ht, &pNode, t); @@ -662,7 +663,7 @@ void JSSchedule::setTargetForNativeNode(CCNode *pNode, JSSchedule *target) { HASH_ADD_PTR(_schedTarget_native_ht, ptr, p); } -CCArray * JSSchedule::getTargetForNativeNode(CCNode *pNode) { +CCArray * JSScheduleWrapper::getTargetForNativeNode(CCNode *pNode) { schedTarget_proxy_t *t; HASH_FIND_PTR(_schedTarget_native_ht, &pNode, t); @@ -673,15 +674,6 @@ CCArray * JSSchedule::getTargetForNativeNode(CCNode *pNode) { } -void JSSchedule::setJSScheduleFunc(jsval func) { - jsSchedule = func; -} - -void JSSchedule::setJSScheduleThis(jsval thisObj) { - jsThisObj = thisObj; -} - - JSBool js_CCNode_unschedule(JSContext *cx, uint32_t argc, jsval *vp) { @@ -698,9 +690,9 @@ JSBool js_CCNode_unschedule(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); - JSSchedule *tmpCobj = JSSchedule::getTargetForSchedule(argv[0]); + JSScheduleWrapper *tmpCobj = JSScheduleWrapper::getTargetForSchedule(argv[0]); - sched->unscheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj); + sched->unscheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj); JS_SET_RVAL(cx, vp, JSVAL_VOID); } @@ -722,7 +714,7 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); - JSSchedule *tmpCobj = new JSSchedule(); + JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); // @@ -734,16 +726,16 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } - tmpCobj->setJSScheduleThis(OBJECT_TO_JSVAL(obj)); - tmpCobj->setJSScheduleFunc(argv[0]); + tmpCobj->setJSCallbackThis(OBJECT_TO_JSVAL(obj)); + tmpCobj->setJSCallbackFunc(argv[0]); - JSSchedule::setTargetForSchedule(argv[0], tmpCobj); - JSSchedule::setTargetForNativeNode(node, tmpCobj); + JSScheduleWrapper::setTargetForSchedule(argv[0], tmpCobj); + JSScheduleWrapper::setTargetForNativeNode(node, tmpCobj); if(argc == 1) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), 0, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), 0, 0); } else { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, interval, node->isRunning(), 0, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, interval, node->isRunning(), 0, 0); } JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -770,7 +762,7 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); js_proxy_t *p = js_get_or_create_proxy(cx, sched); - JSSchedule *tmpCobj = new JSSchedule(); + JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); double interval; if( argc >= 2 ) { @@ -796,20 +788,20 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } - tmpCobj->setJSScheduleThis(OBJECT_TO_JSVAL(obj)); - tmpCobj->setJSScheduleFunc(argv[0]); + tmpCobj->setJSCallbackThis(OBJECT_TO_JSVAL(obj)); + tmpCobj->setJSCallbackFunc(argv[0]); - JSSchedule::setTargetForSchedule(argv[0], tmpCobj); - JSSchedule::setTargetForNativeNode(node, tmpCobj); + JSScheduleWrapper::setTargetForSchedule(argv[0], tmpCobj); + JSScheduleWrapper::setTargetForNativeNode(node, tmpCobj); if(argc == 1) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning()); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning()); } if(argc == 2) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, interval, node->isRunning()); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, interval, node->isRunning()); } if(argc == 3) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, 0); } if (argc == 4) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, delay); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, delay); } @@ -1143,6 +1135,27 @@ JSBool js_cocos2dx_ccpAdd(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } +JSBool js_cocos2dx_ccpDistance(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + + if (argc == 2) { + cocos2d::CCPoint arg0; + arg0 = jsval_to_ccpoint(cx, argv[0]); + cocos2d::CCPoint arg1; + arg1 = jsval_to_ccpoint(cx, argv[1]); + + float ret = ccpDistance(arg0, arg1); + + jsval jsret = DOUBLE_TO_JSVAL(ret); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); + return JS_FALSE; +} + JSBool js_cocos2dx_ccpClamp(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); @@ -1596,6 +1609,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, tmpObj, "garbageCollect", js_forceGC, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pAdd", js_cocos2dx_ccpAdd, 1, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, ns, "pDistance", js_cocos2dx_ccpDistance, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pSub", js_cocos2dx_ccpSub, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pNeg", js_cocos2dx_ccpNeg, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pMult", js_cocos2dx_ccpMult, 0, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index c8c6b8c13b..25f3d541f6 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -4,11 +4,11 @@ #include "jsapi.h" #include "ScriptingCore.h" -class JSSchedule; +class JSScheduleWrapper; typedef struct jsScheduleFunc_proxy { void * ptr; - JSSchedule *obj; + JSScheduleWrapper *obj; UT_hash_handle hh; } schedFunc_proxy_t; @@ -79,19 +79,48 @@ inline js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj) { jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string); void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj); -class JSCallFunc: public CCObject { + +class JSCallbackWrapper: public CCObject { public: - JSCallFunc(jsval func): jsCallback(func) {} - JSCallFunc() {extraData = JSVAL_VOID;} - virtual ~JSCallFunc() { - return; - } - + JSCallbackWrapper() {} + virtual ~JSCallbackWrapper(void) {} void setJSCallbackFunc(jsval obj); void setJSCallbackThis(jsval thisObj); - void setExtraDataField(jsval data); - static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data); - static void setTargetForNativeNode(CCNode *pNode, JSCallFunc *target); + void setJSExtraData(jsval data); + +protected: + jsval jsCallback; + jsval jsThisObj; + jsval extraData; +}; + + +class JSCCBAnimationWrapper: public JSCallbackWrapper { +public: + JSCCBAnimationWrapper() {} + virtual ~JSCCBAnimationWrapper() {} + + void animationCompleteCallback() const { + + JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); + jsval retval = JSVAL_NULL; + + if(!JSVAL_IS_VOID(jsCallback) && !JSVAL_IS_VOID(jsThisObj)) { + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 0, NULL, &retval); + } + } + +}; + + +class JSCallFuncWrapper: public JSCallbackWrapper { +public: + JSCallFuncWrapper() {} + virtual ~JSCallFuncWrapper(void) { + return; + } + + static void setTargetForNativeNode(CCNode *pNode, JSCallFuncWrapper *target); static CCArray * getTargetForNativeNode(CCNode *pNode); void callbackFunc(CCNode *node) const { @@ -115,35 +144,28 @@ public: JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 2, valArr, &retval); } - JSCallFunc::setTargetForNativeNode(node, (JSCallFunc *)this); + JSCallFuncWrapper::setTargetForNativeNode(node, (JSCallFuncWrapper *)this); JS_RemoveValueRoot(cx, valArr); } -private: - jsval jsCallback; - jsval jsThisObj; - jsval extraData; + }; -class JSSchedule: public CCObject { +class JSScheduleWrapper: public JSCallbackWrapper { public: - JSSchedule(jsval func): jsSchedule(func) {} - JSSchedule() {jsSchedule = JSVAL_VOID; jsThisObj = JSVAL_VOID;} - virtual ~JSSchedule() { + JSScheduleWrapper() {} + virtual ~JSScheduleWrapper() { return; } - static void setTargetForSchedule(jsval sched, JSSchedule *target); - static JSSchedule * getTargetForSchedule(jsval sched); - static void setTargetForNativeNode(CCNode *pNode, JSSchedule *target); + static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target); + static JSScheduleWrapper * getTargetForSchedule(jsval sched); + static void setTargetForNativeNode(CCNode *pNode, JSScheduleWrapper *target); static CCArray * getTargetForNativeNode(CCNode *pNode); - void setJSScheduleFunc(jsval obj); - void setJSScheduleThis(jsval thisObj); - void pause(); void scheduleFunc(float dt) const { @@ -156,20 +178,13 @@ public: return; } - if(!JSVAL_IS_VOID(jsSchedule) && !JSVAL_IS_VOID(jsThisObj)) { - ScriptingCore::dumpRoot(cx, 0, NULL); - JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsSchedule, 1, &data, &retval); + if(!JSVAL_IS_VOID(jsCallback) && !JSVAL_IS_VOID(jsThisObj)) { + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 1, &data, &retval); } JS_RemoveValueRoot(cx, &data); } - -private: - - jsval jsSchedule; - jsval jsThisObj; - }; diff --git a/scripting/javascript/bindings/js_bindings_ccbreader.cpp b/scripting/javascript/bindings/js_bindings_ccbreader.cpp index b4213e878b..7c248942e9 100644 --- a/scripting/javascript/bindings/js_bindings_ccbreader.cpp +++ b/scripting/javascript/bindings/js_bindings_ccbreader.cpp @@ -71,6 +71,34 @@ jsval CCBScriptCallbackProxy::getJSOwner() { return owner; } +JSBool js_cocos2dx_CCBAnimationManager_animationCompleteCallback(JSContext *cx, uint32_t argc, jsval *vp) +{ + if (argc >= 1) { + jsval *argv = JS_ARGV(cx, vp); + + JSObject *obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy; + JS_GET_NATIVE_PROXY(proxy, obj); + cocos2d::extension::CCBAnimationManager *node = (cocos2d::extension::CCBAnimationManager *)(proxy ? proxy->ptr : NULL); + + JSCCBAnimationWrapper *tmpCobj = new JSCCBAnimationWrapper(); + tmpCobj->autorelease(); + + tmpCobj->setJSCallbackThis(argv[0]); + if(argc >= 2) { + tmpCobj->setJSCallbackFunc(argv[1]); + } + + node->setAnimationCompletedCallback(tmpCobj, callfunc_selector(JSCCBAnimationWrapper::animationCompleteCallback)); + + JS_SetReservedSlot(proxy->obj, 0, argv[0]); + JS_SetReservedSlot(proxy->obj, 1, argv[1]); + return JS_TRUE; + } + return JS_FALSE; +} + + JSBool js_cocos2dx_CCBReader_readNodeGraphFromFile(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); @@ -255,7 +283,7 @@ JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp) } extern JSObject* js_cocos2dx_CCBReader_prototype; - +extern JSObject* js_cocos2dx_CCBAnimationManager_prototype; void register_CCBuilderReader(JSContext *cx, JSObject *obj) { jsval nsval; @@ -275,5 +303,6 @@ void register_CCBuilderReader(JSContext *cx, JSObject *obj) { JS_DefineFunction(cx, tmpObj, "loadScene", js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, js_cocos2dx_CCBAnimationManager_prototype, "setCompletedAnimationCallback", js_cocos2dx_CCBAnimationManager_animationCompleteCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT); } diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index bd1a856a37..a5e3149923 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -91,7 +91,8 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid CCLayerMultiplex::[*], CCCatmullRom.*::[create actionWithDuration], CCBezier.*::[create actionWithDuration], - CCBReader::[^CCBReader$ addOwnerCallbackName isJSControlled readByte getCCBMemberVariableAssigner readFloat getCCBSelectorResolver toLowerCase lastPathComponent deletePathExtension endsWith concat getResolutionScale getAnimatedProperties readBool readInt addOwnerCallbackNode addDocumentCallbackName readCachedString readNodeGraphFromData addDocumentCallbackNode getLoadedSpriteSheet initWithData readFileWithCleanUp getOwner$ readNodeGraphFromFile createSceneWithNodeGraphFromFile], + CCBReader::[^CCBReader$ addOwnerCallbackName isJSControlled readByte getCCBMemberVariableAssigner readFloat getCCBSelectorResolver toLowerCase lastPathComponent deletePathExtension endsWith concat getResolutionScale getAnimatedProperties readBool readInt addOwnerCallbackNode addDocumentCallbackName readCachedString readNodeGraphFromData addDocumentCallbackNode getLoadedSpriteSheet initWithData readFileWithCleanUp getOwner$ readNodeGraphFromFile createSceneWithNodeGraphFromFile getAnimationManagers setAnimationManagers], + CCBAnimationManager::[setAnimationCompletedCallback], CCCardinalSpline.*::[create actionWithDuration setPoints], CCTextureCache::[addPVRTCImage], CC.*Loader$::[*], From d9fd274f164ad3b3a51466c7b9224cef96bc0d10 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 1 Nov 2012 15:18:24 +0800 Subject: [PATCH 72/95] Updated the project configuration of TestJavascript for win32 and android port. --- samples/TestJavascript/proj.android/.project | 7 ------- .../TestJavascript/proj.win32/TestJavascript.vcproj | 2 ++ .../TestJavascript/proj.win32/TestJavascript.vcxproj | 12 ++++++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/samples/TestJavascript/proj.android/.project b/samples/TestJavascript/proj.android/.project index d24f6ac4b8..e27974fd84 100644 --- a/samples/TestJavascript/proj.android/.project +++ b/samples/TestJavascript/proj.android/.project @@ -30,11 +30,4 @@ com.android.ide.eclipse.adt.AndroidNature org.eclipse.jdt.core.javanature - - - src_common - 2 - PARENT-3-PROJECT_LOC/cocos2dx/platform/android/java/src_common - - diff --git a/samples/TestJavascript/proj.win32/TestJavascript.vcproj b/samples/TestJavascript/proj.win32/TestJavascript.vcproj index 0dbe03f267..c797d19c11 100644 --- a/samples/TestJavascript/proj.win32/TestJavascript.vcproj +++ b/samples/TestJavascript/proj.win32/TestJavascript.vcproj @@ -114,6 +114,8 @@ > Windows MachineX86 + + if not exist "$(OutDir)" mkdir "$(OutDir)" +if exist "$(OutDir)\TestJavascriptRes" rd /s /q "$(OutDir)\TestJavascriptRes" +mkdir "$(OutDir)\TestJavascriptRes" +xcopy "$(ProjectDir)..\cocos2d-html5-tests\res" "$(OutDir)\TestJavascriptRes\res\" /e /Y +xcopy "$(ProjectDir)..\bindings\*.js" "$(OutDir)\TestJavascriptRes" /e /Y +dir "$(ProjectDir)..\cocos2d-html5-tests\src\*.js" /a /b /s > filelist.txt +for /f %%I in (filelist.txt) do (copy /Y %%I "$(OutDir)\TestJavascriptRes") +if exist filelist.txt del /f /q filelist.txt + + Copy js and resource files. + From b3c6f1a2e13095a47c58c8a55b732e4b6dd7cf63 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Wed, 31 Oct 2012 11:08:37 -0700 Subject: [PATCH 73/95] Adding bindings for CCBReader and other improvements. 1. Added additional CCBReader bindings, including callback support for animationCompleted 2. Improved design for JS CallbackWrappers 3. Added bindings for pDistance 4. Updating cocos2dx.ini --- .../javascript/bindings/ScriptingCore.cpp | 40 ++++---- .../javascript/bindings/cocos2d_specifics.cpp | 92 +++++++++++-------- .../javascript/bindings/cocos2d_specifics.hpp | 87 ++++++++++-------- 3 files changed, 127 insertions(+), 92 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index d2b19da945..5a294deefe 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -597,7 +597,7 @@ JSBool ScriptingCore::removeRootJS(JSContext *cx, uint32_t argc, jsval *vp) void ScriptingCore::pauseSchedulesAndActions(CCNode *node) { - CCArray * arr = JSSchedule::getTargetForNativeNode(node); + CCArray * arr = JSScheduleWrapper::getTargetForNativeNode(node); if(! arr) return; for(unsigned int i = 0; i < arr->count(); ++i) { if(arr->objectAtIndex(i)) { @@ -609,7 +609,7 @@ void ScriptingCore::pauseSchedulesAndActions(CCNode *node) { void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { - CCArray * arr = JSSchedule::getTargetForNativeNode(node); + CCArray * arr = JSScheduleWrapper::getTargetForNativeNode(node); if(!arr) return; for(unsigned int i = 0; i < arr->count(); ++i) { if(!arr->objectAtIndex(i)) continue; @@ -619,12 +619,12 @@ void ScriptingCore::resumeSchedulesAndActions(CCNode *node) { void ScriptingCore::cleanupSchedulesAndActions(CCNode *node) { - CCArray * arr = JSCallFunc::getTargetForNativeNode(node); + CCArray * arr = JSCallFuncWrapper::getTargetForNativeNode(node); if(arr) { arr->removeAllObjects(); } - arr = JSSchedule::getTargetForNativeNode(node); + arr = JSScheduleWrapper::getTargetForNativeNode(node); if(arr) { arr->removeAllObjects(); } @@ -1016,20 +1016,26 @@ CCArray* jsval_to_ccarray(JSContext* cx, jsval v) { jsval ccarray_to_jsval(JSContext* cx, CCArray *arr) { - - JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL); - - for(int i = 0; i < arr->count(); ++i) { - - CCObject *obj = arr->objectAtIndex(i); - js_proxy_t *proxy = js_get_or_create_proxy(cx, obj); - jsval arrElement = OBJECT_TO_JSVAL(proxy->obj); - - if(!JS_SetElement(cx, jsretArr, i, &arrElement)) { - break; + + JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL); + + for(int i = 0; i < arr->count(); ++i) { + jsval arrElement; + CCObject *obj = arr->objectAtIndex(i); + + CCString *testString = dynamic_cast(obj); + if(testString) { + arrElement = c_string_to_jsval(cx, testString->getCString()); + } else { + js_proxy_t *proxy = js_get_or_create_proxy(cx, obj); + arrElement = OBJECT_TO_JSVAL(proxy->obj); + } + + if(!JS_SetElement(cx, jsretArr, i, &arrElement)) { + break; + } } - } - return OBJECT_TO_JSVAL(jsretArr); + return OBJECT_TO_JSVAL(jsretArr); } jsval long_long_to_jsval(JSContext* cx, long long v) { diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index a06aa71f2a..e6d2f784fe 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -545,19 +545,19 @@ JSBool js_platform(JSContext *cx, uint32_t argc, jsval *vp) } -void JSCallFunc::setJSCallbackFunc(jsval func) { +void JSCallbackWrapper::setJSCallbackFunc(jsval func) { jsCallback = func; } -void JSCallFunc::setJSCallbackThis(jsval thisObj) { +void JSCallbackWrapper::setJSCallbackThis(jsval thisObj) { jsThisObj = thisObj; } -void JSCallFunc::setExtraDataField(jsval data) { +void JSCallbackWrapper::setJSExtraData(jsval data) { extraData = data; } -void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { +void JSCallFuncWrapper::setTargetForNativeNode(CCNode *pNode, JSCallFuncWrapper *target) { callfuncTarget_proxy_t *t; HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); @@ -577,7 +577,7 @@ void JSCallFunc::setTargetForNativeNode(CCNode *pNode, JSCallFunc *target) { HASH_ADD_PTR(_callfuncTarget_native_ht, ptr, p); } -CCArray * JSCallFunc::getTargetForNativeNode(CCNode *pNode) { +CCArray * JSCallFuncWrapper::getTargetForNativeNode(CCNode *pNode) { schedTarget_proxy_t *t; HASH_FIND_PTR(_callfuncTarget_native_ht, &pNode, t); @@ -596,18 +596,18 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) if (argc >= 1) { jsval *argv = JS_ARGV(cx, vp); - JSCallFunc *tmpCobj = new JSCallFunc(); + JSCallFuncWrapper *tmpCobj = new JSCallFuncWrapper(); tmpCobj->autorelease(); tmpCobj->setJSCallbackThis(argv[0]); if(argc >= 2) { tmpCobj->setJSCallbackFunc(argv[1]); } if(argc == 3) { - tmpCobj->setExtraDataField(argv[2]); + tmpCobj->setJSExtraData(argv[2]); } CCCallFunc *ret = (CCCallFunc *)CCCallFuncN::create((CCObject *)tmpCobj, - callfuncN_selector(JSCallFunc::callbackFunc)); + callfuncN_selector(JSCallFuncWrapper::callbackFunc)); js_proxy_t *proxy = js_get_or_create_proxy(cx, ret); JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(proxy->obj)); @@ -624,7 +624,8 @@ JSBool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp) } -void JSSchedule::setTargetForSchedule(jsval sched, JSSchedule *target) { + +void JSScheduleWrapper::setTargetForSchedule(jsval sched, JSScheduleWrapper *target) { do { schedFunc_proxy_t *p = (schedFunc_proxy_t *)malloc(sizeof(schedFunc_proxy_t)); assert(p); @@ -634,7 +635,7 @@ void JSSchedule::setTargetForSchedule(jsval sched, JSSchedule *target) { } while(0); } -JSSchedule * JSSchedule::getTargetForSchedule(jsval sched) { +JSScheduleWrapper * JSScheduleWrapper::getTargetForSchedule(jsval sched) { schedFunc_proxy_t *t; JSObject *o = JSVAL_TO_OBJECT(sched); HASH_FIND_PTR(_schedFunc_target_ht, &o, t); @@ -642,7 +643,7 @@ JSSchedule * JSSchedule::getTargetForSchedule(jsval sched) { } -void JSSchedule::setTargetForNativeNode(CCNode *pNode, JSSchedule *target) { +void JSScheduleWrapper::setTargetForNativeNode(CCNode *pNode, JSScheduleWrapper *target) { schedTarget_proxy_t *t; HASH_FIND_PTR(_schedTarget_native_ht, &pNode, t); @@ -662,7 +663,7 @@ void JSSchedule::setTargetForNativeNode(CCNode *pNode, JSSchedule *target) { HASH_ADD_PTR(_schedTarget_native_ht, ptr, p); } -CCArray * JSSchedule::getTargetForNativeNode(CCNode *pNode) { +CCArray * JSScheduleWrapper::getTargetForNativeNode(CCNode *pNode) { schedTarget_proxy_t *t; HASH_FIND_PTR(_schedTarget_native_ht, &pNode, t); @@ -673,15 +674,6 @@ CCArray * JSSchedule::getTargetForNativeNode(CCNode *pNode) { } -void JSSchedule::setJSScheduleFunc(jsval func) { - jsSchedule = func; -} - -void JSSchedule::setJSScheduleThis(jsval thisObj) { - jsThisObj = thisObj; -} - - JSBool js_CCNode_unschedule(JSContext *cx, uint32_t argc, jsval *vp) { @@ -698,9 +690,9 @@ JSBool js_CCNode_unschedule(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); - JSSchedule *tmpCobj = JSSchedule::getTargetForSchedule(argv[0]); + JSScheduleWrapper *tmpCobj = JSScheduleWrapper::getTargetForSchedule(argv[0]); - sched->unscheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj); + sched->unscheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj); JS_SET_RVAL(cx, vp, JSVAL_VOID); } @@ -722,7 +714,7 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); - JSSchedule *tmpCobj = new JSSchedule(); + JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); // @@ -734,16 +726,16 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } - tmpCobj->setJSScheduleThis(OBJECT_TO_JSVAL(obj)); - tmpCobj->setJSScheduleFunc(argv[0]); + tmpCobj->setJSCallbackThis(OBJECT_TO_JSVAL(obj)); + tmpCobj->setJSCallbackFunc(argv[0]); - JSSchedule::setTargetForSchedule(argv[0], tmpCobj); - JSSchedule::setTargetForNativeNode(node, tmpCobj); + JSScheduleWrapper::setTargetForSchedule(argv[0], tmpCobj); + JSScheduleWrapper::setTargetForNativeNode(node, tmpCobj); if(argc == 1) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), 0, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), 0, 0); } else { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, interval, node->isRunning(), 0, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, interval, node->isRunning(), 0, 0); } JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -770,7 +762,7 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); js_proxy_t *p = js_get_or_create_proxy(cx, sched); - JSSchedule *tmpCobj = new JSSchedule(); + JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); double interval; if( argc >= 2 ) { @@ -796,20 +788,20 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } - tmpCobj->setJSScheduleThis(OBJECT_TO_JSVAL(obj)); - tmpCobj->setJSScheduleFunc(argv[0]); + tmpCobj->setJSCallbackThis(OBJECT_TO_JSVAL(obj)); + tmpCobj->setJSCallbackFunc(argv[0]); - JSSchedule::setTargetForSchedule(argv[0], tmpCobj); - JSSchedule::setTargetForNativeNode(node, tmpCobj); + JSScheduleWrapper::setTargetForSchedule(argv[0], tmpCobj); + JSScheduleWrapper::setTargetForNativeNode(node, tmpCobj); if(argc == 1) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning()); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning()); } if(argc == 2) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, interval, node->isRunning()); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, interval, node->isRunning()); } if(argc == 3) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, 0); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, 0); } if (argc == 4) { - sched->scheduleSelector(schedule_selector(JSSchedule::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, delay); + sched->scheduleSelector(schedule_selector(JSScheduleWrapper::scheduleFunc), tmpCobj, 0, node->isRunning(), repeat, delay); } @@ -1143,6 +1135,27 @@ JSBool js_cocos2dx_ccpAdd(JSContext *cx, uint32_t argc, jsval *vp) return JS_FALSE; } +JSBool js_cocos2dx_ccpDistance(JSContext *cx, uint32_t argc, jsval *vp) +{ + jsval *argv = JS_ARGV(cx, vp); + + if (argc == 2) { + cocos2d::CCPoint arg0; + arg0 = jsval_to_ccpoint(cx, argv[0]); + cocos2d::CCPoint arg1; + arg1 = jsval_to_ccpoint(cx, argv[1]); + + float ret = ccpDistance(arg0, arg1); + + jsval jsret = DOUBLE_TO_JSVAL(ret); + JS_SET_RVAL(cx, vp, jsret); + return JS_TRUE; + } + + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); + return JS_FALSE; +} + JSBool js_cocos2dx_ccpClamp(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); @@ -1596,6 +1609,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, tmpObj, "garbageCollect", js_forceGC, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pAdd", js_cocos2dx_ccpAdd, 1, JSPROP_READONLY | JSPROP_PERMANENT); + JS_DefineFunction(cx, ns, "pDistance", js_cocos2dx_ccpDistance, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pSub", js_cocos2dx_ccpSub, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pNeg", js_cocos2dx_ccpNeg, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, ns, "pMult", js_cocos2dx_ccpMult, 0, JSPROP_READONLY | JSPROP_PERMANENT); diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index c8c6b8c13b..25f3d541f6 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -4,11 +4,11 @@ #include "jsapi.h" #include "ScriptingCore.h" -class JSSchedule; +class JSScheduleWrapper; typedef struct jsScheduleFunc_proxy { void * ptr; - JSSchedule *obj; + JSScheduleWrapper *obj; UT_hash_handle hh; } schedFunc_proxy_t; @@ -79,19 +79,48 @@ inline js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj) { jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string); void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj); -class JSCallFunc: public CCObject { + +class JSCallbackWrapper: public CCObject { public: - JSCallFunc(jsval func): jsCallback(func) {} - JSCallFunc() {extraData = JSVAL_VOID;} - virtual ~JSCallFunc() { - return; - } - + JSCallbackWrapper() {} + virtual ~JSCallbackWrapper(void) {} void setJSCallbackFunc(jsval obj); void setJSCallbackThis(jsval thisObj); - void setExtraDataField(jsval data); - static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data); - static void setTargetForNativeNode(CCNode *pNode, JSCallFunc *target); + void setJSExtraData(jsval data); + +protected: + jsval jsCallback; + jsval jsThisObj; + jsval extraData; +}; + + +class JSCCBAnimationWrapper: public JSCallbackWrapper { +public: + JSCCBAnimationWrapper() {} + virtual ~JSCCBAnimationWrapper() {} + + void animationCompleteCallback() const { + + JSContext *cx = ScriptingCore::getInstance()->getGlobalContext(); + jsval retval = JSVAL_NULL; + + if(!JSVAL_IS_VOID(jsCallback) && !JSVAL_IS_VOID(jsThisObj)) { + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 0, NULL, &retval); + } + } + +}; + + +class JSCallFuncWrapper: public JSCallbackWrapper { +public: + JSCallFuncWrapper() {} + virtual ~JSCallFuncWrapper(void) { + return; + } + + static void setTargetForNativeNode(CCNode *pNode, JSCallFuncWrapper *target); static CCArray * getTargetForNativeNode(CCNode *pNode); void callbackFunc(CCNode *node) const { @@ -115,35 +144,28 @@ public: JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 2, valArr, &retval); } - JSCallFunc::setTargetForNativeNode(node, (JSCallFunc *)this); + JSCallFuncWrapper::setTargetForNativeNode(node, (JSCallFuncWrapper *)this); JS_RemoveValueRoot(cx, valArr); } -private: - jsval jsCallback; - jsval jsThisObj; - jsval extraData; + }; -class JSSchedule: public CCObject { +class JSScheduleWrapper: public JSCallbackWrapper { public: - JSSchedule(jsval func): jsSchedule(func) {} - JSSchedule() {jsSchedule = JSVAL_VOID; jsThisObj = JSVAL_VOID;} - virtual ~JSSchedule() { + JSScheduleWrapper() {} + virtual ~JSScheduleWrapper() { return; } - static void setTargetForSchedule(jsval sched, JSSchedule *target); - static JSSchedule * getTargetForSchedule(jsval sched); - static void setTargetForNativeNode(CCNode *pNode, JSSchedule *target); + static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target); + static JSScheduleWrapper * getTargetForSchedule(jsval sched); + static void setTargetForNativeNode(CCNode *pNode, JSScheduleWrapper *target); static CCArray * getTargetForNativeNode(CCNode *pNode); - void setJSScheduleFunc(jsval obj); - void setJSScheduleThis(jsval thisObj); - void pause(); void scheduleFunc(float dt) const { @@ -156,20 +178,13 @@ public: return; } - if(!JSVAL_IS_VOID(jsSchedule) && !JSVAL_IS_VOID(jsThisObj)) { - ScriptingCore::dumpRoot(cx, 0, NULL); - JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsSchedule, 1, &data, &retval); + if(!JSVAL_IS_VOID(jsCallback) && !JSVAL_IS_VOID(jsThisObj)) { + JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(jsThisObj), jsCallback, 1, &data, &retval); } JS_RemoveValueRoot(cx, &data); } - -private: - - jsval jsSchedule; - jsval jsThisObj; - }; From 95d3f87bd78df11cd3973bed6f42b908cbf40287 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 1 Nov 2012 15:38:48 +0800 Subject: [PATCH 74/95] fix compiling error on linux 64 bit --- .../third_party/linux/include64/curl/curl.h | 2231 +++++++++++++++++ .../linux/include64/curl/curlbuild.h | 191 ++ .../linux/include64/curl/curlrules.h | 261 ++ .../linux/include64/curl/curlver.h | 69 + .../third_party/linux/include64/curl/easy.h | 102 + .../linux/include64/curl/mprintf.h | 81 + .../third_party/linux/include64/curl/multi.h | 345 +++ .../linux/include64/curl/stdcheaders.h | 33 + cocos2dx/proj.linux/Makefile | 11 +- samples/HelloCpp/proj.linux/main.cpp | 6 +- samples/TestCpp/proj.linux/Makefile | 12 +- 11 files changed, 3328 insertions(+), 14 deletions(-) create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/curl.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/curlbuild.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/curlrules.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/curlver.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/easy.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/mprintf.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/multi.h create mode 100644 cocos2dx/platform/third_party/linux/include64/curl/stdcheaders.h diff --git a/cocos2dx/platform/third_party/linux/include64/curl/curl.h b/cocos2dx/platform/third_party/linux/include64/curl/curl.h new file mode 100644 index 0000000000..2cad28298e --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/curl.h @@ -0,0 +1,2231 @@ +#ifndef __CURL_CURL_H +#define __CURL_CURL_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* + * If you have libcurl problems, all docs and details are found here: + * http://curl.haxx.se/libcurl/ + * + * curl-library mailing list subscription and unsubscription web interface: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + */ + +#include "curlver.h" /* libcurl version defines */ +#include "curlbuild.h" /* libcurl build definitions */ +#include "curlrules.h" /* libcurl rules enforcement */ + +/* + * Define WIN32 when build target is Win32 API + */ + +#if (defined(_WIN32) || defined(__WIN32__)) && \ + !defined(WIN32) && !defined(__SYMBIAN32__) +#define WIN32 +#endif + +#include +#include + +#if defined(__FreeBSD__) && (__FreeBSD__ >= 2) +/* Needed for __FreeBSD_version symbol definition */ +#include +#endif + +/* The include stuff here below is mainly for time_t! */ +#include +#include + +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__)) +/* The check above prevents the winsock2 inclusion if winsock.h already was + included, since they can't co-exist without problems */ +#include +#include +#endif +#endif + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on systems that are known to + require it! */ +#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ + defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ + defined(ANDROID) || defined(__ANDROID__) || \ + (defined(__FreeBSD_version) && (__FreeBSD_version < 800000)) +#include +#endif + +#if !defined(WIN32) && !defined(_WIN32_WCE) +#include +#endif + +#if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__) +#include +#endif + +#ifdef __BEOS__ +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURL; + +/* + * Decorate exportable functions for Win32 and Symbian OS DLL linking. + * This avoids using a .def file for building libcurl.dll. + */ +#if (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) && \ + !defined(CURL_STATICLIB) +#if defined(BUILDING_LIBCURL) +#define CURL_EXTERN __declspec(dllexport) +#else +#define CURL_EXTERN __declspec(dllimport) +#endif +#else + +#ifdef CURL_HIDDEN_SYMBOLS +/* + * This definition is used to make external definitions visible in the + * shared library when symbols are hidden by default. It makes no + * difference when compiling applications whether this is set or not, + * only when compiling the library. + */ +#define CURL_EXTERN CURL_EXTERN_SYMBOL +#else +#define CURL_EXTERN +#endif +#endif + +#ifndef curl_socket_typedef +/* socket typedef */ +#if defined(WIN32) && !defined(__LWIP_OPT_H__) +typedef SOCKET curl_socket_t; +#define CURL_SOCKET_BAD INVALID_SOCKET +#else +typedef int curl_socket_t; +#define CURL_SOCKET_BAD -1 +#endif +#define curl_socket_typedef +#endif /* curl_socket_typedef */ + +struct curl_httppost { + struct curl_httppost *next; /* next entry in the list */ + char *name; /* pointer to allocated name */ + long namelength; /* length of name length */ + char *contents; /* pointer to allocated data contents */ + long contentslength; /* length of contents field */ + char *buffer; /* pointer to allocated buffer contents */ + long bufferlength; /* length of buffer field */ + char *contenttype; /* Content-Type */ + struct curl_slist* contentheader; /* list of extra headers for this form */ + struct curl_httppost *more; /* if one field name has more than one + file, this link should link to following + files */ + long flags; /* as defined below */ +#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ +#define HTTPPOST_READFILE (1<<1) /* specified content is a file name */ +#define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer + do not free in formfree */ +#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer + do not free in formfree */ +#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */ +#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */ +#define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the + regular read callback to get the data + and pass the given pointer as custom + pointer */ + + char *showfilename; /* The file name to show. If not set, the + actual file name will be used (if this + is a file part) */ + void *userp; /* custom pointer used for + HTTPPOST_CALLBACK posts */ +}; + +typedef int (*curl_progress_callback)(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow); + +#ifndef CURL_MAX_WRITE_SIZE + /* Tests have proven that 20K is a very bad buffer size for uploads on + Windows, while 16K for some odd reason performed a lot better. + We do the ifndef check to allow this value to easier be changed at build + time for those who feel adventurous. The practical minimum is about + 400 bytes since libcurl uses a buffer of this size as a scratch area + (unrelated to network send operations). */ +#define CURL_MAX_WRITE_SIZE 16384 +#endif + +#ifndef CURL_MAX_HTTP_HEADER +/* The only reason to have a max limit for this is to avoid the risk of a bad + server feeding libcurl with a never-ending header that will cause reallocs + infinitely */ +#define CURL_MAX_HTTP_HEADER (100*1024) +#endif + +/* This is a magic return code for the write callback that, when returned, + will signal libcurl to pause receiving on the current transfer. */ +#define CURL_WRITEFUNC_PAUSE 0x10000001 + +typedef size_t (*curl_write_callback)(char *buffer, + size_t size, + size_t nitems, + void *outstream); + + + +/* enumeration of file types */ +typedef enum { + CURLFILETYPE_FILE = 0, + CURLFILETYPE_DIRECTORY, + CURLFILETYPE_SYMLINK, + CURLFILETYPE_DEVICE_BLOCK, + CURLFILETYPE_DEVICE_CHAR, + CURLFILETYPE_NAMEDPIPE, + CURLFILETYPE_SOCKET, + CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */ + + CURLFILETYPE_UNKNOWN /* should never occur */ +} curlfiletype; + +#define CURLFINFOFLAG_KNOWN_FILENAME (1<<0) +#define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1) +#define CURLFINFOFLAG_KNOWN_TIME (1<<2) +#define CURLFINFOFLAG_KNOWN_PERM (1<<3) +#define CURLFINFOFLAG_KNOWN_UID (1<<4) +#define CURLFINFOFLAG_KNOWN_GID (1<<5) +#define CURLFINFOFLAG_KNOWN_SIZE (1<<6) +#define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7) + +/* Content of this structure depends on information which is known and is + achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man + page for callbacks returning this structure -- some fields are mandatory, + some others are optional. The FLAG field has special meaning. */ +struct curl_fileinfo { + char *filename; + curlfiletype filetype; + time_t time; + unsigned int perm; + int uid; + int gid; + curl_off_t size; + long int hardlinks; + + struct { + /* If some of these fields is not NULL, it is a pointer to b_data. */ + char *time; + char *perm; + char *user; + char *group; + char *target; /* pointer to the target filename of a symlink */ + } strings; + + unsigned int flags; + + /* used internally */ + char * b_data; + size_t b_size; + size_t b_used; +}; + +/* return codes for CURLOPT_CHUNK_BGN_FUNCTION */ +#define CURL_CHUNK_BGN_FUNC_OK 0 +#define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */ +#define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */ + +/* if splitting of data transfer is enabled, this callback is called before + download of an individual chunk started. Note that parameter "remains" works + only for FTP wildcard downloading (for now), otherwise is not used */ +typedef long (*curl_chunk_bgn_callback)(const void *transfer_info, + void *ptr, + int remains); + +/* return codes for CURLOPT_CHUNK_END_FUNCTION */ +#define CURL_CHUNK_END_FUNC_OK 0 +#define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */ + +/* If splitting of data transfer is enabled this callback is called after + download of an individual chunk finished. + Note! After this callback was set then it have to be called FOR ALL chunks. + Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. + This is the reason why we don't need "transfer_info" parameter in this + callback and we are not interested in "remains" parameter too. */ +typedef long (*curl_chunk_end_callback)(void *ptr); + +/* return codes for FNMATCHFUNCTION */ +#define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */ +#define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */ +#define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */ + +/* callback type for wildcard downloading pattern matching. If the + string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ +typedef int (*curl_fnmatch_callback)(void *ptr, + const char *pattern, + const char *string); + +/* These are the return codes for the seek callbacks */ +#define CURL_SEEKFUNC_OK 0 +#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ +#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so + libcurl might try other means instead */ +typedef int (*curl_seek_callback)(void *instream, + curl_off_t offset, + int origin); /* 'whence' */ + +/* This is a return code for the read callback that, when returned, will + signal libcurl to immediately abort the current transfer. */ +#define CURL_READFUNC_ABORT 0x10000000 +/* This is a return code for the read callback that, when returned, will + signal libcurl to pause sending data on the current transfer. */ +#define CURL_READFUNC_PAUSE 0x10000001 + +typedef size_t (*curl_read_callback)(char *buffer, + size_t size, + size_t nitems, + void *instream); + +typedef enum { + CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ + CURLSOCKTYPE_LAST /* never use */ +} curlsocktype; + +/* The return code from the sockopt_callback can signal information back + to libcurl: */ +#define CURL_SOCKOPT_OK 0 +#define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return + CURLE_ABORTED_BY_CALLBACK */ +#define CURL_SOCKOPT_ALREADY_CONNECTED 2 + +typedef int (*curl_sockopt_callback)(void *clientp, + curl_socket_t curlfd, + curlsocktype purpose); + +struct curl_sockaddr { + int family; + int socktype; + int protocol; + unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it + turned really ugly and painful on the systems that + lack this type */ + struct sockaddr addr; +}; + +typedef curl_socket_t +(*curl_opensocket_callback)(void *clientp, + curlsocktype purpose, + struct curl_sockaddr *address); + +typedef int +(*curl_closesocket_callback)(void *clientp, curl_socket_t item); + +typedef enum { + CURLIOE_OK, /* I/O operation successful */ + CURLIOE_UNKNOWNCMD, /* command was unknown to callback */ + CURLIOE_FAILRESTART, /* failed to restart the read */ + CURLIOE_LAST /* never use */ +} curlioerr; + +typedef enum { + CURLIOCMD_NOP, /* no operation */ + CURLIOCMD_RESTARTREAD, /* restart the read stream from start */ + CURLIOCMD_LAST /* never use */ +} curliocmd; + +typedef curlioerr (*curl_ioctl_callback)(CURL *handle, + int cmd, + void *clientp); + +/* + * The following typedef's are signatures of malloc, free, realloc, strdup and + * calloc respectively. Function pointers of these types can be passed to the + * curl_global_init_mem() function to set user defined memory management + * callback routines. + */ +typedef void *(*curl_malloc_callback)(size_t size); +typedef void (*curl_free_callback)(void *ptr); +typedef void *(*curl_realloc_callback)(void *ptr, size_t size); +typedef char *(*curl_strdup_callback)(const char *str); +typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size); + +/* the kind of data that is passed to information_callback*/ +typedef enum { + CURLINFO_TEXT = 0, + CURLINFO_HEADER_IN, /* 1 */ + CURLINFO_HEADER_OUT, /* 2 */ + CURLINFO_DATA_IN, /* 3 */ + CURLINFO_DATA_OUT, /* 4 */ + CURLINFO_SSL_DATA_IN, /* 5 */ + CURLINFO_SSL_DATA_OUT, /* 6 */ + CURLINFO_END +} curl_infotype; + +typedef int (*curl_debug_callback) + (CURL *handle, /* the handle/transfer this concerns */ + curl_infotype type, /* what kind of data */ + char *data, /* points to the data */ + size_t size, /* size of the data pointed to */ + void *userptr); /* whatever the user please */ + +/* All possible error codes from all sorts of curl functions. Future versions + may return other values, stay prepared. + + Always add new return codes last. Never *EVER* remove any. The return + codes must remain the same! + */ + +typedef enum { + CURLE_OK = 0, + CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ + CURLE_FAILED_INIT, /* 2 */ + CURLE_URL_MALFORMAT, /* 3 */ + CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for + 7.17.0, reused in April 2011 for 7.21.5] */ + CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ + CURLE_COULDNT_RESOLVE_HOST, /* 6 */ + CURLE_COULDNT_CONNECT, /* 7 */ + CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */ + CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server + due to lack of access - when login fails + this is not returned. */ + CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for + 7.15.4, reused in Dec 2011 for 7.24.0]*/ + CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */ + CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server + [was obsoleted in August 2007 for 7.17.0, + reused in Dec 2011 for 7.24.0]*/ + CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */ + CURLE_FTP_WEIRD_227_FORMAT, /* 14 */ + CURLE_FTP_CANT_GET_HOST, /* 15 */ + CURLE_OBSOLETE16, /* 16 - NOT USED */ + CURLE_FTP_COULDNT_SET_TYPE, /* 17 */ + CURLE_PARTIAL_FILE, /* 18 */ + CURLE_FTP_COULDNT_RETR_FILE, /* 19 */ + CURLE_OBSOLETE20, /* 20 - NOT USED */ + CURLE_QUOTE_ERROR, /* 21 - quote command failure */ + CURLE_HTTP_RETURNED_ERROR, /* 22 */ + CURLE_WRITE_ERROR, /* 23 */ + CURLE_OBSOLETE24, /* 24 - NOT USED */ + CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */ + CURLE_READ_ERROR, /* 26 - couldn't open/read from file */ + CURLE_OUT_OF_MEMORY, /* 27 */ + /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error + instead of a memory allocation error if CURL_DOES_CONVERSIONS + is defined + */ + CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */ + CURLE_OBSOLETE29, /* 29 - NOT USED */ + CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */ + CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */ + CURLE_OBSOLETE32, /* 32 - NOT USED */ + CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */ + CURLE_HTTP_POST_ERROR, /* 34 */ + CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */ + CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */ + CURLE_FILE_COULDNT_READ_FILE, /* 37 */ + CURLE_LDAP_CANNOT_BIND, /* 38 */ + CURLE_LDAP_SEARCH_FAILED, /* 39 */ + CURLE_OBSOLETE40, /* 40 - NOT USED */ + CURLE_FUNCTION_NOT_FOUND, /* 41 */ + CURLE_ABORTED_BY_CALLBACK, /* 42 */ + CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */ + CURLE_OBSOLETE44, /* 44 - NOT USED */ + CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */ + CURLE_OBSOLETE46, /* 46 - NOT USED */ + CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */ + CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */ + CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */ + CURLE_OBSOLETE50, /* 50 - NOT USED */ + CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint + wasn't verified fine */ + CURLE_GOT_NOTHING, /* 52 - when this is a specific error */ + CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */ + CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as + default */ + CURLE_SEND_ERROR, /* 55 - failed sending network data */ + CURLE_RECV_ERROR, /* 56 - failure in receiving network data */ + CURLE_OBSOLETE57, /* 57 - NOT IN USE */ + CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ + CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ + CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ + CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */ + CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ + CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ + CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ + CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind + that failed */ + CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */ + CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not + accepted and we failed to login */ + CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */ + CURLE_TFTP_PERM, /* 69 - permission problem on server */ + CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */ + CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */ + CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */ + CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */ + CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */ + CURLE_CONV_FAILED, /* 75 - conversion failed */ + CURLE_CONV_REQD, /* 76 - caller must register conversion + callbacks using curl_easy_setopt options + CURLOPT_CONV_FROM_NETWORK_FUNCTION, + CURLOPT_CONV_TO_NETWORK_FUNCTION, and + CURLOPT_CONV_FROM_UTF8_FUNCTION */ + CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing + or wrong format */ + CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */ + CURLE_SSH, /* 79 - error from the SSH layer, somewhat + generic so the error message will be of + interest when this has happened */ + + CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL + connection */ + CURLE_AGAIN, /* 81 - socket is not ready for send/recv, + wait till it's ready and try again (Added + in 7.18.2) */ + CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or + wrong format (Added in 7.19.0) */ + CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in + 7.19.0) */ + CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */ + CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */ + CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */ + CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */ + CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */ + CURL_LAST /* never use! */ +} CURLcode; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Previously obsoletes error codes re-used in 7.24.0 */ +#define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED +#define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT + +/* compatibility with older names */ +#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING + +/* The following were added in 7.21.5, April 2011 */ +#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION + +/* The following were added in 7.17.1 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION + +/* The following were added in 7.17.0 */ +/* These are scheduled to disappear by 2009 */ +#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */ +#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 +#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 +#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 +#define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16 +#define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32 +#define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29 +#define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12 +#define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20 +#define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40 +#define CURLE_MALFORMAT_USER CURLE_OBSOLETE24 +#define CURLE_SHARE_IN_USE CURLE_OBSOLETE57 +#define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN + +#define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED +#define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE +#define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR +#define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL +#define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS +#define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR +#define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED + +/* The following were added earlier */ + +#define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT + +#define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR +#define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED +#define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED + +#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE +#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME + +/* This was the error code 50 in 7.7.3 and a few earlier versions, this + is no longer used by libcurl but is instead #defined here only to not + make programs break */ +#define CURLE_ALREADY_COMPLETE 99999 + +#endif /*!CURL_NO_OLDIES*/ + +/* This prototype applies to all conversion callbacks */ +typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length); + +typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */ + void *ssl_ctx, /* actually an + OpenSSL SSL_CTX */ + void *userptr); + +typedef enum { + CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use + CONNECT HTTP/1.1 */ + CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT + HTTP/1.0 */ + CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already + in 7.10 */ + CURLPROXY_SOCKS5 = 5, /* added in 7.10 */ + CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */ + CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the + host name rather than the IP address. added + in 7.18.0 */ +} curl_proxytype; /* this enum was added in 7.10 */ + +/* + * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options: + * + * CURLAUTH_NONE - No HTTP authentication + * CURLAUTH_BASIC - HTTP Basic authentication (default) + * CURLAUTH_DIGEST - HTTP Digest authentication + * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication + * CURLAUTH_NTLM - HTTP NTLM authentication + * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour + * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper + * CURLAUTH_ONLY - Use together with a single other type to force no + * authentication or just that single type + * CURLAUTH_ANY - All fine types set + * CURLAUTH_ANYSAFE - All fine types except Basic + */ + +#define CURLAUTH_NONE ((unsigned long)0) +#define CURLAUTH_BASIC (((unsigned long)1)<<0) +#define CURLAUTH_DIGEST (((unsigned long)1)<<1) +#define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2) +#define CURLAUTH_NTLM (((unsigned long)1)<<3) +#define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4) +#define CURLAUTH_NTLM_WB (((unsigned long)1)<<5) +#define CURLAUTH_ONLY (((unsigned long)1)<<31) +#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) +#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) + +#define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */ +#define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */ +#define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */ +#define CURLSSH_AUTH_PASSWORD (1<<1) /* password */ +#define CURLSSH_AUTH_HOST (1<<2) /* host key files */ +#define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */ +#define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY + +#define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */ +#define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */ +#define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */ + +#define CURL_ERROR_SIZE 256 + +struct curl_khkey { + const char *key; /* points to a zero-terminated string encoded with base64 + if len is zero, otherwise to the "raw" data */ + size_t len; + enum type { + CURLKHTYPE_UNKNOWN, + CURLKHTYPE_RSA1, + CURLKHTYPE_RSA, + CURLKHTYPE_DSS + } keytype; +}; + +/* this is the set of return values expected from the curl_sshkeycallback + callback */ +enum curl_khstat { + CURLKHSTAT_FINE_ADD_TO_FILE, + CURLKHSTAT_FINE, + CURLKHSTAT_REJECT, /* reject the connection, return an error */ + CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so + this causes a CURLE_DEFER error but otherwise the + connection will be left intact etc */ + CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */ +}; + +/* this is the set of status codes pass in to the callback */ +enum curl_khmatch { + CURLKHMATCH_OK, /* match */ + CURLKHMATCH_MISMATCH, /* host found, key mismatch! */ + CURLKHMATCH_MISSING, /* no matching host/key found */ + CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */ +}; + +typedef int + (*curl_sshkeycallback) (CURL *easy, /* easy handle */ + const struct curl_khkey *knownkey, /* known */ + const struct curl_khkey *foundkey, /* found */ + enum curl_khmatch, /* libcurl's view on the keys */ + void *clientp); /* custom pointer passed from app */ + +/* parameter for the CURLOPT_USE_SSL option */ +typedef enum { + CURLUSESSL_NONE, /* do not attempt to use SSL */ + CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */ + CURLUSESSL_CONTROL, /* SSL for the control connection or fail */ + CURLUSESSL_ALL, /* SSL for all communication or fail */ + CURLUSESSL_LAST /* not an option, never use */ +} curl_usessl; + +/* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */ + +/* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the + name of improving interoperability with older servers. Some SSL libraries + have introduced work-arounds for this flaw but those work-arounds sometimes + make the SSL communication fail. To regain functionality with those broken + servers, a user can this way allow the vulnerability back. */ +#define CURLSSLOPT_ALLOW_BEAST (1<<0) + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2009 */ + +#define CURLFTPSSL_NONE CURLUSESSL_NONE +#define CURLFTPSSL_TRY CURLUSESSL_TRY +#define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL +#define CURLFTPSSL_ALL CURLUSESSL_ALL +#define CURLFTPSSL_LAST CURLUSESSL_LAST +#define curl_ftpssl curl_usessl +#endif /*!CURL_NO_OLDIES*/ + +/* parameter for the CURLOPT_FTP_SSL_CCC option */ +typedef enum { + CURLFTPSSL_CCC_NONE, /* do not send CCC */ + CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */ + CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */ + CURLFTPSSL_CCC_LAST /* not an option, never use */ +} curl_ftpccc; + +/* parameter for the CURLOPT_FTPSSLAUTH option */ +typedef enum { + CURLFTPAUTH_DEFAULT, /* let libcurl decide */ + CURLFTPAUTH_SSL, /* use "AUTH SSL" */ + CURLFTPAUTH_TLS, /* use "AUTH TLS" */ + CURLFTPAUTH_LAST /* not an option, never use */ +} curl_ftpauth; + +/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ +typedef enum { + CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */ + CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD + again if MKD succeeded, for SFTP this does + similar magic */ + CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD + again even if MKD failed! */ + CURLFTP_CREATE_DIR_LAST /* not an option, never use */ +} curl_ftpcreatedir; + +/* parameter for the CURLOPT_FTP_FILEMETHOD option */ +typedef enum { + CURLFTPMETHOD_DEFAULT, /* let libcurl pick */ + CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */ + CURLFTPMETHOD_NOCWD, /* no CWD at all */ + CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */ + CURLFTPMETHOD_LAST /* not an option, never use */ +} curl_ftpmethod; + +/* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ +#define CURLPROTO_HTTP (1<<0) +#define CURLPROTO_HTTPS (1<<1) +#define CURLPROTO_FTP (1<<2) +#define CURLPROTO_FTPS (1<<3) +#define CURLPROTO_SCP (1<<4) +#define CURLPROTO_SFTP (1<<5) +#define CURLPROTO_TELNET (1<<6) +#define CURLPROTO_LDAP (1<<7) +#define CURLPROTO_LDAPS (1<<8) +#define CURLPROTO_DICT (1<<9) +#define CURLPROTO_FILE (1<<10) +#define CURLPROTO_TFTP (1<<11) +#define CURLPROTO_IMAP (1<<12) +#define CURLPROTO_IMAPS (1<<13) +#define CURLPROTO_POP3 (1<<14) +#define CURLPROTO_POP3S (1<<15) +#define CURLPROTO_SMTP (1<<16) +#define CURLPROTO_SMTPS (1<<17) +#define CURLPROTO_RTSP (1<<18) +#define CURLPROTO_RTMP (1<<19) +#define CURLPROTO_RTMPT (1<<20) +#define CURLPROTO_RTMPE (1<<21) +#define CURLPROTO_RTMPTE (1<<22) +#define CURLPROTO_RTMPS (1<<23) +#define CURLPROTO_RTMPTS (1<<24) +#define CURLPROTO_GOPHER (1<<25) +#define CURLPROTO_ALL (~0) /* enable everything */ + +/* long may be 32 or 64 bits, but we should never depend on anything else + but 32 */ +#define CURLOPTTYPE_LONG 0 +#define CURLOPTTYPE_OBJECTPOINT 10000 +#define CURLOPTTYPE_FUNCTIONPOINT 20000 +#define CURLOPTTYPE_OFF_T 30000 + +/* name is uppercase CURLOPT_, + type is one of the defined CURLOPTTYPE_ + number is unique identifier */ +#ifdef CINIT +#undef CINIT +#endif + +#ifdef CURL_ISOCPP +#define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLOPT_/**/name = type + number +#endif + +/* + * This macro-mania below setups the CURLOPT_[what] enum, to be used with + * curl_easy_setopt(). The first argument in the CINIT() macro is the [what] + * word. + */ + +typedef enum { + /* This is the FILE * or void * the regular output should be written to. */ + CINIT(FILE, OBJECTPOINT, 1), + + /* The full URL to get/put */ + CINIT(URL, OBJECTPOINT, 2), + + /* Port number to connect to, if other than default. */ + CINIT(PORT, LONG, 3), + + /* Name of proxy to use. */ + CINIT(PROXY, OBJECTPOINT, 4), + + /* "name:password" to use when fetching. */ + CINIT(USERPWD, OBJECTPOINT, 5), + + /* "name:password" to use with proxy. */ + CINIT(PROXYUSERPWD, OBJECTPOINT, 6), + + /* Range to get, specified as an ASCII string. */ + CINIT(RANGE, OBJECTPOINT, 7), + + /* not used */ + + /* Specified file stream to upload from (use as input): */ + CINIT(INFILE, OBJECTPOINT, 9), + + /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE + * bytes big. If this is not used, error messages go to stderr instead: */ + CINIT(ERRORBUFFER, OBJECTPOINT, 10), + + /* Function that will be called to store the output (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11), + + /* Function that will be called to read the input (instead of fread). The + * parameters will use fread() syntax, make sure to follow them. */ + CINIT(READFUNCTION, FUNCTIONPOINT, 12), + + /* Time-out the read operation after this amount of seconds */ + CINIT(TIMEOUT, LONG, 13), + + /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about + * how large the file being sent really is. That allows better error + * checking and better verifies that the upload was successful. -1 means + * unknown size. + * + * For large file support, there is also a _LARGE version of the key + * which takes an off_t type, allowing platforms with larger off_t + * sizes to handle larger files. See below for INFILESIZE_LARGE. + */ + CINIT(INFILESIZE, LONG, 14), + + /* POST static input fields. */ + CINIT(POSTFIELDS, OBJECTPOINT, 15), + + /* Set the referrer page (needed by some CGIs) */ + CINIT(REFERER, OBJECTPOINT, 16), + + /* Set the FTP PORT string (interface name, named or numerical IP address) + Use i.e '-' to use default address. */ + CINIT(FTPPORT, OBJECTPOINT, 17), + + /* Set the User-Agent string (examined by some CGIs) */ + CINIT(USERAGENT, OBJECTPOINT, 18), + + /* If the download receives less than "low speed limit" bytes/second + * during "low speed time" seconds, the operations is aborted. + * You could i.e if you have a pretty high speed connection, abort if + * it is less than 2000 bytes/sec during 20 seconds. + */ + + /* Set the "low speed limit" */ + CINIT(LOW_SPEED_LIMIT, LONG, 19), + + /* Set the "low speed time" */ + CINIT(LOW_SPEED_TIME, LONG, 20), + + /* Set the continuation offset. + * + * Note there is also a _LARGE version of this key which uses + * off_t types, allowing for large file offsets on platforms which + * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. + */ + CINIT(RESUME_FROM, LONG, 21), + + /* Set cookie in request: */ + CINIT(COOKIE, OBJECTPOINT, 22), + + /* This points to a linked list of headers, struct curl_slist kind */ + CINIT(HTTPHEADER, OBJECTPOINT, 23), + + /* This points to a linked list of post entries, struct curl_httppost */ + CINIT(HTTPPOST, OBJECTPOINT, 24), + + /* name of the file keeping your private SSL-certificate */ + CINIT(SSLCERT, OBJECTPOINT, 25), + + /* password for the SSL or SSH private key */ + CINIT(KEYPASSWD, OBJECTPOINT, 26), + + /* send TYPE parameter? */ + CINIT(CRLF, LONG, 27), + + /* send linked-list of QUOTE commands */ + CINIT(QUOTE, OBJECTPOINT, 28), + + /* send FILE * or void * to store headers to, if you use a callback it + is simply passed to the callback unmodified */ + CINIT(WRITEHEADER, OBJECTPOINT, 29), + + /* point to a file to read the initial cookies from, also enables + "cookie awareness" */ + CINIT(COOKIEFILE, OBJECTPOINT, 31), + + /* What version to specifically try to use. + See CURL_SSLVERSION defines below. */ + CINIT(SSLVERSION, LONG, 32), + + /* What kind of HTTP time condition to use, see defines */ + CINIT(TIMECONDITION, LONG, 33), + + /* Time to use with the above condition. Specified in number of seconds + since 1 Jan 1970 */ + CINIT(TIMEVALUE, LONG, 34), + + /* 35 = OBSOLETE */ + + /* Custom request, for customizing the get command like + HTTP: DELETE, TRACE and others + FTP: to use a different list command + */ + CINIT(CUSTOMREQUEST, OBJECTPOINT, 36), + + /* HTTP request, for odd commands like DELETE, TRACE and others */ + CINIT(STDERR, OBJECTPOINT, 37), + + /* 38 is not used */ + + /* send linked-list of post-transfer QUOTE commands */ + CINIT(POSTQUOTE, OBJECTPOINT, 39), + + CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */ + + CINIT(VERBOSE, LONG, 41), /* talk a lot */ + CINIT(HEADER, LONG, 42), /* throw the header out too */ + CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */ + CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */ + CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */ + CINIT(UPLOAD, LONG, 46), /* this is an upload */ + CINIT(POST, LONG, 47), /* HTTP POST method */ + CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */ + + CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */ + + /* Specify whether to read the user+password from the .netrc or the URL. + * This must be one of the CURL_NETRC_* enums below. */ + CINIT(NETRC, LONG, 51), + + CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ + + CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */ + CINIT(PUT, LONG, 54), /* HTTP PUT */ + + /* 55 = OBSOLETE */ + + /* Function that will be called instead of the internal progress display + * function. This function should be defined as the curl_progress_callback + * prototype defines. */ + CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56), + + /* Data passed to the progress callback */ + CINIT(PROGRESSDATA, OBJECTPOINT, 57), + + /* We want the referrer field set automatically when following locations */ + CINIT(AUTOREFERER, LONG, 58), + + /* Port of the proxy, can be set in the proxy string as well with: + "[host]:[port]" */ + CINIT(PROXYPORT, LONG, 59), + + /* size of the POST input data, if strlen() is not good to use */ + CINIT(POSTFIELDSIZE, LONG, 60), + + /* tunnel non-http operations through a HTTP proxy */ + CINIT(HTTPPROXYTUNNEL, LONG, 61), + + /* Set the interface string to use as outgoing network interface */ + CINIT(INTERFACE, OBJECTPOINT, 62), + + /* Set the krb4/5 security level, this also enables krb4/5 awareness. This + * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string + * is set but doesn't match one of these, 'private' will be used. */ + CINIT(KRBLEVEL, OBJECTPOINT, 63), + + /* Set if we should verify the peer in ssl handshake, set 1 to verify. */ + CINIT(SSL_VERIFYPEER, LONG, 64), + + /* The CApath or CAfile used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAINFO, OBJECTPOINT, 65), + + /* 66 = OBSOLETE */ + /* 67 = OBSOLETE */ + + /* Maximum number of http redirects to follow */ + CINIT(MAXREDIRS, LONG, 68), + + /* Pass a long set to 1 to get the date of the requested document (if + possible)! Pass a zero to shut it off. */ + CINIT(FILETIME, LONG, 69), + + /* This points to a linked list of telnet options */ + CINIT(TELNETOPTIONS, OBJECTPOINT, 70), + + /* Max amount of cached alive connections */ + CINIT(MAXCONNECTS, LONG, 71), + + CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */ + + /* 73 = OBSOLETE */ + + /* Set to explicitly use a new connection for the upcoming transfer. + Do not use this unless you're absolutely sure of this, as it makes the + operation slower and is less friendly for the network. */ + CINIT(FRESH_CONNECT, LONG, 74), + + /* Set to explicitly forbid the upcoming transfer's connection to be re-used + when done. Do not use this unless you're absolutely sure of this, as it + makes the operation slower and is less friendly for the network. */ + CINIT(FORBID_REUSE, LONG, 75), + + /* Set to a file name that contains random data for libcurl to use to + seed the random engine when doing SSL connects. */ + CINIT(RANDOM_FILE, OBJECTPOINT, 76), + + /* Set to the Entropy Gathering Daemon socket pathname */ + CINIT(EGDSOCKET, OBJECTPOINT, 77), + + /* Time-out connect operations after this amount of seconds, if connects + are OK within this time, then fine... This only aborts the connect + phase. [Only works on unix-style/SIGALRM operating systems] */ + CINIT(CONNECTTIMEOUT, LONG, 78), + + /* Function that will be called to store headers (instead of fwrite). The + * parameters will use fwrite() syntax, make sure to follow them. */ + CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79), + + /* Set this to force the HTTP request to get back to GET. Only really usable + if POST, PUT or a custom request have been used first. + */ + CINIT(HTTPGET, LONG, 80), + + /* Set if we should verify the Common name from the peer certificate in ssl + * handshake, set 1 to check existence, 2 to ensure that it matches the + * provided hostname. */ + CINIT(SSL_VERIFYHOST, LONG, 81), + + /* Specify which file name to write all known cookies in after completed + operation. Set file name to "-" (dash) to make it go to stdout. */ + CINIT(COOKIEJAR, OBJECTPOINT, 82), + + /* Specify which SSL ciphers to use */ + CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83), + + /* Specify which HTTP version to use! This must be set to one of the + CURL_HTTP_VERSION* enums set below. */ + CINIT(HTTP_VERSION, LONG, 84), + + /* Specifically switch on or off the FTP engine's use of the EPSV command. By + default, that one will always be attempted before the more traditional + PASV command. */ + CINIT(FTP_USE_EPSV, LONG, 85), + + /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ + CINIT(SSLCERTTYPE, OBJECTPOINT, 86), + + /* name of the file keeping your private SSL-key */ + CINIT(SSLKEY, OBJECTPOINT, 87), + + /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ + CINIT(SSLKEYTYPE, OBJECTPOINT, 88), + + /* crypto engine for the SSL-sub system */ + CINIT(SSLENGINE, OBJECTPOINT, 89), + + /* set the crypto engine for the SSL-sub system as default + the param has no meaning... + */ + CINIT(SSLENGINE_DEFAULT, LONG, 90), + + /* Non-zero value means to use the global dns cache */ + CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */ + + /* DNS cache timeout */ + CINIT(DNS_CACHE_TIMEOUT, LONG, 92), + + /* send linked-list of pre-transfer QUOTE commands */ + CINIT(PREQUOTE, OBJECTPOINT, 93), + + /* set the debug function */ + CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94), + + /* set the data for the debug function */ + CINIT(DEBUGDATA, OBJECTPOINT, 95), + + /* mark this as start of a cookie session */ + CINIT(COOKIESESSION, LONG, 96), + + /* The CApath directory used to validate the peer certificate + this option is used only if SSL_VERIFYPEER is true */ + CINIT(CAPATH, OBJECTPOINT, 97), + + /* Instruct libcurl to use a smaller receive buffer */ + CINIT(BUFFERSIZE, LONG, 98), + + /* Instruct libcurl to not use any signal/alarm handlers, even when using + timeouts. This option is useful for multi-threaded applications. + See libcurl-the-guide for more background information. */ + CINIT(NOSIGNAL, LONG, 99), + + /* Provide a CURLShare for mutexing non-ts data */ + CINIT(SHARE, OBJECTPOINT, 100), + + /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), + CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ + CINIT(PROXYTYPE, LONG, 101), + + /* Set the Accept-Encoding string. Use this to tell a server you would like + the response to be compressed. Before 7.21.6, this was known as + CURLOPT_ENCODING */ + CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102), + + /* Set pointer to private data */ + CINIT(PRIVATE, OBJECTPOINT, 103), + + /* Set aliases for HTTP 200 in the HTTP Response header */ + CINIT(HTTP200ALIASES, OBJECTPOINT, 104), + + /* Continue to send authentication (user+password) when following locations, + even when hostname changed. This can potentially send off the name + and password to whatever host the server decides. */ + CINIT(UNRESTRICTED_AUTH, LONG, 105), + + /* Specifically switch on or off the FTP engine's use of the EPRT command ( + it also disables the LPRT attempt). By default, those ones will always be + attempted before the good old traditional PORT command. */ + CINIT(FTP_USE_EPRT, LONG, 106), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_USERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(HTTPAUTH, LONG, 107), + + /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx + in second argument. The function must be matching the + curl_ssl_ctx_callback proto. */ + CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108), + + /* Set the userdata for the ssl context callback function's third + argument */ + CINIT(SSL_CTX_DATA, OBJECTPOINT, 109), + + /* FTP Option that causes missing dirs to be created on the remote server. + In 7.19.4 we introduced the convenience enums for this option using the + CURLFTP_CREATE_DIR prefix. + */ + CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110), + + /* Set this to a bitmask value to enable the particular authentications + methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. + Note that setting multiple bits may cause extra network round-trips. */ + CINIT(PROXYAUTH, LONG, 111), + + /* FTP option that changes the timeout, in seconds, associated with + getting a response. This is different from transfer timeout time and + essentially places a demand on the FTP server to acknowledge commands + in a timely manner. */ + CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112), +#define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT + + /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to + tell libcurl to resolve names to those IP versions only. This only has + affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ + CINIT(IPRESOLVE, LONG, 113), + + /* Set this option to limit the size of a file that will be downloaded from + an HTTP or FTP server. + + Note there is also _LARGE version which adds large file support for + platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ + CINIT(MAXFILESIZE, LONG, 114), + + /* See the comment for INFILESIZE above, but in short, specifies + * the size of the file being uploaded. -1 means unknown. + */ + CINIT(INFILESIZE_LARGE, OFF_T, 115), + + /* Sets the continuation offset. There is also a LONG version of this; + * look above for RESUME_FROM. + */ + CINIT(RESUME_FROM_LARGE, OFF_T, 116), + + /* Sets the maximum size of data that will be downloaded from + * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. + */ + CINIT(MAXFILESIZE_LARGE, OFF_T, 117), + + /* Set this option to the file name of your .netrc file you want libcurl + to parse (using the CURLOPT_NETRC option). If not set, libcurl will do + a poor attempt to find the user's home directory and check for a .netrc + file in there. */ + CINIT(NETRC_FILE, OBJECTPOINT, 118), + + /* Enable SSL/TLS for FTP, pick one of: + CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise + CURLFTPSSL_CONTROL - SSL for the control connection or fail + CURLFTPSSL_ALL - SSL for all communication or fail + */ + CINIT(USE_SSL, LONG, 119), + + /* The _LARGE version of the standard POSTFIELDSIZE option */ + CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120), + + /* Enable/disable the TCP Nagle algorithm */ + CINIT(TCP_NODELAY, LONG, 121), + + /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 123 OBSOLETE. Gone in 7.16.0 */ + /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ + /* 127 OBSOLETE. Gone in 7.16.0 */ + /* 128 OBSOLETE. Gone in 7.16.0 */ + + /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option + can be used to change libcurl's default action which is to first try + "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK + response has been received. + + Available parameters are: + CURLFTPAUTH_DEFAULT - let libcurl decide + CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS + CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL + */ + CINIT(FTPSSLAUTH, LONG, 129), + + CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130), + CINIT(IOCTLDATA, OBJECTPOINT, 131), + + /* 132 OBSOLETE. Gone in 7.16.0 */ + /* 133 OBSOLETE. Gone in 7.16.0 */ + + /* zero terminated string for pass on to the FTP server when asked for + "account" info */ + CINIT(FTP_ACCOUNT, OBJECTPOINT, 134), + + /* feed cookies into cookie engine */ + CINIT(COOKIELIST, OBJECTPOINT, 135), + + /* ignore Content-Length */ + CINIT(IGNORE_CONTENT_LENGTH, LONG, 136), + + /* Set to non-zero to skip the IP address received in a 227 PASV FTP server + response. Typically used for FTP-SSL purposes but is not restricted to + that. libcurl will then instead use the same IP address it used for the + control connection. */ + CINIT(FTP_SKIP_PASV_IP, LONG, 137), + + /* Select "file method" to use when doing FTP, see the curl_ftpmethod + above. */ + CINIT(FTP_FILEMETHOD, LONG, 138), + + /* Local port number to bind the socket to */ + CINIT(LOCALPORT, LONG, 139), + + /* Number of ports to try, including the first one set with LOCALPORT. + Thus, setting it to 1 will make no additional attempts but the first. + */ + CINIT(LOCALPORTRANGE, LONG, 140), + + /* no transfer, set up connection and let application use the socket by + extracting it with CURLINFO_LASTSOCKET */ + CINIT(CONNECT_ONLY, LONG, 141), + + /* Function that will be called to convert from the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142), + + /* Function that will be called to convert to the + network encoding (instead of using the iconv calls in libcurl) */ + CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143), + + /* Function that will be called to convert from UTF8 + (instead of using the iconv calls in libcurl) + Note that this is used only for SSL certificate processing */ + CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144), + + /* if the connection proceeds too quickly then need to slow it down */ + /* limit-rate: maximum number of bytes per second to send or receive */ + CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145), + CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146), + + /* Pointer to command string to send if USER/PASS fails. */ + CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), + + /* callback function for setting socket options */ + CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), + CINIT(SOCKOPTDATA, OBJECTPOINT, 149), + + /* set to 0 to disable session ID re-use for this transfer, default is + enabled (== 1) */ + CINIT(SSL_SESSIONID_CACHE, LONG, 150), + + /* allowed SSH authentication methods */ + CINIT(SSH_AUTH_TYPES, LONG, 151), + + /* Used by scp/sftp to do public/private key authentication */ + CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152), + CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153), + + /* Send CCC (Clear Command Channel) after authentication */ + CINIT(FTP_SSL_CCC, LONG, 154), + + /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ + CINIT(TIMEOUT_MS, LONG, 155), + CINIT(CONNECTTIMEOUT_MS, LONG, 156), + + /* set to zero to disable the libcurl's decoding and thus pass the raw body + data to the application even when it is encoded/compressed */ + CINIT(HTTP_TRANSFER_DECODING, LONG, 157), + CINIT(HTTP_CONTENT_DECODING, LONG, 158), + + /* Permission used when creating new files and directories on the remote + server for protocols that support it, SFTP/SCP/FILE */ + CINIT(NEW_FILE_PERMS, LONG, 159), + CINIT(NEW_DIRECTORY_PERMS, LONG, 160), + + /* Set the behaviour of POST when redirecting. Values must be set to one + of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ + CINIT(POSTREDIR, LONG, 161), + + /* used by scp/sftp to verify the host's public key */ + CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162), + + /* Callback function for opening socket (instead of socket(2)). Optionally, + callback is able change the address or refuse to connect returning + CURL_SOCKET_BAD. The callback should have type + curl_opensocket_callback */ + CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163), + CINIT(OPENSOCKETDATA, OBJECTPOINT, 164), + + /* POST volatile input fields. */ + CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165), + + /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ + CINIT(PROXY_TRANSFER_MODE, LONG, 166), + + /* Callback function for seeking in the input stream */ + CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167), + CINIT(SEEKDATA, OBJECTPOINT, 168), + + /* CRL file */ + CINIT(CRLFILE, OBJECTPOINT, 169), + + /* Issuer certificate */ + CINIT(ISSUERCERT, OBJECTPOINT, 170), + + /* (IPv6) Address scope */ + CINIT(ADDRESS_SCOPE, LONG, 171), + + /* Collect certificate chain info and allow it to get retrievable with + CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only + working with OpenSSL-powered builds. */ + CINIT(CERTINFO, LONG, 172), + + /* "name" and "pwd" to use when fetching. */ + CINIT(USERNAME, OBJECTPOINT, 173), + CINIT(PASSWORD, OBJECTPOINT, 174), + + /* "name" and "pwd" to use with Proxy when fetching. */ + CINIT(PROXYUSERNAME, OBJECTPOINT, 175), + CINIT(PROXYPASSWORD, OBJECTPOINT, 176), + + /* Comma separated list of hostnames defining no-proxy zones. These should + match both hostnames directly, and hostnames within a domain. For + example, local.com will match local.com and www.local.com, but NOT + notlocal.com or www.notlocal.com. For compatibility with other + implementations of this, .local.com will be considered to be the same as + local.com. A single * is the only valid wildcard, and effectively + disables the use of proxy. */ + CINIT(NOPROXY, OBJECTPOINT, 177), + + /* block size for TFTP transfers */ + CINIT(TFTP_BLKSIZE, LONG, 178), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179), + + /* Socks Service */ + CINIT(SOCKS5_GSSAPI_NEC, LONG, 180), + + /* set the bitmask for the protocols that are allowed to be used for the + transfer, which thus helps the app which takes URLs from users or other + external inputs and want to restrict what protocol(s) to deal + with. Defaults to CURLPROTO_ALL. */ + CINIT(PROTOCOLS, LONG, 181), + + /* set the bitmask for the protocols that libcurl is allowed to follow to, + as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs + to be set in both bitmasks to be allowed to get redirected to. Defaults + to all protocols except FILE and SCP. */ + CINIT(REDIR_PROTOCOLS, LONG, 182), + + /* set the SSH knownhost file name to use */ + CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183), + + /* set the SSH host key callback, must point to a curl_sshkeycallback + function */ + CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184), + + /* set the SSH host key callback custom pointer */ + CINIT(SSH_KEYDATA, OBJECTPOINT, 185), + + /* set the SMTP mail originator */ + CINIT(MAIL_FROM, OBJECTPOINT, 186), + + /* set the SMTP mail receiver(s) */ + CINIT(MAIL_RCPT, OBJECTPOINT, 187), + + /* FTP: send PRET before PASV */ + CINIT(FTP_USE_PRET, LONG, 188), + + /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ + CINIT(RTSP_REQUEST, LONG, 189), + + /* The RTSP session identifier */ + CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190), + + /* The RTSP stream URI */ + CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191), + + /* The Transport: header to use in RTSP requests */ + CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192), + + /* Manually initialize the client RTSP CSeq for this handle */ + CINIT(RTSP_CLIENT_CSEQ, LONG, 193), + + /* Manually initialize the server RTSP CSeq for this handle */ + CINIT(RTSP_SERVER_CSEQ, LONG, 194), + + /* The stream to pass to INTERLEAVEFUNCTION. */ + CINIT(INTERLEAVEDATA, OBJECTPOINT, 195), + + /* Let the application define a custom write method for RTP data */ + CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196), + + /* Turn on wildcard matching */ + CINIT(WILDCARDMATCH, LONG, 197), + + /* Directory matching callback called before downloading of an + individual file (chunk) started */ + CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198), + + /* Directory matching callback called after the file (chunk) + was downloaded, or skipped */ + CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199), + + /* Change match (fnmatch-like) callback for wildcard matching */ + CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200), + + /* Let the application define custom chunk data pointer */ + CINIT(CHUNK_DATA, OBJECTPOINT, 201), + + /* FNMATCH_FUNCTION user pointer */ + CINIT(FNMATCH_DATA, OBJECTPOINT, 202), + + /* send linked-list of name:port:address sets */ + CINIT(RESOLVE, OBJECTPOINT, 203), + + /* Set a username for authenticated TLS */ + CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204), + + /* Set a password for authenticated TLS */ + CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205), + + /* Set authentication type for authenticated TLS */ + CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), + + /* Set to 1 to enable the "TE:" header in HTTP requests to ask for + compressed transfer-encoded responses. Set to 0 to disable the use of TE: + in outgoing requests. The current default is 0, but it might change in a + future libcurl release. + + libcurl will ask for the compressed methods it knows of, and if that + isn't any, it will not ask for transfer-encoding at all even if this + option is set to 1. + + */ + CINIT(TRANSFER_ENCODING, LONG, 207), + + /* Callback function for closing socket (instead of close(2)). The callback + should have type curl_closesocket_callback */ + CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208), + CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209), + + /* allow GSSAPI credential delegation */ + CINIT(GSSAPI_DELEGATION, LONG, 210), + + /* Set the name servers to use for DNS resolution */ + CINIT(DNS_SERVERS, OBJECTPOINT, 211), + + /* Time-out accept operations (currently for FTP only) after this amount + of miliseconds. */ + CINIT(ACCEPTTIMEOUT_MS, LONG, 212), + + /* Set TCP keepalive */ + CINIT(TCP_KEEPALIVE, LONG, 213), + + /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */ + CINIT(TCP_KEEPIDLE, LONG, 214), + CINIT(TCP_KEEPINTVL, LONG, 215), + + /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */ + CINIT(SSL_OPTIONS, LONG, 216), + + /* set the SMTP auth originator */ + CINIT(MAIL_AUTH, OBJECTPOINT, 217), + + CURLOPT_LASTENTRY /* the last unused */ +} CURLoption; + +#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all + the obsolete stuff removed! */ + +/* Backwards compatibility with older names */ +/* These are scheduled to disappear by 2011 */ + +/* This was added in version 7.19.1 */ +#define CURLOPT_POST301 CURLOPT_POSTREDIR + +/* These are scheduled to disappear by 2009 */ + +/* The following were added in 7.17.0 */ +#define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_FTPAPPEND CURLOPT_APPEND +#define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY +#define CURLOPT_FTP_SSL CURLOPT_USE_SSL + +/* The following were added earlier */ + +#define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD +#define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL + +#else +/* This is set if CURL_NO_OLDIES is defined at compile-time */ +#undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */ +#endif + + + /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host + name resolves addresses using more than one IP protocol version, this + option might be handy to force libcurl to use a specific IP version. */ +#define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP + versions that your system allows */ +#define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */ +#define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */ + + /* three convenient "aliases" that follow the name scheme better */ +#define CURLOPT_WRITEDATA CURLOPT_FILE +#define CURLOPT_READDATA CURLOPT_INFILE +#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER +#define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER + + /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ +enum { + CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd + like the library to choose the best possible + for us! */ + CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ + CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ + + CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ +}; + +/* + * Public API enums for RTSP requests + */ +enum { + CURL_RTSPREQ_NONE, /* first in list */ + CURL_RTSPREQ_OPTIONS, + CURL_RTSPREQ_DESCRIBE, + CURL_RTSPREQ_ANNOUNCE, + CURL_RTSPREQ_SETUP, + CURL_RTSPREQ_PLAY, + CURL_RTSPREQ_PAUSE, + CURL_RTSPREQ_TEARDOWN, + CURL_RTSPREQ_GET_PARAMETER, + CURL_RTSPREQ_SET_PARAMETER, + CURL_RTSPREQ_RECORD, + CURL_RTSPREQ_RECEIVE, + CURL_RTSPREQ_LAST /* last in list */ +}; + + /* These enums are for use with the CURLOPT_NETRC option. */ +enum CURL_NETRC_OPTION { + CURL_NETRC_IGNORED, /* The .netrc will never be read. + * This is the default. */ + CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred + * to one in the .netrc. */ + CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored. + * Unless one is set programmatically, the .netrc + * will be queried. */ + CURL_NETRC_LAST +}; + +enum { + CURL_SSLVERSION_DEFAULT, + CURL_SSLVERSION_TLSv1, + CURL_SSLVERSION_SSLv2, + CURL_SSLVERSION_SSLv3, + + CURL_SSLVERSION_LAST /* never use, keep last */ +}; + +enum CURL_TLSAUTH { + CURL_TLSAUTH_NONE, + CURL_TLSAUTH_SRP, + CURL_TLSAUTH_LAST /* never use, keep last */ +}; + +/* symbols to use with CURLOPT_POSTREDIR. + CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303 + can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 + | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */ + +#define CURL_REDIR_GET_ALL 0 +#define CURL_REDIR_POST_301 1 +#define CURL_REDIR_POST_302 2 +#define CURL_REDIR_POST_303 4 +#define CURL_REDIR_POST_ALL \ + (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303) + +typedef enum { + CURL_TIMECOND_NONE, + + CURL_TIMECOND_IFMODSINCE, + CURL_TIMECOND_IFUNMODSINCE, + CURL_TIMECOND_LASTMOD, + + CURL_TIMECOND_LAST +} curl_TimeCond; + + +/* curl_strequal() and curl_strnequal() are subject for removal in a future + libcurl, see lib/README.curlx for details */ +CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2); +CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n); + +/* name is uppercase CURLFORM_ */ +#ifdef CFINIT +#undef CFINIT +#endif + +#ifdef CURL_ISOCPP +#define CFINIT(name) CURLFORM_ ## name +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define CFINIT(name) CURLFORM_/**/name +#endif + +typedef enum { + CFINIT(NOTHING), /********* the first one is unused ************/ + + /* */ + CFINIT(COPYNAME), + CFINIT(PTRNAME), + CFINIT(NAMELENGTH), + CFINIT(COPYCONTENTS), + CFINIT(PTRCONTENTS), + CFINIT(CONTENTSLENGTH), + CFINIT(FILECONTENT), + CFINIT(ARRAY), + CFINIT(OBSOLETE), + CFINIT(FILE), + + CFINIT(BUFFER), + CFINIT(BUFFERPTR), + CFINIT(BUFFERLENGTH), + + CFINIT(CONTENTTYPE), + CFINIT(CONTENTHEADER), + CFINIT(FILENAME), + CFINIT(END), + CFINIT(OBSOLETE2), + + CFINIT(STREAM), + + CURLFORM_LASTENTRY /* the last unused */ +} CURLformoption; + +#undef CFINIT /* done */ + +/* structure to be used as parameter for CURLFORM_ARRAY */ +struct curl_forms { + CURLformoption option; + const char *value; +}; + +/* use this for multipart formpost building */ +/* Returns code for curl_formadd() + * + * Returns: + * CURL_FORMADD_OK on success + * CURL_FORMADD_MEMORY if the FormInfo allocation fails + * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form + * CURL_FORMADD_NULL if a null pointer was given for a char + * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed + * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used + * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) + * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated + * CURL_FORMADD_MEMORY if some allocation for string copying failed. + * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array + * + ***************************************************************************/ +typedef enum { + CURL_FORMADD_OK, /* first, no error */ + + CURL_FORMADD_MEMORY, + CURL_FORMADD_OPTION_TWICE, + CURL_FORMADD_NULL, + CURL_FORMADD_UNKNOWN_OPTION, + CURL_FORMADD_INCOMPLETE, + CURL_FORMADD_ILLEGAL_ARRAY, + CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */ + + CURL_FORMADD_LAST /* last */ +} CURLFORMcode; + +/* + * NAME curl_formadd() + * + * DESCRIPTION + * + * Pretty advanced function for building multi-part formposts. Each invoke + * adds one part that together construct a full post. Then use + * CURLOPT_HTTPPOST to send it off to libcurl. + */ +CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, + struct curl_httppost **last_post, + ...); + +/* + * callback function for curl_formget() + * The void *arg pointer will be the one passed as second argument to + * curl_formget(). + * The character buffer passed to it must not be freed. + * Should return the buffer length passed to it as the argument "len" on + * success. + */ +typedef size_t (*curl_formget_callback)(void *arg, const char *buf, + size_t len); + +/* + * NAME curl_formget() + * + * DESCRIPTION + * + * Serialize a curl_httppost struct built with curl_formadd(). + * Accepts a void pointer as second argument which will be passed to + * the curl_formget_callback function. + * Returns 0 on success. + */ +CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg, + curl_formget_callback append); +/* + * NAME curl_formfree() + * + * DESCRIPTION + * + * Free a multipart formpost previously built with curl_formadd(). + */ +CURL_EXTERN void curl_formfree(struct curl_httppost *form); + +/* + * NAME curl_getenv() + * + * DESCRIPTION + * + * Returns a malloc()'ed string that MUST be curl_free()ed after usage is + * complete. DEPRECATED - see lib/README.curlx + */ +CURL_EXTERN char *curl_getenv(const char *variable); + +/* + * NAME curl_version() + * + * DESCRIPTION + * + * Returns a static ascii string of the libcurl version. + */ +CURL_EXTERN char *curl_version(void); + +/* + * NAME curl_easy_escape() + * + * DESCRIPTION + * + * Escapes URL strings (converts all letters consider illegal in URLs to their + * %XX versions). This function returns a new allocated string or NULL if an + * error occurred. + */ +CURL_EXTERN char *curl_easy_escape(CURL *handle, + const char *string, + int length); + +/* the previous version: */ +CURL_EXTERN char *curl_escape(const char *string, + int length); + + +/* + * NAME curl_easy_unescape() + * + * DESCRIPTION + * + * Unescapes URL encoding in strings (converts all %XX codes to their 8bit + * versions). This function returns a new allocated string or NULL if an error + * occurred. + * Conversion Note: On non-ASCII platforms the ASCII %XX codes are + * converted into the host encoding. + */ +CURL_EXTERN char *curl_easy_unescape(CURL *handle, + const char *string, + int length, + int *outlength); + +/* the previous version */ +CURL_EXTERN char *curl_unescape(const char *string, + int length); + +/* + * NAME curl_free() + * + * DESCRIPTION + * + * Provided for de-allocation in the same translation unit that did the + * allocation. Added in libcurl 7.10 + */ +CURL_EXTERN void curl_free(void *p); + +/* + * NAME curl_global_init() + * + * DESCRIPTION + * + * curl_global_init() should be invoked exactly once for each application that + * uses libcurl and before any call of other libcurl functions. + * + * This function is not thread-safe! + */ +CURL_EXTERN CURLcode curl_global_init(long flags); + +/* + * NAME curl_global_init_mem() + * + * DESCRIPTION + * + * curl_global_init() or curl_global_init_mem() should be invoked exactly once + * for each application that uses libcurl. This function can be used to + * initialize libcurl and set user defined memory management callback + * functions. Users can implement memory management routines to check for + * memory leaks, check for mis-use of the curl library etc. User registered + * callback routines with be invoked by this library instead of the system + * memory management routines like malloc, free etc. + */ +CURL_EXTERN CURLcode curl_global_init_mem(long flags, + curl_malloc_callback m, + curl_free_callback f, + curl_realloc_callback r, + curl_strdup_callback s, + curl_calloc_callback c); + +/* + * NAME curl_global_cleanup() + * + * DESCRIPTION + * + * curl_global_cleanup() should be invoked exactly once for each application + * that uses libcurl + */ +CURL_EXTERN void curl_global_cleanup(void); + +/* linked-list structure for the CURLOPT_QUOTE option (and other) */ +struct curl_slist { + char *data; + struct curl_slist *next; +}; + +/* + * NAME curl_slist_append() + * + * DESCRIPTION + * + * Appends a string to a linked list. If no list exists, it will be created + * first. Returns the new list, after appending. + */ +CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *, + const char *); + +/* + * NAME curl_slist_free_all() + * + * DESCRIPTION + * + * free a previously built curl_slist. + */ +CURL_EXTERN void curl_slist_free_all(struct curl_slist *); + +/* + * NAME curl_getdate() + * + * DESCRIPTION + * + * Returns the time, in seconds since 1 Jan 1970 of the time string given in + * the first argument. The time argument in the second parameter is unused + * and should be set to NULL. + */ +CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused); + +/* info about the certificate chain, only for OpenSSL builds. Asked + for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ +struct curl_certinfo { + int num_of_certs; /* number of certificates with information */ + struct curl_slist **certinfo; /* for each index in this array, there's a + linked list with textual information in the + format "name: value" */ +}; + +#define CURLINFO_STRING 0x100000 +#define CURLINFO_LONG 0x200000 +#define CURLINFO_DOUBLE 0x300000 +#define CURLINFO_SLIST 0x400000 +#define CURLINFO_MASK 0x0fffff +#define CURLINFO_TYPEMASK 0xf00000 + +typedef enum { + CURLINFO_NONE, /* first, never use this */ + CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1, + CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2, + CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3, + CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4, + CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5, + CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6, + CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7, + CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8, + CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9, + CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10, + CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11, + CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12, + CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13, + CURLINFO_FILETIME = CURLINFO_LONG + 14, + CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15, + CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16, + CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17, + CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18, + CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19, + CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20, + CURLINFO_PRIVATE = CURLINFO_STRING + 21, + CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22, + CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23, + CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, + CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, + CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, + CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, + CURLINFO_COOKIELIST = CURLINFO_SLIST + 28, + CURLINFO_LASTSOCKET = CURLINFO_LONG + 29, + CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30, + CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31, + CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32, + CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33, + CURLINFO_CERTINFO = CURLINFO_SLIST + 34, + CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35, + CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36, + CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37, + CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38, + CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39, + CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40, + CURLINFO_LOCAL_IP = CURLINFO_STRING + 41, + CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42, + /* Fill in new entries below here! */ + + CURLINFO_LASTONE = 42 +} CURLINFO; + +/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as + CURLINFO_HTTP_CODE */ +#define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE + +typedef enum { + CURLCLOSEPOLICY_NONE, /* first, never use this */ + + CURLCLOSEPOLICY_OLDEST, + CURLCLOSEPOLICY_LEAST_RECENTLY_USED, + CURLCLOSEPOLICY_LEAST_TRAFFIC, + CURLCLOSEPOLICY_SLOWEST, + CURLCLOSEPOLICY_CALLBACK, + + CURLCLOSEPOLICY_LAST /* last, never use this */ +} curl_closepolicy; + +#define CURL_GLOBAL_SSL (1<<0) +#define CURL_GLOBAL_WIN32 (1<<1) +#define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32) +#define CURL_GLOBAL_NOTHING 0 +#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL + + +/***************************************************************************** + * Setup defines, protos etc for the sharing stuff. + */ + +/* Different data locks for a single share */ +typedef enum { + CURL_LOCK_DATA_NONE = 0, + /* CURL_LOCK_DATA_SHARE is used internally to say that + * the locking is just made to change the internal state of the share + * itself. + */ + CURL_LOCK_DATA_SHARE, + CURL_LOCK_DATA_COOKIE, + CURL_LOCK_DATA_DNS, + CURL_LOCK_DATA_SSL_SESSION, + CURL_LOCK_DATA_CONNECT, + CURL_LOCK_DATA_LAST +} curl_lock_data; + +/* Different lock access types */ +typedef enum { + CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */ + CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */ + CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */ + CURL_LOCK_ACCESS_LAST /* never use */ +} curl_lock_access; + +typedef void (*curl_lock_function)(CURL *handle, + curl_lock_data data, + curl_lock_access locktype, + void *userptr); +typedef void (*curl_unlock_function)(CURL *handle, + curl_lock_data data, + void *userptr); + +typedef void CURLSH; + +typedef enum { + CURLSHE_OK, /* all is fine */ + CURLSHE_BAD_OPTION, /* 1 */ + CURLSHE_IN_USE, /* 2 */ + CURLSHE_INVALID, /* 3 */ + CURLSHE_NOMEM, /* 4 out of memory */ + CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */ + CURLSHE_LAST /* never use */ +} CURLSHcode; + +typedef enum { + CURLSHOPT_NONE, /* don't use */ + CURLSHOPT_SHARE, /* specify a data type to share */ + CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */ + CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */ + CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */ + CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock + callback functions */ + CURLSHOPT_LAST /* never use */ +} CURLSHoption; + +CURL_EXTERN CURLSH *curl_share_init(void); +CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...); +CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *); + +/**************************************************************************** + * Structures for querying information about the curl library at runtime. + */ + +typedef enum { + CURLVERSION_FIRST, + CURLVERSION_SECOND, + CURLVERSION_THIRD, + CURLVERSION_FOURTH, + CURLVERSION_LAST /* never actually use this */ +} CURLversion; + +/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by + basically all programs ever that want to get version information. It is + meant to be a built-in version number for what kind of struct the caller + expects. If the struct ever changes, we redefine the NOW to another enum + from above. */ +#define CURLVERSION_NOW CURLVERSION_FOURTH + +typedef struct { + CURLversion age; /* age of the returned struct */ + const char *version; /* LIBCURL_VERSION */ + unsigned int version_num; /* LIBCURL_VERSION_NUM */ + const char *host; /* OS/host/cpu/machine when configured */ + int features; /* bitmask, see defines below */ + const char *ssl_version; /* human readable string */ + long ssl_version_num; /* not used anymore, always 0 */ + const char *libz_version; /* human readable string */ + /* protocols is terminated by an entry with a NULL protoname */ + const char * const *protocols; + + /* The fields below this were added in CURLVERSION_SECOND */ + const char *ares; + int ares_num; + + /* This field was added in CURLVERSION_THIRD */ + const char *libidn; + + /* These field were added in CURLVERSION_FOURTH */ + + /* Same as '_libiconv_version' if built with HAVE_ICONV */ + int iconv_ver_num; + + const char *libssh_version; /* human readable string */ + +} curl_version_info_data; + +#define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */ +#define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */ +#define CURL_VERSION_SSL (1<<2) /* SSL options are present */ +#define CURL_VERSION_LIBZ (1<<3) /* libz features are present */ +#define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */ +#define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */ +#define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */ +#define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */ +#define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */ +#define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */ +#define CURL_VERSION_IDN (1<<10) /* International Domain Names support */ +#define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */ +#define CURL_VERSION_CONV (1<<12) /* character conversions supported */ +#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ +#define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */ +#define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */ + + /* + * NAME curl_version_info() + * + * DESCRIPTION + * + * This function returns a pointer to a static copy of the version info + * struct. See above. + */ +CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion); + +/* + * NAME curl_easy_strerror() + * + * DESCRIPTION + * + * The curl_easy_strerror function may be used to turn a CURLcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_easy_strerror(CURLcode); + +/* + * NAME curl_share_strerror() + * + * DESCRIPTION + * + * The curl_share_strerror function may be used to turn a CURLSHcode value + * into the equivalent human readable error string. This is useful + * for printing meaningful error messages. + */ +CURL_EXTERN const char *curl_share_strerror(CURLSHcode); + +/* + * NAME curl_easy_pause() + * + * DESCRIPTION + * + * The curl_easy_pause function pauses or unpauses transfers. Select the new + * state by setting the bitmask, use the convenience defines below. + * + */ +CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask); + +#define CURLPAUSE_RECV (1<<0) +#define CURLPAUSE_RECV_CONT (0) + +#define CURLPAUSE_SEND (1<<2) +#define CURLPAUSE_SEND_CONT (0) + +#define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND) +#define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT) + +#ifdef __cplusplus +} +#endif + +/* unfortunately, the easy.h and multi.h include files need options and info + stuff before they can be included! */ +#include "easy.h" /* nothing in curl is fun without the easy stuff */ +#include "multi.h" + +/* the typechecker doesn't work in C++ (yet) */ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && \ + ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \ + !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK) +#include "typecheck-gcc.h" +#else +#if defined(__STDC__) && (__STDC__ >= 1) +/* This preprocessor magic that replaces a call with the exact same call is + only done to make sure application authors pass exactly three arguments + to these functions. */ +#define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param) +#define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg) +#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param) +#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param) +#endif /* __STDC__ >= 1 */ +#endif /* gcc >= 4.3 && !__cplusplus */ + +#endif /* __CURL_CURL_H */ diff --git a/cocos2dx/platform/third_party/linux/include64/curl/curlbuild.h b/cocos2dx/platform/third_party/linux/include64/curl/curlbuild.h new file mode 100644 index 0000000000..6faccb1a21 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/curlbuild.h @@ -0,0 +1,191 @@ +/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */ +#ifndef __CURL_CURLBUILD_H +#define __CURL_CURLBUILD_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the libcurl development + * mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * This header file shall only export symbols which are 'curl' or 'CURL' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file include/curl/curlbuild.h.in or + * at file include/curl/curlbuild.h, this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed include/curl/curlbuild.h file with one that + * is suitable and specific to the library being configured and built, which + * is generated from the include/curl/curlbuild.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CURL_SIZEOF_LONG +#error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_SOCKLEN_T +#error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_SOCKLEN_T +#error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined +#endif + +#ifdef CURL_TYPEOF_CURL_OFF_T +#error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_T +#error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_FORMAT_CURL_OFF_TU +#error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined +#endif + +#ifdef CURL_FORMAT_OFF_T +#error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined +#endif + +#ifdef CURL_SIZEOF_CURL_OFF_T +#error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_T +#error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined +#endif + +#ifdef CURL_SUFFIX_CURL_OFF_TU +#error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +/* #undef CURL_PULL_WS2TCPIP_H */ +#ifdef CURL_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#define CURL_PULL_SYS_TYPES_H 1 +#ifdef CURL_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file stdint.h must be included by the external interface. */ +/* #undef CURL_PULL_STDINT_H */ +#ifdef CURL_PULL_STDINT_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file inttypes.h must be included by the external interface. */ +/* #undef CURL_PULL_INTTYPES_H */ +#ifdef CURL_PULL_INTTYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#define CURL_PULL_SYS_SOCKET_H 1 +#ifdef CURL_PULL_SYS_SOCKET_H +# include +#endif + +/* The size of `long', as computed by sizeof. */ +#define CURL_SIZEOF_LONG 8 + +/* Integral data type used for curl_socklen_t. */ +#define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t + +/* The size of `curl_socklen_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_SOCKLEN_T 4 + +/* Data type definition of curl_socklen_t. */ +typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; + +/* Signed integral data type used for curl_off_t. */ +#define CURL_TYPEOF_CURL_OFF_T long + +/* Data type definition of curl_off_t. */ +typedef CURL_TYPEOF_CURL_OFF_T curl_off_t; + +/* curl_off_t formatting string directive without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_T "ld" + +/* unsigned curl_off_t formatting string without "%" conversion specifier. */ +#define CURL_FORMAT_CURL_OFF_TU "lu" + +/* curl_off_t formatting string directive with "%" conversion specifier. */ +#define CURL_FORMAT_OFF_T "%ld" + +/* The size of `curl_off_t', as computed by sizeof. */ +#define CURL_SIZEOF_CURL_OFF_T 8 + +/* curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_T L + +/* unsigned curl_off_t constant suffix. */ +#define CURL_SUFFIX_CURL_OFF_TU UL + +#endif /* __CURL_CURLBUILD_H */ diff --git a/cocos2dx/platform/third_party/linux/include64/curl/curlrules.h b/cocos2dx/platform/third_party/linux/include64/curl/curlrules.h new file mode 100644 index 0000000000..cbc12fdd29 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/curlrules.h @@ -0,0 +1,261 @@ +#ifndef __CURL_CURLRULES_H +#define __CURL_CURLRULES_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* ================================================================ */ +/* COMPILE TIME SANITY CHECKS */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * All checks done in this file are intentionally placed in a public + * header file which is pulled by curl/curl.h when an application is + * being built using an already built libcurl library. Additionally + * this file is also included and used when building the library. + * + * If compilation fails on this file it is certainly sure that the + * problem is elsewhere. It could be a problem in the curlbuild.h + * header file, or simply that you are using different compilation + * settings than those used to build the library. + * + * Nothing in this file is intended to be modified or adjusted by the + * curl library user nor by the curl library builder. + * + * Do not deactivate any check, these are done to make sure that the + * library is properly built and used. + * + * You can find further help on the libcurl development mailing list: + * http://cool.haxx.se/mailman/listinfo/curl-library/ + * + * NOTE 2 + * ------ + * + * Some of the following compile time checks are based on the fact + * that the dimension of a constant array can not be a negative one. + * In this way if the compile time verification fails, the compilation + * will fail issuing an error. The error description wording is compiler + * dependent but it will be quite similar to one of the following: + * + * "negative subscript or subscript is too large" + * "array must have at least one element" + * "-1 is an illegal array size" + * "size of array is negative" + * + * If you are building an application which tries to use an already + * built libcurl library and you are getting this kind of errors on + * this file, it is a clear indication that there is a mismatch between + * how the library was built and how you are trying to use it for your + * application. Your already compiled or binary library provider is the + * only one who can give you the details you need to properly use it. + */ + +/* + * Verify that some macros are actually defined. + */ + +#ifndef CURL_SIZEOF_LONG +# error "CURL_SIZEOF_LONG definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing +#endif + +#ifndef CURL_TYPEOF_CURL_SOCKLEN_T +# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_SOCKLEN_T +# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing +#endif + +#ifndef CURL_TYPEOF_CURL_OFF_T +# error "CURL_TYPEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_T +# error "CURL_FORMAT_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_FORMAT_CURL_OFF_TU +# error "CURL_FORMAT_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing +#endif + +#ifndef CURL_FORMAT_OFF_T +# error "CURL_FORMAT_OFF_T definition is missing!" + Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing +#endif + +#ifndef CURL_SIZEOF_CURL_OFF_T +# error "CURL_SIZEOF_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_T +# error "CURL_SUFFIX_CURL_OFF_T definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing +#endif + +#ifndef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" + Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing +#endif + +/* + * Macros private to this header file. + */ + +#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 + +#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 + +/* + * Verify that the size previously defined and expected for long + * is the same as the one reported by sizeof() at compile time. + */ + +typedef char + __curl_rule_01__ + [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; + +/* + * Verify that the size previously defined and expected for + * curl_off_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_02__ + [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; + +/* + * Verify at compile time that the size of curl_off_t as reported + * by sizeof() is greater or equal than the one reported for long + * for the current compilation. + */ + +typedef char + __curl_rule_03__ + [CurlchkszGE(curl_off_t, long)]; + +/* + * Verify that the size previously defined and expected for + * curl_socklen_t is actually the the same as the one reported + * by sizeof() at compile time. + */ + +typedef char + __curl_rule_04__ + [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; + +/* + * Verify at compile time that the size of curl_socklen_t as reported + * by sizeof() is greater or equal than the one reported for int for + * the current compilation. + */ + +typedef char + __curl_rule_05__ + [CurlchkszGE(curl_socklen_t, int)]; + +/* ================================================================ */ +/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ +/* ================================================================ */ + +/* + * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow + * these to be visible and exported by the external libcurl interface API, + * while also making them visible to the library internals, simply including + * setup.h, without actually needing to include curl.h internally. + * If some day this section would grow big enough, all this should be moved + * to its own header file. + */ + +/* + * Figure out if we can use the ## preprocessor operator, which is supported + * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ + * or __cplusplus so we need to carefully check for them too. + */ + +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ + defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ + defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ + defined(__ILEC400__) + /* This compiler is believed to have an ISO compatible preprocessor */ +#define CURL_ISOCPP +#else + /* This compiler is believed NOT to have an ISO compatible preprocessor */ +#undef CURL_ISOCPP +#endif + +/* + * Macros for minimum-width signed and unsigned curl_off_t integer constants. + */ + +#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) +# define __CURL_OFF_T_C_HLPR2(x) x +# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) +# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ + __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) +# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ + __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) +#else +# ifdef CURL_ISOCPP +# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix +# else +# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix +# endif +# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) +# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) +# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) +#endif + +/* + * Get rid of macros private to this header file. + */ + +#undef CurlchkszEQ +#undef CurlchkszGE + +/* + * Get rid of macros not intended to exist beyond this point. + */ + +#undef CURL_PULL_WS2TCPIP_H +#undef CURL_PULL_SYS_TYPES_H +#undef CURL_PULL_SYS_SOCKET_H +#undef CURL_PULL_STDINT_H +#undef CURL_PULL_INTTYPES_H + +#undef CURL_TYPEOF_CURL_SOCKLEN_T +#undef CURL_TYPEOF_CURL_OFF_T + +#ifdef CURL_NO_OLDIES +#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ +#endif + +#endif /* __CURL_CURLRULES_H */ diff --git a/cocos2dx/platform/third_party/linux/include64/curl/curlver.h b/cocos2dx/platform/third_party/linux/include64/curl/curlver.h new file mode 100644 index 0000000000..b7e8acf538 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/curlver.h @@ -0,0 +1,69 @@ +#ifndef __CURL_CURLVER_H +#define __CURL_CURLVER_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/* This header file contains nothing but libcurl version info, generated by + a script at release-time. This was made its own header file in 7.11.2 */ + +/* This is the global package copyright */ +#define LIBCURL_COPYRIGHT "1996 - 2012 Daniel Stenberg, ." + +/* This is the version number of the libcurl package from which this header + file origins: */ +#define LIBCURL_VERSION "7.26.0" + +/* The numeric version number is also available "in parts" by using these + defines: */ +#define LIBCURL_VERSION_MAJOR 7 +#define LIBCURL_VERSION_MINOR 26 +#define LIBCURL_VERSION_PATCH 0 + +/* This is the numeric version of the libcurl version number, meant for easier + parsing and comparions by programs. The LIBCURL_VERSION_NUM define will + always follow this syntax: + + 0xXXYYZZ + + Where XX, YY and ZZ are the main version, release and patch numbers in + hexadecimal (using 8 bits each). All three numbers are always represented + using two digits. 1.2 would appear as "0x010200" while version 9.11.7 + appears as "0x090b07". + + This 6-digit (24 bits) hexadecimal number does not show pre-release number, + and it is always a greater number in a more recent release. It makes + comparisons with greater than and less than work. +*/ +#define LIBCURL_VERSION_NUM 0x071a00 + +/* + * This is the date and time when the full source package was created. The + * timestamp is not stored in git, as the timestamp is properly set in the + * tarballs by the maketgz script. + * + * The format of the date should follow this template: + * + * "Mon Feb 12 11:35:33 UTC 2007" + */ +#define LIBCURL_TIMESTAMP "Thu May 24 16:05:42 UTC 2012" + +#endif /* __CURL_CURLVER_H */ diff --git a/cocos2dx/platform/third_party/linux/include64/curl/easy.h b/cocos2dx/platform/third_party/linux/include64/curl/easy.h new file mode 100644 index 0000000000..c1e3e76096 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/easy.h @@ -0,0 +1,102 @@ +#ifndef __CURL_EASY_H +#define __CURL_EASY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN CURL *curl_easy_init(void); +CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...); +CURL_EXTERN CURLcode curl_easy_perform(CURL *curl); +CURL_EXTERN void curl_easy_cleanup(CURL *curl); + +/* + * NAME curl_easy_getinfo() + * + * DESCRIPTION + * + * Request internal information from the curl session with this function. The + * third argument MUST be a pointer to a long, a pointer to a char * or a + * pointer to a double (as the documentation describes elsewhere). The data + * pointed to will be filled in accordingly and can be relied upon only if the + * function returns CURLE_OK. This function is intended to get used *AFTER* a + * performed transfer, all results from this function are undefined until the + * transfer is completed. + */ +CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...); + + +/* + * NAME curl_easy_duphandle() + * + * DESCRIPTION + * + * Creates a new curl session handle with the same options set for the handle + * passed in. Duplicating a handle could only be a matter of cloning data and + * options, internal state info and things like persistent connections cannot + * be transferred. It is useful in multithreaded applications when you can run + * curl_easy_duphandle() for each new thread to avoid a series of identical + * curl_easy_setopt() invokes in every thread. + */ +CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl); + +/* + * NAME curl_easy_reset() + * + * DESCRIPTION + * + * Re-initializes a CURL handle to the default values. This puts back the + * handle to the same state as it was in when it was just created. + * + * It does keep: live connections, the Session ID cache, the DNS cache and the + * cookies. + */ +CURL_EXTERN void curl_easy_reset(CURL *curl); + +/* + * NAME curl_easy_recv() + * + * DESCRIPTION + * + * Receives data from the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, + size_t *n); + +/* + * NAME curl_easy_send() + * + * DESCRIPTION + * + * Sends data over the connected socket. Use after successful + * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. + */ +CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer, + size_t buflen, size_t *n); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/cocos2dx/platform/third_party/linux/include64/curl/mprintf.h b/cocos2dx/platform/third_party/linux/include64/curl/mprintf.h new file mode 100644 index 0000000000..de7dd2f3c3 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/mprintf.h @@ -0,0 +1,81 @@ +#ifndef __CURL_MPRINTF_H +#define __CURL_MPRINTF_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include +#include /* needed for FILE */ + +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +CURL_EXTERN int curl_mprintf(const char *format, ...); +CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...); +CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...); +CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, + const char *format, ...); +CURL_EXTERN int curl_mvprintf(const char *format, va_list args); +CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args); +CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args); +CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, + const char *format, va_list args); +CURL_EXTERN char *curl_maprintf(const char *format, ...); +CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args); + +#ifdef _MPRINTF_REPLACE +# undef printf +# undef fprintf +# undef sprintf +# undef vsprintf +# undef snprintf +# undef vprintf +# undef vfprintf +# undef vsnprintf +# undef aprintf +# undef vaprintf +# define printf curl_mprintf +# define fprintf curl_mfprintf +#ifdef CURLDEBUG +/* When built with CURLDEBUG we define away the sprintf() functions since we + don't want internal code to be using them */ +# define sprintf sprintf_was_used +# define vsprintf vsprintf_was_used +#else +# define sprintf curl_msprintf +# define vsprintf curl_mvsprintf +#endif +# define snprintf curl_msnprintf +# define vprintf curl_mvprintf +# define vfprintf curl_mvfprintf +# define vsnprintf curl_mvsnprintf +# define aprintf curl_maprintf +# define vaprintf curl_mvaprintf +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __CURL_MPRINTF_H */ diff --git a/cocos2dx/platform/third_party/linux/include64/curl/multi.h b/cocos2dx/platform/third_party/linux/include64/curl/multi.h new file mode 100644 index 0000000000..f96566669c --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/multi.h @@ -0,0 +1,345 @@ +#ifndef __CURL_MULTI_H +#define __CURL_MULTI_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +/* + This is an "external" header file. Don't give away any internals here! + + GOALS + + o Enable a "pull" interface. The application that uses libcurl decides where + and when to ask libcurl to get/send data. + + o Enable multiple simultaneous transfers in the same thread without making it + complicated for the application. + + o Enable the application to select() on its own file descriptors and curl's + file descriptors simultaneous easily. + +*/ + +/* + * This header file should not really need to include "curl.h" since curl.h + * itself includes this file and we expect user applications to do #include + * without the need for especially including multi.h. + * + * For some reason we added this include here at one point, and rather than to + * break existing (wrongly written) libcurl applications, we leave it as-is + * but with this warning attached. + */ +#include "curl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void CURLM; + +typedef enum { + CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or + curl_multi_socket*() soon */ + CURLM_OK, + CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */ + CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */ + CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */ + CURLM_INTERNAL_ERROR, /* this is a libcurl bug */ + CURLM_BAD_SOCKET, /* the passed in socket argument did not match */ + CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */ + CURLM_LAST +} CURLMcode; + +/* just to make code nicer when using curl_multi_socket() you can now check + for CURLM_CALL_MULTI_SOCKET too in the same style it works for + curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ +#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM + +typedef enum { + CURLMSG_NONE, /* first, not used */ + CURLMSG_DONE, /* This easy handle has completed. 'result' contains + the CURLcode of the transfer */ + CURLMSG_LAST /* last, not used */ +} CURLMSG; + +struct CURLMsg { + CURLMSG msg; /* what this message means */ + CURL *easy_handle; /* the handle it concerns */ + union { + void *whatever; /* message-specific data */ + CURLcode result; /* return code for transfer */ + } data; +}; +typedef struct CURLMsg CURLMsg; + +/* + * Name: curl_multi_init() + * + * Desc: inititalize multi-style curl usage + * + * Returns: a new CURLM handle to use in all 'curl_multi' functions. + */ +CURL_EXTERN CURLM *curl_multi_init(void); + +/* + * Name: curl_multi_add_handle() + * + * Desc: add a standard curl handle to the multi stack + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_remove_handle() + * + * Desc: removes a curl handle from the multi stack again + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, + CURL *curl_handle); + + /* + * Name: curl_multi_fdset() + * + * Desc: Ask curl for its fd_set sets. The app can use these to select() or + * poll() on. We want curl_multi_perform() called as soon as one of + * them are ready. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, + fd_set *read_fd_set, + fd_set *write_fd_set, + fd_set *exc_fd_set, + int *max_fd); + + /* + * Name: curl_multi_perform() + * + * Desc: When the app thinks there's data available for curl it calls this + * function to read/write whatever there is right now. This returns + * as soon as the reads and writes are done. This function does not + * require that there actually is data available for reading or that + * data can be written, it can be called just in case. It returns + * the number of handles that still transfer data in the second + * argument's integer-pointer. + * + * Returns: CURLMcode type, general multi error code. *NOTE* that this only + * returns errors etc regarding the whole multi stack. There might + * still have occurred problems on invidual transfers even when this + * returns OK. + */ +CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, + int *running_handles); + + /* + * Name: curl_multi_cleanup() + * + * Desc: Cleans up and removes a whole multi stack. It does not free or + * touch any individual easy handles in any way. We need to define + * in what state those handles will be if this function is called + * in the middle of a transfer. + * + * Returns: CURLMcode type, general multi error code. + */ +CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle); + +/* + * Name: curl_multi_info_read() + * + * Desc: Ask the multi handle if there's any messages/informationals from + * the individual transfers. Messages include informationals such as + * error code from the transfer or just the fact that a transfer is + * completed. More details on these should be written down as well. + * + * Repeated calls to this function will return a new struct each + * time, until a special "end of msgs" struct is returned as a signal + * that there is no more to get at this point. + * + * The data the returned pointer points to will not survive calling + * curl_multi_cleanup(). + * + * The 'CURLMsg' struct is meant to be very simple and only contain + * very basic informations. If more involved information is wanted, + * we will provide the particular "transfer handle" in that struct + * and that should/could/would be used in subsequent + * curl_easy_getinfo() calls (or similar). The point being that we + * must never expose complex structs to applications, as then we'll + * undoubtably get backwards compatibility problems in the future. + * + * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out + * of structs. It also writes the number of messages left in the + * queue (after this read) in the integer the second argument points + * to. + */ +CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle, + int *msgs_in_queue); + +/* + * Name: curl_multi_strerror() + * + * Desc: The curl_multi_strerror function may be used to turn a CURLMcode + * value into the equivalent human readable error string. This is + * useful for printing meaningful error messages. + * + * Returns: A pointer to a zero-terminated error message. + */ +CURL_EXTERN const char *curl_multi_strerror(CURLMcode); + +/* + * Name: curl_multi_socket() and + * curl_multi_socket_all() + * + * Desc: An alternative version of curl_multi_perform() that allows the + * application to pass in one of the file descriptors that have been + * detected to have "action" on them and let libcurl perform. + * See man page for details. + */ +#define CURL_POLL_NONE 0 +#define CURL_POLL_IN 1 +#define CURL_POLL_OUT 2 +#define CURL_POLL_INOUT 3 +#define CURL_POLL_REMOVE 4 + +#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD + +#define CURL_CSELECT_IN 0x01 +#define CURL_CSELECT_OUT 0x02 +#define CURL_CSELECT_ERR 0x04 + +typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */ + curl_socket_t s, /* socket */ + int what, /* see above */ + void *userp, /* private callback + pointer */ + void *socketp); /* private socket + pointer */ +/* + * Name: curl_multi_timer_callback + * + * Desc: Called by libcurl whenever the library detects a change in the + * maximum number of milliseconds the app is allowed to wait before + * curl_multi_socket() or curl_multi_perform() must be called + * (to allow libcurl's timed events to take place). + * + * Returns: The callback should return zero. + */ +typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */ + long timeout_ms, /* see above */ + void *userp); /* private callback + pointer */ + +CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle, + curl_socket_t s, + int ev_bitmask, + int *running_handles); + +CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle, + int *running_handles); + +#ifndef CURL_ALLOW_OLD_MULTI_SOCKET +/* This macro below was added in 7.16.3 to push users who recompile to use + the new curl_multi_socket_action() instead of the old curl_multi_socket() +*/ +#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z) +#endif + +/* + * Name: curl_multi_timeout() + * + * Desc: Returns the maximum number of milliseconds the app is allowed to + * wait before curl_multi_socket() or curl_multi_perform() must be + * called (to allow libcurl's timed events to take place). + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, + long *milliseconds); + +#undef CINIT /* re-using the same name as in curl.h */ + +#ifdef CURL_ISOCPP +#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num +#else +/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ +#define LONG CURLOPTTYPE_LONG +#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT +#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT +#define OFF_T CURLOPTTYPE_OFF_T +#define CINIT(name,type,number) CURLMOPT_/**/name = type + number +#endif + +typedef enum { + /* This is the socket callback function pointer */ + CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1), + + /* This is the argument passed to the socket callback */ + CINIT(SOCKETDATA, OBJECTPOINT, 2), + + /* set to 1 to enable pipelining for this multi handle */ + CINIT(PIPELINING, LONG, 3), + + /* This is the timer callback function pointer */ + CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4), + + /* This is the argument passed to the timer callback */ + CINIT(TIMERDATA, OBJECTPOINT, 5), + + /* maximum number of entries in the connection cache */ + CINIT(MAXCONNECTS, LONG, 6), + + CURLMOPT_LASTENTRY /* the last unused */ +} CURLMoption; + + +/* + * Name: curl_multi_setopt() + * + * Desc: Sets options for the multi handle. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, + CURLMoption option, ...); + + +/* + * Name: curl_multi_assign() + * + * Desc: This function sets an association in the multi handle between the + * given socket and a private pointer of the application. This is + * (only) useful for curl_multi_socket uses. + * + * Returns: CURLM error code. + */ +CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle, + curl_socket_t sockfd, void *sockp); + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif + +#endif diff --git a/cocos2dx/platform/third_party/linux/include64/curl/stdcheaders.h b/cocos2dx/platform/third_party/linux/include64/curl/stdcheaders.h new file mode 100644 index 0000000000..ad82ef6335 --- /dev/null +++ b/cocos2dx/platform/third_party/linux/include64/curl/stdcheaders.h @@ -0,0 +1,33 @@ +#ifndef __STDC_HEADERS_H +#define __STDC_HEADERS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include + +size_t fread (void *, size_t, size_t, FILE *); +size_t fwrite (const void *, size_t, size_t, FILE *); + +int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); + +#endif /* __STDC_HEADERS_H */ diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile index bbddb59751..1cf7542ca4 100644 --- a/cocos2dx/proj.linux/Makefile +++ b/cocos2dx/proj.linux/Makefile @@ -23,10 +23,14 @@ INCLUDES = -I.. \ -I../platform/third_party/linux/libxml2 \ -I../platform/third_party/linux/libpng \ -I../platform/third_party/linux/libjpeg \ - -I../platform/third_party/linux/libtiff/include \ - -I../platform/third_party/linux/ \ + -I../platform/third_party/linux/libtiff/include -# -I../platform/third_party/linux/libpng \ +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) +INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux/include64 +else +INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux +endif DEFINES = -DLINUX DEFINES += -D__CC_PLATFORM_FILEUTILS_CPP__ @@ -191,7 +195,6 @@ OBJECTS = ../actions/CCAction.o \ # ../../extensions/CCListView/CCListView.o \ # ../../extensions/GUI/CCTextureWatcher/CCTextureWatcher.o \ -LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) STATICLIBS_DIR = ../platform/third_party/linux/libraries/lib64 else diff --git a/samples/HelloCpp/proj.linux/main.cpp b/samples/HelloCpp/proj.linux/main.cpp index cc5c57f916..069f414aa5 100644 --- a/samples/HelloCpp/proj.linux/main.cpp +++ b/samples/HelloCpp/proj.linux/main.cpp @@ -29,9 +29,7 @@ int main(int argc, char **argv) AppDelegate app; CCApplication::sharedApplication()->setResourceRootPath(resourcePath.c_str()); CCEGLView* eglView = CCEGLView::sharedOpenGLView(); - eglView->setFrameSize(2048, 1536); - // The resolution of ipad3 is very large. In general, PC's resolution is smaller than it. - // So we need to invoke 'setFrameZoomFactor'(only valid on desktop(win32, mac, linux)) to make the window smaller. - eglView->setFrameZoomFactor(0.4f); + eglView->setFrameSize(480, 320); + return CCApplication::sharedApplication()->run(); } diff --git a/samples/TestCpp/proj.linux/Makefile b/samples/TestCpp/proj.linux/Makefile index 3cf5f55790..8c9f053c83 100644 --- a/samples/TestCpp/proj.linux/Makefile +++ b/samples/TestCpp/proj.linux/Makefile @@ -11,7 +11,6 @@ INCLUDES = -I../ \ -I../../ \ -I../Classes \ -I$(COCOS2DX_PATH) \ - -I$(COCOS2DX_PATH)/platform/third_party/linux \ -I$(COCOS2DX_PATH)/platform/third_party/linux/libfreetype2 \ -I$(COCOS2DX_PATH)/cocoa \ -I$(COCOS2DX_PATH)/include \ @@ -21,14 +20,17 @@ INCLUDES = -I../ \ -I$(COCOS2DX_PATH)/platform/third_party/linux/glew-1.7.0/glew-1.7.0/include/ \ -I$(COCOS2DX_PATH)/platform/third_party/linux/libxml2 \ -I$(COCOS2DX_PATH)/platform/third_party/linux/libjpeg \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/curl \ -I../../../CocosDenshion/include \ -I../../../extensions/ \ -I../../../external/ \ -I../../../external/chipmunk/include/chipmunk \ - - +LBITS := $(shell getconf LONG_BIT) +ifeq ($(LBITS),64) +INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux/include64 +else +INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux +endif #CCFLAGS += -fno-tree-scev-cprop @@ -124,8 +126,6 @@ OBJECTS = ../Classes/AccelerometerTest/AccelerometerTest.o \ ../Classes/VisibleRect.o \ ./main.o - -LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 else From 026662ee5f659f4321a27c803200ef48761e5463 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 1 Nov 2012 15:45:22 +0800 Subject: [PATCH 75/95] issue #1530: Assigned JSVAL_VOID to member variables for JSCallbackWrapper class. --- scripting/javascript/bindings/cocos2d_specifics.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index 25f3d541f6..8328e98005 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -82,7 +82,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj); class JSCallbackWrapper: public CCObject { public: - JSCallbackWrapper() {} + JSCallbackWrapper() : jsCallback(JSVAL_VOID), jsThisObj(JSVAL_VOID), extraData(JSVAL_VOID) {} virtual ~JSCallbackWrapper(void) {} void setJSCallbackFunc(jsval obj); void setJSCallbackThis(jsval thisObj); From 45005c6cd9ff089712aad8e113604fe6f22d5b5d Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 1 Nov 2012 15:56:05 +0800 Subject: [PATCH 76/95] issue #1530: Set COCOS2D_DEBUG macro to 1 in Application.mk for MoonWarriors project, otherwise there are many outputs in logcat window. --- samples/MoonWarriors/proj.android/jni/Application.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/MoonWarriors/proj.android/jni/Application.mk b/samples/MoonWarriors/proj.android/jni/Application.mk index 4b8115b893..7d6285b80b 100644 --- a/samples/MoonWarriors/proj.android/jni/Application.mk +++ b/samples/MoonWarriors/proj.android/jni/Application.mk @@ -1,3 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -APP_CPPFLAGS += -DCOCOS2D_DEBUG=2 +APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 From d2a9acd227b6af8afd55f02c0d78fe4c8cc702aa Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 1 Nov 2012 16:06:05 +0800 Subject: [PATCH 77/95] issue #1530: Two memory leaks fixes. --- scripting/javascript/bindings/cocos2d_specifics.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index e6d2f784fe..6cd8f8abd7 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -715,7 +715,7 @@ JSBool js_CCNode_scheduleOnce(JSContext *cx, uint32_t argc, jsval *vp) CCScheduler *sched = node->getScheduler(); JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); - + tmpCobj->autorelease(); // // delay @@ -763,7 +763,8 @@ JSBool js_CCNode_schedule(JSContext *cx, uint32_t argc, jsval *vp) js_proxy_t *p = js_get_or_create_proxy(cx, sched); JSScheduleWrapper *tmpCobj = new JSScheduleWrapper(); - + tmpCobj->autorelease(); + double interval; if( argc >= 2 ) { if( ! JS_ValueToNumber(cx, argv[1], &interval ) ) From 19d29287b926d8f45f5889837af93a9796213c94 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 1 Nov 2012 17:40:00 +0800 Subject: [PATCH 78/95] update changelog --- CHANGELOG | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 220ac50b48..77800b669a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,41 @@ +cocos2d-2.0-x-2.0.4 @Nov.2 2012 + [all platforms] + Bug #1473: fix a bug that CCScale9Sprite does not support rotated spriteframe in atlas + Bug #1494: fix a bug that missing removing auto-release object from AutoReleasePool if it invokes 'autorelease' method more than one time + Bug #1495: fix a bug that CCScrollView display area and touch area are wrong if its parent's postion isn't at CCPointZero in world + Bug #1508: fix a bug that potential observer array modification while it's traversed in CCNotificationCenter + Bug #1510: fix a bug that application will freeze when 'numberOfCellsInTableView' returns zero + Bug #1516: fix a bug that the font size of labels for displaying FPS,SPF,DrawCount is incorrect in different design resolutions + Bug #1536: CCControl* should not respond to touches if the control is not visible + Bug #1538: fix a logic error in CCControlHuePicker::checkSliderPosition() + Bug #1543: fix a bug that CCLayerGradient background of CocosBuilderTest can't be shown + Feature #1515: add a zoom function for debugging large resolution (e.g.new ipad) app on desktop + Refactor #1312: upgrade libcurl to 7.26.0 + Refactor #1486: apply multi-resolution mechanic on iOS, especially for iphone5 + Refactor #1520: add comments to describe the usage of multiresolution in HelloCpp + Refactor #1521: use relative coordinates in TestCpp + Document #1532: write a document describes how to debug games for ipad3 on low-resolution PC + Document #1493: add doxygen comments in CCNotificationCenter.h + [android] + Bug #1466: reload shader for test case "ShaderTest" after it comes from background + Bug #1500: fix a bug that CCRenderTexture cannot render properly on some Qualcomm Adreno GPUs + Bug #1507: fix a bug that can not play effect for the first time without pre-load effect + [iOS] + Bug #1527: fix a bug that MoonWarriors can not run on iOS simulator sometimes + Refactor #1491: remove dependency of FontLabel lib + [javascript binding] + Feature #1469: add MoonWarriors as a sample game + Refactor #1487: use shared javascript test cases with cocos2d-html5 and cocos2d-iphone + Refactor #1517: upgrade SpiderMonkey to FF 16.0.1 + [lua binding] + Bug #1506: fix a compilation error of TestLua if the path of cocos2d-x contains spaces + [win32] + Bug #1496: fix an error of comparing font's face name in CCImage of win32 port + Bug #1511: fix openGL framebuffer access violation + Bug #1540: fix win32 CCLuaLog memory leaks and invalid console UTF8 output + Feature #1513: add Multi-Touch support for win7/8 tablet or ultrabook + Refactor #1512: change writable directory to "C:\Documents and Settings\username\Local Settings\Application Data\your app name" if the app be built in release mode + cocos2d-2.0-x-2.0.3 @Sep.26 2012 [all platforms] Bug #1452: change CCRGBAProtocol to public in order for actions like CCTintTo to have an affect on the CCScale9Sprite From d16a6bbe2f6e9225a0e5eb16c5bdd4423f0a47fa Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 1 Nov 2012 22:12:13 +0800 Subject: [PATCH 79/95] issue #1526:move implementation of static methond into .cpp file --- .../CCTransition.cpp | 524 ++++++++++++++++++ .../CCTransition.h | 131 ++--- .../CCTransitionProgress.cpp | 177 ++++++ .../CCTransitionProgress.h | 28 +- 4 files changed, 760 insertions(+), 100 deletions(-) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp index e26943c9a1..b2e513064f 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.cpp @@ -234,6 +234,32 @@ CCTransitionRotoZoom::CCTransitionRotoZoom() { } +CCTransitionRotoZoom* CCTransitionRotoZoom::create(float t, CCScene* scene) +{ + CCTransitionRotoZoom* pScene = new CCTransitionRotoZoom(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionRotoZoom* CCTransitionRotoZoom::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionRotoZoom* pScene = new CCTransitionRotoZoom(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + CCTransitionRotoZoom::~CCTransitionRotoZoom() { } @@ -282,6 +308,32 @@ CCTransitionJumpZoom::~CCTransitionJumpZoom() { } +CCTransitionJumpZoom* CCTransitionJumpZoom::create(float t, CCScene* scene) +{ + CCTransitionJumpZoom* pScene = new CCTransitionJumpZoom(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionJumpZoom* CCTransitionJumpZoom::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionJumpZoom* pScene = new CCTransitionJumpZoom(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionJumpZoom::onEnter() { CCTransitionScene::onEnter(); @@ -325,6 +377,32 @@ CCTransitionMoveInL::~CCTransitionMoveInL() { } +CCTransitionMoveInL* CCTransitionMoveInL::create(float t, CCScene* scene) +{ + CCTransitionMoveInL* pScene = new CCTransitionMoveInL(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionMoveInL* CCTransitionMoveInL::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionMoveInL* pScene = new CCTransitionMoveInL(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionMoveInL::onEnter() { CCTransitionScene::onEnter(); @@ -370,6 +448,32 @@ CCTransitionMoveInR::~CCTransitionMoveInR() { } +CCTransitionMoveInR* CCTransitionMoveInR::create(float t, CCScene* scene) +{ + CCTransitionMoveInR* pScene = new CCTransitionMoveInR(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionMoveInR* CCTransitionMoveInR::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionMoveInR* pScene = new CCTransitionMoveInR(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionMoveInR::initScenes() { CCSize s = CCDirector::sharedDirector()->getWinSize(); @@ -386,6 +490,32 @@ CCTransitionMoveInT::~CCTransitionMoveInT() { } +CCTransitionMoveInT* CCTransitionMoveInT::create(float t, CCScene* scene) +{ + CCTransitionMoveInT* pScene = new CCTransitionMoveInT(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionMoveInT* CCTransitionMoveInT::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionMoveInT* pScene = new CCTransitionMoveInT(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionMoveInT::initScenes() { CCSize s = CCDirector::sharedDirector()->getWinSize(); @@ -402,6 +532,32 @@ CCTransitionMoveInB::~CCTransitionMoveInB() { } +CCTransitionMoveInB* CCTransitionMoveInB::create(float t, CCScene* scene) +{ + CCTransitionMoveInB* pScene = new CCTransitionMoveInB(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionMoveInB* CCTransitionMoveInB::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionMoveInB* pScene = new CCTransitionMoveInB(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionMoveInB::initScenes() { CCSize s = CCDirector::sharedDirector()->getWinSize(); @@ -425,6 +581,32 @@ CCTransitionSlideInL::~CCTransitionSlideInL() { } +CCTransitionSlideInL* CCTransitionSlideInL::create(float t, CCScene* scene) +{ + CCTransitionSlideInL* pScene = new CCTransitionSlideInL(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSlideInL* CCTransitionSlideInL::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSlideInL* pScene = new CCTransitionSlideInL(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionSlideInL::onEnter() { CCTransitionScene::onEnter(); @@ -478,6 +660,32 @@ CCTransitionSlideInR::~CCTransitionSlideInR() { } +CCTransitionSlideInR* CCTransitionSlideInR::create(float t, CCScene* scene) +{ + CCTransitionSlideInR* pScene = new CCTransitionSlideInR(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSlideInR* CCTransitionSlideInR::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSlideInR* pScene = new CCTransitionSlideInR(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionSlideInR::sceneOrder() { m_bIsInSceneOnTop = true; @@ -507,6 +715,32 @@ CCTransitionSlideInT::~CCTransitionSlideInT() { } +CCTransitionSlideInT* CCTransitionSlideInT::create(float t, CCScene* scene) +{ + CCTransitionSlideInT* pScene = new CCTransitionSlideInT(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSlideInT* CCTransitionSlideInT::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSlideInT* pScene = new CCTransitionSlideInT(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionSlideInT::sceneOrder() { m_bIsInSceneOnTop = false; @@ -535,6 +769,32 @@ CCTransitionSlideInB::~CCTransitionSlideInB() { } +CCTransitionSlideInB* CCTransitionSlideInB::create(float t, CCScene* scene) +{ + CCTransitionSlideInB* pScene = new CCTransitionSlideInB(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSlideInB* CCTransitionSlideInB::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSlideInB* pScene = new CCTransitionSlideInB(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionSlideInB::sceneOrder() { m_bIsInSceneOnTop = true; @@ -563,6 +823,32 @@ CCTransitionShrinkGrow::~CCTransitionShrinkGrow() { } +CCTransitionShrinkGrow* CCTransitionShrinkGrow::create(float t, CCScene* scene) +{ + CCTransitionShrinkGrow* pScene = new CCTransitionShrinkGrow(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionShrinkGrow* CCTransitionShrinkGrow::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionShrinkGrow* pScene = new CCTransitionShrinkGrow(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + void CCTransitionShrinkGrow::onEnter() { CCTransitionScene::onEnter(); @@ -663,6 +949,11 @@ CCTransitionFlipX* CCTransitionFlipX::create(float t, CCScene* s, tOrientation o return pScene; } +CCTransitionFlipX* CCTransitionFlipX::create(float t, CCScene* s) +{ + return CCTransitionFlipX::create(t, s, kOrientationRightOver); +} + // // FlipY Transition // @@ -733,6 +1024,11 @@ CCTransitionFlipY* CCTransitionFlipY::create(float t, CCScene* s, tOrientation o return pScene; } +CCTransitionFlipY* CCTransitionFlipY::create(float t, CCScene* s) +{ + return CCTransitionFlipY::create(t, s, kOrientationUpOver); +} + // // FlipAngular Transition // @@ -803,6 +1099,11 @@ CCTransitionFlipAngular* CCTransitionFlipAngular::create(float t, CCScene* s, tO return pScene; } +CCTransitionFlipAngular* CCTransitionFlipAngular::create(float t, CCScene* s) +{ + return CCTransitionFlipAngular::create(t, s, kOrientationRightOver); +} + // // ZoomFlipX Transition // @@ -881,6 +1182,11 @@ CCTransitionZoomFlipX* CCTransitionZoomFlipX::create(float t, CCScene* s, tOrien return pScene; } +CCTransitionZoomFlipX* CCTransitionZoomFlipX::create(float t, CCScene* s) +{ + return CCTransitionZoomFlipX::create(t, s, kOrientationRightOver); +} + // // ZoomFlipY Transition // @@ -960,6 +1266,11 @@ CCTransitionZoomFlipY* CCTransitionZoomFlipY::create(float t, CCScene* s, tOrien return pScene; } +CCTransitionZoomFlipY* CCTransitionZoomFlipY::create(float t, CCScene* s) +{ + return CCTransitionZoomFlipY::create(t, s, kOrientationUpOver); +} + // // ZoomFlipAngular Transition // @@ -1041,6 +1352,11 @@ CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::create(float t, CCScen return pScene; } +CCTransitionZoomFlipAngular* CCTransitionZoomFlipAngular::create(float t, CCScene* s) +{ + return CCTransitionZoomFlipAngular::create(t, s, kOrientationRightOver); +} + // // Fade Transition // @@ -1064,6 +1380,11 @@ CCTransitionFade * CCTransitionFade::create(float duration, CCScene *scene, cons return pTransition; } +CCTransitionFade* CCTransitionFade::create(float duration,CCScene* scene) +{ + return CCTransitionFade::create(duration, scene, ccBLACK); +} + bool CCTransitionFade::initWithDuration(float duration, CCScene *scene, const ccColor3B& color) { if (CCTransitionScene::initWithDuration(duration, scene)) @@ -1119,6 +1440,31 @@ CCTransitionCrossFade::~CCTransitionCrossFade() { } +CCTransitionCrossFade* CCTransitionCrossFade::create(float t, CCScene* scene) +{ + CCTransitionCrossFade* pScene = new CCTransitionCrossFade(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionCrossFade* CCTransitionCrossFade::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionCrossFade* pScene = new CCTransitionCrossFade(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} void CCTransitionCrossFade:: draw() { @@ -1216,6 +1562,31 @@ CCTransitionTurnOffTiles::~CCTransitionTurnOffTiles() { } +CCTransitionTurnOffTiles* CCTransitionTurnOffTiles::create(float t, CCScene* scene) +{ + CCTransitionTurnOffTiles* pScene = new CCTransitionTurnOffTiles(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionTurnOffTiles* CCTransitionTurnOffTiles::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionTurnOffTiles* pScene = new CCTransitionTurnOffTiles(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} // override addScenes, and change the order void CCTransitionTurnOffTiles::sceneOrder() @@ -1261,6 +1632,31 @@ CCTransitionSplitCols::~CCTransitionSplitCols() { } +CCTransitionSplitCols* CCTransitionSplitCols::create(float t, CCScene* scene) +{ + CCTransitionSplitCols* pScene = new CCTransitionSplitCols(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSplitCols* CCTransitionSplitCols::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSplitCols* pScene = new CCTransitionSplitCols(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} void CCTransitionSplitCols::onEnter() { @@ -1311,6 +1707,31 @@ CCTransitionSplitRows::~CCTransitionSplitRows() { } +CCTransitionSplitRows* CCTransitionSplitRows::create(float t, CCScene* scene) +{ + CCTransitionSplitRows* pScene = new CCTransitionSplitRows(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionSplitRows* CCTransitionSplitRows::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionSplitRows* pScene = new CCTransitionSplitRows(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} CCActionInterval* CCTransitionSplitRows::action() { @@ -1327,6 +1748,31 @@ CCTransitionFadeTR::~CCTransitionFadeTR() { } +CCTransitionFadeTR* CCTransitionFadeTR::create(float t, CCScene* scene) +{ + CCTransitionFadeTR* pScene = new CCTransitionFadeTR(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionFadeTR* CCTransitionFadeTR::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionFadeTR* pScene = new CCTransitionFadeTR(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} void CCTransitionFadeTR::sceneOrder() { @@ -1379,6 +1825,32 @@ CCTransitionFadeBL::~CCTransitionFadeBL() { } +CCTransitionFadeBL* CCTransitionFadeBL::create(float t, CCScene* scene) +{ + CCTransitionFadeBL* pScene = new CCTransitionFadeBL(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionFadeBL* CCTransitionFadeBL::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionFadeBL* pScene = new CCTransitionFadeBL(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + CCActionInterval* CCTransitionFadeBL::actionWithSize(const ccGridSize& size) { return CCFadeOutBLTiles::create(size, m_fDuration); @@ -1394,6 +1866,32 @@ CCTransitionFadeUp::~CCTransitionFadeUp() { } +CCTransitionFadeUp* CCTransitionFadeUp::create(float t, CCScene* scene) +{ + CCTransitionFadeUp* pScene = new CCTransitionFadeUp(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionFadeUp* CCTransitionFadeUp::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionFadeUp* pScene = new CCTransitionFadeUp(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + CCActionInterval* CCTransitionFadeUp::actionWithSize(const ccGridSize& size) { return CCFadeOutUpTiles::create(size, m_fDuration); @@ -1409,6 +1907,32 @@ CCTransitionFadeDown::~CCTransitionFadeDown() { } +CCTransitionFadeDown* CCTransitionFadeDown::create(float t, CCScene* scene) +{ + CCTransitionFadeDown* pScene = new CCTransitionFadeDown(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionFadeDown* CCTransitionFadeDown::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionFadeDown* pScene = new CCTransitionFadeDown(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + CCActionInterval* CCTransitionFadeDown::actionWithSize(const ccGridSize& size) { return CCFadeOutDownTiles::create(size, m_fDuration); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.h b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.h index 38a9e525f8..b4c2f683b2 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransition.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransition.h @@ -41,32 +41,6 @@ NS_CC_BEGIN //c/c++ don't support object creation of using class name //so, all classes need creation method. -#define OLD_TRANSITION_CREATE_FUNC(_Type) \ - CC_DEPRECATED_ATTRIBUTE static _Type* transitionWithDuration(float t, CCScene* scene) \ - { \ - _Type* pScene = new _Type(); \ - if(pScene && pScene->initWithDuration(t, scene)) \ - { \ - pScene->autorelease(); \ - return pScene; \ - } \ - CC_SAFE_DELETE(pScene); \ - return NULL; \ - } - -#define TRANSITION_CREATE_FUNC(_Type) \ - static _Type* create(float t, CCScene* scene) \ - { \ - _Type* pScene = new _Type(); \ - if(pScene && pScene->initWithDuration(t, scene)) \ - { \ - pScene->autorelease(); \ - return pScene; \ - } \ - CC_SAFE_DELETE(pScene); \ - return NULL; \ - } - class CCActionInterval; class CCNode; @@ -174,8 +148,8 @@ public: virtual ~CCTransitionRotoZoom(); virtual void onEnter(); - TRANSITION_CREATE_FUNC(CCTransitionRotoZoom); - OLD_TRANSITION_CREATE_FUNC(CCTransitionRotoZoom); + CC_DEPRECATED_ATTRIBUTE static CCTransitionRotoZoom* transitionWithDuration(float t, CCScene* scene); + static CCTransitionRotoZoom* create(float t, CCScene* scene); }; /** @brief CCTransitionJumpZoom: @@ -188,8 +162,8 @@ public: virtual ~CCTransitionJumpZoom(); virtual void onEnter(); - TRANSITION_CREATE_FUNC(CCTransitionJumpZoom); - OLD_TRANSITION_CREATE_FUNC(CCTransitionJumpZoom); + CC_DEPRECATED_ATTRIBUTE static CCTransitionJumpZoom* transitionWithDuration(float t, CCScene* scene); + static CCTransitionJumpZoom* create(float t, CCScene* scene); }; /** @brief CCTransitionMoveInL: @@ -209,8 +183,8 @@ public: virtual void onEnter(); - TRANSITION_CREATE_FUNC(CCTransitionMoveInL); - OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInL); + CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInL* transitionWithDuration(float t, CCScene* scene); + static CCTransitionMoveInL* create(float t, CCScene* scene); }; /** @brief CCTransitionMoveInR: @@ -223,8 +197,8 @@ public: virtual ~CCTransitionMoveInR(); virtual void initScenes(); - TRANSITION_CREATE_FUNC(CCTransitionMoveInR); - OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInR); + CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInR* transitionWithDuration(float t, CCScene* scene); + static CCTransitionMoveInR* create(float t, CCScene* scene); }; /** @brief CCTransitionMoveInT: @@ -237,8 +211,8 @@ public: virtual ~CCTransitionMoveInT(); virtual void initScenes(); - TRANSITION_CREATE_FUNC(CCTransitionMoveInT); - OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInT); + CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInT* transitionWithDuration(float t, CCScene* scene); + static CCTransitionMoveInT* create(float t, CCScene* scene); }; /** @brief CCTransitionMoveInB: @@ -251,8 +225,8 @@ public: virtual ~CCTransitionMoveInB(); virtual void initScenes(); - TRANSITION_CREATE_FUNC(CCTransitionMoveInB); - OLD_TRANSITION_CREATE_FUNC(CCTransitionMoveInB); + CC_DEPRECATED_ATTRIBUTE static CCTransitionMoveInB* transitionWithDuration(float t, CCScene* scene); + static CCTransitionMoveInB* create(float t, CCScene* scene); }; /** @brief CCTransitionSlideInL: @@ -273,8 +247,8 @@ public: virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); - TRANSITION_CREATE_FUNC(CCTransitionSlideInL); - OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInL); + CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInL* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSlideInL* create(float t, CCScene* scene); protected: virtual void sceneOrder(); }; @@ -293,8 +267,8 @@ public: /** returns the action that will be performed by the incoming and outgoing scene */ virtual CCActionInterval* action(void); - TRANSITION_CREATE_FUNC(CCTransitionSlideInR); - OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInR); + CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInR* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSlideInR* create(float t, CCScene* scene); protected: virtual void sceneOrder(); }; @@ -313,8 +287,8 @@ public: /** returns the action that will be performed by the incoming and outgoing scene */ virtual CCActionInterval* action(void); - TRANSITION_CREATE_FUNC(CCTransitionSlideInB); - OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInB); + CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInB* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSlideInB* create(float t, CCScene* scene); protected: virtual void sceneOrder(); }; @@ -333,8 +307,8 @@ public: /** returns the action that will be performed by the incoming and outgoing scene */ virtual CCActionInterval* action(void); - TRANSITION_CREATE_FUNC(CCTransitionSlideInT); - OLD_TRANSITION_CREATE_FUNC(CCTransitionSlideInT); + CC_DEPRECATED_ATTRIBUTE static CCTransitionSlideInT* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSlideInT* create(float t, CCScene* scene); protected: virtual void sceneOrder(); }; @@ -351,8 +325,8 @@ public: virtual void onEnter(); virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); - TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow); - OLD_TRANSITION_CREATE_FUNC(CCTransitionShrinkGrow); + CC_DEPRECATED_ATTRIBUTE static CCTransitionShrinkGrow* transitionWithDuration(float t, CCScene* scene); + static CCTransitionShrinkGrow* create(float t, CCScene* scene); }; /** @brief CCTransitionFlipX: @@ -370,9 +344,7 @@ public: // @deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver); static CCTransitionFlipX* create(float t, CCScene* s, tOrientation o); - static CCTransitionFlipX* create(float t, CCScene* s) { - return CCTransitionFlipX::create(t, s, kOrientationRightOver); - } + static CCTransitionFlipX* create(float t, CCScene* s); }; /** @brief CCTransitionFlipY: @@ -390,9 +362,7 @@ public: //@deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver); static CCTransitionFlipY* create(float t, CCScene* s, tOrientation o); - static CCTransitionFlipY* create(float t, CCScene* s) { - return CCTransitionFlipY::create(t, s, kOrientationUpOver); - } + static CCTransitionFlipY* create(float t, CCScene* s); }; /** @brief CCTransitionFlipAngular: @@ -410,9 +380,7 @@ public: //@deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver); static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientation o); - static CCTransitionFlipAngular* create(float t, CCScene* s) { - return CCTransitionFlipAngular::create(t, s, kOrientationRightOver); - } + static CCTransitionFlipAngular* create(float t, CCScene* s); }; /** @brief CCTransitionZoomFlipX: @@ -430,9 +398,7 @@ public: //@deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipX* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver); static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation o); - static CCTransitionZoomFlipX* create(float t, CCScene* s) { - return CCTransitionZoomFlipX::create(t, s, kOrientationRightOver); - } + static CCTransitionZoomFlipX* create(float t, CCScene* s); }; /** @brief CCTransitionZoomFlipY: @@ -450,9 +416,7 @@ public: //@deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipY* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationUpOver); static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation o); - static CCTransitionZoomFlipY* create(float t, CCScene* s) { - return CCTransitionZoomFlipY::create(t, s, kOrientationUpOver); - } + static CCTransitionZoomFlipY* create(float t, CCScene* s); }; /** @brief CCTransitionZoomFlipAngular: @@ -470,9 +434,7 @@ public: //@deprecated: This interface will be deprecated sooner or later. CC_DEPRECATED_ATTRIBUTE static CCTransitionZoomFlipAngular* transitionWithDuration(float t, CCScene* s, tOrientation o = kOrientationRightOver); static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrientation o); - static CCTransitionZoomFlipAngular* create(float t, CCScene* s) { - return CCTransitionZoomFlipAngular::create(t, s, kOrientationRightOver); - } + static CCTransitionZoomFlipAngular* create(float t, CCScene* s); }; /** @brief CCTransitionFade: @@ -498,9 +460,7 @@ public: * Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color */ static CCTransitionFade* create(float duration,CCScene* scene, const ccColor3B& color); - static CCTransitionFade* create(float duration,CCScene* scene) { - return CCTransitionFade::create(duration, scene, ccBLACK); - } + static CCTransitionFade* create(float duration,CCScene* scene); /** initializes the transition with a duration and with an RGB color */ virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color); @@ -526,8 +486,8 @@ public : virtual void onExit(); public: - TRANSITION_CREATE_FUNC(CCTransitionCrossFade); - OLD_TRANSITION_CREATE_FUNC(CCTransitionCrossFade); + CC_DEPRECATED_ATTRIBUTE static CCTransitionCrossFade* transitionWithDuration(float t, CCScene* scene); + static CCTransitionCrossFade* create(float t, CCScene* scene); }; /** @brief CCTransitionTurnOffTiles: @@ -543,8 +503,8 @@ public : virtual CCActionInterval * easeActionWithAction(CCActionInterval * action); public: - TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles); - OLD_TRANSITION_CREATE_FUNC(CCTransitionTurnOffTiles); + CC_DEPRECATED_ATTRIBUTE static CCTransitionTurnOffTiles* transitionWithDuration(float t, CCScene* scene); + static CCTransitionTurnOffTiles* create(float t, CCScene* scene); protected: virtual void sceneOrder(); }; @@ -563,8 +523,8 @@ public: virtual CCActionInterval * easeActionWithAction(CCActionInterval * action); public: - TRANSITION_CREATE_FUNC(CCTransitionSplitCols); - OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitCols); + CC_DEPRECATED_ATTRIBUTE static CCTransitionSplitCols* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSplitCols* create(float t, CCScene* scene); }; /** @brief CCTransitionSplitRows: @@ -579,8 +539,8 @@ public: virtual CCActionInterval* action(void); public: - TRANSITION_CREATE_FUNC(CCTransitionSplitRows) - OLD_TRANSITION_CREATE_FUNC(CCTransitionSplitRows) + CC_DEPRECATED_ATTRIBUTE static CCTransitionSplitRows* transitionWithDuration(float t, CCScene* scene); + static CCTransitionSplitRows* create(float t, CCScene* scene); }; /** @brief CCTransitionFadeTR: @@ -596,11 +556,10 @@ public: virtual CCActionInterval* easeActionWithAction(CCActionInterval * action); public: - TRANSITION_CREATE_FUNC(CCTransitionFadeTR) - OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeTR) + CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeTR* transitionWithDuration(float t, CCScene* scene); + static CCTransitionFadeTR* create(float t, CCScene* scene); protected: virtual void sceneOrder(); - }; /** @brief CCTransitionFadeBL: @@ -614,8 +573,8 @@ public: virtual CCActionInterval* actionWithSize(const ccGridSize& size); public: - TRANSITION_CREATE_FUNC(CCTransitionFadeBL) - OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeBL) + CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeBL* transitionWithDuration(float t, CCScene* scene); + static CCTransitionFadeBL* create(float t, CCScene* scene); }; /** @brief CCTransitionFadeUp: @@ -629,8 +588,8 @@ public: virtual CCActionInterval* actionWithSize(const ccGridSize& size); public: - TRANSITION_CREATE_FUNC(CCTransitionFadeUp) - OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeUp) + CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeUp* transitionWithDuration(float t, CCScene* scene); + static CCTransitionFadeUp* create(float t, CCScene* scene); }; /** @brief CCTransitionFadeDown: @@ -644,8 +603,8 @@ public: virtual CCActionInterval* actionWithSize(const ccGridSize& size); public: - TRANSITION_CREATE_FUNC(CCTransitionFadeDown) - OLD_TRANSITION_CREATE_FUNC(CCTransitionFadeDown) + CC_DEPRECATED_ATTRIBUTE static CCTransitionFadeDown* transitionWithDuration(float t, CCScene* scene); + static CCTransitionFadeDown* create(float t, CCScene* scene); }; // end of transition group diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp index 06b75864dc..e56641d20e 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp @@ -48,6 +48,32 @@ CCTransitionProgress::CCTransitionProgress() } +CCTransitionProgress* CCTransitionProgress::create(float t, CCScene* scene) +{ + CCTransitionProgress* pScene = new CCTransitionProgress(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgress* CCTransitionProgress::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgress* pScene = new CCTransitionProgress(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + // CCTransitionProgress void CCTransitionProgress::onEnter() { @@ -140,7 +166,58 @@ CCProgressTimer* CCTransitionProgressRadialCCW::progressTimerNodeWithRenderTextu return pNode; } +CCTransitionProgressRadialCCW* CCTransitionProgressRadialCCW::create(float t, CCScene* scene) +{ + CCTransitionProgressRadialCCW* pScene = new CCTransitionProgressRadialCCW(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressRadialCCW* CCTransitionProgressRadialCCW::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressRadialCCW* pScene = new CCTransitionProgressRadialCCW(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + // CCTransitionProgressRadialCW +CCTransitionProgressRadialCW* CCTransitionProgressRadialCW::create(float t, CCScene* scene) +{ + CCTransitionProgressRadialCW* pScene = new CCTransitionProgressRadialCW(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressRadialCW* CCTransitionProgressRadialCW::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressRadialCW* pScene = new CCTransitionProgressRadialCW(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTexture(CCRenderTexture* texture) { @@ -162,6 +239,31 @@ CCProgressTimer* CCTransitionProgressRadialCW::progressTimerNodeWithRenderTextur } // CCTransitionProgressHorizontal +CCTransitionProgressHorizontal* CCTransitionProgressHorizontal::create(float t, CCScene* scene) +{ + CCTransitionProgressHorizontal* pScene = new CCTransitionProgressHorizontal(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressHorizontal* CCTransitionProgressHorizontal::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressHorizontal* pScene = new CCTransitionProgressHorizontal(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} CCProgressTimer* CCTransitionProgressHorizontal::progressTimerNodeWithRenderTexture(CCRenderTexture* texture) { @@ -184,6 +286,31 @@ CCProgressTimer* CCTransitionProgressHorizontal::progressTimerNodeWithRenderText } // CCTransitionProgressVertical +CCTransitionProgressVertical* CCTransitionProgressVertical::create(float t, CCScene* scene) +{ + CCTransitionProgressVertical* pScene = new CCTransitionProgressVertical(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressVertical* CCTransitionProgressVertical::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressVertical* pScene = new CCTransitionProgressVertical(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} CCProgressTimer* CCTransitionProgressVertical::progressTimerNodeWithRenderTexture(CCRenderTexture* texture) { @@ -207,6 +334,31 @@ CCProgressTimer* CCTransitionProgressVertical::progressTimerNodeWithRenderTextur // CCTransitionProgressInOut +CCTransitionProgressInOut* CCTransitionProgressInOut::create(float t, CCScene* scene) +{ + CCTransitionProgressInOut* pScene = new CCTransitionProgressInOut(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressInOut* CCTransitionProgressInOut::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressInOut* pScene = new CCTransitionProgressInOut(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} void CCTransitionProgressInOut::sceneOrder() { @@ -242,6 +394,31 @@ CCProgressTimer* CCTransitionProgressInOut::progressTimerNodeWithRenderTexture(C // CCTransitionProgressOutIn +CCTransitionProgressOutIn* CCTransitionProgressOutIn::create(float t, CCScene* scene) +{ + CCTransitionProgressOutIn* pScene = new CCTransitionProgressOutIn(); + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} + + +CCTransitionProgressOutIn* CCTransitionProgressOutIn::transitionWithDuration(float t, CCScene* scene) +{ + CCTransitionProgressOutIn* pScene = new CCTransitionProgressOutIn(); + + if(pScene && pScene->initWithDuration(t, scene)) + { + pScene->autorelease(); + return pScene; + } + CC_SAFE_DELETE(pScene); + return NULL; +} CCProgressTimer* CCTransitionProgressOutIn::progressTimerNodeWithRenderTexture(CCRenderTexture* texture) { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h index 5bbf0ce856..65dcf3a928 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.h @@ -42,8 +42,8 @@ class CCRenderTexture; class CC_DLL CCTransitionProgress : public CCTransitionScene { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgress) - TRANSITION_CREATE_FUNC(CCTransitionProgress) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgress* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgress* create(float t, CCScene* scene); CCTransitionProgress(); virtual void onEnter(); @@ -64,8 +64,8 @@ protected: class CC_DLL CCTransitionProgressRadialCCW : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) - TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressRadialCCW* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressRadialCCW* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); @@ -78,8 +78,8 @@ protected: class CC_DLL CCTransitionProgressRadialCW : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) - TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCW) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressRadialCW* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressRadialCW* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); @@ -91,8 +91,8 @@ protected: class CC_DLL CCTransitionProgressHorizontal : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) - TRANSITION_CREATE_FUNC(CCTransitionProgressHorizontal) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressHorizontal* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressHorizontal* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); @@ -101,8 +101,8 @@ protected: class CC_DLL CCTransitionProgressVertical : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressVertical) - TRANSITION_CREATE_FUNC(CCTransitionProgressVertical) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressVertical* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressVertical* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); @@ -111,8 +111,8 @@ protected: class CC_DLL CCTransitionProgressInOut : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressInOut) - TRANSITION_CREATE_FUNC(CCTransitionProgressInOut) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressInOut* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressInOut* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); virtual void sceneOrder(); @@ -122,8 +122,8 @@ protected: class CC_DLL CCTransitionProgressOutIn : public CCTransitionProgress { public: - OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressOutIn) - TRANSITION_CREATE_FUNC(CCTransitionProgressOutIn) + CC_DEPRECATED_ATTRIBUTE static CCTransitionProgressOutIn* transitionWithDuration(float t, CCScene* scene); + static CCTransitionProgressOutIn* create(float t, CCScene* scene); protected: virtual CCProgressTimer* progressTimerNodeWithRenderTexture(CCRenderTexture* texture); From 0ace12fc520a68d13fee1f46985774f9b75e0063 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 1 Nov 2012 22:17:12 +0800 Subject: [PATCH 80/95] issue #1526: Moved implementations of static functions in CCParticleExample.h, CCLayer.h to CCParticleExample.cpp, CCLayer.cpp. --- .../CCLayer.cpp | 58 +++++ .../layers_scenes_transitions_nodes/CCLayer.h | 24 +- .../particle_nodes/CCParticleExamples.cpp | 219 ++++++++++++++++++ cocos2dx/particle_nodes/CCParticleExamples.h | 212 ++++------------- 4 files changed, 334 insertions(+), 179 deletions(-) diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index a670abb7ec..ffcfc94d84 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -500,6 +500,25 @@ void CCLayerColor::setBlendFunc(ccBlendFunc var) m_tBlendFunc = var; } +CCLayerColor* CCLayerColor::node() +{ + return CCLayerColor::create(); +} + +CCLayerColor* CCLayerColor::create() +{ + CCLayerColor* pRet = new CCLayerColor(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + CCLayerColor * CCLayerColor::layerWithColor(const ccColor4B& color, GLfloat width, GLfloat height) { return CCLayerColor::create(color,width,height); @@ -667,6 +686,25 @@ CCLayerGradient* CCLayerGradient::create(const ccColor4B& start, const ccColor4B return NULL; } +CCLayerGradient* CCLayerGradient::node() +{ + return CCLayerGradient::create(); +} + +CCLayerGradient* CCLayerGradient::create() +{ + CCLayerGradient* pRet = new CCLayerGradient(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCLayerGradient::init() { return initWithColor(ccc4(0, 0, 0, 255), ccc4(0, 0, 0, 255)); @@ -869,6 +907,26 @@ CCLayerMultiplex * CCLayerMultiplex::createWithLayer(CCLayer* layer) return CCLayerMultiplex::create(layer, NULL); } +CCLayerMultiplex* CCLayerMultiplex::node() +{ + return CCLayerMultiplex::create(); +} + +CCLayerMultiplex* CCLayerMultiplex::create() +{ + CCLayerMultiplex* pRet = new CCLayerMultiplex(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + + void CCLayerMultiplex::addLayer(CCLayer* layer) { CCAssert(m_pLayers, ""); diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index e166ff8c8a..01846abdf4 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -182,6 +182,11 @@ public: */ CC_DEPRECATED_ATTRIBUTE static CCLayerColor * layerWithColor(const ccColor4B& color); + //@deprecated: This interface will be deprecated sooner or later. + static CCLayerColor* node(); + + static CCLayerColor* create(); + /** creates a CCLayer with color, width and height in Points */ static CCLayerColor * create(const ccColor4B& color, GLfloat width, GLfloat height); /** creates a CCLayer with color. Width and height are the window size. */ @@ -211,9 +216,8 @@ public: virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual bool isOpacityModifyRGB(void) { return false;} - //@deprecated: This interface will be deprecated sooner or later. - CREATE_FUNC(CCLayerColor) - NODE_FUNC(CCLayerColor) + + protected: virtual void updateColor(); }; @@ -284,9 +288,11 @@ public: virtual void setCompressedInterpolation(bool bCompressedInterpolation); virtual bool isCompressedInterpolation(); - // @deprecated: This interface will be deprecated sooner or later. - NODE_FUNC(CCLayerGradient) - CREATE_FUNC(CCLayerGradient) + //@deprecated: This interface will be deprecated sooner or later. + static CCLayerGradient* node(); + + static CCLayerGradient* create(); + protected: virtual void updateColor(); }; @@ -341,9 +347,9 @@ public: void switchToAndReleaseMe(unsigned int n); //@deprecated: This interface will be deprecated sooner or later. - NODE_FUNC(CCLayerMultiplex) - - CREATE_FUNC(CCLayerMultiplex) + static CCLayerMultiplex* node(); + + static CCLayerMultiplex* create(); }; diff --git a/cocos2dx/particle_nodes/CCParticleExamples.cpp b/cocos2dx/particle_nodes/CCParticleExamples.cpp index c13c74623e..84459adbd6 100644 --- a/cocos2dx/particle_nodes/CCParticleExamples.cpp +++ b/cocos2dx/particle_nodes/CCParticleExamples.cpp @@ -32,6 +32,26 @@ NS_CC_BEGIN // // ParticleFire // + +CCParticleFire* CCParticleFire::node() +{ + return CCParticleFire::create(); +} + +CCParticleFire* CCParticleFire::create() +{ + CCParticleFire* pRet = new CCParticleFire(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleFire::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -102,6 +122,25 @@ bool CCParticleFire::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleFireworks // +CCParticleFireworks* CCParticleFireworks::node() +{ + return CCParticleFireworks::create(); +} + +CCParticleFireworks* CCParticleFireworks::create() +{ + CCParticleFireworks* pRet = new CCParticleFireworks(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -170,6 +209,26 @@ bool CCParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleSun // + +CCParticleSun* CCParticleSun::node() +{ + return CCParticleSun::create(); +} + +CCParticleSun* CCParticleSun::create() +{ + CCParticleSun* pRet = new CCParticleSun(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleSun::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -242,6 +301,26 @@ bool CCParticleSun::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleGalaxy // + +CCParticleGalaxy* CCParticleGalaxy::node() +{ + return CCParticleGalaxy::create(); +} + +CCParticleGalaxy* CCParticleGalaxy::create() +{ + CCParticleGalaxy* pRet = new CCParticleGalaxy(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -316,6 +395,26 @@ bool CCParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleFlower // + +CCParticleFlower* CCParticleFlower::node() +{ + return CCParticleFlower::create(); +} + +CCParticleFlower* CCParticleFlower::create() +{ + CCParticleFlower* pRet = new CCParticleFlower(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleFlower::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -389,6 +488,26 @@ bool CCParticleFlower::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleMeteor // + +CCParticleMeteor * CCParticleMeteor::node() +{ + return create(); +} + +CCParticleMeteor * CCParticleMeteor::create() +{ + CCParticleMeteor *pRet = new CCParticleMeteor(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -463,6 +582,26 @@ bool CCParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleSpiral // + +CCParticleSpiral* CCParticleSpiral::node() +{ + return CCParticleSpiral::create(); +} + +CCParticleSpiral* CCParticleSpiral::create() +{ + CCParticleSpiral* pRet = new CCParticleSpiral(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -537,6 +676,26 @@ bool CCParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleExplosion // + +CCParticleExplosion* CCParticleExplosion::node() +{ + return CCParticleExplosion::create(); +} + +CCParticleExplosion* CCParticleExplosion::create() +{ + CCParticleExplosion* pRet = new CCParticleExplosion(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -610,6 +769,26 @@ bool CCParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles) // // ParticleSmoke // + +CCParticleSmoke* CCParticleSmoke::node() +{ + return CCParticleSmoke::create(); +} + +CCParticleSmoke* CCParticleSmoke::create() +{ + CCParticleSmoke* pRet = new CCParticleSmoke(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -676,9 +855,30 @@ bool CCParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles) } return false; } + // // CCParticleSnow // + +CCParticleSnow* CCParticleSnow::node() +{ + return CCParticleSnow::create(); +} + +CCParticleSnow* CCParticleSnow::create() +{ + CCParticleSnow* pRet = new CCParticleSnow(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleSnow::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) @@ -752,6 +952,25 @@ bool CCParticleSnow::initWithTotalParticles(unsigned int numberOfParticles) // // CCParticleRain // +CCParticleRain* CCParticleRain::node() +{ + return CCParticleRain::create(); +} + +CCParticleRain* CCParticleRain::create() +{ + CCParticleRain* pRet = new CCParticleRain(); + if (pRet && pRet->init()) + { + pRet->autorelease(); + } + else + { + CC_SAFE_DELETE(pRet); + } + return pRet; +} + bool CCParticleRain::initWithTotalParticles(unsigned int numberOfParticles) { if( CCParticleSystemQuad::initWithTotalParticles(numberOfParticles) ) diff --git a/cocos2dx/particle_nodes/CCParticleExamples.h b/cocos2dx/particle_nodes/CCParticleExamples.h index c6b91847b8..1e40fef80b 100644 --- a/cocos2dx/particle_nodes/CCParticleExamples.h +++ b/cocos2dx/particle_nodes/CCParticleExamples.h @@ -43,22 +43,10 @@ public: virtual ~CCParticleFire(){} bool init(){ return initWithTotalParticles(250); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleFire * node() - { - return create(); - } - - static CCParticleFire * create() - { - CCParticleFire *pRet = new CCParticleFire(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleFire* node(); + + static CCParticleFire* create(); }; //! @brief A fireworks particle system @@ -69,22 +57,10 @@ public: virtual ~CCParticleFireworks(){} bool init(){ return initWithTotalParticles(1500); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleFireworks * node() - { - return create(); - } - - static CCParticleFireworks * create() - { - CCParticleFireworks *pRet = new CCParticleFireworks(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleFireworks* node(); + + static CCParticleFireworks* create(); }; //! @brief A sun particle system @@ -95,21 +71,10 @@ public: virtual ~CCParticleSun(){} bool init(){ return initWithTotalParticles(350); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleSun * node() - { - return create(); - } - static CCParticleSun * create() - { - CCParticleSun *pRet = new CCParticleSun(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleSun* node(); + + static CCParticleSun* create(); }; //! @brief A galaxy particle system @@ -120,22 +85,10 @@ public: virtual ~CCParticleGalaxy(){} bool init(){ return initWithTotalParticles(200); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleGalaxy * node() - { - return create(); - } - - static CCParticleGalaxy * create() - { - CCParticleGalaxy *pRet = new CCParticleGalaxy(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleGalaxy* node(); + + static CCParticleGalaxy* create(); }; //! @brief A flower particle system @@ -146,22 +99,10 @@ public: virtual ~CCParticleFlower(){} bool init(){ return initWithTotalParticles(250); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleFlower * node() - { - return create(); - } - - static CCParticleFlower * create() - { - CCParticleFlower *pRet = new CCParticleFlower(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleFlower* node(); + + static CCParticleFlower* create(); }; //! @brief A meteor particle system @@ -172,21 +113,8 @@ public: virtual ~CCParticleMeteor(){} bool init(){ return initWithTotalParticles(150); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleMeteor * node() - { - return create(); - } - static CCParticleMeteor * create() - { - CCParticleMeteor *pRet = new CCParticleMeteor(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + CC_DEPRECATED_ATTRIBUTE static CCParticleMeteor * node(); + static CCParticleMeteor * create(); }; //! @brief An spiral particle system @@ -197,21 +125,10 @@ public: virtual ~CCParticleSpiral(){} bool init(){ return initWithTotalParticles(500); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleSpiral * node() - { - return create(); - } - static CCParticleSpiral * create() - { - CCParticleSpiral *pRet = new CCParticleSpiral(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleSpiral* node(); + + static CCParticleSpiral* create(); }; //! @brief An explosion particle system @@ -222,21 +139,10 @@ public: virtual ~CCParticleExplosion(){} bool init(){ return initWithTotalParticles(700); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleExplosion * node() - { - return create(); - } - static CCParticleExplosion * create() - { - CCParticleExplosion *pRet = new CCParticleExplosion(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleExplosion* node(); + + static CCParticleExplosion* create(); }; //! @brief An smoke particle system @@ -247,21 +153,10 @@ public: virtual ~CCParticleSmoke(){} bool init(){ return initWithTotalParticles(200); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleSmoke * node() - { - return create(); - } - static CCParticleSmoke * create() - { - CCParticleSmoke *pRet = new CCParticleSmoke(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleSmoke* node(); + + static CCParticleSmoke* create(); }; //! @brief An snow particle system @@ -272,22 +167,10 @@ public: virtual ~CCParticleSnow(){} bool init(){ return initWithTotalParticles(700); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleSnow * node() - { - return create(); - } - - static CCParticleSnow * create() - { - CCParticleSnow *pRet = new CCParticleSnow(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleSnow* node(); + + static CCParticleSnow* create(); }; //! @brief A rain particle system @@ -298,21 +181,10 @@ public: virtual ~CCParticleRain(){} bool init(){ return initWithTotalParticles(1000); } virtual bool initWithTotalParticles(unsigned int numberOfParticles); - static CCParticleRain * node() - { - return create(); - } - static CCParticleRain * create() - { - CCParticleRain *pRet = new CCParticleRain(); - if (pRet->init()) - { - pRet->autorelease(); - return pRet; - } - CC_SAFE_DELETE(pRet); - return NULL; - } + //@deprecated: This interface will be deprecated sooner or later. + CC_DEPRECATED_ATTRIBUTE static CCParticleRain* node(); + + static CCParticleRain* create(); }; // end of particle_nodes group From 09248f366764046b67db4e1f9b51ad2c5f54aa54 Mon Sep 17 00:00:00 2001 From: Rohan Kuruvilla Date: Thu, 1 Nov 2012 17:52:07 -0700 Subject: [PATCH 81/95] Updating CCBReader to latest version from cocos2d-iphone. Includes support for script callbacks --- extensions/CCBReader/CCBAnimationManager.cpp | 51 ++++++ extensions/CCBReader/CCBAnimationManager.h | 19 ++- extensions/CCBReader/CCBReader.cpp | 37 +++-- extensions/CCBReader/CCBReader.h | 24 +-- extensions/CCBReader/CCNodeLoader.cpp | 159 ++++++++++--------- 5 files changed, 192 insertions(+), 98 deletions(-) diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index 099ea069a2..a6fd668250 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -93,6 +93,52 @@ void CCBAnimationManager::setRootNode(CCNode *pRootNode) CC_SAFE_RETAIN(mRootNode); } +void CCBAnimationManager::setDocumentControllerName(const std::string &name) { + mDocumentControllerName = name; +} + + +std::string CCBAnimationManager::getDocumentControllerName() { + return mDocumentControllerName; +} + +void CCBAnimationManager::addDocumentCallbackNode(CCNode *node) { + mDocumentCallbackNodes->addObject(node); +} + +void CCBAnimationManager::addDocumentCallbackName(std::string name) { + CCString *tmpName = CCString::create(name); + mDocumentCallbackNames->addObject(tmpName); +} + +CCArray* CCBAnimationManager::getDocumentCallbackNames() { + return mDocumentCallbackNames; +} + +CCArray* CCBAnimationManager::getDocumentCallbackNodes() { + return mDocumentCallbackNodes; +} + +void CCBAnimationManager::addDocumentOutletNode(CCNode *node) { + mDocumentOutletNodes->addObject(node); +} + +void CCBAnimationManager::addDocumentOutletName(std::string name) { + mDocumentOutletNames->addObject(CCString::create(name)); +} + +CCArray* CCBAnimationManager::getDocumentOutletNames() { + return mDocumentOutletNames; +} + +CCArray* CCBAnimationManager::getDocumentOutletNodes() { + return mDocumentOutletNodes; +} + +std::string CCBAnimationManager::getLastCompletedSequenceName() { + return lastCompletedSequenceName; +} + const CCSize& CCBAnimationManager::getRootContainerSize() { return mRootContainerSize; @@ -592,6 +638,11 @@ void CCBAnimationManager::setAnimationCompletedCallback(CCObject *target, SEL_Ca void CCBAnimationManager::sequenceCompleted() { + + if(lastCompletedSequenceName != mRunningSequence->getName()) { + lastCompletedSequenceName = mRunningSequence->getName(); + } + if (mDelegate) { mDelegate->completedAnimationSequenceNamed(mRunningSequence->getName()); diff --git a/extensions/CCBReader/CCBAnimationManager.h b/extensions/CCBReader/CCBAnimationManager.h index ff7b96f857..415e884e0f 100644 --- a/extensions/CCBReader/CCBAnimationManager.h +++ b/extensions/CCBReader/CCBAnimationManager.h @@ -35,6 +35,7 @@ private: CCArray *mDocumentCallbackNodes; std::string mDocumentControllerName; std::string lastCompletedSequenceName; + SEL_CallFunc mAnimationCompleteCallbackFunc; CCObject *mTarget; @@ -50,7 +51,23 @@ public: void setAutoPlaySequenceId(int autoPlaySequenceId); CCNode* getRootNode(); - void setRootNode(CCNode* pRootNode); // retain + void setRootNode(CCNode* pRootNode); // retain + + + void addDocumentCallbackNode(CCNode *node); + void addDocumentCallbackName(std::string name); + void addDocumentOutletNode(CCNode *node); + void addDocumentOutletName(std::string name); + + void setDocumentControllerName(const std::string &name); + + std::string getDocumentControllerName(); + CCArray* getDocumentCallbackNames(); + CCArray* getDocumentCallbackNodes(); + CCArray* getDocumentOutletNames(); + CCArray* getDocumentOutletNodes(); + std::string getLastCompletedSequenceName(); + const CCSize& getRootContainerSize(); void setRootContainerSize(const CCSize &rootContainerSize); diff --git a/extensions/CCBReader/CCBReader.cpp b/extensions/CCBReader/CCBReader.cpp index 0ac2719021..59cbf6fe41 100644 --- a/extensions/CCBReader/CCBReader.cpp +++ b/extensions/CCBReader/CCBReader.cpp @@ -234,7 +234,7 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const mOwnerOutletNames = CCArray::create(); mOwnerOutletNodes = CCArray::create(); - + mOwnerCallbackNames = CCArray::create(); mOwnerCallbackNodes = CCArray::create(); @@ -313,6 +313,8 @@ bool CCBReader::readHeader() { return false; } + jsControlled = this->readBool(); + return true; } @@ -345,13 +347,9 @@ CCNode* CCBReader::readFileWithCleanUp(bool bCleanUp) } CCNode *pNode = readNodeGraph(); -<<<<<<< HEAD - -======= mAnimationManagers.push_back(std::make_pair(pNode, mActionManager)); ->>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader if (bCleanUp) { cleanUpNodeGraph(pNode); @@ -489,6 +487,12 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { /* Read class name. */ CCString * className = this->readCachedString(); + CCString * jsControlledName; + + if(jsControlled) { + jsControlledName = this->readCachedString(); + } + // Read assignment type and name int memberVarAssignmentType = this->readInt(false); CCString * memberVarAssignmentName; @@ -511,13 +515,10 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { mActionManager->setRootNode(node); } -<<<<<<< HEAD -======= if(jsControlled && node == mActionManager->getRootNode()) { mActionManager->setDocumentControllerName(jsControlledName->getCString()); } - ->>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader + // Read animated properties CCDictionary *seqs = CCDictionary::create(); mAnimatedProps = new set(); @@ -573,7 +574,7 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { embeddedNode->setScale(ccbFileNode->getScale()); embeddedNode->setTag(ccbFileNode->getTag()); embeddedNode->setVisible(true); - //embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition()); + embeddedNode->ignoreAnchorPointForPosition(ccbFileNode->isIgnoreAnchorPointForPosition()); mActionManager->moveAnimationsFromNode(ccbFileNode, embeddedNode); @@ -590,6 +591,7 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { }*/ #else if(memberVarAssignmentType != kCCBTargetTypeNone) { + if(!jsControlled) { CCObject * target = NULL; if(memberVarAssignmentType == kCCBTargetTypeDocumentRoot) { @@ -613,6 +615,15 @@ CCNode * CCBReader::readNodeGraph(CCNode * pParent) { this->mCCBMemberVariableAssigner->onAssignCCBMemberVariable(target, memberVarAssignmentName, node); } } + } else { + if(memberVarAssignmentType == kCCBTargetTypeDocumentRoot) { + mActionManager->addDocumentOutletName(memberVarAssignmentName->getCString()); + mActionManager->addDocumentOutletNode(node); + } else { + mOwnerOutletNames->addObject(CCString::create(memberVarAssignmentName->getCString())); + mOwnerOutletNodes->addObject(node); + } + } } #endif // CCB_ENABLE_JAVASCRIPT @@ -798,8 +809,6 @@ bool CCBReader::endsWith(CCString * pString, CCString * pEnding) { } } -<<<<<<< HEAD -======= bool CCBReader::isJSControlled() { return jsControlled; } @@ -842,7 +851,7 @@ CCArray* CCBReader::getNodesWithAnimationManagers() { return mNodesWithAnimationManagers; } -CCArray* CCBReader::getAnimationManagerForNodes() { +CCArray* CCBReader::getAnimationManagersForNodes() { return mAnimationManagerForNodes; } @@ -854,8 +863,6 @@ void CCBReader::setAnimationManagers(std::vector>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader /************************************************************************ Static functions ************************************************************************/ diff --git a/extensions/CCBReader/CCBReader.h b/extensions/CCBReader/CCBReader.h index d9c462e25e..4229b91ca9 100644 --- a/extensions/CCBReader/CCBReader.h +++ b/extensions/CCBReader/CCBReader.h @@ -26,7 +26,7 @@ return NULL; \ } -#define kCCBVersion 3 +#define kCCBVersion 4 enum { kCCBPropTypePosition = 0, @@ -166,6 +166,8 @@ class CCBKeyframe; class CCBReader : public CCObject { private: + + bool jsControlled; CCData *mData; unsigned char *mBytes; int mCurrentByte; @@ -179,13 +181,21 @@ private: CCBAnimationManager *mActionManager; std::vector > mAnimationManagers; - std::set *mAnimatedProps; CCNodeLoaderLibrary *mCCNodeLoaderLibrary; CCNodeLoaderListener *mCCNodeLoaderListener; CCBMemberVariableAssigner *mCCBMemberVariableAssigner; - CCBSelectorResolver *mCCBSelectorResolver; + CCBSelectorResolver *mCCBSelectorResolver; + + CCArray* mOwnerOutletNames; + CCArray* mOwnerOutletNodes; + CCArray* mNodesWithAnimationManagers; + CCArray* mAnimationManagerForNodes; + + CCArray* mOwnerCallbackNames; + CCArray* mOwnerCallbackNodes; + public: CCBReader(CCNodeLoaderLibrary *pCCNodeLoaderLibrary, CCBMemberVariableAssigner *pCCBMemberVariableAssigner = NULL, CCBSelectorResolver *pCCBSelectorResolver = NULL, CCNodeLoaderListener *pCCNodeLoaderListener = NULL); @@ -234,8 +244,6 @@ public: bool readBool(); float readFloat(); CCString* readCachedString(); -<<<<<<< HEAD -======= bool isJSControlled(); @@ -244,18 +252,16 @@ public: CCArray* getOwnerOutletNames(); CCArray* getOwnerOutletNodes(); CCArray* getNodesWithAnimationManagers(); - CCArray* getAnimationManagerForNodes(); + CCArray* getAnimationManagersForNodes(); + std::vector > getAnimationManagers(); void setAnimationManagers(std::vector > x); - - void addOwnerCallbackName(std::string name); void addOwnerCallbackNode(CCNode *node); void addDocumentCallbackName(std::string name); void addDocumentCallbackNode(CCNode *node); ->>>>>>> Changing mAnimationManagers and bringing CCBReader implementation closer to cocos2d-iphone CCBReader static float getResolutionScale(); diff --git a/extensions/CCBReader/CCNodeLoader.cpp b/extensions/CCBReader/CCNodeLoader.cpp index be797f748c..b7d6954bb6 100644 --- a/extensions/CCBReader/CCNodeLoader.cpp +++ b/extensions/CCBReader/CCNodeLoader.cpp @@ -680,54 +680,55 @@ BlockData * CCNodeLoader::parsePropTypeBlock(CCNode * pNode, CCNode * pParent, C if(selectorTarget != kCCBTargetTypeNone) { CCObject * target = NULL; - if(selectorTarget == kCCBTargetTypeDocumentRoot) { - target = pCCBReader->getAnimationManager()->getRootNode(); - } else if(selectorTarget == kCCBTargetTypeOwner) { - target = pCCBReader->getOwner(); + if(!pCCBReader->isJSControlled()) { - /* Scripting specific code because selector function is common for all callbacks. - * So if we had 1 target and 1 selector function, the context (callback function name) - * would get lost. Hence the need for a new target for each callback. - */ - if(pCCBReader->hasScriptingOwner) { - CCBScriptOwnerProtocol *proxy = dynamic_cast(pCCBReader->getOwner()); - if(proxy) { - target = dynamic_cast(proxy->createNew()); - } + if(selectorTarget == kCCBTargetTypeDocumentRoot) { + target = pCCBReader->getAnimationManager()->getRootNode(); + } else if(selectorTarget == kCCBTargetTypeOwner) { + target = pCCBReader->getOwner(); } - } - - if(target != NULL) { - if(selectorName->length() > 0) { - SEL_MenuHandler selMenuHandler = 0; - - CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); - - if(targetAsCCBSelectorResolver != NULL) { - selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName); - } - if(selMenuHandler == 0) { - CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver(); - if(ccbSelectorResolver != NULL) { - selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName); + + if(target != NULL) { + if(selectorName->length() > 0) { + SEL_MenuHandler selMenuHandler = 0; + + CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); + + if(targetAsCCBSelectorResolver != NULL) { + selMenuHandler = targetAsCCBSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName); + } + if(selMenuHandler == 0) { + CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver(); + if(ccbSelectorResolver != NULL) { + selMenuHandler = ccbSelectorResolver->onResolveCCBCCMenuItemSelector(target, selectorName); + } + } + + if(selMenuHandler == 0) { + CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString()); + } else { + BlockData * blockData = new BlockData(); + blockData->mSELMenuHandler = selMenuHandler; + + blockData->mTarget = target; + + return blockData; } - } - - if(selMenuHandler == 0) { - CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString()); } else { - BlockData * blockData = new BlockData(); - blockData->mSELMenuHandler = selMenuHandler; - - blockData->mTarget = target; - - return blockData; + CCLOG("Unexpected empty selector."); } } else { - CCLOG("Unexpected empty selector."); + CCLOG("Unexpected NULL target for selector."); } } else { - CCLOG("Unexpected NULL target for selector."); + if(selectorTarget == kCCBTargetTypeDocumentRoot) { + pCCBReader->addDocumentCallbackNode(pNode); + pCCBReader->addDocumentCallbackName(selectorName->getCString()); + + } else { + pCCBReader->addOwnerCallbackNode(pNode); + pCCBReader->addOwnerCallbackName(selectorName->getCString()); + } } } @@ -740,45 +741,57 @@ BlockCCControlData * CCNodeLoader::parsePropTypeBlockCCControl(CCNode * pNode, C int controlEvents = pCCBReader->readInt(false); if(selectorTarget != kCCBTargetTypeNone) { - CCObject * target = NULL; - if(selectorTarget == kCCBTargetTypeDocumentRoot) { - target = pCCBReader->getAnimationManager()->getRootNode(); - } else if(selectorTarget == kCCBTargetTypeOwner) { - target = pCCBReader->getOwner(); - } - - if(target != NULL) { - if(selectorName->length() > 0) { - SEL_CCControlHandler selCCControlHandler = 0; - - CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); - - if(targetAsCCBSelectorResolver != NULL) { - selCCControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName); - } - if(selCCControlHandler == 0) { - CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver(); - if(ccbSelectorResolver != NULL) { - selCCControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName); + + if(!pCCBReader->isJSControlled()) { + CCObject * target = NULL; + if(selectorTarget == kCCBTargetTypeDocumentRoot) { + target = pCCBReader->getAnimationManager()->getRootNode(); + } else if(selectorTarget == kCCBTargetTypeOwner) { + target = pCCBReader->getOwner(); + } + + if(target != NULL) { + if(selectorName->length() > 0) { + SEL_CCControlHandler selCCControlHandler = 0; + + CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast(target); + + if(targetAsCCBSelectorResolver != NULL) { + selCCControlHandler = targetAsCCBSelectorResolver->onResolveCCBCCControlSelector(target, selectorName); + } + if(selCCControlHandler == 0) { + CCBSelectorResolver * ccbSelectorResolver = pCCBReader->getCCBSelectorResolver(); + if(ccbSelectorResolver != NULL) { + selCCControlHandler = ccbSelectorResolver->onResolveCCBCCControlSelector(target, selectorName); + } + } + + if(selCCControlHandler == 0) { + CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString()); + } else { + BlockCCControlData * blockCCControlData = new BlockCCControlData(); + blockCCControlData->mSELCCControlHandler = selCCControlHandler; + + blockCCControlData->mTarget = target; + blockCCControlData->mControlEvents = controlEvents; + + return blockCCControlData; } - } - - if(selCCControlHandler == 0) { - CCLOG("Skipping selector '%s' since no CCBSelectorResolver is present.", selectorName->getCString()); } else { - BlockCCControlData * blockCCControlData = new BlockCCControlData(); - blockCCControlData->mSELCCControlHandler = selCCControlHandler; - - blockCCControlData->mTarget = target; - blockCCControlData->mControlEvents = controlEvents; - - return blockCCControlData; + CCLOG("Unexpected empty selector."); } } else { - CCLOG("Unexpected empty selector."); + CCLOG("Unexpected NULL target for selector."); } } else { - CCLOG("Unexpected NULL target for selector."); + if(selectorTarget == kCCBTargetTypeDocumentRoot) { + pCCBReader->addDocumentCallbackNode(pNode); + pCCBReader->addDocumentCallbackName(selectorName->getCString()); + + } else { + pCCBReader->addOwnerCallbackNode(pNode); + pCCBReader->addOwnerCallbackName(selectorName->getCString()); + } } } From 2f5f7a601be3cf237fc87b25bca21aefeb00414d Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 10:06:48 +0800 Subject: [PATCH 82/95] issue #1526: Moved implementations of static functions in CCActionEase.h, CCLabelBMFont.h to CCActionEase.cpp, CCLabelBMFont.cpp. --- cocos2dx/actions/CCActionEase.cpp | 20 ++++++++++++++++++++ cocos2dx/actions/CCActionEase.h | 16 ++++------------ cocos2dx/label_nodes/CCLabelBMFont.cpp | 15 +++++++++++++++ cocos2dx/label_nodes/CCLabelBMFont.h | 12 +++--------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/cocos2dx/actions/CCActionEase.cpp b/cocos2dx/actions/CCActionEase.cpp index 11e7b655fa..3f7d75d627 100644 --- a/cocos2dx/actions/CCActionEase.cpp +++ b/cocos2dx/actions/CCActionEase.cpp @@ -738,6 +738,11 @@ CCEaseElastic* CCEaseElastic::actionWithAction(CCActionInterval *pAction, float return CCEaseElastic::create(pAction, fPeriod); } +CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction) +{ + return CCEaseElastic::create(pAction, 0.3f); +} + CCEaseElastic* CCEaseElastic::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/) { CCEaseElastic *pRet = new CCEaseElastic(); @@ -803,6 +808,11 @@ CCEaseElasticIn* CCEaseElasticIn::actionWithAction(CCActionInterval *pAction, fl return CCEaseElasticIn::create(pAction, fPeriod); } +CCEaseElasticIn* CCEaseElasticIn::create(CCActionInterval *pAction) +{ + return CCEaseElasticIn::create(pAction, 0.3f); +} + CCEaseElasticIn* CCEaseElasticIn::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/) { CCEaseElasticIn *pRet = new CCEaseElasticIn(); @@ -873,6 +883,11 @@ CCEaseElasticOut* CCEaseElasticOut::actionWithAction(CCActionInterval *pAction, return CCEaseElasticOut::create(pAction, fPeriod); } +CCEaseElasticOut* CCEaseElasticOut::create(CCActionInterval *pAction) +{ + return CCEaseElasticOut::create(pAction, 0.3f); +} + CCEaseElasticOut* CCEaseElasticOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/) { CCEaseElasticOut *pRet = new CCEaseElasticOut(); @@ -942,6 +957,11 @@ CCEaseElasticInOut* CCEaseElasticInOut::actionWithAction(CCActionInterval *pActi return CCEaseElasticInOut::create(pAction, fPeriod); } +CCEaseElasticInOut* CCEaseElasticInOut::create(CCActionInterval *pAction) +{ + return CCEaseElasticInOut::create(pAction, 0.3f); +} + CCEaseElasticInOut* CCEaseElasticInOut::create(CCActionInterval *pAction, float fPeriod/* = 0.3f*/) { CCEaseElasticInOut *pRet = new CCEaseElasticInOut(); diff --git a/cocos2dx/actions/CCActionEase.h b/cocos2dx/actions/CCActionEase.h index 0118d3e136..07f9c29109 100644 --- a/cocos2dx/actions/CCActionEase.h +++ b/cocos2dx/actions/CCActionEase.h @@ -311,9 +311,7 @@ public: CC_DEPRECATED_ATTRIBUTE static CCEaseElastic* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f); /** Creates the action with the inner action and the period in radians (default is 0.3) */ static CCEaseElastic* create(CCActionInterval *pAction, float fPeriod); - static CCEaseElastic* create(CCActionInterval *pAction) { - return CCEaseElastic::create(pAction, 0.3f); - } + static CCEaseElastic* create(CCActionInterval *pAction); protected: float m_fPeriod; }; @@ -338,9 +336,7 @@ public: CC_DEPRECATED_ATTRIBUTE static CCEaseElasticIn* actionWithAction(CCActionInterval *pAction, float fPeriod = 0.3f); /** Creates the action with the inner action and the period in radians (default is 0.3) */ static CCEaseElasticIn* create(CCActionInterval *pAction, float fPeriod); - static CCEaseElasticIn* create(CCActionInterval *pAction) { - return CCEaseElasticIn::create(pAction, 0.3f); - } + static CCEaseElasticIn* create(CCActionInterval *pAction); }; /** @@ -364,9 +360,7 @@ public: /** Creates the action with the inner action and the period in radians (default is 0.3) */ static CCEaseElasticOut* create(CCActionInterval *pAction, float fPeriod); - static CCEaseElasticOut* create(CCActionInterval *pAction) { - return CCEaseElasticOut::create(pAction, 0.3f); - } + static CCEaseElasticOut* create(CCActionInterval *pAction); }; /** @@ -390,9 +384,7 @@ public: /** Creates the action with the inner action and the period in radians (default is 0.3) */ static CCEaseElasticInOut* create(CCActionInterval *pAction, float fPeriod); - static CCEaseElasticInOut* create(CCActionInterval *pAction) { - return CCEaseElasticInOut::create(pAction, 0.3f); - } + static CCEaseElasticInOut* create(CCActionInterval *pAction); }; /** diff --git a/cocos2dx/label_nodes/CCLabelBMFont.cpp b/cocos2dx/label_nodes/CCLabelBMFont.cpp index f919ac2fb7..d1d587f500 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.cpp +++ b/cocos2dx/label_nodes/CCLabelBMFont.cpp @@ -736,6 +736,21 @@ CCLabelBMFont * CCLabelBMFont::create() return NULL; } +CCLabelBMFont * CCLabelBMFont::create(const char *str, const char *fntFile, float width, CCTextAlignment alignment) +{ + return CCLabelBMFont::create(str, fntFile, width, alignment, CCPointZero); +} + +CCLabelBMFont * CCLabelBMFont::create(const char *str, const char *fntFile, float width) +{ + return CCLabelBMFont::create(str, fntFile, width, kCCTextAlignmentLeft, CCPointZero); +} + +CCLabelBMFont * CCLabelBMFont::create(const char *str, const char *fntFile) +{ + return CCLabelBMFont::create(str, fntFile, kCCLabelAutomaticWidth, kCCTextAlignmentLeft, CCPointZero); +} + CCLabelBMFont *CCLabelBMFont::labelWithString(const char *str, const char *fntFile, float width/* = kCCLabelAutomaticWidth*/, CCTextAlignment alignment/* = kCCTextAlignmentLeft*/, CCPoint imageOffset/* = CCPointZero*/) { return CCLabelBMFont::create(str, fntFile, width, alignment, imageOffset); diff --git a/cocos2dx/label_nodes/CCLabelBMFont.h b/cocos2dx/label_nodes/CCLabelBMFont.h index 83d6b7c791..1645ee54a0 100644 --- a/cocos2dx/label_nodes/CCLabelBMFont.h +++ b/cocos2dx/label_nodes/CCLabelBMFont.h @@ -209,17 +209,11 @@ public: /** creates a bitmap font atlas with an initial string and the FNT file */ static CCLabelBMFont * create(const char *str, const char *fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset); - static CCLabelBMFont * create(const char *str, const char *fntFile, float width, CCTextAlignment alignment) { - return CCLabelBMFont::create(str, fntFile, width, alignment, CCPointZero); - } + static CCLabelBMFont * create(const char *str, const char *fntFile, float width, CCTextAlignment alignment); - static CCLabelBMFont * create(const char *str, const char *fntFile, float width) { - return CCLabelBMFont::create(str, fntFile, width, kCCTextAlignmentLeft, CCPointZero); - } + static CCLabelBMFont * create(const char *str, const char *fntFile, float width); - static CCLabelBMFont * create(const char *str, const char *fntFile) { - return CCLabelBMFont::create(str, fntFile, kCCLabelAutomaticWidth, kCCTextAlignmentLeft, CCPointZero); - } + static CCLabelBMFont * create(const char *str, const char *fntFile); /** Creates an label. @deprecated: This interface will be deprecated sooner or later. From 6f6345d3a6680af4ae49526c34982a87172d0239 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 2 Nov 2012 11:23:50 +0800 Subject: [PATCH 83/95] update CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 77800b669a..8ab8bdc727 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -24,6 +24,7 @@ cocos2d-2.0-x-2.0.4 @Nov.2 2012 Bug #1527: fix a bug that MoonWarriors can not run on iOS simulator sometimes Refactor #1491: remove dependency of FontLabel lib [javascript binding] + Bug #1526: fix a bug that javascript binding related samples will crash on iOS devices Feature #1469: add MoonWarriors as a sample game Refactor #1487: use shared javascript test cases with cocos2d-html5 and cocos2d-iphone Refactor #1517: upgrade SpiderMonkey to FF 16.0.1 From c8e21be7ec5e7dfae80b72bc8e9c9b371401008d Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 11:24:34 +0800 Subject: [PATCH 84/95] issue #1526: Using spiderMonkey library in cocos2d-iphone. --- .../spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id b/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id index a56f43d2cd..bc8ebad88f 100644 --- a/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id +++ b/scripting/javascript/spidermonkey-ios/lib/libjs_static.a.REMOVED.git-id @@ -1 +1 @@ -2559ff4626d1357e05dd1f64c9875b2a51c26957 \ No newline at end of file +d30d9e3b35aaae6a2483f9dfbf3318b0650548f3 \ No newline at end of file From 24385b04a6783c824326e8f589efaff43c833b62 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 11:25:24 +0800 Subject: [PATCH 85/95] fixed #1526: Updated MoonWorriors project configuration for iOS port. --- .../MoonWarriors.xcodeproj/project.pbxproj | 1169 +++++++++++++++++ .../project.pbxproj.REMOVED.git-id | 1 - 2 files changed, 1169 insertions(+), 1 deletion(-) create mode 100644 samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj delete mode 100644 samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..ba6a3a916f --- /dev/null +++ b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj @@ -0,0 +1,1169 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 15674A6E163E70370002AD61 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A6D163E70370002AD61 /* QuartzCore.framework */; }; + 15674A70163E70370002AD61 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A6F163E70370002AD61 /* OpenGLES.framework */; }; + 15674A72163E70370002AD61 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A71163E70370002AD61 /* OpenAL.framework */; }; + 15674A74163E70370002AD61 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A73163E70370002AD61 /* AudioToolbox.framework */; }; + 15674A76163E70370002AD61 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A75163E70370002AD61 /* AVFoundation.framework */; }; + 15674A78163E70370002AD61 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A77163E70370002AD61 /* UIKit.framework */; }; + 15674A7A163E70370002AD61 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A79163E70370002AD61 /* Foundation.framework */; }; + 15674A7C163E70370002AD61 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674A7B163E70370002AD61 /* CoreGraphics.framework */; }; + 15674EFF163E72EE0002AD61 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15674EFD163E72EE0002AD61 /* AppDelegate.cpp */; }; + 15674F05163E73290002AD61 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15674F02163E73290002AD61 /* AppController.mm */; }; + 15674F06163E73290002AD61 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15674F03163E73290002AD61 /* main.m */; }; + 15675005163E737B0002AD61 /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 15674FA2163E737B0002AD61 /* CDAudioManager.m */; }; + 15675006163E737B0002AD61 /* CDOpenALSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 15674FA5163E737B0002AD61 /* CDOpenALSupport.m */; }; + 15675007163E737B0002AD61 /* CocosDenshion.m in Sources */ = {isa = PBXBuildFile; fileRef = 15674FA7163E737B0002AD61 /* CocosDenshion.m */; }; + 15675008163E737B0002AD61 /* SimpleAudioEngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15674FA8163E737B0002AD61 /* SimpleAudioEngine.mm */; }; + 15675009163E737B0002AD61 /* SimpleAudioEngine_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 15674FAA163E737B0002AD61 /* SimpleAudioEngine_objc.m */; }; + 15675108163E73B10002AD61 /* Android.mk in Resources */ = {isa = PBXBuildFile; fileRef = 1567502C163E73B10002AD61 /* Android.mk */; }; + 15675109163E73B10002AD61 /* CCPhysicsSprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567502D163E73B10002AD61 /* CCPhysicsSprite.cpp */; }; + 1567510A163E73B10002AD61 /* cocos2d_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567502F163E73B10002AD61 /* cocos2d_specifics.cpp */; }; + 1567510B163E73B10002AD61 /* cocosjs_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675031163E73B10002AD61 /* cocosjs_manual_conversions.cpp */; }; + 1567510C163E73B10002AD61 /* cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675034163E73B10002AD61 /* cocos2dx.cpp */; }; + 1567510E163E73B10002AD61 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 15675037163E73B10002AD61 /* README */; }; + 1567510F163E73B10002AD61 /* js_bindings_ccbreader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675038163E73B10002AD61 /* js_bindings_ccbreader.cpp */; }; + 15675110163E73B10002AD61 /* js_bindings_chipmunk_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567503A163E73B10002AD61 /* js_bindings_chipmunk_functions.cpp */; }; + 15675111163E73B10002AD61 /* js_bindings_chipmunk_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567503C163E73B10002AD61 /* js_bindings_chipmunk_manual.cpp */; }; + 15675112163E73B10002AD61 /* js_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567503F163E73B10002AD61 /* js_manual_conversions.cpp */; }; + 15675113163E73B10002AD61 /* ScriptingCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675041163E73B10002AD61 /* ScriptingCore.cpp */; }; + 15675125163E74050002AD61 /* js in Resources */ = {isa = PBXBuildFile; fileRef = 15675124163E74050002AD61 /* js */; }; + 1567516D163E741E0002AD61 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675164163E741E0002AD61 /* Default-568h@2x.png */; }; + 1567516E163E741E0002AD61 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675165163E741E0002AD61 /* Default.png */; }; + 1567516F163E741E0002AD61 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675166163E741E0002AD61 /* Default@2x.png */; }; + 15675170163E741E0002AD61 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675167163E741E0002AD61 /* Icon-72.png */; }; + 15675171163E741E0002AD61 /* Icon-Small-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675168163E741E0002AD61 /* Icon-Small-50.png */; }; + 15675172163E741E0002AD61 /* Icon-Small.png in Resources */ = {isa = PBXBuildFile; fileRef = 15675169163E741E0002AD61 /* Icon-Small.png */; }; + 15675173163E741E0002AD61 /* Icon-Small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1567516A163E741E0002AD61 /* Icon-Small@2x.png */; }; + 15675174163E741E0002AD61 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 1567516B163E741E0002AD61 /* Icon.png */; }; + 15675175163E741E0002AD61 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1567516C163E741E0002AD61 /* Icon@2x.png */; }; + 156751F4163E765D0002AD61 /* CCBAnimationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675182163E765D0002AD61 /* CCBAnimationManager.cpp */; }; + 156751F5163E765D0002AD61 /* CCBFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675184163E765D0002AD61 /* CCBFileLoader.cpp */; }; + 156751F6163E765D0002AD61 /* CCBKeyframe.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675186163E765D0002AD61 /* CCBKeyframe.cpp */; }; + 156751F7163E765D0002AD61 /* CCBReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675189163E765D0002AD61 /* CCBReader.cpp */; }; + 156751F8163E765D0002AD61 /* CCBSequence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567518C163E765D0002AD61 /* CCBSequence.cpp */; }; + 156751F9163E765D0002AD61 /* CCBSequenceProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567518E163E765D0002AD61 /* CCBSequenceProperty.cpp */; }; + 156751FA163E765D0002AD61 /* CCBValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675190163E765D0002AD61 /* CCBValue.cpp */; }; + 156751FB163E765D0002AD61 /* CCControlButtonLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675192163E765D0002AD61 /* CCControlButtonLoader.cpp */; }; + 156751FC163E765D0002AD61 /* CCControlLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675194163E765D0002AD61 /* CCControlLoader.cpp */; }; + 156751FD163E765D0002AD61 /* CCData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675196163E765D0002AD61 /* CCData.cpp */; }; + 156751FE163E765D0002AD61 /* CCLabelBMFontLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15675198163E765D0002AD61 /* CCLabelBMFontLoader.cpp */; }; + 156751FF163E765D0002AD61 /* CCLabelTTFLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567519A163E765D0002AD61 /* CCLabelTTFLoader.cpp */; }; + 15675200163E765D0002AD61 /* CCLayerColorLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567519C163E765D0002AD61 /* CCLayerColorLoader.cpp */; }; + 15675201163E765D0002AD61 /* CCLayerGradientLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1567519E163E765D0002AD61 /* CCLayerGradientLoader.cpp */; }; + 15675202163E765D0002AD61 /* CCLayerLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751A0163E765D0002AD61 /* CCLayerLoader.cpp */; }; + 15675203163E765D0002AD61 /* CCMenuItemImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751A2163E765D0002AD61 /* CCMenuItemImageLoader.cpp */; }; + 15675204163E765D0002AD61 /* CCMenuItemLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751A4163E765D0002AD61 /* CCMenuItemLoader.cpp */; }; + 15675205163E765D0002AD61 /* CCNode+CCBRelativePositioning.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751A7163E765D0002AD61 /* CCNode+CCBRelativePositioning.cpp */; }; + 15675206163E765D0002AD61 /* CCNodeLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751A9163E765D0002AD61 /* CCNodeLoader.cpp */; }; + 15675207163E765D0002AD61 /* CCNodeLoaderLibrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751AB163E765D0002AD61 /* CCNodeLoaderLibrary.cpp */; }; + 15675208163E765D0002AD61 /* CCParticleSystemQuadLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751AE163E765D0002AD61 /* CCParticleSystemQuadLoader.cpp */; }; + 15675209163E765D0002AD61 /* CCScale9SpriteLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751B0163E765D0002AD61 /* CCScale9SpriteLoader.cpp */; }; + 1567520A163E765D0002AD61 /* CCScrollViewLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751B2163E765D0002AD61 /* CCScrollViewLoader.cpp */; }; + 1567520B163E765D0002AD61 /* CCSpriteLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751B4163E765D0002AD61 /* CCSpriteLoader.cpp */; }; + 1567520C163E765D0002AD61 /* CCControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751BA163E765D0002AD61 /* CCControl.cpp */; }; + 1567520D163E765D0002AD61 /* CCControlButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751BC163E765D0002AD61 /* CCControlButton.cpp */; }; + 1567520E163E765D0002AD61 /* CCControlColourPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751BE163E765D0002AD61 /* CCControlColourPicker.cpp */; }; + 1567520F163E765D0002AD61 /* CCControlHuePicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751C1163E765D0002AD61 /* CCControlHuePicker.cpp */; }; + 15675210163E765D0002AD61 /* CCControlPotentiometer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751C3163E765D0002AD61 /* CCControlPotentiometer.cpp */; }; + 15675211163E765D0002AD61 /* CCControlSaturationBrightnessPicker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751C5163E765D0002AD61 /* CCControlSaturationBrightnessPicker.cpp */; }; + 15675212163E765D0002AD61 /* CCControlSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751C7163E765D0002AD61 /* CCControlSlider.cpp */; }; + 15675213163E765D0002AD61 /* CCControlStepper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751C9163E765D0002AD61 /* CCControlStepper.cpp */; }; + 15675214163E765D0002AD61 /* CCControlSwitch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751CB163E765D0002AD61 /* CCControlSwitch.cpp */; }; + 15675215163E765D0002AD61 /* CCControlUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751CD163E765D0002AD61 /* CCControlUtils.cpp */; }; + 15675216163E765D0002AD61 /* CCInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751CF163E765D0002AD61 /* CCInvocation.cpp */; }; + 15675217163E765D0002AD61 /* CCScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751D1163E765D0002AD61 /* CCScale9Sprite.cpp */; }; + 15675218163E765D0002AD61 /* CCEditBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751D4163E765D0002AD61 /* CCEditBox.cpp */; }; + 1567521A163E765D0002AD61 /* CCEditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 156751DA163E765D0002AD61 /* CCEditBoxImplIOS.mm */; }; + 1567521B163E765D0002AD61 /* EditBoxImplIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 156751DC163E765D0002AD61 /* EditBoxImplIOS.mm */; }; + 1567521C163E765D0002AD61 /* CCScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751DE163E765D0002AD61 /* CCScrollView.cpp */; }; + 1567521D163E765D0002AD61 /* CCSorting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751E0163E765D0002AD61 /* CCSorting.cpp */; }; + 1567521E163E765D0002AD61 /* CCTableView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751E2163E765D0002AD61 /* CCTableView.cpp */; }; + 1567521F163E765D0002AD61 /* CCTableViewCell.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 156751E4163E765D0002AD61 /* CCTableViewCell.cpp */; }; + 15675229163E77460002AD61 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15674E4B163E71D90002AD61 /* libcocos2dx.a */; }; + 15675289163E77A90002AD61 /* chipmunk.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567525A163E77A90002AD61 /* chipmunk.c */; }; + 1567528A163E77A90002AD61 /* CMakeLists.txt in Resources */ = {isa = PBXBuildFile; fileRef = 1567525B163E77A90002AD61 /* CMakeLists.txt */; }; + 1567528B163E77A90002AD61 /* cpConstraint.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567525D163E77A90002AD61 /* cpConstraint.c */; }; + 1567528C163E77A90002AD61 /* cpDampedRotarySpring.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567525E163E77A90002AD61 /* cpDampedRotarySpring.c */; }; + 1567528D163E77A90002AD61 /* cpDampedSpring.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567525F163E77A90002AD61 /* cpDampedSpring.c */; }; + 1567528E163E77A90002AD61 /* cpGearJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675260163E77A90002AD61 /* cpGearJoint.c */; }; + 1567528F163E77A90002AD61 /* cpGrooveJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675261163E77A90002AD61 /* cpGrooveJoint.c */; }; + 15675290163E77A90002AD61 /* cpPinJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675262163E77A90002AD61 /* cpPinJoint.c */; }; + 15675291163E77A90002AD61 /* cpPivotJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675263163E77A90002AD61 /* cpPivotJoint.c */; }; + 15675292163E77A90002AD61 /* cpRatchetJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675264163E77A90002AD61 /* cpRatchetJoint.c */; }; + 15675293163E77A90002AD61 /* cpRotaryLimitJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675265163E77A90002AD61 /* cpRotaryLimitJoint.c */; }; + 15675294163E77A90002AD61 /* cpSimpleMotor.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675266163E77A90002AD61 /* cpSimpleMotor.c */; }; + 15675295163E77A90002AD61 /* cpSlideJoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675267163E77A90002AD61 /* cpSlideJoint.c */; }; + 15675296163E77A90002AD61 /* cpArbiter.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675268163E77A90002AD61 /* cpArbiter.c */; }; + 15675297163E77A90002AD61 /* cpArray.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675269163E77A90002AD61 /* cpArray.c */; }; + 15675298163E77A90002AD61 /* cpBB.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526A163E77A90002AD61 /* cpBB.c */; }; + 15675299163E77A90002AD61 /* cpBBTree.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526B163E77A90002AD61 /* cpBBTree.c */; }; + 1567529A163E77A90002AD61 /* cpBody.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526C163E77A90002AD61 /* cpBody.c */; }; + 1567529B163E77A90002AD61 /* cpCollision.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526D163E77A90002AD61 /* cpCollision.c */; }; + 1567529C163E77A90002AD61 /* cpHashSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526E163E77A90002AD61 /* cpHashSet.c */; }; + 1567529D163E77A90002AD61 /* cpPolyShape.c in Sources */ = {isa = PBXBuildFile; fileRef = 1567526F163E77A90002AD61 /* cpPolyShape.c */; }; + 1567529E163E77A90002AD61 /* cpShape.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675270163E77A90002AD61 /* cpShape.c */; }; + 1567529F163E77A90002AD61 /* cpSpace.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675271163E77A90002AD61 /* cpSpace.c */; }; + 156752A0163E77A90002AD61 /* cpSpaceComponent.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675272163E77A90002AD61 /* cpSpaceComponent.c */; }; + 156752A1163E77A90002AD61 /* cpSpaceHash.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675273163E77A90002AD61 /* cpSpaceHash.c */; }; + 156752A2163E77A90002AD61 /* cpSpaceQuery.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675274163E77A90002AD61 /* cpSpaceQuery.c */; }; + 156752A3163E77A90002AD61 /* cpSpaceStep.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675275163E77A90002AD61 /* cpSpaceStep.c */; }; + 156752A4163E77A90002AD61 /* cpSpatialIndex.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675276163E77A90002AD61 /* cpSpatialIndex.c */; }; + 156752A5163E77A90002AD61 /* cpSweep1D.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675277163E77A90002AD61 /* cpSweep1D.c */; }; + 156752A6163E77A90002AD61 /* cpVect.c in Sources */ = {isa = PBXBuildFile; fileRef = 15675278163E77A90002AD61 /* cpVect.c */; }; + 156752A9163E78180002AD61 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 156752A8163E78180002AD61 /* RootViewController.mm */; }; + 156752BD163E7C350002AD61 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 156752BC163E7C350002AD61 /* Icon-144.png */; }; + 156752F7163E7FC30002AD61 /* libjs_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 156752F6163E7FC30002AD61 /* libjs_static.a */; }; + 156752F9163E82D40002AD61 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 156752F8163E82D40002AD61 /* libz.dylib */; }; + 15675300163E870E0002AD61 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 156752FF163E870E0002AD61 /* libxml2.dylib */; }; + 1A4C5FDD164362D800509019 /* res in Resources */ = {isa = PBXBuildFile; fileRef = 1A4C5FDC164362D800509019 /* res */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 15674E4A163E71D90002AD61 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1551A33F158F2AB200E66CFE; + remoteInfo = cocos2dx; + }; + 15675227163E773F0002AD61 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 1551A33E158F2AB200E66CFE; + remoteInfo = cocos2dx; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 15674A69163E70370002AD61 /* MoonWarriors.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoonWarriors.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 15674A6D163E70370002AD61 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 15674A6F163E70370002AD61 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 15674A71163E70370002AD61 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; + 15674A73163E70370002AD61 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 15674A75163E70370002AD61 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 15674A77163E70370002AD61 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 15674A79163E70370002AD61 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 15674A7B163E70370002AD61 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = ""; }; + 15674EFD163E72EE0002AD61 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; + 15674EFE163E72EE0002AD61 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 15674F01163E73290002AD61 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; + 15674F02163E73290002AD61 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; + 15674F03163E73290002AD61 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 15674F04163E73290002AD61 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; + 15674F9E163E737B0002AD61 /* Export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = ""; }; + 15674F9F163E737B0002AD61 /* SimpleAudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine.h; sourceTree = ""; }; + 15674FA1163E737B0002AD61 /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = ""; }; + 15674FA2163E737B0002AD61 /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = ""; }; + 15674FA3163E737B0002AD61 /* CDConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDConfig.h; sourceTree = ""; }; + 15674FA4163E737B0002AD61 /* CDOpenALSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDOpenALSupport.h; sourceTree = ""; }; + 15674FA5163E737B0002AD61 /* CDOpenALSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDOpenALSupport.m; sourceTree = ""; }; + 15674FA6163E737B0002AD61 /* CocosDenshion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosDenshion.h; sourceTree = ""; }; + 15674FA7163E737B0002AD61 /* CocosDenshion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocosDenshion.m; sourceTree = ""; }; + 15674FA8163E737B0002AD61 /* SimpleAudioEngine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleAudioEngine.mm; sourceTree = ""; }; + 15674FA9163E737B0002AD61 /* SimpleAudioEngine_objc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine_objc.h; sourceTree = ""; }; + 15674FAA163E737B0002AD61 /* SimpleAudioEngine_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleAudioEngine_objc.m; sourceTree = ""; }; + 1567502C163E73B10002AD61 /* Android.mk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Android.mk; sourceTree = ""; }; + 1567502D163E73B10002AD61 /* CCPhysicsSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsSprite.cpp; sourceTree = ""; }; + 1567502E163E73B10002AD61 /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = ""; }; + 1567502F163E73B10002AD61 /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = ""; }; + 15675030163E73B10002AD61 /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = ""; }; + 15675031163E73B10002AD61 /* cocosjs_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocosjs_manual_conversions.cpp; sourceTree = ""; }; + 15675032163E73B10002AD61 /* cocosjs_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocosjs_manual_conversions.h; sourceTree = ""; }; + 15675034163E73B10002AD61 /* cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2dx.cpp; sourceTree = ""; }; + 15675035163E73B10002AD61 /* cocos2dx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2dx.hpp; sourceTree = ""; }; + 15675036163E73B10002AD61 /* cocos2dxapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cocos2dxapi.js; sourceTree = ""; }; + 15675037163E73B10002AD61 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; + 15675038163E73B10002AD61 /* js_bindings_ccbreader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_ccbreader.cpp; sourceTree = ""; }; + 15675039163E73B10002AD61 /* js_bindings_ccbreader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_ccbreader.h; sourceTree = ""; }; + 1567503A163E73B10002AD61 /* js_bindings_chipmunk_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_functions.cpp; sourceTree = ""; }; + 1567503B163E73B10002AD61 /* js_bindings_chipmunk_functions.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_functions.hpp; sourceTree = ""; }; + 1567503C163E73B10002AD61 /* js_bindings_chipmunk_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_bindings_chipmunk_manual.cpp; sourceTree = ""; }; + 1567503D163E73B10002AD61 /* js_bindings_chipmunk_manual.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = js_bindings_chipmunk_manual.hpp; sourceTree = ""; }; + 1567503E163E73B10002AD61 /* js_bindings_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_config.h; sourceTree = ""; }; + 1567503F163E73B10002AD61 /* js_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_manual_conversions.cpp; sourceTree = ""; }; + 15675040163E73B10002AD61 /* js_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_manual_conversions.h; sourceTree = ""; }; + 15675041163E73B10002AD61 /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = ""; }; + 15675042163E73B10002AD61 /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = ""; }; + 15675043163E73B10002AD61 /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = ""; }; + 15675044163E73B10002AD61 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = ""; }; + 15675124163E74050002AD61 /* js */ = {isa = PBXFileReference; lastKnownFileType = folder; name = js; path = ../Resources/js; sourceTree = ""; }; + 15675164163E741E0002AD61 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; + 15675165163E741E0002AD61 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; + 15675166163E741E0002AD61 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; + 15675167163E741E0002AD61 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = ""; }; + 15675168163E741E0002AD61 /* Icon-Small-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small-50.png"; sourceTree = ""; }; + 15675169163E741E0002AD61 /* Icon-Small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small.png"; sourceTree = ""; }; + 1567516A163E741E0002AD61 /* Icon-Small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-Small@2x.png"; sourceTree = ""; }; + 1567516B163E741E0002AD61 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + 1567516C163E741E0002AD61 /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = ""; }; + 15675182163E765D0002AD61 /* CCBAnimationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBAnimationManager.cpp; sourceTree = ""; }; + 15675183163E765D0002AD61 /* CCBAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBAnimationManager.h; sourceTree = ""; }; + 15675184163E765D0002AD61 /* CCBFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBFileLoader.cpp; sourceTree = ""; }; + 15675185163E765D0002AD61 /* CCBFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBFileLoader.h; sourceTree = ""; }; + 15675186163E765D0002AD61 /* CCBKeyframe.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBKeyframe.cpp; sourceTree = ""; }; + 15675187163E765D0002AD61 /* CCBKeyframe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBKeyframe.h; sourceTree = ""; }; + 15675188163E765D0002AD61 /* CCBMemberVariableAssigner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBMemberVariableAssigner.h; sourceTree = ""; }; + 15675189163E765D0002AD61 /* CCBReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBReader.cpp; sourceTree = ""; }; + 1567518A163E765D0002AD61 /* CCBReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBReader.h; sourceTree = ""; }; + 1567518B163E765D0002AD61 /* CCBSelectorResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSelectorResolver.h; sourceTree = ""; }; + 1567518C163E765D0002AD61 /* CCBSequence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBSequence.cpp; sourceTree = ""; }; + 1567518D163E765D0002AD61 /* CCBSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSequence.h; sourceTree = ""; }; + 1567518E163E765D0002AD61 /* CCBSequenceProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBSequenceProperty.cpp; sourceTree = ""; }; + 1567518F163E765D0002AD61 /* CCBSequenceProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBSequenceProperty.h; sourceTree = ""; }; + 15675190163E765D0002AD61 /* CCBValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBValue.cpp; sourceTree = ""; }; + 15675191163E765D0002AD61 /* CCBValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBValue.h; sourceTree = ""; }; + 15675192163E765D0002AD61 /* CCControlButtonLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlButtonLoader.cpp; sourceTree = ""; }; + 15675193163E765D0002AD61 /* CCControlButtonLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlButtonLoader.h; sourceTree = ""; }; + 15675194163E765D0002AD61 /* CCControlLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlLoader.cpp; sourceTree = ""; }; + 15675195163E765D0002AD61 /* CCControlLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlLoader.h; sourceTree = ""; }; + 15675196163E765D0002AD61 /* CCData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCData.cpp; sourceTree = ""; }; + 15675197163E765D0002AD61 /* CCData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCData.h; sourceTree = ""; }; + 15675198163E765D0002AD61 /* CCLabelBMFontLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLabelBMFontLoader.cpp; sourceTree = ""; }; + 15675199163E765D0002AD61 /* CCLabelBMFontLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelBMFontLoader.h; sourceTree = ""; }; + 1567519A163E765D0002AD61 /* CCLabelTTFLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLabelTTFLoader.cpp; sourceTree = ""; }; + 1567519B163E765D0002AD61 /* CCLabelTTFLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelTTFLoader.h; sourceTree = ""; }; + 1567519C163E765D0002AD61 /* CCLayerColorLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerColorLoader.cpp; sourceTree = ""; }; + 1567519D163E765D0002AD61 /* CCLayerColorLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerColorLoader.h; sourceTree = ""; }; + 1567519E163E765D0002AD61 /* CCLayerGradientLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerGradientLoader.cpp; sourceTree = ""; }; + 1567519F163E765D0002AD61 /* CCLayerGradientLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerGradientLoader.h; sourceTree = ""; }; + 156751A0163E765D0002AD61 /* CCLayerLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCLayerLoader.cpp; sourceTree = ""; }; + 156751A1163E765D0002AD61 /* CCLayerLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLayerLoader.h; sourceTree = ""; }; + 156751A2163E765D0002AD61 /* CCMenuItemImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMenuItemImageLoader.cpp; sourceTree = ""; }; + 156751A3163E765D0002AD61 /* CCMenuItemImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuItemImageLoader.h; sourceTree = ""; }; + 156751A4163E765D0002AD61 /* CCMenuItemLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCMenuItemLoader.cpp; sourceTree = ""; }; + 156751A5163E765D0002AD61 /* CCMenuItemLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuItemLoader.h; sourceTree = ""; }; + 156751A6163E765D0002AD61 /* CCMenuLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMenuLoader.h; sourceTree = ""; }; + 156751A7163E765D0002AD61 /* CCNode+CCBRelativePositioning.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "CCNode+CCBRelativePositioning.cpp"; sourceTree = ""; }; + 156751A8163E765D0002AD61 /* CCNode+CCBRelativePositioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CCNode+CCBRelativePositioning.h"; sourceTree = ""; }; + 156751A9163E765D0002AD61 /* CCNodeLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeLoader.cpp; sourceTree = ""; }; + 156751AA163E765D0002AD61 /* CCNodeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoader.h; sourceTree = ""; }; + 156751AB163E765D0002AD61 /* CCNodeLoaderLibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeLoaderLibrary.cpp; sourceTree = ""; }; + 156751AC163E765D0002AD61 /* CCNodeLoaderLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoaderLibrary.h; sourceTree = ""; }; + 156751AD163E765D0002AD61 /* CCNodeLoaderListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeLoaderListener.h; sourceTree = ""; }; + 156751AE163E765D0002AD61 /* CCParticleSystemQuadLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCParticleSystemQuadLoader.cpp; sourceTree = ""; }; + 156751AF163E765D0002AD61 /* CCParticleSystemQuadLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCParticleSystemQuadLoader.h; sourceTree = ""; }; + 156751B0163E765D0002AD61 /* CCScale9SpriteLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9SpriteLoader.cpp; sourceTree = ""; }; + 156751B1163E765D0002AD61 /* CCScale9SpriteLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScale9SpriteLoader.h; sourceTree = ""; }; + 156751B2163E765D0002AD61 /* CCScrollViewLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScrollViewLoader.cpp; sourceTree = ""; }; + 156751B3163E765D0002AD61 /* CCScrollViewLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScrollViewLoader.h; sourceTree = ""; }; + 156751B4163E765D0002AD61 /* CCSpriteLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSpriteLoader.cpp; sourceTree = ""; }; + 156751B5163E765D0002AD61 /* CCSpriteLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSpriteLoader.h; sourceTree = ""; }; + 156751B6163E765D0002AD61 /* cocos-ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "cocos-ext.h"; sourceTree = ""; }; + 156751B7163E765D0002AD61 /* ExtensionMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionMacros.h; sourceTree = ""; }; + 156751BA163E765D0002AD61 /* CCControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControl.cpp; sourceTree = ""; }; + 156751BB163E765D0002AD61 /* CCControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControl.h; sourceTree = ""; }; + 156751BC163E765D0002AD61 /* CCControlButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlButton.cpp; sourceTree = ""; }; + 156751BD163E765D0002AD61 /* CCControlButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlButton.h; sourceTree = ""; }; + 156751BE163E765D0002AD61 /* CCControlColourPicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlColourPicker.cpp; sourceTree = ""; }; + 156751BF163E765D0002AD61 /* CCControlColourPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlColourPicker.h; sourceTree = ""; }; + 156751C0163E765D0002AD61 /* CCControlExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlExtensions.h; sourceTree = ""; }; + 156751C1163E765D0002AD61 /* CCControlHuePicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlHuePicker.cpp; sourceTree = ""; }; + 156751C2163E765D0002AD61 /* CCControlHuePicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlHuePicker.h; sourceTree = ""; }; + 156751C3163E765D0002AD61 /* CCControlPotentiometer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlPotentiometer.cpp; sourceTree = ""; }; + 156751C4163E765D0002AD61 /* CCControlPotentiometer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlPotentiometer.h; sourceTree = ""; }; + 156751C5163E765D0002AD61 /* CCControlSaturationBrightnessPicker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSaturationBrightnessPicker.cpp; sourceTree = ""; }; + 156751C6163E765D0002AD61 /* CCControlSaturationBrightnessPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSaturationBrightnessPicker.h; sourceTree = ""; }; + 156751C7163E765D0002AD61 /* CCControlSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSlider.cpp; sourceTree = ""; }; + 156751C8163E765D0002AD61 /* CCControlSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSlider.h; sourceTree = ""; }; + 156751C9163E765D0002AD61 /* CCControlStepper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlStepper.cpp; sourceTree = ""; }; + 156751CA163E765D0002AD61 /* CCControlStepper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlStepper.h; sourceTree = ""; }; + 156751CB163E765D0002AD61 /* CCControlSwitch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlSwitch.cpp; sourceTree = ""; }; + 156751CC163E765D0002AD61 /* CCControlSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlSwitch.h; sourceTree = ""; }; + 156751CD163E765D0002AD61 /* CCControlUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCControlUtils.cpp; sourceTree = ""; }; + 156751CE163E765D0002AD61 /* CCControlUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlUtils.h; sourceTree = ""; }; + 156751CF163E765D0002AD61 /* CCInvocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCInvocation.cpp; sourceTree = ""; }; + 156751D0163E765D0002AD61 /* CCInvocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCInvocation.h; sourceTree = ""; }; + 156751D1163E765D0002AD61 /* CCScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScale9Sprite.cpp; sourceTree = ""; }; + 156751D2163E765D0002AD61 /* CCScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScale9Sprite.h; sourceTree = ""; }; + 156751D4163E765D0002AD61 /* CCEditBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCEditBox.cpp; sourceTree = ""; }; + 156751D5163E765D0002AD61 /* CCEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBox.h; sourceTree = ""; }; + 156751D6163E765D0002AD61 /* CCEditBoxImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImpl.h; sourceTree = ""; }; + 156751D8163E765D0002AD61 /* CCEditBoxImplAndroid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplAndroid.h; sourceTree = ""; }; + 156751D9163E765D0002AD61 /* CCEditBoxImplIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCEditBoxImplIOS.h; sourceTree = ""; }; + 156751DA163E765D0002AD61 /* CCEditBoxImplIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCEditBoxImplIOS.mm; sourceTree = ""; }; + 156751DB163E765D0002AD61 /* EditBoxImplIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditBoxImplIOS.h; sourceTree = ""; }; + 156751DC163E765D0002AD61 /* EditBoxImplIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditBoxImplIOS.mm; sourceTree = ""; }; + 156751DE163E765D0002AD61 /* CCScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCScrollView.cpp; sourceTree = ""; }; + 156751DF163E765D0002AD61 /* CCScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCScrollView.h; sourceTree = ""; }; + 156751E0163E765D0002AD61 /* CCSorting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSorting.cpp; sourceTree = ""; }; + 156751E1163E765D0002AD61 /* CCSorting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSorting.h; sourceTree = ""; }; + 156751E2163E765D0002AD61 /* CCTableView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTableView.cpp; sourceTree = ""; }; + 156751E3163E765D0002AD61 /* CCTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTableView.h; sourceTree = ""; }; + 156751E4163E765D0002AD61 /* CCTableViewCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTableViewCell.cpp; sourceTree = ""; }; + 156751E5163E765D0002AD61 /* CCTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTableViewCell.h; sourceTree = ""; }; + 15675230163E77A90002AD61 /* chipmunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk.h; sourceTree = ""; }; + 15675231163E77A90002AD61 /* chipmunk_ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_ffi.h; sourceTree = ""; }; + 15675232163E77A90002AD61 /* chipmunk_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_private.h; sourceTree = ""; }; + 15675233163E77A90002AD61 /* chipmunk_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_types.h; sourceTree = ""; }; + 15675234163E77A90002AD61 /* chipmunk_unsafe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chipmunk_unsafe.h; sourceTree = ""; }; + 15675236163E77A90002AD61 /* cpConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpConstraint.h; sourceTree = ""; }; + 15675237163E77A90002AD61 /* cpDampedRotarySpring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpDampedRotarySpring.h; sourceTree = ""; }; + 15675238163E77A90002AD61 /* cpDampedSpring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpDampedSpring.h; sourceTree = ""; }; + 15675239163E77A90002AD61 /* cpGearJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpGearJoint.h; sourceTree = ""; }; + 1567523A163E77A90002AD61 /* cpGrooveJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpGrooveJoint.h; sourceTree = ""; }; + 1567523B163E77A90002AD61 /* cpPinJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpPinJoint.h; sourceTree = ""; }; + 1567523C163E77A90002AD61 /* cpPivotJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpPivotJoint.h; sourceTree = ""; }; + 1567523D163E77A90002AD61 /* cpRatchetJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpRatchetJoint.h; sourceTree = ""; }; + 1567523E163E77A90002AD61 /* cpRotaryLimitJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpRotaryLimitJoint.h; sourceTree = ""; }; + 1567523F163E77A90002AD61 /* cpSimpleMotor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpSimpleMotor.h; sourceTree = ""; }; + 15675240163E77A90002AD61 /* cpSlideJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpSlideJoint.h; sourceTree = ""; }; + 15675241163E77A90002AD61 /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + 15675242163E77A90002AD61 /* cpArbiter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpArbiter.h; sourceTree = ""; }; + 15675243163E77A90002AD61 /* cpBB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpBB.h; sourceTree = ""; }; + 15675244163E77A90002AD61 /* cpBody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpBody.h; sourceTree = ""; }; + 15675245163E77A90002AD61 /* cpPolyShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpPolyShape.h; sourceTree = ""; }; + 15675246163E77A90002AD61 /* cpShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpShape.h; sourceTree = ""; }; + 15675247163E77A90002AD61 /* cpSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpSpace.h; sourceTree = ""; }; + 15675248163E77A90002AD61 /* cpSpatialIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpSpatialIndex.h; sourceTree = ""; }; + 15675249163E77A90002AD61 /* cpVect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpVect.h; sourceTree = ""; }; + 1567525A163E77A90002AD61 /* chipmunk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = chipmunk.c; sourceTree = ""; }; + 1567525B163E77A90002AD61 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = ""; }; + 1567525D163E77A90002AD61 /* cpConstraint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpConstraint.c; sourceTree = ""; }; + 1567525E163E77A90002AD61 /* cpDampedRotarySpring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpDampedRotarySpring.c; sourceTree = ""; }; + 1567525F163E77A90002AD61 /* cpDampedSpring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpDampedSpring.c; sourceTree = ""; }; + 15675260163E77A90002AD61 /* cpGearJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpGearJoint.c; sourceTree = ""; }; + 15675261163E77A90002AD61 /* cpGrooveJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpGrooveJoint.c; sourceTree = ""; }; + 15675262163E77A90002AD61 /* cpPinJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpPinJoint.c; sourceTree = ""; }; + 15675263163E77A90002AD61 /* cpPivotJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpPivotJoint.c; sourceTree = ""; }; + 15675264163E77A90002AD61 /* cpRatchetJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpRatchetJoint.c; sourceTree = ""; }; + 15675265163E77A90002AD61 /* cpRotaryLimitJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpRotaryLimitJoint.c; sourceTree = ""; }; + 15675266163E77A90002AD61 /* cpSimpleMotor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSimpleMotor.c; sourceTree = ""; }; + 15675267163E77A90002AD61 /* cpSlideJoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSlideJoint.c; sourceTree = ""; }; + 15675268163E77A90002AD61 /* cpArbiter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpArbiter.c; sourceTree = ""; }; + 15675269163E77A90002AD61 /* cpArray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpArray.c; sourceTree = ""; }; + 1567526A163E77A90002AD61 /* cpBB.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpBB.c; sourceTree = ""; }; + 1567526B163E77A90002AD61 /* cpBBTree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpBBTree.c; sourceTree = ""; }; + 1567526C163E77A90002AD61 /* cpBody.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpBody.c; sourceTree = ""; }; + 1567526D163E77A90002AD61 /* cpCollision.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpCollision.c; sourceTree = ""; }; + 1567526E163E77A90002AD61 /* cpHashSet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpHashSet.c; sourceTree = ""; }; + 1567526F163E77A90002AD61 /* cpPolyShape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpPolyShape.c; sourceTree = ""; }; + 15675270163E77A90002AD61 /* cpShape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpShape.c; sourceTree = ""; }; + 15675271163E77A90002AD61 /* cpSpace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpace.c; sourceTree = ""; }; + 15675272163E77A90002AD61 /* cpSpaceComponent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceComponent.c; sourceTree = ""; }; + 15675273163E77A90002AD61 /* cpSpaceHash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceHash.c; sourceTree = ""; }; + 15675274163E77A90002AD61 /* cpSpaceQuery.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceQuery.c; sourceTree = ""; }; + 15675275163E77A90002AD61 /* cpSpaceStep.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpaceStep.c; sourceTree = ""; }; + 15675276163E77A90002AD61 /* cpSpatialIndex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSpatialIndex.c; sourceTree = ""; }; + 15675277163E77A90002AD61 /* cpSweep1D.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpSweep1D.c; sourceTree = ""; }; + 15675278163E77A90002AD61 /* cpVect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpVect.c; sourceTree = ""; }; + 15675279163E77A90002AD61 /* prime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prime.h; sourceTree = ""; }; + 156752A7163E78180002AD61 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; + 156752A8163E78180002AD61 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; + 156752BC163E7C350002AD61 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = ""; }; + 156752F6163E7FC30002AD61 /* libjs_static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libjs_static.a; path = "../../../scripting/javascript/spidermonkey-ios/lib/libjs_static.a"; sourceTree = ""; }; + 156752F8163E82D40002AD61 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + 156752FF163E870E0002AD61 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; + 1A4C5FDC164362D800509019 /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = res; path = ../Resources/res; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 15674A66163E70370002AD61 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 15675300163E870E0002AD61 /* libxml2.dylib in Frameworks */, + 156752F9163E82D40002AD61 /* libz.dylib in Frameworks */, + 156752F7163E7FC30002AD61 /* libjs_static.a in Frameworks */, + 15675229163E77460002AD61 /* libcocos2dx.a in Frameworks */, + 15674A6E163E70370002AD61 /* QuartzCore.framework in Frameworks */, + 15674A70163E70370002AD61 /* OpenGLES.framework in Frameworks */, + 15674A72163E70370002AD61 /* OpenAL.framework in Frameworks */, + 15674A74163E70370002AD61 /* AudioToolbox.framework in Frameworks */, + 15674A76163E70370002AD61 /* AVFoundation.framework in Frameworks */, + 15674A78163E70370002AD61 /* UIKit.framework in Frameworks */, + 15674A7A163E70370002AD61 /* Foundation.framework in Frameworks */, + 15674A7C163E70370002AD61 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 15674A5E163E70370002AD61 = { + isa = PBXGroup; + children = ( + 156752FF163E870E0002AD61 /* libxml2.dylib */, + 156752F8163E82D40002AD61 /* libz.dylib */, + 156752F6163E7FC30002AD61 /* libjs_static.a */, + 1567522A163E77A90002AD61 /* chipmunk */, + 1567517F163E765D0002AD61 /* extensions */, + 15675123163E73F40002AD61 /* Resources */, + 1567502A163E73B10002AD61 /* javascript */, + 15674F87163E737B0002AD61 /* CocosDenshion */, + 15674F00163E730E0002AD61 /* ios */, + 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */, + 15674A6C163E70370002AD61 /* Frameworks */, + 15674A6A163E70370002AD61 /* Products */, + 15674EFC163E72EE0002AD61 /* Classes */, + ); + sourceTree = ""; + }; + 15674A6A163E70370002AD61 /* Products */ = { + isa = PBXGroup; + children = ( + 15674A69163E70370002AD61 /* MoonWarriors.app */, + ); + name = Products; + sourceTree = ""; + }; + 15674A6C163E70370002AD61 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 15674A6D163E70370002AD61 /* QuartzCore.framework */, + 15674A6F163E70370002AD61 /* OpenGLES.framework */, + 15674A71163E70370002AD61 /* OpenAL.framework */, + 15674A73163E70370002AD61 /* AudioToolbox.framework */, + 15674A75163E70370002AD61 /* AVFoundation.framework */, + 15674A77163E70370002AD61 /* UIKit.framework */, + 15674A79163E70370002AD61 /* Foundation.framework */, + 15674A7B163E70370002AD61 /* CoreGraphics.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 15674E44163E71D90002AD61 /* Products */ = { + isa = PBXGroup; + children = ( + 15674E4B163E71D90002AD61 /* libcocos2dx.a */, + ); + name = Products; + sourceTree = ""; + }; + 15674EFC163E72EE0002AD61 /* Classes */ = { + isa = PBXGroup; + children = ( + 15674EFD163E72EE0002AD61 /* AppDelegate.cpp */, + 15674EFE163E72EE0002AD61 /* AppDelegate.h */, + ); + name = Classes; + path = ../Classes; + sourceTree = ""; + }; + 15674F00163E730E0002AD61 /* ios */ = { + isa = PBXGroup; + children = ( + 156752A7163E78180002AD61 /* RootViewController.h */, + 156752A8163E78180002AD61 /* RootViewController.mm */, + 15674F01163E73290002AD61 /* AppController.h */, + 15674F02163E73290002AD61 /* AppController.mm */, + 15674F03163E73290002AD61 /* main.m */, + 15674F04163E73290002AD61 /* Prefix.pch */, + ); + name = ios; + sourceTree = ""; + }; + 15674F87163E737B0002AD61 /* CocosDenshion */ = { + isa = PBXGroup; + children = ( + 15674F9D163E737B0002AD61 /* include */, + 15674FA0163E737B0002AD61 /* ios */, + ); + name = CocosDenshion; + path = ../../../CocosDenshion; + sourceTree = ""; + }; + 15674F9D163E737B0002AD61 /* include */ = { + isa = PBXGroup; + children = ( + 15674F9E163E737B0002AD61 /* Export.h */, + 15674F9F163E737B0002AD61 /* SimpleAudioEngine.h */, + ); + path = include; + sourceTree = ""; + }; + 15674FA0163E737B0002AD61 /* ios */ = { + isa = PBXGroup; + children = ( + 15674FA1163E737B0002AD61 /* CDAudioManager.h */, + 15674FA2163E737B0002AD61 /* CDAudioManager.m */, + 15674FA3163E737B0002AD61 /* CDConfig.h */, + 15674FA4163E737B0002AD61 /* CDOpenALSupport.h */, + 15674FA5163E737B0002AD61 /* CDOpenALSupport.m */, + 15674FA6163E737B0002AD61 /* CocosDenshion.h */, + 15674FA7163E737B0002AD61 /* CocosDenshion.m */, + 15674FA8163E737B0002AD61 /* SimpleAudioEngine.mm */, + 15674FA9163E737B0002AD61 /* SimpleAudioEngine_objc.h */, + 15674FAA163E737B0002AD61 /* SimpleAudioEngine_objc.m */, + ); + path = ios; + sourceTree = ""; + }; + 1567502A163E73B10002AD61 /* javascript */ = { + isa = PBXGroup; + children = ( + 1567502B163E73B10002AD61 /* bindings */, + ); + name = javascript; + path = ../../../scripting/javascript; + sourceTree = ""; + }; + 1567502B163E73B10002AD61 /* bindings */ = { + isa = PBXGroup; + children = ( + 1567502C163E73B10002AD61 /* Android.mk */, + 1567502D163E73B10002AD61 /* CCPhysicsSprite.cpp */, + 1567502E163E73B10002AD61 /* CCPhysicsSprite.h */, + 1567502F163E73B10002AD61 /* cocos2d_specifics.cpp */, + 15675030163E73B10002AD61 /* cocos2d_specifics.hpp */, + 15675031163E73B10002AD61 /* cocosjs_manual_conversions.cpp */, + 15675032163E73B10002AD61 /* cocosjs_manual_conversions.h */, + 15675033163E73B10002AD61 /* generated */, + 15675038163E73B10002AD61 /* js_bindings_ccbreader.cpp */, + 15675039163E73B10002AD61 /* js_bindings_ccbreader.h */, + 1567503A163E73B10002AD61 /* js_bindings_chipmunk_functions.cpp */, + 1567503B163E73B10002AD61 /* js_bindings_chipmunk_functions.hpp */, + 1567503C163E73B10002AD61 /* js_bindings_chipmunk_manual.cpp */, + 1567503D163E73B10002AD61 /* js_bindings_chipmunk_manual.hpp */, + 1567503E163E73B10002AD61 /* js_bindings_config.h */, + 1567503F163E73B10002AD61 /* js_manual_conversions.cpp */, + 15675040163E73B10002AD61 /* js_manual_conversions.h */, + 15675041163E73B10002AD61 /* ScriptingCore.cpp */, + 15675042163E73B10002AD61 /* ScriptingCore.h */, + 15675043163E73B10002AD61 /* spidermonkey_specifics.h */, + 15675044163E73B10002AD61 /* uthash.h */, + ); + path = bindings; + sourceTree = ""; + }; + 15675033163E73B10002AD61 /* generated */ = { + isa = PBXGroup; + children = ( + 15675034163E73B10002AD61 /* cocos2dx.cpp */, + 15675035163E73B10002AD61 /* cocos2dx.hpp */, + 15675036163E73B10002AD61 /* cocos2dxapi.js */, + 15675037163E73B10002AD61 /* README */, + ); + path = generated; + sourceTree = ""; + }; + 15675123163E73F40002AD61 /* Resources */ = { + isa = PBXGroup; + children = ( + 1A4C5FDC164362D800509019 /* res */, + 156752BC163E7C350002AD61 /* Icon-144.png */, + 15675164163E741E0002AD61 /* Default-568h@2x.png */, + 15675165163E741E0002AD61 /* Default.png */, + 15675166163E741E0002AD61 /* Default@2x.png */, + 15675167163E741E0002AD61 /* Icon-72.png */, + 15675168163E741E0002AD61 /* Icon-Small-50.png */, + 15675169163E741E0002AD61 /* Icon-Small.png */, + 1567516A163E741E0002AD61 /* Icon-Small@2x.png */, + 1567516B163E741E0002AD61 /* Icon.png */, + 1567516C163E741E0002AD61 /* Icon@2x.png */, + 15675124163E74050002AD61 /* js */, + ); + name = Resources; + sourceTree = ""; + }; + 1567517F163E765D0002AD61 /* extensions */ = { + isa = PBXGroup; + children = ( + 15675181163E765D0002AD61 /* CCBReader */, + 156751B6163E765D0002AD61 /* cocos-ext.h */, + 156751B7163E765D0002AD61 /* ExtensionMacros.h */, + 156751B8163E765D0002AD61 /* GUI */, + ); + name = extensions; + path = ../../../extensions; + sourceTree = ""; + }; + 15675181163E765D0002AD61 /* CCBReader */ = { + isa = PBXGroup; + children = ( + 15675182163E765D0002AD61 /* CCBAnimationManager.cpp */, + 15675183163E765D0002AD61 /* CCBAnimationManager.h */, + 15675184163E765D0002AD61 /* CCBFileLoader.cpp */, + 15675185163E765D0002AD61 /* CCBFileLoader.h */, + 15675186163E765D0002AD61 /* CCBKeyframe.cpp */, + 15675187163E765D0002AD61 /* CCBKeyframe.h */, + 15675188163E765D0002AD61 /* CCBMemberVariableAssigner.h */, + 15675189163E765D0002AD61 /* CCBReader.cpp */, + 1567518A163E765D0002AD61 /* CCBReader.h */, + 1567518B163E765D0002AD61 /* CCBSelectorResolver.h */, + 1567518C163E765D0002AD61 /* CCBSequence.cpp */, + 1567518D163E765D0002AD61 /* CCBSequence.h */, + 1567518E163E765D0002AD61 /* CCBSequenceProperty.cpp */, + 1567518F163E765D0002AD61 /* CCBSequenceProperty.h */, + 15675190163E765D0002AD61 /* CCBValue.cpp */, + 15675191163E765D0002AD61 /* CCBValue.h */, + 15675192163E765D0002AD61 /* CCControlButtonLoader.cpp */, + 15675193163E765D0002AD61 /* CCControlButtonLoader.h */, + 15675194163E765D0002AD61 /* CCControlLoader.cpp */, + 15675195163E765D0002AD61 /* CCControlLoader.h */, + 15675196163E765D0002AD61 /* CCData.cpp */, + 15675197163E765D0002AD61 /* CCData.h */, + 15675198163E765D0002AD61 /* CCLabelBMFontLoader.cpp */, + 15675199163E765D0002AD61 /* CCLabelBMFontLoader.h */, + 1567519A163E765D0002AD61 /* CCLabelTTFLoader.cpp */, + 1567519B163E765D0002AD61 /* CCLabelTTFLoader.h */, + 1567519C163E765D0002AD61 /* CCLayerColorLoader.cpp */, + 1567519D163E765D0002AD61 /* CCLayerColorLoader.h */, + 1567519E163E765D0002AD61 /* CCLayerGradientLoader.cpp */, + 1567519F163E765D0002AD61 /* CCLayerGradientLoader.h */, + 156751A0163E765D0002AD61 /* CCLayerLoader.cpp */, + 156751A1163E765D0002AD61 /* CCLayerLoader.h */, + 156751A2163E765D0002AD61 /* CCMenuItemImageLoader.cpp */, + 156751A3163E765D0002AD61 /* CCMenuItemImageLoader.h */, + 156751A4163E765D0002AD61 /* CCMenuItemLoader.cpp */, + 156751A5163E765D0002AD61 /* CCMenuItemLoader.h */, + 156751A6163E765D0002AD61 /* CCMenuLoader.h */, + 156751A7163E765D0002AD61 /* CCNode+CCBRelativePositioning.cpp */, + 156751A8163E765D0002AD61 /* CCNode+CCBRelativePositioning.h */, + 156751A9163E765D0002AD61 /* CCNodeLoader.cpp */, + 156751AA163E765D0002AD61 /* CCNodeLoader.h */, + 156751AB163E765D0002AD61 /* CCNodeLoaderLibrary.cpp */, + 156751AC163E765D0002AD61 /* CCNodeLoaderLibrary.h */, + 156751AD163E765D0002AD61 /* CCNodeLoaderListener.h */, + 156751AE163E765D0002AD61 /* CCParticleSystemQuadLoader.cpp */, + 156751AF163E765D0002AD61 /* CCParticleSystemQuadLoader.h */, + 156751B0163E765D0002AD61 /* CCScale9SpriteLoader.cpp */, + 156751B1163E765D0002AD61 /* CCScale9SpriteLoader.h */, + 156751B2163E765D0002AD61 /* CCScrollViewLoader.cpp */, + 156751B3163E765D0002AD61 /* CCScrollViewLoader.h */, + 156751B4163E765D0002AD61 /* CCSpriteLoader.cpp */, + 156751B5163E765D0002AD61 /* CCSpriteLoader.h */, + ); + path = CCBReader; + sourceTree = ""; + }; + 156751B8163E765D0002AD61 /* GUI */ = { + isa = PBXGroup; + children = ( + 156751B9163E765D0002AD61 /* CCControlExtension */, + 156751D3163E765D0002AD61 /* CCEditBox */, + 156751DD163E765D0002AD61 /* CCScrollView */, + ); + path = GUI; + sourceTree = ""; + }; + 156751B9163E765D0002AD61 /* CCControlExtension */ = { + isa = PBXGroup; + children = ( + 156751BA163E765D0002AD61 /* CCControl.cpp */, + 156751BB163E765D0002AD61 /* CCControl.h */, + 156751BC163E765D0002AD61 /* CCControlButton.cpp */, + 156751BD163E765D0002AD61 /* CCControlButton.h */, + 156751BE163E765D0002AD61 /* CCControlColourPicker.cpp */, + 156751BF163E765D0002AD61 /* CCControlColourPicker.h */, + 156751C0163E765D0002AD61 /* CCControlExtensions.h */, + 156751C1163E765D0002AD61 /* CCControlHuePicker.cpp */, + 156751C2163E765D0002AD61 /* CCControlHuePicker.h */, + 156751C3163E765D0002AD61 /* CCControlPotentiometer.cpp */, + 156751C4163E765D0002AD61 /* CCControlPotentiometer.h */, + 156751C5163E765D0002AD61 /* CCControlSaturationBrightnessPicker.cpp */, + 156751C6163E765D0002AD61 /* CCControlSaturationBrightnessPicker.h */, + 156751C7163E765D0002AD61 /* CCControlSlider.cpp */, + 156751C8163E765D0002AD61 /* CCControlSlider.h */, + 156751C9163E765D0002AD61 /* CCControlStepper.cpp */, + 156751CA163E765D0002AD61 /* CCControlStepper.h */, + 156751CB163E765D0002AD61 /* CCControlSwitch.cpp */, + 156751CC163E765D0002AD61 /* CCControlSwitch.h */, + 156751CD163E765D0002AD61 /* CCControlUtils.cpp */, + 156751CE163E765D0002AD61 /* CCControlUtils.h */, + 156751CF163E765D0002AD61 /* CCInvocation.cpp */, + 156751D0163E765D0002AD61 /* CCInvocation.h */, + 156751D1163E765D0002AD61 /* CCScale9Sprite.cpp */, + 156751D2163E765D0002AD61 /* CCScale9Sprite.h */, + ); + path = CCControlExtension; + sourceTree = ""; + }; + 156751D3163E765D0002AD61 /* CCEditBox */ = { + isa = PBXGroup; + children = ( + 156751D4163E765D0002AD61 /* CCEditBox.cpp */, + 156751D5163E765D0002AD61 /* CCEditBox.h */, + 156751D6163E765D0002AD61 /* CCEditBoxImpl.h */, + 156751D8163E765D0002AD61 /* CCEditBoxImplAndroid.h */, + 156751D9163E765D0002AD61 /* CCEditBoxImplIOS.h */, + 156751DA163E765D0002AD61 /* CCEditBoxImplIOS.mm */, + 156751DB163E765D0002AD61 /* EditBoxImplIOS.h */, + 156751DC163E765D0002AD61 /* EditBoxImplIOS.mm */, + ); + path = CCEditBox; + sourceTree = ""; + }; + 156751DD163E765D0002AD61 /* CCScrollView */ = { + isa = PBXGroup; + children = ( + 156751DE163E765D0002AD61 /* CCScrollView.cpp */, + 156751DF163E765D0002AD61 /* CCScrollView.h */, + 156751E0163E765D0002AD61 /* CCSorting.cpp */, + 156751E1163E765D0002AD61 /* CCSorting.h */, + 156751E2163E765D0002AD61 /* CCTableView.cpp */, + 156751E3163E765D0002AD61 /* CCTableView.h */, + 156751E4163E765D0002AD61 /* CCTableViewCell.cpp */, + 156751E5163E765D0002AD61 /* CCTableViewCell.h */, + ); + path = CCScrollView; + sourceTree = ""; + }; + 1567522A163E77A90002AD61 /* chipmunk */ = { + isa = PBXGroup; + children = ( + 1567522E163E77A90002AD61 /* include */, + 15675259163E77A90002AD61 /* src */, + ); + name = chipmunk; + path = ../../../external/chipmunk; + sourceTree = ""; + }; + 1567522E163E77A90002AD61 /* include */ = { + isa = PBXGroup; + children = ( + 1567522F163E77A90002AD61 /* chipmunk */, + ); + path = include; + sourceTree = ""; + }; + 1567522F163E77A90002AD61 /* chipmunk */ = { + isa = PBXGroup; + children = ( + 15675230163E77A90002AD61 /* chipmunk.h */, + 15675231163E77A90002AD61 /* chipmunk_ffi.h */, + 15675232163E77A90002AD61 /* chipmunk_private.h */, + 15675233163E77A90002AD61 /* chipmunk_types.h */, + 15675234163E77A90002AD61 /* chipmunk_unsafe.h */, + 15675235163E77A90002AD61 /* constraints */, + 15675242163E77A90002AD61 /* cpArbiter.h */, + 15675243163E77A90002AD61 /* cpBB.h */, + 15675244163E77A90002AD61 /* cpBody.h */, + 15675245163E77A90002AD61 /* cpPolyShape.h */, + 15675246163E77A90002AD61 /* cpShape.h */, + 15675247163E77A90002AD61 /* cpSpace.h */, + 15675248163E77A90002AD61 /* cpSpatialIndex.h */, + 15675249163E77A90002AD61 /* cpVect.h */, + ); + path = chipmunk; + sourceTree = ""; + }; + 15675235163E77A90002AD61 /* constraints */ = { + isa = PBXGroup; + children = ( + 15675236163E77A90002AD61 /* cpConstraint.h */, + 15675237163E77A90002AD61 /* cpDampedRotarySpring.h */, + 15675238163E77A90002AD61 /* cpDampedSpring.h */, + 15675239163E77A90002AD61 /* cpGearJoint.h */, + 1567523A163E77A90002AD61 /* cpGrooveJoint.h */, + 1567523B163E77A90002AD61 /* cpPinJoint.h */, + 1567523C163E77A90002AD61 /* cpPivotJoint.h */, + 1567523D163E77A90002AD61 /* cpRatchetJoint.h */, + 1567523E163E77A90002AD61 /* cpRotaryLimitJoint.h */, + 1567523F163E77A90002AD61 /* cpSimpleMotor.h */, + 15675240163E77A90002AD61 /* cpSlideJoint.h */, + 15675241163E77A90002AD61 /* util.h */, + ); + path = constraints; + sourceTree = ""; + }; + 15675259163E77A90002AD61 /* src */ = { + isa = PBXGroup; + children = ( + 1567525A163E77A90002AD61 /* chipmunk.c */, + 1567525B163E77A90002AD61 /* CMakeLists.txt */, + 1567525C163E77A90002AD61 /* constraints */, + 15675268163E77A90002AD61 /* cpArbiter.c */, + 15675269163E77A90002AD61 /* cpArray.c */, + 1567526A163E77A90002AD61 /* cpBB.c */, + 1567526B163E77A90002AD61 /* cpBBTree.c */, + 1567526C163E77A90002AD61 /* cpBody.c */, + 1567526D163E77A90002AD61 /* cpCollision.c */, + 1567526E163E77A90002AD61 /* cpHashSet.c */, + 1567526F163E77A90002AD61 /* cpPolyShape.c */, + 15675270163E77A90002AD61 /* cpShape.c */, + 15675271163E77A90002AD61 /* cpSpace.c */, + 15675272163E77A90002AD61 /* cpSpaceComponent.c */, + 15675273163E77A90002AD61 /* cpSpaceHash.c */, + 15675274163E77A90002AD61 /* cpSpaceQuery.c */, + 15675275163E77A90002AD61 /* cpSpaceStep.c */, + 15675276163E77A90002AD61 /* cpSpatialIndex.c */, + 15675277163E77A90002AD61 /* cpSweep1D.c */, + 15675278163E77A90002AD61 /* cpVect.c */, + 15675279163E77A90002AD61 /* prime.h */, + ); + path = src; + sourceTree = ""; + }; + 1567525C163E77A90002AD61 /* constraints */ = { + isa = PBXGroup; + children = ( + 1567525D163E77A90002AD61 /* cpConstraint.c */, + 1567525E163E77A90002AD61 /* cpDampedRotarySpring.c */, + 1567525F163E77A90002AD61 /* cpDampedSpring.c */, + 15675260163E77A90002AD61 /* cpGearJoint.c */, + 15675261163E77A90002AD61 /* cpGrooveJoint.c */, + 15675262163E77A90002AD61 /* cpPinJoint.c */, + 15675263163E77A90002AD61 /* cpPivotJoint.c */, + 15675264163E77A90002AD61 /* cpRatchetJoint.c */, + 15675265163E77A90002AD61 /* cpRotaryLimitJoint.c */, + 15675266163E77A90002AD61 /* cpSimpleMotor.c */, + 15675267163E77A90002AD61 /* cpSlideJoint.c */, + ); + path = constraints; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 15674A68163E70370002AD61 /* MoonWarriors */ = { + isa = PBXNativeTarget; + buildConfigurationList = 15674E3B163E70430002AD61 /* Build configuration list for PBXNativeTarget "MoonWarriors" */; + buildPhases = ( + 15674A65163E70370002AD61 /* Sources */, + 15674A66163E70370002AD61 /* Frameworks */, + 15674A67163E70370002AD61 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 15675228163E773F0002AD61 /* PBXTargetDependency */, + ); + name = MoonWarriors; + productName = MoonWarriors; + productReference = 15674A69163E70370002AD61 /* MoonWarriors.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 15674A60163E70370002AD61 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + }; + buildConfigurationList = 15674A63163E70370002AD61 /* Build configuration list for PBXProject "MoonWarriors" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 15674A5E163E70370002AD61; + productRefGroup = 15674A6A163E70370002AD61 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 15674E44163E71D90002AD61 /* Products */; + ProjectRef = 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 15674A68163E70370002AD61 /* MoonWarriors */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 15674E4B163E71D90002AD61 /* libcocos2dx.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcocos2dx.a; + remoteRef = 15674E4A163E71D90002AD61 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 15674A67163E70370002AD61 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15675108163E73B10002AD61 /* Android.mk in Resources */, + 1567510E163E73B10002AD61 /* README in Resources */, + 15675125163E74050002AD61 /* js in Resources */, + 1567516D163E741E0002AD61 /* Default-568h@2x.png in Resources */, + 1567516E163E741E0002AD61 /* Default.png in Resources */, + 1567516F163E741E0002AD61 /* Default@2x.png in Resources */, + 15675170163E741E0002AD61 /* Icon-72.png in Resources */, + 15675171163E741E0002AD61 /* Icon-Small-50.png in Resources */, + 15675172163E741E0002AD61 /* Icon-Small.png in Resources */, + 15675173163E741E0002AD61 /* Icon-Small@2x.png in Resources */, + 15675174163E741E0002AD61 /* Icon.png in Resources */, + 15675175163E741E0002AD61 /* Icon@2x.png in Resources */, + 1567528A163E77A90002AD61 /* CMakeLists.txt in Resources */, + 156752BD163E7C350002AD61 /* Icon-144.png in Resources */, + 1A4C5FDD164362D800509019 /* res in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 15674A65163E70370002AD61 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 15674EFF163E72EE0002AD61 /* AppDelegate.cpp in Sources */, + 15674F05163E73290002AD61 /* AppController.mm in Sources */, + 15674F06163E73290002AD61 /* main.m in Sources */, + 15675005163E737B0002AD61 /* CDAudioManager.m in Sources */, + 15675006163E737B0002AD61 /* CDOpenALSupport.m in Sources */, + 15675007163E737B0002AD61 /* CocosDenshion.m in Sources */, + 15675008163E737B0002AD61 /* SimpleAudioEngine.mm in Sources */, + 15675009163E737B0002AD61 /* SimpleAudioEngine_objc.m in Sources */, + 15675109163E73B10002AD61 /* CCPhysicsSprite.cpp in Sources */, + 1567510A163E73B10002AD61 /* cocos2d_specifics.cpp in Sources */, + 1567510B163E73B10002AD61 /* cocosjs_manual_conversions.cpp in Sources */, + 1567510C163E73B10002AD61 /* cocos2dx.cpp in Sources */, + 1567510F163E73B10002AD61 /* js_bindings_ccbreader.cpp in Sources */, + 15675110163E73B10002AD61 /* js_bindings_chipmunk_functions.cpp in Sources */, + 15675111163E73B10002AD61 /* js_bindings_chipmunk_manual.cpp in Sources */, + 15675112163E73B10002AD61 /* js_manual_conversions.cpp in Sources */, + 15675113163E73B10002AD61 /* ScriptingCore.cpp in Sources */, + 156751F4163E765D0002AD61 /* CCBAnimationManager.cpp in Sources */, + 156751F5163E765D0002AD61 /* CCBFileLoader.cpp in Sources */, + 156751F6163E765D0002AD61 /* CCBKeyframe.cpp in Sources */, + 156751F7163E765D0002AD61 /* CCBReader.cpp in Sources */, + 156751F8163E765D0002AD61 /* CCBSequence.cpp in Sources */, + 156751F9163E765D0002AD61 /* CCBSequenceProperty.cpp in Sources */, + 156751FA163E765D0002AD61 /* CCBValue.cpp in Sources */, + 156751FB163E765D0002AD61 /* CCControlButtonLoader.cpp in Sources */, + 156751FC163E765D0002AD61 /* CCControlLoader.cpp in Sources */, + 156751FD163E765D0002AD61 /* CCData.cpp in Sources */, + 156751FE163E765D0002AD61 /* CCLabelBMFontLoader.cpp in Sources */, + 156751FF163E765D0002AD61 /* CCLabelTTFLoader.cpp in Sources */, + 15675200163E765D0002AD61 /* CCLayerColorLoader.cpp in Sources */, + 15675201163E765D0002AD61 /* CCLayerGradientLoader.cpp in Sources */, + 15675202163E765D0002AD61 /* CCLayerLoader.cpp in Sources */, + 15675203163E765D0002AD61 /* CCMenuItemImageLoader.cpp in Sources */, + 15675204163E765D0002AD61 /* CCMenuItemLoader.cpp in Sources */, + 15675205163E765D0002AD61 /* CCNode+CCBRelativePositioning.cpp in Sources */, + 15675206163E765D0002AD61 /* CCNodeLoader.cpp in Sources */, + 15675207163E765D0002AD61 /* CCNodeLoaderLibrary.cpp in Sources */, + 15675208163E765D0002AD61 /* CCParticleSystemQuadLoader.cpp in Sources */, + 15675209163E765D0002AD61 /* CCScale9SpriteLoader.cpp in Sources */, + 1567520A163E765D0002AD61 /* CCScrollViewLoader.cpp in Sources */, + 1567520B163E765D0002AD61 /* CCSpriteLoader.cpp in Sources */, + 1567520C163E765D0002AD61 /* CCControl.cpp in Sources */, + 1567520D163E765D0002AD61 /* CCControlButton.cpp in Sources */, + 1567520E163E765D0002AD61 /* CCControlColourPicker.cpp in Sources */, + 1567520F163E765D0002AD61 /* CCControlHuePicker.cpp in Sources */, + 15675210163E765D0002AD61 /* CCControlPotentiometer.cpp in Sources */, + 15675211163E765D0002AD61 /* CCControlSaturationBrightnessPicker.cpp in Sources */, + 15675212163E765D0002AD61 /* CCControlSlider.cpp in Sources */, + 15675213163E765D0002AD61 /* CCControlStepper.cpp in Sources */, + 15675214163E765D0002AD61 /* CCControlSwitch.cpp in Sources */, + 15675215163E765D0002AD61 /* CCControlUtils.cpp in Sources */, + 15675216163E765D0002AD61 /* CCInvocation.cpp in Sources */, + 15675217163E765D0002AD61 /* CCScale9Sprite.cpp in Sources */, + 15675218163E765D0002AD61 /* CCEditBox.cpp in Sources */, + 1567521A163E765D0002AD61 /* CCEditBoxImplIOS.mm in Sources */, + 1567521B163E765D0002AD61 /* EditBoxImplIOS.mm in Sources */, + 1567521C163E765D0002AD61 /* CCScrollView.cpp in Sources */, + 1567521D163E765D0002AD61 /* CCSorting.cpp in Sources */, + 1567521E163E765D0002AD61 /* CCTableView.cpp in Sources */, + 1567521F163E765D0002AD61 /* CCTableViewCell.cpp in Sources */, + 15675289163E77A90002AD61 /* chipmunk.c in Sources */, + 1567528B163E77A90002AD61 /* cpConstraint.c in Sources */, + 1567528C163E77A90002AD61 /* cpDampedRotarySpring.c in Sources */, + 1567528D163E77A90002AD61 /* cpDampedSpring.c in Sources */, + 1567528E163E77A90002AD61 /* cpGearJoint.c in Sources */, + 1567528F163E77A90002AD61 /* cpGrooveJoint.c in Sources */, + 15675290163E77A90002AD61 /* cpPinJoint.c in Sources */, + 15675291163E77A90002AD61 /* cpPivotJoint.c in Sources */, + 15675292163E77A90002AD61 /* cpRatchetJoint.c in Sources */, + 15675293163E77A90002AD61 /* cpRotaryLimitJoint.c in Sources */, + 15675294163E77A90002AD61 /* cpSimpleMotor.c in Sources */, + 15675295163E77A90002AD61 /* cpSlideJoint.c in Sources */, + 15675296163E77A90002AD61 /* cpArbiter.c in Sources */, + 15675297163E77A90002AD61 /* cpArray.c in Sources */, + 15675298163E77A90002AD61 /* cpBB.c in Sources */, + 15675299163E77A90002AD61 /* cpBBTree.c in Sources */, + 1567529A163E77A90002AD61 /* cpBody.c in Sources */, + 1567529B163E77A90002AD61 /* cpCollision.c in Sources */, + 1567529C163E77A90002AD61 /* cpHashSet.c in Sources */, + 1567529D163E77A90002AD61 /* cpPolyShape.c in Sources */, + 1567529E163E77A90002AD61 /* cpShape.c in Sources */, + 1567529F163E77A90002AD61 /* cpSpace.c in Sources */, + 156752A0163E77A90002AD61 /* cpSpaceComponent.c in Sources */, + 156752A1163E77A90002AD61 /* cpSpaceHash.c in Sources */, + 156752A2163E77A90002AD61 /* cpSpaceQuery.c in Sources */, + 156752A3163E77A90002AD61 /* cpSpaceStep.c in Sources */, + 156752A4163E77A90002AD61 /* cpSpatialIndex.c in Sources */, + 156752A5163E77A90002AD61 /* cpSweep1D.c in Sources */, + 156752A6163E77A90002AD61 /* cpVect.c in Sources */, + 156752A9163E78180002AD61 /* RootViewController.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 15675228163E773F0002AD61 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = cocos2dx; + targetProxy = 15675227163E773F0002AD61 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 15674E39163E70430002AD61 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + DEBUG, + "COCOS2D_DEBUG=1", + USE_FILE32API, + TARGET_OS_IPHONE, + COCOS2D_JAVASCRIPT, + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"", + "\"$(PROJECT_NAME)/libs/cocos2dx\"", + "\"$(PROJECT_NAME)/libs/CocosDenshion/include\"", + "\"$(SDKROOT)/usr/include/libxml2\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/include\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 15674E3A163E70430002AD61 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + NDEBUG, + USE_FILE32API, + TARGET_OS_IPHONE, + COCOS2D_JAVASCRIPT, + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"", + "\"$(PROJECT_NAME)/libs/cocos2dx\"", + "\"$(PROJECT_NAME)/libs/CocosDenshion/include\"", + "\"$(SDKROOT)/usr/include/libxml2\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/include\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"", + "\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + SDKROOT = iphoneos; + }; + name = Release; + }; + 15674E3C163E70430002AD61 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + HEADER_SEARCH_PATHS = ( + "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../cocos2dx\"", + "\"$(SRCROOT)/../../../CocosDenshion/include\"", + "\"$(SRCROOT)/usr/include/libxml2\"", + "\"$(SRCROOT)/../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"", + "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", + "$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include", + "$(SRCROOT)/../../../scripting/javascript/bindings", + "$(SRCROOT)/../../../external/chipmunk/include/**", + ); + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\"", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; + VALID_ARCHS = "armv7 armv7s"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 15674E3D163E70430002AD61 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Prefix.pch; + "GCC_THUMB_SUPPORT[arch=armv6]" = ""; + HEADER_SEARCH_PATHS = ( + "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", + "\"$(SRCROOT)/../../../cocos2dx\"", + "\"$(SRCROOT)/../../../CocosDenshion/include\"", + "\"$(SRCROOT)/usr/include/libxml2\"", + "\"$(SRCROOT)/../../../cocos2dx/include\"", + "\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"", + "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", + "$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include", + "$(SRCROOT)/../../../scripting/javascript/bindings", + "$(SRCROOT)/../../../external/chipmunk/include/**", + ); + INFOPLIST_FILE = Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\"", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ""; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "armv7 armv7s"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 15674A63163E70370002AD61 /* Build configuration list for PBXProject "MoonWarriors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15674E39163E70430002AD61 /* Debug */, + 15674E3A163E70430002AD61 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 15674E3B163E70430002AD61 /* Build configuration list for PBXNativeTarget "MoonWarriors" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 15674E3C163E70430002AD61 /* Debug */, + 15674E3D163E70430002AD61 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 15674A60163E70370002AD61 /* Project object */; +} diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id deleted file mode 100644 index e4f1ecffb5..0000000000 --- a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a772a4adde649b9a9820bdd03d5bc32c3796e28e \ No newline at end of file From 05b1b7c2c32d33e91f302e73703f8425558b463e Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:13:12 +0800 Subject: [PATCH 86/95] Updated cocos2dx.ini. Renamed some methods exported to js. --- tools/tojs/cocos2dx.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 7b2f312cc3..f86fae15d0 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -105,6 +105,9 @@ rename_functions = CCDirector::[sharedDirector=getInstance], CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation], CCLayerGradient::[initWithColor=init], CCNode::[boundingBox=getBoundingBox], + CCTMXLayer::[tileAt=getTileAt tileGIDAt=getTileGIDAt], + CCTileMapAtlas::[tileAt=getTileAt], + CCTMXTiledMap::[layerNamed=getLayer objectGroupNamed=getObjectGroup], SimpleAudioEngine::[sharedEngine=getInstance] rename_classes = CCParticleSystemQuad::CCParticleSystem From b401730c1a1b7ccd97c4ec0a9843299a1f9aee31 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:14:29 +0800 Subject: [PATCH 87/95] Updated the submodule reference of cocos2d-html5-test. --- samples/TestJavascript/cocos2d-html5-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TestJavascript/cocos2d-html5-tests b/samples/TestJavascript/cocos2d-html5-tests index 01d0bb4e80..77f6d102a8 160000 --- a/samples/TestJavascript/cocos2d-html5-tests +++ b/samples/TestJavascript/cocos2d-html5-tests @@ -1 +1 @@ -Subproject commit 01d0bb4e8091382647f929cb734330970c67b089 +Subproject commit 77f6d102a842cc83693d9f7c8f3e4cdcd79c0f81 From d8580f77a2deaec6a4d91f7ca3a973b8a9da8bc8 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:20:42 +0800 Subject: [PATCH 88/95] Updated project configuration for TestJavascript, added UnitTest.js. --- .../TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id index 27c00e26d5..c487c2d073 100644 --- a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -50ef6ba405247a2cf5b6e3bfc310660b3b821881 \ No newline at end of file +dd6ce183e44bbfded697536a7c0893c253d16b29 \ No newline at end of file From f031a09e77e30f653d52cf15d6f9d57eba626022 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:21:44 +0800 Subject: [PATCH 89/95] Added cc.TMXLayer.getTileFlagsAt to jsbindings. --- .../javascript/bindings/cocos2d_specifics.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp b/scripting/javascript/bindings/cocos2d_specifics.cpp index 6cd8f8abd7..e752dab952 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp @@ -1428,6 +1428,7 @@ JSBool js_cocos2dx_ccpNormalize(JSContext *cx, uint32_t argc, jsval *vp) extern JSObject* js_cocos2dx_CCNode_prototype; extern JSObject* js_cocos2dx_CCLayerColor_prototype; extern JSObject* js_cocos2dx_CCSprite_prototype; +extern JSObject* js_cocos2dx_CCTMXLayer_prototype; extern JSObject* js_cocos2dx_CCAction_prototype; extern JSObject* js_cocos2dx_CCAnimation_prototype; extern JSObject* js_cocos2dx_CCMenuItem_prototype; @@ -1505,6 +1506,31 @@ JSBool js_cocos2dx_CCParticleSystem_setBlendFunc(JSContext *cx, uint32_t argc, j return js_cocos2dx_setBlendFunc(cx, argc, vp); } +// CCTMXLayer +JSBool js_cocos2dx_CCTMXLayer_getTileFlagsAt(JSContext *cx, uint32_t argc, jsval *vp) +{ + + jsval *argv = JS_ARGV(cx, vp); + JSObject *obj; + CCTMXLayer* cobj; + obj = JS_THIS_OBJECT(cx, vp); + js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj); + cobj = (CCTMXLayer*)(proxy ? proxy->ptr : NULL); + TEST_NATIVE_OBJECT(cx, cobj) + if (argc == 1) + { + ccTMXTileFlags flags; + CCPoint arg0 = jsval_to_ccpoint(cx, argv[0]); + cobj->tileGIDAt(arg0, &flags); + + JS_SET_RVAL(cx, vp, UINT_TO_JSVAL((uint32_t)flags)); + return JS_TRUE; + } + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2); + return JS_FALSE; +} + + void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) { // first, try to get the ns @@ -1534,6 +1560,8 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "setPosition", js_cocos2dx_CCNode_setPosition, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCSprite_prototype, "setPosition", js_cocos2dx_CCSprite_setPosition, 1, JSPROP_READONLY | JSPROP_PERMANENT); + + JS_DefineFunction(cx, js_cocos2dx_CCTMXLayer_prototype, "getTileFlagsAt", js_cocos2dx_CCTMXLayer_getTileFlagsAt, 1, JSPROP_READONLY | JSPROP_PERMANENT); tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, global, "(function () { return cc.BezierBy; })()")); JS_DefineFunction(cx, tmpObj, "create", JSB_CCBezierBy_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT); From e2ee4f560cf27cfe6fe5cfd0355e03e70338d7a8 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:22:58 +0800 Subject: [PATCH 90/95] Updated TestJavascript/bindings/jsb_constants_cocos2d.js. --- .../bindings/jsb_constants_cocos2d.js | 354 ++++++++++++------ 1 file changed, 233 insertions(+), 121 deletions(-) diff --git a/samples/TestJavascript/bindings/jsb_constants_cocos2d.js b/samples/TestJavascript/bindings/jsb_constants_cocos2d.js index 5b73b0c671..06eebf90e8 100644 --- a/samples/TestJavascript/bindings/jsb_constants_cocos2d.js +++ b/samples/TestJavascript/bindings/jsb_constants_cocos2d.js @@ -16,7 +16,7 @@ cc.TEXTURE_PIXELFORMAT_PVRTC4 = 8; cc.TEXTURE_PIXELFORMAT_PVRTC4 = 9; cc.TEXTURE_PIXELFORMAT_DEFAULT = cc.TEXTURE_PIXELFORMAT_RGBA8888; -cc.TEXT_ALIGNMENT_LEFT = 0; +cc.TEXT_ALIGNMENT_LEFT = 0; cc.TEXT_ALIGNMENT_CENTER = 1; cc.TEXT_ALIGNMENT_RIGHT = 2; @@ -39,6 +39,18 @@ cc.PARTICLE_MODE_RADIUS = 1; cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1; cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1; +cc.TOUCH_ALL_AT_ONCE = 0; +cc.TOUCH_ONE_BY_ONE = 1; + +cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000; +cc.TMX_TILE_VERTICAL_FLAG = 0x40000000; +cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000; + +cc.TRANSITION_ORIENTATION_LEFT_OVER = 0; +cc.TRANSITION_ORIENTATION_RIGHT_OVER = 1; +cc.TRANSITION_ORIENTATION_UP_OVER = 0; +cc.TRANSITION_ORIENTATION_DOWN_OVER = 1; + cc.RED = {r:255, g:0, b:0}; cc.GREEN = {r:0, g:255, b:0}; cc.BLUE = {r:0, g:0, b:255}; @@ -47,9 +59,18 @@ cc.WHITE = {r:255, g:255, b:255}; cc.POINT_ZERO = {x:0, y:0}; -cc._reuse_p0 = {x:0, y:0}; -cc._reuse_p1 = {x:0, y:0}; +// XXX: This definition is different than cocos2d-html5 +cc.REPEAT_FOREVER = -1; +// reusable objects +cc._reuse_p = [ + {x:0, y:0}, + {x:0, y:0}, + {x:0, y:0}, + {x:0, y:0} +]; cc._reuse_p_index = 0; +cc._reuse_size = {width:0, height:0}; +cc._reuse_rect = {x:0, y:0, width:0, height:0}; cc._reuse_color3b = {r:255, g:255, b:255 }; cc._reuse_color4b = {r:255, g:255, b:255, a:255 }; cc._reuse_grid = {x:0, y:0}; @@ -57,12 +78,10 @@ cc._reuse_grid = {x:0, y:0}; // // Color 3B // -cc.c3b = function( r, g, b ) -{ +cc.c3b = function (r, g, b) { return {r:r, g:g, b:b }; }; -cc._c3b = function( r, g, b ) -{ +cc._c3b = function (r, g, b) { cc._reuse_color3b.r = r; cc._reuse_color3b.g = g; cc._reuse_color3b.b = b; @@ -75,12 +94,10 @@ cc._c3 = cc._c3b; // // Color 4B // -cc.c4b = function( r, g, b, a ) -{ +cc.c4b = function (r, g, b, a) { return {r:r, g:g, b:b, a:a }; }; -cc._c4b = function( r, g, b, a ) -{ +cc._c4b = function (r, g, b, a) { cc._reuse_color4b.r = r; cc._reuse_color4b.g = g; cc._reuse_color4b.b = b; @@ -92,46 +109,41 @@ cc.c4 = cc.c4b; cc._c4 = cc._c4b; - // // Color 4F // -cc.c4f = function( r, g, b, a ) -{ +cc.c4f = function (r, g, b, a) { return {r:r, g:g, b:b, a:a }; }; // // Point // -cc.p = function( x, y ) -{ +cc.p = function (x, y) { return {x:x, y:y}; }; -cc._p = function( x, y ) -{ - if( cc._reuse_p_index === 0 ) { - cc._reuse_p0.x = x; - cc._reuse_p0.y = y; - cc._reuse_p_index = 1; - return cc._reuse_p0; - } else { - cc._reuse_p1.x = x; - cc._reuse_p1.y = y; +cc._p = function (x, y) { + if (cc._reuse_p_index == cc._reuse_p.length) cc._reuse_p_index = 0; - return cc._reuse_p1; - } + + var p = cc._reuse_p[ cc._reuse_p_index]; + cc._reuse_p_index++; + p.x = x; + p.y = y; + return p; +}; + +cc.pointEqualToPoint = function (point1, point2) { + return ((point1.x == point2.x) && (point1.y == point2.y)); }; // // Grid // -cc.g = function(x, y) -{ +cc.g = function (x, y) { return {x:x, y:y}; }; -cc._g = function( x, y ) -{ +cc._g = function (x, y) { cc._reuse_grid.x = x; cc._reuse_grid.y = y; return cc._reuse_grid; @@ -140,75 +152,108 @@ cc._g = function( x, y ) // // Size // -cc.size = function(w,h) -{ +cc.size = function (w, h) { return {width:w, height:h}; }; +cc._size = function (w, h) { + cc._reuse_size.width = w; + cc._reuse_size.height = h; + return cc._reuse_size; +}; +cc.sizeEqualToSize = function (size1, size2) { + return ((size1.width == size2.width) && (size1.height == size2.height)); +}; // // Rect // -cc.rect = function(x,y,w,h) -{ +cc.rect = function (x, y, w, h) { return {x:x, y:y, width:w, height:h}; }; - -// dump config info, but only in debug mode -cc.dumpConfig = function() -{ - if( cc.config.debug ) { - for( var i in cc.config ) - cc.log( i + " = " + cc.config[i] ); - } +cc._rect = function (x, y, w, h) { + cc._reuse_rect.x = x; + cc._reuse_rect.y = y; + cc._reuse_rect.width = w; + cc._reuse_rect.height = h; + return cc._reuse_rect; +}; +cc.rectEqualToRect = function (rect1, rect2) { + return ( rect1.x == rect2.x && rect1.y == rect2.y && rect1.width == rect2.width && rect1.height == rect2.height); }; -// -// MenuItemToggle -// -cc.MenuItemToggle.create = function( /* var args */) { - - var n = arguments.length; - - if (typeof arguments[n-1] === 'function') { - var args = Array.prototype.slice.call(arguments); - var func = args.pop(); - var obj = args.pop(); - - // create it with arguments, - var item = cc.MenuItemToggle._create.apply(this, args); - - // then set the callback - item.setCallback(obj, func); - return item; - } else { - return cc.MenuItemToggle._create.apply(this, arguments); - } +cc.rectContainsRect = function (rect1, rect2) { + if ((rect1.x >= rect2.x) || (rect1.y >= rect2.y) || + ( rect1.x + rect1.width <= rect2.x + rect2.width) || + ( rect1.y + rect1.height <= rect2.y + rect2.height)) + return false; + return true; }; -/** - * Associates a base class with a native superclass - * @function - * @param {object} jsobj subclass - * @param {object} klass superclass - */ -cc.associateWithNative = function( jsobj, superclass ) { - var native = new superclass(); - __associateObjWithNative( jsobj, native ); +cc.rectGetMaxX = function (rect) { + return (rect.x + rect.width); +}; + +cc.rectGetMidX = function (rect) { + return (rect.x + rect.width / 2.0); +}; + +cc.rectGetMinX = function (rect) { + return rect.x; +}; + +cc.rectGetMaxY = function (rect) { + return(rect.y + rect.height); +}; + +cc.rectGetMidY = function (rect) { + return rect.y + rect.height / 2.0; +}; + +cc.rectGetMinY = function (rect) { + return rect.y; +}; + +cc.rectContainsPoint = function (rect, point) { + var ret = false; + if (point.x >= rect.x && point.x <= rect.x + rect.width && + point.y >= rect.y && point.y <= rect.y + rect.height) { + ret = true; + } + return ret; }; // XXX Should be done in native -cc.rectIntersectsRect = function( rectA, rectB ) -{ - var bool = ! ( rectA.x > rectB.x + rectB.width || - rectA.x + rectA.width < rectB.x || - rectA.y > rectB.y +rectB.height || - rectA.y + rectA.height < rectB.y ); +cc.rectIntersectsRect = function (rectA, rectB) { + var bool = !( rectA.x > rectB.x + rectB.width || + rectA.x + rectA.width < rectB.x || + rectA.y > rectB.y + rectB.height || + rectA.y + rectA.height < rectB.y ); return bool; }; +cc.rectUnion = function (rectA, rectB) { + var rect = cc.rect(0, 0, 0, 0); + rect.x = Math.min(rectA.x, rectB.x); + rect.y = Math.min(rectA.y, rectB.y); + rect.width = Math.max(rectA.x + rectA.width, rectB.x + rectB.width) - rect.x; + rect.height = Math.max(rectA.y + rectA.height, rectB.y + rectB.height) - rect.y; + return rect; +}; + +cc.rectIntersection = function (rectA, rectB) { + var intersection = cc.rect( + Math.max(rectA.x, rectB.x), + Math.max(rectA.y, rectB.y), + 0, 0); + + intersection.width = Math.min(rectA.x + rectA.width, rectB.x + rectB.width) - intersection.x; + intersection.height = Math.min(rectA.y + rectA.height, rectB.y + rectB.height) - intersection.y; + return intersection; +}; + // // Array: for cocos2d-html5 compatibility // @@ -220,67 +265,133 @@ cc.ArrayRemoveObject = function (arr, delObj) { } }; +// +// Helpers +// +cc.dump = function (obj) { + for (var i in obj) + cc.log(i + " = " + obj[i]); +}; + +// dump config info, but only in debug mode +cc.dumpConfig = function () { + if (cc.config.debug) + cc.dump(cc.config); +}; // -// Google "subclasses" -// borrowed from closure library +// Bindings Overrides // -var goog = goog || {}; // Check to see if already defined in current scope -goog.inherits = function (childCtor, parentCtor) { +// MenuItemToggle +cc.MenuItemToggle.create = function (/* var args */) { + + var n = arguments.length; + + if (typeof arguments[n - 1] === 'function') { + var args = Array.prototype.slice.call(arguments); + var func = args.pop(); + var obj = args.pop(); + + // create it with arguments, + var item = cc.MenuItemToggle._create.apply(this, args); + + // then set the callback + item.setCallback(obj, func); + return item; + } else { + return cc.MenuItemToggle._create.apply(this, arguments); + } +}; + +// LabelAtlas +// TODO: +// cc.LabelAtlas.create = function (a, b, c, d, e) { + +// var n = arguments.length; + +// if (n == 5) { +// return cc.LabelAtlas._create(a, b, c, d, e.charCodeAt(0)); +// } else { +// return cc.LabelAtlas._create.apply(this, arguments); +// } +// }; + +/** + * Associates a base class with a native superclass + * @function + * @param {object} jsobj subclass + * @param {object} klass superclass + */ +cc.associateWithNative = function (jsobj, superclass_or_instance) { + + try { + // Used when subclassing using the "extend" method + var native = new superclass_or_instance(); + __associateObjWithNative(jsobj, native); + } catch (err) { + // Used when subclassing using the goog.inherits method + __associateObjWithNative(jsobj, superclass_or_instance); + } +}; + +// +// JSB supports 2 official ways to create subclasses +// +// 1) Google "subclasses" borrowed from closure library +// This is the recommended way to do it +// +cc.inherits = function (childCtor, parentCtor) { /** @constructor */ function tempCtor() {}; tempCtor.prototype = parentCtor.prototype; childCtor.superClass_ = parentCtor.prototype; - childCtor.prototype = new tempCtor(); - childCtor.prototype.constructor = childCtor; + childCtor.prototype = new tempCtor(); + childCtor.prototype.constructor = childCtor; - // Copy "static" method, but doesn't generate subclasses. + // Copy "static" method, but doesn't generate subclasses. // for( var i in parentCtor ) { // childCtor[ i ] = parentCtor[ i ]; // } }; -goog.base = function(me, opt_methodName, var_args) { - var caller = arguments.callee.caller; - if (caller.superClass_) { - // This is a constructor. Call the superclass constructor. - ret = caller.superClass_.constructor.apply( me, Array.prototype.slice.call(arguments, 1)); - // XXX: SpiderMonkey bindings extensions -// __associateObjWithNative( me, ret ); - return ret; - } +cc.base = function (me, opt_methodName, var_args) { + var caller = arguments.callee.caller; + if (caller.superClass_) { + // This is a constructor. Call the superclass constructor. + ret = caller.superClass_.constructor.apply(me, Array.prototype.slice.call(arguments, 1)); + return ret; + } - var args = Array.prototype.slice.call(arguments, 2); - var foundCaller = false; - for (var ctor = me.constructor; - ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) { - if (ctor.prototype[opt_methodName] === caller) { - foundCaller = true; - } else if (foundCaller) { - return ctor.prototype[opt_methodName].apply(me, args); - } - } + var args = Array.prototype.slice.call(arguments, 2); + var foundCaller = false; + for (var ctor = me.constructor; + ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) { + if (ctor.prototype[opt_methodName] === caller) { + foundCaller = true; + } else if (foundCaller) { + return ctor.prototype[opt_methodName].apply(me, args); + } + } - // If we did not find the caller in the prototype chain, - // then one of two things happened: - // 1) The caller is an instance method. - // 2) This method was not called by the right caller. - if (me[opt_methodName] === caller) { - return me.constructor.prototype[opt_methodName].apply(me, args); - } else { - throw Error( - 'goog.base called from a method of one name ' + - 'to a method of a different name'); - } + // If we did not find the caller in the prototype chain, + // then one of two things happened: + // 1) The caller is an instance method. + // 2) This method was not called by the right caller. + if (me[opt_methodName] === caller) { + return me.constructor.prototype[opt_methodName].apply(me, args); + } else { + throw Error( + 'cc.base called from a method of one name ' + + 'to a method of a different name'); + } }; // -// Simple subclass +// 2) Using "extend" subclassing +// Simple JavaScript Inheritance By John Resig http://ejohn.org/ // - -cc.Class = function(){}; - +cc.Class = function () {}; cc.Class.extend = function (prop) { var _super = this.prototype; @@ -334,6 +445,7 @@ cc.Class.extend = function (prop) { return Class; }; +cc.Node.prototype.ctor = function () {}; cc.Node.extend = cc.Class.extend; cc.Layer.extend = cc.Class.extend; cc.LayerGradient.extend = cc.Class.extend; From 2bba105453258cecfd2b6994cb136586efd10c24 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 2 Nov 2012 15:38:46 +0800 Subject: [PATCH 91/95] cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated bindings --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index c39ca31caf..2bc7eaa94d 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit c39ca31caf1e312485c0b9637a66645b438ed83d +Subproject commit 2bc7eaa94d79613ad4756c28eb632ea8464ae770 From d14d5369534b4807e8a1540139eb1df1531147f8 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 15:52:28 +0800 Subject: [PATCH 92/95] Sorted the sources of MoonWarriors and TestJavascript by type to make iOS project more beautiful. --- .../MoonWarriors.xcodeproj/project.pbxproj | 22 +++++++++---------- .../project.pbxproj.REMOVED.git-id | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj index ba6a3a916f..230469c88c 100644 --- a/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj +++ b/samples/MoonWarriors/proj.ios/MoonWarriors.xcodeproj/project.pbxproj @@ -392,19 +392,16 @@ 15674A5E163E70370002AD61 = { isa = PBXGroup; children = ( - 156752FF163E870E0002AD61 /* libxml2.dylib */, - 156752F8163E82D40002AD61 /* libz.dylib */, - 156752F6163E7FC30002AD61 /* libjs_static.a */, - 1567522A163E77A90002AD61 /* chipmunk */, - 1567517F163E765D0002AD61 /* extensions */, - 15675123163E73F40002AD61 /* Resources */, - 1567502A163E73B10002AD61 /* javascript */, - 15674F87163E737B0002AD61 /* CocosDenshion */, - 15674F00163E730E0002AD61 /* ios */, 15674E43163E71D90002AD61 /* cocos2dx.xcodeproj */, - 15674A6C163E70370002AD61 /* Frameworks */, - 15674A6A163E70370002AD61 /* Products */, + 1567522A163E77A90002AD61 /* chipmunk */, 15674EFC163E72EE0002AD61 /* Classes */, + 15674F87163E737B0002AD61 /* CocosDenshion */, + 1567517F163E765D0002AD61 /* extensions */, + 15674A6C163E70370002AD61 /* Frameworks */, + 15674F00163E730E0002AD61 /* ios */, + 1567502A163E73B10002AD61 /* javascript */, + 15674A6A163E70370002AD61 /* Products */, + 15675123163E73F40002AD61 /* Resources */, ); sourceTree = ""; }; @@ -419,6 +416,9 @@ 15674A6C163E70370002AD61 /* Frameworks */ = { isa = PBXGroup; children = ( + 156752FF163E870E0002AD61 /* libxml2.dylib */, + 156752F8163E82D40002AD61 /* libz.dylib */, + 156752F6163E7FC30002AD61 /* libjs_static.a */, 15674A6D163E70370002AD61 /* QuartzCore.framework */, 15674A6F163E70370002AD61 /* OpenGLES.framework */, 15674A71163E70370002AD61 /* OpenAL.framework */, diff --git a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id index c487c2d073..a1500b5f84 100644 --- a/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -dd6ce183e44bbfded697536a7c0893c253d16b29 \ No newline at end of file +5b32f69c1db700fd64cd7586a8c21743a944fa12 \ No newline at end of file From fa071d308213cfc143e3e87eb9fe90a6a3ec6391 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 2 Nov 2012 16:09:45 +0800 Subject: [PATCH 93/95] Updated js template for iOS. --- .../cocos2dx_js.xctemplate/Resources/hello.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/template/xcode4/cocos2dx_js.xctemplate/Resources/hello.js b/template/xcode4/cocos2dx_js.xctemplate/Resources/hello.js index 0d77bcec6d..63d4bab721 100644 --- a/template/xcode4/cocos2dx_js.xctemplate/Resources/hello.js +++ b/template/xcode4/cocos2dx_js.xctemplate/Resources/hello.js @@ -15,6 +15,27 @@ try { }; cc.BLACK = cc.c3(0,0,0); + // MenuItemToggle + cc.MenuItemToggle.create = function (/* var args */) { + + var n = arguments.length; + + if (typeof arguments[n - 1] === 'function') { + var args = Array.prototype.slice.call(arguments); + var func = args.pop(); + var obj = args.pop(); + + // create it with arguments, + var item = cc.MenuItemToggle._create.apply(this, args); + + // then set the callback + item.setCallback(obj, func); + return item; + } else { + return cc.MenuItemToggle._create.apply(this, arguments); + } + }; + director = cc.Director.getInstance(); winSize = director.getWinSize(); From d064947c168ba8afbab1a6c99546d61cc8c916b7 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 2 Nov 2012 16:16:12 +0800 Subject: [PATCH 94/95] Update CHANGELOG --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 8ab8bdc727..6144697cf4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,7 +27,7 @@ cocos2d-2.0-x-2.0.4 @Nov.2 2012 Bug #1526: fix a bug that javascript binding related samples will crash on iOS devices Feature #1469: add MoonWarriors as a sample game Refactor #1487: use shared javascript test cases with cocos2d-html5 and cocos2d-iphone - Refactor #1517: upgrade SpiderMonkey to FF 16.0.1 + Refactor #1517: upgrade SpiderMonkey to FF 17.0 beta3 [lua binding] Bug #1506: fix a compilation error of TestLua if the path of cocos2d-x contains spaces [win32] From da457732b9315e669cab98e1714c56a1e4cbbb88 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Fri, 2 Nov 2012 18:56:53 +0800 Subject: [PATCH 95/95] cocos2dxmatoMac-mini : updating submodule reference to latest autogenerated bindings --- scripting/javascript/bindings/generated | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/javascript/bindings/generated b/scripting/javascript/bindings/generated index 2bc7eaa94d..170b2cbb06 160000 --- a/scripting/javascript/bindings/generated +++ b/scripting/javascript/bindings/generated @@ -1 +1 @@ -Subproject commit 2bc7eaa94d79613ad4756c28eb632ea8464ae770 +Subproject commit 170b2cbb069462e8019a74f71efbf06e873c08de