Emscripten workarounds and llvm syntax fixes
authorLee Morgan <lee.morgan@partner.samsung.com>
Tue, 17 Dec 2013 18:10:26 +0000 (18:10 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 3 Mar 2014 18:34:53 +0000 (18:34 +0000)
[Issue] N/A
[Problem] N/A
[Cause] N/A
[Solution] N/A

54 files changed:
automated-tests/dali-internal-test-suite/master-makefile.mk
automated-tests/dali-test-suite-utils/test-application.cpp [new file with mode: 0644]
automated-tests/dali-test-suite-utils/test-application.h
automated-tests/dali-test-suite-utils/test-gl-abstraction.h
automated-tests/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/dali-test-suite/master-makefile.mk
build/slp/configure.ac
build/slp/dali-core/Makefile.am
capi/dali/public-api/common/dali-common.h
capi/dali/public-api/events/pan-gesture-detector.h
capi/dali/public-api/events/pinch-gesture-detector.h
capi/dali/public-api/events/tap-gesture-detector.h
capi/dali/public-api/math/compile-time-math.h
capi/dali/public-api/math/vector3.h
dali/integration-api/common/lockless-buffer.cpp
dali/integration-api/debug.cpp
dali/integration-api/debug.h
dali/integration-api/dynamics/dynamics-body-intf.h
dali/integration-api/dynamics/dynamics-collision-data.h
dali/integration-api/dynamics/dynamics-world-intf.h
dali/internal/event/actors/layer-impl.cpp
dali/internal/event/actors/layer-impl.h
dali/internal/event/animation/constraint-source-impl.h
dali/internal/event/common/demangler.cpp [new file with mode: 0644]
dali/internal/event/common/demangler.h [new file with mode: 0644]
dali/internal/event/common/notification-manager.cpp
dali/internal/event/common/thread-local-storage.cpp
dali/internal/event/common/type-registry-impl.cpp
dali/internal/event/events/event-processor.cpp
dali/internal/event/events/event-processor.h
dali/internal/event/events/gesture-detector-impl.h
dali/internal/event/modeling/animatable-mesh-impl.h
dali/internal/event/modeling/model-archive.h
dali/internal/event/modeling/model-factory.cpp
dali/internal/event/modeling/model-impl.cpp
dali/internal/event/resources/resource-client.cpp
dali/internal/event/text/font-impl.h
dali/internal/event/text/font-metrics.cpp
dali/internal/event/text/font-metrics.h
dali/internal/file.list
dali/internal/render/common/render-debug.h
dali/internal/render/dynamics/scene-graph-dynamics-debug-renderer.cpp
dali/internal/render/dynamics/scene-graph-dynamics-debug-renderer.h
dali/internal/render/gl-resources/context.cpp
dali/internal/render/renderers/scene-graph-mesh-renderer.h
dali/internal/render/renderers/scene-graph-text-renderer.cpp
dali/internal/update/common/scene-graph-buffers.cpp
dali/internal/update/dynamics/scene-graph-dynamics-body.h
dali/internal/update/node-attachments/scene-graph-light-attachment.h
dali/internal/update/queue/update-message-queue.cpp
dali/internal/update/touch/history.h
dali/public-api/common/dali-common.cpp
dali/public-api/geometry/mesh.cpp
dali/public-api/modeling/bone.h

index 52b14d1..3bb53d5 100644 (file)
@@ -27,7 +27,7 @@ include ../../coverage.mk
 all: $(TARGETS)
 
 %: %.cpp
-       $(CC) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
+       $(CC) -o $@ $< ../../dali-test-suite-utils/test-application.cpp $(CXXFLAGS) $(LDFLAGS)
 
 clean:
        @rm -f $(notdir $(TARGETS))
diff --git a/automated-tests/dali-test-suite-utils/test-application.cpp b/automated-tests/dali-test-suite-utils/test-application.cpp
new file mode 100644 (file)
index 0000000..fe27b07
--- /dev/null
@@ -0,0 +1,21 @@
+#define tet_infoline printf
+#define tet_printf printf
+#include "test-application.h"
+
+bool BlendEnabled(const TraceCallStack& callStack)
+{
+  std::stringstream out;
+  out << GL_BLEND;
+  bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
+  return blendEnabled;
+}
+
+bool BlendDisabled(const TraceCallStack& callStack)
+{
+  std::stringstream out;
+  out << GL_BLEND;
+  bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
+  return blendEnabled;
+}
+
+
index 8859b78..192c6be 100644 (file)
@@ -41,8 +41,8 @@ public:
   static constexpr float DEFAULT_HORIZONTAL_DPI = 220.0f;
   static constexpr float DEFAULT_VERTICAL_DPI   = 217.0f;
 #else
-  static const float DEFAULT_HORIZONTAL_DPI = 220.0f;
-  static const float DEFAULT_VERTICAL_DPI   = 217.0f;
+  static const float DEFAULT_HORIZONTAL_DPI     = 220.0f;
+  static const float DEFAULT_VERTICAL_DPI       = 217.0f;
 #endif
 
   static const unsigned int DEFAULT_RENDER_INTERVAL = 1;
index 7f9a76c..04f4a35 100644 (file)
@@ -359,11 +359,11 @@ public:
   void DeleteTextures(GLsizei n, const GLuint* textures)
   {
     std::stringstream out;
-    out << n << ", " << textures << " = [" ;
+    out << n << ", " << textures << " = [";
 
     for(GLsizei i=0; i<n; i++)
     {
-      out << textures[i] << ", " ;
+      out << textures[i] << ", ";
       mDeletedTextureIds.push_back(textures[i]);
     }
     out << "]";
@@ -1808,65 +1808,51 @@ private:
 };
 
 template <>
-int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
+inline int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
 {
   return 0;
 }
 
 template <>
-float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
+inline float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
 {
   return 0.0f;
 }
 
 template <>
-Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
+inline Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
 {
   return Vector2::ZERO;
 }
 
 template <>
-Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
+inline Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
 {
   return Vector3::ZERO;
 }
 
 template <>
-Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
+inline Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
 {
   return Vector4::ZERO;
 }
 
 template <>
-Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
+inline Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
 {
   return Matrix();
 }
 
 template <>
-Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
+inline Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
 {
   return Matrix3( Matrix() );
 }
 
 } // namespace Dali
 
-bool BlendEnabled(const TraceCallStack& callStack)
-{
-  std::stringstream out;
-  out << GL_BLEND;
-  bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
-  return blendEnabled;
-}
-
-bool BlendDisabled(const TraceCallStack& callStack)
-{
-  std::stringstream out;
-  out << GL_BLEND;
-  bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
-  return blendEnabled;
-}
-
+extern bool BlendEnabled(const TraceCallStack& callStack);
+extern bool BlendDisabled(const TraceCallStack& callStack);
 
 
-#endif // __TEST_GL_ES_H__
+#endif // header
index 5c8536a..6ae2627 100644 (file)
@@ -260,7 +260,7 @@ public:
         {
           bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
           bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
-          PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
+          Integration::PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
           memset( pixelBuffer, it->character, 64*64 );
         }
 
@@ -301,7 +301,7 @@ public:
 
         bitmapData = Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true);
         bitmapData->GetPackedPixelsProfile()->ReserveBuffer(Pixel::A8, 64, 64);
-        PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
+        Integration::PixelBuffer* pixelBuffer = bitmapData->GetBuffer();
         memset( pixelBuffer, it->character, 64*64 );
         set->AddCharacter(bitmapData, character);
       }
index 52b14d1..41064f7 100644 (file)
@@ -27,7 +27,8 @@ include ../../coverage.mk
 all: $(TARGETS)
 
 %: %.cpp
-       $(CC) -o $@ $< $(CXXFLAGS) $(LDFLAGS)
+       $(CC) -o $@ $< ../../dali-test-suite-utils/test-application.cpp $(CXXFLAGS) $(LDFLAGS)
+
 
 clean:
        @rm -f $(notdir $(TARGETS))
index 3d6102d..d91962b 100644 (file)
@@ -46,6 +46,12 @@ AC_ARG_ENABLE([debug],
               [enable_debug=$enableval],
               [enable_debug=no])
 
+AC_ARG_ENABLE([emscripten],
+              [AC_HELP_STRING([--enable-emscripten],
+                              [Emscripten builds])],
+              [enable_emscripten=$enableval],
+              [enable_emscripten=no])
+
 if test "x$enable_debug" = "xyes"; then
   DALI_CFLAGS="$DALI_CFLAGS -DDEBUG_ENABLED -DDEBUG_BACKTRACE"
 fi
@@ -54,6 +60,10 @@ if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then
   DALI_CFLAGS="$DALI_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
 fi
 
+if test "x$enable_emscripten" = "xyes"; then
+  DALI_CFLAGS="$DALI_CFLAGS -DEMSCRIPTEN -std=c++11"
+fi
+
 AC_ARG_ENABLE([performance-monitor],
               [AC_HELP_STRING([--enable-performance-monitor],
                               [Enables the performance monitor output])],
@@ -102,4 +112,5 @@ Configuration
   Performance Monitor:              $enable_performance_monitor
   Data Dir (Read/Write):            $dataReadWriteDir
   Data Dir (Read Only):             $dataReadOnlyDir
+  Emscripten:                       $enable_emscripten
 "
index d2d3a60..602081b 100644 (file)
@@ -176,7 +176,7 @@ CLEANFILES = dali-shaders.cpp \
 
 noinst_PROGRAMS = linker.test
 
-linker_test_SOURCES = linker-test.cpp
+linker_test_SOURCES = linker-test.cpp ../../../automated-tests/dali-test-suite-utils/test-application.cpp
 
 linker_test_CXXFLAGS = \
   -Werror -Wall -Wfloat-equal \
index d3f6057..a3eaf75 100644 (file)
 // C++0x not supported
 #endif
 
+#ifdef EMSCRIPTEN
+
+#ifndef __clang__
+# error not clang?
+#endif
+
+// clang cpp11 check is per feature
+#if !__has_feature(cxx_constexpr)
+# error constexpr needed for compile-time-math. Use --std=c11
+#endif
+
+#define _CPP11
+
+#endif
+
 namespace Dali
 {
 
index 0692259..a8369e2 100644 (file)
@@ -36,7 +36,7 @@ namespace Internal DALI_INTERNAL
 class PanGestureDetector;
 }
 
-class PanGesture;
+struct PanGesture;
 
 /**
  * This class looks for panning (or dragging) gestures.  The user will be pressing one or more fingers on
index 0c8b644..3d1fc5f 100644 (file)
@@ -34,7 +34,7 @@ namespace Internal DALI_INTERNAL
 class PinchGestureDetector;
 }
 
-class PinchGesture;
+struct PinchGesture;
 
 /**
  * This class looks for pinching gestures involving two touches.  It tries to detect when the user moves two
index ba99f9b..ec42325 100644 (file)
@@ -34,7 +34,7 @@ namespace Internal DALI_INTERNAL
 class TapGestureDetector;
 }
 
-class TapGesture;
+struct TapGesture;
 
 /**
  * This class emits a signal when a tap gesture occurs that meets the requirements set by the
index 6d71076..a03449d 100644 (file)
@@ -100,6 +100,7 @@ struct Log< 0, base >
   enum { value = 0 };
 };
 
+
 /**
  * Compile time template to calculate the machine epsilon for a given floating point number
  * Note! value needs to be compile time constant
index 8b81750..d4cdef6 100644 (file)
@@ -35,7 +35,7 @@ namespace Dali DALI_IMPORT_API
 
 struct Vector2;
 struct Vector4;
-struct Quaternion;
+class Quaternion;
 
 /**
  * 3d Vector
index 3f362ae..3f36c78 100644 (file)
@@ -57,7 +57,9 @@ void LocklessBuffer::Write( const unsigned char *src, size_t size )
   memcpy( mBuffer[index], src, size );
 
   // unset WRITING bit, set UPDATED bit
-  BufferState checkState = __sync_val_compare_and_swap( &mState, (currentState | WRITING), (index | UPDATED) );
+  BufferState checkState = __sync_val_compare_and_swap( &mState,
+                                                        static_cast<BufferState>(currentState | WRITING),
+                                                        static_cast<BufferState>(index | UPDATED) );
 
   DALI_ASSERT_DEBUG( checkState & WRITING );
   (void)checkState; // Avoid unused variable warning
@@ -73,7 +75,9 @@ const unsigned char* LocklessBuffer::Read()
   {
     // Try to swap buffers.
     // This will set mState to 1 if readbuffer 0 was updated, 0 if readbuffer 1 was updated and fail if WRITING is set
-    if( __sync_bool_compare_and_swap( &mState, currentWriteBuf | UPDATED, !currentWriteBuf ) )
+    if( __sync_bool_compare_and_swap( &mState,
+                                      static_cast<BufferState>(currentWriteBuf | UPDATED),
+                                      static_cast<BufferState>(!currentWriteBuf) )  )
     {
       // swap successful
       return mBuffer[currentWriteBuf];
index 4260201..0cfb179 100644 (file)
 #include <string.h>
 #include <sstream>
 #include <iomanip>
-#include <boost/thread/tss.hpp>
+
+#ifndef EMSCRIPTEN
+# include <boost/thread/tss.hpp>
+#endif
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/constants.h>
@@ -100,7 +103,11 @@ struct ThreadLocalLogging
   unsigned int logOptions;
 };
 
+#ifndef EMSCRIPTEN // single threaded
 boost::thread_specific_ptr<ThreadLocalLogging> threadLocal;
+#else
+std::auto_ptr<ThreadLocalLogging> threadLocal;
+#endif
 
 /* Forward declarations */
 std::string FormatToString(const char *format, ...);
@@ -178,7 +185,6 @@ void LogMessage(DebugPriority priority, const char* format, ...)
   {
     return;
   }
-
   va_list arg;
   va_start(arg, format);
   std::string message = ArgListToString(format, arg);
index b9d0019..5d50e18 100644 (file)
@@ -34,9 +34,9 @@ namespace Dali
 struct Vector2;
 struct Vector3;
 struct Vector4;
-struct Matrix3;
-struct Matrix;
-struct Quaternion;
+class Matrix3;
+class Matrix;
+class Quaternion;
 
 namespace Integration
 {
index 14f295b..83856af 100644 (file)
@@ -30,7 +30,7 @@ struct Vector3;
 namespace Integration
 {
 
-class DynamicsBodySettings;
+struct DynamicsBodySettings;
 class DynamicsShape;
 class DynamicsWorld;
 
index 85382b2..16311f0 100644 (file)
@@ -29,11 +29,11 @@ struct Vector3;
 namespace Integration
 {
 
-class DynamicsCollisionData;
+struct DynamicsCollisionData;
 class DynamicsBody;
 class DynamicsJoint;
 class DynamicsWorld;
-class DynamicsWorldSettings;
+struct DynamicsWorldSettings;
 typedef std::map<void*, DynamicsCollisionData> CollisionDataContainer;
 
 DynamicsWorld* InitializeDynamics( DynamicsWorldSettings* settings );
index 52e10e4..563106c 100644 (file)
@@ -109,7 +109,6 @@ Layer::Layer( Actor::DerivedType type )
   mLayerList(NULL),
   mClippingBox(0,0,0,0),
   mSortFunction(Dali::Layer::ZValue),
-  mRenderOffscreen(false),
   mIsClipping(false),
   mDepthTestDisabled(false)
 {
index e2b7baa..caff89d 100644 (file)
@@ -248,11 +248,10 @@ private:
   ClippingBox mClippingBox;                     ///< The clipping box, in window coordinates
   Dali::Layer::SortFunctionType mSortFunction;  ///< Used to sort semi-transparent geometry
 
-  bool mRenderOffscreen:1;                      ///< true when rendering to a FBO
   bool mIsClipping:1;                           ///< True when clipping is enabled
   bool mDepthTestDisabled:1;                    ///< Whether depth test is disabled.
 
-  static bool mFirstInstance ;
+  static bool mFirstInstance;
   static DefaultPropertyLookup* mDefaultLayerPropertyLookup; ///< Default properties
 };
 
index efa981e..4043e1b 100644 (file)
@@ -28,7 +28,7 @@ namespace Dali
 namespace Internal
 {
 
-class Source;
+struct Source;
 typedef std::vector<Source> SourceContainer;
 typedef SourceContainer::iterator SourceIter;
 
diff --git a/dali/internal/event/common/demangler.cpp b/dali/internal/event/common/demangler.cpp
new file mode 100644 (file)
index 0000000..673972e
--- /dev/null
@@ -0,0 +1,165 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+//
+// gcc and clang minimal demangling
+// Both follow Itanium C++ ABI
+//
+// We only decode namespaces and class typeid names for simplicity as its all we need.
+//
+// From http://mentorembedded.github.io/cxx-abi/abi.html#mangling-structure
+//
+// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
+//     ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
+//
+// <prefix> ::= <prefix> <unqualified-name>
+//     ::= <template-prefix> <template-args>
+//          ::= <template-param>
+//          ::= <decltype>
+//     ::= # empty
+//     ::= <substitution>
+//          ::= <prefix> <data-member-prefix>
+//
+// <template-prefix> ::= <prefix> <template unqualified-name>
+//                   ::= <template-param>
+//                   ::= <substitution>
+// <unqualified-name> ::= <operator-name>
+//                    ::= <ctor-dtor-name>
+//                    ::= <source-name>
+//                    ::= <unnamed-type-name>
+//
+// <source-name> ::= <positive length number> <identifier>
+// <number> ::= [n] <non-negative decimal integer>
+// <identifier> ::= <unqualified source code identifier>
+//
+// So for example
+//
+// Dali::Internal::Actor would be
+//
+//   N4Dali8Internal5ActorE
+//
+
+// CLASS HEADER
+#include <dali/internal/event/common/demangler.h>
+
+namespace
+{
+
+// true if character represent a digit
+inline bool IsDigit(char c)
+{
+  return (c >= '0' && c <= '9');
+}
+
+// Gets the number of characters (number is in string)
+//   start The start position to look for a number
+//   result The number as an integer
+//   returns the number of characters used to define the number ie '12' is 2
+size_t GetNumberOfCharacters(const std::string& s, const size_t& start, int& result)
+{
+  size_t size = s.size();
+
+  size_t i = start;
+
+  int number = 0;
+
+  for( ; i < size; ++i )
+  {
+    char c = s.at(i);
+    if( !IsDigit( c ) )
+    {
+      break;
+    }
+    else
+    {
+      number = 10 * number + (c - '0');
+    }
+  }
+
+  if( i - start )
+  {
+    result = number;
+  }
+
+  return i - start;
+}
+
+} // anon namespace
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+#if defined(__clang__) || defined(__GNUC__)
+
+// Demangle class name mangled according to the Itanium C++ ABI
+// Returns demangled names ie "N4Dali8Internal5ActorE" is ["Dali","Internal","Actor"]
+std::vector<std::string> DemangleNestedNames(const char *typeIdName)
+{
+  std::vector<std::string> ret;
+
+  const std::string mangledName(typeIdName);
+
+
+  size_t size = mangledName.size();
+
+  if( size >= 2 )
+  {
+    int number = 0;
+    size_t start = 0;
+
+    // If the class isnt nested in a namespace then it just starts with the
+    // number of characters
+    if(mangledName[0] == 'N' && mangledName[size-1]  == 'E')
+    {
+      start = 1;
+    }
+
+    while( size_t chars = GetNumberOfCharacters(mangledName, start, number) )
+    {
+      ret.push_back( mangledName.substr( start + chars, number ) );
+
+      start += chars + number;
+    }
+  }
+
+  return ret;
+}
+
+#else
+# error Unsupported Compiler
+#endif
+
+
+const std::string DemangleClassName(const char *typeIdName)
+{
+  std::string name;
+  std::vector<std::string> names = DemangleNestedNames(typeIdName);
+
+  if( names.size() )
+  {
+    name = names[ names.size() - 1 ];
+  }
+
+  return name;
+}
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/event/common/demangler.h b/dali/internal/event/common/demangler.h
new file mode 100644 (file)
index 0000000..8c90c8e
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef __DALI_DEMANGLER_H__
+#define __DALI_DEMANGLER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// INTERNAL INCLUDES
+#include <vector>
+#include <string>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+/**
+ * Demangle a nested typeid name into its component parts.
+ * A nested type name is one containing namespaces and class names only.
+ *   eg DemangleNestedNames(typeid(Dali::Actor).name());
+ * @param[in] typeIdName The type id name string to demangle.
+ * @returns the demangled list of names ie ["Dali","Actor"] or an empty list
+ */
+std::vector<std::string> DemangleNestedNames(const char *typeIdName);
+
+/**
+ * Demangle a nested typeid name to its class name.
+ * @param[in] typeIdName The type id name string to demangle.
+ * @returns the class name ie "Actor" or an empty string
+ */
+const std::string DemangleClassName(const char *typeIdName);
+
+}
+
+}
+
+
+#endif // header
index 36bf8b8..56845e9 100644 (file)
 #include <dali/internal/event/common/notification-manager.h>
 
 // EXTERNAL INCLUDES
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wall"
+
 #include <boost/thread/mutex.hpp>
 
+#pragma clang diagnostic pop
+#else
+
+#include <boost/thread/mutex.hpp>
+
+#endif // __clang__
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/internal/event/common/property-notification-impl.h>
index 28d342d..94cdd26 100644 (file)
@@ -19,6 +19,7 @@
 
 // EXTERNAL INCLUDES
 #include <boost/thread/tss.hpp>
+#include <memory>
 
 // INTERNAL INCLUDES
 #include <dali/internal/common/core-impl.h>
@@ -36,7 +37,11 @@ namespace Internal
 
 namespace
 {
-boost::thread_specific_ptr<ThreadLocalStorage> threadLocal;
+#ifdef EMSCRIPTEN
+  std::auto_ptr<ThreadLocalStorage> threadLocal;
+#else
+  boost::thread_specific_ptr<ThreadLocalStorage> threadLocal;
+#endif
 }
 
 ThreadLocalStorage::ThreadLocalStorage(Core* core)
index cd1e9c9..a2bad79 100644 (file)
@@ -18,8 +18,6 @@
 #include <dali/internal/event/common/type-registry-impl.h>
 
 // EXTERNAL INCLUDES
-#include <execinfo.h>
-#include <cxxabi.h>
 #include <string.h>
 #include <sstream>
 
@@ -28,6 +26,7 @@
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/internal/event/actors/custom-actor-internal.h>
+#include <dali/internal/event/common/demangler.h>
 
 #include <dali/integration-api/debug.h>
 
@@ -38,51 +37,6 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_TYPE_REGISTRY");
 #endif
 
-std::vector<std::string> SplitString(const std::string &s, char delim, std::vector<std::string> &elems)
-{
-  std::stringstream ss(s);
-  std::string item;
-  while(std::getline(ss, item, delim))
-  {
-    elems.push_back(item);
-  }
-  return elems;
-}
-
-const int Demangle(const char* symbol, std::vector<std::string> &resolved)
-{
-  int status = -4;
-
-  char* res = abi::__cxa_demangle(symbol, NULL, NULL, &status);
-
-  const char* const demangled_name = (status==0)?res:symbol;
-
-  std::string sDemangled(demangled_name);
-
-  free(res);
-
-  SplitString(sDemangled, ':', resolved);
-
-  return resolved.size();
-}
-
-const std::string DemangleShortName(const char *symbol)
-{
-  std::vector<std::string> resolved;
-
-  Demangle(symbol, resolved);
-
-  if(resolved.size() > 0)
-  {
-    return resolved[ resolved.size() - 1 ];
-  }
-  else
-  {
-    return std::string(symbol);
-  }
-
-}
-
 } // namespace anon
 
 namespace Dali
@@ -132,7 +86,7 @@ Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
 {
   Dali::TypeInfo ret;
 
-  std::string typeName = DemangleShortName(registerType.name());
+  std::string typeName = DemangleClassName(registerType.name());
 
   RegistryMap::iterator iter = mRegistryLut.find(typeName);
 
@@ -161,9 +115,9 @@ Dali::TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
 }
 
 bool TypeRegistry::Register( const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo,
-                               Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit )
+                             Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit )
 {
-  std::string uniqueTypeName  = DemangleShortName(theTypeInfo.name());
+  std::string uniqueTypeName  = DemangleClassName(theTypeInfo.name());
 
   return Register( uniqueTypeName, baseTypeInfo, createInstance, callCreateOnInit );
 }
@@ -173,7 +127,7 @@ bool TypeRegistry::Register( const std::string& uniqueTypeName, const std::type_
 {
   bool ret = false;
 
-  std::string baseTypeName    = DemangleShortName(baseTypeInfo.name());
+  std::string baseTypeName    = DemangleClassName(baseTypeInfo.name());
 
   RegistryMap::iterator iter = mRegistryLut.find(uniqueTypeName);
 
@@ -207,7 +161,7 @@ void TypeRegistry::CallInitFunctions(void) const
 
 std::string TypeRegistry::RegistrationName( const std::type_info& registerType )
 {
-  return DemangleShortName( registerType.name() );
+  return DemangleClassName( registerType.name() );
 }
 
 void TypeRegistry::RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunctionV2 func )
index 1b5b952..249ca29 100644 (file)
@@ -53,9 +53,8 @@ static const std::size_t INITIAL_BUFFER_SIZE = MAX_MESSAGE_SIZE * INITIAL_MIN_CA
 
 } // unnamed namespace
 
-EventProcessor::EventProcessor(Stage& stage, NotificationManager& notificationManager, GestureEventProcessor& gestureEventProcessor)
-: mNotificationManager(notificationManager),
-  mTouchEventProcessor(stage),
+EventProcessor::EventProcessor(Stage& stage, NotificationManager& /* notificationManager */, GestureEventProcessor& gestureEventProcessor)
+: mTouchEventProcessor(stage),
   mGestureEventProcessor(gestureEventProcessor),
   mKeyEventProcessor(stage),
   mMouseWheelEventProcessor(stage),
index 306b15e..ebdb6a2 100644 (file)
@@ -85,7 +85,6 @@ private:
 
 private:
 
-  NotificationManager&     mNotificationManager;        ///< Processes notification events.
   TouchEventProcessor      mTouchEventProcessor;        ///< Processes touch events.
   GestureEventProcessor&   mGestureEventProcessor;      ///< Processes gesture events.
   KeyEventProcessor        mKeyEventProcessor;          ///< Processes key events.
index 41f6140..109f2a5 100644 (file)
@@ -30,7 +30,7 @@ namespace Dali
 
 namespace Integration
 {
-class GestureEvent;
+struct GestureEvent;
 }
 
 namespace Internal
index 387999c..d15d85f 100644 (file)
@@ -87,6 +87,7 @@ public:
   /**
    * Get the property index from the vertex index and the vertex property enumeration
    */
+  using ProxyObject::GetPropertyIndex;
   Property::Index GetPropertyIndex( unsigned int vertex, Property::Index property ) const;
 
   /**
index 7284856..376216c 100644 (file)
@@ -50,7 +50,7 @@ enum VertexElementType
 namespace Internal
 {
 class Material;
-class MaterialProperties;
+struct MaterialProperties;
 class ModelData;
 
 namespace Serialize
index 1b62373..9e4729d 100644 (file)
@@ -40,7 +40,8 @@ ModelFactory::~ModelFactory()
 ResourceTicketPtr ModelFactory::Load( const std::string& filename )
 {
   ResourceTicketPtr ticket;
-  ResourceTypePath typePath(ModelResourceType(), filename);
+  ModelResourceType modelResourceType; // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(modelResourceType, filename);
 
   // Search for a matching resource
   ResourceTypePathIdIter iter = mResourceTypePathIdMap.end();
@@ -67,7 +68,8 @@ ResourceTicketPtr ModelFactory::Load( const std::string& filename )
   // Request a new model resource, if necessary
   if ( !ticket )
   {
-    ticket = mResourceClient.RequestResource(ModelResourceType(), filename);
+    ModelResourceType modelResourceType; // construct first as no copy ctor (needed to bind ref to object)
+    ticket = mResourceClient.RequestResource(modelResourceType, filename);
 
     mResourceTypePathIdMap.insert( ResourceTypePathIdPair( typePath, ticket->GetId() ) );
   }
index 150ca12..498e3fb 100644 (file)
@@ -139,7 +139,12 @@ void Model::Write()
   }
   else
   {
+#ifndef EMSCRIPTEN
     fprintf(stderr, "%s: Model not loaded yet\n", __PRETTY_FUNCTION__);
+#else
+    // printf to stderr doesnt always show in browser console window
+    printf("%s: Model not loaded yet\n", __PRETTY_FUNCTION__);
+#endif
   }
 }
 
index 25c5d99..98c898c 100644 (file)
@@ -294,8 +294,8 @@ ImageTicketPtr ResourceClient::AddBitmapImage(Bitmap* bitmap)
   const ResourceId newId = ++(mImpl->mNextId);
 
   Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New(bitmap->GetImageWidth(), bitmap->GetImageHeight(), bitmap->GetPixelFormat());
-  ResourceTypePath typePath(BitmapResourceType(imageAttributes), "");
-
+  BitmapResourceType bitmapResourceType(imageAttributes); // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(bitmapResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
   newTicket->mAttributes = imageAttributes;
   newTicket->LoadingSucceeded();
@@ -316,8 +316,8 @@ ResourceTicketPtr ResourceClient::AddNativeImage ( NativeImage& resourceData )
   ImageTicketPtr newTicket;
 
   const ResourceId newId = ++(mImpl->mNextId);
-
-  ResourceTypePath typePath(NativeImageResourceType(), "");
+  NativeImageResourceType nativeImageResourceType; // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(nativeImageResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
   newTicket->mAttributes = ImageAttributes::New(resourceData.GetWidth(),
                                                 resourceData.GetHeight(),
@@ -340,7 +340,8 @@ ImageTicketPtr ResourceClient::AddFrameBufferImage ( unsigned int width, unsigne
   const ResourceId newId = ++(mImpl->mNextId);
 
   Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New(width, height, pixelFormat );
-  ResourceTypePath typePath(RenderTargetResourceType(imageAttributes), "");
+  RenderTargetResourceType renderTargetResourceType(imageAttributes) ; // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(renderTargetResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
   newTicket->mAttributes = imageAttributes;
   newTicket->LoadingSucceeded();
@@ -360,7 +361,8 @@ ImageTicketPtr ResourceClient::AddFrameBufferImage ( NativeImage& nativeImage )
   const ResourceId newId = ++(mImpl->mNextId);
 
   Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New(nativeImage.GetWidth(), nativeImage.GetHeight(), nativeImage.GetPixelFormat() );
-  ResourceTypePath typePath(RenderTargetResourceType(imageAttributes), "");
+  RenderTargetResourceType renderTargetResourceType(imageAttributes); // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(renderTargetResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
   newTicket->mAttributes = imageAttributes;
   newTicket->LoadingSucceeded();
@@ -382,7 +384,8 @@ ResourceTicketPtr ResourceClient::AllocateTexture( unsigned int width,
   const ResourceId newId = ++(mImpl->mNextId);
 
   Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::New( width, height, pixelformat);
-  ResourceTypePath typePath(BitmapResourceType(imageAttributes), "");
+  BitmapResourceType bitmapResourceType(imageAttributes); // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(bitmapResourceType, "");
   newTicket = new ImageTicket(*this, newId, typePath);
 
   mImpl->mTickets.insert(TicketPair(newId, newTicket.Get()));
@@ -406,7 +409,8 @@ ResourceTicketPtr ResourceClient::AllocateMesh( OwnerPointer<MeshData>& meshData
 {
   ResourceTicketPtr newTicket;
   const ResourceId newId = ++(mImpl->mNextId);
-  ResourceTypePath typePath(MeshResourceType(), "");
+  MeshResourceType meshResourceType; // construct first as no copy ctor (needed to bind ref to object)
+  ResourceTypePath typePath(meshResourceType, "");
   newTicket = new ResourceTicket(*this, newId, typePath);
   mImpl->mTickets.insert(TicketPair(newId, newTicket.Get()));
 
index 34dddfe..9bcf86a 100644 (file)
@@ -46,7 +46,7 @@ namespace Internal
 
 // Forward declarations.
 
-class TextFormat;
+struct TextFormat;
 class ResourceClient;
 class FontFactory;
 
index 994a41a..a30c78e 100644 (file)
@@ -97,7 +97,7 @@ Vector3 FontMetrics::MeasureText( const TextArray& text )
   TextArray  utfCodes = GetUniqueCharacters( text );
 
   // ensure all the metrics are loaded for the characters
-  LoadMetricsSynchronously( utfCodes ) ;
+  LoadMetricsSynchronously( utfCodes );
 
   // Measure text
   // Calculate the natural size of text for the font
@@ -303,7 +303,7 @@ void FontMetrics::GetMetrics( const Dali::Character& character, Dali::Font::Metr
   TextArray utfCodes;
   utfCodes.push_back( character.GetImplementation().GetCharacter() );
 
-  LoadMetricsSynchronously( utfCodes ) ;
+  LoadMetricsSynchronously( utfCodes );
 
   const GlyphMetric* glyph;
 
@@ -428,8 +428,7 @@ FontMetrics::FontMetrics(const Vector2& dpi,
   mFontId(fontId),
   mFontCount( 0 ),
   mMetricsLoaded( false ),
-  mPlatform( ThreadLocalStorage::Get().GetPlatformAbstraction() ),
-  mResourceClient( resourceClient )
+  mPlatform( ThreadLocalStorage::Get().GetPlatformAbstraction() )
 {
 }
 
index e57b0b6..65762c7 100644 (file)
@@ -317,7 +317,6 @@ private:
   unsigned int          mFontCount;             ///< How many font objects are using this font, used to know when it should be deleted from font factory
   bool                  mMetricsLoaded;         ///< Whether the metrics cache has been loaded
   Integration::PlatformAbstraction& mPlatform;  ///< platform abstraction
-  ResourceClient&       mResourceClient;        ///< resource client
 };
 
 } // namespace Internal
index fb0b254..a7748a8 100644 (file)
@@ -31,6 +31,7 @@ internal_src_files = \
   $(internal_src_dir)/event/animation/animation-playlist.cpp \
   $(internal_src_dir)/event/animation/constraint-impl.cpp \
   $(internal_src_dir)/event/animation/key-frames-impl.cpp \
+  $(internal_src_dir)/event/common/demangler.cpp \
   $(internal_src_dir)/event/common/notification-manager.cpp \
   $(internal_src_dir)/event/common/object-registry-impl.cpp \
   $(internal_src_dir)/event/common/projection.cpp \
index 46ffdf1..cd444c2 100644 (file)
@@ -52,7 +52,7 @@ class PropertyInputImpl;
 namespace SceneGraph
 {
 class RenderInstruction;
-class RenderList;
+struct RenderList;
 class RenderItem;
 }
 
index 7c1346c..589c94f 100644 (file)
@@ -33,8 +33,7 @@ namespace SceneGraph
 {
 
 DynamicsDebugRenderer::DynamicsDebugRenderer(const Shader& debugShader)
-: mBufferName(0),
-  mShader(const_cast<Shader&>(debugShader)),
+: mShader(const_cast<Shader&>(debugShader)),
   mContext(NULL),
   mBufferIndex(0),
   mViewMatrix(Matrix::IDENTITY),
index 76efbd4..5c9a04e 100644 (file)
@@ -57,8 +57,6 @@ public:
   void UpdateBuffer( const Integration::DynamicsDebugVertexContainer& vertices );
 
 private:
-
-  int mBufferName;
   Shader& mShader;
   Context* mContext;
   BufferIndex mBufferIndex;
index c76a1aa..4f8274a 100644 (file)
@@ -307,9 +307,11 @@ void Context::ResetGlState()
   LOG_GL("BindBuffer GL_ELEMENT_ARRAY_BUFFER 0\n");
   mGlAbstraction.BindBuffer(GL_ELEMENT_ARRAY_BUFFER, mBoundElementArrayBufferId);
 
+#ifndef EMSCRIPTEN // not in WebGL
   mBoundTransformFeedbackBufferId = 0;
   LOG_GL("BindBuffer GL_TRANSFORM_FEEDBACK_BUFFER 0\n");
   mGlAbstraction.BindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, mBoundTransformFeedbackBufferId);
+#endif
 
   mActiveTextureUnit = UNINITIALIZED_TEXTURE_UNIT;
 
index e9b6a54..0a59f7b 100644 (file)
@@ -35,7 +35,7 @@ namespace SceneGraph
 {
 
 class RenderDataProvider;
-class BoneTransforms;
+struct BoneTransforms;
 class LightController;
 class RenderMaterial;
 class Mesh;
index 844af78..ed04693 100644 (file)
@@ -281,7 +281,7 @@ bool TextRenderer::CheckResources()
   {
     mTexture = mTextureCache->GetTexture( mTextureId );
 
-    if( ( mTexture == NULL ) )
+    if( mTexture == NULL )
     {
       // texture atlas hasn't been created yet
       return false;
index c71eb60..2ef61ec 100644 (file)
@@ -17,8 +17,6 @@
 // CLASS HEADER
 #include <dali/internal/update/common/scene-graph-buffers.h>
 
-using namespace std;
-
 namespace Dali
 {
 
index 88e593d..f0c200b 100644 (file)
@@ -36,7 +36,7 @@ namespace Integration
 {
 
 class DynamicsBody;
-class DynamicsBodySettings;
+struct DynamicsBodySettings;
 
 } // namespace Integration
 
index a85efc9..50e32cd 100644 (file)
@@ -268,6 +268,14 @@ public:
     }
   }
 
+  virtual void Update( BufferIndex /*updateBufferIndex*/, const Node& /*owningNode*/, int /*nodeDirtyFlags*/ )
+  {
+    if (mUpdateRequired)
+    {
+      mUpdateRequired = false;
+    }
+  }
+
 protected:
 
   /**
@@ -283,14 +291,6 @@ private:
   // Undefined
   LightAttachment& operator=(const LightAttachment& rhs);
 
-  void Update()
-  {
-    if (mUpdateRequired)
-    {
-      mUpdateRequired = false;
-    }
-  }
-
 private:
   Internal::LightPtr mLight;
   bool               mUpdateRequired;                ///< This is set to true if the projection matrix requires an update
index adeb03d..b5c9896 100644 (file)
 #include <dali/internal/update/queue/update-message-queue.h>
 
 // EXTERNAL INCLUDES
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wall"
 #include <boost/thread/mutex.hpp>
+#pragma clang diagnostic pop
+#else
+#include <boost/thread/mutex.hpp>
+#endif // ifdef __clang
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
index e975db0..4efbf20 100644 (file)
@@ -81,7 +81,7 @@ class History
 {
   typedef HistoryPairType<Vector2> HistoryPair;
   typedef std::set<HistoryPair> HistoryContainer;
-  typedef typename HistoryContainer::iterator HistoryContainerIter;
+  typedef HistoryContainer::iterator HistoryContainerIter;
 
 public:
 
index 9ef8a26..82a4b6c 100644 (file)
 #include <string>
 #include <cstdio>
 #include <execinfo.h>
-#include <cxxabi.h>
+
+#ifndef EMSCRIPTEN // cxxabi not supported
+# include <cxxabi.h>
+#endif
+
 #include <cstring>
 
 // INTERNAL INCLUDES
@@ -37,6 +41,8 @@ const size_t C_SYMBOL_LENGTH = 4096;
 namespace Dali
 {
 
+#ifndef EMSCRIPTEN
+
 std::string Demangle(const char* symbol)
 {
   std::string result;
@@ -87,6 +93,10 @@ std::string Demangle(const char* symbol)
   return result;
 }
 
+#endif // EMSCRIPTEN
+
+#ifndef EMSCRIPTEN
+
 DALI_EXPORT_API DaliException::DaliException(const char *location, const char* condition)
 : mLocation(location), mCondition(condition)
 {
@@ -110,6 +120,16 @@ DALI_EXPORT_API DaliException::DaliException(const char *location, const char* c
   free(symbols);
 }
 
+#else
+
+DALI_EXPORT_API DaliException::DaliException(const char *location, const char* condition)
+: mLocation(location), mCondition(condition)
+{
+  printf("Exception: \n%s\n thrown at %s\nSee dlog for backtrace\n", mCondition.c_str(), mLocation.c_str());
+}
+
+#endif // EMSCRIPTEN
+
 DALI_EXPORT_API void DaliAssertMessage(const char* condition, const char* file, int line)
 {
   DALI_LOG_ERROR_NOFN( "Assertion (%s) failed in: %s:%d\n", condition, file, line );
index b54dc6b..d014ae2 100644 (file)
@@ -29,16 +29,6 @@ namespace Dali
 namespace
 {
 
-Vector3 CalculateNormal(const Vector3& v0, const Vector3& v1, const Vector3& v2)
-{
-  // Calculate normal...
-  const Vector3 e0 = v1 - v0;
-  const Vector3 e1 = v2 - v1;
-  Vector3 normal = e0.Cross(e1);
-  normal.Normalize();
-  return normal;
-}
-
 } // namespace
 
 Mesh::Mesh()
index 31b7458..c6631a5 100644 (file)
@@ -26,7 +26,7 @@ namespace Dali DALI_IMPORT_API
 
 class Matrix;
 
-struct Bone;
+class Bone;
 typedef std::vector< Bone >           BoneContainer;
 typedef BoneContainer::iterator       BoneIter;
 typedef BoneContainer::const_iterator BoneConstIter;