Selaa lähdekoodia

[c][cpp] Fix remaining 4.0 porting bugs, apply formatter.

Mario Zechner 4 vuotta sitten
vanhempi
commit
4715608108
100 muutettua tiedostoa jossa 5418 lisäystä ja 4930 poistoa
  1. 21 21
      spine-c/spine-c-unit-tests/main.cpp
  2. 178 183
      spine-c/spine-c-unit-tests/memory/KMemory.cpp
  3. 58 66
      spine-c/spine-c-unit-tests/memory/KMemory.h
  4. 42 51
      spine-c/spine-c-unit-tests/memory/KString.cpp
  5. 8 6
      spine-c/spine-c-unit-tests/memory/KString.h
  6. 109 127
      spine-c/spine-c-unit-tests/minicppunit/MiniCppUnit.cxx
  7. 167 165
      spine-c/spine-c-unit-tests/minicppunit/MiniCppUnit.hxx
  8. 42 48
      spine-c/spine-c-unit-tests/teamcity/teamcity_cppunit.cpp
  9. 29 22
      spine-c/spine-c-unit-tests/teamcity/teamcity_cppunit.h
  10. 153 146
      spine-c/spine-c-unit-tests/teamcity/teamcity_messages.cpp
  11. 39 30
      spine-c/spine-c-unit-tests/teamcity/teamcity_messages.h
  12. 9 17
      spine-c/spine-c-unit-tests/tests/CPP_InterfaceTestFixture.cpp
  13. 13 7
      spine-c/spine-c-unit-tests/tests/CPP_InterfaceTestFixture.h
  14. 20 27
      spine-c/spine-c-unit-tests/tests/C_InterfaceTestFixture.cpp
  15. 11 8
      spine-c/spine-c-unit-tests/tests/C_InterfaceTestFixture.h
  16. 6 11
      spine-c/spine-c-unit-tests/tests/EmptyTestFixture.cpp
  17. 12 8
      spine-c/spine-c-unit-tests/tests/EmptyTestFixture.h
  18. 60 66
      spine-c/spine-c-unit-tests/tests/MemoryTestFixture.cpp
  19. 13 5
      spine-c/spine-c-unit-tests/tests/MemoryTestFixture.h
  20. 45 45
      spine-c/spine-c-unit-tests/tests/SpineEventMonitor.cpp
  21. 29 21
      spine-c/spine-c-unit-tests/tests/SpineEventMonitor.h
  22. 6 11
      spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/CPP_InterfaceTestFixture.cpp
  23. 9 5
      spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/CPP_InterfaceTestFixture.h
  24. 6 11
      spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/_TestFixture.cpp
  25. 27 18
      spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/_TestFixture.h
  26. 192 154
      spine-c/spine-c/include/spine/Animation.h
  27. 57 38
      spine-c/spine-c/include/spine/AnimationState.h
  28. 10 7
      spine-c/spine-c/include/spine/AnimationStateData.h
  29. 83 78
      spine-c/spine-c/include/spine/Array.h
  30. 25 22
      spine-c/spine-c/include/spine/Atlas.h
  31. 2 2
      spine-c/spine-c/include/spine/AtlasAttachmentLoader.h
  32. 5 5
      spine-c/spine-c/include/spine/Attachment.h
  33. 9 8
      spine-c/spine-c/include/spine/AttachmentLoader.h
  34. 32 21
      spine-c/spine-c/include/spine/Bone.h
  35. 5 4
      spine-c/spine-c/include/spine/BoneData.h
  36. 1 1
      spine-c/spine-c/include/spine/BoundingBoxAttachment.h
  37. 4 3
      spine-c/spine-c/include/spine/ClippingAttachment.h
  38. 19 10
      spine-c/spine-c/include/spine/Color.h
  39. 16 9
      spine-c/spine-c/include/spine/Debug.h
  40. 5 4
      spine-c/spine-c/include/spine/Event.h
  41. 6 5
      spine-c/spine-c/include/spine/EventData.h
  42. 13 8
      spine-c/spine-c/include/spine/IkConstraint.h
  43. 6 5
      spine-c/spine-c/include/spine/IkConstraintData.h
  44. 14 11
      spine-c/spine-c/include/spine/MeshAttachment.h
  45. 2 2
      spine-c/spine-c/include/spine/PathAttachment.h
  46. 15 12
      spine-c/spine-c/include/spine/PathConstraint.h
  47. 6 5
      spine-c/spine-c/include/spine/PathConstraintData.h
  48. 5 3
      spine-c/spine-c/include/spine/PointAttachment.h
  49. 10 6
      spine-c/spine-c/include/spine/RegionAttachment.h
  50. 34 29
      spine-c/spine-c/include/spine/Skeleton.h
  51. 11 7
      spine-c/spine-c/include/spine/SkeletonBinary.h
  52. 22 16
      spine-c/spine-c/include/spine/SkeletonBounds.h
  53. 23 16
      spine-c/spine-c/include/spine/SkeletonClipping.h
  54. 31 27
      spine-c/spine-c/include/spine/SkeletonData.h
  55. 10 7
      spine-c/spine-c/include/spine/SkeletonJson.h
  56. 26 22
      spine-c/spine-c/include/spine/Skin.h
  57. 13 11
      spine-c/spine-c/include/spine/Slot.h
  58. 8 7
      spine-c/spine-c/include/spine/SlotData.h
  59. 8 6
      spine-c/spine-c/include/spine/TransformConstraint.h
  60. 7 6
      spine-c/spine-c/include/spine/TransformConstraintData.h
  61. 15 11
      spine-c/spine-c/include/spine/Triangulator.h
  62. 6 5
      spine-c/spine-c/include/spine/VertexAttachment.h
  63. 1 1
      spine-c/spine-c/include/spine/VertexEffect.h
  64. 69 47
      spine-c/spine-c/include/spine/extension.h
  65. 748 686
      spine-c/spine-c/src/spine/Animation.c
  66. 285 230
      spine-c/spine-c/src/spine/AnimationState.c
  67. 29 28
      spine-c/spine-c/src/spine/AnimationStateData.c
  68. 5 0
      spine-c/spine-c/src/spine/Array.c
  69. 288 276
      spine-c/spine-c/src/spine/Atlas.c
  70. 55 55
      spine-c/spine-c/src/spine/AtlasAttachmentLoader.c
  71. 10 9
      spine-c/spine-c/src/spine/Attachment.c
  72. 24 18
      spine-c/spine-c/src/spine/AttachmentLoader.c
  73. 100 95
      spine-c/spine-c/src/spine/Bone.c
  74. 3 3
      spine-c/spine-c/src/spine/BoneData.c
  75. 9 8
      spine-c/spine-c/src/spine/BoundingBoxAttachment.c
  76. 9 8
      spine-c/spine-c/src/spine/ClippingAttachment.c
  77. 21 21
      spine-c/spine-c/src/spine/Color.c
  78. 196 194
      spine-c/spine-c/src/spine/Debug.c
  79. 3 3
      spine-c/spine-c/src/spine/Event.c
  80. 3 3
      spine-c/spine-c/src/spine/EventData.c
  81. 61 45
      spine-c/spine-c/src/spine/IkConstraint.c
  82. 3 3
      spine-c/spine-c/src/spine/IkConstraintData.c
  83. 131 128
      spine-c/spine-c/src/spine/Json.c
  84. 15 11
      spine-c/spine-c/src/spine/Json.h
  85. 61 60
      spine-c/spine-c/src/spine/MeshAttachment.c
  86. 7 7
      spine-c/spine-c/src/spine/PathAttachment.c
  87. 106 104
      spine-c/spine-c/src/spine/PathConstraint.c
  88. 3 3
      spine-c/spine-c/src/spine/PathConstraintData.c
  89. 9 9
      spine-c/spine-c/src/spine/PointAttachment.c
  90. 13 12
      spine-c/spine-c/src/spine/RegionAttachment.c
  91. 182 164
      spine-c/spine-c/src/spine/Skeleton.c
  92. 496 471
      spine-c/spine-c/src/spine/SkeletonBinary.c
  93. 35 30
      spine-c/spine-c/src/spine/SkeletonBounds.c
  94. 58 43
      spine-c/spine-c/src/spine/SkeletonClipping.c
  95. 28 27
      spine-c/spine-c/src/spine/SkeletonData.c
  96. 355 292
      spine-c/spine-c/src/spine/SkeletonJson.c
  97. 47 40
      spine-c/spine-c/src/spine/Skin.c
  98. 10 10
      spine-c/spine-c/src/spine/Slot.c
  99. 4 4
      spine-c/spine-c/src/spine/SlotData.c
  100. 68 64
      spine-c/spine-c/src/spine/TransformConstraint.c

+ 21 - 21
spine-c/spine-c-unit-tests/main.cpp

@@ -6,7 +6,9 @@
 #ifdef WIN32
 #include <direct.h>
 #else
+
 #include <unistd.h>
+
 #endif // WIN32
 
 #include <ctime>
@@ -18,19 +20,17 @@
 
 #include "KMemory.h" // last include
 
-void RegisterMemoryLeakDetector()
-{
+void RegisterMemoryLeakDetector() {
 	// Register our malloc and free functions to track memory leaks
-	#ifdef KANJI_MEMTRACE
+#ifdef KANJI_MEMTRACE
 	_spSetDebugMalloc(_kanjimalloc);
-	#endif
+#endif
 	_spSetMalloc(_kanjimalloc);
 	_spSetRealloc(_kanjirealloc);
 	_spSetFree(_kanjifree);
 }
 
-int main(int argc, char* argv[])
-{
+int main(int argc, char *argv[]) {
 	RegisterMemoryLeakDetector();
 
 	// Start Timing
@@ -46,14 +46,15 @@ int main(int argc, char* argv[])
 #endif
 
 	// Run Test Suite
-	if(JetBrains::underTeamcity()) gTeamCityListener.startSuite("Spine-C Test Suite");
+	if (JetBrains::underTeamcity()) gTeamCityListener.startSuite("Spine-C Test Suite");
 	int ret_val = TestFixtureFactory::theInstance().runTests() ? 0 : -1;
-	if(JetBrains::underTeamcity()) gTeamCityListener.endSuite("Spine-C Test Suite");
+	if (JetBrains::underTeamcity()) gTeamCityListener.endSuite("Spine-C Test Suite");
 
 	// End Timing
 	time(&end_time);
-	double secs = difftime(end_time,start_time);
-	printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int)secs) / 60, ((int)secs) % 60);
+	double secs = difftime(end_time, start_time);
+	printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int) secs) / 60,
+		   ((int) secs) % 60);
 
 	spAnimationState_disposeStatics(); // Fix for #775
 
@@ -61,19 +62,18 @@ int main(int argc, char* argv[])
 }
 
 
-
 extern "C" { // probably unnecessary
 
-	void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) {
-		self->rendererObject = 0;
-		self->width = 2048;
-		self->height = 2048;
-	}
+void _spAtlasPage_createTexture(spAtlasPage *self, const char *path) {
+	self->rendererObject = 0;
+	self->width = 2048;
+	self->height = 2048;
+}
 
-	void _spAtlasPage_disposeTexture(spAtlasPage* self) {
-	}
+void _spAtlasPage_disposeTexture(spAtlasPage *self) {
+}
 
-	char* _spUtil_readFile(const char* path, int* length) {
-		return _spReadFile(path, length);
-	}
+char *_spUtil_readFile(const char *path, int *length) {
+	return _spReadFile(path, length);
+}
 }

+ 178 - 183
spine-c/spine-c-unit-tests/memory/KMemory.cpp

@@ -36,46 +36,47 @@
 #include <mutex>
 typedef std::recursive_mutex KSysLock; // rentrant
 struct KAutoLock {
-	KAutoLock(KSysLock& lock) :mLock(lock) { mLock.lock(); }	// acquire 
+	KAutoLock(KSysLock& lock) :mLock(lock) { mLock.lock(); }	// acquire
 	~KAutoLock() { mLock.unlock(); }							// release
 
 	KSysLock& mLock;
 };
 #else // Fallback to unsafe.  don't spawn threads
 typedef int KSysLock;
+
 struct KAutoLock {
-	KAutoLock(KSysLock) {}	// acquire 
-	~KAutoLock() {}			// release
+	KAutoLock(KSysLock) {}    // acquire
+	~KAutoLock() {}            // release
 };
-#endif
 
+#endif
 
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-struct KANJI_ALLOC_INFO
-{
-    size_t  size;
-    std::string file;
-    int     line;
+struct KANJI_ALLOC_INFO {
+	size_t size;
+	std::string file;
+	int line;
 };
 static bool showLeaks = false;
-class KAllocMap : public std::map<void*, KANJI_ALLOC_INFO>
-{
+
+class KAllocMap : public std::map<void *, KANJI_ALLOC_INFO> {
 public:
-    KSysLock crit;
-    static bool allocMapValid;
+	KSysLock crit;
+	static bool allocMapValid;
 
 public:
-    KAllocMap() { allocMapValid = true; }
-    ~KAllocMap()
-    {
-        if (showLeaks)
-            KMemoryDumpUnfreed();
-
-        allocMapValid = false;
-    }
+	KAllocMap() { allocMapValid = true; }
+
+	~KAllocMap() {
+		if (showLeaks)
+			KMemoryDumpUnfreed();
+
+		allocMapValid = false;
+	}
 };
+
 bool KAllocMap::allocMapValid = false;
 static KAllocMap allocMap; // once this static object destructs, it dumps unfreed memory
 
@@ -87,219 +88,213 @@ void KMemoryDumpUsage(); // forward declaration
 class KAllocStat
 {
 public:
-    typedef std::map<int, int> allocCount; // [size] = count
-    typedef std::map<std::pair<std::string, int>, allocCount> allocInfo; // [file, line] = allocCount
+	typedef std::map<int, int> allocCount; // [size] = count
+	typedef std::map<std::pair<std::string, int>, allocCount> allocInfo; // [file, line] = allocCount
 
-    allocInfo memInfo;
-    static bool allocMapValid;
+	allocInfo memInfo;
+	static bool allocMapValid;
 
 public:
 
-    KAllocStat()
-    {
-        allocMapValid = true;
-    }
-    ~KAllocStat()
-    {
-        if (showLeaks)
-            KMemoryDumpUsage();
-
-        allocMapValid = false;
-    }
-    void addTrack(const char* fname, int lnum, int asize)
-    {
-        allocCount& info = memInfo[std::pair<std::string, int>(fname, lnum)];
-        info[asize]++;
-    }
+	KAllocStat()
+	{
+		allocMapValid = true;
+	}
+	~KAllocStat()
+	{
+		if (showLeaks)
+			KMemoryDumpUsage();
+
+		allocMapValid = false;
+	}
+	void addTrack(const char* fname, int lnum, int asize)
+	{
+		allocCount& info = memInfo[std::pair<std::string, int>(fname, lnum)];
+		info[asize]++;
+	}
 };
 bool KAllocStat::allocMapValid = false;
 static KAllocStat allocStat;
 #endif // KANJI_TRACK_MEM_USAGE
 
 
-
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-extern void KMemoryAddTrack( void* addr, size_t asize, const char* fname, int lnum )
-{
-    if (!KAllocMap::allocMapValid || asize == 0)
-        return;
+extern void KMemoryAddTrack(void *addr, size_t asize, const char *fname, int lnum) {
+	if (!KAllocMap::allocMapValid || asize == 0)
+		return;
 
-    KAutoLock aCrit(allocMap.crit);
-    showLeaks = true;
+	KAutoLock aCrit(allocMap.crit);
+	showLeaks = true;
 
-    KANJI_ALLOC_INFO& info = allocMap[addr];
-    info.file = fname;
-    info.line = lnum;
-    info.size = asize;
+	KANJI_ALLOC_INFO &info = allocMap[addr];
+	info.file = fname;
+	info.line = lnum;
+	info.size = asize;
 
 #ifdef KANJI_TRACK_MEM_USAGE
-    if (KAllocStat::allocMapValid)
-        allocStat.addTrack(fname, lnum, asize);
+	if (KAllocStat::allocMapValid)
+		allocStat.addTrack(fname, lnum, asize);
 #endif
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-void KMemoryRemoveTrack(void* addr)
-{
-    if (!KAllocMap::allocMapValid)
-        return;
-
-    KAutoLock aCrit(allocMap.crit);
-    KAllocMap::iterator anItr = allocMap.find(addr);
-    if (anItr != allocMap.end())
-        allocMap.erase(anItr);
+void KMemoryRemoveTrack(void *addr) {
+	if (!KAllocMap::allocMapValid)
+		return;
+
+	KAutoLock aCrit(allocMap.crit);
+	KAllocMap::iterator anItr = allocMap.find(addr);
+	if (anItr != allocMap.end())
+		allocMap.erase(anItr);
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
-void KMemoryDumpUnfreed()
-{
-    if (!KAllocMap::allocMapValid)
-        return;
-
-    KAutoLock aCrit(allocMap.crit); // prevent modification of the map while iterating
-
-    size_t totalSize = 0;
-    char buf[8192];
-
-    FILE* f = fopen("mem_leaks.txt", "wt");
-    if (!f)
-        return;
-
-    time_t aTime = time(NULL);
-    sprintf(buf, "Memory Leak Report for %s\n", asctime(localtime(&aTime)));
-    fprintf(f, "%s", buf);
-    KOutputDebug(DEBUGLVL, "\n");
-    KOutputDebug(INFOLVL, buf);
-    for(KAllocMap::iterator i = allocMap.begin(); i != allocMap.end(); ++i)
-    {
-        sprintf(buf, "%s(%d) : Leak %u byte%s @0x%08X\n", i->second.file.c_str(), i->second.line, i->second.size, i->second.size > 1 ? "s" : "", (size_t)i->first);
-        KOutputDebug(ERRORLVL, buf);
-        fprintf(f, "%s", buf);
+void KMemoryDumpUnfreed() {
+	if (!KAllocMap::allocMapValid)
+		return;
+
+	KAutoLock aCrit(allocMap.crit); // prevent modification of the map while iterating
+
+	size_t totalSize = 0;
+	char buf[8192];
+
+	FILE *f = fopen("mem_leaks.txt", "wt");
+	if (!f)
+		return;
+
+	time_t aTime = time(NULL);
+	sprintf(buf, "Memory Leak Report for %s\n", asctime(localtime(&aTime)));
+	fprintf(f, "%s", buf);
+	KOutputDebug(DEBUGLVL, "\n");
+	KOutputDebug(INFOLVL, buf);
+	for (KAllocMap::iterator i = allocMap.begin(); i != allocMap.end(); ++i) {
+		sprintf(buf, "%s(%d) : Leak %u byte%s @0x%08X\n", i->second.file.c_str(), i->second.line, i->second.size,
+				i->second.size > 1 ? "s" : "", (size_t) i->first);
+		KOutputDebug(ERRORLVL, buf);
+		fprintf(f, "%s", buf);
 
 #ifdef KANJI_DUMP_LEAKED_MEM
-        unsigned char* data = (unsigned char*)i->first;
-        int count = 0;
-        char hex_dump[1024];
-        char ascii_dump[1024];
+		unsigned char* data = (unsigned char*)i->first;
+		int count = 0;
+		char hex_dump[1024];
+		char ascii_dump[1024];
 
-        for (int index = 0; index < i->second.size; index++)
-        {
-            unsigned char _c = *data;
+		for (int index = 0; index < i->second.size; index++)
+		{
+			unsigned char _c = *data;
 
-            if (count == 0)
-                sprintf(hex_dump, "\t%02X ", _c);
-            else
-                sprintf(hex_dump, "%s%02X ", hex_dump, _c); // technically, this is undefined behavior
+			if (count == 0)
+				sprintf(hex_dump, "\t%02X ", _c);
+			else
+				sprintf(hex_dump, "%s%02X ", hex_dump, _c); // technically, this is undefined behavior
 
-            if ((_c < 32) || (_c > 126))
-                _c = '.';
+			if ((_c < 32) || (_c > 126))
+				_c = '.';
 
-            if (count == 7)
-                sprintf(ascii_dump, "%s%c ", ascii_dump, _c);
-            else
-                sprintf(ascii_dump, "%s%c", count == 0 ? "\t" : ascii_dump, _c); // technically, this is undefined behavior
+			if (count == 7)
+				sprintf(ascii_dump, "%s%c ", ascii_dump, _c);
+			else
+				sprintf(ascii_dump, "%s%c", count == 0 ? "\t" : ascii_dump, _c); // technically, this is undefined behavior
 
 
-            if (++count == 16)
-            {
-                count = 0;
-                sprintf(buf, "%s\t%s\n", hex_dump, ascii_dump);
-                fprintf(f, buf);
+			if (++count == 16)
+			{
+				count = 0;
+				sprintf(buf, "%s\t%s\n", hex_dump, ascii_dump);
+				fprintf(f, buf);
 
-                memset((void*)hex_dump, 0, 1024);
-                memset((void*)ascii_dump, 0, 1024);
-            }
+				memset((void*)hex_dump, 0, 1024);
+				memset((void*)ascii_dump, 0, 1024);
+			}
 
-            data++;
-        }
+			data++;
+		}
 
-        if (count != 0)
-        {
-            fprintf(f, hex_dump);
-            for (int index = 0; index < 16 - count; index++)
-                fprintf(f, "\t");
+		if (count != 0)
+		{
+			fprintf(f, hex_dump);
+			for (int index = 0; index < 16 - count; index++)
+				fprintf(f, "\t");
 
-            fprintf(f, ascii_dump);
+			fprintf(f, ascii_dump);
 
-            for (int index = 0; index < 16 - count; index++)
-                fprintf(f, ".");
-        }
+			for (int index = 0; index < 16 - count; index++)
+				fprintf(f, ".");
+		}
 
-        count = 0;
-        fprintf(f, "\n\n");
-        memset((void*)hex_dump, 0, 1024);
-        memset((void*)ascii_dump, 0, 1024);
+		count = 0;
+		fprintf(f, "\n\n");
+		memset((void*)hex_dump, 0, 1024);
+		memset((void*)ascii_dump, 0, 1024);
 
 #endif // KANJI_DUMP_LEAKED_MEM
 
-        totalSize += i->second.size;
-    }
+		totalSize += i->second.size;
+	}
 
 	ErrorLevel lvl = (totalSize > 0) ? ERRORLVL : INFOLVL;
 
-    sprintf(buf, "-----------------------------------------------------------\n");
-    fprintf(f, "%s", buf);
-    KOutputDebug(lvl, buf);
-    sprintf(buf, "Total Unfreed: %u bytes (%luKB)\n\n", totalSize, totalSize / 1024);
-    KOutputDebug(lvl, buf);
-    fprintf(f, "%s", buf);
-    fclose(f);
+	sprintf(buf, "-----------------------------------------------------------\n");
+	fprintf(f, "%s", buf);
+	KOutputDebug(lvl, buf);
+	sprintf(buf, "Total Unfreed: %u bytes (%luKB)\n\n", totalSize, totalSize / 1024);
+	KOutputDebug(lvl, buf);
+	fprintf(f, "%s", buf);
+	fclose(f);
 }
 
 #ifdef KANJI_TRACK_MEM_USAGE
 void KMemoryDumpUsage()
 {
-    if (!KAllocStat::allocMapValid)
-        return;
-
-    char buf[8192];
-    FILE* f = fopen("mem_usage.txt", "wt");
-
-    time_t aTime = time(NULL);
-    sprintf(buf, "Memory Usage Report for %s\n", asctime(localtime(&aTime)));
-    if (f) fprintf(f, "%s", buf);
-    KOutputDebug("\n");
-    KOutputDebug(buf);
-
-    for(KAllocStat::allocInfo::iterator i = allocStat.memInfo.begin(); i != allocStat.memInfo.end(); ++i)
-    {
-        int aBytesTotal = 0;
-        int aCallsTotal = 0;
-        for (KAllocStat::allocCount::iterator index = i->second.begin(); index != i->second.end(); ++index)
-        {
-            aBytesTotal += index->first;
-            aCallsTotal += index->second;
-            sprintf(buf, "%s(%d) : %d bytes (%d %s)\n", i->first.first.c_str(), i->first.second, index->first, index->second, index->second == 1 ? "call" : "calls");
-            if (f) fprintf(f, "%s", buf);
-            KOutputDebug(buf);
-        }
-
-        if (i->second.size() > 1)
-        {
-            sprintf(buf, "    %s(%d) : %d KB total (%d calls)\n", i->first.first.c_str(), i->first.second, aBytesTotal / 1024, aCallsTotal);
-            if (f) fprintf(f, "%s", buf);
-            KOutputDebug(buf);
-        }
-    }
-    if (f) fclose(f);
+	if (!KAllocStat::allocMapValid)
+		return;
+
+	char buf[8192];
+	FILE* f = fopen("mem_usage.txt", "wt");
+
+	time_t aTime = time(NULL);
+	sprintf(buf, "Memory Usage Report for %s\n", asctime(localtime(&aTime)));
+	if (f) fprintf(f, "%s", buf);
+	KOutputDebug("\n");
+	KOutputDebug(buf);
+
+	for(KAllocStat::allocInfo::iterator i = allocStat.memInfo.begin(); i != allocStat.memInfo.end(); ++i)
+	{
+		int aBytesTotal = 0;
+		int aCallsTotal = 0;
+		for (KAllocStat::allocCount::iterator index = i->second.begin(); index != i->second.end(); ++index)
+		{
+			aBytesTotal += index->first;
+			aCallsTotal += index->second;
+			sprintf(buf, "%s(%d) : %d bytes (%d %s)\n", i->first.first.c_str(), i->first.second, index->first, index->second, index->second == 1 ? "call" : "calls");
+			if (f) fprintf(f, "%s", buf);
+			KOutputDebug(buf);
+		}
+
+		if (i->second.size() > 1)
+		{
+			sprintf(buf, "    %s(%d) : %d KB total (%d calls)\n", i->first.first.c_str(), i->first.second, aBytesTotal / 1024, aCallsTotal);
+			if (f) fprintf(f, "%s", buf);
+			KOutputDebug(buf);
+		}
+	}
+	if (f) fclose(f);
 }
 #endif // KANJI_TRACK_MEM_USAGE
 
-size_t KMemoryAllocated()
-{
-    if (!KAllocMap::allocMapValid)
-        return 0;
-
-    KAutoLock aCrit(allocMap.crit);
-
-    size_t size = 0;
-    for(auto i = allocMap.begin(); i != allocMap.end(); ++i)
-    {
-        KANJI_ALLOC_INFO& info = i->second;
-        size += info.size;
-    }
-    return size;
+size_t KMemoryAllocated() {
+	if (!KAllocMap::allocMapValid)
+		return 0;
+
+	KAutoLock aCrit(allocMap.crit);
+
+	size_t size = 0;
+	for (auto i = allocMap.begin(); i != allocMap.end(); ++i) {
+		KANJI_ALLOC_INFO &info = i->second;
+		size += info.size;
+	}
+	return size;
 }

+ 58 - 66
spine-c/spine-c-unit-tests/memory/KMemory.h

@@ -29,15 +29,17 @@
 #endif
 
 #ifndef SCOPED_AUTO_SAFE_DELETE
-template <typename T>
-class ScopedAutoDeletePointerHelper
-{
+
+template<typename T>
+class ScopedAutoDeletePointerHelper {
 public:
-    ScopedAutoDeletePointerHelper(T pPtr) : _pPtr(pPtr) {}
-    ~ScopedAutoDeletePointerHelper() { SAFE_DELETE(_pPtr); }
+	ScopedAutoDeletePointerHelper(T pPtr) : _pPtr(pPtr) {}
+
+	~ScopedAutoDeletePointerHelper() {SAFE_DELETE(_pPtr); }
 
-    T _pPtr;
+	T _pPtr;
 };
+
 #define SCOPED_AUTO_SAFE_DELETE(p) ScopedAutoDeletePointerHelper<decltype(p)> anAutoDelete##p(p);
 #endif
 
@@ -46,6 +48,7 @@ public:
 #endif
 
 extern void KMemoryDumpUnfreed();
+
 extern size_t KMemoryAllocated();
 
 #ifdef WIN32
@@ -57,7 +60,9 @@ extern size_t KMemoryAllocated();
 #ifdef __APPLE__
 #define KMEM_THROWSPEC throw(std::bad_alloc)
 #define KMEM_THROWS_BADALLOC
+
 #include <new>
+
 #else
 #define KMEM_THROWSPEC
 #endif
@@ -68,42 +73,37 @@ extern size_t KMemoryAllocated();
 // DO NOT CALL THESE TWO METHODS DIRECTLY  //
 /////////////////////////////////////////////
 
-extern void KMemoryAddTrack(void* addr, size_t asize, const char* fname, int lnum);
-extern void KMemoryRemoveTrack(void* addr);
+extern void KMemoryAddTrack(void *addr, size_t asize, const char *fname, int lnum);
+
+extern void KMemoryRemoveTrack(void *addr);
 
 //Replacement for the standard malloc/free, records size of allocation and the file/line number it was on
-inline void* _kanjimalloc (size_t size, const char* file, int line)
-{
-    void* ptr = (void*)malloc(size);
-    KMemoryAddTrack(ptr, size, file, line);
-    return(ptr);
+inline void *_kanjimalloc(size_t size, const char *file, int line) {
+	void *ptr = (void *) malloc(size);
+	KMemoryAddTrack(ptr, size, file, line);
+	return (ptr);
 }
 
-inline void* _kanjimalloc (size_t size)
-{
-    return _kanjimalloc(size, "", 0);
+inline void *_kanjimalloc(size_t size) {
+	return _kanjimalloc(size, "", 0);
 }
 
-inline void _kanjifree (void* ptr)
-{
-    KMemoryRemoveTrack(ptr);
-    free(ptr);
+inline void _kanjifree(void *ptr) {
+	KMemoryRemoveTrack(ptr);
+	free(ptr);
 }
 
-inline void* _kanjirealloc (void* ptr, size_t size, const char* file, int line)
-{
-    void* ptr2 = (void*)realloc(ptr, size);
-    if (ptr2)
-    {
-        KMemoryRemoveTrack(ptr);
-        KMemoryAddTrack(ptr2, size, file, line);
-    }
-    return ptr2;
+inline void *_kanjirealloc(void *ptr, size_t size, const char *file, int line) {
+	void *ptr2 = (void *) realloc(ptr, size);
+	if (ptr2) {
+		KMemoryRemoveTrack(ptr);
+		KMemoryAddTrack(ptr2, size, file, line);
+	}
+	return ptr2;
 }
 
-inline void* _kanjirealloc (void* ptr, size_t size)
-{
-    return _kanjirealloc(ptr, size, "", 0);
+inline void *_kanjirealloc(void *ptr, size_t size) {
+	return _kanjirealloc(ptr, size, "", 0);
 }
 
 #define kanjimalloc(size) _kanjimalloc((size), __FILE__, __LINE__)
@@ -111,64 +111,56 @@ inline void* _kanjirealloc (void* ptr, size_t size)
 #define kanjirealloc(ptr, size) _kanjirealloc(ptr, size, __FILE__, __LINE__)
 
 //Replacement for the standard "new" operator, records size of allocation and the file/line number it was on
-inline void* KMEM_CALLTYPE operator new(size_t size, const char* file, int line)
-{
-    void* ptr = (void*)malloc(size);
-    KMemoryAddTrack(ptr, size, file, line);
-    return(ptr);
+inline void *KMEM_CALLTYPE operator new(size_t size, const char *file, int line) {
+	void *ptr = (void *) malloc(size);
+	KMemoryAddTrack(ptr, size, file, line);
+	return (ptr);
 }
 
 //Same as above, but for arrays
-inline void* KMEM_CALLTYPE operator new[](size_t size, const char* file, int line)
-{
-    void* ptr = (void*)malloc(size);
-    KMemoryAddTrack(ptr, size, file, line);
-    return(ptr);
+inline void *KMEM_CALLTYPE operator new[](size_t size, const char *file, int line) {
+	void *ptr = (void *) malloc(size);
+	KMemoryAddTrack(ptr, size, file, line);
+	return (ptr);
 }
 
 
 // These single argument new operators allow vc6 apps to compile without errors
-inline void* KMEM_CALLTYPE operator new(size_t size) KMEM_THROWSPEC
-{
-    void* ptr = (void*)malloc(size);
+inline void *KMEM_CALLTYPE operator new(size_t size) KMEM_THROWSPEC {
+	void *ptr = (void *) malloc(size);
 #ifdef KMEM_THROWS_BADALLOC
-    if(!ptr) throw std::bad_alloc();
+	if (!ptr) throw std::bad_alloc();
 #endif
-    return(ptr);
+	return (ptr);
 }
 
-inline void* KMEM_CALLTYPE operator new[](size_t size) KMEM_THROWSPEC
-{
-    void* ptr = (void*)malloc(size);
+inline void *KMEM_CALLTYPE operator new[](size_t size) KMEM_THROWSPEC {
+	void *ptr = (void *) malloc(size);
 #ifdef KMEM_THROWS_BADALLOC
-    if(!ptr) throw std::bad_alloc();
+	if (!ptr) throw std::bad_alloc();
 #endif // KMEM_THROWS_BADALLOC
-    return(ptr);
+	return (ptr);
 }
 
 
 //custom delete operators
-inline void KMEM_CALLTYPE operator delete(void* p) throw()
-{
-    KMemoryRemoveTrack(p);
-    free(p);
+inline void KMEM_CALLTYPE operator delete(void *p) throw() {
+	KMemoryRemoveTrack(p);
+	free(p);
 }
 
-inline void KMEM_CALLTYPE operator delete[](void* p) throw()
-{
-    KMemoryRemoveTrack(p);
-    free(p);
+inline void KMEM_CALLTYPE operator delete[](void *p) throw() {
+	KMemoryRemoveTrack(p);
+	free(p);
 }
 
 //needed in case in the constructor of the class we're newing, it throws an exception
-inline void KMEM_CALLTYPE operator delete(void* pMem, const char* file, int line)
-{
-    free(pMem);
+inline void KMEM_CALLTYPE operator delete(void *pMem, const char *file, int line) {
+	free(pMem);
 }
 
-inline void KMEM_CALLTYPE operator delete[](void* pMem, const char* file, int line)
-{
-    free(pMem);
+inline void KMEM_CALLTYPE operator delete[](void *pMem, const char *file, int line) {
+	free(pMem);
 }
 
 #define KDEBUG_NEW new(__FILE__, __LINE__)

+ 42 - 51
spine-c/spine-c-unit-tests/memory/KString.cpp

@@ -1,4 +1,4 @@
-#include "KString.h" 
+#include "KString.h"
 #include <stdarg.h>
 
 #include "MiniCppUnit.hxx"
@@ -7,8 +7,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // String Helper 
 
-static std::string vasprintf(const char* fmt, va_list argv)
-{
+static std::string vasprintf(const char *fmt, va_list argv) {
 	std::string result;
 	va_list argv_copy; // vsnprintf modifies argv, need copy
 #ifndef va_copy
@@ -18,16 +17,13 @@ static std::string vasprintf(const char* fmt, va_list argv)
 #endif
 
 	int len = vsnprintf(NULL, 0, fmt, argv_copy);
-	if (len > 0 && len < 255)
-	{
+	if (len > 0 && len < 255) {
 		// cover 90% of all calls
-		char str[256] = { 0 };
+		char str[256] = {0};
 		int len2 = vsnprintf(str, 255, fmt, argv);
 		result = str;
-	}
-	else if (len > 0)
-	{
-		char* str = static_cast<char*>(alloca(len + 1)); // alloca on stack, space for null-termination
+	} else if (len > 0) {
+		char *str = static_cast<char *>(alloca(len + 1)); // alloca on stack, space for null-termination
 		int len2 = vsnprintf(str, len + 1, fmt, argv);
 		result = str;
 	}
@@ -35,47 +31,49 @@ static std::string vasprintf(const char* fmt, va_list argv)
 }
 
 
-static void reportWarning(const std::string& warnStr)
-{
+static void reportWarning(const std::string &warnStr) {
 	if (JetBrains::underTeamcity())
 		gTeamCityListener.messages.messageWarning(warnStr);
 	else
 		fprintf(stderr, "%s", warnStr.c_str());
 }
 
-static void reportError(const std::string& errorStr)
-{
+static void reportError(const std::string &errorStr) {
 	if (JetBrains::underTeamcity())
 		gTeamCityListener.messages.messageError(errorStr);
 	else
 		fprintf(stderr, "%s", errorStr.c_str());
 }
 
-static void reportInfo(const std::string& infoStr)
-{
+static void reportInfo(const std::string &infoStr) {
 	if (JetBrains::underTeamcity())
 		gTeamCityListener.messages.messageNormal(infoStr);
 	else
 		fprintf(stderr, "%s", infoStr.c_str());
 }
 
-static void reportDebug(const std::string& debugStr)
-{
+static void reportDebug(const std::string &debugStr) {
 	fprintf(stderr, "%s", debugStr.c_str());
 }
 
-static void report(ErrorLevel level, const std::string& Str)
-{
+static void report(ErrorLevel level, const std::string &Str) {
 	switch (level) {
-	case WARNLVL: reportWarning(Str); break;
-	case ERRORLVL: reportError(Str); break;
-	case INFOLVL: reportInfo(Str); break;
-	case DEBUGLVL: reportDebug(Str); break;
+		case WARNLVL:
+			reportWarning(Str);
+			break;
+		case ERRORLVL:
+			reportError(Str);
+			break;
+		case INFOLVL:
+			reportInfo(Str);
+			break;
+		case DEBUGLVL:
+			reportDebug(Str);
+			break;
 	}
 }
 
-void KOutputDebug(ErrorLevel lvl, const char* fmt ...)
-{
+void KOutputDebug(ErrorLevel lvl, const char *fmt ...) {
 	va_list argList;
 	va_start(argList, fmt);
 	std::string str = vasprintf(fmt, argList);
@@ -84,15 +82,13 @@ void KOutputDebug(ErrorLevel lvl, const char* fmt ...)
 	report(lvl, str);
 }
 
-#define K_MAX(a,b) ((a>b) ? a : b)
+#define K_MAX(a, b) ((a>b) ? a : b)
 
-std::string GetFileName(const std::string& thePath, bool noExtension)
-{
-	int aLastSlash = K_MAX((int)thePath.rfind('\\'), (int)thePath.rfind('/'));
+std::string GetFileName(const std::string &thePath, bool noExtension) {
+	int aLastSlash = K_MAX((int) thePath.rfind('\\'), (int) thePath.rfind('/'));
 
-	if (noExtension)
-	{
-		int aLastDot = (int)thePath.rfind('.');
+	if (noExtension) {
+		int aLastDot = (int) thePath.rfind('.');
 		if (aLastDot > aLastSlash)
 			return thePath.substr(aLastSlash + 1, aLastDot - aLastSlash - 1);
 	}
@@ -103,14 +99,12 @@ std::string GetFileName(const std::string& thePath, bool noExtension)
 		return thePath.substr(aLastSlash + 1);
 }
 
-std::string GetFileDir(const std::string& thePath, bool withSlash)
-{
-	int aLastSlash = K_MAX((int)thePath.rfind(('\\')), (int)thePath.rfind(('/')));
+std::string GetFileDir(const std::string &thePath, bool withSlash) {
+	int aLastSlash = K_MAX((int) thePath.rfind(('\\')), (int) thePath.rfind(('/')));
 
 	if (aLastSlash == -1)
 		return ("");
-	else
-	{
+	else {
 		if (withSlash)
 			return thePath.substr(0, aLastSlash + 1);
 		else
@@ -118,8 +112,7 @@ std::string GetFileDir(const std::string& thePath, bool withSlash)
 	}
 }
 
-std::string GetFileExt(const std::string& thePath)
-{
+std::string GetFileExt(const std::string &thePath) {
 	std::string::size_type idx = thePath.find_last_of('.');
 
 	if (idx != std::string::npos)
@@ -151,27 +144,26 @@ std::string GetFileExt(const std::string& thePath)
  *               zero if @s1 is found, respectively, to be less than,
  *               to match, or to be greater than @s2.
  **/
-static int g_ascii_compare_caseless(const char* s1, const char* s2)
-{
+static int g_ascii_compare_caseless(const char *s1, const char *s2) {
 #define TOUPPER(c)  (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c))
 #define TOLOWER(c)  (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
-#define g_return_val_if_fail(expr,val) { if (!(expr)) return (val); }
+#define g_return_val_if_fail(expr, val) { if (!(expr)) return (val); }
 
 	int c1, c2;
 
 	g_return_val_if_fail(s1 != NULL, 0);
 	g_return_val_if_fail(s2 != NULL, 0);
 
-	while (*s1 && *s2)
-	{
-		c1 = (int)(unsigned char)TOLOWER(*s1);
-		c2 = (int)(unsigned char)TOLOWER(*s2);
+	while (*s1 && *s2) {
+		c1 = (int) (unsigned char) TOLOWER(*s1);
+		c2 = (int) (unsigned char) TOLOWER(*s2);
 		if (c1 != c2)
 			return (c1 - c2);
-		s1++; s2++;
+		s1++;
+		s2++;
 	}
 
-	return (((int)(unsigned char)* s1) - ((int)(unsigned char)* s2));
+	return (((int) (unsigned char) *s1) - ((int) (unsigned char) *s2));
 
 #undef g_return_val_if_fail
 #undef TOUPPER
@@ -179,7 +171,6 @@ static int g_ascii_compare_caseless(const char* s1, const char* s2)
 }
 
 
-int CompareNoCase(const std::string & str1, const std::string & str2)
-{
+int CompareNoCase(const std::string &str1, const std::string &str2) {
 	return g_ascii_compare_caseless(str1.c_str(), str2.c_str());
 }

+ 8 - 6
spine-c/spine-c-unit-tests/memory/KString.h

@@ -1,4 +1,4 @@
-#pragma once 
+#pragma once
 
 #include <string>
 
@@ -10,10 +10,12 @@ enum ErrorLevel {
 	DEBUGLVL
 };
 
-extern void KOutputDebug(ErrorLevel lvl, const char* fmt ...);
+extern void KOutputDebug(ErrorLevel lvl, const char *fmt ...);
 
-extern std::string GetFileName(const std::string& thePath, bool noExtension);
-extern std::string GetFileDir(const std::string& thePath, bool withSlash);
-extern std::string GetFileExt(const std::string& thePath);
+extern std::string GetFileName(const std::string &thePath, bool noExtension);
 
-extern int CompareNoCase(const std::string& str1, const std::string& str2);
+extern std::string GetFileDir(const std::string &thePath, bool withSlash);
+
+extern std::string GetFileExt(const std::string &thePath);
+
+extern int CompareNoCase(const std::string &str1, const std::string &str2);

+ 109 - 127
spine-c/spine-c-unit-tests/minicppunit/MiniCppUnit.cxx

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004  Pau Arumí & David García
+ * Copyright (c) 2003-2004  Pau Arum� & David Garc�a
  *
  *
  * This program is free software; you can redistribute it and/or modify
@@ -27,42 +27,38 @@ bool gUseTeamCity = false;
 #include <string>
 #include <sstream>
 
-#define MIN(a,b) ((a < b) ? a : b)
-#define MAX(a,b) ((a > b) ? a : b)
+#define MIN(a, b) ((a < b) ? a : b)
+#define MAX(a, b) ((a > b) ? a : b)
 
-TestsListener::TestsListener() : _currentTestName(0)
-{
-	_executed=_failed=_exceptions=0;
+TestsListener::TestsListener() : _currentTestName(0) {
+	_executed = _failed = _exceptions = 0;
 	gUseTeamCity = JetBrains::underTeamcity();
 }
 
-TestsListener& TestsListener::theInstance()
-{
+TestsListener &TestsListener::theInstance() {
 	static TestsListener instancia;
 	return instancia;
 }
 
-std::stringstream& TestsListener::errorsLog()
-{
-	if (_currentTestName)
-	{
+std::stringstream &TestsListener::errorsLog() {
+	if (_currentTestName) {
 		_log << "\n" << errmsgTag_nameOfTest() << (*_currentTestName) << "\n";
 	}
 	return _log;
 }
 
-std::string TestsListener::logString()
-{
+std::string TestsListener::logString() {
 	std::string aRetornar = _log.str();
 	_log.str("");
 	return aRetornar;
 }
-void TestsListener::currentTestName( std::string& name)
-{
+
+void TestsListener::currentTestName(std::string &name) {
 	_currentTestName = &name;
 
-	if(gUseTeamCity)gTeamCityListener.startTest(name);
+	if (gUseTeamCity)gTeamCityListener.startTest(name);
 }
+
 void TestsListener::testHasRun() // started
 {
 	std::cout << ".";
@@ -71,15 +67,15 @@ void TestsListener::testHasRun() // started
 
 void TestsListener::testHasPassed() // finished without errors
 {
-	if(gUseTeamCity)
+	if (gUseTeamCity)
 		gTeamCityListener.endTest(*(theInstance()._currentTestName));
 }
 
-void TestsListener::testHasFailed(const char* reason, const char* file, int line)
-{
-	if(gUseTeamCity)
-	{
-		gTeamCityListener.addFailure(JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(file, line), reason));
+void TestsListener::testHasFailed(const char *reason, const char *file, int line) {
+	if (gUseTeamCity) {
+		gTeamCityListener.addFailure(
+				JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(file, line),
+									   reason));
 		gTeamCityListener.endTest(*(theInstance()._currentTestName));
 	}
 
@@ -87,140 +83,128 @@ void TestsListener::testHasFailed(const char* reason, const char* file, int line
 	theInstance()._failed++;
 	throw TestFailedException();
 }
-void TestsListener::testHasThrown()
-{
-	if(gUseTeamCity)
-	{
-		gTeamCityListener.addFailure(JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(), "Exception"));
+
+void TestsListener::testHasThrown() {
+	if (gUseTeamCity) {
+		gTeamCityListener.addFailure(
+				JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(), "Exception"));
 		gTeamCityListener.endTest(*(theInstance()._currentTestName));
 	}
 	std::cout << "E";
 	theInstance()._exceptions++;
 }
-std::string TestsListener::summary()
-{
+
+std::string TestsListener::summary() {
 	std::ostringstream os;
-	os	<< "\nSummary:\n"
-		<< Assert::bold() << "\tExecuted Tests:         " 
-		<< _executed << Assert::normal() << std::endl
-		<< Assert::green() << "\tPassed Tests:           " 
-		<< (_executed-_failed-_exceptions) 
-		<< Assert::normal() << std::endl;
-	if (_failed > 0)
-	{
-		os 	<< Assert::red() << "\tFailed Tests:           " 
-			<< _failed << Assert::normal() << std::endl;
+	os << "\nSummary:\n"
+	   << Assert::bold() << "\tExecuted Tests:         "
+	   << _executed << Assert::normal() << std::endl
+	   << Assert::green() << "\tPassed Tests:           "
+	   << (_executed - _failed - _exceptions)
+	   << Assert::normal() << std::endl;
+	if (_failed > 0) {
+		os << Assert::red() << "\tFailed Tests:           "
+		   << _failed << Assert::normal() << std::endl;
 	}
-	if (_exceptions > 0)
-	{
-		os 	<< Assert::yellow() << "\tUnexpected exceptions:  " 
-			<< _exceptions << Assert::normal() << std::endl;
+	if (_exceptions > 0) {
+		os << Assert::yellow() << "\tUnexpected exceptions:  "
+		   << _exceptions << Assert::normal() << std::endl;
 	}
 	os << std::endl;
 	return os.str();
 }
-bool TestsListener::allTestsPassed()
-{
+
+bool TestsListener::allTestsPassed() {
 	return !theInstance()._exceptions && !theInstance()._failed;
 }
 
 
-
-void Assert::assertTrue(char* strExpression, bool expression,
-		const char* file, int linia)
-{
-	if (!expression)
-	{
+void Assert::assertTrue(char *strExpression, bool expression,
+						const char *file, int linia) {
+	if (!expression) {
 		TestsListener::theInstance().errorsLog() << "\n"
-			<< errmsgTag_testFailedIn() << file 
-			<< errmsgTag_inLine() << linia << "\n" 
-			<< errmsgTag_failedExpression() 
-			<< bold() << strExpression << normal() << "\n";
+												 << errmsgTag_testFailedIn() << file
+												 << errmsgTag_inLine() << linia << "\n"
+												 << errmsgTag_failedExpression()
+												 << bold() << strExpression << normal() << "\n";
 		TestsListener::theInstance().testHasFailed(strExpression, file, linia);
 	}
 }
 
-void Assert::assertTrueMissatge(char* strExpression, bool expression, 
-		const char* missatge, const char* file, int linia)
-{
-	if (!expression)
-	{
+void Assert::assertTrueMissatge(char *strExpression, bool expression,
+								const char *missatge, const char *file, int linia) {
+	if (!expression) {
 		TestsListener::theInstance().errorsLog() << "\n"
-			<< errmsgTag_testFailedIn() << file
-			<< errmsgTag_inLine() << linia << "\n" 
-			<< errmsgTag_failedExpression() 
-			<< bold() << strExpression << "\n"
-			<< missatge<< normal() << "\n";
+												 << errmsgTag_testFailedIn() << file
+												 << errmsgTag_inLine() << linia << "\n"
+												 << errmsgTag_failedExpression()
+												 << bold() << strExpression << "\n"
+												 << missatge << normal() << "\n";
 		TestsListener::theInstance().testHasFailed(strExpression, file, linia);
 	}
 }
 
 
-
-void Assert::assertEquals( const char * expected, const char * result,
-	const char* file, int linia )
-{
+void Assert::assertEquals(const char *expected, const char *result,
+						  const char *file, int linia) {
 	assertEquals(std::string(expected), std::string(result),
-		file, linia);
+				 file, linia);
 
 }
-void Assert::assertEquals( const bool& expected, const bool& result,
-	const char* file, int linia )
-{
+
+void Assert::assertEquals(const bool &expected, const bool &result,
+						  const char *file, int linia) {
 	assertEquals(
-		(expected?"true":"false"), 
-		(result?"true":"false"),
-		file, linia);
+			(expected ? "true" : "false"),
+			(result ? "true" : "false"),
+			file, linia);
 }
 
 // floating point numbers comparisons taken
 // from c/c++ users journal. dec 04 pag 10
-bool isNaN(double x)
-{
+bool isNaN(double x) {
 	bool b1 = (x < 0.0);
 	bool b2 = (x >= 0.0);
 	return !(b1 || b2);
 }
 
-double scaledEpsilon(const double& expected, const double& fuzzyEpsilon )
-{ 
-	const double aa = fabs(expected)+1;
-	return (std::isinf(aa))? fuzzyEpsilon: fuzzyEpsilon * aa;
+double scaledEpsilon(const double &expected, const double &fuzzyEpsilon) {
+	const double aa = fabs(expected) + 1;
+	return (std::isinf(aa)) ? fuzzyEpsilon : fuzzyEpsilon * aa;
 }
-bool fuzzyEquals(double expected, double result, double fuzzyEpsilon)
-{
-	return (expected==result) || ( fabs(expected-result) <= scaledEpsilon(expected, fuzzyEpsilon) );
+
+bool fuzzyEquals(double expected, double result, double fuzzyEpsilon) {
+	return (expected == result) || (fabs(expected - result) <= scaledEpsilon(expected, fuzzyEpsilon));
 }
-void Assert::assertEquals( const double& expected, const double& result,
-		const char* file, int linia )
-{	
+
+void Assert::assertEquals(const double &expected, const double &result,
+						  const char *file, int linia) {
 	const double fuzzyEpsilon = 0.000001;
-	assertEqualsEpsilon( expected, result, fuzzyEpsilon, file, linia );
+	assertEqualsEpsilon(expected, result, fuzzyEpsilon, file, linia);
 }
 
-void Assert::assertEquals( const float& expected, const float& result,
-		const char* file, int linia )
-{
-	assertEquals((double)expected, (double)result, file, linia);
+void Assert::assertEquals(const float &expected, const float &result,
+						  const char *file, int linia) {
+	assertEquals((double) expected, (double) result, file, linia);
 }
-void Assert::assertEquals( const long double& expected, const long double& result,
-		const char* file, int linia )
-{
-	assertEquals((double)expected, (double)result, file, linia);
+
+void Assert::assertEquals(const long double &expected, const long double &result,
+						  const char *file, int linia) {
+	assertEquals((double) expected, (double) result, file, linia);
 }
-void Assert::assertEqualsEpsilon( const double& expected, const double& result, const double& epsilon,
-		const char* file, int linia )
-{
-	if (isNaN(expected) && isNaN(result) ) return;
-	if (!isNaN(expected) && !isNaN(result) && fuzzyEquals(expected, result, epsilon) ) return;
+
+void Assert::assertEqualsEpsilon(const double &expected, const double &result, const double &epsilon,
+								 const char *file, int linia) {
+	if (isNaN(expected) && isNaN(result)) return;
+	if (!isNaN(expected) && !isNaN(result) && fuzzyEquals(expected, result, epsilon)) return;
 
 	std::stringstream anError;
 	anError
 			<< errmsgTag_testFailedIn() << file
-			<< errmsgTag_inLine() << linia << "\n" 
+			<< errmsgTag_inLine() << linia << "\n"
 			<< errmsgTag_expected()
 			<< bold() << expected << normal() << " "
-			<< errmsgTag_butWas() 
+			<< errmsgTag_butWas()
 			<< bold() << result << normal() << "\n";
 
 	TestsListener::theInstance().errorsLog() << anError.str();
@@ -228,11 +212,10 @@ void Assert::assertEqualsEpsilon( const double& expected, const double& result,
 	TestsListener::theInstance().testHasFailed(anError.str().c_str(), file, linia);
 }
 
-int Assert::notEqualIndex( const std::string & one, const std::string & other )
-{
+int Assert::notEqualIndex(const std::string &one, const std::string &other) {
 	int end = MIN(one.length(), other.length());
-	for ( int index = 0; index < end; index++ )
-		if (one[index] != other[index] )
+	for (int index = 0; index < end; index++)
+		if (one[index] != other[index])
 			return index;
 	return end;
 }
@@ -243,35 +226,34 @@ int Assert::notEqualIndex( const std::string & one, const std::string & other )
  *
  * MS Visual6 doesn't allow string by reference :-( 
  */
-void Assert::assertEquals( const std::string expected, const std::string result,
-	const char* file, int linia )
-{
-	if(expected == result)
+void Assert::assertEquals(const std::string expected, const std::string result,
+						  const char *file, int linia) {
+	if (expected == result)
 		return;
-	
+
 	int indexDiferent = notEqualIndex(expected, result);
 
 	std::stringstream anError;
 	anError
-		<< file << ", linia: " << linia << "\n"
-		<< errmsgTag_expected() << "\n" << blue() 
-		<< expected.substr(0,indexDiferent)
-		<< green() << expected.substr(indexDiferent) 
-		<< normal() << "\n"
-		<< errmsgTag_butWas() << blue() << "\n" 
-		<< result.substr(0,indexDiferent)
-		<< red() << result.substr(indexDiferent) 
-		<< normal() << std::endl;
+			<< file << ", linia: " << linia << "\n"
+			<< errmsgTag_expected() << "\n" << blue()
+			<< expected.substr(0, indexDiferent)
+			<< green() << expected.substr(indexDiferent)
+			<< normal() << "\n"
+			<< errmsgTag_butWas() << blue() << "\n"
+			<< result.substr(0, indexDiferent)
+			<< red() << result.substr(indexDiferent)
+			<< normal() << std::endl;
 
 	TestsListener::theInstance().errorsLog() << anError.str();
 
 	TestsListener::theInstance().testHasFailed(anError.str().c_str(), file, linia);
 }
-void Assert::fail(const char* motiu, const char* file, int linia)
-{
+
+void Assert::fail(const char *motiu, const char *file, int linia) {
 	TestsListener::theInstance().errorsLog() <<
-		file << errmsgTag_inLine() << linia << "\n" <<
-		"Reason: " << motiu << "\n";
+											 file << errmsgTag_inLine() << linia << "\n" <<
+											 "Reason: " << motiu << "\n";
 
 	TestsListener::theInstance().testHasFailed(motiu, file, linia);
 }

+ 167 - 165
spine-c/spine-c-unit-tests/minicppunit/MiniCppUnit.hxx

@@ -91,9 +91,9 @@
 
 #if _MSC_VER < 1300
 /** necesary for Visual 6 which don't define std::min */
-namespace std
-{
-	template<typename T> T min(const T& a, const T& b) { return a < b ? a: b; }
+namespace std {
+	template<typename T>
+	T min(const T &a, const T &b) { return a < b ? a : b; }
 }
 #endif
 
@@ -109,38 +109,45 @@ extern JetBrains::TeamcityProgressListener gTeamCityListener;
  * methods but it is probably asking for a refactoring in order to limit
  * access only to TestFixtures
  */
-class TestsListener
-{
+class TestsListener {
 public:
 	/** accessor to the global (static) singleton instance */
-	static TestsListener& theInstance();
-	std::stringstream& errorsLog();
+	static TestsListener &theInstance();
+
+	std::stringstream &errorsLog();
+
 	std::string logString();
-	void currentTestName( std::string& name);
+
+	void currentTestName(std::string &name);
+
 	static void testHasRun();
+
 	static void testHasPassed();
-	static void testHasFailed(const char* reason, const char* file, int line);
+
+	static void testHasFailed(const char *reason, const char *file, int line);
+
 	static void testHasThrown();
+
 	/** the human readable summary of run tests*/
 	std::string summary();
+
 	/** returns wheather all run tests have passed */
 	static bool allTestsPassed();
-	
+
 private:
-	static const char* errmsgTag_nameOfTest() { return "Test failed: "; }
-	
+	static const char *errmsgTag_nameOfTest() { return "Test failed: "; }
+
 	/** constructor private: force the singleton to be wellbehaved ! */
 	TestsListener();
-	
-	std::string* _currentTestName;
+
+	std::string *_currentTestName;
 	std::stringstream _log;
 	unsigned _executed;
 	unsigned _failed;
 	unsigned _exceptions;
 };
 
-class TestFailedException
-{
+class TestFailedException {
 };
 
 /**
@@ -149,12 +156,13 @@ class TestFailedException
  *
  * It does the 'Component' role in the 'Composite' patten
  **/
-class Test
-{
+class Test {
 public:
-	virtual ~Test(){}
+	virtual ~Test() {}
+
 	/** run the test: exercice the code and check results*/
 	virtual void runTest() = 0;
+
 	/** the test human-readable name */
 	virtual std::string name() const = 0;
 };
@@ -164,13 +172,16 @@ public:
  * This class is just a placeholder for all assert functions --as static methods.
  * It is meant for being used just by the assert macros
  */
-class Assert
-{
-	static const char * errmsgTag_testFailedIn() { return "Test failed in "; }
-	static const char * errmsgTag_inLine() { return ", line: "; };
-	static const char * errmsgTag_failedExpression() { return "Failed expression: "; } 
-	static const char * errmsgTag_expected() { return "Expected: "; } 
-	static const char * errmsgTag_butWas() { return "But was: "; } 
+class Assert {
+	static const char *errmsgTag_testFailedIn() { return "Test failed in "; }
+
+	static const char *errmsgTag_inLine() { return ", line: "; };
+
+	static const char *errmsgTag_failedExpression() { return "Failed expression: "; }
+
+	static const char *errmsgTag_expected() { return "Expected: "; }
+
+	static const char *errmsgTag_butWas() { return "But was: "; }
 
 public:
 #ifdef _MSC_VER
@@ -181,25 +192,31 @@ public:
 	static const char * bold() { return ""; }
 	static const char * yellow() { return ""; }
 #else
-	static const char * blue() { return "\033[36;1m"; }
-	static const char * green() { return "\033[32;1m"; }
-	static const char * red() { return "\033[31;1m"; }
-	static const char * normal() { return "\033[0m"; }
-	static const char * bold() { return "\033[" "1m"; }
-	static const char * yellow() { return "\033[93;1m"; }
+
+	static const char *blue() { return "\033[36;1m"; }
+
+	static const char *green() { return "\033[32;1m"; }
+
+	static const char *red() { return "\033[31;1m"; }
+
+	static const char *normal() { return "\033[0m"; }
+
+	static const char *bold() { return "\033[" "1m"; }
+
+	static const char *yellow() { return "\033[93;1m"; }
+
 #endif
+
 	template<typename AType>
-	static void assertEquals( const AType& expected, const AType& result,
-		const char* file="", int linia=0 )
-	{
-		if(expected != result)
-		{
+	static void assertEquals(const AType &expected, const AType &result,
+							 const char *file = "", int linia = 0) {
+		if (expected != result) {
 			std::stringstream anError;
 
 			anError
-				<< file << ", linia: " << linia << "\n"
-				<< errmsgTag_expected() << " " << expected << " "
-				<< errmsgTag_butWas() << " " << result << "\n";
+					<< file << ", linia: " << linia << "\n"
+					<< errmsgTag_expected() << " " << expected << " "
+					<< errmsgTag_butWas() << " " << result << "\n";
 
 			// TestsListener::theInstance().errorsLog() << anError;
 
@@ -207,41 +224,41 @@ public:
 		}
 	}
 
-	static void assertTrue(char* strExpression, bool expression,
-			const char* file="", int linia=0);
+	static void assertTrue(char *strExpression, bool expression,
+						   const char *file = "", int linia = 0);
+
+	static void assertTrueMissatge(char *strExpression, bool expression,
+								   const char *missatge, const char *file = "", int linia = 0);
+
+	static void assertEquals(const char *expected, const char *result,
+							 const char *file = "", int linia = 0);
 
-	static void assertTrueMissatge(char* strExpression, bool expression, 
-			const char* missatge, const char* file="", int linia=0);
+	static void assertEquals(const bool &expected, const bool &result,
+							 const char *file = "", int linia = 0);
 
-	static void assertEquals( const char * expected, const char * result,
-		const char* file="", int linia=0 );
-	
-	static void assertEquals( const bool& expected, const bool& result,
-		const char* file="", int linia=0 );
-	
-	static void assertEquals( const double& expected, const double& result,
-		const char* file="", int linia=0 );
+	static void assertEquals(const double &expected, const double &result,
+							 const char *file = "", int linia = 0);
 
-	static void assertEquals( const float& expected, const float& result,
-		const char* file="", int linia=0 );
-	
-	static void assertEquals( const long double& expected, const long double& result,
-		const char* file="", int linia=0 );
-	
-	static void assertEqualsEpsilon( const double& expected, const double& result, const double& epsilon,
-		const char* file="", int linia=0 );
+	static void assertEquals(const float &expected, const float &result,
+							 const char *file = "", int linia = 0);
 
-	static int notEqualIndex( const std::string & one, const std::string & other );
+	static void assertEquals(const long double &expected, const long double &result,
+							 const char *file = "", int linia = 0);
+
+	static void assertEqualsEpsilon(const double &expected, const double &result, const double &epsilon,
+									const char *file = "", int linia = 0);
+
+	static int notEqualIndex(const std::string &one, const std::string &other);
 
 	/**
 	 * we overload the assert with string doing colored diffs
 	 *
-	 * MS Visual6 doesn't allow string by reference :-( 
+	 * MS Visual6 doesn't allow string by reference :-(
 	 */
-	static void assertEquals( const std::string expected, const std::string result,
-		const char* file="", int linia=0 );
-	
-	static void fail(const char* motiu, const char* file="", int linia=0);
+	static void assertEquals(const std::string expected, const std::string result,
+							 const char *file = "", int linia = 0);
+
+	static void fail(const char *motiu, const char *file = "", int linia = 0);
 
 
 };
@@ -261,12 +278,12 @@ public:
  * instantiate TestCase objects templatized with this same parameter: it needs the 
  * concrete class type for calling its non-static methods.
  */
-template <typename ConcreteTestFixture>
-class TestFixture : public Test
-{
+template<typename ConcreteTestFixture>
+class TestFixture : public Test {
 protected:
 
 	typedef ConcreteTestFixture ConcreteFixture;
+
 	typedef void(ConcreteTestFixture::*TestCaseMethod)();
 
 	/**
@@ -274,116 +291,106 @@ protected:
 	 *
 	 * Makes the 'Leave' role in the 'Composite' GoF pattern because can't be
 	 * be a composition of other tests.
-	 * 
-	 * It's also a case of 'Command' pattern because it encapsules in an object 
+	 *
+	 * It's also a case of 'Command' pattern because it encapsules in an object
 	 * certain functionality whose execution depends on some deferred entity.
 	 */
-	class TestCase : public Test
-	{
+	class TestCase : public Test {
 	public:
-		TestCase(ConcreteFixture* parent, TestCaseMethod method, const std::string & name) : 
-		  _parent(parent),
-		  _testCaseMethod(method),
-		  _name(name)
-		{
+		TestCase(ConcreteFixture *parent, TestCaseMethod method, const std::string &name) :
+				_parent(parent),
+				_testCaseMethod(method),
+				_name(name) {
 		}
+
 		/** calls TestFixture method.  setUp and tearDown methods are called by
 		 * its parent TestFixture (in its runTest method).
 		 * it is robust to unexpected exceptions (throw) */
-		void runTest()
-		{
+		void runTest() {
 			TestsListener::theInstance().testHasRun();
 			TestsListener::theInstance().currentTestName(_name);
-			try
-			{
+			try {
 				(_parent->*_testCaseMethod)();
 				TestsListener::theInstance().testHasPassed();
 			}
-			catch( std::exception& error )
-			{
+			catch (std::exception &error) {
 				TestsListener::theInstance().testHasThrown();
-				TestsListener::theInstance().errorsLog() 
-					<< "std::exception catched by MiniCppUnit: \n"
-					<< "what() : " 
-					<< Assert::yellow() << error.what() 
-					<< Assert::normal() << "\n";
+				TestsListener::theInstance().errorsLog()
+						<< "std::exception catched by MiniCppUnit: \n"
+						<< "what() : "
+						<< Assert::yellow() << error.what()
+						<< Assert::normal() << "\n";
 			}
-			catch ( TestFailedException& ) //just for skiping current test case
+			catch (TestFailedException &) //just for skiping current test case
 			{
 				// the assert() calls testHasFailed()
 			}
-			catch(...)
-			{
+			catch (...) {
 				TestsListener::theInstance().testHasThrown();
-				TestsListener::theInstance().errorsLog() 
-					<< "non standard exception catched by MiniCppUnit.\n";
+				TestsListener::theInstance().errorsLog()
+						<< "non standard exception catched by MiniCppUnit.\n";
 			}
 		}
 
 		/** the TestFixture method hame */
-		std::string name() const
-		{
+		std::string name() const {
 			return _name;
 		}
 
 	private:
-		ConcreteFixture* _parent;
+		ConcreteFixture *_parent;
 		TestCaseMethod _testCaseMethod;
 		std::string _name;
 	};
-    //------------- end of class TestCase ----------------------------
+	//------------- end of class TestCase ----------------------------
 
 private:
-	
-	typedef std::list<Test*> TestCases;
+
+	typedef std::list<Test *> TestCases;
 	TestCases _testCases;
 	std::string _name;
 
-	void testsList() const
-	{
+	void testsList() const {
 		std::cout << "\n+ " << name() << "\n";
-		for( TestCases::const_iterator it=_testCases.begin(); 
-			it!=_testCases.end(); it++ )
-			std::cout << "  - "<< (*it)->name() << "\n";
+		for (TestCases::const_iterator it = _testCases.begin();
+			 it != _testCases.end(); it++)
+			std::cout << "  - " << (*it)->name() << "\n";
 	}
-	
+
 
 public:
 	virtual void setUp() {}
+
 	virtual void tearDown() {}
 
-	std::string name() const 
-	{
+	std::string name() const {
 		return _name;
 	};
 
-	TestFixture(const std::string& name="A text fixture") : _name(name)
-	{
+	TestFixture(const std::string &name = "A text fixture") : _name(name) {
 	}
 
-	void afegeixCasDeTest(ConcreteFixture* parent, TestCaseMethod method, const char* name)
-	{
-		TestCase* casDeTest = new TestCase(parent, method, _name + "::" + name);
-		_testCases.push_back( casDeTest );
+	void afegeixCasDeTest(ConcreteFixture *parent, TestCaseMethod method, const char *name) {
+		TestCase *casDeTest = new TestCase(parent, method, _name + "::" + name);
+		_testCases.push_back(casDeTest);
 	}
+
 	/** calls each test after setUp and tearDown TestFixture methods */
-	void runTest()
-	{
+	void runTest() {
 		testsList();
 		TestCases::iterator it;
-		for( it=_testCases.begin(); it!=_testCases.end(); it++)
-		{
+		for (it = _testCases.begin(); it != _testCases.end(); it++) {
 			setUp();
 			(*it)->runTest();
 			tearDown();
 		}
 	}
-	/** TestCase that wrapps TestFixture methods are dynamically created and owned by 
+
+	/** TestCase that wrapps TestFixture methods are dynamically created and owned by
 	 * the TestFixture. So here we clean it up*/
-	virtual ~TestFixture()
-	{	
+	virtual ~TestFixture() {
 		TestCases::iterator it;
-		for( it =_testCases.begin(); it!=_testCases.end(); it++)
+		for (it = _testCases.begin(); it != _testCases.end(); it++)
 			delete (*it);
 	}
 };
@@ -392,61 +399,59 @@ public:
 /**
  * This class is aimed to hold a creator method for each concrete TestFixture
  */
-class TestFixtureFactory
-{
+class TestFixtureFactory {
 private:
-	/** Well behaved singleton: 
+	/** Well behaved singleton:
 	 *  Don't allow instantiation apart from theInstance(), so private ctr.*/
-	TestFixtureFactory()
-	{
+	TestFixtureFactory() {
 	}
-	typedef Test* (*FixtureCreator)();
+
+	typedef Test *(*FixtureCreator)();
+
 	std::list<FixtureCreator> _creators;
 public:
 	/** Accessor to the (static) singleton instance */
-	static TestFixtureFactory& theInstance()
-	{
+	static TestFixtureFactory &theInstance() {
 		static TestFixtureFactory theFactory;
 		return theFactory;
 	}
-	bool runTests()
-	{
+
+	bool runTests() {
 		std::list<FixtureCreator>::iterator it;
-		for(it=_creators.begin(); it!=_creators.end(); it++)
-		{	
+		for (it = _creators.begin(); it != _creators.end(); it++) {
 			FixtureCreator creator = *it;
-			Test* test = creator();
+			Test *test = creator();
 			test->runTest();
 			delete test;
 		}
-		std::string errors =  TestsListener::theInstance().logString();
-		if (errors!="") std::cout << "\n\nError Details:\n" << errors;
+		std::string errors = TestsListener::theInstance().logString();
+		if (errors != "") std::cout << "\n\nError Details:\n" << errors;
 		std::cout << TestsListener::theInstance().summary();
 
-		return TestsListener::theInstance().allTestsPassed();	
+		return TestsListener::theInstance().allTestsPassed();
 	}
-	void addFixtureCreator(FixtureCreator creator)
-	{
-		_creators.push_back( creator );
+
+	void addFixtureCreator(FixtureCreator creator) {
+		_creators.push_back(creator);
 	}
-	
+
 };
 
 /** 
  * Macro a usar despr�s de cada classe de test
  */
-#define REGISTER_FIXTURE( ConcreteTestFixture ) \
+#define REGISTER_FIXTURE(ConcreteTestFixture) \
 \
 Test* Creador##ConcreteTestFixture() { return new ConcreteTestFixture; } \
 \
 class Registrador##ConcreteTestFixture \
 { \
 public: \
-	Registrador##ConcreteTestFixture() \
-	{ \
-		TestFixtureFactory::theInstance().addFixtureCreator( \
-				Creador##ConcreteTestFixture); \
-	} \
+    Registrador##ConcreteTestFixture() \
+    { \
+        TestFixtureFactory::theInstance().addFixtureCreator( \
+                Creador##ConcreteTestFixture); \
+    } \
 }; \
 static Registrador##ConcreteTestFixture estatic##ConcreteTestFixture;
 
@@ -455,20 +460,20 @@ static Registrador##ConcreteTestFixture estatic##ConcreteTestFixture;
  * Assert macros to use in test methods. An assert is a test condition
  * we want to check.
  */
-#define ASSERT_EQUALS( expected, result) \
-	Assert::assertEquals( expected, result, __FILE__, __LINE__ );
+#define ASSERT_EQUALS(expected, result) \
+    Assert::assertEquals( expected, result, __FILE__, __LINE__ );
 
-#define ASSERT_EQUALS_EPSILON( expected, result, epsilon) \
-	Assert::assertEqualsEpsilon( expected, result, epsilon, __FILE__, __LINE__ );
+#define ASSERT_EQUALS_EPSILON(expected, result, epsilon) \
+    Assert::assertEqualsEpsilon( expected, result, epsilon, __FILE__, __LINE__ );
 
-#define ASSERT( exp ) \
-	Assert::assertTrue(#exp, exp, __FILE__, __LINE__);
+#define ASSERT(exp) \
+    Assert::assertTrue(#exp, exp, __FILE__, __LINE__);
 
-#define ASSERT_MESSAGE( exp, message ) \
-	Assert::assertTrueMissatge(#exp, exp, message, __FILE__, __LINE__);
+#define ASSERT_MESSAGE(exp, message) \
+    Assert::assertTrueMissatge(#exp, exp, message, __FILE__, __LINE__);
 
-#define FAIL( why ) \
-	Assert::fail(#why, __FILE__, __LINE__);
+#define FAIL(why) \
+    Assert::fail(#why, __FILE__, __LINE__);
 
 /**
  * Macros that allows to write the  constructor of the concrete TestFixture.
@@ -491,14 +496,11 @@ static Registrador##ConcreteTestFixture estatic##ConcreteTestFixture;
  * @endcode
  */
 
-#define TEST_FIXTURE( ConcreteFixture ) \
-	ConcreteFixture() : TestFixture<ConcreteFixture>( #ConcreteFixture )
-
-#define TEST_CASE( methodName ) \
-	afegeixCasDeTest( this, &ConcreteFixture::methodName, #methodName );
-
+#define TEST_FIXTURE(ConcreteFixture) \
+    ConcreteFixture() : TestFixture<ConcreteFixture>( #ConcreteFixture )
 
+#define TEST_CASE(methodName) \
+    afegeixCasDeTest( this, &ConcreteFixture::methodName, #methodName );
 
 
-			     
 #endif  // MiniCppUnit_hxx

+ 42 - 48
spine-c/spine-c-unit-tests/teamcity/teamcity_cppunit.cpp

@@ -23,60 +23,54 @@ using namespace std;
 
 namespace JetBrains {
 
-TeamcityProgressListener::TeamcityProgressListener()
-{
-    flowid = getFlowIdFromEnvironment();
-}
+	TeamcityProgressListener::TeamcityProgressListener() {
+		flowid = getFlowIdFromEnvironment();
+	}
 
-TeamcityProgressListener::TeamcityProgressListener(const std::string& _flowid)
-{
-    flowid = _flowid;
-}
+	TeamcityProgressListener::TeamcityProgressListener(const std::string &_flowid) {
+		flowid = _flowid;
+	}
 
-void TeamcityProgressListener::startTest(const std::string& test) {
-    messages.testStarted(test, flowid);
-}
+	void TeamcityProgressListener::startTest(const std::string &test) {
+		messages.testStarted(test, flowid);
+	}
 
-static string sourceLine2string(const SourceLine &sline) {
-    stringstream ss;
-        
-    ss << sline.fileName << ":" << sline.lineNumber;
-    
-    return ss.str();
-}
+	static string sourceLine2string(const SourceLine &sline) {
+		stringstream ss;
 
-void TeamcityProgressListener::addFailure(const TestFailure &failure) 
-{
-  
-    string details = failure.details;
-    
-    if (failure.sourceLine.isValid()) {
-        details.append(" at ");
-        details.append(sourceLine2string(failure.sourceLine));
-        details.append("\n");
-    }
-    
-    messages.testFailed(
-        failure.testName,
-        failure.description,
-        details,
-        flowid
-    );
-}
+		ss << sline.fileName << ":" << sline.lineNumber;
 
-void TeamcityProgressListener::endTest(const std::string& test) 
-{
-    messages.testFinished(test, -1, flowid);
-}
+		return ss.str();
+	}
 
-void TeamcityProgressListener::startSuite(const std::string& test) 
-{
-    messages.suiteStarted(test, flowid);
-}
+	void TeamcityProgressListener::addFailure(const TestFailure &failure) {
 
-void TeamcityProgressListener::endSuite(const std::string& test) 
-{
-    messages.suiteFinished(test, flowid);
-}
+		string details = failure.details;
+
+		if (failure.sourceLine.isValid()) {
+			details.append(" at ");
+			details.append(sourceLine2string(failure.sourceLine));
+			details.append("\n");
+		}
+
+		messages.testFailed(
+				failure.testName,
+				failure.description,
+				details,
+				flowid
+		);
+	}
+
+	void TeamcityProgressListener::endTest(const std::string &test) {
+		messages.testFinished(test, -1, flowid);
+	}
+
+	void TeamcityProgressListener::startSuite(const std::string &test) {
+		messages.suiteStarted(test, flowid);
+	}
+
+	void TeamcityProgressListener::endSuite(const std::string &test) {
+		messages.suiteFinished(test, flowid);
+	}
 
 }

+ 29 - 22
spine-c/spine-c-unit-tests/teamcity/teamcity_cppunit.h

@@ -23,31 +23,33 @@
 
 namespace JetBrains {
 
-	class SourceLine
-	{
+	class SourceLine {
 	public:
-		SourceLine():lineNumber(-1){}
-		SourceLine(const std::string& theFile, int theLineNum):fileName(theFile),lineNumber(theLineNum){}
-		~SourceLine(){}
+		SourceLine() : lineNumber(-1) {}
+
+		SourceLine(const std::string &theFile, int theLineNum) : fileName(theFile), lineNumber(theLineNum) {}
+
+		~SourceLine() {}
 
 		std::string fileName;
 		int lineNumber;
-		bool isValid() const {return (!fileName.empty() && lineNumber > -1);}
+
+		bool isValid() const { return (!fileName.empty() && lineNumber > -1); }
 	};
 
-	class TestFailure
-	{
+	class TestFailure {
 	public:
 		std::string details;
 		SourceLine sourceLine;
 		std::string testName;
 		std::string description;
 	public:
-		TestFailure(){}
-		~TestFailure(){}
+		TestFailure() {}
 
-		TestFailure(const std::string& theTestName, const std::string& theDetails, SourceLine theSourcelLine, const std::string& theDescription)
-		{
+		~TestFailure() {}
+
+		TestFailure(const std::string &theTestName, const std::string &theDetails, SourceLine theSourcelLine,
+					const std::string &theDescription) {
 			testName = theTestName;
 			details = theDetails;
 			sourceLine = theSourcelLine;
@@ -55,21 +57,26 @@ namespace JetBrains {
 		}
 	};
 
-	class TeamcityProgressListener 
-	{
+	class TeamcityProgressListener {
 	public:
 		TeamcityMessages messages;
 	public:
-		TeamcityProgressListener(const std::string& _flowid);
+		TeamcityProgressListener(const std::string &_flowid);
+
 		TeamcityProgressListener();
-		~TeamcityProgressListener(){}
 
-		void startTest(const std::string& test);
+		~TeamcityProgressListener() {}
+
+		void startTest(const std::string &test);
+
 		void addFailure(const TestFailure &failure);
-		void endTest(const std::string& test);
-		void startSuite(const std::string& test);
-		void endSuite(const std::string& test);
-    
+
+		void endTest(const std::string &test);
+
+		void startSuite(const std::string &test);
+
+		void endSuite(const std::string &test);
+
 	private:
 		std::string flowid;
 
@@ -77,7 +84,7 @@ namespace JetBrains {
 		TeamcityProgressListener(const TeamcityProgressListener &copy);
 
 		// Prevents the use of the copy operator.
-		void operator =(const TeamcityProgressListener &copy);
+		void operator=(const TeamcityProgressListener &copy);
 	};
 
 }

+ 153 - 146
spine-c/spine-c-unit-tests/teamcity/teamcity_messages.cpp

@@ -26,151 +26,158 @@ using namespace std;
 
 namespace JetBrains {
 
-std::string getFlowIdFromEnvironment() {
-    const char *flowId = getenv("TEAMCITY_PROCESS_FLOW_ID");
-    return flowId == NULL ? "" : flowId;
-}
-
-bool underTeamcity() {
-    return getenv("TEAMCITY_PROJECT_NAME") != NULL;
-}
-
-TeamcityMessages::TeamcityMessages()
-: m_out(&cout)
-{}
-
-void TeamcityMessages::setOutput(ostream &out) {
-    m_out = &out;
-}
-
-string TeamcityMessages::escape(string s) {
-    string result;
-    
-    for (size_t i = 0; i < s.length(); i++) {
-        char c = s[i];
-        
-        switch (c) {
-        case '\n': result.append("|n"); break;
-        case '\r': result.append("|r"); break;
-        case '\'': result.append("|'"); break;
-        case '|':  result.append("||"); break;
-        case ']':  result.append("|]"); break;
-        default:   result.append(&c, 1);
-        }
-    }
-    
-    return result;
-}
-
-void TeamcityMessages::openMsg(const string &name) {
-    // endl for http://jetbrains.net/tracker/issue/TW-4412
-    *m_out << endl << "##teamcity[" << name;
-}
-
-void TeamcityMessages::closeMsg() {
-    *m_out << "]";
-    // endl for http://jetbrains.net/tracker/issue/TW-4412
-    *m_out << endl;
-    m_out->flush();
-}
-
-void TeamcityMessages::writeProperty(string name, string value) {
-    *m_out << " " << name << "='" << escape(value) << "'";
-}
-
-void TeamcityMessages::suiteStarted(string name, string flowid) {
-    openMsg("testSuiteStarted");
-    writeProperty("name", name);
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::suiteFinished(string name, string flowid) {
-    openMsg("testSuiteFinished");
-    writeProperty("name", name);
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::testStarted(string name, string flowid) {
-    openMsg("testStarted");
-    writeProperty("name", name);
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::testFinished(string name, int durationMs, string flowid) {
-    openMsg("testFinished");
-
-    writeProperty("name", name);
-
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-
-    if(durationMs >= 0) {
-        stringstream out;
-        out << durationMs;
-        writeProperty("duration", out.str());
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::testFailed(string name, string message, string details, string flowid) {
-    openMsg("testFailed");
-    writeProperty("name", name);
-    writeProperty("message", message);
-    writeProperty("details", details);
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::testIgnored(std::string name, std::string message, string flowid) {
-    openMsg("testIgnored");
-    writeProperty("name", name);
-    writeProperty("message", message);
-    if(flowid.length() > 0) {
-        writeProperty("flowId", flowid);
-    }
-    
-    closeMsg();
-}
-
-void TeamcityMessages::messageError(const std::string& text)
-{
-	openMsg("message");
-	writeProperty("text", text);
-	writeProperty("status", "ERROR");
-	closeMsg();
-}
-
-void TeamcityMessages::messageWarning(const std::string& text)
-{
-	openMsg("message");
-	writeProperty("text", text);
-	writeProperty("status", "WARNING");
-	closeMsg();
-}
-
-void TeamcityMessages::messageNormal(const std::string& text)
-{
-	openMsg("message");
-	writeProperty("text", text);
-	writeProperty("status", "NORMAL");
-	closeMsg();
-}
+	std::string getFlowIdFromEnvironment() {
+		const char *flowId = getenv("TEAMCITY_PROCESS_FLOW_ID");
+		return flowId == NULL ? "" : flowId;
+	}
+
+	bool underTeamcity() {
+		return getenv("TEAMCITY_PROJECT_NAME") != NULL;
+	}
+
+	TeamcityMessages::TeamcityMessages()
+			: m_out(&cout) {}
+
+	void TeamcityMessages::setOutput(ostream &out) {
+		m_out = &out;
+	}
+
+	string TeamcityMessages::escape(string s) {
+		string result;
+
+		for (size_t i = 0; i < s.length(); i++) {
+			char c = s[i];
+
+			switch (c) {
+				case '\n':
+					result.append("|n");
+					break;
+				case '\r':
+					result.append("|r");
+					break;
+				case '\'':
+					result.append("|'");
+					break;
+				case '|':
+					result.append("||");
+					break;
+				case ']':
+					result.append("|]");
+					break;
+				default:
+					result.append(&c, 1);
+			}
+		}
+
+		return result;
+	}
+
+	void TeamcityMessages::openMsg(const string &name) {
+		// endl for http://jetbrains.net/tracker/issue/TW-4412
+		*m_out << endl << "##teamcity[" << name;
+	}
+
+	void TeamcityMessages::closeMsg() {
+		*m_out << "]";
+		// endl for http://jetbrains.net/tracker/issue/TW-4412
+		*m_out << endl;
+		m_out->flush();
+	}
+
+	void TeamcityMessages::writeProperty(string name, string value) {
+		*m_out << " " << name << "='" << escape(value) << "'";
+	}
+
+	void TeamcityMessages::suiteStarted(string name, string flowid) {
+		openMsg("testSuiteStarted");
+		writeProperty("name", name);
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::suiteFinished(string name, string flowid) {
+		openMsg("testSuiteFinished");
+		writeProperty("name", name);
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::testStarted(string name, string flowid) {
+		openMsg("testStarted");
+		writeProperty("name", name);
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::testFinished(string name, int durationMs, string flowid) {
+		openMsg("testFinished");
+
+		writeProperty("name", name);
+
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		if (durationMs >= 0) {
+			stringstream out;
+			out << durationMs;
+			writeProperty("duration", out.str());
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::testFailed(string name, string message, string details, string flowid) {
+		openMsg("testFailed");
+		writeProperty("name", name);
+		writeProperty("message", message);
+		writeProperty("details", details);
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::testIgnored(std::string name, std::string message, string flowid) {
+		openMsg("testIgnored");
+		writeProperty("name", name);
+		writeProperty("message", message);
+		if (flowid.length() > 0) {
+			writeProperty("flowId", flowid);
+		}
+
+		closeMsg();
+	}
+
+	void TeamcityMessages::messageError(const std::string &text) {
+		openMsg("message");
+		writeProperty("text", text);
+		writeProperty("status", "ERROR");
+		closeMsg();
+	}
+
+	void TeamcityMessages::messageWarning(const std::string &text) {
+		openMsg("message");
+		writeProperty("text", text);
+		writeProperty("status", "WARNING");
+		closeMsg();
+	}
+
+	void TeamcityMessages::messageNormal(const std::string &text) {
+		openMsg("message");
+		writeProperty("text", text);
+		writeProperty("status", "NORMAL");
+		closeMsg();
+	}
 
 }

+ 39 - 30
spine-c/spine-c-unit-tests/teamcity/teamcity_messages.h

@@ -23,36 +23,45 @@
 
 namespace JetBrains {
 
-std::string getFlowIdFromEnvironment();
-bool underTeamcity();
-
-class TeamcityMessages {
-    std::ostream *m_out;
-    
-protected:
-    std::string escape(std::string s);
-
-    void openMsg(const std::string &name);
-    void writeProperty(std::string name, std::string value);
-    void closeMsg();
-
-public:
-    TeamcityMessages();
-    
-    void setOutput(std::ostream &);
-    
-    void suiteStarted(std::string name, std::string flowid = "");
-    void suiteFinished(std::string name, std::string flowid = "");
-    
-    void testStarted(std::string name, std::string flowid = "");
-    void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
-    void testIgnored(std::string name, std::string message, std::string flowid = "");
-    void testFinished(std::string name, int durationMs = -1, std::string flowid = "");    
-
-	void messageError(const std::string& text);
-	void messageWarning(const std::string& text);
-	void messageNormal(const std::string& text);
-};
+	std::string getFlowIdFromEnvironment();
+
+	bool underTeamcity();
+
+	class TeamcityMessages {
+		std::ostream *m_out;
+
+	protected:
+		std::string escape(std::string s);
+
+		void openMsg(const std::string &name);
+
+		void writeProperty(std::string name, std::string value);
+
+		void closeMsg();
+
+	public:
+		TeamcityMessages();
+
+		void setOutput(std::ostream &);
+
+		void suiteStarted(std::string name, std::string flowid = "");
+
+		void suiteFinished(std::string name, std::string flowid = "");
+
+		void testStarted(std::string name, std::string flowid = "");
+
+		void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
+
+		void testIgnored(std::string name, std::string message, std::string flowid = "");
+
+		void testFinished(std::string name, int durationMs = -1, std::string flowid = "");
+
+		void messageError(const std::string &text);
+
+		void messageWarning(const std::string &text);
+
+		void messageNormal(const std::string &text);
+	};
 
 }
 

+ 9 - 17
spine-c/spine-c-unit-tests/tests/CPP_InterfaceTestFixture.cpp

@@ -5,44 +5,36 @@
 //
 /////////////////////////////////////////////////////////////////////
 
-#include "CPP_InterfaceTestFixture.h" 
+#include "CPP_InterfaceTestFixture.h"
 
-CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture()
-{
+CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture() {
 	finalize();
 }
 
-void CPP_InterfaceTestFixture::initialize()
-{
+void CPP_InterfaceTestFixture::initialize() {
 	// on a Per- Fixture Basis, before Test execution
 }
 
-void CPP_InterfaceTestFixture::finalize()
-{
+void CPP_InterfaceTestFixture::finalize() {
 	// on a Per- Fixture Basis, after all tests pass/fail
 }
 
-void CPP_InterfaceTestFixture::setUp()
-{
+void CPP_InterfaceTestFixture::setUp() {
 	// Setup on Per-Test Basis
 }
 
-void CPP_InterfaceTestFixture::tearDown()
-{
+void CPP_InterfaceTestFixture::tearDown() {
 	// Tear Down on Per-Test Basis
 }
 
-void CPP_InterfaceTestFixture::spineboyTestCase()
-{
+void CPP_InterfaceTestFixture::spineboyTestCase() {
 	// There is no C++ interface.
 }
 
-void CPP_InterfaceTestFixture::raptorTestCase()
-{
+void CPP_InterfaceTestFixture::raptorTestCase() {
 	// There is no C++ interface.
 }
 
-void CPP_InterfaceTestFixture::goblinsTestCase()
-{
+void CPP_InterfaceTestFixture::goblinsTestCase() {
 	// No c++ interface
 }

+ 13 - 7
spine-c/spine-c-unit-tests/tests/CPP_InterfaceTestFixture.h

@@ -1,4 +1,4 @@
-#pragma once 
+#pragma once
 //////////////////////////////////////////////////////////////////////
 //	filename: 	C_InterfaceTestFixture.h
 //	
@@ -11,10 +11,9 @@
 #include "MiniCppUnit.hxx"
 #include "TestOptions.h"
 
-class CPP_InterfaceTestFixture : public TestFixture < CPP_InterfaceTestFixture >
-{
+class CPP_InterfaceTestFixture : public TestFixture<CPP_InterfaceTestFixture> {
 public:
-	TEST_FIXTURE(CPP_InterfaceTestFixture){
+	TEST_FIXTURE(CPP_InterfaceTestFixture) {
 		TEST_CASE(spineboyTestCase);
 		TEST_CASE(raptorTestCase);
 		TEST_CASE(goblinsTestCase);
@@ -28,20 +27,27 @@ public:
 	// Test Cases
 	//////////////////////////////////////////////////////////////////////////
 public:
-	void	spineboyTestCase();
-	void	raptorTestCase();
-	void	goblinsTestCase();
+	void spineboyTestCase();
+
+	void raptorTestCase();
+
+	void goblinsTestCase();
 
 	//////////////////////////////////////////////////////////////////////////
 	// test fixture setup
 	//////////////////////////////////////////////////////////////////////////
 	void initialize();
+
 	void finalize();
+
 public:
 	virtual void setUp();
+
 	virtual void tearDown();
 
 };
+
 #if defined(gForceAllTests) || defined(gCPPInterfaceTestFixture)
+
 REGISTER_FIXTURE(CPP_InterfaceTestFixture);
 #endif

+ 20 - 27
spine-c/spine-c-unit-tests/tests/C_InterfaceTestFixture.cpp

@@ -1,5 +1,5 @@
-#include "C_InterfaceTestFixture.h" 
-#include "SpineEventMonitor.h" 
+#include "C_InterfaceTestFixture.h"
+#include "SpineEventMonitor.h"
 
 #include "spine/spine.h"
 #include <vector>
@@ -17,19 +17,17 @@
 
 #define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
 
-void C_InterfaceTestFixture::setUp()
-{
+void C_InterfaceTestFixture::setUp() {
 }
 
-void C_InterfaceTestFixture::tearDown()
-{
+void C_InterfaceTestFixture::tearDown() {
 }
 
-static spSkeletonData* readSkeletonJsonData(const char* filename, spAtlas* atlas) {
-	spSkeletonJson* json = spSkeletonJson_create(atlas);
+static spSkeletonData *readSkeletonJsonData(const char *filename, spAtlas *atlas) {
+	spSkeletonJson *json = spSkeletonJson_create(atlas);
 	ASSERT(json != 0);
 
-	spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
+	spSkeletonData *skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
 	ASSERT(skeletonData != 0);
 
 	spSkeletonJson_dispose(json);
@@ -38,9 +36,8 @@ static spSkeletonData* readSkeletonJsonData(const char* filename, spAtlas* atlas
 
 typedef std::vector<std::string> AnimList;
 
-static size_t enumerateAnimations(AnimList& outList, spSkeletonData* skeletonData)
-{
-	if (skeletonData){
+static size_t enumerateAnimations(AnimList &outList, spSkeletonData *skeletonData) {
+	if (skeletonData) {
 
 		for (int n = 0; n < skeletonData->animationsCount; n++)
 			outList.push_back(skeletonData->animations[n]->name);
@@ -49,26 +46,25 @@ static size_t enumerateAnimations(AnimList& outList, spSkeletonData* skeletonDat
 	return outList.size();
 }
 
-static void testRunner(const char* jsonName, const char* atlasName)
-{
+static void testRunner(const char *jsonName, const char *atlasName) {
 	///////////////////////////////////////////////////////////////////////////
 	// Global Animation Information
-	spAtlas* atlas = spAtlas_createFromFile(atlasName, 0);
+	spAtlas *atlas = spAtlas_createFromFile(atlasName, 0);
 	ASSERT(atlas != 0);
 
-	spSkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas);
+	spSkeletonData *skeletonData = readSkeletonJsonData(jsonName, atlas);
 	ASSERT(skeletonData != 0);
 
-	spAnimationStateData* stateData = spAnimationStateData_create(skeletonData);
+	spAnimationStateData *stateData = spAnimationStateData_create(skeletonData);
 	ASSERT(stateData != 0);
 	stateData->defaultMix = 0.2f; // force mixing
 
 	///////////////////////////////////////////////////////////////////////////
-	// Animation Instance 
-	spSkeleton* skeleton = spSkeleton_create(skeletonData);
+	// Animation Instance
+	spSkeleton *skeleton = spSkeleton_create(skeletonData);
 	ASSERT(skeleton != 0);
 
-	spAnimationState* state = spAnimationState_create(stateData);
+	spAnimationState *state = spAnimationState_create(stateData);
 	ASSERT(state != 0);
 
 
@@ -94,7 +90,7 @@ static void testRunner(const char* jsonName, const char* atlasName)
 		spAnimationState_apply(state, skeleton);
 	}
 
-	
+
 	///////////////////////////////////////////////////////////////////////////
 	// Dispose Instance
 	spSkeleton_dispose(skeleton);
@@ -107,17 +103,14 @@ static void testRunner(const char* jsonName, const char* atlasName)
 	spAtlas_dispose(atlas);
 }
 
-void C_InterfaceTestFixture::spineboyTestCase()
-{
+void C_InterfaceTestFixture::spineboyTestCase() {
 	testRunner(SPINEBOY_JSON, SPINEBOY_ATLAS);
 }
 
-void C_InterfaceTestFixture::raptorTestCase()
-{
+void C_InterfaceTestFixture::raptorTestCase() {
 	testRunner(RAPTOR_JSON, RAPTOR_ATLAS);
 }
 
-void C_InterfaceTestFixture::goblinsTestCase()
-{
+void C_InterfaceTestFixture::goblinsTestCase() {
 	testRunner(GOBLINS_JSON, GOBLINS_ATLAS);
 }

+ 11 - 8
spine-c/spine-c-unit-tests/tests/C_InterfaceTestFixture.h

@@ -1,4 +1,4 @@
-#pragma once 
+#pragma once
 //////////////////////////////////////////////////////////////////////
 //	filename: 	C_InterfaceTestFixture.h
 //	
@@ -9,11 +9,9 @@
 #include "TestOptions.h"
 #include "MiniCppUnit.hxx"
 
-class C_InterfaceTestFixture : public TestFixture<C_InterfaceTestFixture>
-{
+class C_InterfaceTestFixture : public TestFixture<C_InterfaceTestFixture> {
 public:
-	TEST_FIXTURE(C_InterfaceTestFixture)
-	{
+	TEST_FIXTURE(C_InterfaceTestFixture) {
 		// enable/disable individual tests here
 		TEST_CASE(spineboyTestCase);
 		TEST_CASE(raptorTestCase);
@@ -22,12 +20,17 @@ public:
 
 public:
 	virtual void setUp();
+
 	virtual void tearDown();
 
-	void	spineboyTestCase();
-	void	raptorTestCase();
-	void	goblinsTestCase();
+	void spineboyTestCase();
+
+	void raptorTestCase();
+
+	void goblinsTestCase();
 };
+
 #if defined(gForceAllTests) || defined(gCInterfaceTestFixture)
+
 REGISTER_FIXTURE(C_InterfaceTestFixture);
 #endif

+ 6 - 11
spine-c/spine-c-unit-tests/tests/EmptyTestFixture.cpp

@@ -1,25 +1,20 @@
-#include "EmptyTestFixture.h" 
+#include "EmptyTestFixture.h"
 
 #include "KMemory.h" // Last include
 
 
-void EmptyTestFixture::setUp()
-{
+void EmptyTestFixture::setUp() {
 }
 
-void EmptyTestFixture::tearDown()
-{
+void EmptyTestFixture::tearDown() {
 }
 
-void EmptyTestFixture::emptyTestCase_1()
-{
+void EmptyTestFixture::emptyTestCase_1() {
 	// char* pLeak = new char[256]; // test leak detector
 }
 
-void EmptyTestFixture::emptyTestCase_2()
-{
+void EmptyTestFixture::emptyTestCase_2() {
 }
 
-void EmptyTestFixture::emptyTestCase_3()
-{
+void EmptyTestFixture::emptyTestCase_3() {
 }

+ 12 - 8
spine-c/spine-c-unit-tests/tests/EmptyTestFixture.h

@@ -1,12 +1,11 @@
-#pragma once 
+#pragma once
+
 #include "TestOptions.h"
 #include "MiniCppUnit.hxx"
 
-class EmptyTestFixture : public TestFixture<EmptyTestFixture>
-{
+class EmptyTestFixture : public TestFixture<EmptyTestFixture> {
 public:
-	TEST_FIXTURE(EmptyTestFixture)
-	{
+	TEST_FIXTURE(EmptyTestFixture) {
 		// enable/disable individual tests here
 		TEST_CASE(emptyTestCase_1);
 		TEST_CASE(emptyTestCase_2);
@@ -15,12 +14,17 @@ public:
 
 public:
 	virtual void setUp();
+
 	virtual void tearDown();
 
-	void	emptyTestCase_1();
-	void	emptyTestCase_2();
-	void	emptyTestCase_3();
+	void emptyTestCase_1();
+
+	void emptyTestCase_2();
+
+	void emptyTestCase_3();
 };
+
 #if defined(gForceAllTests) || defined(gEmptyTestFixture)
+
 REGISTER_FIXTURE(EmptyTestFixture);
 #endif

+ 60 - 66
spine-c/spine-c-unit-tests/tests/MemoryTestFixture.cpp

@@ -1,6 +1,6 @@
 #include <spine/extension.h>
 #include "MemoryTestFixture.h"
-#include "SpineEventMonitor.h" 
+#include "SpineEventMonitor.h"
 
 #include "spine/spine.h"
 
@@ -11,47 +11,42 @@
 
 #define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
 
-MemoryTestFixture::~MemoryTestFixture()
-{
+MemoryTestFixture::~MemoryTestFixture() {
 	finalize();
 }
 
-void MemoryTestFixture::initialize()
-{
+void MemoryTestFixture::initialize() {
 	// on a Per- Fixture Basis, before Test execution
 }
 
-void MemoryTestFixture::finalize()
-{
+void MemoryTestFixture::finalize() {
 	// on a Per- Fixture Basis, after all tests pass/fail
 }
 
-void MemoryTestFixture::setUp()
-{
+void MemoryTestFixture::setUp() {
 	// Setup on Per-Test Basis
 }
 
-void MemoryTestFixture::tearDown()
-{
+void MemoryTestFixture::tearDown() {
 	// Tear Down on Per-Test Basis
 }
 
 
 //////////////////////////////////////////////////////////////////////////
 // Helper methods
-static spSkeletonData* readSkeletonJsonData(const char* filename, spAtlas* atlas) {
-	spSkeletonJson* json = spSkeletonJson_create(atlas);
+static spSkeletonData *readSkeletonJsonData(const char *filename, spAtlas *atlas) {
+	spSkeletonJson *json = spSkeletonJson_create(atlas);
 	ASSERT(json != 0);
 
-	spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
+	spSkeletonData *skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
 	ASSERT(skeletonData != 0);
 
 	spSkeletonJson_dispose(json);
 	return skeletonData;
 }
 
-static void LoadSpineboyExample(spAtlas* &atlas, spSkeletonData* &skeletonData, spAnimationStateData* &stateData, spSkeleton* &skeleton, spAnimationState* &state)
-{
+static void LoadSpineboyExample(spAtlas *&atlas, spSkeletonData *&skeletonData, spAnimationStateData *&stateData,
+								spSkeleton *&skeleton, spAnimationState *&state) {
 	///////////////////////////////////////////////////////////////////////////
 	// Global Animation Information
 	atlas = spAtlas_createFromFile(SPINEBOY_ATLAS, 0);
@@ -65,7 +60,7 @@ static void LoadSpineboyExample(spAtlas* &atlas, spSkeletonData* &skeletonData,
 	stateData->defaultMix = 0.4f; // force mixing
 
 	///////////////////////////////////////////////////////////////////////////
-	// Animation Instance 
+	// Animation Instance
 	skeleton = spSkeleton_create(skeletonData);
 	ASSERT(skeleton != 0);
 
@@ -73,8 +68,9 @@ static void LoadSpineboyExample(spAtlas* &atlas, spSkeletonData* &skeletonData,
 	ASSERT(state != 0);
 }
 
-static void DisposeAll(spSkeleton* skeleton, spAnimationState* state, spAnimationStateData* stateData, spSkeletonData* skeletonData, spAtlas* atlas)
-{
+static void
+DisposeAll(spSkeleton *skeleton, spAnimationState *state, spAnimationStateData *stateData, spSkeletonData *skeletonData,
+		   spAtlas *atlas) {
 	///////////////////////////////////////////////////////////////////////////
 	// Dispose Instance
 	spSkeleton_dispose(skeleton);
@@ -91,13 +87,12 @@ static void DisposeAll(spSkeleton* skeleton, spAnimationState* state, spAnimatio
 //////////////////////////////////////////////////////////////////////////
 // Reproduce Memory leak as described in Issue #776
 // https://github.com/EsotericSoftware/spine-runtimes/issues/776
-void MemoryTestFixture::reproduceIssue_776()
-{
-	spAtlas* atlas = 0;
-	spSkeletonData* skeletonData = 0;
-	spAnimationStateData* stateData = 0;
-	spSkeleton* skeleton = 0;
-	spAnimationState* state = 0;
+void MemoryTestFixture::reproduceIssue_776() {
+	spAtlas *atlas = 0;
+	spSkeletonData *skeletonData = 0;
+	spAnimationStateData *stateData = 0;
+	spSkeleton *skeleton = 0;
+	spAnimationState *state = 0;
 
 	//////////////////////////////////////////////////////////////////////////
 	// Initialize Animations
@@ -111,14 +106,14 @@ void MemoryTestFixture::reproduceIssue_776()
 
 	// Interrupt the animation on this specific sequence of spEventType(s)
 	eventMonitor
-		.AddInterruptEvent(SP_ANIMATION_INTERRUPT, "jump")
-		.AddInterruptEvent(SP_ANIMATION_START);
+			.AddInterruptEvent(SP_ANIMATION_INTERRUPT, "jump")
+			.AddInterruptEvent(SP_ANIMATION_START);
 
 	spAnimationState_setAnimationByName(state, 0, "walk", true);
 	spAnimationState_addAnimationByName(state, 0, "jump", false, 0.0f);
-	spAnimationState_addAnimationByName(state, 0, "run",  true,  0.0f);
+	spAnimationState_addAnimationByName(state, 0, "run", true, 0.0f);
 	spAnimationState_addAnimationByName(state, 0, "jump", false, 3.0f);
-	spAnimationState_addAnimationByName(state, 0, "walk", true,  0.0f);
+	spAnimationState_addAnimationByName(state, 0, "walk", true, 0.0f);
 	spAnimationState_addAnimationByName(state, 0, "idle", false, 1.0f);
 
 	for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i) {
@@ -133,13 +128,12 @@ void MemoryTestFixture::reproduceIssue_776()
 	DisposeAll(skeleton, state, stateData, skeletonData, atlas);
 }
 
-void MemoryTestFixture::reproduceIssue_777()
-{
-	spAtlas* atlas = 0;
-	spSkeletonData* skeletonData = 0;
-	spAnimationStateData* stateData = 0;
-	spSkeleton* skeleton = 0;
-	spAnimationState* state = 0;
+void MemoryTestFixture::reproduceIssue_777() {
+	spAtlas *atlas = 0;
+	spSkeletonData *skeletonData = 0;
+	spAnimationStateData *stateData = 0;
+	spSkeleton *skeleton = 0;
+	spAnimationState *state = 0;
 
 	//////////////////////////////////////////////////////////////////////////
 	// Initialize Animations
@@ -180,23 +174,21 @@ void MemoryTestFixture::reproduceIssue_777()
 	DisposeAll(skeleton, state, stateData, skeletonData, atlas);
 }
 
-spSkeleton* skeleton = 0;
-static void  spineAnimStateHandler(spAnimationState* state, int type, spTrackEntry* entry, spEvent* event)
-{
-	if (type == SP_ANIMATION_COMPLETE)
-	{
+spSkeleton *skeleton = 0;
+
+static void spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event) {
+	if (type == SP_ANIMATION_COMPLETE) {
 		spAnimationState_setAnimationByName(state, 0, "walk", false);
 		spAnimationState_update(state, 0);
 		spAnimationState_apply(state, skeleton);
 	}
 }
 
-void MemoryTestFixture::reproduceIssue_Loop()
-{
-	spAtlas* atlas = 0;
-	spSkeletonData* skeletonData = 0;
-	spAnimationStateData* stateData = 0;
-	spAnimationState* state = 0;
+void MemoryTestFixture::reproduceIssue_Loop() {
+	spAtlas *atlas = 0;
+	spSkeletonData *skeletonData = 0;
+	spAnimationStateData *stateData = 0;
+	spAnimationState *state = 0;
 
 	//////////////////////////////////////////////////////////////////////////
 	// Initialize Animations
@@ -205,7 +197,7 @@ void MemoryTestFixture::reproduceIssue_Loop()
 	///////////////////////////////////////////////////////////////////////////
 
 	if (state)
-		state->listener = (spAnimationStateListener)&spineAnimStateHandler;
+		state->listener = (spAnimationStateListener) &spineAnimStateHandler;
 
 	spAnimationState_setAnimationByName(state, 0, "walk", false);
 
@@ -221,8 +213,8 @@ void MemoryTestFixture::reproduceIssue_Loop()
 }
 
 void MemoryTestFixture::triangulator() {
-	spTriangulator* triangulator = spTriangulator_create();
-	spFloatArray* polygon = spFloatArray_create(16);
+	spTriangulator *triangulator = spTriangulator_create();
+	spFloatArray *polygon = spFloatArray_create(16);
 	spFloatArray_add(polygon, 0);
 	spFloatArray_add(polygon, 0);
 	spFloatArray_add(polygon, 100);
@@ -232,7 +224,7 @@ void MemoryTestFixture::triangulator() {
 	spFloatArray_add(polygon, 0);
 	spFloatArray_add(polygon, 100);
 
-	spShortArray* triangles = spTriangulator_triangulate(triangulator, polygon);
+	spShortArray *triangles = spTriangulator_triangulate(triangulator, polygon);
 	ASSERT(triangles->size == 6);
 	ASSERT(triangles->items[0] == 3);
 	ASSERT(triangles->items[1] == 0);
@@ -241,7 +233,7 @@ void MemoryTestFixture::triangulator() {
 	ASSERT(triangles->items[4] == 1);
 	ASSERT(triangles->items[5] == 2);
 
-	spArrayFloatArray* polys = spTriangulator_decompose(triangulator, polygon, triangles);
+	spArrayFloatArray *polys = spTriangulator_decompose(triangulator, polygon, triangles);
 	ASSERT(polys->size == 1);
 	ASSERT(polys->items[0]->size == 8);
 	ASSERT(polys->items[0]->items[0] == 0);
@@ -258,19 +250,19 @@ void MemoryTestFixture::triangulator() {
 }
 
 void MemoryTestFixture::skeletonClipper() {
-	spSkeletonClipping* clipping = spSkeletonClipping_create();
+	spSkeletonClipping *clipping = spSkeletonClipping_create();
 
-	spBoneData* boneData = spBoneData_create(0, "bone", 0);
-	spBone* bone = spBone_create(boneData, 0, 0);
+	spBoneData *boneData = spBoneData_create(0, "bone", 0);
+	spBone *bone = spBone_create(boneData, 0, 0);
 	CONST_CAST(float, bone->a) = 1;
 	CONST_CAST(float, bone->b) = 0;
 	CONST_CAST(float, bone->c) = 0;
 	CONST_CAST(float, bone->d) = 1;
 	CONST_CAST(float, bone->worldX) = 0;
 	CONST_CAST(float, bone->worldY) = 0;
-	spSlotData* slotData = spSlotData_create(0, "slot", 0);
-	spSlot* slot = spSlot_create(slotData, bone);
-	spClippingAttachment* clip = spClippingAttachment_create("clipping");
+	spSlotData *slotData = spSlotData_create(0, "slot", 0);
+	spSlot *slot = spSlot_create(slotData, bone);
+	spClippingAttachment *clip = spClippingAttachment_create("clipping");
 	clip->endSlot = slotData;
 	clip->super.worldVerticesLength = 4 * 2;
 	clip->super.verticesCount = 4;
@@ -286,40 +278,42 @@ void MemoryTestFixture::skeletonClipper() {
 
 	spSkeletonClipping_clipStart(clipping, slot, clip);
 
-	spFloatArray* vertices = spFloatArray_create(16);
+	spFloatArray *vertices = spFloatArray_create(16);
 	spFloatArray_add(vertices, 0);
 	spFloatArray_add(vertices, 0);
 	spFloatArray_add(vertices, 100);
 	spFloatArray_add(vertices, 0);
 	spFloatArray_add(vertices, 50);
 	spFloatArray_add(vertices, 150);
-	spFloatArray* uvs = spFloatArray_create(16);
+	spFloatArray *uvs = spFloatArray_create(16);
 	spFloatArray_add(uvs, 0);
 	spFloatArray_add(uvs, 0);
 	spFloatArray_add(uvs, 1);
 	spFloatArray_add(uvs, 0);
 	spFloatArray_add(uvs, 0.5f);
 	spFloatArray_add(uvs, 1);
-	spUnsignedShortArray* indices = spUnsignedShortArray_create(16);
+	spUnsignedShortArray *indices = spUnsignedShortArray_create(16);
 	spUnsignedShortArray_add(indices, 0);
 	spUnsignedShortArray_add(indices, 1);
 	spUnsignedShortArray_add(indices, 2);
 
-	spSkeletonClipping_clipTriangles(clipping, vertices->items, vertices->size, indices->items, indices->size, uvs->items, 2);
+	spSkeletonClipping_clipTriangles(clipping, vertices->items, vertices->size, indices->items, indices->size,
+									 uvs->items, 2);
 
-	float expectedVertices[8] = { 83.333328f, 50.000000f, 76.666664f, 70.000000f, 23.333334f, 70.000000f, 16.666672f, 50.000000f };
+	float expectedVertices[8] = {83.333328f, 50.000000f, 76.666664f, 70.000000f, 23.333334f, 70.000000f, 16.666672f,
+								 50.000000f};
 	ASSERT(clipping->clippedVertices->size == 8);
 	for (int i = 0; i < clipping->clippedVertices->size; i++) {
 		ASSERT(ABS(clipping->clippedVertices->items[i] - expectedVertices[i]) < 0.001);
 	}
 
-	float expectedUVs[8] = { 0.833333f, 0.333333f, 0.766667f, 0.466667f, 0.233333f, 0.466667f, 0.166667f, 0.333333f };
+	float expectedUVs[8] = {0.833333f, 0.333333f, 0.766667f, 0.466667f, 0.233333f, 0.466667f, 0.166667f, 0.333333f};
 	ASSERT(clipping->clippedUVs->size == 8);
 	for (int i = 0; i < clipping->clippedUVs->size; i++) {
 		ASSERT(ABS(clipping->clippedUVs->items[i] - expectedUVs[i]) < 0.001);
 	}
 
-	short expectedIndices[6] = { 0, 1, 2, 0, 2, 3 };
+	short expectedIndices[6] = {0, 1, 2, 0, 2, 3};
 	ASSERT(clipping->clippedTriangles->size == 6);
 	for (int i = 0; i < clipping->clippedTriangles->size; i++) {
 		ASSERT(clipping->clippedTriangles->items[i] == expectedIndices[i]);

+ 13 - 5
spine-c/spine-c-unit-tests/tests/MemoryTestFixture.h

@@ -5,16 +5,16 @@
 //				and for regression testing
 /////////////////////////////////////////////////////////////////////
 
-#pragma once 
+#pragma once
+
 #include "MiniCppUnit.hxx"
 #include "TestOptions.h"
 
-class MemoryTestFixture : public TestFixture < MemoryTestFixture >
-{
+class MemoryTestFixture : public TestFixture<MemoryTestFixture> {
 public:
-	TEST_FIXTURE(MemoryTestFixture){
+	TEST_FIXTURE(MemoryTestFixture) {
 
-		// Comment out here to disable individual test cases 
+		// Comment out here to disable individual test cases
 		TEST_CASE(reproduceIssue_776);
 		TEST_CASE(reproduceIssue_777);
 		TEST_CASE(reproduceIssue_Loop);
@@ -31,20 +31,28 @@ public:
 	//////////////////////////////////////////////////////////////////////////
 public:
 	void reproduceIssue_776();
+
 	void reproduceIssue_777();
+
 	void reproduceIssue_Loop(); // http://esotericsoftware.com/forum/spine-c-3-5-animation-jerking-7451
 	void triangulator();
+
 	void skeletonClipper();
 
 	//////////////////////////////////////////////////////////////////////////
 	// test fixture setup
 	//////////////////////////////////////////////////////////////////////////
 	void initialize();
+
 	void finalize();
+
 public:
 	virtual void setUp();
+
 	virtual void tearDown();
 };
+
 #if defined(gForceAllTests) || defined(gMemoryTestFixture)
+
 REGISTER_FIXTURE(MemoryTestFixture);
 #endif

+ 45 - 45
spine-c/spine-c-unit-tests/tests/SpineEventMonitor.cpp

@@ -1,83 +1,85 @@
-#include "SpineEventMonitor.h" 
+#include "SpineEventMonitor.h"
 
 #include "spine/spine.h"
 #include "KString.h"
 
 #include "KMemory.h" // Last include
 
-SpineEventMonitor::SpineEventMonitor(spAnimationState* _pAnimationState /*= nullptr*/)
-{
+SpineEventMonitor::SpineEventMonitor(spAnimationState *_pAnimationState /*= nullptr*/) {
 	bLogging = false;
 	RegisterListener(_pAnimationState);
 }
 
-SpineEventMonitor::~SpineEventMonitor()
-{
+SpineEventMonitor::~SpineEventMonitor() {
 	pAnimState = 0;
 }
 
-void SpineEventMonitor::RegisterListener(spAnimationState * _pAnimationState)
-{
+void SpineEventMonitor::RegisterListener(spAnimationState *_pAnimationState) {
 	if (_pAnimationState) {
 		_pAnimationState->rendererObject = this;
-		_pAnimationState->listener = (spAnimationStateListener)&SpineEventMonitor::spineAnimStateHandler;
+		_pAnimationState->listener = (spAnimationStateListener) &SpineEventMonitor::spineAnimStateHandler;
 	}
 	pAnimState = _pAnimationState;
 }
 
-bool SpineEventMonitor::isAnimationPlaying()
-{
-	if (pAnimState) 
+bool SpineEventMonitor::isAnimationPlaying() {
+	if (pAnimState)
 		return spAnimationState_getCurrent(pAnimState, 0) != 0;
 	return false;
 }
 
-void SpineEventMonitor::spineAnimStateHandler(spAnimationState * state, int type, spTrackEntry * entry, spEvent * event)
-{
+void SpineEventMonitor::spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event) {
 	if (state && state->rendererObject) {
-		SpineEventMonitor* pEventMonitor = (SpineEventMonitor*)state->rendererObject;
+		SpineEventMonitor *pEventMonitor = (SpineEventMonitor *) state->rendererObject;
 		pEventMonitor->OnSpineAnimationStateEvent(state, type, entry, event);
 	}
 }
 
-void SpineEventMonitor::OnSpineAnimationStateEvent(spAnimationState * state, int type, spTrackEntry * trackEntry, spEvent * event)
-{
-	const char* eventName = 0;
+void SpineEventMonitor::OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry,
+												   spEvent *event) {
+	const char *eventName = 0;
 	if (state == pAnimState) { // only monitor ours
-		switch(type)
-		{
-		case SP_ANIMATION_START: eventName = "SP_ANIMATION_START"; break;
-		case SP_ANIMATION_INTERRUPT: eventName = "SP_ANIMATION_INTERRUPT"; break;
-		case SP_ANIMATION_END: eventName = "SP_ANIMATION_END"; break;
-		case SP_ANIMATION_COMPLETE: eventName = "SP_ANIMATION_COMPLETE"; break;
-		case SP_ANIMATION_DISPOSE: eventName = "SP_ANIMATION_DISPOSE"; break;
-		case SP_ANIMATION_EVENT: eventName = "SP_ANIMATION_EVENT"; break;
-		default:
-			break;
+		switch (type) {
+			case SP_ANIMATION_START:
+				eventName = "SP_ANIMATION_START";
+				break;
+			case SP_ANIMATION_INTERRUPT:
+				eventName = "SP_ANIMATION_INTERRUPT";
+				break;
+			case SP_ANIMATION_END:
+				eventName = "SP_ANIMATION_END";
+				break;
+			case SP_ANIMATION_COMPLETE:
+				eventName = "SP_ANIMATION_COMPLETE";
+				break;
+			case SP_ANIMATION_DISPOSE:
+				eventName = "SP_ANIMATION_DISPOSE";
+				break;
+			case SP_ANIMATION_EVENT:
+				eventName = "SP_ANIMATION_EVENT";
+				break;
+			default:
+				break;
 		}
 
 		if (bLogging && eventName && trackEntry && trackEntry->animation && trackEntry->animation->name)
-			KOutputDebug(DEBUGLVL, "[%s : '%s']\n", eventName,  trackEntry->animation->name);//*/
+			KOutputDebug(DEBUGLVL, "[%s : '%s']\n", eventName, trackEntry->animation->name);//*/
 	}
 }
 
 
-
-InterruptMonitor::InterruptMonitor(spAnimationState * _pAnimationState):
-	SpineEventMonitor(_pAnimationState)
-{
+InterruptMonitor::InterruptMonitor(spAnimationState *_pAnimationState) :
+		SpineEventMonitor(_pAnimationState) {
 	bForceInterrupt = false;
 	mEventStackCursor = 0; // cursor used to track events
 }
 
-bool InterruptMonitor::isAnimationPlaying()
-{
+bool InterruptMonitor::isAnimationPlaying() {
 	return !bForceInterrupt && SpineEventMonitor::isAnimationPlaying();
 }
 
 // Stops the animation on any occurance of the spEventType
-InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType)
-{
+InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType) {
 	InterruptEvent ev;
 	ev.mEventType = theEventType;
 	mEventStack.push_back(ev);
@@ -85,8 +87,7 @@ InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType)
 }
 
 // Stops the animation when the [spEventType : 'animationName'] occurs
-InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType, const std::string & theAnimationName)
-{
+InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType, const std::string &theAnimationName) {
 	InterruptEvent ev;
 	ev.mEventType = theEventType;
 	ev.mAnimName = theAnimationName;
@@ -95,8 +96,7 @@ InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType, const st
 }
 
 // stops the first encounter of spEventType on the specified TrackEntry
-InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType, spTrackEntry * theTrackEntry)
-{
+InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType, spTrackEntry *theTrackEntry) {
 	InterruptEvent ev;
 	ev.mEventType = theEventType;
 	ev.mTrackEntry = theTrackEntry;
@@ -105,8 +105,7 @@ InterruptMonitor& InterruptMonitor::AddInterruptEvent(int theEventType, spTrackE
 }
 
 // Stops on the first SP_ANIMATION_EVENT with the string payload of 'theEventTriggerName'
-InterruptMonitor& InterruptMonitor::AddInterruptEventTrigger(const std::string & theEventTriggerName)
-{
+InterruptMonitor &InterruptMonitor::AddInterruptEventTrigger(const std::string &theEventTriggerName) {
 	InterruptEvent ev;
 	ev.mEventType = SP_ANIMATION_EVENT;
 	ev.mEventName = theEventTriggerName;
@@ -114,8 +113,8 @@ InterruptMonitor& InterruptMonitor::AddInterruptEventTrigger(const std::string &
 	return *this;
 }
 
-void InterruptMonitor::OnSpineAnimationStateEvent(spAnimationState * state, int type, spTrackEntry * trackEntry, spEvent * event)
-{
+void InterruptMonitor::OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry,
+												  spEvent *event) {
 	SpineEventMonitor::OnSpineAnimationStateEvent(state, type, trackEntry, event);
 
 	if (mEventStackCursor < mEventStack.size()) {
@@ -129,7 +128,8 @@ void InterruptMonitor::OnSpineAnimationStateEvent(spAnimationState * state, int
 	}
 }
 
-inline bool InterruptMonitor::InterruptEvent::matches(spAnimationState * state, int type, spTrackEntry * trackEntry, spEvent * event) {
+inline bool
+InterruptMonitor::InterruptEvent::matches(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event) {
 
 	// Must match spEventType {SP_ANIMATION_START, SP_ANIMATION_INTERRUPT, SP_ANIMATION_END, SP_ANIMATION_COMPLETE, SP_ANIMATION_DISPOSE, SP_ANIMATION_EVENT }
 	if (mEventType == type) {

+ 29 - 21
spine-c/spine-c-unit-tests/tests/SpineEventMonitor.h

@@ -4,7 +4,7 @@
 //	purpose:	Monitor spAnimationState Events
 /////////////////////////////////////////////////////////////////////
 
-#pragma once 
+#pragma once
 
 #include <vector>
 #include <string>
@@ -22,26 +22,29 @@ typedef struct spEvent spEvent;
 //
 //				Also allows for debug printing of Events to console.
 /////////////////////////////////////////////////////////////////////
-class SpineEventMonitor
-{
+class SpineEventMonitor {
 public:
-	SpineEventMonitor(spAnimationState* _pAnimationState = 0);
+	SpineEventMonitor(spAnimationState *_pAnimationState = 0);
+
 	virtual ~SpineEventMonitor();
 
-	void RegisterListener(spAnimationState* _pAnimationState);
+	void RegisterListener(spAnimationState *_pAnimationState);
 
 	void SetDebugLogging(bool val) { bLogging = val; }
+
 	bool GetDebugLogging() { return bLogging; }
 
 	virtual bool isAnimationPlaying();
 
 protected:
-	static void	spineAnimStateHandler(spAnimationState* state, int type, spTrackEntry* entry, spEvent* event);
-	virtual void OnSpineAnimationStateEvent(spAnimationState* state, int type, spTrackEntry* trackEntry, spEvent* event);
+	static void spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event);
+
+	virtual void
+	OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event);
 
 protected:
-	spAnimationState	*pAnimState;
-	bool				bLogging;
+	spAnimationState *pAnimState;
+	bool bLogging;
 };
 
 //////////////////////////////////////////////////////////////////////
@@ -51,40 +54,45 @@ protected:
 //				of an animation based on a specific sequence of
 //				events generated by the animation.
 /////////////////////////////////////////////////////////////////////
-class InterruptMonitor : public SpineEventMonitor
-{
+class InterruptMonitor : public SpineEventMonitor {
 private:
-	struct InterruptEvent
-	{
+	struct InterruptEvent {
 		InterruptEvent() {
 			mEventType = -1; // invalid
 			mTrackEntry = 0;
 		}
 
-		bool matches(spAnimationState* state, int type, spTrackEntry* trackEntry, spEvent* event);
+		bool matches(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event);
 
 		std::string mAnimName;
 		int mEventType;
-		spTrackEntry* mTrackEntry;
+		spTrackEntry *mTrackEntry;
 		std::string mEventName;
 	};
+
 	typedef std::vector<InterruptEvent> InterruptEventStack;
 
 
 public:
-	InterruptMonitor(spAnimationState* _pAnimationState = 0);
+	InterruptMonitor(spAnimationState *_pAnimationState = 0);
+
 	~InterruptMonitor() {}
 
 	virtual bool isAnimationPlaying() override;
 
 public:
-	InterruptMonitor& AddInterruptEvent(int theEventType);
-	InterruptMonitor& AddInterruptEvent(int theEventType, const std::string& theAnimationName);
-	InterruptMonitor& AddInterruptEvent(int theEventType, spTrackEntry* theTrackEntry);
-	InterruptMonitor& AddInterruptEventTrigger(const std::string& theEventTriggerName);
+	InterruptMonitor &AddInterruptEvent(int theEventType);
+
+	InterruptMonitor &AddInterruptEvent(int theEventType, const std::string &theAnimationName);
+
+	InterruptMonitor &AddInterruptEvent(int theEventType, spTrackEntry *theTrackEntry);
+
+	InterruptMonitor &AddInterruptEventTrigger(const std::string &theEventTriggerName);
 
 protected:
-	virtual void OnSpineAnimationStateEvent(spAnimationState* state, int type, spTrackEntry* trackEntry, spEvent* event) override;
+	virtual void
+	OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event) override;
+
 	virtual void OnMatchingComplete() {}
 
 protected:

+ 6 - 11
spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/CPP_InterfaceTestFixture.cpp

@@ -1,26 +1,21 @@
-#include "CPP_InterfaceTestFixture.h" 
+#include "CPP_InterfaceTestFixture.h"
 
-CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture()
-{
+CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture() {
 	finalize();
 }
 
-void CPP_InterfaceTestFixture::initialize()
-{
+void CPP_InterfaceTestFixture::initialize() {
 	// on a Per- Fixture Basis, before Test execution
 }
 
-void CPP_InterfaceTestFixture::finalize()
-{
+void CPP_InterfaceTestFixture::finalize() {
 	// on a Per- Fixture Basis, after all tests pass/fail
 }
 
-void CPP_InterfaceTestFixture::setUp()
-{
+void CPP_InterfaceTestFixture::setUp() {
 	// Setup on Per-Test Basis
 }
 
-void CPP_InterfaceTestFixture::tearDown()
-{
+void CPP_InterfaceTestFixture::tearDown() {
 	// Tear Down on Per-Test Basis
 }

+ 9 - 5
spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/CPP_InterfaceTestFixture.h

@@ -1,13 +1,13 @@
-#pragma once 
+#pragma once
+
 #include "MiniCppUnit.hxx"
 
-class CPP_InterfaceTestFixture : public TestFixture < CPP_InterfaceTestFixture >
-{
+class CPP_InterfaceTestFixture : public TestFixture<CPP_InterfaceTestFixture> {
 public:
 	TEST_FIXTURE(CPP_InterfaceTestFixture){
-		//TEST_CASE(parseJSON);
+			//TEST_CASE(parseJSON);
 
-		initialize();
+			initialize();
 	}
 
 	virtual ~CPP_InterfaceTestFixture();
@@ -22,9 +22,13 @@ public:
 	// test fixture setup
 	//////////////////////////////////////////////////////////////////////////
 	void initialize();
+
 	void finalize();
+
 public:
 	virtual void setUp();
+
 	virtual void tearDown();
 };
+
 REGISTER_FIXTURE(CPP_InterfaceTestFixture);

+ 6 - 11
spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/_TestFixture.cpp

@@ -1,26 +1,21 @@
-#include "[[FIXTURE_TYPE]].h" 
+#include "[[FIXTURE_TYPE]].h"
 
-[[FIXTURE_TYPE]]::~[[FIXTURE_TYPE]]()
-{
+[[FIXTURE_TYPE]]:: ~[[FIXTURE_TYPE]]() {
 	finalize();
 }
 
-void [[FIXTURE_TYPE]]::initialize()
-{
+void [[FIXTURE_TYPE]]::initialize() {
 	// on a Per- Fixture Basis, before Test execution
 }
 
-void [[FIXTURE_TYPE]]::finalize()
-{
+void [[FIXTURE_TYPE]]::finalize() {
 	// on a Per- Fixture Basis, after all tests pass/fail
 }
 
-void [[FIXTURE_TYPE]]::setUp()
-{
+void [[FIXTURE_TYPE]]::setUp() {
 	// Setup on Per-Test Basis
 }
 
-void [[FIXTURE_TYPE]]::tearDown()
-{
+void [[FIXTURE_TYPE]]::tearDown() {
 	// Tear Down on Per-Test Basis
 }

+ 27 - 18
spine-c/spine-c-unit-tests/tests/TestFixtureGenerator/_TestFixture.h

@@ -1,30 +1,39 @@
-#pragma once 
+#pragma once
+
 #include "MiniCppUnit.hxx"
 
-class [[FIXTURE_TYPE]] : public TestFixture < [[FIXTURE_TYPE]] >
+class [[FIXTURE_TYPE]] : public TestFixture< [[FIXTURE_TYPE]]
+
+>
 {
 public:
-	TEST_FIXTURE([[FIXTURE_TYPE]]){
-		//TEST_CASE(parseJSON);
+TEST_FIXTURE([[FIXTURE_TYPE]]){
+//TEST_CASE(parseJSON);
 
-		initialize();
-	}
+initialize();
 
-	virtual ~[[FIXTURE_TYPE]]();
+}
 
-	//////////////////////////////////////////////////////////////////////////
-	// Test Cases
-	//////////////////////////////////////////////////////////////////////////
+virtual ~[[FIXTURE_TYPE]]();
+
+//////////////////////////////////////////////////////////////////////////
+// Test Cases
+//////////////////////////////////////////////////////////////////////////
 public:
-	// void parseJSON();
+// void parseJSON();
+
+//////////////////////////////////////////////////////////////////////////
+// test fixture setup
+//////////////////////////////////////////////////////////////////////////
+void initialize();
+
+void finalize();
 
-	//////////////////////////////////////////////////////////////////////////
-	// test fixture setup
-	//////////////////////////////////////////////////////////////////////////
-	void initialize();
-	void finalize();
 public:
-	virtual void setUp();
-	virtual void tearDown();
+
+virtual void setUp();
+
+virtual void tearDown();
+
 };
 REGISTER_FIXTURE([[FIXTURE_TYPE]]);

+ 192 - 154
spine-c/spine-c/include/spine/Animation.h

@@ -46,14 +46,15 @@ struct spSkeleton;
 typedef uint64_t spPropertyId;
 
 _SP_ARRAY_DECLARE_TYPE(spPropertyIdArray, spPropertyId)
+
 _SP_ARRAY_DECLARE_TYPE(spTimelineArray, spTimeline*)
 
 typedef struct spAnimation {
-	const char* const name;
+	const char *const name;
 	float duration;
 
 	spTimelineArray *timelines;
-    spPropertyIdArray *timelineIds;
+	spPropertyIdArray *timelineIds;
 } spAnimation;
 
 typedef enum {
@@ -68,76 +69,82 @@ typedef enum {
 	SP_MIX_DIRECTION_OUT
 } spMixDirection;
 
-SP_API spAnimation* spAnimation_create (const char* name, spTimelineArray* timelines, float duration);
-SP_API void spAnimation_dispose (spAnimation* self);
-SP_API int /*bool*/ spAnimation_hasTimeline(spAnimation* self, spPropertyId* ids, int idsCount);
+SP_API spAnimation *spAnimation_create(const char *name, spTimelineArray *timelines, float duration);
+
+SP_API void spAnimation_dispose(spAnimation *self);
+
+SP_API int /*bool*/ spAnimation_hasTimeline(spAnimation *self, spPropertyId *ids, int idsCount);
 
 /** Poses the skeleton at the specified time for this animation.
  * @param lastTime The last time the animation was applied.
  * @param events Any triggered events are added. May be null.*/
-SP_API void spAnimation_apply (const spAnimation* self, struct spSkeleton* skeleton, float lastTime, float time, int loop,
-		spEvent** events, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
+SP_API void
+spAnimation_apply(const spAnimation *self, struct spSkeleton *skeleton, float lastTime, float time, int loop,
+				  spEvent **events, int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
 
 /**/
 typedef enum {
-    SP_TIMELINE_ATTACHMENT,
-    SP_TIMELINE_ALPHA,
-    SP_TIMELINE_PATHCONSTRAINTPOSITION,
-    SP_TIMELINE_PATHCONSTRAINTSPACING,
-    SP_TIMELINE_ROTATE,
-    SP_TIMELINE_SCALEX,
-    SP_TIMELINE_SCALEY,
-    SP_TIMELINE_SHEARX,
-    SP_TIMELINE_SHEARY,
-    SP_TIMELINE_TRANSLATEX,
-    SP_TIMELINE_TRANSLATEY,
-    SP_TIMELINE_SCALE,
-    SP_TIMELINE_SHEAR,
-    SP_TIMELINE_TRANSLATE,
-    SP_TIMELINE_DEFORM,
-    SP_TIMELINE_IKCONSTRAINT,
-    SP_TIMELINE_PATHCONSTRAINTMIX,
-    SP_TIMELINE_RGB2,
-    SP_TIMELINE_RGBA2,
-    SP_TIMELINE_RGBA,
-    SP_TIMELINE_RGB,
-    SP_TIMELINE_TRANSFORMCONSTRAINT,
-    SP_TIMELINE_DRAWORDER,
-    SP_TIMELINE_EVENT
+	SP_TIMELINE_ATTACHMENT,
+	SP_TIMELINE_ALPHA,
+	SP_TIMELINE_PATHCONSTRAINTPOSITION,
+	SP_TIMELINE_PATHCONSTRAINTSPACING,
+	SP_TIMELINE_ROTATE,
+	SP_TIMELINE_SCALEX,
+	SP_TIMELINE_SCALEY,
+	SP_TIMELINE_SHEARX,
+	SP_TIMELINE_SHEARY,
+	SP_TIMELINE_TRANSLATEX,
+	SP_TIMELINE_TRANSLATEY,
+	SP_TIMELINE_SCALE,
+	SP_TIMELINE_SHEAR,
+	SP_TIMELINE_TRANSLATE,
+	SP_TIMELINE_DEFORM,
+	SP_TIMELINE_IKCONSTRAINT,
+	SP_TIMELINE_PATHCONSTRAINTMIX,
+	SP_TIMELINE_RGB2,
+	SP_TIMELINE_RGBA2,
+	SP_TIMELINE_RGBA,
+	SP_TIMELINE_RGB,
+	SP_TIMELINE_TRANSFORMCONSTRAINT,
+	SP_TIMELINE_DRAWORDER,
+	SP_TIMELINE_EVENT
 } spTimelineType;
 
 /**/
 
 typedef enum {
-    SP_PROPERTY_ROTATE = 1 << 0,
-    SP_PROPERTY_X = 1 << 1,
-    SP_PROPERTY_Y = 1 << 2,
-    SP_PROPERTY_SCALEX = 1 << 3,
-    SP_PROPERTY_SCALEY = 1 << 4,
-    SP_PROPERTY_SHEARX = 1 << 5,
-    SP_PROPERTY_SHEARY = 1 << 6,
-    SP_PROPERTY_RGB = 1 << 7,
-    SP_PROPERTY_ALPHA = 1 << 8,
-    SP_PROPERTY_RGB2 = 1 << 9,
-    SP_PROPERTY_ATTACHMENT = 1 << 10,
-    SP_PROPERTY_DEFORM = 1 << 11,
-    SP_PROPERTY_EVENT = 1 << 12,
-    SP_PROPERTY_DRAWORDER = 1 << 13,
-    SP_PROPERTY_IKCONSTRAINT = 1 << 14,
-    SP_PROPERTY_TRANSFORMCONSTRAINT = 1 << 15,
-    SP_PROPERTY_PATHCONSTRAINT_POSITION = 1 << 16,
-    SP_PROPERTY_PATHCONSTRAINT_SPACING = 1 << 17,
-    SP_PROPERTY_PATHCONSTRAINT_MIX = 1 << 18
+	SP_PROPERTY_ROTATE = 1 << 0,
+	SP_PROPERTY_X = 1 << 1,
+	SP_PROPERTY_Y = 1 << 2,
+	SP_PROPERTY_SCALEX = 1 << 3,
+	SP_PROPERTY_SCALEY = 1 << 4,
+	SP_PROPERTY_SHEARX = 1 << 5,
+	SP_PROPERTY_SHEARY = 1 << 6,
+	SP_PROPERTY_RGB = 1 << 7,
+	SP_PROPERTY_ALPHA = 1 << 8,
+	SP_PROPERTY_RGB2 = 1 << 9,
+	SP_PROPERTY_ATTACHMENT = 1 << 10,
+	SP_PROPERTY_DEFORM = 1 << 11,
+	SP_PROPERTY_EVENT = 1 << 12,
+	SP_PROPERTY_DRAWORDER = 1 << 13,
+	SP_PROPERTY_IKCONSTRAINT = 1 << 14,
+	SP_PROPERTY_TRANSFORMCONSTRAINT = 1 << 15,
+	SP_PROPERTY_PATHCONSTRAINT_POSITION = 1 << 16,
+	SP_PROPERTY_PATHCONSTRAINT_SPACING = 1 << 17,
+	SP_PROPERTY_PATHCONSTRAINT_MIX = 1 << 18
 } spProperty;
 
 #define SP_MAX_PROPERTY_IDS 3
 
 typedef struct _spTimelineVtable {
-    void (*apply) (spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
-                   int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
-    void (*dispose) (spTimeline* self);
-    void (*setBezier) (spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
-                       float cx2, float cy2, float time2, float value2);
+	void (*apply)(spTimeline *self, struct spSkeleton *skeleton, float lastTime, float time, spEvent **firedEvents,
+				  int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
+
+	void (*dispose)(spTimeline *self);
+
+	void
+	(*setBezier)(spTimeline *self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
+				 float cx2, float cy2, float time2, float value2);
 } _spTimelineVtable;
 
 struct spTimeline {
@@ -150,251 +157,268 @@ struct spTimeline {
 	spTimelineType type;
 };
 
-SP_API void spTimeline_dispose (spTimeline* self);
-SP_API void spTimeline_apply (spTimeline* self, struct spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
-		int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
-SP_API void spTimeline_setBezier(spTimeline* self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2);
-SP_API float spTimeline_getDuration (const spTimeline* self);
+SP_API void spTimeline_dispose(spTimeline *self);
+
+SP_API void
+spTimeline_apply(spTimeline *self, struct spSkeleton *skeleton, float lastTime, float time, spEvent **firedEvents,
+				 int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
+
+SP_API void
+spTimeline_setBezier(spTimeline *self, int bezier, int frame, float value, float time1, float value1, float cx1,
+					 float cy1, float cx2, float cy2, float time2, float value2);
+
+SP_API float spTimeline_getDuration(const spTimeline *self);
 
 /**/
 
 typedef struct spCurveTimeline {
 	spTimeline super;
-	spFloatArray* curves; /* type, x, y, ... */
+	spFloatArray *curves; /* type, x, y, ... */
 } spCurveTimeline;
 
-SP_API void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex);
-SP_API void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex);
+SP_API void spCurveTimeline_setLinear(spCurveTimeline *self, int frameIndex);
+
+SP_API void spCurveTimeline_setStepped(spCurveTimeline *self, int frameIndex);
 
 /* Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
  * cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
  * the difference between the keyframe's values. */
-SP_API void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2);
-SP_API float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent);
+SP_API void spCurveTimeline_setCurve(spCurveTimeline *self, int frameIndex, float cx1, float cy1, float cx2, float cy2);
+
+SP_API float spCurveTimeline_getCurvePercent(const spCurveTimeline *self, int frameIndex, float percent);
 
 typedef struct spCurveTimeline spCurveTimeline1;
 
-SP_API void spCurveTimeline1_setFrame(spCurveTimeline1* self, int frame, float time, float value);
-SP_API float spCurveTimeline1_getCurveValue(spCurveTimeline1* self, float time);
+SP_API void spCurveTimeline1_setFrame(spCurveTimeline1 *self, int frame, float time, float value);
+
+SP_API float spCurveTimeline1_getCurveValue(spCurveTimeline1 *self, float time);
 
 typedef struct spCurveTimeline spCurveTimeline2;
 
-SP_API void spCurveTimeline2_setFrame(spCurveTimeline1* self, int frame, float time, float value1, float value2);
+SP_API void spCurveTimeline2_setFrame(spCurveTimeline1 *self, int frame, float time, float value1, float value2);
 
 /**/
 
 typedef struct spRotateTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spRotateTimeline;
 
-SP_API spRotateTimeline* spRotateTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spRotateTimeline *spRotateTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float angle);
+SP_API void spRotateTimeline_setFrame(spRotateTimeline *self, int frameIndex, float time, float angle);
 
 /**/
 
 typedef struct spTranslateTimeline {
-    spCurveTimeline2 super;
-    int boneIndex;
+	spCurveTimeline2 super;
+	int boneIndex;
 } spTranslateTimeline;
 
-SP_API spTranslateTimeline* spTranslateTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spTranslateTimeline *spTranslateTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y);
+SP_API void spTranslateTimeline_setFrame(spTranslateTimeline *self, int frameIndex, float time, float x, float y);
 
 /**/
 
 typedef struct spTranslateXTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spTranslateXTimeline;
 
-SP_API spTranslateXTimeline* spTranslateXTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spTranslateXTimeline *spTranslateXTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spTranslateXTimeline_setFrame (spTranslateXTimeline* self, int frame, float time, float x);
+SP_API void spTranslateXTimeline_setFrame(spTranslateXTimeline *self, int frame, float time, float x);
 
 /**/
 
 typedef struct spTranslateYTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spTranslateYTimeline;
 
-SP_API spTranslateYTimeline* spTranslateYTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spTranslateYTimeline *spTranslateYTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spTranslateYTimeline_setFrame (spTranslateYTimeline* self, int frame, float time, float y);
+SP_API void spTranslateYTimeline_setFrame(spTranslateYTimeline *self, int frame, float time, float y);
 
 /**/
 
 typedef struct spScaleTimeline {
-    spCurveTimeline2 super;
-    int boneIndex;
+	spCurveTimeline2 super;
+	int boneIndex;
 } spScaleTimeline;
 
-SP_API spScaleTimeline* spScaleTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spScaleTimeline *spScaleTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y);
+SP_API void spScaleTimeline_setFrame(spScaleTimeline *self, int frameIndex, float time, float x, float y);
 
 /**/
 
 typedef struct spScaleXTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spScaleXTimeline;
 
-SP_API spScaleXTimeline* spScaleXTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spScaleXTimeline *spScaleXTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spScaleXTimeline_setFrame (spScaleXTimeline* self, int frame, float time, float x);
+SP_API void spScaleXTimeline_setFrame(spScaleXTimeline *self, int frame, float time, float x);
 
 /**/
 
 typedef struct spScaleYTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spScaleYTimeline;
 
-SP_API spScaleYTimeline* spScaleYTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spScaleYTimeline *spScaleYTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spScaleYTimeline_setFrame (spScaleYTimeline* self, int frame, float time, float y);
+SP_API void spScaleYTimeline_setFrame(spScaleYTimeline *self, int frame, float time, float y);
 
 /**/
 
 typedef struct spShearTimeline {
-    spCurveTimeline2 super;
-    int boneIndex;
+	spCurveTimeline2 super;
+	int boneIndex;
 } spShearTimeline;
 
-SP_API spShearTimeline* spShearTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spShearTimeline *spShearTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y);
+SP_API void spShearTimeline_setFrame(spShearTimeline *self, int frameIndex, float time, float x, float y);
 
 /**/
 
 typedef struct spShearXTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spShearXTimeline;
 
-SP_API spShearXTimeline* spShearXTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spShearXTimeline *spShearXTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spShearXTimeline_setFrame (spShearXTimeline* self, int frame, float time, float x);
+SP_API void spShearXTimeline_setFrame(spShearXTimeline *self, int frame, float time, float x);
 
 /**/
 
 typedef struct spShearYTimeline {
-    spCurveTimeline1 super;
-    int boneIndex;
+	spCurveTimeline1 super;
+	int boneIndex;
 } spShearYTimeline;
 
-SP_API spShearYTimeline* spShearYTimeline_create (int frameCount, int bezierCount, int boneIndex);
+SP_API spShearYTimeline *spShearYTimeline_create(int frameCount, int bezierCount, int boneIndex);
 
-SP_API void spShearYTimeline_setFrame (spShearYTimeline* self, int frame, float time, float x);
+SP_API void spShearYTimeline_setFrame(spShearYTimeline *self, int frame, float time, float x);
 
 /**/
 
 typedef struct spRGBATimeline {
-    spCurveTimeline2 super;
-    int slotIndex;
+	spCurveTimeline2 super;
+	int slotIndex;
 } spRGBATimeline;
 
-SP_API spRGBATimeline* spRGBATimeline_create (int framesCount, int bezierCount, int slotIndex);
+SP_API spRGBATimeline *spRGBATimeline_create(int framesCount, int bezierCount, int slotIndex);
 
-SP_API void spRGBATimeline_setFrame (spRGBATimeline* self, int frameIndex, float time, float r, float g, float b, float a);
+SP_API void
+spRGBATimeline_setFrame(spRGBATimeline *self, int frameIndex, float time, float r, float g, float b, float a);
 
 /**/
 
 typedef struct spRGBTimeline {
-    spCurveTimeline2 super;
-    int slotIndex;
+	spCurveTimeline2 super;
+	int slotIndex;
 } spRGBTimeline;
 
-SP_API spRGBTimeline* spRGBTimeline_create (int framesCount, int bezierCount, int slotIndex);
+SP_API spRGBTimeline *spRGBTimeline_create(int framesCount, int bezierCount, int slotIndex);
 
-SP_API void spRGBTimeline_setFrame (spRGBTimeline* self, int frameIndex, float time, float r, float g, float b);
+SP_API void spRGBTimeline_setFrame(spRGBTimeline *self, int frameIndex, float time, float r, float g, float b);
 
 /**/
 
 typedef struct spAlphaTimeline {
-    spCurveTimeline1 super;
-    int slotIndex;
+	spCurveTimeline1 super;
+	int slotIndex;
 } spAlphaTimeline;
 
-SP_API spAlphaTimeline* spAlphaTimeline_create (int frameCount, int bezierCount, int slotIndex);
+SP_API spAlphaTimeline *spAlphaTimeline_create(int frameCount, int bezierCount, int slotIndex);
 
-SP_API void spAlphaTimeline_setFrame (spAlphaTimeline* self, int frame, float time, float x);
+SP_API void spAlphaTimeline_setFrame(spAlphaTimeline *self, int frame, float time, float x);
 
 /**/
 
 typedef struct spRGBA2Timeline {
-    spCurveTimeline super;
-    int slotIndex;
+	spCurveTimeline super;
+	int slotIndex;
 } spRGBA2Timeline;
 
-SP_API spRGBA2Timeline* spRGBA2Timeline_create (int framesCount, int bezierCount, int slotIndex);
+SP_API spRGBA2Timeline *spRGBA2Timeline_create(int framesCount, int bezierCount, int slotIndex);
 
-SP_API void spRGBA2Timeline_setFrame (spRGBA2Timeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2);
+SP_API void
+spRGBA2Timeline_setFrame(spRGBA2Timeline *self, int frameIndex, float time, float r, float g, float b, float a,
+						 float r2, float g2, float b2);
 
 /**/
 
 typedef struct spRGB2Timeline {
-    spCurveTimeline super;
-    int slotIndex;
+	spCurveTimeline super;
+	int slotIndex;
 } spRGB2Timeline;
 
-SP_API spRGB2Timeline* spRGB2Timeline_create (int framesCount, int bezierCount, int slotIndex);
+SP_API spRGB2Timeline *spRGB2Timeline_create(int framesCount, int bezierCount, int slotIndex);
 
-SP_API void spRGB2Timeline_setFrame (spRGB2Timeline* self, int frameIndex, float time, float r, float g, float b, float r2, float g2, float b2);
+SP_API void
+spRGB2Timeline_setFrame(spRGB2Timeline *self, int frameIndex, float time, float r, float g, float b, float r2, float g2,
+						float b2);
 
 /**/
 
 typedef struct spAttachmentTimeline {
 	spTimeline super;
 	int slotIndex;
-	const char** const attachmentNames;
+	const char **const attachmentNames;
 } spAttachmentTimeline;
 
-SP_API spAttachmentTimeline* spAttachmentTimeline_create (int framesCount, int SlotIndex);
+SP_API spAttachmentTimeline *spAttachmentTimeline_create(int framesCount, int SlotIndex);
 
 /* @param attachmentName May be 0. */
-SP_API void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName);
+SP_API void
+spAttachmentTimeline_setFrame(spAttachmentTimeline *self, int frameIndex, float time, const char *attachmentName);
 
 /**/
 
 typedef struct spDeformTimeline {
-    spCurveTimeline super;
-    int const frameVerticesCount;
-    const float** const frameVertices;
-    int slotIndex;
-    spAttachment* attachment;
+	spCurveTimeline super;
+	int const frameVerticesCount;
+	const float **const frameVertices;
+	int slotIndex;
+	spAttachment *attachment;
 } spDeformTimeline;
 
-SP_API spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount, int bezierCount, int slotIndex, spVertexAttachment* attachment);
+SP_API spDeformTimeline *
+spDeformTimeline_create(int framesCount, int frameVerticesCount, int bezierCount, int slotIndex,
+						spVertexAttachment *attachment);
 
-SP_API void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices);
+SP_API void spDeformTimeline_setFrame(spDeformTimeline *self, int frameIndex, float time, float *vertices);
 
 /**/
 
 typedef struct spEventTimeline {
 	spTimeline super;
-	spEvent** const events;
+	spEvent **const events;
 } spEventTimeline;
 
-SP_API spEventTimeline* spEventTimeline_create (int framesCount);
+SP_API spEventTimeline *spEventTimeline_create(int framesCount);
 
-SP_API void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event);
+SP_API void spEventTimeline_setFrame(spEventTimeline *self, int frameIndex, spEvent *event);
 
 /**/
 
 typedef struct spDrawOrderTimeline {
 	spTimeline super;
-	const int** const drawOrders;
+	const int **const drawOrders;
 	int const slotsCount;
 } spDrawOrderTimeline;
 
-SP_API spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount);
+SP_API spDrawOrderTimeline *spDrawOrderTimeline_create(int framesCount, int slotsCount);
 
-SP_API void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder);
+SP_API void spDrawOrderTimeline_setFrame(spDrawOrderTimeline *self, int frameIndex, float time, const int *drawOrder);
 
 /**/
 
@@ -403,9 +427,12 @@ typedef struct spIkConstraintTimeline {
 	int ikConstraintIndex;
 } spIkConstraintTimeline;
 
-SP_API spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount, int bezierCount, int transformConstraintIndex);
+SP_API spIkConstraintTimeline *
+spIkConstraintTimeline_create(int framesCount, int bezierCount, int transformConstraintIndex);
 
-SP_API void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, float softness, int bendDirection, int /*boolean*/ compress, int /**boolean**/ stretch);
+SP_API void
+spIkConstraintTimeline_setFrame(spIkConstraintTimeline *self, int frameIndex, float time, float mix, float softness,
+								int bendDirection, int /*boolean*/ compress, int /**boolean**/ stretch);
 
 /**/
 
@@ -414,9 +441,12 @@ typedef struct spTransformConstraintTimeline {
 	int transformConstraintIndex;
 } spTransformConstraintTimeline;
 
-SP_API spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount, int bezierCount, int ikConstraintIndex);
+SP_API spTransformConstraintTimeline *
+spTransformConstraintTimeline_create(int framesCount, int bezierCount, int transformConstraintIndex);
 
-SP_API void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float mixRotate, float mixX, float mixY, float mixScaleX, float mixScaleY, float mixShearY);
+SP_API void
+spTransformConstraintTimeline_setFrame(spTransformConstraintTimeline *self, int frameIndex, float time, float mixRotate,
+									   float mixX, float mixY, float mixScaleX, float mixScaleY, float mixShearY);
 
 /**/
 
@@ -425,9 +455,12 @@ typedef struct spPathConstraintPositionTimeline {
 	int pathConstraintIndex;
 } spPathConstraintPositionTimeline;
 
-SP_API spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount, int bezierCount, int pathConstraintIndex);
+SP_API spPathConstraintPositionTimeline *
+spPathConstraintPositionTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
 
-SP_API void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value);
+SP_API void
+spPathConstraintPositionTimeline_setFrame(spPathConstraintPositionTimeline *self, int frameIndex, float time,
+										  float value);
 
 /**/
 
@@ -436,9 +469,11 @@ typedef struct spPathConstraintSpacingTimeline {
 	int pathConstraintIndex;
 } spPathConstraintSpacingTimeline;
 
-SP_API spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount, int bezierCount, int pathConstraintIndex);
+SP_API spPathConstraintSpacingTimeline *
+spPathConstraintSpacingTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
 
-SP_API void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value);
+SP_API void spPathConstraintSpacingTimeline_setFrame(spPathConstraintSpacingTimeline *self, int frameIndex, float time,
+													 float value);
 
 /**/
 
@@ -447,9 +482,12 @@ typedef struct spPathConstraintMixTimeline {
 	int pathConstraintIndex;
 } spPathConstraintMixTimeline;
 
-SP_API spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount, int bezierCount, int pathConstraintIndex);
+SP_API spPathConstraintMixTimeline *
+spPathConstraintMixTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
 
-SP_API void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float mixRotate, float mixX, float mixY);
+SP_API void
+spPathConstraintMixTimeline_setFrame(spPathConstraintMixTimeline *self, int frameIndex, float time, float mixRotate,
+									 float mixX, float mixY);
 
 /**/
 

+ 57 - 38
spine-c/spine-c/include/spine/AnimationState.h

@@ -41,22 +41,28 @@ extern "C" {
 #endif
 
 typedef enum {
-	SP_ANIMATION_START, SP_ANIMATION_INTERRUPT, SP_ANIMATION_END, SP_ANIMATION_COMPLETE, SP_ANIMATION_DISPOSE, SP_ANIMATION_EVENT
+	SP_ANIMATION_START,
+	SP_ANIMATION_INTERRUPT,
+	SP_ANIMATION_END,
+	SP_ANIMATION_COMPLETE,
+	SP_ANIMATION_DISPOSE,
+	SP_ANIMATION_EVENT
 } spEventType;
 
 typedef struct spAnimationState spAnimationState;
 typedef struct spTrackEntry spTrackEntry;
 
-typedef void (*spAnimationStateListener) (spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event);
+typedef void (*spAnimationStateListener)(spAnimationState *state, spEventType type, spTrackEntry *entry,
+										 spEvent *event);
 
 _SP_ARRAY_DECLARE_TYPE(spTrackEntryArray, spTrackEntry*)
 
 struct spTrackEntry {
-	spAnimation* animation;
-	spTrackEntry* previous;
-	spTrackEntry* next;
-	spTrackEntry* mixingFrom;
-	spTrackEntry* mixingTo;
+	spAnimation *animation;
+	spTrackEntry *previous;
+	spTrackEntry *next;
+	spTrackEntry *mixingFrom;
+	spTrackEntry *mixingTo;
 	spAnimationStateListener listener;
 	int trackIndex;
 	int /*boolean*/ loop;
@@ -67,65 +73,78 @@ struct spTrackEntry {
 	float delay, trackTime, trackLast, nextTrackLast, trackEnd, timeScale;
 	float alpha, mixTime, mixDuration, interruptAlpha, totalAlpha;
 	spMixBlend mixBlend;
-	spIntArray* timelineMode;
-	spTrackEntryArray* timelineHoldMix;
-	float* timelinesRotation;
+	spIntArray *timelineMode;
+	spTrackEntryArray *timelineHoldMix;
+	float *timelinesRotation;
 	int timelinesRotationCount;
-	void* rendererObject;
-	void* userData;
+	void *rendererObject;
+	void *userData;
 };
 
 struct spAnimationState {
-	spAnimationStateData* const data;
+	spAnimationStateData *const data;
 
 	int tracksCount;
-	spTrackEntry** tracks;
+	spTrackEntry **tracks;
 
 	spAnimationStateListener listener;
 
 	float timeScale;
 
-	void* rendererObject;
-	void* userData;
+	void *rendererObject;
+	void *userData;
 
-    int unkeyedState;
+	int unkeyedState;
 };
 
 /* @param data May be 0 for no mixing. */
-SP_API spAnimationState* spAnimationState_create (spAnimationStateData* data);
-SP_API void spAnimationState_dispose (spAnimationState* self);
+SP_API spAnimationState *spAnimationState_create(spAnimationStateData *data);
 
-SP_API void spAnimationState_update (spAnimationState* self, float delta);
-SP_API int /**bool**/ spAnimationState_apply (spAnimationState* self, struct spSkeleton* skeleton);
+SP_API void spAnimationState_dispose(spAnimationState *self);
 
-SP_API void spAnimationState_clearTracks (spAnimationState* self);
-SP_API void spAnimationState_clearTrack (spAnimationState* self, int trackIndex);
+SP_API void spAnimationState_update(spAnimationState *self, float delta);
+
+SP_API int /**bool**/ spAnimationState_apply(spAnimationState *self, struct spSkeleton *skeleton);
+
+SP_API void spAnimationState_clearTracks(spAnimationState *self);
+
+SP_API void spAnimationState_clearTrack(spAnimationState *self, int trackIndex);
 
 /** Set the current animation. Any queued animations are cleared. */
-SP_API spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName,
-		int/*bool*/loop);
-SP_API spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop);
+SP_API spTrackEntry *
+spAnimationState_setAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
+									int/*bool*/loop);
+
+SP_API spTrackEntry *
+spAnimationState_setAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop);
 
 /** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix
  * duration. */
-SP_API spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName,
-		int/*bool*/loop, float delay);
-SP_API spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop,
-		float delay);
-SP_API spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration);
-SP_API spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay);
-SP_API void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration);
+SP_API spTrackEntry *
+spAnimationState_addAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
+									int/*bool*/loop, float delay);
+
+SP_API spTrackEntry *
+spAnimationState_addAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop,
+							  float delay);
+
+SP_API spTrackEntry *spAnimationState_setEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration);
+
+SP_API spTrackEntry *
+spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay);
+
+SP_API void spAnimationState_setEmptyAnimations(spAnimationState *self, float mixDuration);
 
-SP_API spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex);
+SP_API spTrackEntry *spAnimationState_getCurrent(spAnimationState *self, int trackIndex);
 
-SP_API void spAnimationState_clearListenerNotifications(spAnimationState* self);
+SP_API void spAnimationState_clearListenerNotifications(spAnimationState *self);
 
-SP_API float spTrackEntry_getAnimationTime (spTrackEntry* entry);
+SP_API float spTrackEntry_getAnimationTime(spTrackEntry *entry);
 
-SP_API float spTrackEntry_getTrackComplete(spTrackEntry* entry);
+SP_API float spTrackEntry_getTrackComplete(spTrackEntry *entry);
 
 /** Use this to dispose static memory before your app exits to appease your memory leak detector*/
-SP_API void spAnimationState_disposeStatics ();
+SP_API void spAnimationState_disposeStatics();
 
 #ifdef __cplusplus
 }

+ 10 - 7
spine-c/spine-c/include/spine/AnimationStateData.h

@@ -39,18 +39,21 @@ extern "C" {
 #endif
 
 typedef struct spAnimationStateData {
-	spSkeletonData* const skeletonData;
+	spSkeletonData *const skeletonData;
 	float defaultMix;
-	const void* const entries;
+	const void *const entries;
 } spAnimationStateData;
 
-SP_API spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData);
-SP_API void spAnimationStateData_dispose (spAnimationStateData* self);
+SP_API spAnimationStateData *spAnimationStateData_create(spSkeletonData *skeletonData);
 
-SP_API void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration);
-SP_API void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration);
+SP_API void spAnimationStateData_dispose(spAnimationStateData *self);
+
+SP_API void
+spAnimationStateData_setMixByName(spAnimationStateData *self, const char *fromName, const char *toName, float duration);
+
+SP_API void spAnimationStateData_setMix(spAnimationStateData *self, spAnimation *from, spAnimation *to, float duration);
 /* Returns 0 if there is no mixing between the animations. */
-SP_API float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to);
+SP_API float spAnimationStateData_getMix(spAnimationStateData *self, spAnimation *from, spAnimation *to);
 
 #ifdef __cplusplus
 }

+ 83 - 78
spine-c/spine-c/include/spine/Array.h

@@ -37,92 +37,97 @@ extern "C" {
 #endif
 
 #define _SP_ARRAY_DECLARE_TYPE(name, itemType) \
-	typedef struct name { int size; int capacity; itemType* items; } name; \
-	SP_API name* name##_create(int initialCapacity); \
-	SP_API void name##_dispose(name* self); \
-	SP_API void name##_clear(name* self); \
-	SP_API name* name##_setSize(name* self, int newSize); \
-	SP_API void name##_ensureCapacity(name* self, int newCapacity); \
-	SP_API void name##_add(name* self, itemType value); \
-	SP_API void name##_addAll(name* self, name* other); \
-	SP_API void name##_addAllValues(name* self, itemType* values, int offset, int count); \
-	SP_API void name##_removeAt(name* self, int index); \
-	SP_API int name##_contains(name* self, itemType value); \
-	SP_API itemType name##_pop(name* self); \
-	SP_API itemType name##_peek(name* self);
+    typedef struct name { int size; int capacity; itemType* items; } name; \
+    SP_API name* name##_create(int initialCapacity); \
+    SP_API void name##_dispose(name* self); \
+    SP_API void name##_clear(name* self); \
+    SP_API name* name##_setSize(name* self, int newSize); \
+    SP_API void name##_ensureCapacity(name* self, int newCapacity); \
+    SP_API void name##_add(name* self, itemType value); \
+    SP_API void name##_addAll(name* self, name* other); \
+    SP_API void name##_addAllValues(name* self, itemType* values, int offset, int count); \
+    SP_API void name##_removeAt(name* self, int index); \
+    SP_API int name##_contains(name* self, itemType value); \
+    SP_API itemType name##_pop(name* self); \
+    SP_API itemType name##_peek(name* self);
 
 #define _SP_ARRAY_IMPLEMENT_TYPE(name, itemType) \
-	name* name##_create(int initialCapacity) { \
-		name* array = CALLOC(name, 1); \
-		array->size = 0; \
-		array->capacity = initialCapacity; \
-		array->items = CALLOC(itemType, initialCapacity); \
-		return array; \
-	} \
-	void name##_dispose(name* self) { \
-		FREE(self->items); \
-		FREE(self); \
-	} \
-	void name##_clear(name* self) { \
-		self->size = 0; \
-	} \
-	name* name##_setSize(name* self, int newSize) { \
-		self->size = newSize; \
-		if (self->capacity < newSize) { \
-			self->capacity = MAX(8, (int)(self->size * 1.75f)); \
-			self->items = REALLOC(self->items, itemType, self->capacity); \
-		} \
-		return self; \
-	} \
-	void name##_ensureCapacity(name* self, int newCapacity) { \
-		if (self->capacity >= newCapacity) return; \
-		self->capacity = newCapacity; \
-		self->items = REALLOC(self->items, itemType, self->capacity); \
-	} \
-	void name##_add(name* self, itemType value) { \
-		if (self->size == self->capacity) { \
-			self->capacity = MAX(8, (int)(self->size * 1.75f)); \
-			self->items = REALLOC(self->items, itemType, self->capacity); \
-		} \
-		self->items[self->size++] = value; \
-	} \
-	void name##_addAll(name* self, name* other) { \
-		int i = 0; \
-		for (; i < other->size; i++) { \
-			name##_add(self, other->items[i]); \
-		} \
-	} \
-	void name##_addAllValues(name* self, itemType* values, int offset, int count) { \
-		int i = offset, n = offset + count; \
-		for (; i < n; i++) { \
-			name##_add(self, values[i]); \
-		} \
-	} \
-	void name##_removeAt(name* self, int index) { \
-		self->size--; \
-		memmove(self->items + index, self->items + index + 1, sizeof(itemType) * (self->size - index)); \
-	} \
-	int name##_contains(name* self, itemType value) { \
-		itemType* items = self->items; \
-		int i, n; \
-		for (i = 0, n = self->size; i < n; i++) { \
-			if (items[i] == value) return -1; \
-		} \
-		return 0; \
-	} \
-	itemType name##_pop(name* self) { \
-		itemType item = self->items[--self->size]; \
-		return item; \
-	} \
-	itemType name##_peek(name* self) { \
-		return self->items[self->size - 1]; \
-	}
+    name* name##_create(int initialCapacity) { \
+        name* array = CALLOC(name, 1); \
+        array->size = 0; \
+        array->capacity = initialCapacity; \
+        array->items = CALLOC(itemType, initialCapacity); \
+        return array; \
+    } \
+    void name##_dispose(name* self) { \
+        FREE(self->items); \
+        FREE(self); \
+    } \
+    void name##_clear(name* self) { \
+        self->size = 0; \
+    } \
+    name* name##_setSize(name* self, int newSize) { \
+        self->size = newSize; \
+        if (self->capacity < newSize) { \
+            self->capacity = MAX(8, (int)(self->size * 1.75f)); \
+            self->items = REALLOC(self->items, itemType, self->capacity); \
+        } \
+        return self; \
+    } \
+    void name##_ensureCapacity(name* self, int newCapacity) { \
+        if (self->capacity >= newCapacity) return; \
+        self->capacity = newCapacity; \
+        self->items = REALLOC(self->items, itemType, self->capacity); \
+    } \
+    void name##_add(name* self, itemType value) { \
+        if (self->size == self->capacity) { \
+            self->capacity = MAX(8, (int)(self->size * 1.75f)); \
+            self->items = REALLOC(self->items, itemType, self->capacity); \
+        } \
+        self->items[self->size++] = value; \
+    } \
+    void name##_addAll(name* self, name* other) { \
+        int i = 0; \
+        for (; i < other->size; i++) { \
+            name##_add(self, other->items[i]); \
+        } \
+    } \
+    void name##_addAllValues(name* self, itemType* values, int offset, int count) { \
+        int i = offset, n = offset + count; \
+        for (; i < n; i++) { \
+            name##_add(self, values[i]); \
+        } \
+    } \
+    void name##_removeAt(name* self, int index) { \
+        self->size--; \
+        memmove(self->items + index, self->items + index + 1, sizeof(itemType) * (self->size - index)); \
+    } \
+    int name##_contains(name* self, itemType value) { \
+        itemType* items = self->items; \
+        int i, n; \
+        for (i = 0, n = self->size; i < n; i++) { \
+            if (items[i] == value) return -1; \
+        } \
+        return 0; \
+    } \
+    itemType name##_pop(name* self) { \
+        itemType item = self->items[--self->size]; \
+        return item; \
+    } \
+    itemType name##_peek(name* self) { \
+        return self->items[self->size - 1]; \
+    }
 
 _SP_ARRAY_DECLARE_TYPE(spFloatArray, float)
+
 _SP_ARRAY_DECLARE_TYPE(spIntArray, int)
+
 _SP_ARRAY_DECLARE_TYPE(spShortArray, short)
+
 _SP_ARRAY_DECLARE_TYPE(spUnsignedShortArray, unsigned short)
+
 _SP_ARRAY_DECLARE_TYPE(spArrayFloatArray, spFloatArray*)
+
 _SP_ARRAY_DECLARE_TYPE(spArrayShortArray, spShortArray*)
 
 #ifdef __cplusplus

+ 25 - 22
spine-c/spine-c/include/spine/Atlas.h

@@ -69,68 +69,71 @@ typedef enum {
 
 typedef struct spAtlasPage spAtlasPage;
 struct spAtlasPage {
-	const spAtlas* atlas;
-	const char* name;
+	const spAtlas *atlas;
+	const char *name;
 	spAtlasFormat format;
 	spAtlasFilter minFilter, magFilter;
 	spAtlasWrap uWrap, vWrap;
 
-	void* rendererObject;
+	void *rendererObject;
 	int width, height;
 	int /*boolean*/ pma;
 
-	spAtlasPage* next;
+	spAtlasPage *next;
 };
 
-SP_API spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name);
-SP_API void spAtlasPage_dispose (spAtlasPage* self);
+SP_API spAtlasPage *spAtlasPage_create(spAtlas *atlas, const char *name);
+
+SP_API void spAtlasPage_dispose(spAtlasPage *self);
 
 /**/
 typedef struct spKeyValue {
-    char *name;
-    float values[5];
+	char *name;
+	float values[5];
 } spKeyValue;
 _SP_ARRAY_DECLARE_TYPE(spKeyValueArray, spKeyValue)
 
 /**/
 typedef struct spAtlasRegion spAtlasRegion;
 struct spAtlasRegion {
-	const char* name;
+	const char *name;
 	int x, y, width, height;
 	float u, v, u2, v2;
 	int offsetX, offsetY;
 	int originalWidth, originalHeight;
 	int index;
 	int degrees;
-	int* splits;
-	int* pads;
+	int *splits;
+	int *pads;
 	spKeyValueArray *keyValues;
 
-	spAtlasPage* page;
+	spAtlasPage *page;
 
-	spAtlasRegion* next;
+	spAtlasRegion *next;
 };
 
-SP_API spAtlasRegion* spAtlasRegion_create ();
-SP_API void spAtlasRegion_dispose (spAtlasRegion* self);
+SP_API spAtlasRegion *spAtlasRegion_create();
+
+SP_API void spAtlasRegion_dispose(spAtlasRegion *self);
 
 /**/
 
 struct spAtlas {
-	spAtlasPage* pages;
-	spAtlasRegion* regions;
+	spAtlasPage *pages;
+	spAtlasRegion *regions;
 
-	void* rendererObject;
+	void *rendererObject;
 };
 
 /* Image files referenced in the atlas file will be prefixed with dir. */
-SP_API spAtlas* spAtlas_create (const char* data, int length, const char* dir, void* rendererObject);
+SP_API spAtlas *spAtlas_create(const char *data, int length, const char *dir, void *rendererObject);
 /* Image files referenced in the atlas file will be prefixed with the directory containing the atlas file. */
-SP_API spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject);
-SP_API void spAtlas_dispose (spAtlas* atlas);
+SP_API spAtlas *spAtlas_createFromFile(const char *path, void *rendererObject);
+
+SP_API void spAtlas_dispose(spAtlas *atlas);
 
 /* Returns 0 if the region was not found. */
-SP_API spAtlasRegion* spAtlas_findRegion (const spAtlas* self, const char* name);
+SP_API spAtlasRegion *spAtlas_findRegion(const spAtlas *self, const char *name);
 
 #ifdef __cplusplus
 }

+ 2 - 2
spine-c/spine-c/include/spine/AtlasAttachmentLoader.h

@@ -40,10 +40,10 @@ extern "C" {
 
 typedef struct spAtlasAttachmentLoader {
 	spAttachmentLoader super;
-	spAtlas* atlas;
+	spAtlas *atlas;
 } spAtlasAttachmentLoader;
 
-SP_API spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas);
+SP_API spAtlasAttachmentLoader *spAtlasAttachmentLoader_create(spAtlas *atlas);
 
 #ifdef __cplusplus
 }

+ 5 - 5
spine-c/spine-c/include/spine/Attachment.h

@@ -49,16 +49,16 @@ typedef enum {
 } spAttachmentType;
 
 typedef struct spAttachment {
-	const char* const name;
+	const char *const name;
 	const spAttachmentType type;
-	const void* const vtable;
+	const void *const vtable;
 	int refCount;
-	struct spAttachmentLoader* attachmentLoader;
+	struct spAttachmentLoader *attachmentLoader;
 } spAttachment;
 
-void spAttachment_dispose (spAttachment* self);
+void spAttachment_dispose(spAttachment *self);
 
-spAttachment* spAttachment_copy (spAttachment* self);
+spAttachment *spAttachment_copy(spAttachment *self);
 
 #ifdef __cplusplus
 }

+ 9 - 8
spine-c/spine-c/include/spine/AttachmentLoader.h

@@ -39,22 +39,23 @@ extern "C" {
 #endif
 
 typedef struct spAttachmentLoader {
-	const char* error1;
-	const char* error2;
+	const char *error1;
+	const char *error2;
 
-	const void* const vtable;
+	const void *const vtable;
 } spAttachmentLoader;
 
-SP_API void spAttachmentLoader_dispose (spAttachmentLoader* self);
+SP_API void spAttachmentLoader_dispose(spAttachmentLoader *self);
 
 /* Called to create each attachment. Returns 0 to not load an attachment. If 0 is returned and _spAttachmentLoader_setError was
  * called, an error occurred. */
-SP_API spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name,
-		const char* path);
+SP_API spAttachment *
+spAttachmentLoader_createAttachment(spAttachmentLoader *self, spSkin *skin, spAttachmentType type, const char *name,
+									const char *path);
 /* Called after the attachment has been fully configured. */
-SP_API void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment);
+SP_API void spAttachmentLoader_configureAttachment(spAttachmentLoader *self, spAttachment *attachment);
 /* Called just before the attachment is disposed. This can release allocations made in spAttachmentLoader_configureAttachment. */
-SP_API void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment);
+SP_API void spAttachmentLoader_disposeAttachment(spAttachmentLoader *self, spAttachment *attachment);
 
 #ifdef __cplusplus
 }

+ 32 - 21
spine-c/spine-c/include/spine/Bone.h

@@ -41,11 +41,11 @@ struct spSkeleton;
 
 typedef struct spBone spBone;
 struct spBone {
-	spBoneData* const data;
-	struct spSkeleton* const skeleton;
-	spBone* const parent;
+	spBoneData *const data;
+	struct spSkeleton *const skeleton;
+	spBone *const parent;
 	int childrenCount;
-	spBone** const children;
+	spBone **const children;
 	float x, y, rotation, scaleX, scaleY, shearX, shearY;
 	float ax, ay, arotation, ascaleX, ascaleY, ashearX, ashearY;
 	int /*bool*/ appliedValid;
@@ -57,30 +57,41 @@ struct spBone {
 	int/*bool*/ active;
 };
 
-SP_API void spBone_setYDown (int/*bool*/yDown);
-SP_API int/*bool*/spBone_isYDown ();
+SP_API void spBone_setYDown(int/*bool*/yDown);
+
+SP_API int/*bool*/spBone_isYDown();
 
 /* @param parent May be 0. */
-SP_API spBone* spBone_create (spBoneData* data, struct spSkeleton* skeleton, spBone* parent);
-SP_API void spBone_dispose (spBone* self);
+SP_API spBone *spBone_create(spBoneData *data, struct spSkeleton *skeleton, spBone *parent);
+
+SP_API void spBone_dispose(spBone *self);
+
+SP_API void spBone_setToSetupPose(spBone *self);
+
+SP_API void spBone_updateWorldTransform(spBone *self);
+
+SP_API void spBone_updateWorldTransformWith(spBone *self, float x, float y, float rotation, float scaleX, float scaleY,
+											float shearX, float shearY);
+
+SP_API float spBone_getWorldRotationX(spBone *self);
+
+SP_API float spBone_getWorldRotationY(spBone *self);
+
+SP_API float spBone_getWorldScaleX(spBone *self);
+
+SP_API float spBone_getWorldScaleY(spBone *self);
+
+SP_API void spBone_updateAppliedTransform(spBone *self);
 
-SP_API void spBone_setToSetupPose (spBone* self);
+SP_API void spBone_worldToLocal(spBone *self, float worldX, float worldY, float *localX, float *localY);
 
-SP_API void spBone_updateWorldTransform (spBone* self);
-SP_API void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY);
+SP_API void spBone_localToWorld(spBone *self, float localX, float localY, float *worldX, float *worldY);
 
-SP_API float spBone_getWorldRotationX (spBone* self);
-SP_API float spBone_getWorldRotationY (spBone* self);
-SP_API float spBone_getWorldScaleX (spBone* self);
-SP_API float spBone_getWorldScaleY (spBone* self);
+SP_API float spBone_worldToLocalRotation(spBone *self, float worldRotation);
 
-SP_API void spBone_updateAppliedTransform (spBone* self);
+SP_API float spBone_localToWorldRotation(spBone *self, float localRotation);
 
-SP_API void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY);
-SP_API void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY);
-SP_API float spBone_worldToLocalRotation (spBone* self, float worldRotation);
-SP_API float spBone_localToWorldRotation (spBone* self, float localRotation);
-SP_API void spBone_rotateWorld (spBone* self, float degrees);
+SP_API void spBone_rotateWorld(spBone *self, float degrees);
 
 #ifdef __cplusplus
 }

+ 5 - 4
spine-c/spine-c/include/spine/BoneData.h

@@ -47,16 +47,17 @@ typedef enum {
 typedef struct spBoneData spBoneData;
 struct spBoneData {
 	const int index;
-	const char* const name;
-	spBoneData* const parent;
+	const char *const name;
+	spBoneData *const parent;
 	float length;
 	float x, y, rotation, scaleX, scaleY, shearX, shearY;
 	spTransformMode transformMode;
 	int/*bool*/ skinRequired;
 };
 
-SP_API spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent);
-SP_API void spBoneData_dispose (spBoneData* self);
+SP_API spBoneData *spBoneData_create(int index, const char *name, spBoneData *parent);
+
+SP_API void spBoneData_dispose(spBoneData *self);
 
 #ifdef __cplusplus
 }

+ 1 - 1
spine-c/spine-c/include/spine/BoundingBoxAttachment.h

@@ -44,7 +44,7 @@ typedef struct spBoundingBoxAttachment {
 	spVertexAttachment super;
 } spBoundingBoxAttachment;
 
-SP_API spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name);
+SP_API spBoundingBoxAttachment *spBoundingBoxAttachment_create(const char *name);
 
 #ifdef __cplusplus
 }

+ 4 - 3
spine-c/spine-c/include/spine/ClippingAttachment.h

@@ -42,11 +42,12 @@ extern "C" {
 
 typedef struct spClippingAttachment {
 	spVertexAttachment super;
-	spSlotData* endSlot;
+	spSlotData *endSlot;
 } spClippingAttachment;
 
-SP_API void _spClippingAttachment_dispose(spAttachment* self);
-SP_API spClippingAttachment* spClippingAttachment_create (const char* name);
+SP_API void _spClippingAttachment_dispose(spAttachment *self);
+
+SP_API spClippingAttachment *spClippingAttachment_create(const char *name);
 
 #ifdef __cplusplus
 }

+ 19 - 10
spine-c/spine-c/include/spine/Color.h

@@ -41,16 +41,25 @@ typedef struct spColor {
 } spColor;
 
 /* @param attachmentName May be 0 for no setup pose attachment. */
-SP_API spColor* spColor_create();
-SP_API void spColor_dispose(spColor* self);
-SP_API void spColor_setFromFloats(spColor* color, float r, float g, float b, float a);
-SP_API void spColor_setFromFloats3(spColor* self, float r, float g, float b);
-SP_API void spColor_setFromColor(spColor* color, spColor* otherColor);
-SP_API void spColor_setFromColor3(spColor* self, spColor* otherColor);
-SP_API void spColor_addFloats(spColor* color, float r, float g, float b, float a);
-SP_API void spColor_addFloats3(spColor* color, float r, float g, float b);
-SP_API void spColor_addColor(spColor* color, spColor* otherColor);
-SP_API void spColor_clamp(spColor* color);
+SP_API spColor *spColor_create();
+
+SP_API void spColor_dispose(spColor *self);
+
+SP_API void spColor_setFromFloats(spColor *color, float r, float g, float b, float a);
+
+SP_API void spColor_setFromFloats3(spColor *self, float r, float g, float b);
+
+SP_API void spColor_setFromColor(spColor *color, spColor *otherColor);
+
+SP_API void spColor_setFromColor3(spColor *self, spColor *otherColor);
+
+SP_API void spColor_addFloats(spColor *color, float r, float g, float b, float a);
+
+SP_API void spColor_addFloats3(spColor *color, float r, float g, float b);
+
+SP_API void spColor_addColor(spColor *color, spColor *otherColor);
+
+SP_API void spColor_clamp(spColor *color);
 
 #ifdef __cplusplus
 }

+ 16 - 9
spine-c/spine-c/include/spine/Debug.h

@@ -36,15 +36,22 @@
 extern "C" {
 #endif
 
-void spDebug_printSkeletonData(spSkeletonData* skeletonData);
-void spDebug_printAnimation(spAnimation* animation);
-void spDebug_printTimeline(spTimeline* timeline);
-void spDebug_printBoneDatas(spBoneData** boneDatas, int numBoneDatas);
-void spDebug_printBoneData(spBoneData* boneData);
-
-void spDebug_printSkeleton(spSkeleton* skeleton);
-void spDebug_printBones(spBone** bones, int numBones);
-void spDebug_printBone(spBone* bone);
+void spDebug_printSkeletonData(spSkeletonData *skeletonData);
+
+void spDebug_printAnimation(spAnimation *animation);
+
+void spDebug_printTimeline(spTimeline *timeline);
+
+void spDebug_printBoneDatas(spBoneData **boneDatas, int numBoneDatas);
+
+void spDebug_printBoneData(spBoneData *boneData);
+
+void spDebug_printSkeleton(spSkeleton *skeleton);
+
+void spDebug_printBones(spBone **bones, int numBones);
+
+void spDebug_printBone(spBone *bone);
+
 void spDebug_printFloats(float *values, int numFloats);
 
 #ifdef __cplusplus

+ 5 - 4
spine-c/spine-c/include/spine/Event.h

@@ -38,11 +38,11 @@ extern "C" {
 #endif
 
 typedef struct spEvent {
-	spEventData* const data;
+	spEventData *const data;
 	float const time;
 	int intValue;
 	float floatValue;
-	const char* stringValue;
+	const char *stringValue;
 	float volume;
 	float balance;
 
@@ -59,8 +59,9 @@ typedef struct spEvent {
 #endif
 } spEvent;
 
-SP_API spEvent* spEvent_create (float time, spEventData* data);
-SP_API void spEvent_dispose (spEvent* self);
+SP_API spEvent *spEvent_create(float time, spEventData *data);
+
+SP_API void spEvent_dispose(spEvent *self);
 
 #ifdef __cplusplus
 }

+ 6 - 5
spine-c/spine-c/include/spine/EventData.h

@@ -37,17 +37,18 @@ extern "C" {
 #endif
 
 typedef struct spEventData {
-	const char* const name;
+	const char *const name;
 	int intValue;
 	float floatValue;
-	const char* stringValue;
-	const char* audioPath;
+	const char *stringValue;
+	const char *audioPath;
 	float volume;
 	float balance;
 } spEventData;
 
-SP_API spEventData* spEventData_create (const char* name);
-SP_API void spEventData_dispose (spEventData* self);
+SP_API spEventData *spEventData_create(const char *name);
+
+SP_API void spEventData_dispose(spEventData *self);
 
 #ifdef __cplusplus
 }

+ 13 - 8
spine-c/spine-c/include/spine/IkConstraint.h

@@ -41,12 +41,12 @@ extern "C" {
 struct spSkeleton;
 
 typedef struct spIkConstraint {
-	spIkConstraintData* const data;
+	spIkConstraintData *const data;
 
 	int bonesCount;
-	spBone** bones;
+	spBone **bones;
 
-	spBone* target;
+	spBone *target;
 	int bendDirection;
 	int /*boolean*/ compress;
 	int /*boolean*/ stretch;
@@ -56,13 +56,18 @@ typedef struct spIkConstraint {
 	int /*boolean*/ active;
 } spIkConstraint;
 
-SP_API spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton);
-SP_API void spIkConstraint_dispose (spIkConstraint* self);
+SP_API spIkConstraint *spIkConstraint_create(spIkConstraintData *data, const struct spSkeleton *skeleton);
 
-SP_API void spIkConstraint_update (spIkConstraint* self);
+SP_API void spIkConstraint_dispose(spIkConstraint *self);
 
-SP_API void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch, int /*boolean*/ uniform, float alpha);
-SP_API void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDirection, int /*boolean*/ stretch, float softness, float alpha);
+SP_API void spIkConstraint_update(spIkConstraint *self);
+
+SP_API void
+spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch,
+					  int /*boolean*/ uniform, float alpha);
+
+SP_API void spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float targetY, int bendDirection,
+								  int /*boolean*/ stretch, float softness, float alpha);
 
 #ifdef __cplusplus
 }

+ 6 - 5
spine-c/spine-c/include/spine/IkConstraintData.h

@@ -38,13 +38,13 @@ extern "C" {
 #endif
 
 typedef struct spIkConstraintData {
-	const char* const name;
+	const char *const name;
 	int order;
 	int /*boolean*/ skinRequired;
 	int bonesCount;
-	spBoneData** bones;
+	spBoneData **bones;
 
-	spBoneData* target;
+	spBoneData *target;
 	int bendDirection;
 	int /*boolean*/ compress;
 	int /*boolean*/ stretch;
@@ -53,8 +53,9 @@ typedef struct spIkConstraintData {
 	float softness;
 } spIkConstraintData;
 
-SP_API spIkConstraintData* spIkConstraintData_create (const char* name);
-SP_API void spIkConstraintData_dispose (spIkConstraintData* self);
+SP_API spIkConstraintData *spIkConstraintData_create(const char *name);
+
+SP_API void spIkConstraintData_dispose(spIkConstraintData *self);
 
 #ifdef __cplusplus
 }

+ 14 - 11
spine-c/spine-c/include/spine/MeshAttachment.h

@@ -44,37 +44,40 @@ typedef struct spMeshAttachment spMeshAttachment;
 struct spMeshAttachment {
 	spVertexAttachment super;
 
-	void* rendererObject;
+	void *rendererObject;
 	int regionOffsetX, regionOffsetY; /* Pixels stripped from the bottom left, unrotated. */
 	int regionWidth, regionHeight; /* Unrotated, stripped pixel size. */
 	int regionOriginalWidth, regionOriginalHeight; /* Unrotated, unstripped pixel size. */
 	float regionU, regionV, regionU2, regionV2;
 	int regionDegrees;
 
-	const char* path;
+	const char *path;
 
-	float* regionUVs;
-	float* uvs;
+	float *regionUVs;
+	float *uvs;
 
 	int trianglesCount;
-	unsigned short* triangles;
+	unsigned short *triangles;
 
 	spColor color;
 
 	int hullLength;
 
-	spMeshAttachment* const parentMesh;
+	spMeshAttachment *const parentMesh;
 
 	/* Nonessential. */
 	int edgesCount;
-	int* edges;
+	int *edges;
 	float width, height;
 };
 
-SP_API spMeshAttachment* spMeshAttachment_create (const char* name);
-SP_API void spMeshAttachment_updateUVs (spMeshAttachment* self);
-SP_API void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh);
-SP_API spMeshAttachment* spMeshAttachment_newLinkedMesh (spMeshAttachment* self);
+SP_API spMeshAttachment *spMeshAttachment_create(const char *name);
+
+SP_API void spMeshAttachment_updateUVs(spMeshAttachment *self);
+
+SP_API void spMeshAttachment_setParentMesh(spMeshAttachment *self, spMeshAttachment *parentMesh);
+
+SP_API spMeshAttachment *spMeshAttachment_newLinkedMesh(spMeshAttachment *self);
 
 #ifdef __cplusplus
 }

+ 2 - 2
spine-c/spine-c/include/spine/PathAttachment.h

@@ -43,11 +43,11 @@ extern "C" {
 typedef struct spPathAttachment {
 	spVertexAttachment super;
 	int lengthsLength;
-	float* lengths;
+	float *lengths;
 	int/*bool*/ closed, constantSpeed;
 } spPathAttachment;
 
-SP_API spPathAttachment* spPathAttachment_create (const char* name);
+SP_API spPathAttachment *spPathAttachment_create(const char *name);
 
 #ifdef __cplusplus
 }

+ 15 - 12
spine-c/spine-c/include/spine/PathConstraint.h

@@ -43,27 +43,27 @@ extern "C" {
 struct spSkeleton;
 
 typedef struct spPathConstraint {
-	spPathConstraintData* const data;
+	spPathConstraintData *const data;
 	int bonesCount;
-	spBone** const bones;
-	spSlot* target;
+	spBone **const bones;
+	spSlot *target;
 	float position, spacing;
 	float mixRotate, mixX, mixY;
 
 	int spacesCount;
-	float* spaces;
+	float *spaces;
 
 	int positionsCount;
-	float* positions;
+	float *positions;
 
 	int worldCount;
-	float* world;
+	float *world;
 
 	int curvesCount;
-	float* curves;
+	float *curves;
 
 	int lengthsCount;
-	float* lengths;
+	float *lengths;
 
 	float segments[10];
 
@@ -72,11 +72,14 @@ typedef struct spPathConstraint {
 
 #define SP_PATHCONSTRAINT_
 
-SP_API spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const struct spSkeleton* skeleton);
-SP_API void spPathConstraint_dispose (spPathConstraint* self);
+SP_API spPathConstraint *spPathConstraint_create(spPathConstraintData *data, const struct spSkeleton *skeleton);
 
-SP_API void spPathConstraint_update (spPathConstraint* self);
-SP_API float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents);
+SP_API void spPathConstraint_dispose(spPathConstraint *self);
+
+SP_API void spPathConstraint_update(spPathConstraint *self);
+
+SP_API float *spPathConstraint_computeWorldPositions(spPathConstraint *self, spPathAttachment *path, int spacesCount,
+													 int/*bool*/ tangents);
 
 #ifdef __cplusplus
 }

+ 6 - 5
spine-c/spine-c/include/spine/PathConstraintData.h

@@ -51,12 +51,12 @@ typedef enum {
 } spRotateMode;
 
 typedef struct spPathConstraintData {
-	const char* const name;
+	const char *const name;
 	int order;
 	int/*bool*/ skinRequired;
 	int bonesCount;
-	spBoneData** const bones;
-	spSlotData* target;
+	spBoneData **const bones;
+	spSlotData *target;
 	spPositionMode positionMode;
 	spSpacingMode spacingMode;
 	spRotateMode rotateMode;
@@ -65,8 +65,9 @@ typedef struct spPathConstraintData {
 	float mixRotate, mixX, mixY;
 } spPathConstraintData;
 
-SP_API spPathConstraintData* spPathConstraintData_create (const char* name);
-SP_API void spPathConstraintData_dispose (spPathConstraintData* self);
+SP_API spPathConstraintData *spPathConstraintData_create(const char *name);
+
+SP_API void spPathConstraintData_dispose(spPathConstraintData *self);
 
 #ifdef __cplusplus
 }

+ 5 - 3
spine-c/spine-c/include/spine/PointAttachment.h

@@ -46,9 +46,11 @@ typedef struct spPointAttachment {
 	spColor color;
 } spPointAttachment;
 
-SP_API spPointAttachment* spPointAttachment_create (const char* name);
-SP_API void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y);
-SP_API float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone);
+SP_API spPointAttachment *spPointAttachment_create(const char *name);
+
+SP_API void spPointAttachment_computeWorldPosition(spPointAttachment *self, spBone *bone, float *x, float *y);
+
+SP_API float spPointAttachment_computeWorldRotation(spPointAttachment *self, spBone *bone);
 
 #ifdef __cplusplus
 }

+ 10 - 6
spine-c/spine-c/include/spine/RegionAttachment.h

@@ -41,11 +41,11 @@ extern "C" {
 
 typedef struct spRegionAttachment {
 	spAttachment super;
-	const char* path;
+	const char *path;
 	float x, y, scaleX, scaleY, rotation, width, height;
 	spColor color;
 
-	void* rendererObject;
+	void *rendererObject;
 	int regionOffsetX, regionOffsetY; /* Pixels stripped from the bottom left, unrotated. */
 	int regionWidth, regionHeight; /* Unrotated, stripped pixel size. */
 	int regionOriginalWidth, regionOriginalHeight; /* Unrotated, unstripped pixel size. */
@@ -54,10 +54,14 @@ typedef struct spRegionAttachment {
 	float uvs[8];
 } spRegionAttachment;
 
-SP_API spRegionAttachment* spRegionAttachment_create (const char* name);
-SP_API void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, float degrees);
-SP_API void spRegionAttachment_updateOffset (spRegionAttachment* self);
-SP_API void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride);
+SP_API spRegionAttachment *spRegionAttachment_create(const char *name);
+
+SP_API void spRegionAttachment_setUVs(spRegionAttachment *self, float u, float v, float u2, float v2, float degrees);
+
+SP_API void spRegionAttachment_updateOffset(spRegionAttachment *self);
+
+SP_API void spRegionAttachment_computeWorldVertices(spRegionAttachment *self, spBone *bone, float *vertices, int offset,
+													int stride);
 
 #ifdef __cplusplus
 }

+ 34 - 29
spine-c/spine-c/include/spine/Skeleton.h

@@ -43,83 +43,88 @@ extern "C" {
 #endif
 
 typedef struct spSkeleton {
-	spSkeletonData* const data;
+	spSkeletonData *const data;
 
 	int bonesCount;
-	spBone** bones;
-	spBone* const root;
+	spBone **bones;
+	spBone *const root;
 
 	int slotsCount;
-	spSlot** slots;
-	spSlot** drawOrder;
+	spSlot **slots;
+	spSlot **drawOrder;
 
 	int ikConstraintsCount;
-	spIkConstraint** ikConstraints;
+	spIkConstraint **ikConstraints;
 
 	int transformConstraintsCount;
-	spTransformConstraint** transformConstraints;
+	spTransformConstraint **transformConstraints;
 
 	int pathConstraintsCount;
-	spPathConstraint** pathConstraints;
+	spPathConstraint **pathConstraints;
 
-	spSkin* const skin;
+	spSkin *const skin;
 	spColor color;
 	float time;
 	float scaleX, scaleY;
 	float x, y;
 } spSkeleton;
 
-SP_API spSkeleton* spSkeleton_create (spSkeletonData* data);
-SP_API void spSkeleton_dispose (spSkeleton* self);
+SP_API spSkeleton *spSkeleton_create(spSkeletonData *data);
+
+SP_API void spSkeleton_dispose(spSkeleton *self);
 
 /* Caches information about bones and constraints. Must be called if bones or constraints, or weighted path attachments
  * are added or removed. */
-SP_API void spSkeleton_updateCache (spSkeleton* self);
-SP_API void spSkeleton_updateWorldTransform (const spSkeleton* self);
+SP_API void spSkeleton_updateCache(spSkeleton *self);
+
+SP_API void spSkeleton_updateWorldTransform(const spSkeleton *self);
 
 /* Sets the bones, constraints, and slots to their setup pose values. */
-SP_API void spSkeleton_setToSetupPose (const spSkeleton* self);
+SP_API void spSkeleton_setToSetupPose(const spSkeleton *self);
 /* Sets the bones and constraints to their setup pose values. */
-SP_API void spSkeleton_setBonesToSetupPose (const spSkeleton* self);
-SP_API void spSkeleton_setSlotsToSetupPose (const spSkeleton* self);
+SP_API void spSkeleton_setBonesToSetupPose(const spSkeleton *self);
+
+SP_API void spSkeleton_setSlotsToSetupPose(const spSkeleton *self);
 
 /* Returns 0 if the bone was not found. */
-SP_API spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName);
+SP_API spBone *spSkeleton_findBone(const spSkeleton *self, const char *boneName);
 /* Returns -1 if the bone was not found. */
-SP_API int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName);
+SP_API int spSkeleton_findBoneIndex(const spSkeleton *self, const char *boneName);
 
 /* Returns 0 if the slot was not found. */
-SP_API spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName);
+SP_API spSlot *spSkeleton_findSlot(const spSkeleton *self, const char *slotName);
 /* Returns -1 if the slot was not found. */
-SP_API int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName);
+SP_API int spSkeleton_findSlotIndex(const spSkeleton *self, const char *slotName);
 
 /* Sets the skin used to look up attachments before looking in the SkeletonData defaultSkin. Attachments from the new skin are
  * attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode
  * attachment is attached from the new skin.
  * @param skin May be 0.*/
-SP_API void spSkeleton_setSkin (spSkeleton* self, spSkin* skin);
+SP_API void spSkeleton_setSkin(spSkeleton *self, spSkin *skin);
 /* Returns 0 if the skin was not found. See spSkeleton_setSkin.
  * @param skinName May be 0. */
-SP_API int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName);
+SP_API int spSkeleton_setSkinByName(spSkeleton *self, const char *skinName);
 
 /* Returns 0 if the slot or attachment was not found. */
-SP_API spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName);
+SP_API spAttachment *
+spSkeleton_getAttachmentForSlotName(const spSkeleton *self, const char *slotName, const char *attachmentName);
 /* Returns 0 if the slot or attachment was not found. */
-SP_API spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName);
+SP_API spAttachment *
+spSkeleton_getAttachmentForSlotIndex(const spSkeleton *self, int slotIndex, const char *attachmentName);
 /* Returns 0 if the slot or attachment was not found.
  * @param attachmentName May be 0. */
-SP_API int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName);
+SP_API int spSkeleton_setAttachment(spSkeleton *self, const char *slotName, const char *attachmentName);
 
 /* Returns 0 if the IK constraint was not found. */
-SP_API spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName);
+SP_API spIkConstraint *spSkeleton_findIkConstraint(const spSkeleton *self, const char *constraintName);
 
 /* Returns 0 if the transform constraint was not found. */
-SP_API spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName);
+SP_API spTransformConstraint *spSkeleton_findTransformConstraint(const spSkeleton *self, const char *constraintName);
 
 /* Returns 0 if the path constraint was not found. */
-SP_API spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName);
+SP_API spPathConstraint *spSkeleton_findPathConstraint(const spSkeleton *self, const char *constraintName);
 
-SP_API void spSkeleton_update (spSkeleton* self, float deltaTime);
+SP_API void spSkeleton_update(spSkeleton *self, float deltaTime);
 
 #ifdef __cplusplus
 }

+ 11 - 7
spine-c/spine-c/include/spine/SkeletonBinary.h

@@ -44,16 +44,20 @@ struct spAtlasAttachmentLoader;
 
 typedef struct spSkeletonBinary {
 	float scale;
-	spAttachmentLoader* attachmentLoader;
-	const char* const error;
+	spAttachmentLoader *attachmentLoader;
+	const char *const error;
 } spSkeletonBinary;
 
-SP_API spSkeletonBinary* spSkeletonBinary_createWithLoader (spAttachmentLoader* attachmentLoader);
-SP_API spSkeletonBinary* spSkeletonBinary_create (spAtlas* atlas);
-SP_API void spSkeletonBinary_dispose (spSkeletonBinary* self);
+SP_API spSkeletonBinary *spSkeletonBinary_createWithLoader(spAttachmentLoader *attachmentLoader);
 
-SP_API spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, const int length);
-SP_API spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path);
+SP_API spSkeletonBinary *spSkeletonBinary_create(spAtlas *atlas);
+
+SP_API void spSkeletonBinary_dispose(spSkeletonBinary *self);
+
+SP_API spSkeletonData *
+spSkeletonBinary_readSkeletonData(spSkeletonBinary *self, const unsigned char *binary, const int length);
+
+SP_API spSkeletonData *spSkeletonBinary_readSkeletonDataFile(spSkeletonBinary *self, const char *path);
 
 #ifdef __cplusplus
 }

+ 22 - 16
spine-c/spine-c/include/spine/SkeletonBounds.h

@@ -39,50 +39,56 @@ extern "C" {
 #endif
 
 typedef struct spPolygon {
-	float* const vertices;
+	float *const vertices;
 	int count;
 	int capacity;
 } spPolygon;
 
-SP_API spPolygon* spPolygon_create (int capacity);
-SP_API void spPolygon_dispose (spPolygon* self);
+SP_API spPolygon *spPolygon_create(int capacity);
 
-SP_API int/*bool*/spPolygon_containsPoint (spPolygon* polygon, float x, float y);
-SP_API int/*bool*/spPolygon_intersectsSegment (spPolygon* polygon, float x1, float y1, float x2, float y2);
+SP_API void spPolygon_dispose(spPolygon *self);
+
+SP_API int/*bool*/spPolygon_containsPoint(spPolygon *polygon, float x, float y);
+
+SP_API int/*bool*/spPolygon_intersectsSegment(spPolygon *polygon, float x1, float y1, float x2, float y2);
 
 /**/
 
 typedef struct spSkeletonBounds {
 	int count;
-	spBoundingBoxAttachment** boundingBoxes;
-	spPolygon** polygons;
+	spBoundingBoxAttachment **boundingBoxes;
+	spPolygon **polygons;
 
 	float minX, minY, maxX, maxY;
 } spSkeletonBounds;
 
-SP_API spSkeletonBounds* spSkeletonBounds_create ();
-SP_API void spSkeletonBounds_dispose (spSkeletonBounds* self);
-SP_API void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb);
+SP_API spSkeletonBounds *spSkeletonBounds_create();
+
+SP_API void spSkeletonBounds_dispose(spSkeletonBounds *self);
+
+SP_API void spSkeletonBounds_update(spSkeletonBounds *self, spSkeleton *skeleton, int/*bool*/updateAabb);
 
 /** Returns true if the axis aligned bounding box contains the point. */
-SP_API int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y);
+SP_API int/*bool*/spSkeletonBounds_aabbContainsPoint(spSkeletonBounds *self, float x, float y);
 
 /** Returns true if the axis aligned bounding box intersects the line segment. */
-SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2);
+SP_API int/*bool*/
+spSkeletonBounds_aabbIntersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2);
 
 /** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
-SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds);
+SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton(spSkeletonBounds *self, spSkeletonBounds *bounds);
 
 /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
  * efficient to only call this method if spSkeletonBounds_aabbContainsPoint returns true. */
-SP_API spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y);
+SP_API spBoundingBoxAttachment *spSkeletonBounds_containsPoint(spSkeletonBounds *self, float x, float y);
 
 /** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
  * more efficient to only call this method if spSkeletonBounds_aabbIntersectsSegment returns true. */
-SP_API spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2);
+SP_API spBoundingBoxAttachment *
+spSkeletonBounds_intersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2);
 
 /** Returns the polygon for the specified bounding box, or null. */
-SP_API spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox);
+SP_API spPolygon *spSkeletonBounds_getPolygon(spSkeletonBounds *self, spBoundingBoxAttachment *boundingBox);
 
 #ifdef __cplusplus
 }

+ 23 - 16
spine-c/spine-c/include/spine/SkeletonClipping.h

@@ -41,24 +41,31 @@ extern "C" {
 #endif
 
 typedef struct spSkeletonClipping {
-	spTriangulator* triangulator;
-	spFloatArray* clippingPolygon;
-	spFloatArray* clipOutput;
-	spFloatArray* clippedVertices;
-	spFloatArray* clippedUVs;
-	spUnsignedShortArray* clippedTriangles;
-	spFloatArray* scratch;
-	spClippingAttachment* clipAttachment;
-	spArrayFloatArray* clippingPolygons;
+	spTriangulator *triangulator;
+	spFloatArray *clippingPolygon;
+	spFloatArray *clipOutput;
+	spFloatArray *clippedVertices;
+	spFloatArray *clippedUVs;
+	spUnsignedShortArray *clippedTriangles;
+	spFloatArray *scratch;
+	spClippingAttachment *clipAttachment;
+	spArrayFloatArray *clippingPolygons;
 } spSkeletonClipping;
 
-SP_API spSkeletonClipping* spSkeletonClipping_create();
-SP_API int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip);
-SP_API void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot);
-SP_API void spSkeletonClipping_clipEnd2(spSkeletonClipping* self);
-SP_API int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self);
-SP_API void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride);
-SP_API void spSkeletonClipping_dispose(spSkeletonClipping* self);
+SP_API spSkeletonClipping *spSkeletonClipping_create();
+
+SP_API int spSkeletonClipping_clipStart(spSkeletonClipping *self, spSlot *slot, spClippingAttachment *clip);
+
+SP_API void spSkeletonClipping_clipEnd(spSkeletonClipping *self, spSlot *slot);
+
+SP_API void spSkeletonClipping_clipEnd2(spSkeletonClipping *self);
+
+SP_API int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping *self);
+
+SP_API void spSkeletonClipping_clipTriangles(spSkeletonClipping *self, float *vertices, int verticesLength,
+											 unsigned short *triangles, int trianglesLength, float *uvs, int stride);
+
+SP_API void spSkeletonClipping_dispose(spSkeletonClipping *self);
 
 #ifdef __cplusplus
 }

+ 31 - 27
spine-c/spine-c/include/spine/SkeletonData.h

@@ -45,65 +45,69 @@ extern "C" {
 #endif
 
 typedef struct spSkeletonData {
-	const char* version;
-	const char* hash;
+	const char *version;
+	const char *hash;
 	float x, y, width, height;
 
 	int stringsCount;
-	char** strings;
+	char **strings;
 
 	int bonesCount;
-	spBoneData** bones;
+	spBoneData **bones;
 
 	int slotsCount;
-	spSlotData** slots;
+	spSlotData **slots;
 
 	int skinsCount;
-	spSkin** skins;
-	spSkin* defaultSkin;
+	spSkin **skins;
+	spSkin *defaultSkin;
 
 	int eventsCount;
-	spEventData** events;
+	spEventData **events;
 
 	int animationsCount;
-	spAnimation** animations;
+	spAnimation **animations;
 
 	int ikConstraintsCount;
-	spIkConstraintData** ikConstraints;
+	spIkConstraintData **ikConstraints;
 
 	int transformConstraintsCount;
-	spTransformConstraintData** transformConstraints;
+	spTransformConstraintData **transformConstraints;
 
 	int pathConstraintsCount;
-	spPathConstraintData** pathConstraints;
+	spPathConstraintData **pathConstraints;
 } spSkeletonData;
 
-SP_API spSkeletonData* spSkeletonData_create ();
-SP_API void spSkeletonData_dispose (spSkeletonData* self);
+SP_API spSkeletonData *spSkeletonData_create();
 
-SP_API spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName);
-SP_API int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName);
+SP_API void spSkeletonData_dispose(spSkeletonData *self);
 
-SP_API spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName);
-SP_API int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName);
+SP_API spBoneData *spSkeletonData_findBone(const spSkeletonData *self, const char *boneName);
 
-SP_API spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName);
+SP_API int spSkeletonData_findBoneIndex(const spSkeletonData *self, const char *boneName);
 
-SP_API spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName);
+SP_API spSlotData *spSkeletonData_findSlot(const spSkeletonData *self, const char *slotName);
 
-SP_API spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName);
+SP_API int spSkeletonData_findSlotIndex(const spSkeletonData *self, const char *slotName);
 
-SP_API spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName);
+SP_API spSkin *spSkeletonData_findSkin(const spSkeletonData *self, const char *skinName);
 
-SP_API int spSkeletonData_findIkConstraintIndex (const spSkeletonData* self, const char* constraintName);
+SP_API spEventData *spSkeletonData_findEvent(const spSkeletonData *self, const char *eventName);
 
-SP_API spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName);
+SP_API spAnimation *spSkeletonData_findAnimation(const spSkeletonData *self, const char *animationName);
 
-SP_API int spSkeletonData_findTransformConstraintIndex (const spSkeletonData* self, const char* constraintName);
+SP_API spIkConstraintData *spSkeletonData_findIkConstraint(const spSkeletonData *self, const char *constraintName);
 
-SP_API spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName);
+SP_API int spSkeletonData_findIkConstraintIndex(const spSkeletonData *self, const char *constraintName);
 
-SP_API int spSkeletonData_findPathConstraintIndex (const spSkeletonData* self, const char* constraintName);
+SP_API spTransformConstraintData *
+spSkeletonData_findTransformConstraint(const spSkeletonData *self, const char *constraintName);
+
+SP_API int spSkeletonData_findTransformConstraintIndex(const spSkeletonData *self, const char *constraintName);
+
+SP_API spPathConstraintData *spSkeletonData_findPathConstraint(const spSkeletonData *self, const char *constraintName);
+
+SP_API int spSkeletonData_findPathConstraintIndex(const spSkeletonData *self, const char *constraintName);
 
 #ifdef __cplusplus
 }

+ 10 - 7
spine-c/spine-c/include/spine/SkeletonJson.h

@@ -45,16 +45,19 @@ struct spAtlasAttachmentLoader;
 
 typedef struct spSkeletonJson {
 	float scale;
-	spAttachmentLoader* attachmentLoader;
-	const char* const error;
+	spAttachmentLoader *attachmentLoader;
+	const char *const error;
 } spSkeletonJson;
 
-SP_API spSkeletonJson* spSkeletonJson_createWithLoader (spAttachmentLoader* attachmentLoader);
-SP_API spSkeletonJson* spSkeletonJson_create (spAtlas* atlas);
-SP_API void spSkeletonJson_dispose (spSkeletonJson* self);
+SP_API spSkeletonJson *spSkeletonJson_createWithLoader(spAttachmentLoader *attachmentLoader);
 
-SP_API spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json);
-SP_API spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path);
+SP_API spSkeletonJson *spSkeletonJson_create(spAtlas *atlas);
+
+SP_API void spSkeletonJson_dispose(spSkeletonJson *self);
+
+SP_API spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char *json);
+
+SP_API spSkeletonData *spSkeletonJson_readSkeletonDataFile(spSkeletonJson *self, const char *path);
 
 #ifdef __cplusplus
 }

+ 26 - 22
spine-c/spine-c/include/spine/Skin.h

@@ -47,17 +47,20 @@ extern "C" {
 struct spSkeleton;
 
 _SP_ARRAY_DECLARE_TYPE(spBoneDataArray, spBoneData*)
+
 _SP_ARRAY_DECLARE_TYPE(spIkConstraintDataArray, spIkConstraintData*)
+
 _SP_ARRAY_DECLARE_TYPE(spTransformConstraintDataArray, spTransformConstraintData*)
+
 _SP_ARRAY_DECLARE_TYPE(spPathConstraintDataArray, spPathConstraintData*)
 
 typedef struct spSkin {
-	const char* const name;
+	const char *const name;
 
-	spBoneDataArray* bones;
-	spIkConstraintDataArray* ikConstraints;
-	spTransformConstraintDataArray* transformConstraints;
-	spPathConstraintDataArray* pathConstraints;
+	spBoneDataArray *bones;
+	spIkConstraintDataArray *ikConstraints;
+	spTransformConstraintDataArray *transformConstraints;
+	spPathConstraintDataArray *pathConstraints;
 } spSkin;
 
 /* Private structs, needed by Skeleton */
@@ -65,48 +68,49 @@ typedef struct _Entry _Entry;
 typedef struct _Entry spSkinEntry;
 struct _Entry {
 	int slotIndex;
-	const char* name;
-	spAttachment* attachment;
-	_Entry* next;
+	const char *name;
+	spAttachment *attachment;
+	_Entry *next;
 };
 
 typedef struct _SkinHashTableEntry _SkinHashTableEntry;
 struct _SkinHashTableEntry {
-	_Entry* entry;
-	_SkinHashTableEntry* next;
+	_Entry *entry;
+	_SkinHashTableEntry *next;
 };
 
 typedef struct {
 	spSkin super;
-	_Entry* entries; /* entries list stored for getting attachment name by attachment index */
-	_SkinHashTableEntry* entriesHashTable[SKIN_ENTRIES_HASH_TABLE_SIZE]; /* hashtable for fast attachment lookup */
+	_Entry *entries; /* entries list stored for getting attachment name by attachment index */
+	_SkinHashTableEntry *entriesHashTable[SKIN_ENTRIES_HASH_TABLE_SIZE]; /* hashtable for fast attachment lookup */
 } _spSkin;
 
-SP_API spSkin* spSkin_create (const char* name);
-SP_API void spSkin_dispose (spSkin* self);
+SP_API spSkin *spSkin_create(const char *name);
+
+SP_API void spSkin_dispose(spSkin *self);
 
 /* The Skin owns the attachment. */
-SP_API void spSkin_setAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment);
+SP_API void spSkin_setAttachment(spSkin *self, int slotIndex, const char *name, spAttachment *attachment);
 /* Returns 0 if the attachment was not found. */
-SP_API spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name);
+SP_API spAttachment *spSkin_getAttachment(const spSkin *self, int slotIndex, const char *name);
 
 /* Returns 0 if the slot or attachment was not found. */
-SP_API const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex);
+SP_API const char *spSkin_getAttachmentName(const spSkin *self, int slotIndex, int attachmentIndex);
 
 /** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */
-SP_API void spSkin_attachAll (const spSkin* self, struct spSkeleton* skeleton, const spSkin* oldspSkin);
+SP_API void spSkin_attachAll(const spSkin *self, struct spSkeleton *skeleton, const spSkin *oldspSkin);
 
 /** Adds all attachments, bones, and constraints from the specified skin to this skin. */
-SP_API void spSkin_addSkin(spSkin* self, const spSkin* other);
+SP_API void spSkin_addSkin(spSkin *self, const spSkin *other);
 
 /** Adds all attachments, bones, and constraints from the specified skin to this skin. Attachments are deep copied. */
-SP_API void spSkin_copySkin(spSkin* self, const spSkin* other);
+SP_API void spSkin_copySkin(spSkin *self, const spSkin *other);
 
 /** Returns all attachments in this skin. */
-SP_API spSkinEntry* spSkin_getAttachments(const spSkin* self);
+SP_API spSkinEntry *spSkin_getAttachments(const spSkin *self);
 
 /** Clears all attachments, bones, and constraints. */
-SP_API void spSkin_clear(spSkin* self);
+SP_API void spSkin_clear(spSkin *self);
 
 #ifdef __cplusplus
 }

+ 13 - 11
spine-c/spine-c/include/spine/Slot.h

@@ -40,28 +40,30 @@ extern "C" {
 #endif
 
 typedef struct spSlot {
-	spSlotData* const data;
-	spBone* const bone;
+	spSlotData *const data;
+	spBone *const bone;
 	spColor color;
-	spColor* darkColor;
-	spAttachment* attachment;
+	spColor *darkColor;
+	spAttachment *attachment;
 	int attachmentState;
 
 	int deformCapacity;
 	int deformCount;
-	float* deform;
+	float *deform;
 } spSlot;
 
-SP_API spSlot* spSlot_create (spSlotData* data, spBone* bone);
-SP_API void spSlot_dispose (spSlot* self);
+SP_API spSlot *spSlot_create(spSlotData *data, spBone *bone);
+
+SP_API void spSlot_dispose(spSlot *self);
 
 /* @param attachment May be 0 to clear the attachment for the slot. */
-SP_API void spSlot_setAttachment (spSlot* self, spAttachment* attachment);
+SP_API void spSlot_setAttachment(spSlot *self, spAttachment *attachment);
+
+SP_API void spSlot_setAttachmentTime(spSlot *self, float time);
 
-SP_API void spSlot_setAttachmentTime (spSlot* self, float time);
-SP_API float spSlot_getAttachmentTime (const spSlot* self);
+SP_API float spSlot_getAttachmentTime(const spSlot *self);
 
-SP_API void spSlot_setToSetupPose (spSlot* self);
+SP_API void spSlot_setToSetupPose(spSlot *self);
 
 #ifdef __cplusplus
 }

+ 8 - 7
spine-c/spine-c/include/spine/SlotData.h

@@ -44,19 +44,20 @@ typedef enum {
 
 typedef struct spSlotData {
 	const int index;
-	const char* const name;
-	const spBoneData* const boneData;
-	const char* attachmentName;
+	const char *const name;
+	const spBoneData *const boneData;
+	const char *attachmentName;
 	spColor color;
-	spColor* darkColor;
+	spColor *darkColor;
 	spBlendMode blendMode;
 } spSlotData;
 
-SP_API spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData);
-SP_API void spSlotData_dispose (spSlotData* self);
+SP_API spSlotData *spSlotData_create(const int index, const char *name, spBoneData *boneData);
+
+SP_API void spSlotData_dispose(spSlotData *self);
 
 /* @param attachmentName May be 0 for no setup pose attachment. */
-SP_API void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName);
+SP_API void spSlotData_setAttachmentName(spSlotData *self, const char *attachmentName);
 
 #ifdef __cplusplus
 }

+ 8 - 6
spine-c/spine-c/include/spine/TransformConstraint.h

@@ -41,18 +41,20 @@ extern "C" {
 struct spSkeleton;
 
 typedef struct spTransformConstraint {
-	spTransformConstraintData* const data;
+	spTransformConstraintData *const data;
 	int bonesCount;
-	spBone** const bones;
-	spBone* target;
+	spBone **const bones;
+	spBone *target;
 	float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY;
 	int /*boolean*/ active;
 } spTransformConstraint;
 
-SP_API spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const struct spSkeleton* skeleton);
-SP_API void spTransformConstraint_dispose (spTransformConstraint* self);
+SP_API spTransformConstraint *
+spTransformConstraint_create(spTransformConstraintData *data, const struct spSkeleton *skeleton);
 
-SP_API void spTransformConstraint_update (spTransformConstraint* self);
+SP_API void spTransformConstraint_dispose(spTransformConstraint *self);
+
+SP_API void spTransformConstraint_update(spTransformConstraint *self);
 
 #ifdef __cplusplus
 }

+ 7 - 6
spine-c/spine-c/include/spine/TransformConstraintData.h

@@ -38,20 +38,21 @@ extern "C" {
 #endif
 
 typedef struct spTransformConstraintData {
-	const char* const name;
+	const char *const name;
 	int order;
 	int/*bool*/ skinRequired;
 	int bonesCount;
-	spBoneData** const bones;
-	spBoneData* target;
-    float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY;
+	spBoneData **const bones;
+	spBoneData *target;
+	float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY;
 	float offsetRotation, offsetX, offsetY, offsetScaleX, offsetScaleY, offsetShearY;
 	int /*boolean*/ relative;
 	int /*boolean*/ local;
 } spTransformConstraintData;
 
-SP_API spTransformConstraintData* spTransformConstraintData_create (const char* name);
-SP_API void spTransformConstraintData_dispose (spTransformConstraintData* self);
+SP_API spTransformConstraintData *spTransformConstraintData_create(const char *name);
+
+SP_API void spTransformConstraintData_dispose(spTransformConstraintData *self);
 
 #ifdef __cplusplus
 }

+ 15 - 11
spine-c/spine-c/include/spine/Triangulator.h

@@ -38,21 +38,25 @@ extern "C" {
 #endif
 
 typedef struct spTriangulator {
-	spArrayFloatArray* convexPolygons;
-	spArrayShortArray* convexPolygonsIndices;
+	spArrayFloatArray *convexPolygons;
+	spArrayShortArray *convexPolygonsIndices;
 
-	spShortArray* indicesArray;
-	spIntArray* isConcaveArray;
-	spShortArray* triangles;
+	spShortArray *indicesArray;
+	spIntArray *isConcaveArray;
+	spShortArray *triangles;
 
-	spArrayFloatArray* polygonPool;
-	spArrayShortArray* polygonIndicesPool;
+	spArrayFloatArray *polygonPool;
+	spArrayShortArray *polygonIndicesPool;
 } spTriangulator;
 
-SP_API spTriangulator* spTriangulator_create();
-SP_API spShortArray* spTriangulator_triangulate(spTriangulator* self, spFloatArray* verticesArray);
-SP_API spArrayFloatArray* spTriangulator_decompose(spTriangulator* self, spFloatArray* verticesArray, spShortArray* triangles);
-SP_API void spTriangulator_dispose(spTriangulator* self);
+SP_API spTriangulator *spTriangulator_create();
+
+SP_API spShortArray *spTriangulator_triangulate(spTriangulator *self, spFloatArray *verticesArray);
+
+SP_API spArrayFloatArray *
+spTriangulator_decompose(spTriangulator *self, spFloatArray *verticesArray, spShortArray *triangles);
+
+SP_API void spTriangulator_dispose(spTriangulator *self);
 
 
 #ifdef __cplusplus

+ 6 - 5
spine-c/spine-c/include/spine/VertexAttachment.h

@@ -43,21 +43,22 @@ struct spVertexAttachment {
 	spAttachment super;
 
 	int bonesCount;
-	int* bones;
+	int *bones;
 
 	int verticesCount;
-	float* vertices;
+	float *vertices;
 
 	int worldVerticesLength;
 
-	spVertexAttachment* deformAttachment;
+	spVertexAttachment *deformAttachment;
 
 	int id;
 };
 
-SP_API void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, spSlot* slot, int start, int count, float* worldVertices, int offset, int stride);
+SP_API void spVertexAttachment_computeWorldVertices(spVertexAttachment *self, spSlot *slot, int start, int count,
+													float *worldVertices, int offset, int stride);
 
-void spVertexAttachment_copyTo(spVertexAttachment* self, spVertexAttachment* other);
+void spVertexAttachment_copyTo(spVertexAttachment *self, spVertexAttachment *other);
 
 #ifdef __cplusplus
 }

+ 1 - 1
spine-c/spine-c/include/spine/VertexEffect.h

@@ -43,7 +43,7 @@ struct spVertexEffect;
 typedef void (*spVertexEffectBegin)(struct spVertexEffect *self, spSkeleton *skeleton);
 
 typedef void (*spVertexEffectTransform)(struct spVertexEffect *self, float *x, float *y, float *u, float *v,
-	spColor *light, spColor *dark);
+										spColor *light, spColor *dark);
 
 typedef void (*spVertexEffectEnd)(struct spVertexEffect *self);
 

+ 69 - 47
spine-c/spine-c/include/spine/extension.h

@@ -67,31 +67,31 @@
 #endif
 
 /* All allocation uses these. */
-#define MALLOC(TYPE,COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
-#define CALLOC(TYPE,COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
-#define REALLOC(PTR,TYPE,COUNT) ((TYPE*)_spRealloc(PTR, sizeof(TYPE) * (COUNT)))
+#define MALLOC(TYPE, COUNT) ((TYPE*)_spMalloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
+#define CALLOC(TYPE, COUNT) ((TYPE*)_spCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
+#define REALLOC(PTR, TYPE, COUNT) ((TYPE*)_spRealloc(PTR, sizeof(TYPE) * (COUNT)))
 #define NEW(TYPE) CALLOC(TYPE,1)
 
 /* Gets the direct super class. Type safe. */
 #define SUPER(VALUE) (&VALUE->super)
 
 /* Cast to a super class. Not type safe, use with care. Prefer SUPER() where possible. */
-#define SUPER_CAST(TYPE,VALUE) ((TYPE*)VALUE)
+#define SUPER_CAST(TYPE, VALUE) ((TYPE*)VALUE)
 
 /* Cast to a sub class. Not type safe, use with care. */
-#define SUB_CAST(TYPE,VALUE) ((TYPE*)VALUE)
+#define SUB_CAST(TYPE, VALUE) ((TYPE*)VALUE)
 
 /* Casts away const. Can be used as an lvalue. Not type safe, use with care. */
-#define CONST_CAST(TYPE,VALUE) (*(TYPE*)&VALUE)
+#define CONST_CAST(TYPE, VALUE) (*(TYPE*)&VALUE)
 
 /* Gets the vtable for the specified type. Not type safe, use with care. */
-#define VTABLE(TYPE,VALUE) ((_##TYPE##Vtable*)((TYPE*)VALUE)->vtable)
+#define VTABLE(TYPE, VALUE) ((_##TYPE##Vtable*)((TYPE*)VALUE)->vtable)
 
 /* Frees memory. Can be used on const types. */
 #define FREE(VALUE) _spFree((void*)VALUE)
 
 /* Allocates a new char[], assigns it to TO, and copies FROM to it. Can be used on const types. */
-#define MALLOC_STR(TO,FROM) strcpy(CONST_CAST(char*, TO) = (char*)MALLOC(char, strlen(FROM) + 1), FROM)
+#define MALLOC_STR(TO, FROM) strcpy(CONST_CAST(char*, TO) = (char*)MALLOC(char, strlen(FROM) + 1), FROM)
 
 #define PI 3.1415926535897932385f
 #define PI2 (PI * 2)
@@ -111,13 +111,13 @@
 #define POW(A,B) pow(A, B)
 #define ISNAN(A) (int)isnan(A)
 #else
-#define FMOD(A,B) (float)fmod(A, B)
-#define ATAN2(A,B) (float)atan2(A, B)
+#define FMOD(A, B) (float)fmod(A, B)
+#define ATAN2(A, B) (float)atan2(A, B)
 #define COS(A) (float)cos(A)
 #define SIN(A) (float)sin(A)
 #define SQRT(A) (float)sqrt(A)
 #define ACOS(A) (float)acos(A)
-#define POW(A,B) (float)pow(A, B)
+#define POW(A, B) (float)pow(A, B)
 #define ISNAN(A) (int)isnan(A)
 #endif
 
@@ -157,52 +157,67 @@ extern "C" {
  * Functions that must be implemented:
  */
 
-void _spAtlasPage_createTexture (spAtlasPage* self, const char* path);
-void _spAtlasPage_disposeTexture (spAtlasPage* self);
-char* _spUtil_readFile (const char* path, int* length);
+void _spAtlasPage_createTexture(spAtlasPage *self, const char *path);
+
+void _spAtlasPage_disposeTexture(spAtlasPage *self);
+
+char *_spUtil_readFile(const char *path, int *length);
 
 /*
  * Internal API available for extension:
  */
 
-void* _spMalloc (size_t size, const char* file, int line);
-void* _spCalloc (size_t num, size_t size, const char* file, int line);
-void* _spRealloc(void* ptr, size_t size);
-void _spFree (void* ptr);
-float _spRandom ();
+void *_spMalloc(size_t size, const char *file, int line);
+
+void *_spCalloc(size_t num, size_t size, const char *file, int line);
+
+void *_spRealloc(void *ptr, size_t size);
+
+void _spFree(void *ptr);
+
+float _spRandom();
 
-SP_API void _spSetMalloc (void* (*_malloc) (size_t size));
-SP_API void _spSetDebugMalloc (void* (*_malloc) (size_t size, const char* file, int line));
-SP_API void _spSetRealloc(void* (*_realloc) (void* ptr, size_t size));
-SP_API void _spSetFree (void (*_free) (void* ptr));
-SP_API void _spSetRandom(float (*_random) ());
+SP_API void _spSetMalloc(void *(*_malloc)(size_t size));
 
-char* _spReadFile (const char* path, int* length);
+SP_API void _spSetDebugMalloc(void *(*_malloc)(size_t size, const char *file, int line));
+
+SP_API void _spSetRealloc(void *(*_realloc)(void *ptr, size_t size));
+
+SP_API void _spSetFree(void (*_free)(void *ptr));
+
+SP_API void _spSetRandom(float (*_random)());
+
+char *_spReadFile(const char *path, int *length);
 
 
 /*
  * Math utilities
  */
 float _spMath_random(float min, float max);
+
 float _spMath_randomTriangular(float min, float max);
+
 float _spMath_randomTriangularWith(float min, float max, float mode);
-float _spMath_interpolate(float (*apply) (float a), float start, float end, float a);
+
+float _spMath_interpolate(float (*apply)(float a), float start, float end, float a);
+
 float _spMath_pow2_apply(float a);
+
 float _spMath_pow2out_apply(float a);
 
 /**/
 
 typedef union _spEventQueueItem {
 	int type;
-	spTrackEntry* entry;
-	spEvent* event;
+	spTrackEntry *entry;
+	spEvent *event;
 } _spEventQueueItem;
 
 typedef struct _spAnimationState _spAnimationState;
 
 typedef struct _spEventQueue {
-	_spAnimationState* state;
-	_spEventQueueItem* objects;
+	_spAnimationState *state;
+	_spEventQueueItem *objects;
 	int objectsCount;
 	int objectsCapacity;
 	int /*boolean*/ drainDisabled;
@@ -212,11 +227,11 @@ struct _spAnimationState {
 	spAnimationState super;
 
 	int eventsCount;
-	spEvent** events;
+	spEvent **events;
 
-	_spEventQueue* queue;
+	_spEventQueue *queue;
 
-	spPropertyId* propertyIDs;
+	spPropertyId *propertyIDs;
 	int propertyIDsCount;
 	int propertyIDsCapacity;
 
@@ -227,25 +242,32 @@ struct _spAnimationState {
 /**/
 
 /* configureAttachment and disposeAttachment may be 0. */
-void _spAttachmentLoader_init (spAttachmentLoader* self,
-	void (*dispose) (spAttachmentLoader* self),
-	spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name,
-		const char* path),
-	void (*configureAttachment) (spAttachmentLoader* self, spAttachment*),
-	void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*)
+void _spAttachmentLoader_init(spAttachmentLoader *self,
+							  void (*dispose)(spAttachmentLoader *self),
+							  spAttachment *(*createAttachment)(spAttachmentLoader *self, spSkin *skin,
+																spAttachmentType type, const char *name,
+																const char *path),
+							  void (*configureAttachment)(spAttachmentLoader *self, spAttachment *),
+							  void (*disposeAttachment)(spAttachmentLoader *self, spAttachment *)
 );
-void _spAttachmentLoader_deinit (spAttachmentLoader* self);
+
+void _spAttachmentLoader_deinit(spAttachmentLoader *self);
+
 /* Can only be called from createAttachment. */
-void _spAttachmentLoader_setError (spAttachmentLoader* self, const char* error1, const char* error2);
-void _spAttachmentLoader_setUnknownTypeError (spAttachmentLoader* self, spAttachmentType type);
+void _spAttachmentLoader_setError(spAttachmentLoader *self, const char *error1, const char *error2);
+
+void _spAttachmentLoader_setUnknownTypeError(spAttachmentLoader *self, spAttachmentType type);
 
 /**/
 
-void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type,
-void (*dispose) (spAttachment* self), spAttachment* (*copy) (spAttachment* self));
-void _spAttachment_deinit (spAttachment* self);
-void _spVertexAttachment_init (spVertexAttachment* self);
-void _spVertexAttachment_deinit (spVertexAttachment* self);
+void _spAttachment_init(spAttachment *self, const char *name, spAttachmentType type,
+						void (*dispose)(spAttachment *self), spAttachment *(*copy)(spAttachment *self));
+
+void _spAttachment_deinit(spAttachment *self);
+
+void _spVertexAttachment_init(spVertexAttachment *self);
+
+void _spVertexAttachment_deinit(spVertexAttachment *self);
 
 #ifdef __cplusplus
 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 748 - 686
spine-c/spine-c/src/spine/Animation.c


+ 285 - 230
spine-c/spine-c/src/spine/AnimationState.c

@@ -42,32 +42,55 @@
 
 _SP_ARRAY_IMPLEMENT_TYPE(spTrackEntryArray, spTrackEntry*)
 
-static spAnimation* SP_EMPTY_ANIMATION = 0;
-void spAnimationState_disposeStatics () {
+static spAnimation *SP_EMPTY_ANIMATION = 0;
+
+void spAnimationState_disposeStatics() {
 	if (SP_EMPTY_ANIMATION) spAnimation_dispose(SP_EMPTY_ANIMATION);
 	SP_EMPTY_ANIMATION = 0;
 }
 
 /* Forward declaration of some "private" functions so we can keep
  the same function order in C as we have method order in Java. */
-void _spAnimationState_disposeTrackEntry (spTrackEntry* entry);
-void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntry* entry);
-int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTrackEntry* entry, float delta);
-float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* entry, spSkeleton* skeleton, spMixBlend currentBlend);
-void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time, float alpha, spMixBlend blend, float* timelinesRotation, int i, int /*boolean*/ firstFrame);
-void _spAnimationState_applyAttachmentTimeline(spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float animationTime, spMixBlend blend, int /*bool*/ firstFrame);
-void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry, float animationTime);
-void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt);
-spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index);
-spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackIndex, spAnimation* animation, int /*boolean*/ loop, spTrackEntry* last);
-void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry);
-void _spAnimationState_animationsChanged (spAnimationState* self);
-float* _spAnimationState_resizeTimelinesRotation(spTrackEntry* entry, int newSize);
-void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int capacity);
-int _spAnimationState_addPropertyID(spAnimationState* self, spPropertyId id);
-void _spTrackEntry_computeHold(spTrackEntry* self, spAnimationState* state);
-
-_spEventQueue* _spEventQueue_create (_spAnimationState* state) {
+void _spAnimationState_disposeTrackEntry(spTrackEntry *entry);
+
+void _spAnimationState_disposeTrackEntries(spAnimationState *state, spTrackEntry *entry);
+
+int /*boolean*/ _spAnimationState_updateMixingFrom(spAnimationState *self, spTrackEntry *entry, float delta);
+
+float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *entry, spSkeleton *skeleton,
+										spMixBlend currentBlend);
+
+void
+_spAnimationState_applyRotateTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton, float time,
+									  float alpha, spMixBlend blend, float *timelinesRotation, int i,
+									  int /*boolean*/ firstFrame);
+
+void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
+											   float animationTime, spMixBlend blend, int /*bool*/ firstFrame);
+
+void _spAnimationState_queueEvents(spAnimationState *self, spTrackEntry *entry, float animationTime);
+
+void _spAnimationState_setCurrent(spAnimationState *self, int index, spTrackEntry *current, int /*boolean*/ interrupt);
+
+spTrackEntry *_spAnimationState_expandToIndex(spAnimationState *self, int index);
+
+spTrackEntry *
+_spAnimationState_trackEntry(spAnimationState *self, int trackIndex, spAnimation *animation, int /*boolean*/ loop,
+							 spTrackEntry *last);
+
+void _spAnimationState_disposeNext(spAnimationState *self, spTrackEntry *entry);
+
+void _spAnimationState_animationsChanged(spAnimationState *self);
+
+float *_spAnimationState_resizeTimelinesRotation(spTrackEntry *entry, int newSize);
+
+void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState *self, int capacity);
+
+int _spAnimationState_addPropertyID(spAnimationState *self, spPropertyId id);
+
+void _spTrackEntry_computeHold(spTrackEntry *self, spAnimationState *state);
+
+_spEventQueue *_spEventQueue_create(_spAnimationState *state) {
 	_spEventQueue *self = CALLOC(_spEventQueue, 1);
 	self->state = state;
 	self->objectsCount = 0;
@@ -77,14 +100,14 @@ _spEventQueue* _spEventQueue_create (_spAnimationState* state) {
 	return self;
 }
 
-void _spEventQueue_free (_spEventQueue* self) {
+void _spEventQueue_free(_spEventQueue *self) {
 	FREE(self->objects);
 	FREE(self);
 }
 
-void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) {
+void _spEventQueue_ensureCapacity(_spEventQueue *self, int newElements) {
 	if (self->objectsCount + newElements > self->objectsCapacity) {
-		_spEventQueueItem* newObjects;
+		_spEventQueueItem *newObjects;
 		self->objectsCapacity <<= 1;
 		newObjects = CALLOC(_spEventQueueItem, self->objectsCapacity);
 		memcpy(newObjects, self->objects, sizeof(_spEventQueueItem) * self->objectsCount);
@@ -93,66 +116,66 @@ void _spEventQueue_ensureCapacity (_spEventQueue* self, int newElements) {
 	}
 }
 
-void _spEventQueue_addType (_spEventQueue* self, spEventType type) {
+void _spEventQueue_addType(_spEventQueue *self, spEventType type) {
 	_spEventQueue_ensureCapacity(self, 1);
 	self->objects[self->objectsCount++].type = type;
 }
 
-void _spEventQueue_addEntry (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_addEntry(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_ensureCapacity(self, 1);
 	self->objects[self->objectsCount++].entry = entry;
 }
 
-void _spEventQueue_addEvent (_spEventQueue* self, spEvent* event) {
+void _spEventQueue_addEvent(_spEventQueue *self, spEvent *event) {
 	_spEventQueue_ensureCapacity(self, 1);
 	self->objects[self->objectsCount++].event = event;
 }
 
-void _spEventQueue_start (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_start(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_addType(self, SP_ANIMATION_START);
 	_spEventQueue_addEntry(self, entry);
 	self->state->animationsChanged = 1;
 }
 
-void _spEventQueue_interrupt (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_interrupt(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_addType(self, SP_ANIMATION_INTERRUPT);
 	_spEventQueue_addEntry(self, entry);
 }
 
-void _spEventQueue_end (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_end(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_addType(self, SP_ANIMATION_END);
 	_spEventQueue_addEntry(self, entry);
 	self->state->animationsChanged = 1;
 }
 
-void _spEventQueue_dispose (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_dispose(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_addType(self, SP_ANIMATION_DISPOSE);
 	_spEventQueue_addEntry(self, entry);
 }
 
-void _spEventQueue_complete (_spEventQueue* self, spTrackEntry* entry) {
+void _spEventQueue_complete(_spEventQueue *self, spTrackEntry *entry) {
 	_spEventQueue_addType(self, SP_ANIMATION_COMPLETE);
 	_spEventQueue_addEntry(self, entry);
 }
 
-void _spEventQueue_event (_spEventQueue* self, spTrackEntry* entry, spEvent* event) {
+void _spEventQueue_event(_spEventQueue *self, spTrackEntry *entry, spEvent *event) {
 	_spEventQueue_addType(self, SP_ANIMATION_EVENT);
 	_spEventQueue_addEntry(self, entry);
 	_spEventQueue_addEvent(self, event);
 }
 
-void _spEventQueue_clear (_spEventQueue* self) {
+void _spEventQueue_clear(_spEventQueue *self) {
 	self->objectsCount = 0;
 }
 
-void _spEventQueue_drain (_spEventQueue* self) {
+void _spEventQueue_drain(_spEventQueue *self) {
 	int i;
 	if (self->drainDisabled) return;
 	self->drainDisabled = 1;
 	for (i = 0; i < self->objectsCount; i += 2) {
-		spEventType type = (spEventType)self->objects[i].type;
-		spTrackEntry* entry = self->objects[i+1].entry;
-		spEvent* event;
+		spEventType type = (spEventType) self->objects[i].type;
+		spTrackEntry *entry = self->objects[i + 1].entry;
+		spEvent *event;
 		switch (type) {
 			case SP_ANIMATION_START:
 			case SP_ANIMATION_INTERRUPT:
@@ -166,11 +189,12 @@ void _spEventQueue_drain (_spEventQueue* self) {
 				/* Fall through. */
 			case SP_ANIMATION_DISPOSE:
 				if (entry->listener) entry->listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0);
-				if (self->state->super.listener) self->state->super.listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0);
+				if (self->state->super.listener)
+					self->state->super.listener(SUPER(self->state), SP_ANIMATION_DISPOSE, entry, 0);
 				_spAnimationState_disposeTrackEntry(entry);
 				break;
 			case SP_ANIMATION_EVENT:
-				event = self->objects[i+2].event;
+				event = self->objects[i + 2].event;
 				if (entry->listener) entry->listener(SUPER(self->state), type, entry, event);
 				if (self->state->super.listener) self->state->super.listener(SUPER(self->state), type, entry, event);
 				i++;
@@ -183,29 +207,29 @@ void _spEventQueue_drain (_spEventQueue* self) {
 }
 
 /* These two functions are needed in the UE4 runtime, see #1037 */
-void _spAnimationState_enableQueue(spAnimationState* self) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void _spAnimationState_enableQueue(spAnimationState *self) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	internal->queue->drainDisabled = 0;
 }
 
-void _spAnimationState_disableQueue(spAnimationState* self) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void _spAnimationState_disableQueue(spAnimationState *self) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	internal->queue->drainDisabled = 1;
 }
 
-void _spAnimationState_disposeTrackEntry (spTrackEntry* entry) {
+void _spAnimationState_disposeTrackEntry(spTrackEntry *entry) {
 	spIntArray_dispose(entry->timelineMode);
 	spTrackEntryArray_dispose(entry->timelineHoldMix);
 	FREE(entry->timelinesRotation);
 	FREE(entry);
 }
 
-void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntry* entry) {
+void _spAnimationState_disposeTrackEntries(spAnimationState *state, spTrackEntry *entry) {
 	while (entry) {
-		spTrackEntry* next = entry->next;
-		spTrackEntry* from = entry->mixingFrom;
+		spTrackEntry *next = entry->next;
+		spTrackEntry *from = entry->mixingFrom;
 		while (from) {
-			spTrackEntry* nextFrom = from->mixingFrom;
+			spTrackEntry *nextFrom = from->mixingFrom;
 			if (entry->listener) entry->listener(state, SP_ANIMATION_DISPOSE, from, 0);
 			if (state->listener) state->listener(state, SP_ANIMATION_DISPOSE, from, 0);
 			_spAnimationState_disposeTrackEntry(from);
@@ -218,12 +242,12 @@ void _spAnimationState_disposeTrackEntries (spAnimationState* state, spTrackEntr
 	}
 }
 
-spAnimationState* spAnimationState_create (spAnimationStateData* data) {
-	_spAnimationState* internal;
-	spAnimationState* self;
+spAnimationState *spAnimationState_create(spAnimationStateData *data) {
+	_spAnimationState *internal;
+	spAnimationState *self;
 
 	if (!SP_EMPTY_ANIMATION) {
-		SP_EMPTY_ANIMATION = (spAnimation*)1; /* dirty trick so we can recursively call spAnimation_create */
+		SP_EMPTY_ANIMATION = (spAnimation *) 1; /* dirty trick so we can recursively call spAnimation_create */
 		SP_EMPTY_ANIMATION = spAnimation_create("<empty>", NULL, 0);
 	}
 
@@ -242,9 +266,9 @@ spAnimationState* spAnimationState_create (spAnimationStateData* data) {
 	return self;
 }
 
-void spAnimationState_dispose (spAnimationState* self) {
+void spAnimationState_dispose(spAnimationState *self) {
 	int i;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	for (i = 0; i < self->tracksCount; i++)
 		_spAnimationState_disposeTrackEntries(self, self->tracks[i]);
 	FREE(self->tracks);
@@ -254,14 +278,14 @@ void spAnimationState_dispose (spAnimationState* self) {
 	FREE(internal);
 }
 
-void spAnimationState_update (spAnimationState* self, float delta) {
+void spAnimationState_update(spAnimationState *self, float delta) {
 	int i, n;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	delta *= self->timeScale;
 	for (i = 0, n = self->tracksCount; i < n; i++) {
 		float currentDelta;
-		spTrackEntry* current = self->tracks[i];
-		spTrackEntry* next;
+		spTrackEntry *current = self->tracks[i];
+		spTrackEntry *next;
 		if (!current) continue;
 
 		current->animationLast = current->nextAnimationLast;
@@ -282,7 +306,8 @@ void spAnimationState_update (spAnimationState* self, float delta) {
 			float nextTime = current->trackLast - next->delay;
 			if (nextTime >= 0) {
 				next->delay = 0;
-				next->trackTime += current->timeScale == 0 ? 0 : (nextTime / current->timeScale + delta) * next->timeScale;
+				next->trackTime +=
+						current->timeScale == 0 ? 0 : (nextTime / current->timeScale + delta) * next->timeScale;
 				current->trackTime += currentDelta;
 				_spAnimationState_setCurrent(self, i, next, 1);
 				while (next->mixingFrom) {
@@ -302,7 +327,7 @@ void spAnimationState_update (spAnimationState* self, float delta) {
 		}
 		if (current->mixingFrom != 0 && _spAnimationState_updateMixingFrom(self, current, delta)) {
 			/* End mixing from entries once all have completed. */
-			spTrackEntry* from = current->mixingFrom;
+			spTrackEntry *from = current->mixingFrom;
 			current->mixingFrom = 0;
 			if (from != 0) from->mixingTo = 0;
 			while (from != 0) {
@@ -317,10 +342,10 @@ void spAnimationState_update (spAnimationState* self, float delta) {
 	_spEventQueue_drain(internal->queue);
 }
 
-int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTrackEntry* to, float delta) {
-	spTrackEntry* from = to->mixingFrom;
+int /*boolean*/ _spAnimationState_updateMixingFrom(spAnimationState *self, spTrackEntry *to, float delta) {
+	spTrackEntry *from = to->mixingFrom;
 	int finished;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	if (!from) return -1;
 
 	finished = _spAnimationState_updateMixingFrom(self, from, delta);
@@ -345,24 +370,24 @@ int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTr
 	return 0;
 }
 
-int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
-	spTrackEntry* current;
+int spAnimationState_apply(spAnimationState *self, spSkeleton *skeleton) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
+	spTrackEntry *current;
 	int i, ii, n;
 	float animationLast, animationTime;
 	int timelineCount;
-	spTimeline** timelines;
+	spTimeline **timelines;
 	int /*boolean*/ firstFrame;
-	float* timelinesRotation;
-	spTimeline* timeline;
+	float *timelinesRotation;
+	spTimeline *timeline;
 	int applied = 0;
 	spMixBlend blend;
 	spMixBlend timelineBlend;
 	int setupState = 0;
-	spSlot** slots = NULL;
-	spSlot* slot = NULL;
-    const char* attachmentName = NULL;
-	spEvent** applyEvents = NULL;
+	spSlot **slots = NULL;
+	spSlot *slot = NULL;
+	const char *attachmentName = NULL;
+	spEvent **applyEvents = NULL;
 	float applyTime;
 
 	if (internal->animationsChanged) _spAnimationState_animationsChanged(self);
@@ -382,7 +407,8 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
 			mix = 0;
 
 		/* Apply current entry. */
-		animationLast = current->animationLast; animationTime = spTrackEntry_getAnimationTime(current);
+		animationLast = current->animationLast;
+		animationTime = spTrackEntry_getAnimationTime(current);
 		timelineCount = current->animation->timelines->size;
 		applyEvents = internal->events;
 		applyTime = animationTime;
@@ -393,16 +419,16 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
 		timelines = current->animation->timelines->items;
 		if ((i == 0 && mix == 1) || blend == SP_MIX_BLEND_ADD) {
 			for (ii = 0; ii < timelineCount; ii++) {
-                timeline = timelines[ii];
-			    if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT) {
-                    _spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, blend, -1);
-			    } else {
-                    spTimeline_apply(timelines[ii], skeleton, animationLast, applyTime, applyEvents,
-                                     &internal->eventsCount, mix, blend, SP_MIX_DIRECTION_IN);
-                }
-            }
+				timeline = timelines[ii];
+				if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT) {
+					_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, blend, -1);
+				} else {
+					spTimeline_apply(timelines[ii], skeleton, animationLast, applyTime, applyEvents,
+									 &internal->eventsCount, mix, blend, SP_MIX_DIRECTION_IN);
+				}
+			}
 		} else {
-			spIntArray* timelineMode = current->timelineMode;
+			spIntArray *timelineMode = current->timelineMode;
 
 			firstFrame = current->timelinesRotationCount != timelineCount << 1;
 			if (firstFrame) _spAnimationState_resizeTimelinesRotation(current, timelineCount << 1);
@@ -412,11 +438,13 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
 				timeline = timelines[ii];
 				timelineBlend = timelineMode->items[ii] == SUBSEQUENT ? blend : SP_MIX_BLEND_SETUP;
 				if (timeline->propertyIds[0] == SP_PROPERTY_ROTATE)
-					_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame);
+					_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, mix, timelineBlend,
+														  timelinesRotation, ii << 1, firstFrame);
 				else if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT)
-				    _spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, -1);
+					_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, -1);
 				else
-					spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount, mix, timelineBlend, SP_MIX_DIRECTION_IN);
+					spTimeline_apply(timeline, skeleton, animationLast, applyTime, applyEvents, &internal->eventsCount,
+									 mix, timelineBlend, SP_MIX_DIRECTION_IN);
 			}
 		}
 		_spAnimationState_queueEvents(self, current, animationTime);
@@ -426,43 +454,46 @@ int spAnimationState_apply (spAnimationState* self, spSkeleton* skeleton) {
 	}
 
 	setupState = self->unkeyedState + SETUP;
-    slots = skeleton->slots;
-    for (i = 0, n = skeleton->slotsCount; i < n; i++) {
-        slot = slots[i];
-        if (slot->attachmentState == setupState) {
-            attachmentName = slot->data->attachmentName;
-            slot->attachment = attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName);
-        }
-    }
-    self->unkeyedState += 2;
+	slots = skeleton->slots;
+	for (i = 0, n = skeleton->slotsCount; i < n; i++) {
+		slot = slots[i];
+		if (slot->attachmentState == setupState) {
+			attachmentName = slot->data->attachmentName;
+			slot->attachment =
+					attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index,
+																						 attachmentName);
+		}
+	}
+	self->unkeyedState += 2;
 
 	_spEventQueue_drain(internal->queue);
 	return applied;
 }
 
-float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* to, spSkeleton* skeleton, spMixBlend blend) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+float
+_spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to, spSkeleton *skeleton, spMixBlend blend) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	float mix;
-	spEvent** events;
+	spEvent **events;
 	int /*boolean*/ attachments;
 	int /*boolean*/ drawOrder;
 	float animationLast;
 	float animationTime;
 	int timelineCount;
-	spTimeline** timelines;
-	spIntArray* timelineMode;
-	spTrackEntryArray* timelineHoldMix;
+	spTimeline **timelines;
+	spIntArray *timelineMode;
+	spTrackEntryArray *timelineHoldMix;
 	spMixBlend timelineBlend;
 	float alphaHold;
 	float alphaMix;
 	float alpha;
 	int /*boolean*/ firstFrame;
-	float* timelinesRotation;
+	float *timelinesRotation;
 	int i;
-	spTrackEntry* holdMix;
+	spTrackEntry *holdMix;
 	float applyTime;
 
-	spTrackEntry* from = to->mixingFrom;
+	spTrackEntry *from = to->mixingFrom;
 	if (from->mixingFrom) _spAnimationState_applyMixingFrom(self, from, skeleton, blend);
 
 	if (to->mixDuration == 0) { /* Single frame mix to undo mixingFrom changes. */
@@ -478,7 +509,8 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
 	drawOrder = mix < from->drawOrderThreshold;
 	timelineCount = from->animation->timelines->size;
 	timelines = from->animation->timelines->items;
-	alphaHold = from->alpha * to->interruptAlpha; alphaMix = alphaHold * (1 - mix);
+	alphaHold = from->alpha * to->interruptAlpha;
+	alphaMix = alphaHold * (1 - mix);
 	animationLast = from->animationLast;
 	animationTime = spTrackEntry_getAnimationTime(from);
 	applyTime = animationTime;
@@ -492,7 +524,8 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
 	if (blend == SP_MIX_BLEND_ADD) {
 		for (i = 0; i < timelineCount; i++) {
 			spTimeline *timeline = timelines[i];
-			spTimeline_apply(timeline, skeleton, animationLast, applyTime, events, &internal->eventsCount, alphaMix, blend, SP_MIX_DIRECTION_OUT);
+			spTimeline_apply(timeline, skeleton, animationLast, applyTime, events, &internal->eventsCount, alphaMix,
+							 blend, SP_MIX_DIRECTION_OUT);
 		}
 	} else {
 		timelineMode = from->timelineMode;
@@ -510,17 +543,17 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
 			switch (timelineMode->items[i]) {
 				case SUBSEQUENT:
 					if (!drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER) continue;
-                    timelineBlend = blend;
+					timelineBlend = blend;
 					alpha = alphaMix;
 					break;
 				case FIRST:
 					timelineBlend = SP_MIX_BLEND_SETUP;
 					alpha = alphaMix;
 					break;
-			    case HOLD_SUBSEQUENT:
-			        timelineBlend = blend;
-			        alpha = alphaHold;
-			        break;
+				case HOLD_SUBSEQUENT:
+					timelineBlend = blend;
+					alpha = alphaHold;
+					break;
 				case HOLD_FIRST:
 					timelineBlend = SP_MIX_BLEND_SETUP;
 					alpha = alphaHold;
@@ -534,14 +567,16 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
 			from->totalAlpha += alpha;
 			if (timeline->propertyIds[0] == SP_PROPERTY_ROTATE)
 				_spAnimationState_applyRotateTimeline(self, timeline, skeleton, applyTime, alpha, timelineBlend,
-					timelinesRotation, i << 1, firstFrame);
+													  timelinesRotation, i << 1, firstFrame);
 			else if (timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT)
-			    _spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend, attachments);
+				_spAnimationState_applyAttachmentTimeline(self, timeline, skeleton, applyTime, timelineBlend,
+														  attachments);
 			else {
-                if (drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER && timelineBlend == SP_MIX_BLEND_SETUP)
-                    direction = SP_MIX_DIRECTION_IN;
+				if (drawOrder && timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER &&
+					timelineBlend == SP_MIX_BLEND_SETUP)
+					direction = SP_MIX_DIRECTION_IN;
 				spTimeline_apply(timeline, skeleton, animationLast, applyTime, events, &internal->eventsCount,
-					alpha, timelineBlend, direction);
+								 alpha, timelineBlend, direction);
 			}
 		}
 	}
@@ -555,55 +590,64 @@ float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* t
 	return mix;
 }
 
-static void _spAnimationState_setAttachment(spAnimationState* self, spSkeleton* skeleton, spSlot* slot, const char* attachmentName, int /*bool*/ attachments) {
-    slot->attachment = attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName);
-    if (attachments) slot->attachmentState = self->unkeyedState + CURRENT;
+static void
+_spAnimationState_setAttachment(spAnimationState *self, spSkeleton *skeleton, spSlot *slot, const char *attachmentName,
+								int /*bool*/ attachments) {
+	slot->attachment = attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index,
+																							attachmentName);
+	if (attachments) slot->attachmentState = self->unkeyedState + CURRENT;
 }
 
 /* @param target After the first and before the last entry. */
-static int binarySearch1 (float *values, int valuesLength, float target) {
-    int low = 0, current;
-    int high = valuesLength - 2;
-    if (high == 0) return 1;
-    current = high >> 1;
-    while (1) {
-        if (values[(current + 1)] <= target)
-            low = current + 1;
-        else
-            high = current;
-        if (low == high) return low + 1;
-        current = (low + high) >> 1;
-    }
-    return 0;
+static int binarySearch1(float *values, int valuesLength, float target) {
+	int low = 0, current;
+	int high = valuesLength - 2;
+	if (high == 0) return 1;
+	current = high >> 1;
+	while (1) {
+		if (values[(current + 1)] <= target)
+			low = current + 1;
+		else
+			high = current;
+		if (low == high) return low + 1;
+		current = (low + high) >> 1;
+	}
+	return 0;
 }
 
-void _spAnimationState_applyAttachmentTimeline(spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time, spMixBlend blend, int /*bool*/ attachments) {
-    spAttachmentTimeline* attachmentTimeline;
-    spSlot* slot;
-    float* frames;
-
-    attachmentTimeline = SUB_CAST(spAttachmentTimeline, timeline);
-    slot = skeleton->slots[attachmentTimeline->slotIndex];
-    if (!slot->bone->active) return;
-
-    frames = attachmentTimeline->super.frames->items;
-    if (time < frames[0]) {
-        if (blend == SP_MIX_BLEND_SETUP || blend == SP_MIX_BLEND_FIRST)
-        _spAnimationState_setAttachment(self, skeleton, slot, slot->data->attachmentName, attachments);
-    } else {
-        _spAnimationState_setAttachment(self, skeleton, slot, attachmentTimeline->attachmentNames[binarySearch1(frames, attachmentTimeline->super.frames->size, time)], attachments);
-    }
-
-    /* If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.*/
-    if (slot->attachmentState <= self->unkeyedState) slot->attachmentState = self->unkeyedState + SETUP;
+void _spAnimationState_applyAttachmentTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton,
+											   float time, spMixBlend blend, int /*bool*/ attachments) {
+	spAttachmentTimeline *attachmentTimeline;
+	spSlot *slot;
+	float *frames;
+
+	attachmentTimeline = SUB_CAST(spAttachmentTimeline, timeline);
+	slot = skeleton->slots[attachmentTimeline->slotIndex];
+	if (!slot->bone->active) return;
+
+	frames = attachmentTimeline->super.frames->items;
+	if (time < frames[0]) {
+		if (blend == SP_MIX_BLEND_SETUP || blend == SP_MIX_BLEND_FIRST)
+			_spAnimationState_setAttachment(self, skeleton, slot, slot->data->attachmentName, attachments);
+	} else {
+		_spAnimationState_setAttachment(self, skeleton, slot, attachmentTimeline->attachmentNames[binarySearch1(frames,
+																												attachmentTimeline->super.frames->size,
+																												time)],
+										attachments);
+	}
+
+	/* If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.*/
+	if (slot->attachmentState <= self->unkeyedState) slot->attachmentState = self->unkeyedState + SETUP;
 }
 
-void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time,
-	float alpha, spMixBlend blend, float* timelinesRotation, int i, int /*boolean*/ firstFrame
+void
+_spAnimationState_applyRotateTimeline(spAnimationState *self, spTimeline *timeline, spSkeleton *skeleton, float time,
+									  float alpha, spMixBlend blend, float *timelinesRotation, int i,
+									  int /*boolean*/ firstFrame
 ) {
 	spRotateTimeline *rotateTimeline;
 	float *frames;
-	spBone* bone;
+	spBone *bone;
 	float r1, r2;
 	float total, diff;
 	int /*boolean*/ current, dir;
@@ -637,7 +681,7 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
 
 	/* Mix between rotations using the direction of the shortest route on the first frame while detecting crosses. */
 	diff = r2 - r1;
-	diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
+	diff -= (16384 - (int) (16384.499999999996 - diff / 360)) * 360;
 	if (diff == 0) {
 		total = timelinesRotation[i];
 	} else {
@@ -665,10 +709,10 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
 	bone->rotation = r1 + total * alpha;
 }
 
-void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry, float animationTime) {
-	spEvent** events;
-	spEvent* event;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void _spAnimationState_queueEvents(spAnimationState *self, spTrackEntry *entry, float animationTime) {
+	spEvent **events;
+	spEvent *event;
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	int i, n, complete;
 	float animationStart = entry->animationStart, animationEnd = entry->animationEnd;
 	float duration = animationEnd - animationStart;
@@ -698,12 +742,12 @@ void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry,
 	}
 }
 
-void spAnimationState_clearNext(spTrackEntry* entry) {
+void spAnimationState_clearNext(spTrackEntry *entry) {
 	_spAnimationState_disposeTrackEntry(entry);
 }
 
-void spAnimationState_clearTracks (spAnimationState* self) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void spAnimationState_clearTracks(spAnimationState *self) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	int i, n, oldDrainDisabled;
 	oldDrainDisabled = internal->queue->drainDisabled;
 	internal->queue->drainDisabled = 1;
@@ -714,11 +758,11 @@ void spAnimationState_clearTracks (spAnimationState* self) {
 	_spEventQueue_drain(internal->queue);
 }
 
-void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) {
-	spTrackEntry* current;
-	spTrackEntry* entry;
-	spTrackEntry* from;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void spAnimationState_clearTrack(spAnimationState *self, int trackIndex) {
+	spTrackEntry *current;
+	spTrackEntry *entry;
+	spTrackEntry *from;
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 
 	if (trackIndex >= self->tracksCount) return;
 	current = self->tracks[trackIndex];
@@ -742,9 +786,9 @@ void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) {
 	_spEventQueue_drain(internal->queue);
 }
 
-void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
-	spTrackEntry* from = _spAnimationState_expandToIndex(self, index);
+void _spAnimationState_setCurrent(spAnimationState *self, int index, spTrackEntry *current, int /*boolean*/ interrupt) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
+	spTrackEntry *from = _spAnimationState_expandToIndex(self, index);
 	self->tracks[index] = current;
 	current->previous = NULL;
 
@@ -765,16 +809,18 @@ void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEnt
 }
 
 /** Set the current animation. Any queued animations are cleared. */
-spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName, int/*bool*/loop) {
-	spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
+spTrackEntry *spAnimationState_setAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
+												  int/*bool*/loop) {
+	spAnimation *animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
 	return spAnimationState_setAnimation(self, trackIndex, animation, loop);
 }
 
-spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop) {
-	spTrackEntry* entry;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+spTrackEntry *
+spAnimationState_setAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop) {
+	spTrackEntry *entry;
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	int interrupt = 1;
-	spTrackEntry* current = _spAnimationState_expandToIndex(self, trackIndex);
+	spTrackEntry *current = _spAnimationState_expandToIndex(self, trackIndex);
 	if (current) {
 		if (current->nextTrackLast == -1) {
 			/* Don't mix from an entry that was never applied. */
@@ -795,17 +841,19 @@ spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIn
 
 /** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix
  * duration. */
-spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName,
-	int/*bool*/loop, float delay
+spTrackEntry *spAnimationState_addAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
+												  int/*bool*/loop, float delay
 ) {
-	spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
+	spAnimation *animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
 	return spAnimationState_addAnimation(self, trackIndex, animation, loop, delay);
 }
 
-spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, float delay) {
-	spTrackEntry* entry;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
-	spTrackEntry* last = _spAnimationState_expandToIndex(self, trackIndex);
+spTrackEntry *
+spAnimationState_addAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop,
+							  float delay) {
+	spTrackEntry *entry;
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
+	spTrackEntry *last = _spAnimationState_expandToIndex(self, trackIndex);
 	if (last) {
 		while (last->next)
 			last = last->next;
@@ -826,26 +874,28 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
 	return entry;
 }
 
-spTrackEntry* spAnimationState_setEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration) {
-	spTrackEntry* entry = spAnimationState_setAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0);
+spTrackEntry *spAnimationState_setEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration) {
+	spTrackEntry *entry = spAnimationState_setAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0);
 	entry->mixDuration = mixDuration;
 	entry->trackEnd = mixDuration;
 	return entry;
 }
 
-spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int trackIndex, float mixDuration, float delay) {
-	spTrackEntry* entry;
+spTrackEntry *
+spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay) {
+	spTrackEntry *entry;
 	entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay <= 0 ? 1 : delay);
 	entry->mixDuration = mixDuration;
 	entry->trackEnd = mixDuration;
-	if (delay <= 0 && entry->previous != NULL) entry->delay = spTrackEntry_getTrackComplete(entry->previous) - entry->mixDuration + delay;
+	if (delay <= 0 && entry->previous != NULL)
+		entry->delay = spTrackEntry_getTrackComplete(entry->previous) - entry->mixDuration + delay;
 	return entry;
 }
 
-void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration) {
+void spAnimationState_setEmptyAnimations(spAnimationState *self, float mixDuration) {
 	int i, n, oldDrainDisabled;
-	spTrackEntry* current;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	spTrackEntry *current;
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	oldDrainDisabled = internal->queue->drainDisabled;
 	internal->queue->drainDisabled = 1;
 	for (i = 0, n = self->tracksCount; i < n; i++) {
@@ -856,19 +906,21 @@ void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDurati
 	_spEventQueue_drain(internal->queue);
 }
 
-spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index) {
-	spTrackEntry** newTracks;
+spTrackEntry *_spAnimationState_expandToIndex(spAnimationState *self, int index) {
+	spTrackEntry **newTracks;
 	if (index < self->tracksCount) return self->tracks[index];
 	newTracks = CALLOC(spTrackEntry*, index + 1);
-	memcpy(newTracks, self->tracks, self->tracksCount * sizeof(spTrackEntry*));
+	memcpy(newTracks, self->tracks, self->tracksCount * sizeof(spTrackEntry *));
 	FREE(self->tracks);
 	self->tracks = newTracks;
 	self->tracksCount = index + 1;
 	return 0;
 }
 
-spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackIndex, spAnimation* animation, int /*boolean*/ loop, spTrackEntry* last) {
-	spTrackEntry* entry = NEW(spTrackEntry);
+spTrackEntry *
+_spAnimationState_trackEntry(spAnimationState *self, int trackIndex, spAnimation *animation, int /*boolean*/ loop,
+							 spTrackEntry *last) {
+	spTrackEntry *entry = NEW(spTrackEntry);
 	entry->trackIndex = trackIndex;
 	entry->animation = animation;
 	entry->loop = loop;
@@ -890,7 +942,7 @@ spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackInd
 	entry->trackTime = 0;
 	entry->trackLast = -1;
 	entry->nextTrackLast = -1;
-	entry->trackEnd = (float)INT_MAX;
+	entry->trackEnd = (float) INT_MAX;
 	entry->timeScale = 1;
 
 	entry->alpha = 1;
@@ -905,9 +957,9 @@ spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackInd
 	return entry;
 }
 
-void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
-	spTrackEntry* next = entry->next;
+void _spAnimationState_disposeNext(spAnimationState *self, spTrackEntry *entry) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
+	spTrackEntry *next = entry->next;
 	while (next) {
 		_spEventQueue_dispose(internal->queue, next);
 		next = next->next;
@@ -915,16 +967,17 @@ void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry)
 	entry->next = 0;
 }
 
-void _spAnimationState_animationsChanged (spAnimationState* self) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void _spAnimationState_animationsChanged(spAnimationState *self) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	int i, n;
-	spTrackEntry* entry;
+	spTrackEntry *entry;
 	internal->animationsChanged = 0;
 
 	internal->propertyIDsCount = 0;
-	i = 0; n = self->tracksCount;
+	i = 0;
+	n = self->tracksCount;
 
-	for (;i < n; i++) {
+	for (; i < n; i++) {
 		entry = self->tracks[i];
 		if (!entry) continue;
 		while (entry->mixingFrom != 0)
@@ -936,9 +989,9 @@ void _spAnimationState_animationsChanged (spAnimationState* self) {
 	}
 }
 
-float* _spAnimationState_resizeTimelinesRotation(spTrackEntry* entry, int newSize) {
+float *_spAnimationState_resizeTimelinesRotation(spTrackEntry *entry, int newSize) {
 	if (entry->timelinesRotationCount != newSize) {
-		float* newTimelinesRotation = CALLOC(float, newSize);
+		float *newTimelinesRotation = CALLOC(float, newSize);
 		FREE(entry->timelinesRotation);
 		entry->timelinesRotation = newTimelinesRotation;
 		entry->timelinesRotationCount = newSize;
@@ -946,8 +999,8 @@ float* _spAnimationState_resizeTimelinesRotation(spTrackEntry* entry, int newSiz
 	return entry->timelinesRotation;
 }
 
-void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int capacity) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState *self, int capacity) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	if (internal->propertyIDsCapacity < capacity) {
 		spPropertyId *newPropertyIDs = CALLOC(spPropertyId, capacity << 1);
 		memcpy(newPropertyIDs, internal->propertyIDs, sizeof(spPropertyId) * internal->propertyIDsCount);
@@ -957,9 +1010,9 @@ void _spAnimationState_ensureCapacityPropertyIDs(spAnimationState* self, int cap
 	}
 }
 
-int _spAnimationState_addPropertyID(spAnimationState* self, spPropertyId id) {
+int _spAnimationState_addPropertyID(spAnimationState *self, spPropertyId id) {
 	int i, n;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 
 	for (i = 0, n = internal->propertyIDsCount; i < n; i++) {
 		if (internal->propertyIDs[i] == id) return 0;
@@ -971,9 +1024,9 @@ int _spAnimationState_addPropertyID(spAnimationState* self, spPropertyId id) {
 	return 1;
 }
 
-int _spAnimationState_addPropertyIDs(spAnimationState* self, spPropertyId *ids, int numIds) {
+int _spAnimationState_addPropertyIDs(spAnimationState *self, spPropertyId *ids, int numIds) {
 	int i, n;
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	int oldSize = internal->propertyIDsCount;
 
 	for (i = 0, n = numIds; i < n; i++) {
@@ -983,17 +1036,17 @@ int _spAnimationState_addPropertyIDs(spAnimationState* self, spPropertyId *ids,
 	return internal->propertyIDsCount != oldSize;
 }
 
-spTrackEntry* spAnimationState_getCurrent (spAnimationState* self, int trackIndex) {
+spTrackEntry *spAnimationState_getCurrent(spAnimationState *self, int trackIndex) {
 	if (trackIndex >= self->tracksCount) return 0;
 	return self->tracks[trackIndex];
 }
 
-void spAnimationState_clearListenerNotifications(spAnimationState* self) {
-	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
+void spAnimationState_clearListenerNotifications(spAnimationState *self) {
+	_spAnimationState *internal = SUB_CAST(_spAnimationState, self);
 	_spEventQueue_clear(internal->queue);
 }
 
-float spTrackEntry_getAnimationTime (spTrackEntry* entry) {
+float spTrackEntry_getAnimationTime(spTrackEntry *entry) {
 	if (entry->loop) {
 		float duration = entry->animationEnd - entry->animationStart;
 		if (duration == 0) return entry->animationStart;
@@ -1002,22 +1055,22 @@ float spTrackEntry_getAnimationTime (spTrackEntry* entry) {
 	return MIN(entry->trackTime + entry->animationStart, entry->animationEnd);
 }
 
-float spTrackEntry_getTrackComplete(spTrackEntry* entry) {
+float spTrackEntry_getTrackComplete(spTrackEntry *entry) {
 	float duration = entry->animationEnd - entry->animationStart;
 	if (duration != 0) {
-		if (entry->loop) return duration * (1 + (int)(entry->trackTime / duration)); /* Completion of next loop. */
+		if (entry->loop) return duration * (1 + (int) (entry->trackTime / duration)); /* Completion of next loop. */
 		if (entry->trackTime < duration) return duration; /* Before duration. */
 	}
 	return entry->trackTime; /* Next update. */
 }
 
-void _spTrackEntry_computeHold(spTrackEntry* entry, spAnimationState* state) {
-	spTrackEntry* to;
-	spTimeline** timelines;
+void _spTrackEntry_computeHold(spTrackEntry *entry, spAnimationState *state) {
+	spTrackEntry *to;
+	spTimeline **timelines;
 	int timelinesCount;
-	int* timelineMode;
-	spTrackEntry** timelineHoldMix;
-	spTrackEntry* next;
+	int *timelineMode;
+	spTrackEntry **timelineHoldMix;
+	spTrackEntry *next;
 	int i;
 
 	to = entry->mixingTo;
@@ -1029,7 +1082,7 @@ void _spTrackEntry_computeHold(spTrackEntry* entry, spAnimationState* state) {
 
 	if (to != 0 && to->holdPrevious) {
 		for (i = 0; i < timelinesCount; i++) {
-			spPropertyId* ids = timelines[i]->propertyIds;
+			spPropertyId *ids = timelines[i]->propertyIds;
 			int numIds = timelines[i]->propertyIdsCount;
 			timelineMode[i] = _spAnimationState_addPropertyIDs(state, ids, numIds) ? HOLD_FIRST : HOLD_SUBSEQUENT;
 		}
@@ -1039,13 +1092,15 @@ void _spTrackEntry_computeHold(spTrackEntry* entry, spAnimationState* state) {
 	i = 0;
 	continue_outer:
 	for (; i < timelinesCount; i++) {
-		spTimeline* timeline = timelines[i];
+		spTimeline *timeline = timelines[i];
 		spPropertyId *ids = timeline->propertyIds;
 		int numIds = timeline->propertyIdsCount;
 		if (!_spAnimationState_addPropertyIDs(state, ids, numIds))
 			timelineMode[i] = SUBSEQUENT;
-		else if (to == 0 || timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT || timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER ||
-				timeline->propertyIds[0] == SP_PROPERTY_EVENT || !spAnimation_hasTimeline(to->animation, ids, numIds)) {
+		else if (to == 0 || timeline->propertyIds[0] == SP_PROPERTY_ATTACHMENT ||
+				 timeline->propertyIds[0] == SP_PROPERTY_DRAWORDER ||
+				 timeline->propertyIds[0] == SP_PROPERTY_EVENT ||
+				 !spAnimation_hasTimeline(to->animation, ids, numIds)) {
 			timelineMode[i] = FIRST;
 		} else {
 			for (next = to->mixingTo; next != 0; next = next->mixingTo) {

+ 29 - 28
spine-c/spine-c/src/spine/AnimationStateData.c

@@ -32,19 +32,19 @@
 
 typedef struct _ToEntry _ToEntry;
 struct _ToEntry {
-	spAnimation* animation;
+	spAnimation *animation;
 	float duration;
-	_ToEntry* next;
+	_ToEntry *next;
 };
 
-_ToEntry* _ToEntry_create (spAnimation* to, float duration) {
-	_ToEntry* self = NEW(_ToEntry);
+_ToEntry *_ToEntry_create(spAnimation *to, float duration) {
+	_ToEntry *self = NEW(_ToEntry);
 	self->animation = to;
 	self->duration = duration;
 	return self;
 }
 
-void _ToEntry_dispose (_ToEntry* self) {
+void _ToEntry_dispose(_ToEntry *self) {
 	FREE(self);
 }
 
@@ -52,35 +52,35 @@ void _ToEntry_dispose (_ToEntry* self) {
 
 typedef struct _FromEntry _FromEntry;
 struct _FromEntry {
-	spAnimation* animation;
-	_ToEntry* toEntries;
-	_FromEntry* next;
+	spAnimation *animation;
+	_ToEntry *toEntries;
+	_FromEntry *next;
 };
 
-_FromEntry* _FromEntry_create (spAnimation* from) {
-	_FromEntry* self = NEW(_FromEntry);
+_FromEntry *_FromEntry_create(spAnimation *from) {
+	_FromEntry *self = NEW(_FromEntry);
 	self->animation = from;
 	return self;
 }
 
-void _FromEntry_dispose (_FromEntry* self) {
+void _FromEntry_dispose(_FromEntry *self) {
 	FREE(self);
 }
 
 /**/
 
-spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData) {
-	spAnimationStateData* self = NEW(spAnimationStateData);
+spAnimationStateData *spAnimationStateData_create(spSkeletonData *skeletonData) {
+	spAnimationStateData *self = NEW(spAnimationStateData);
 	CONST_CAST(spSkeletonData*, self->skeletonData) = skeletonData;
 	return self;
 }
 
-void spAnimationStateData_dispose (spAnimationStateData* self) {
-	_ToEntry* toEntry;
-	_ToEntry* nextToEntry;
-	_FromEntry* nextFromEntry;
+void spAnimationStateData_dispose(spAnimationStateData *self) {
+	_ToEntry *toEntry;
+	_ToEntry *nextToEntry;
+	_FromEntry *nextFromEntry;
 
-	_FromEntry* fromEntry = (_FromEntry*)self->entries;
+	_FromEntry *fromEntry = (_FromEntry *) self->entries;
 	while (fromEntry) {
 		toEntry = fromEntry->toEntries;
 		while (toEntry) {
@@ -96,19 +96,20 @@ void spAnimationStateData_dispose (spAnimationStateData* self) {
 	FREE(self);
 }
 
-void spAnimationStateData_setMixByName (spAnimationStateData* self, const char* fromName, const char* toName, float duration) {
-	spAnimation* to;
-	spAnimation* from = spSkeletonData_findAnimation(self->skeletonData, fromName);
+void spAnimationStateData_setMixByName(spAnimationStateData *self, const char *fromName, const char *toName,
+									   float duration) {
+	spAnimation *to;
+	spAnimation *from = spSkeletonData_findAnimation(self->skeletonData, fromName);
 	if (!from) return;
 	to = spSkeletonData_findAnimation(self->skeletonData, toName);
 	if (!to) return;
 	spAnimationStateData_setMix(self, from, to, duration);
 }
 
-void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from, spAnimation* to, float duration) {
+void spAnimationStateData_setMix(spAnimationStateData *self, spAnimation *from, spAnimation *to, float duration) {
 	/* Find existing FromEntry. */
-	_ToEntry* toEntry;
-	_FromEntry* fromEntry = (_FromEntry*)self->entries;
+	_ToEntry *toEntry;
+	_FromEntry *fromEntry = (_FromEntry *) self->entries;
 	while (fromEntry) {
 		if (fromEntry->animation == from) {
 			/* Find existing ToEntry. */
@@ -126,7 +127,7 @@ void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from,
 	}
 	if (!fromEntry) {
 		fromEntry = _FromEntry_create(from);
-		fromEntry->next = (_FromEntry*)self->entries;
+		fromEntry->next = (_FromEntry *) self->entries;
 		CONST_CAST(_FromEntry*, self->entries) = fromEntry;
 	}
 	toEntry = _ToEntry_create(to, duration);
@@ -134,11 +135,11 @@ void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation* from,
 	fromEntry->toEntries = toEntry;
 }
 
-float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to) {
-	_FromEntry* fromEntry = (_FromEntry*)self->entries;
+float spAnimationStateData_getMix(spAnimationStateData *self, spAnimation *from, spAnimation *to) {
+	_FromEntry *fromEntry = (_FromEntry *) self->entries;
 	while (fromEntry) {
 		if (fromEntry->animation == from) {
-			_ToEntry* toEntry = fromEntry->toEntries;
+			_ToEntry *toEntry = fromEntry->toEntries;
 			while (toEntry) {
 				if (toEntry->animation == to) return toEntry->duration;
 				toEntry = toEntry->next;

+ 5 - 0
spine-c/spine-c/src/spine/Array.c

@@ -31,8 +31,13 @@
 #include <spine/extension.h>
 
 _SP_ARRAY_IMPLEMENT_TYPE(spFloatArray, float)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spIntArray, int)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spShortArray, short)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spUnsignedShortArray, unsigned short)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spArrayFloatArray, spFloatArray*)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spArrayShortArray, spShortArray*)

+ 288 - 276
spine-c/spine-c/src/spine/Atlas.c

@@ -32,70 +32,81 @@
 #include <spine/extension.h>
 
 spKeyValueArray *spKeyValueArray_create(int initialCapacity) {
-    spKeyValueArray *array = ((spKeyValueArray *) _spCalloc(1, sizeof(spKeyValueArray), "_file_name_", 39));
-    array->size = 0;
-    array->capacity = initialCapacity;
-    array->items = ((spKeyValue *) _spCalloc(initialCapacity, sizeof(spKeyValue), "_file_name_", 39));
-    return array;
+	spKeyValueArray *array = ((spKeyValueArray *) _spCalloc(1, sizeof(spKeyValueArray), "_file_name_", 39));
+	array->size = 0;
+	array->capacity = initialCapacity;
+	array->items = ((spKeyValue *) _spCalloc(initialCapacity, sizeof(spKeyValue), "_file_name_", 39));
+	return array;
 }
+
 void spKeyValueArray_dispose(spKeyValueArray *self) {
-    _spFree((void *) self->items);
-    _spFree((void *) self);
+	_spFree((void *) self->items);
+	_spFree((void *) self);
 }
+
 void spKeyValueArray_clear(spKeyValueArray *self) { self->size = 0; }
+
 spKeyValueArray *spKeyValueArray_setSize(spKeyValueArray *self, int newSize) {
-    self->size = newSize;
-    if (self->capacity < newSize) {
-        self->capacity = ((8) > ((int) (self->size * 1.75f)) ? (8) : ((int) (self->size * 1.75f)));
-        self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
-    }
-    return self;
+	self->size = newSize;
+	if (self->capacity < newSize) {
+		self->capacity = ((8) > ((int) (self->size * 1.75f)) ? (8) : ((int) (self->size * 1.75f)));
+		self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
+	}
+	return self;
 }
+
 void spKeyValueArray_ensureCapacity(spKeyValueArray *self, int newCapacity) {
-    if (self->capacity >= newCapacity)return;
-    self->capacity = newCapacity;
-    self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
+	if (self->capacity >= newCapacity)return;
+	self->capacity = newCapacity;
+	self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
 }
+
 void spKeyValueArray_add(spKeyValueArray *self, spKeyValue value) {
-    if (self->size == self->capacity) {
-        self->capacity = ((8) > ((int) (self->size * 1.75f)) ? (8) : ((int) (self->size * 1.75f)));
-        self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
-    }
-    self->items[self->size++] = value;
+	if (self->size == self->capacity) {
+		self->capacity = ((8) > ((int) (self->size * 1.75f)) ? (8) : ((int) (self->size * 1.75f)));
+		self->items = ((spKeyValue *) _spRealloc(self->items, sizeof(spKeyValue) * (self->capacity)));
+	}
+	self->items[self->size++] = value;
 }
+
 void spKeyValueArray_addAll(spKeyValueArray *self, spKeyValueArray *other) {
-    int i = 0;
-    for (; i < other->size; i++) { spKeyValueArray_add(self, other->items[i]); }
+	int i = 0;
+	for (; i < other->size; i++) { spKeyValueArray_add(self, other->items[i]); }
 }
+
 void spKeyValueArray_addAllValues(spKeyValueArray *self, spKeyValue *values, int offset, int count) {
-    int i = offset, n = offset + count;
-    for (; i < n; i++) { spKeyValueArray_add(self, values[i]); }
+	int i = offset, n = offset + count;
+	for (; i < n; i++) { spKeyValueArray_add(self, values[i]); }
 }
+
 void spKeyValueArray_removeAt(spKeyValueArray *self, int index) {
-    self->size--;
-    __builtin___memmove_chk(self->items + index, self->items + index + 1, sizeof(spKeyValue) * (self->size - index),
-                            __builtin_object_size(self->items + index, 0));
+	self->size--;
+	__builtin___memmove_chk(self->items + index, self->items + index + 1, sizeof(spKeyValue) * (self->size - index),
+							__builtin_object_size(self->items + index, 0));
 }
+
 int spKeyValueArray_contains(spKeyValueArray *self, spKeyValue value) {
-    spKeyValue *items = self->items;
-    int i, n;
-    for (i = 0, n = self->size; i < n; i++) { if (!strcmp(items[i].name, value.name))return -1; }
-    return 0;
+	spKeyValue *items = self->items;
+	int i, n;
+	for (i = 0, n = self->size; i < n; i++) { if (!strcmp(items[i].name, value.name))return -1; }
+	return 0;
 }
+
 spKeyValue spKeyValueArray_pop(spKeyValueArray *self) {
-    spKeyValue item = self->items[--self->size];
-    return item;
+	spKeyValue item = self->items[--self->size];
+	return item;
 }
+
 spKeyValue spKeyValueArray_peek(spKeyValueArray *self) { return self->items[self->size - 1]; }
 
-spAtlasPage* spAtlasPage_create(spAtlas* atlas, const char* name) {
-	spAtlasPage* self = NEW(spAtlasPage);
+spAtlasPage *spAtlasPage_create(spAtlas *atlas, const char *name) {
+	spAtlasPage *self = NEW(spAtlasPage);
 	CONST_CAST(spAtlas*, self->atlas) = atlas;
 	MALLOC_STR(self->name, name);
 	return self;
 }
 
-void spAtlasPage_dispose(spAtlasPage* self) {
+void spAtlasPage_dispose(spAtlasPage *self) {
 	_spAtlasPage_disposeTexture(self);
 	FREE(self->name);
 	FREE(self);
@@ -103,19 +114,19 @@ void spAtlasPage_dispose(spAtlasPage* self) {
 
 /**/
 
-spAtlasRegion* spAtlasRegion_create() {
+spAtlasRegion *spAtlasRegion_create() {
 	spAtlasRegion *region = NEW(spAtlasRegion);
 	region->keyValues = spKeyValueArray_create(2);
 	return region;
 }
 
-void spAtlasRegion_dispose(spAtlasRegion* self) {
-    int i, n;
+void spAtlasRegion_dispose(spAtlasRegion *self) {
+	int i, n;
 	FREE(self->name);
 	FREE(self->splits);
 	FREE(self->pads);
 	for (i = 0, n = self->keyValues->size; i < n; i++) {
-	    FREE(self->keyValues->items[i].name);
+		FREE(self->keyValues->items[i].name);
 	}
 	spKeyValueArray_dispose(self->keyValues);
 	FREE(self);
@@ -124,147 +135,148 @@ void spAtlasRegion_dispose(spAtlasRegion* self) {
 /**/
 
 typedef struct SimpleString {
-    char *start;
-    char* end;
-    int length;
+	char *start;
+	char *end;
+	int length;
 } SimpleString;
 
 static SimpleString *ss_trim(SimpleString *self) {
-  while (isspace((unsigned char) *self->start) && self->start < self->end)
-    self->start++;
-  if (self->start == self->end) return self;
-  self->end--;
-  while (((unsigned char)*self->end == '\r') && self->end >= self->start)
-    self->end--;
-  self->end++;
-  self->length = self->end - self->start;
-  return self;
+	while (isspace((unsigned char) *self->start) && self->start < self->end)
+		self->start++;
+	if (self->start == self->end) return self;
+	self->end--;
+	while (((unsigned char) *self->end == '\r') && self->end >= self->start)
+		self->end--;
+	self->end++;
+	self->length = self->end - self->start;
+	return self;
 }
 
 static int ss_indexOf(SimpleString *self, char needle) {
-  char *c = self->start;
-  while (c < self->end) {
-    if (*c == needle) return c - self->start;
-    c++;
-  }
-  return -1;
+	char *c = self->start;
+	while (c < self->end) {
+		if (*c == needle) return c - self->start;
+		c++;
+	}
+	return -1;
 }
 
 static int ss_indexOf2(SimpleString *self, char needle, int at) {
-  char *c = self->start + at;
-  while (c < self->end) {
-    if (*c == needle) return c - self->start;
-    c++;
-  }
-  return -1;
+	char *c = self->start + at;
+	while (c < self->end) {
+		if (*c == needle) return c - self->start;
+		c++;
+	}
+	return -1;
 }
 
 static SimpleString ss_substr(SimpleString *self, int s, int e) {
-  SimpleString result;
-  e = s + e;
-  result.start = self->start + s;
-  result.end = self->start + e;
-  result.length = e - s;
-  return result;
+	SimpleString result;
+	e = s + e;
+	result.start = self->start + s;
+	result.end = self->start + e;
+	result.length = e - s;
+	return result;
 }
 
 static SimpleString ss_substr2(SimpleString *self, int s) {
-  SimpleString result;
-  result.start = self->start + s;
-  result.end = self->end;
-  result.length = result.end - result.start;
-  return result;
+	SimpleString result;
+	result.start = self->start + s;
+	result.end = self->end;
+	result.length = result.end - result.start;
+	return result;
 }
+
 static int /*boolean*/ ss_equals(SimpleString *self, const char *str) {
-  int i;
-  int otherLen = strlen(str);
-  if (self->length != otherLen) return 0;
-  for (i = 0; i < self->length; i++) {
-    if (self->start[i] != str[i]) return 0;
-  }
-  return -1;
+	int i;
+	int otherLen = strlen(str);
+	if (self->length != otherLen) return 0;
+	for (i = 0; i < self->length; i++) {
+		if (self->start[i] != str[i]) return 0;
+	}
+	return -1;
 }
 
 static char *ss_copy(SimpleString *self) {
-  char *string = CALLOC(char, self->length + 1);
-  memcpy(string, self->start, self->length);
-  string[self->length] = '\0';
-  return string;
+	char *string = CALLOC(char, self->length + 1);
+	memcpy(string, self->start, self->length);
+	string[self->length] = '\0';
+	return string;
 }
 
 static int ss_toInt(SimpleString *self) {
-  return (int) strtol(self->start, &self->end, 10);
+	return (int) strtol(self->start, &self->end, 10);
 }
 
 typedef struct AtlasInput {
-    const char *start;
-    const char *end;
-    char *index;
-    int length;
-    SimpleString line;
+	const char *start;
+	const char *end;
+	char *index;
+	int length;
+	SimpleString line;
 } AtlasInput;
 
 static SimpleString *ai_readLine(AtlasInput *self) {
-  if (self->index >= self->end) return 0;
-  self->line.start = self->index;
-  while (self->index < self->end && *self->index != '\n')
-    self->index++;
-  self->line.end = self->index;
-  if (self->index != self->end) self->index++;
-  self->line = *ss_trim(&self->line);
-  self->line.length = self->end - self->start;
-  return &self->line;
+	if (self->index >= self->end) return 0;
+	self->line.start = self->index;
+	while (self->index < self->end && *self->index != '\n')
+		self->index++;
+	self->line.end = self->index;
+	if (self->index != self->end) self->index++;
+	self->line = *ss_trim(&self->line);
+	self->line.length = self->end - self->start;
+	return &self->line;
 }
 
 static int ai_readEntry(SimpleString entry[5], SimpleString *line) {
-  int colon, i, lastMatch;
-  SimpleString substr;
-  if (line == NULL) return 0;
-  ss_trim(line);
-  if (line->length == 0) return 0;
-
-  colon = ss_indexOf(line, ':');
-  if (colon == -1) return 0;
-  substr = ss_substr(line, 0, colon);
-  entry[0] = *ss_trim(&substr);
-  for (i = 1, lastMatch = colon + 1;; i++) {
-    int comma = ss_indexOf2(line, ',', lastMatch);
-    if (comma == -1) {
-      substr = ss_substr2(line, lastMatch);
-      entry[i] = *ss_trim(&substr);
-      return i;
-    }
-    substr = ss_substr(line, lastMatch, comma - lastMatch);
-    entry[i] = *ss_trim(&substr);
-    lastMatch = comma + 1;
-    if (i == 4) return 4;
-  }
+	int colon, i, lastMatch;
+	SimpleString substr;
+	if (line == NULL) return 0;
+	ss_trim(line);
+	if (line->length == 0) return 0;
+
+	colon = ss_indexOf(line, ':');
+	if (colon == -1) return 0;
+	substr = ss_substr(line, 0, colon);
+	entry[0] = *ss_trim(&substr);
+	for (i = 1, lastMatch = colon + 1;; i++) {
+		int comma = ss_indexOf2(line, ',', lastMatch);
+		if (comma == -1) {
+			substr = ss_substr2(line, lastMatch);
+			entry[i] = *ss_trim(&substr);
+			return i;
+		}
+		substr = ss_substr(line, lastMatch, comma - lastMatch);
+		entry[i] = *ss_trim(&substr);
+		lastMatch = comma + 1;
+		if (i == 4) return 4;
+	}
 }
 
 static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888",
-                                    "RGBA8888"};
+									"RGBA8888"};
 static const char *textureFilterNames[] = {"", "Nearest", "Linear", "MipMap", "MipMapNearestNearest",
-                                           "MipMapLinearNearest",
-                                           "MipMapNearestLinear", "MipMapLinearLinear"};
+										   "MipMapLinearNearest",
+										   "MipMapNearestLinear", "MipMapLinearLinear"};
 
 int indexOf(const char **array, int count, SimpleString *str) {
-    int i;
-    for (i = 0; i < count; i++)
-        if (ss_equals(str, array[i])) return i;
-    return 0;
+	int i;
+	for (i = 0; i < count; i++)
+		if (ss_equals(str, array[i])) return i;
+	return 0;
 }
 
-spAtlas* spAtlas_create(const char* begin, int length, const char* dir, void* rendererObject) {
-	spAtlas* self;
-    AtlasInput reader;
-    SimpleString *line;
-    SimpleString entry[5];
-    spAtlasPage *page = NULL;
-    spAtlasPage *lastPage = NULL;
-    spAtlasRegion *lastRegion = NULL;
+spAtlas *spAtlas_create(const char *begin, int length, const char *dir, void *rendererObject) {
+	spAtlas *self;
+	AtlasInput reader;
+	SimpleString *line;
+	SimpleString entry[5];
+	spAtlasPage *page = NULL;
+	spAtlasPage *lastPage = NULL;
+	spAtlasRegion *lastRegion = NULL;
 
 	int count;
-	int dirLength = (int)strlen(dir);
+	int dirLength = (int) strlen(dir);
 	int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\';
 
 	self = NEW(spAtlas);
@@ -272,149 +284,149 @@ spAtlas* spAtlas_create(const char* begin, int length, const char* dir, void* re
 
 	reader.start = begin;
 	reader.end = begin + length;
-	reader.index = (char*)begin;
+	reader.index = (char *) begin;
 	reader.length = length;
 
-    line = ai_readLine(&reader);
-    while (line != NULL && line->length == 0)
-        line = ai_readLine(&reader);
-
-    while (-1) {
-        if (line == NULL || line->length == 0) break;
-        if (ai_readEntry(entry, line) == 0) break;
-        line = ai_readLine(&reader);
-    }
-
-    while (-1) {
-        if (line == NULL) break;
-        if (ss_trim(line)->length == 0) {
-            page = NULL;
-            line = ai_readLine(&reader);
-        } else if (page == NULL) {
-            char *name = ss_copy(line);
-            char *path = CALLOC(char, dirLength + needsSlash + strlen(name) + 1);
-            memcpy(path, dir, dirLength);
-            if (needsSlash) path[dirLength] = '/';
-            strcpy(path + dirLength + needsSlash, name);
-            page = spAtlasPage_create(self, name);
-            FREE(name);
-
-            if (lastPage)
-                lastPage->next = page;
-            else
-                self->pages = page;
-            lastPage = page;
-
-            while (-1) {
-                line = ai_readLine(&reader);
-                if (ai_readEntry(entry, line) == 0) break;
-                if (ss_equals(&entry[0], "size")) {
-                    page->width = ss_toInt(&entry[1]);
-                    page->height = ss_toInt(&entry[2]);
-                } else if (ss_equals(&entry[0], "format")) {
-                    page->format = (spAtlasFormat) indexOf(formatNames, 8, &entry[1]);
-                } else if (ss_equals(&entry[0], "filter")) {
-                    page->minFilter = (spAtlasFilter) indexOf(textureFilterNames, 8, &entry[1]);
-                    page->magFilter = (spAtlasFilter) indexOf(textureFilterNames, 8, &entry[2]);
-                } else if (ss_equals(&entry[0], "repeat")) {
-                    page->uWrap = SP_ATLAS_CLAMPTOEDGE;
-                    page->vWrap = SP_ATLAS_CLAMPTOEDGE;
-                    if (ss_indexOf(&entry[1], 'x') != -1) page->uWrap = SP_ATLAS_REPEAT;
-                    if (ss_indexOf(&entry[1], 'y') != -1) page->vWrap = SP_ATLAS_REPEAT;
-                } else if (ss_equals(&entry[0], "pma")) {
-                    page->pma = ss_equals(&entry[1], "true");
-                }
-            }
-
-            _spAtlasPage_createTexture(page, path);
-            FREE(path);
-        } else {
-            spAtlasRegion *region = spAtlasRegion_create();
-            if (lastRegion)
-                lastRegion->next = region;
-            else
-                self->regions = region;
-            lastRegion = region;
-            region->page = page;
-            region->name = ss_copy(line);
-            while (-1) {
-                line = ai_readLine(&reader);
-                count = ai_readEntry(entry, line);
-                if (count == 0) break;
-                if (ss_equals(&entry[0], "xy")) {
-                    region->x = ss_toInt(&entry[1]);
-                    region->y = ss_toInt(&entry[2]);
-                } else if (ss_equals(&entry[0], "size")) {
-                    region->width = ss_toInt(&entry[1]);
-                    region->height = ss_toInt(&entry[2]);
-                } else if (ss_equals(&entry[0], "bounds")) {
-                    region->x = ss_toInt(&entry[1]);
-                    region->y = ss_toInt(&entry[2]);
-                    region->width = ss_toInt(&entry[3]);
-                    region->height = ss_toInt(&entry[4]);
-                } else if (ss_equals(&entry[0], "offset")) {
-                    region->offsetX = ss_toInt(&entry[1]);
-                    region->offsetY = ss_toInt(&entry[2]);
-                } else if (ss_equals(&entry[0], "orig")) {
-                    region->originalWidth = ss_toInt(&entry[1]);
-                    region->originalHeight = ss_toInt(&entry[2]);
-                } else if (ss_equals(&entry[0], "offsets")) {
-                    region->offsetX = ss_toInt(&entry[1]);
-                    region->offsetY = ss_toInt(&entry[2]);
-                    region->originalWidth = ss_toInt(&entry[3]);
-                    region->originalHeight = ss_toInt(&entry[4]);
-                } else if (ss_equals(&entry[0], "rotate")) {
-                    if (ss_equals(&entry[1], "true")) {
-                        region->degrees = 90;
-                    } else if (!ss_equals(&entry[1], "false")) {
-                        region->degrees = ss_toInt(&entry[1]);
-                    }
-                } else if (ss_equals(&entry[0], "index")) {
-                    region->index = ss_toInt(&entry[1]);
-                } else {
-                    int i = 0;
-                    spKeyValue keyValue;
-                    keyValue.name = ss_copy(&entry[0]);
-                    for (i = 0; i < count; i++) {
-                        keyValue.values[i] = ss_toInt(&entry[i + 1]);
-                    }
-                    spKeyValueArray_add(region->keyValues, keyValue);
-                }
-            }
-            if (region->originalWidth == 0 && region->originalHeight == 0) {
-                region->originalWidth = region->width;
-                region->originalHeight = region->height;
-            }
-
-            region->u = (float)region->x / page->width;
-            region->v = (float)region->y / page->height;
-            if (region->degrees == 90) {
-                region->u2 = (float)(region->x + region->height) / page->width;
-                region->v2 = (float)(region->y + region->width) / page->height;
-            } else {
-                region->u2 = (float)(region->x + region->width) / page->width;
-                region->v2 = (float)(region->y + region->height) / page->height;
-            }
-        }
-    }
+	line = ai_readLine(&reader);
+	while (line != NULL && line->length == 0)
+		line = ai_readLine(&reader);
+
+	while (-1) {
+		if (line == NULL || line->length == 0) break;
+		if (ai_readEntry(entry, line) == 0) break;
+		line = ai_readLine(&reader);
+	}
+
+	while (-1) {
+		if (line == NULL) break;
+		if (ss_trim(line)->length == 0) {
+			page = NULL;
+			line = ai_readLine(&reader);
+		} else if (page == NULL) {
+			char *name = ss_copy(line);
+			char *path = CALLOC(char, dirLength + needsSlash + strlen(name) + 1);
+			memcpy(path, dir, dirLength);
+			if (needsSlash) path[dirLength] = '/';
+			strcpy(path + dirLength + needsSlash, name);
+			page = spAtlasPage_create(self, name);
+			FREE(name);
+
+			if (lastPage)
+				lastPage->next = page;
+			else
+				self->pages = page;
+			lastPage = page;
+
+			while (-1) {
+				line = ai_readLine(&reader);
+				if (ai_readEntry(entry, line) == 0) break;
+				if (ss_equals(&entry[0], "size")) {
+					page->width = ss_toInt(&entry[1]);
+					page->height = ss_toInt(&entry[2]);
+				} else if (ss_equals(&entry[0], "format")) {
+					page->format = (spAtlasFormat) indexOf(formatNames, 8, &entry[1]);
+				} else if (ss_equals(&entry[0], "filter")) {
+					page->minFilter = (spAtlasFilter) indexOf(textureFilterNames, 8, &entry[1]);
+					page->magFilter = (spAtlasFilter) indexOf(textureFilterNames, 8, &entry[2]);
+				} else if (ss_equals(&entry[0], "repeat")) {
+					page->uWrap = SP_ATLAS_CLAMPTOEDGE;
+					page->vWrap = SP_ATLAS_CLAMPTOEDGE;
+					if (ss_indexOf(&entry[1], 'x') != -1) page->uWrap = SP_ATLAS_REPEAT;
+					if (ss_indexOf(&entry[1], 'y') != -1) page->vWrap = SP_ATLAS_REPEAT;
+				} else if (ss_equals(&entry[0], "pma")) {
+					page->pma = ss_equals(&entry[1], "true");
+				}
+			}
+
+			_spAtlasPage_createTexture(page, path);
+			FREE(path);
+		} else {
+			spAtlasRegion *region = spAtlasRegion_create();
+			if (lastRegion)
+				lastRegion->next = region;
+			else
+				self->regions = region;
+			lastRegion = region;
+			region->page = page;
+			region->name = ss_copy(line);
+			while (-1) {
+				line = ai_readLine(&reader);
+				count = ai_readEntry(entry, line);
+				if (count == 0) break;
+				if (ss_equals(&entry[0], "xy")) {
+					region->x = ss_toInt(&entry[1]);
+					region->y = ss_toInt(&entry[2]);
+				} else if (ss_equals(&entry[0], "size")) {
+					region->width = ss_toInt(&entry[1]);
+					region->height = ss_toInt(&entry[2]);
+				} else if (ss_equals(&entry[0], "bounds")) {
+					region->x = ss_toInt(&entry[1]);
+					region->y = ss_toInt(&entry[2]);
+					region->width = ss_toInt(&entry[3]);
+					region->height = ss_toInt(&entry[4]);
+				} else if (ss_equals(&entry[0], "offset")) {
+					region->offsetX = ss_toInt(&entry[1]);
+					region->offsetY = ss_toInt(&entry[2]);
+				} else if (ss_equals(&entry[0], "orig")) {
+					region->originalWidth = ss_toInt(&entry[1]);
+					region->originalHeight = ss_toInt(&entry[2]);
+				} else if (ss_equals(&entry[0], "offsets")) {
+					region->offsetX = ss_toInt(&entry[1]);
+					region->offsetY = ss_toInt(&entry[2]);
+					region->originalWidth = ss_toInt(&entry[3]);
+					region->originalHeight = ss_toInt(&entry[4]);
+				} else if (ss_equals(&entry[0], "rotate")) {
+					if (ss_equals(&entry[1], "true")) {
+						region->degrees = 90;
+					} else if (!ss_equals(&entry[1], "false")) {
+						region->degrees = ss_toInt(&entry[1]);
+					}
+				} else if (ss_equals(&entry[0], "index")) {
+					region->index = ss_toInt(&entry[1]);
+				} else {
+					int i = 0;
+					spKeyValue keyValue;
+					keyValue.name = ss_copy(&entry[0]);
+					for (i = 0; i < count; i++) {
+						keyValue.values[i] = ss_toInt(&entry[i + 1]);
+					}
+					spKeyValueArray_add(region->keyValues, keyValue);
+				}
+			}
+			if (region->originalWidth == 0 && region->originalHeight == 0) {
+				region->originalWidth = region->width;
+				region->originalHeight = region->height;
+			}
+
+			region->u = (float) region->x / page->width;
+			region->v = (float) region->y / page->height;
+			if (region->degrees == 90) {
+				region->u2 = (float) (region->x + region->height) / page->width;
+				region->v2 = (float) (region->y + region->width) / page->height;
+			} else {
+				region->u2 = (float) (region->x + region->width) / page->width;
+				region->v2 = (float) (region->y + region->height) / page->height;
+			}
+		}
+	}
 
 	return self;
 }
 
-spAtlas* spAtlas_createFromFile(const char* path, void* rendererObject) {
+spAtlas *spAtlas_createFromFile(const char *path, void *rendererObject) {
 	int dirLength;
 	char *dir;
 	int length;
-	const char* data;
+	const char *data;
 
-	spAtlas* atlas = 0;
+	spAtlas *atlas = 0;
 
 	/* Get directory from atlas path. */
-	const char* lastForwardSlash = strrchr(path, '/');
-	const char* lastBackwardSlash = strrchr(path, '\\');
-	const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
+	const char *lastForwardSlash = strrchr(path, '/');
+	const char *lastBackwardSlash = strrchr(path, '\\');
+	const char *lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
 	if (lastSlash == path) lastSlash++; /* Never drop starting slash. */
-	dirLength = (int)(lastSlash ? lastSlash - path : 0);
+	dirLength = (int) (lastSlash ? lastSlash - path : 0);
 	dir = MALLOC(char, dirLength + 1);
 	memcpy(dir, path, dirLength);
 	dir[dirLength] = '\0';
@@ -427,11 +439,11 @@ spAtlas* spAtlas_createFromFile(const char* path, void* rendererObject) {
 	return atlas;
 }
 
-void spAtlas_dispose(spAtlas* self) {
-	spAtlasRegion* region, *nextRegion;
-	spAtlasPage* page = self->pages;
+void spAtlas_dispose(spAtlas *self) {
+	spAtlasRegion *region, *nextRegion;
+	spAtlasPage *page = self->pages;
 	while (page) {
-		spAtlasPage* nextPage = page->next;
+		spAtlasPage *nextPage = page->next;
 		spAtlasPage_dispose(page);
 		page = nextPage;
 	}
@@ -446,8 +458,8 @@ void spAtlas_dispose(spAtlas* self) {
 	FREE(self);
 }
 
-spAtlasRegion* spAtlas_findRegion(const spAtlas* self, const char* name) {
-	spAtlasRegion* region = self->regions;
+spAtlasRegion *spAtlas_findRegion(const spAtlas *self, const char *name) {
+	spAtlasRegion *region = self->regions;
 	while (region) {
 		if (strcmp(region->name, name) == 0) return region;
 		region = region->next;

+ 55 - 55
spine-c/spine-c/src/spine/AtlasAttachmentLoader.c

@@ -30,69 +30,69 @@
 #include <spine/AtlasAttachmentLoader.h>
 #include <spine/extension.h>
 
-spAttachment* _spAtlasAttachmentLoader_createAttachment (spAttachmentLoader* loader, spSkin* skin, spAttachmentType type,
-		const char* name, const char* path) {
-	spAtlasAttachmentLoader* self = SUB_CAST(spAtlasAttachmentLoader, loader);
+spAttachment *_spAtlasAttachmentLoader_createAttachment(spAttachmentLoader *loader, spSkin *skin, spAttachmentType type,
+														const char *name, const char *path) {
+	spAtlasAttachmentLoader *self = SUB_CAST(spAtlasAttachmentLoader, loader);
 	switch (type) {
-	case SP_ATTACHMENT_REGION: {
-		spRegionAttachment* attachment;
-		spAtlasRegion* region = spAtlas_findRegion(self->atlas, path);
-		if (!region) {
-			_spAttachmentLoader_setError(loader, "Region not found: ", path);
-			return 0;
+		case SP_ATTACHMENT_REGION: {
+			spRegionAttachment *attachment;
+			spAtlasRegion *region = spAtlas_findRegion(self->atlas, path);
+			if (!region) {
+				_spAttachmentLoader_setError(loader, "Region not found: ", path);
+				return 0;
+			}
+			attachment = spRegionAttachment_create(name);
+			attachment->rendererObject = region;
+			spRegionAttachment_setUVs(attachment, region->u, region->v, region->u2, region->v2, region->degrees);
+			attachment->regionOffsetX = region->offsetX;
+			attachment->regionOffsetY = region->offsetY;
+			attachment->regionWidth = region->width;
+			attachment->regionHeight = region->height;
+			attachment->regionOriginalWidth = region->originalWidth;
+			attachment->regionOriginalHeight = region->originalHeight;
+			return SUPER(attachment);
 		}
-		attachment = spRegionAttachment_create(name);
-		attachment->rendererObject = region;
-		spRegionAttachment_setUVs(attachment, region->u, region->v, region->u2, region->v2, region->degrees);
-		attachment->regionOffsetX = region->offsetX;
-		attachment->regionOffsetY = region->offsetY;
-		attachment->regionWidth = region->width;
-		attachment->regionHeight = region->height;
-		attachment->regionOriginalWidth = region->originalWidth;
-		attachment->regionOriginalHeight = region->originalHeight;
-		return SUPER(attachment);
-	}
-	case SP_ATTACHMENT_MESH:
-	case SP_ATTACHMENT_LINKED_MESH: {
-		spMeshAttachment* attachment;
-		spAtlasRegion* region = spAtlas_findRegion(self->atlas, path);
-		if (!region) {
-			_spAttachmentLoader_setError(loader, "Region not found: ", path);
-			return 0;
+		case SP_ATTACHMENT_MESH:
+		case SP_ATTACHMENT_LINKED_MESH: {
+			spMeshAttachment *attachment;
+			spAtlasRegion *region = spAtlas_findRegion(self->atlas, path);
+			if (!region) {
+				_spAttachmentLoader_setError(loader, "Region not found: ", path);
+				return 0;
+			}
+			attachment = spMeshAttachment_create(name);
+			attachment->rendererObject = region;
+			attachment->regionU = region->u;
+			attachment->regionV = region->v;
+			attachment->regionU2 = region->u2;
+			attachment->regionV2 = region->v2;
+			attachment->regionDegrees = region->degrees;
+			attachment->regionOffsetX = region->offsetX;
+			attachment->regionOffsetY = region->offsetY;
+			attachment->regionWidth = region->width;
+			attachment->regionHeight = region->height;
+			attachment->regionOriginalWidth = region->originalWidth;
+			attachment->regionOriginalHeight = region->originalHeight;
+			return SUPER(SUPER(attachment));
 		}
-		attachment = spMeshAttachment_create(name);
-		attachment->rendererObject = region;
-		attachment->regionU = region->u;
-		attachment->regionV = region->v;
-		attachment->regionU2 = region->u2;
-		attachment->regionV2 = region->v2;
-		attachment->regionDegrees = region->degrees;
-		attachment->regionOffsetX = region->offsetX;
-		attachment->regionOffsetY = region->offsetY;
-		attachment->regionWidth = region->width;
-		attachment->regionHeight = region->height;
-		attachment->regionOriginalWidth = region->originalWidth;
-		attachment->regionOriginalHeight = region->originalHeight;
-		return SUPER(SUPER(attachment));
-	}
-	case SP_ATTACHMENT_BOUNDING_BOX:
-		return SUPER(SUPER(spBoundingBoxAttachment_create(name)));
-	case SP_ATTACHMENT_PATH:
-		return SUPER(SUPER(spPathAttachment_create(name)));
-	case SP_ATTACHMENT_POINT:
-		return SUPER(spPointAttachment_create(name));
-	case SP_ATTACHMENT_CLIPPING:
-		return SUPER(SUPER(spClippingAttachment_create(name)));
-	default:
-		_spAttachmentLoader_setUnknownTypeError(loader, type);
-		return 0;
+		case SP_ATTACHMENT_BOUNDING_BOX:
+			return SUPER(SUPER(spBoundingBoxAttachment_create(name)));
+		case SP_ATTACHMENT_PATH:
+			return SUPER(SUPER(spPathAttachment_create(name)));
+		case SP_ATTACHMENT_POINT:
+			return SUPER(spPointAttachment_create(name));
+		case SP_ATTACHMENT_CLIPPING:
+			return SUPER(SUPER(spClippingAttachment_create(name)));
+		default:
+			_spAttachmentLoader_setUnknownTypeError(loader, type);
+			return 0;
 	}
 
 	UNUSED(skin);
 }
 
-spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas) {
-	spAtlasAttachmentLoader* self = NEW(spAtlasAttachmentLoader);
+spAtlasAttachmentLoader *spAtlasAttachmentLoader_create(spAtlas *atlas) {
+	spAtlasAttachmentLoader *self = NEW(spAtlasAttachmentLoader);
 	_spAttachmentLoader_init(SUPER(self), _spAttachmentLoader_deinit, _spAtlasAttachmentLoader_createAttachment, 0, 0);
 	self->atlas = atlas;
 	return self;

+ 10 - 9
spine-c/spine-c/src/spine/Attachment.c

@@ -32,12 +32,13 @@
 #include <spine/Slot.h>
 
 typedef struct _spAttachmentVtable {
-	void (*dispose) (spAttachment* self);
-	spAttachment* (*copy) (spAttachment* self);
+	void (*dispose)(spAttachment *self);
+
+	spAttachment *(*copy)(spAttachment *self);
 } _spAttachmentVtable;
 
-void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type, /**/
-		void (*dispose) (spAttachment* self), spAttachment* (*copy) (spAttachment* self)) {
+void _spAttachment_init(spAttachment *self, const char *name, spAttachmentType type, /**/
+						void (*dispose)(spAttachment *self), spAttachment *(*copy)(spAttachment *self)) {
 
 	CONST_CAST(_spAttachmentVtable*, self->vtable) = NEW(_spAttachmentVtable);
 	VTABLE(spAttachment, self)->dispose = dispose;
@@ -47,18 +48,18 @@ void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType
 	CONST_CAST(spAttachmentType, self->type) = type;
 }
 
-void _spAttachment_deinit (spAttachment* self) {
+void _spAttachment_deinit(spAttachment *self) {
 	if (self->attachmentLoader) spAttachmentLoader_disposeAttachment(self->attachmentLoader, self);
 	FREE(self->vtable);
 	FREE(self->name);
 }
 
-spAttachment* spAttachment_copy (spAttachment* self) {
-	return VTABLE(spAttachment, self) ->copy(self);
+spAttachment *spAttachment_copy(spAttachment *self) {
+	return VTABLE(spAttachment, self)->copy(self);
 }
 
-void spAttachment_dispose (spAttachment* self) {
+void spAttachment_dispose(spAttachment *self) {
 	self->refCount--;
 	if (self->refCount <= 0)
-		VTABLE(spAttachment, self) ->dispose(self);
+		VTABLE(spAttachment, self)->dispose(self);
 }

+ 24 - 18
spine-c/spine-c/src/spine/AttachmentLoader.c

@@ -32,18 +32,23 @@
 #include <spine/extension.h>
 
 typedef struct _spAttachmentLoaderVtable {
-	spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, const char* path);
-	void (*configureAttachment) (spAttachmentLoader* self, spAttachment*);
-	void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*);
-	void (*dispose) (spAttachmentLoader* self);
+	spAttachment *(*createAttachment)(spAttachmentLoader *self, spSkin *skin, spAttachmentType type, const char *name,
+									  const char *path);
+
+	void (*configureAttachment)(spAttachmentLoader *self, spAttachment *);
+
+	void (*disposeAttachment)(spAttachmentLoader *self, spAttachment *);
+
+	void (*dispose)(spAttachmentLoader *self);
 } _spAttachmentLoaderVtable;
 
-void _spAttachmentLoader_init (spAttachmentLoader* self,
-	void (*dispose) (spAttachmentLoader* self),
-	spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name,
-		const char* path),
-	void (*configureAttachment) (spAttachmentLoader* self, spAttachment*),
-	void (*disposeAttachment) (spAttachmentLoader* self, spAttachment*)
+void _spAttachmentLoader_init(spAttachmentLoader *self,
+							  void (*dispose)(spAttachmentLoader *self),
+							  spAttachment *(*createAttachment)(spAttachmentLoader *self, spSkin *skin,
+																spAttachmentType type, const char *name,
+																const char *path),
+							  void (*configureAttachment)(spAttachmentLoader *self, spAttachment *),
+							  void (*disposeAttachment)(spAttachmentLoader *self, spAttachment *)
 ) {
 	CONST_CAST(_spAttachmentLoaderVtable*, self->vtable) = NEW(_spAttachmentLoaderVtable);
 	VTABLE(spAttachmentLoader, self)->dispose = dispose;
@@ -52,19 +57,20 @@ void _spAttachmentLoader_init (spAttachmentLoader* self,
 	VTABLE(spAttachmentLoader, self)->disposeAttachment = disposeAttachment;
 }
 
-void _spAttachmentLoader_deinit (spAttachmentLoader* self) {
+void _spAttachmentLoader_deinit(spAttachmentLoader *self) {
 	FREE(self->vtable);
 	FREE(self->error1);
 	FREE(self->error2);
 }
 
-void spAttachmentLoader_dispose (spAttachmentLoader* self) {
+void spAttachmentLoader_dispose(spAttachmentLoader *self) {
 	VTABLE(spAttachmentLoader, self)->dispose(self);
 	FREE(self);
 }
 
-spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name,
-		const char* path) {
+spAttachment *
+spAttachmentLoader_createAttachment(spAttachmentLoader *self, spSkin *skin, spAttachmentType type, const char *name,
+									const char *path) {
 	FREE(self->error1);
 	FREE(self->error2);
 	self->error1 = 0;
@@ -72,24 +78,24 @@ spAttachment* spAttachmentLoader_createAttachment (spAttachmentLoader* self, spS
 	return VTABLE(spAttachmentLoader, self)->createAttachment(self, skin, type, name, path);
 }
 
-void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, spAttachment* attachment) {
+void spAttachmentLoader_configureAttachment(spAttachmentLoader *self, spAttachment *attachment) {
 	if (!VTABLE(spAttachmentLoader, self)->configureAttachment) return;
 	VTABLE(spAttachmentLoader, self)->configureAttachment(self, attachment);
 }
 
-void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment) {
+void spAttachmentLoader_disposeAttachment(spAttachmentLoader *self, spAttachment *attachment) {
 	if (!VTABLE(spAttachmentLoader, self)->disposeAttachment) return;
 	VTABLE(spAttachmentLoader, self)->disposeAttachment(self, attachment);
 }
 
-void _spAttachmentLoader_setError (spAttachmentLoader* self, const char* error1, const char* error2) {
+void _spAttachmentLoader_setError(spAttachmentLoader *self, const char *error1, const char *error2) {
 	FREE(self->error1);
 	FREE(self->error2);
 	MALLOC_STR(self->error1, error1);
 	MALLOC_STR(self->error2, error2);
 }
 
-void _spAttachmentLoader_setUnknownTypeError (spAttachmentLoader* self, spAttachmentType type) {
+void _spAttachmentLoader_setUnknownTypeError(spAttachmentLoader *self, spAttachmentType type) {
 	char buffer[16];
 	sprintf(buffer, "%d", type);
 	_spAttachmentLoader_setError(self, "Unknown attachment type: ", buffer);

+ 100 - 95
spine-c/spine-c/src/spine/Bone.c

@@ -30,18 +30,19 @@
 #include <spine/Bone.h>
 #include <spine/extension.h>
 #include <stdio.h>
+
 static int yDown;
 
-void spBone_setYDown (int value) {
+void spBone_setYDown(int value) {
 	yDown = value;
 }
 
-int spBone_isYDown () {
+int spBone_isYDown() {
 	return yDown;
 }
 
-spBone* spBone_create (spBoneData* data, spSkeleton* skeleton, spBone* parent) {
-	spBone* self = NEW(spBone);
+spBone *spBone_create(spBoneData *data, spSkeleton *skeleton, spBone *parent) {
+	spBone *self = NEW(spBone);
 	CONST_CAST(spBoneData*, self->data) = data;
 	CONST_CAST(spSkeleton*, self->skeleton) = skeleton;
 	CONST_CAST(spBone*, self->parent) = parent;
@@ -51,19 +52,21 @@ spBone* spBone_create (spBoneData* data, spSkeleton* skeleton, spBone* parent) {
 	return self;
 }
 
-void spBone_dispose (spBone* self) {
+void spBone_dispose(spBone *self) {
 	FREE(self->children);
 	FREE(self);
 }
 
-void spBone_updateWorldTransform (spBone* self) {
-	spBone_updateWorldTransformWith(self, self->x, self->y, self->rotation, self->scaleX, self->scaleY, self->shearX, self->shearY);
+void spBone_updateWorldTransform(spBone *self) {
+	spBone_updateWorldTransformWith(self, self->x, self->y, self->rotation, self->scaleX, self->scaleY, self->shearX,
+									self->shearY);
 }
 
-void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rotation, float scaleX, float scaleY, float shearX, float shearY) {
+void spBone_updateWorldTransformWith(spBone *self, float x, float y, float rotation, float scaleX, float scaleY,
+									 float shearX, float shearY) {
 	float cosine, sine;
 	float pa, pb, pc, pd;
-	spBone* parent = self->parent;
+	spBone *parent = self->parent;
 	float sx = self->skeleton->scaleX;
 	float sy = self->skeleton->scaleY * (spBone_isYDown() ? -1 : 1);
 
@@ -96,80 +99,81 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
 	CONST_CAST(float, self->worldY) = pc * x + pd * y + parent->worldY;
 
 	switch (self->data->transformMode) {
-	case SP_TRANSFORMMODE_NORMAL: {
-		float rotationY = rotation + 90 + shearY;
-		float la = COS_DEG(rotation + shearX) * scaleX;
-		float lb = COS_DEG(rotationY) * scaleY;
-		float lc = SIN_DEG(rotation + shearX) * scaleX;
-		float ld = SIN_DEG(rotationY) * scaleY;
-		CONST_CAST(float, self->a) = pa * la + pb * lc;
-		CONST_CAST(float, self->b) = pa * lb + pb * ld;
-		CONST_CAST(float, self->c) = pc * la + pd * lc;
-		CONST_CAST(float, self->d) = pc * lb + pd * ld;
-		return;
-	}
-	case SP_TRANSFORMMODE_ONLYTRANSLATION: {
-		float rotationY = rotation + 90 + shearY;
-		CONST_CAST(float, self->a) = COS_DEG(rotation + shearX) * scaleX;
-		CONST_CAST(float, self->b) = COS_DEG(rotationY) * scaleY;
-		CONST_CAST(float, self->c) = SIN_DEG(rotation + shearX) * scaleX;
-		CONST_CAST(float, self->d) = SIN_DEG(rotationY) * scaleY;
-		break;
-	}
-	case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: {
-		float s = pa * pa + pc * pc;
-		float prx, rx, ry, la, lb, lc, ld;
-		if (s > 0.0001f) {
-			s = ABS(pa * pd - pb * pc) / s;
-            pa /= self->skeleton->scaleX;
-            pc /= self->skeleton->scaleY;
-			pb = pc * s;
-			pd = pa * s;
-			prx = ATAN2(pc, pa) * RAD_DEG;
-		} else {
-			pa = 0;
-			pc = 0;
-			prx = 90 - ATAN2(pd, pb) * RAD_DEG;
+		case SP_TRANSFORMMODE_NORMAL: {
+			float rotationY = rotation + 90 + shearY;
+			float la = COS_DEG(rotation + shearX) * scaleX;
+			float lb = COS_DEG(rotationY) * scaleY;
+			float lc = SIN_DEG(rotation + shearX) * scaleX;
+			float ld = SIN_DEG(rotationY) * scaleY;
+			CONST_CAST(float, self->a) = pa * la + pb * lc;
+			CONST_CAST(float, self->b) = pa * lb + pb * ld;
+			CONST_CAST(float, self->c) = pc * la + pd * lc;
+			CONST_CAST(float, self->d) = pc * lb + pd * ld;
+			return;
+		}
+		case SP_TRANSFORMMODE_ONLYTRANSLATION: {
+			float rotationY = rotation + 90 + shearY;
+			CONST_CAST(float, self->a) = COS_DEG(rotation + shearX) * scaleX;
+			CONST_CAST(float, self->b) = COS_DEG(rotationY) * scaleY;
+			CONST_CAST(float, self->c) = SIN_DEG(rotation + shearX) * scaleX;
+			CONST_CAST(float, self->d) = SIN_DEG(rotationY) * scaleY;
+			break;
+		}
+		case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: {
+			float s = pa * pa + pc * pc;
+			float prx, rx, ry, la, lb, lc, ld;
+			if (s > 0.0001f) {
+				s = ABS(pa * pd - pb * pc) / s;
+				pa /= self->skeleton->scaleX;
+				pc /= self->skeleton->scaleY;
+				pb = pc * s;
+				pd = pa * s;
+				prx = ATAN2(pc, pa) * RAD_DEG;
+			} else {
+				pa = 0;
+				pc = 0;
+				prx = 90 - ATAN2(pd, pb) * RAD_DEG;
+			}
+			rx = rotation + shearX - prx;
+			ry = rotation + shearY - prx + 90;
+			la = COS_DEG(rx) * scaleX;
+			lb = COS_DEG(ry) * scaleY;
+			lc = SIN_DEG(rx) * scaleX;
+			ld = SIN_DEG(ry) * scaleY;
+			CONST_CAST(float, self->a) = pa * la - pb * lc;
+			CONST_CAST(float, self->b) = pa * lb - pb * ld;
+			CONST_CAST(float, self->c) = pc * la + pd * lc;
+			CONST_CAST(float, self->d) = pc * lb + pd * ld;
+			break;
+		}
+		case SP_TRANSFORMMODE_NOSCALE:
+		case SP_TRANSFORMMODE_NOSCALEORREFLECTION: {
+			float za, zc, s;
+			float r, zb, zd, la, lb, lc, ld;
+			cosine = COS_DEG(rotation);
+			sine = SIN_DEG(rotation);
+			za = (pa * cosine + pb * sine) / sx;
+			zc = (pc * cosine + pd * sine) / sy;
+			s = SQRT(za * za + zc * zc);
+			if (s > 0.00001f) s = 1 / s;
+			za *= s;
+			zc *= s;
+			s = SQRT(za * za + zc * zc);
+			if (self->data->transformMode == SP_TRANSFORMMODE_NOSCALE && (pa * pd - pb * pc < 0) != (sx < 0 != sy < 0))
+				s = -s;
+			r = PI / 2 + ATAN2(zc, za);
+			zb = COS(r) * s;
+			zd = SIN(r) * s;
+			la = COS_DEG(shearX) * scaleX;
+			lb = COS_DEG(90 + shearY) * scaleY;
+			lc = SIN_DEG(shearX) * scaleX;
+			ld = SIN_DEG(90 + shearY) * scaleY;
+			CONST_CAST(float, self->a) = za * la + zb * lc;
+			CONST_CAST(float, self->b) = za * lb + zb * ld;
+			CONST_CAST(float, self->c) = zc * la + zd * lc;
+			CONST_CAST(float, self->d) = zc * lb + zd * ld;
+			break;
 		}
-		rx = rotation + shearX - prx;
-		ry = rotation + shearY - prx + 90;
-		la = COS_DEG(rx) * scaleX;
-		lb = COS_DEG(ry) * scaleY;
-		lc = SIN_DEG(rx) * scaleX;
-		ld = SIN_DEG(ry) * scaleY;
-		CONST_CAST(float, self->a) = pa * la - pb * lc;
-		CONST_CAST(float, self->b) = pa * lb - pb * ld;
-		CONST_CAST(float, self->c) = pc * la + pd * lc;
-		CONST_CAST(float, self->d) = pc * lb + pd * ld;
-		break;
-	}
-	case SP_TRANSFORMMODE_NOSCALE:
-	case SP_TRANSFORMMODE_NOSCALEORREFLECTION: {
-		float za, zc, s;
-		float r, zb, zd, la, lb, lc, ld;
-		cosine = COS_DEG(rotation); sine = SIN_DEG(rotation);
-		za = (pa * cosine + pb * sine) / sx;
-		zc = (pc * cosine + pd * sine) / sy;
-		s = SQRT(za * za + zc * zc);
-		if (s > 0.00001f) s = 1 / s;
-		za *= s;
-		zc *= s;
-		s = SQRT(za * za + zc * zc);
-		if (self->data->transformMode == SP_TRANSFORMMODE_NOSCALE && (pa * pd - pb * pc < 0) != (sx < 0 != sy < 0))
-			s = -s;
-		r = PI / 2 + ATAN2(zc, za);
-		zb = COS(r) * s;
-		zd = SIN(r) * s;
-		la = COS_DEG(shearX) * scaleX;
-		lb = COS_DEG(90 + shearY) * scaleY;
-		lc = SIN_DEG(shearX) * scaleX;
-		ld = SIN_DEG(90 + shearY) * scaleY;
-		CONST_CAST(float, self->a) = za * la + zb * lc;
-		CONST_CAST(float, self->b) = za * lb + zb * ld;
-		CONST_CAST(float, self->c) = zc * la + zd * lc;
-		CONST_CAST(float, self->d) = zc * lb + zd * ld;
-		break;
-	}
 	}
 
 	CONST_CAST(float, self->a) *= sx;
@@ -178,7 +182,7 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
 	CONST_CAST(float, self->d) *= sy;
 }
 
-void spBone_setToSetupPose (spBone* self) {
+void spBone_setToSetupPose(spBone *self) {
 	self->x = self->data->x;
 	self->y = self->data->y;
 	self->rotation = self->data->rotation;
@@ -188,19 +192,19 @@ void spBone_setToSetupPose (spBone* self) {
 	self->shearY = self->data->shearY;
 }
 
-float spBone_getWorldRotationX (spBone* self) {
+float spBone_getWorldRotationX(spBone *self) {
 	return ATAN2(self->c, self->a) * RAD_DEG;
 }
 
-float spBone_getWorldRotationY (spBone* self) {
+float spBone_getWorldRotationY(spBone *self) {
 	return ATAN2(self->d, self->b) * RAD_DEG;
 }
 
-float spBone_getWorldScaleX (spBone* self) {
+float spBone_getWorldScaleX(spBone *self) {
 	return SQRT(self->a * self->a + self->c * self->c);
 }
 
-float spBone_getWorldScaleY (spBone* self) {
+float spBone_getWorldScaleY(spBone *self) {
 	return SQRT(self->b * self->b + self->d * self->d);
 }
 
@@ -208,8 +212,8 @@ float spBone_getWorldScaleY (spBone* self) {
  * the applied transform after the world transform has been modified directly (eg, by a constraint).
  * <p>
  * Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. */
-void spBone_updateAppliedTransform (spBone* self) {
-	spBone* parent = self->parent;
+void spBone_updateAppliedTransform(spBone *self) {
+	spBone *parent = self->parent;
 	self->appliedValid = 1;
 	if (!parent) {
 		self->ax = self->worldX;
@@ -249,27 +253,28 @@ void spBone_updateAppliedTransform (spBone* self) {
 	}
 }
 
-void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY) {
+void spBone_worldToLocal(spBone *self, float worldX, float worldY, float *localX, float *localY) {
 	float invDet = 1 / (self->a * self->d - self->b * self->c);
 	float x = worldX - self->worldX, y = worldY - self->worldY;
 	*localX = (x * self->d * invDet - y * self->b * invDet);
 	*localY = (y * self->a * invDet - x * self->c * invDet);
 }
 
-void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY) {
+void spBone_localToWorld(spBone *self, float localX, float localY, float *worldX, float *worldY) {
 	float x = localX, y = localY;
 	*worldX = x * self->a + y * self->b + self->worldX;
 	*worldY = x * self->c + y * self->d + self->worldY;
 }
 
-float spBone_worldToLocalRotation (spBone* self, float worldRotation) {
+float spBone_worldToLocalRotation(spBone *self, float worldRotation) {
 	float sine, cosine;
 	sine = SIN_DEG(worldRotation);
 	cosine = COS_DEG(worldRotation);
-	return ATAN2(self->a * sine - self->c * cosine, self->d * cosine - self->b * sine) * RAD_DEG + self->rotation - self->shearX;
+	return ATAN2(self->a * sine - self->c * cosine, self->d * cosine - self->b * sine) * RAD_DEG + self->rotation -
+		   self->shearX;
 }
 
-float spBone_localToWorldRotation (spBone* self, float localRotation) {
+float spBone_localToWorldRotation(spBone *self, float localRotation) {
 	float sine, cosine;
 	localRotation -= self->rotation - self->shearX;
 	sine = SIN_DEG(localRotation);
@@ -277,7 +282,7 @@ float spBone_localToWorldRotation (spBone* self, float localRotation) {
 	return ATAN2(cosine * self->c + sine * self->d, cosine * self->a + sine * self->b) * RAD_DEG;
 }
 
-void spBone_rotateWorld (spBone* self, float degrees) {
+void spBone_rotateWorld(spBone *self, float degrees) {
 	float a = self->a, b = self->b, c = self->c, d = self->d;
 	float cosine = COS_DEG(degrees), sine = SIN_DEG(degrees);
 	CONST_CAST(float, self->a) = cosine * a - sine * c;

+ 3 - 3
spine-c/spine-c/src/spine/BoneData.c

@@ -30,8 +30,8 @@
 #include <spine/BoneData.h>
 #include <spine/extension.h>
 
-spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent) {
-	spBoneData* self = NEW(spBoneData);
+spBoneData *spBoneData_create(int index, const char *name, spBoneData *parent) {
+	spBoneData *self = NEW(spBoneData);
 	CONST_CAST(int, self->index) = index;
 	MALLOC_STR(self->name, name);
 	CONST_CAST(spBoneData*, self->parent) = parent;
@@ -41,7 +41,7 @@ spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent)
 	return self;
 }
 
-void spBoneData_dispose (spBoneData* self) {
+void spBoneData_dispose(spBoneData *self) {
 	FREE(self->name);
 	FREE(self);
 }

+ 9 - 8
spine-c/spine-c/src/spine/BoundingBoxAttachment.c

@@ -30,24 +30,25 @@
 #include <spine/BoundingBoxAttachment.h>
 #include <spine/extension.h>
 
-void _spBoundingBoxAttachment_dispose (spAttachment* attachment) {
-	spBoundingBoxAttachment* self = SUB_CAST(spBoundingBoxAttachment, attachment);
+void _spBoundingBoxAttachment_dispose(spAttachment *attachment) {
+	spBoundingBoxAttachment *self = SUB_CAST(spBoundingBoxAttachment, attachment);
 
 	_spVertexAttachment_deinit(SUPER(self));
 
 	FREE(self);
 }
 
-spAttachment* _spBoundingBoxAttachment_copy (spAttachment* attachment) {
-	spBoundingBoxAttachment* copy = spBoundingBoxAttachment_create(attachment->name);
-	spBoundingBoxAttachment* self = SUB_CAST(spBoundingBoxAttachment, attachment);
+spAttachment *_spBoundingBoxAttachment_copy(spAttachment *attachment) {
+	spBoundingBoxAttachment *copy = spBoundingBoxAttachment_create(attachment->name);
+	spBoundingBoxAttachment *self = SUB_CAST(spBoundingBoxAttachment, attachment);
 	spVertexAttachment_copyTo(SUPER(self), SUPER(copy));
 	return SUPER(SUPER(copy));
 }
 
-spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name) {
-	spBoundingBoxAttachment* self = NEW(spBoundingBoxAttachment);
+spBoundingBoxAttachment *spBoundingBoxAttachment_create(const char *name) {
+	spBoundingBoxAttachment *self = NEW(spBoundingBoxAttachment);
 	_spVertexAttachment_init(SUPER(self));
-	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_BOUNDING_BOX, _spBoundingBoxAttachment_dispose, _spBoundingBoxAttachment_copy);
+	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_BOUNDING_BOX, _spBoundingBoxAttachment_dispose,
+					   _spBoundingBoxAttachment_copy);
 	return self;
 }

+ 9 - 8
spine-c/spine-c/src/spine/ClippingAttachment.c

@@ -30,26 +30,27 @@
 #include <spine/ClippingAttachment.h>
 #include <spine/extension.h>
 
-void _spClippingAttachment_dispose (spAttachment* attachment) {
-	spClippingAttachment* self = SUB_CAST(spClippingAttachment, attachment);
+void _spClippingAttachment_dispose(spAttachment *attachment) {
+	spClippingAttachment *self = SUB_CAST(spClippingAttachment, attachment);
 
 	_spVertexAttachment_deinit(SUPER(self));
 
 	FREE(self);
 }
 
-spAttachment* _spClippingAttachment_copy (spAttachment* attachment) {
-	spClippingAttachment* copy = spClippingAttachment_create(attachment->name);
-	spClippingAttachment* self = SUB_CAST(spClippingAttachment, attachment);
+spAttachment *_spClippingAttachment_copy(spAttachment *attachment) {
+	spClippingAttachment *copy = spClippingAttachment_create(attachment->name);
+	spClippingAttachment *self = SUB_CAST(spClippingAttachment, attachment);
 	spVertexAttachment_copyTo(SUPER(self), SUPER(copy));
 	copy->endSlot = self->endSlot;
 	return SUPER(SUPER(copy));
 }
 
-spClippingAttachment* spClippingAttachment_create (const char* name) {
-	spClippingAttachment* self = NEW(spClippingAttachment);
+spClippingAttachment *spClippingAttachment_create(const char *name) {
+	spClippingAttachment *self = NEW(spClippingAttachment);
 	_spVertexAttachment_init(SUPER(self));
-	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_CLIPPING, _spClippingAttachment_dispose, _spClippingAttachment_copy);
+	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_CLIPPING, _spClippingAttachment_dispose,
+					   _spClippingAttachment_copy);
 	self->endSlot = 0;
 	return self;
 }

+ 21 - 21
spine-c/spine-c/src/spine/Color.c

@@ -30,15 +30,15 @@
 #include <spine/Color.h>
 #include <spine/extension.h>
 
-spColor* spColor_create() {
+spColor *spColor_create() {
 	return MALLOC(spColor, 1);
 }
 
-void spColor_dispose(spColor* self) {
+void spColor_dispose(spColor *self) {
 	if (self) FREE(self);
 }
 
-void spColor_setFromFloats(spColor* self, float r, float g, float b, float a) {
+void spColor_setFromFloats(spColor *self, float r, float g, float b, float a) {
 	self->r = r;
 	self->g = g;
 	self->b = b;
@@ -46,27 +46,27 @@ void spColor_setFromFloats(spColor* self, float r, float g, float b, float a) {
 	spColor_clamp(self);
 }
 
-void spColor_setFromFloats3(spColor* self, float r, float g, float b) {
-    self->r = r;
-    self->g = g;
-    self->b = b;
-    spColor_clamp(self);
+void spColor_setFromFloats3(spColor *self, float r, float g, float b) {
+	self->r = r;
+	self->g = g;
+	self->b = b;
+	spColor_clamp(self);
 }
 
-void spColor_setFromColor(spColor* self, spColor* otherColor) {
+void spColor_setFromColor(spColor *self, spColor *otherColor) {
 	self->r = otherColor->r;
 	self->g = otherColor->g;
 	self->b = otherColor->b;
 	self->a = otherColor->a;
 }
 
-void spColor_setFromColor3(spColor* self, spColor* otherColor) {
-    self->r = otherColor->r;
-    self->g = otherColor->g;
-    self->b = otherColor->b;
+void spColor_setFromColor3(spColor *self, spColor *otherColor) {
+	self->r = otherColor->r;
+	self->g = otherColor->g;
+	self->b = otherColor->b;
 }
 
-void spColor_addColor(spColor* self, spColor* otherColor) {
+void spColor_addColor(spColor *self, spColor *otherColor) {
 	self->r += otherColor->r;
 	self->g += otherColor->g;
 	self->b += otherColor->b;
@@ -74,7 +74,7 @@ void spColor_addColor(spColor* self, spColor* otherColor) {
 	spColor_clamp(self);
 }
 
-void spColor_addFloats(spColor* self, float r, float g, float b, float a) {
+void spColor_addFloats(spColor *self, float r, float g, float b, float a) {
 	self->r += r;
 	self->g += g;
 	self->b += b;
@@ -82,14 +82,14 @@ void spColor_addFloats(spColor* self, float r, float g, float b, float a) {
 	spColor_clamp(self);
 }
 
-void spColor_addFloats3(spColor* self, float r, float g, float b) {
-    self->r += r;
-    self->g += g;
-    self->b += b;
-    spColor_clamp(self);
+void spColor_addFloats3(spColor *self, float r, float g, float b) {
+	self->r += r;
+	self->g += g;
+	self->b += b;
+	spColor_clamp(self);
 }
 
-void spColor_clamp(spColor* self) {
+void spColor_clamp(spColor *self) {
 	if (self->r < 0) self->r = 0;
 	else if (self->r > 1) self->r = 1;
 

+ 196 - 194
spine-c/spine-c/src/spine/Debug.c

@@ -32,223 +32,225 @@
 
 #include <stdio.h>
 
-static const char* _spTimelineTypeNames[] = {
-    "Attachment",
-    "Alpha",
-    "PathConstraintPosition",
-    "PathConstraintSpace",
-    "Rotate",
-    "ScaleX",
-    "ScaleY",
-    "ShearX",
-    "ShearY",
-    "TranslateX",
-    "TranslateY",
-    "Scale",
-    "Shear",
-    "Translate",
-    "Deform",
-    "IkConstraint",
-    "PathConstraintMix",
-    "Rgb2",
-    "Rgba2",
-    "Rgba",
-    "Rgb",
-    "TransformConstraint",
-    "DrawOrder",
-    "Event"
+static const char *_spTimelineTypeNames[] = {
+		"Attachment",
+		"Alpha",
+		"PathConstraintPosition",
+		"PathConstraintSpace",
+		"Rotate",
+		"ScaleX",
+		"ScaleY",
+		"ShearX",
+		"ShearY",
+		"TranslateX",
+		"TranslateY",
+		"Scale",
+		"Shear",
+		"Translate",
+		"Deform",
+		"IkConstraint",
+		"PathConstraintMix",
+		"Rgb2",
+		"Rgba2",
+		"Rgba",
+		"Rgb",
+		"TransformConstraint",
+		"DrawOrder",
+		"Event"
 };
 
-void spDebug_printSkeletonData(spSkeletonData* skeletonData) {
-    int i, n;
-    spDebug_printBoneDatas(skeletonData->bones, skeletonData->bonesCount);
+void spDebug_printSkeletonData(spSkeletonData *skeletonData) {
+	int i, n;
+	spDebug_printBoneDatas(skeletonData->bones, skeletonData->bonesCount);
 
-    for (i = 0, n = skeletonData->animationsCount; i < n; i++) {
-        spDebug_printAnimation(skeletonData->animations[i]);
-    }
+	for (i = 0, n = skeletonData->animationsCount; i < n; i++) {
+		spDebug_printAnimation(skeletonData->animations[i]);
+	}
 }
 
-void _spDebug_printTimelineBase(spTimeline* timeline) {
-    printf("   Timeline %s:\n", _spTimelineTypeNames[timeline->type]);
-    printf("      frame count: %i\n", timeline->frameCount);
-    printf("      frame entries: %i\n", timeline->frameEntries);
-    printf("      frames: ");
-    spDebug_printFloats(timeline->frames->items, timeline->frames->size);
-    printf("\n");
+void _spDebug_printTimelineBase(spTimeline *timeline) {
+	printf("   Timeline %s:\n", _spTimelineTypeNames[timeline->type]);
+	printf("      frame count: %i\n", timeline->frameCount);
+	printf("      frame entries: %i\n", timeline->frameEntries);
+	printf("      frames: ");
+	spDebug_printFloats(timeline->frames->items, timeline->frames->size);
+	printf("\n");
 }
 
-void _spDebug_printCurveTimeline(spCurveTimeline* timeline) {
-    _spDebug_printTimelineBase(&timeline->super);
-    printf("      curves: ");
-    spDebug_printFloats(timeline->curves->items, timeline->curves->size);
-    printf("\n");
+void _spDebug_printCurveTimeline(spCurveTimeline *timeline) {
+	_spDebug_printTimelineBase(&timeline->super);
+	printf("      curves: ");
+	spDebug_printFloats(timeline->curves->items, timeline->curves->size);
+	printf("\n");
 }
 
-void spDebug_printTimeline(spTimeline* timeline) {
-    switch(timeline->type) {
-        case SP_TIMELINE_ATTACHMENT: {
-            spAttachmentTimeline *t = (spAttachmentTimeline*)timeline;
-            _spDebug_printTimelineBase(&t->super);
-            break;
-        }
-        case SP_TIMELINE_ALPHA: {
-            spAlphaTimeline *t = (spAlphaTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_PATHCONSTRAINTPOSITION: {
-            spPathConstraintPositionTimeline *t = (spPathConstraintPositionTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_PATHCONSTRAINTSPACING: {
-            spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_ROTATE: {
-            spRotateTimeline *t = (spRotateTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SCALEX: {
-            spScaleXTimeline *t = (spScaleXTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SCALEY: {
-            spScaleYTimeline *t = (spScaleYTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SHEARX: {
-            spShearXTimeline *t = (spShearXTimeline *)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SHEARY: {
-            spShearYTimeline *t = (spShearYTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_TRANSLATEX: {
-            spTranslateXTimeline *t = (spTranslateXTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_TRANSLATEY: {
-            spTranslateYTimeline *t = (spTranslateYTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SCALE: {
-            spScaleTimeline *t = (spScaleTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_SHEAR: {
-            spShearTimeline *t = (spShearTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_TRANSLATE: {
-            spTranslateTimeline *t = (spTranslateTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_DEFORM: {
-            spDeformTimeline *t = (spDeformTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_IKCONSTRAINT: {
-            spIkConstraintTimeline *t = (spIkConstraintTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_PATHCONSTRAINTMIX: {
-            spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_RGB2: {
-            spRGB2Timeline *t = (spRGB2Timeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_RGBA2: {
-            spRGBA2Timeline *t = (spRGBA2Timeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_RGBA: {
-            spRGBATimeline *t = (spRGBATimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_RGB: {
-            spRGBTimeline *t = (spRGBTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_TRANSFORMCONSTRAINT: {
-            spTransformConstraintTimeline *t = (spTransformConstraintTimeline*)timeline;
-            _spDebug_printCurveTimeline(&t->super);
-            break;
-        }
-        case SP_TIMELINE_DRAWORDER: {
-            spDrawOrderTimeline *t = (spDrawOrderTimeline*)timeline;
-            _spDebug_printTimelineBase(&t->super);
-            break;
-        }
-        case SP_TIMELINE_EVENT: {
-            spEventTimeline *t = (spEventTimeline*)timeline;
-            _spDebug_printTimelineBase(&t->super);
-            break;
-        }
-    }
+void spDebug_printTimeline(spTimeline *timeline) {
+	switch (timeline->type) {
+		case SP_TIMELINE_ATTACHMENT: {
+			spAttachmentTimeline *t = (spAttachmentTimeline *) timeline;
+			_spDebug_printTimelineBase(&t->super);
+			break;
+		}
+		case SP_TIMELINE_ALPHA: {
+			spAlphaTimeline *t = (spAlphaTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_PATHCONSTRAINTPOSITION: {
+			spPathConstraintPositionTimeline *t = (spPathConstraintPositionTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_PATHCONSTRAINTSPACING: {
+			spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_ROTATE: {
+			spRotateTimeline *t = (spRotateTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SCALEX: {
+			spScaleXTimeline *t = (spScaleXTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SCALEY: {
+			spScaleYTimeline *t = (spScaleYTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SHEARX: {
+			spShearXTimeline *t = (spShearXTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SHEARY: {
+			spShearYTimeline *t = (spShearYTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_TRANSLATEX: {
+			spTranslateXTimeline *t = (spTranslateXTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_TRANSLATEY: {
+			spTranslateYTimeline *t = (spTranslateYTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SCALE: {
+			spScaleTimeline *t = (spScaleTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_SHEAR: {
+			spShearTimeline *t = (spShearTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_TRANSLATE: {
+			spTranslateTimeline *t = (spTranslateTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_DEFORM: {
+			spDeformTimeline *t = (spDeformTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_IKCONSTRAINT: {
+			spIkConstraintTimeline *t = (spIkConstraintTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_PATHCONSTRAINTMIX: {
+			spPathConstraintMixTimeline *t = (spPathConstraintMixTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_RGB2: {
+			spRGB2Timeline *t = (spRGB2Timeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_RGBA2: {
+			spRGBA2Timeline *t = (spRGBA2Timeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_RGBA: {
+			spRGBATimeline *t = (spRGBATimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_RGB: {
+			spRGBTimeline *t = (spRGBTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_TRANSFORMCONSTRAINT: {
+			spTransformConstraintTimeline *t = (spTransformConstraintTimeline *) timeline;
+			_spDebug_printCurveTimeline(&t->super);
+			break;
+		}
+		case SP_TIMELINE_DRAWORDER: {
+			spDrawOrderTimeline *t = (spDrawOrderTimeline *) timeline;
+			_spDebug_printTimelineBase(&t->super);
+			break;
+		}
+		case SP_TIMELINE_EVENT: {
+			spEventTimeline *t = (spEventTimeline *) timeline;
+			_spDebug_printTimelineBase(&t->super);
+			break;
+		}
+	}
 }
 
-void spDebug_printAnimation(spAnimation* animation) {
-    int i, n;
-    printf("Animation %s: %i timelines\n", animation->name, animation->timelines->size);
+void spDebug_printAnimation(spAnimation *animation) {
+	int i, n;
+	printf("Animation %s: %i timelines\n", animation->name, animation->timelines->size);
 
-    for (i = 0, n = animation->timelines->size; i < n; i++) {
-        spDebug_printTimeline(animation->timelines->items[i]);
-    }
+	for (i = 0, n = animation->timelines->size; i < n; i++) {
+		spDebug_printTimeline(animation->timelines->items[i]);
+	}
 }
 
-void spDebug_printBoneDatas(spBoneData** boneDatas, int numBoneDatas) {
-    int i;
-    for(i = 0; i < numBoneDatas; i++) {
-        spDebug_printBoneData(boneDatas[i]);
-    }
+void spDebug_printBoneDatas(spBoneData **boneDatas, int numBoneDatas) {
+	int i;
+	for (i = 0; i < numBoneDatas; i++) {
+		spDebug_printBoneData(boneDatas[i]);
+	}
 }
 
-void spDebug_printBoneData(spBoneData* boneData) {
-    printf("Bone data %s: %f, %f, %f, %f, %f, %f %f\n", boneData->name, boneData->rotation, boneData->scaleX, boneData->scaleY, boneData->x, boneData->y, boneData->shearX, boneData->shearY);
+void spDebug_printBoneData(spBoneData *boneData) {
+	printf("Bone data %s: %f, %f, %f, %f, %f, %f %f\n", boneData->name, boneData->rotation, boneData->scaleX,
+		   boneData->scaleY, boneData->x, boneData->y, boneData->shearX, boneData->shearY);
 }
 
-void spDebug_printSkeleton(spSkeleton* skeleton) {
-    spDebug_printBones(skeleton->bones, skeleton->bonesCount);
+void spDebug_printSkeleton(spSkeleton *skeleton) {
+	spDebug_printBones(skeleton->bones, skeleton->bonesCount);
 }
 
-void spDebug_printBones(spBone** bones, int numBones) {
-    int i;
-    for (i = 0; i < numBones; i++) {
-        spDebug_printBone(bones[i]);
-    }
+void spDebug_printBones(spBone **bones, int numBones) {
+	int i;
+	for (i = 0; i < numBones; i++) {
+		spDebug_printBone(bones[i]);
+	}
 }
 
-void spDebug_printBone(spBone* bone) {
-    printf("Bone %s: %f, %f, %f, %f, %f, %f\n", bone->data->name, bone->a, bone->b, bone->c, bone->d, bone->worldX, bone->worldY);
+void spDebug_printBone(spBone *bone) {
+	printf("Bone %s: %f, %f, %f, %f, %f, %f\n", bone->data->name, bone->a, bone->b, bone->c, bone->d, bone->worldX,
+		   bone->worldY);
 }
 
 void spDebug_printFloats(float *values, int numFloats) {
-    int i;
-    printf("[");
-    for (i = 0; i < numFloats; i++) {
-        printf("%f, ", values[i]);
-    }
-    printf("]");
+	int i;
+	printf("(%i) [", numFloats);
+	for (i = 0; i < numFloats; i++) {
+		printf("%f, ", values[i]);
+	}
+	printf("]");
 }

+ 3 - 3
spine-c/spine-c/src/spine/Event.c

@@ -30,14 +30,14 @@
 #include <spine/Event.h>
 #include <spine/extension.h>
 
-spEvent* spEvent_create (float time, spEventData* data) {
-	spEvent* self = NEW(spEvent);
+spEvent *spEvent_create(float time, spEventData *data) {
+	spEvent *self = NEW(spEvent);
 	CONST_CAST(spEventData*, self->data) = data;
 	CONST_CAST(float, self->time) = time;
 	return self;
 }
 
-void spEvent_dispose (spEvent* self) {
+void spEvent_dispose(spEvent *self) {
 	FREE(self->stringValue);
 	FREE(self);
 }

+ 3 - 3
spine-c/spine-c/src/spine/EventData.c

@@ -30,13 +30,13 @@
 #include <spine/EventData.h>
 #include <spine/extension.h>
 
-spEventData* spEventData_create (const char* name) {
-	spEventData* self = NEW(spEventData);
+spEventData *spEventData_create(const char *name) {
+	spEventData *self = NEW(spEventData);
 	MALLOC_STR(self->name, name);
 	return self;
 }
 
-void spEventData_dispose (spEventData* self) {
+void spEventData_dispose(spEventData *self) {
 	FREE(self->audioPath);
 	FREE(self->stringValue);
 	FREE(self->name);

+ 61 - 45
spine-c/spine-c/src/spine/IkConstraint.c

@@ -58,45 +58,49 @@ void spIkConstraint_dispose(spIkConstraint *self) {
 }
 
 void spIkConstraint_update(spIkConstraint *self) {
-    if (self->mix == 0) return;
+	if (self->mix == 0) return;
 	switch (self->bonesCount) {
-	case 1:
-		spIkConstraint_apply1(self->bones[0], self->target->worldX, self->target->worldY, self->compress, self->stretch, self->data->uniform, self->mix);
-		break;
-	case 2:
-		spIkConstraint_apply2(self->bones[0], self->bones[1], self->target->worldX, self->target->worldY, self->bendDirection, self->stretch, self->softness, self->mix);
-		break;
+		case 1:
+			spIkConstraint_apply1(self->bones[0], self->target->worldX, self->target->worldY, self->compress,
+								  self->stretch, self->data->uniform, self->mix);
+			break;
+		case 2:
+			spIkConstraint_apply2(self->bones[0], self->bones[1], self->target->worldX, self->target->worldY,
+								  self->bendDirection, self->stretch, self->softness, self->mix);
+			break;
 	}
 }
 
-void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch, int /*boolean*/ uniform, float alpha) {
-	spBone* p = bone->parent;
-    float pa = p->a, pb = p->b, pc = p->c, pd = p->d;
-    float rotationIK = -bone->ashearX - bone->arotation;
-    float tx = 0, ty = 0, sx = 0, sy = 0, s = 0, sa = 0, sc = 0;
+void
+spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch,
+					  int /*boolean*/ uniform, float alpha) {
+	spBone *p = bone->parent;
+	float pa = p->a, pb = p->b, pc = p->c, pd = p->d;
+	float rotationIK = -bone->ashearX - bone->arotation;
+	float tx = 0, ty = 0, sx = 0, sy = 0, s = 0, sa = 0, sc = 0;
 	if (!bone->appliedValid) spBone_updateAppliedTransform(bone);
 
-    switch(bone->data->transformMode) {
-        case SP_TRANSFORMMODE_ONLYTRANSLATION:
-            tx = targetX - bone->worldX;
-            ty = targetY - bone->worldY;
-            break;
-        case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: {
-            s = ABS(pa * pd - pb * pc) / (pa * pa + pc * pc);
+	switch (bone->data->transformMode) {
+		case SP_TRANSFORMMODE_ONLYTRANSLATION:
+			tx = targetX - bone->worldX;
+			ty = targetY - bone->worldY;
+			break;
+		case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: {
+			s = ABS(pa * pd - pb * pc) / (pa * pa + pc * pc);
 			sa = pa / bone->skeleton->scaleX;
 			sc = pc / bone->skeleton->scaleY;
 			pb = -sc * s * bone->skeleton->scaleX;
 			pd = sa * s * bone->skeleton->scaleY;
 			rotationIK += ATAN2(sc, sa) * RAD_DEG;
-        }
-        default: {
-            float x = targetX - p->worldX, y = targetY - p->worldY;
-            float d = pa * pd - pb * pc;
-            tx = (x * pd - y * pb) / d - bone->ax;
-            ty = (y * pa - x * pc) / d - bone->ay;
-        }
-    }
-    rotationIK += ATAN2(ty, tx) * RAD_DEG;
+		}
+		default: {
+			float x = targetX - p->worldX, y = targetY - p->worldY;
+			float d = pa * pd - pb * pc;
+			tx = (x * pd - y * pb) / d - bone->ax;
+			ty = (y * pa - x * pc) / d - bone->ay;
+		}
+	}
+	rotationIK += ATAN2(ty, tx) * RAD_DEG;
 
 	if (bone->ascaleX < 0) rotationIK += 180;
 	if (rotationIK > 180) rotationIK -= 360;
@@ -104,14 +108,14 @@ void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, int /*bo
 	sx = bone->ascaleX;
 	sy = bone->ascaleY;
 	if (compress || stretch) {
-	    float b, dd;
-        switch(bone->data->transformMode) {
-            case SP_TRANSFORMMODE_NOSCALE:
-            case SP_TRANSFORMMODE_NOSCALEORREFLECTION:
-                tx = targetX - bone->worldX;
-                ty = targetY - bone->worldY;
-            default: ;
-        }
+		float b, dd;
+		switch (bone->data->transformMode) {
+			case SP_TRANSFORMMODE_NOSCALE:
+			case SP_TRANSFORMMODE_NOSCALEORREFLECTION:
+				tx = targetX - bone->worldX;
+				ty = targetY - bone->worldY;
+			default:;
+		}
 		b = bone->data->length * sx, dd = SQRT(tx * tx + ty * ty);
 		if ((compress && dd < b) || ((stretch && dd > b) && (b > 0.0001f))) {
 			s = (dd / b - 1) * alpha + 1;
@@ -120,22 +124,29 @@ void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, int /*bo
 		}
 	}
 	spBone_updateWorldTransformWith(bone, bone->ax, bone->ay, bone->arotation + rotationIK * alpha, sx,
-		sy, bone->ashearX, bone->ashearY);
+									sy, bone->ashearX, bone->ashearY);
 }
 
-void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDir, int /*boolean*/ stretch, float softness, float alpha) {
+void
+spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float targetY, int bendDir, int /*boolean*/ stretch,
+					  float softness, float alpha) {
 	float a, b, c, d;
 	float px, py, psx, sx, psy;
 	float cx, cy, csx, cwx, cwy;
 	int o1, o2, s2, u;
-	spBone* pp = parent->parent;
+	spBone *pp = parent->parent;
 	float tx, ty, dd, dx, dy, l1, l2, a1, a2, r, td, sd, p;
 	float id, x, y;
 	float aa, bb, ll, ta, c0, c1, c2;
 
 	if (!parent->appliedValid) spBone_updateAppliedTransform(parent);
 	if (!child->appliedValid) spBone_updateAppliedTransform(child);
-	px = parent->ax; py = parent->ay; psx = parent->ascaleX; sx = psx; psy = parent->ascaleY; csx = child->ascaleX;
+	px = parent->ax;
+	py = parent->ay;
+	psx = parent->ascaleX;
+	sx = psx;
+	psy = parent->ascaleY;
+	csx = child->ascaleX;
 	if (psx < 0) {
 		psx = -psx;
 		o1 = 180;
@@ -178,7 +189,8 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 	l2 = child->data->length * csx;
 	if (l1 < 0.0001) {
 		spIkConstraint_apply1(parent, targetX, targetY, 0, stretch, 0, alpha);
-		spBone_updateWorldTransformWith(child, cx, cy, 0, child->ascaleX, child->ascaleY, child->ashearX, child->ashearY);
+		spBone_updateWorldTransformWith(child, cx, cy, 0, child->ascaleX, child->ascaleY, child->ashearX,
+										child->ashearY);
 		return;
 	}
 	x = targetX - pp->worldX;
@@ -212,7 +224,8 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 		b = l2 * SIN(a2);
 		a1 = ATAN2(ty * a - tx * b, tx * a + ty * b);
 	} else {
-		a = psx * l2; b = psy * l2;
+		a = psx * l2;
+		b = psy * l2;
 		aa = a * a, bb = b * b, ll = l1 * l1, ta = ATAN2(ty, tx);
 		c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa;
 		d = c1 * c1 - 4 * c2 * c0;
@@ -220,7 +233,8 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 			float q = SQRT(d), r0, r1;
 			if (c1 < 0) q = -q;
 			q = -(c1 + q) / 2;
-			r0 = q / c2; r1 = c0 / q;
+			r0 = q / c2;
+			r1 = c0 / q;
 			r = ABS(r0) < ABS(r1) ? r0 : r1;
 			if (r * r <= dd) {
 				y = SQRT(dd - r * r) * bendDir;
@@ -260,7 +274,8 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 			}
 		}
 	}
-	break_outer: {
+	break_outer:
+	{
 		float os = ATAN2(cy, cx) * s2;
 		a1 = (a1 - os) * RAD_DEG + o1 - parent->arotation;
 		if (a1 > 180) a1 -= 360;
@@ -269,6 +284,7 @@ void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float
 		a2 = ((a2 + os) * RAD_DEG - child->ashearX) * s2 + o2 - child->arotation;
 		if (a2 > 180) a2 -= 360;
 		else if (a2 < -180) a2 += 360;
-		spBone_updateWorldTransformWith(child, cx, cy, child->arotation + a2 * alpha, child->ascaleX, child->ascaleY, child->ashearX, child->ashearY);
+		spBone_updateWorldTransformWith(child, cx, cy, child->arotation + a2 * alpha, child->ascaleX, child->ascaleY,
+										child->ashearX, child->ashearY);
 	}
 }

+ 3 - 3
spine-c/spine-c/src/spine/IkConstraintData.c

@@ -30,8 +30,8 @@
 #include <spine/IkConstraintData.h>
 #include <spine/extension.h>
 
-spIkConstraintData* spIkConstraintData_create (const char* name) {
-	spIkConstraintData* self = NEW(spIkConstraintData);
+spIkConstraintData *spIkConstraintData_create(const char *name) {
+	spIkConstraintData *self = NEW(spIkConstraintData);
 	MALLOC_STR(self->name, name);
 	self->bendDirection = 1;
 	self->compress = 0;
@@ -41,7 +41,7 @@ spIkConstraintData* spIkConstraintData_create (const char* name) {
 	return self;
 }
 
-void spIkConstraintData_dispose (spIkConstraintData* self) {
+void spIkConstraintData_dispose(spIkConstraintData *self) {
 	FREE(self->name);
 	FREE(self->bones);
 	FREE(self);

+ 131 - 128
spine-c/spine-c/src/spine/Json.c

@@ -46,20 +46,20 @@ THE SOFTWARE.
 #define SPINE_JSON_DEBUG 0
 #endif
 
-static const char* ep;
+static const char *ep;
 
-const char* Json_getError (void) {
+const char *Json_getError(void) {
 	return ep;
 }
 
-static int Json_strcasecmp (const char* s1, const char* s2) {
+static int Json_strcasecmp(const char *s1, const char *s2) {
 	/* TODO we may be able to elide these NULL checks if we can prove
 	the graph and input (only callsite is Json_getItem) should not have NULLs */
 	if (s1 && s2) {
 #if defined(_WIN32)
 		return _stricmp(s1, s2);
 #else
-		return strcasecmp( s1, s2 );
+		return strcasecmp(s1, s2);
 #endif
 	} else {
 		if (s1 < s2)
@@ -72,12 +72,12 @@ static int Json_strcasecmp (const char* s1, const char* s2) {
 }
 
 /* Internal constructor. */
-static Json *Json_new (void) {
-	return (Json*)CALLOC(Json, 1);
+static Json *Json_new(void) {
+	return (Json *) CALLOC(Json, 1);
 }
 
 /* Delete a Json structure. */
-void Json_dispose (Json *c) {
+void Json_dispose(Json *c) {
 	Json *next;
 	while (c) {
 		next = c->next;
@@ -90,10 +90,10 @@ void Json_dispose (Json *c) {
 }
 
 /* Parse the input text to generate a number, and populate the result into item. */
-static const char* parse_number (Json *item, const char* num) {
+static const char *parse_number(Json *item, const char *num) {
 	double result = 0.0;
 	int negative = 0;
-	char* ptr = (char*)num;
+	char *ptr = (char *) num;
 
 	if (*ptr == '-') {
 		negative = -1;
@@ -146,8 +146,8 @@ static const char* parse_number (Json *item, const char* num) {
 
 	if (ptr != num) {
 		/* Parse success, number found. */
-		item->valueFloat = (float)result;
-		item->valueInt = (int)result;
+		item->valueFloat = (float) result;
+		item->valueInt = (int) result;
 		item->type = Json_Number;
 		return ptr;
 	} else {
@@ -159,10 +159,11 @@ static const char* parse_number (Json *item, const char* num) {
 
 /* Parse the input text into an unescaped cstring, and populate item. */
 static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
-static const char* parse_string (Json *item, const char* str) {
-	const char* ptr = str + 1;
-	char* ptr2;
-	char* out;
+
+static const char *parse_string(Json *item, const char *str) {
+	const char *ptr = str + 1;
+	char *ptr2;
+	char *out;
 	int len = 0;
 	unsigned uc, uc2;
 	if (*str != '\"') { /* TODO: don't need this check when called from parse_value, but do need from parse_object */
@@ -184,66 +185,66 @@ static const char* parse_string (Json *item, const char* str) {
 		else {
 			ptr++;
 			switch (*ptr) {
-			case 'b':
-				*ptr2++ = '\b';
-				break;
-			case 'f':
-				*ptr2++ = '\f';
-				break;
-			case 'n':
-				*ptr2++ = '\n';
-				break;
-			case 'r':
-				*ptr2++ = '\r';
-				break;
-			case 't':
-				*ptr2++ = '\t';
-				break;
-			case 'u': /* transcode utf16 to utf8. */
-				sscanf(ptr + 1, "%4x", &uc);
-				ptr += 4; /* get the unicode char. */
-
-				if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; /* check for invalid.	*/
-
-				/* TODO provide an option to ignore surrogates, use unicode replacement character? */
-				if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs.	*/
-				{
-					if (ptr[1] != '\\' || ptr[2] != 'u') break; /* missing second-half of surrogate.	*/
-					sscanf(ptr + 3, "%4x", &uc2);
-					ptr += 6;
-					if (uc2 < 0xDC00 || uc2 > 0xDFFF) break; /* invalid second-half of surrogate.	*/
-					uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF));
-				}
-
-				len = 4;
-				if (uc < 0x80)
-					len = 1;
-				else if (uc < 0x800)
-					len = 2;
-				else if (uc < 0x10000) len = 3;
-				ptr2 += len;
-
-				switch (len) {
-				case 4:
-					*--ptr2 = ((uc | 0x80) & 0xBF);
-					uc >>= 6;
-					/* fallthrough */
-				case 3:
-					*--ptr2 = ((uc | 0x80) & 0xBF);
-					uc >>= 6;
-					/* fallthrough */
-				case 2:
-					*--ptr2 = ((uc | 0x80) & 0xBF);
-					uc >>= 6;
-					/* fallthrough */
-				case 1:
-					*--ptr2 = (uc | firstByteMark[len]);
-				}
-				ptr2 += len;
-				break;
-			default:
-				*ptr2++ = *ptr;
-				break;
+				case 'b':
+					*ptr2++ = '\b';
+					break;
+				case 'f':
+					*ptr2++ = '\f';
+					break;
+				case 'n':
+					*ptr2++ = '\n';
+					break;
+				case 'r':
+					*ptr2++ = '\r';
+					break;
+				case 't':
+					*ptr2++ = '\t';
+					break;
+				case 'u': /* transcode utf16 to utf8. */
+					sscanf(ptr + 1, "%4x", &uc);
+					ptr += 4; /* get the unicode char. */
+
+					if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; /* check for invalid.	*/
+
+					/* TODO provide an option to ignore surrogates, use unicode replacement character? */
+					if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs.	*/
+					{
+						if (ptr[1] != '\\' || ptr[2] != 'u') break; /* missing second-half of surrogate.	*/
+						sscanf(ptr + 3, "%4x", &uc2);
+						ptr += 6;
+						if (uc2 < 0xDC00 || uc2 > 0xDFFF) break; /* invalid second-half of surrogate.	*/
+						uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF));
+					}
+
+					len = 4;
+					if (uc < 0x80)
+						len = 1;
+					else if (uc < 0x800)
+						len = 2;
+					else if (uc < 0x10000) len = 3;
+					ptr2 += len;
+
+					switch (len) {
+						case 4:
+							*--ptr2 = ((uc | 0x80) & 0xBF);
+							uc >>= 6;
+							/* fallthrough */
+						case 3:
+							*--ptr2 = ((uc | 0x80) & 0xBF);
+							uc >>= 6;
+							/* fallthrough */
+						case 2:
+							*--ptr2 = ((uc | 0x80) & 0xBF);
+							uc >>= 6;
+							/* fallthrough */
+						case 1:
+							*--ptr2 = (uc | firstByteMark[len]);
+					}
+					ptr2 += len;
+					break;
+				default:
+					*ptr2++ = *ptr;
+					break;
 			}
 			ptr++;
 		}
@@ -256,20 +257,22 @@ static const char* parse_string (Json *item, const char* str) {
 }
 
 /* Predeclare these prototypes. */
-static const char* parse_value (Json *item, const char* value);
-static const char* parse_array (Json *item, const char* value);
-static const char* parse_object (Json *item, const char* value);
+static const char *parse_value(Json *item, const char *value);
+
+static const char *parse_array(Json *item, const char *value);
+
+static const char *parse_object(Json *item, const char *value);
 
 /* Utility to jump whitespace and cr/lf */
-static const char* skip (const char* in) {
+static const char *skip(const char *in) {
 	if (!in) return 0; /* must propagate NULL since it's often called in skip(f(...)) form */
-	while (*in && (unsigned char)*in <= 32)
+	while (*in && (unsigned char) *in <= 32)
 		in++;
 	return in;
 }
 
 /* Parse an object - create a new root, and populate. */
-Json *Json_create (const char* value) {
+Json *Json_create(const char *value) {
 	Json *c;
 	ep = 0;
 	if (!value) return 0; /* only place we check for NULL other than skip() */
@@ -286,7 +289,7 @@ Json *Json_create (const char* value) {
 }
 
 /* Parser core - when encountering text, process appropriately. */
-static const char* parse_value (Json *item, const char* value) {
+static const char *parse_value(Json *item, const char *value) {
 	/* Referenced by Json_create(), parse_array(), and parse_object(). */
 	/* Always called with the result of skip(). */
 #if SPINE_JSON_DEBUG /* Checked at entry to graph, Json_create, and after every parse_ call. */
@@ -294,49 +297,49 @@ static const char* parse_value (Json *item, const char* value) {
 #endif
 
 	switch (*value) {
-	case 'n': {
-		if (!strncmp(value + 1, "ull", 3)) {
-			item->type = Json_NULL;
-			return value + 4;
+		case 'n': {
+			if (!strncmp(value + 1, "ull", 3)) {
+				item->type = Json_NULL;
+				return value + 4;
+			}
+			break;
 		}
-		break;
-	}
-	case 'f': {
-		if (!strncmp(value + 1, "alse", 4)) {
-			item->type = Json_False;
-			/* calloc prevents us needing item->type = Json_False or valueInt = 0 here */
-			return value + 5;
+		case 'f': {
+			if (!strncmp(value + 1, "alse", 4)) {
+				item->type = Json_False;
+				/* calloc prevents us needing item->type = Json_False or valueInt = 0 here */
+				return value + 5;
+			}
+			break;
 		}
-		break;
-	}
-	case 't': {
-		if (!strncmp(value + 1, "rue", 3)) {
-			item->type = Json_True;
-			item->valueInt = 1;
-			return value + 4;
+		case 't': {
+			if (!strncmp(value + 1, "rue", 3)) {
+				item->type = Json_True;
+				item->valueInt = 1;
+				return value + 4;
+			}
+			break;
 		}
-		break;
-	}
-	case '\"':
-		return parse_string(item, value);
-	case '[':
-		return parse_array(item, value);
-	case '{':
-		return parse_object(item, value);
-	case '-': /* fallthrough */
-	case '0': /* fallthrough */
-	case '1': /* fallthrough */
-	case '2': /* fallthrough */
-	case '3': /* fallthrough */
-	case '4': /* fallthrough */
-	case '5': /* fallthrough */
-	case '6': /* fallthrough */
-	case '7': /* fallthrough */
-	case '8': /* fallthrough */
-	case '9':
-		return parse_number(item, value);
-	default:
-		break;
+		case '\"':
+			return parse_string(item, value);
+		case '[':
+			return parse_array(item, value);
+		case '{':
+			return parse_object(item, value);
+		case '-': /* fallthrough */
+		case '0': /* fallthrough */
+		case '1': /* fallthrough */
+		case '2': /* fallthrough */
+		case '3': /* fallthrough */
+		case '4': /* fallthrough */
+		case '5': /* fallthrough */
+		case '6': /* fallthrough */
+		case '7': /* fallthrough */
+		case '8': /* fallthrough */
+		case '9':
+			return parse_number(item, value);
+		default:
+			break;
 	}
 
 	ep = value;
@@ -344,7 +347,7 @@ static const char* parse_value (Json *item, const char* value) {
 }
 
 /* Build an array from input text. */
-static const char* parse_array (Json *item, const char* value) {
+static const char *parse_array(Json *item, const char *value) {
 	Json *child;
 
 #if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */
@@ -383,7 +386,7 @@ static const char* parse_array (Json *item, const char* value) {
 }
 
 /* Build an object from the text. */
-static const char* parse_object (Json *item, const char* value) {
+static const char *parse_object(Json *item, const char *value) {
 	Json *child;
 
 #if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */
@@ -437,7 +440,7 @@ static const char* parse_object (Json *item, const char* value) {
 	return 0; /* malformed. */
 }
 
-Json *Json_getItem (Json *object, const char* string) {
+Json *Json_getItem(Json *object, const char *string) {
 	Json *c = object->child;
 	while (c && Json_strcasecmp(c->name, string))
 		c = c->next;
@@ -453,18 +456,18 @@ Json *Json_getItemAtIndex(Json *object, int childIndex) {
 	return current;
 }
 
-const char* Json_getString (Json* object, const char* name, const char* defaultValue) {
+const char *Json_getString(Json *object, const char *name, const char *defaultValue) {
 	object = Json_getItem(object, name);
 	if (object) return object->valueString;
 	return defaultValue;
 }
 
-float Json_getFloat (Json* value, const char* name, float defaultValue) {
+float Json_getFloat(Json *value, const char *name, float defaultValue) {
 	value = Json_getItem(value, name);
 	return value ? value->valueFloat : defaultValue;
 }
 
-int Json_getInt (Json* value, const char* name, int defaultValue) {
+int Json_getInt(Json *value, const char *name, int defaultValue) {
 	value = Json_getItem(value, name);
 	return value ? value->valueInt : defaultValue;
 }

+ 15 - 11
spine-c/spine-c/src/spine/Json.h

@@ -45,37 +45,41 @@ extern "C" {
 
 /* The Json structure: */
 typedef struct Json {
-	struct Json* next;
+	struct Json *next;
 #if SPINE_JSON_HAVE_PREV
 	struct Json* prev; /* next/prev allow you to walk array/object chains. Alternatively, use getSize/getItem */
 #endif
-	struct Json* child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
+	struct Json *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
 
 	int type; /* The type of the item, as above. */
 	int size; /* The number of children. */
 
-	const char* valueString; /* The item's string, if type==Json_String */
+	const char *valueString; /* The item's string, if type==Json_String */
 	int valueInt; /* The item's number, if type==Json_Number */
 	float valueFloat; /* The item's number, if type==Json_Number */
 
-	const char* name; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
+	const char *name; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
 } Json;
 
 /* Supply a block of JSON, and this returns a Json object you can interrogate. Call Json_dispose when finished. */
-Json* Json_create (const char* value);
+Json *Json_create(const char *value);
 
 /* Delete a Json entity and all subentities. */
-void Json_dispose (Json* json);
+void Json_dispose(Json *json);
 
 /* Get item "string" from object. Case insensitive. */
-Json* Json_getItem (Json* json, const char* string);
+Json *Json_getItem(Json *json, const char *string);
+
 Json *Json_getItemAtIndex(Json *object, int childIndex);
-const char* Json_getString (Json* json, const char* name, const char* defaultValue);
-float Json_getFloat (Json* json, const char* name, float defaultValue);
-int Json_getInt (Json* json, const char* name, int defaultValue);
+
+const char *Json_getString(Json *json, const char *name, const char *defaultValue);
+
+float Json_getFloat(Json *json, const char *name, float defaultValue);
+
+int Json_getInt(Json *json, const char *name, int defaultValue);
 
 /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when Json_create() returns 0. 0 when Json_create() succeeds. */
-const char* Json_getError (void);
+const char *Json_getError(void);
 
 #ifdef __cplusplus
 }

+ 61 - 60
spine-c/spine-c/src/spine/MeshAttachment.c

@@ -31,8 +31,8 @@
 #include <spine/extension.h>
 #include <stdio.h>
 
-void _spMeshAttachment_dispose (spAttachment* attachment) {
-	spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment);
+void _spMeshAttachment_dispose(spAttachment *attachment) {
+	spMeshAttachment *self = SUB_CAST(spMeshAttachment, attachment);
 	FREE(self->path);
 	FREE(self->uvs);
 	if (!self->parentMesh) {
@@ -45,9 +45,9 @@ void _spMeshAttachment_dispose (spAttachment* attachment) {
 	FREE(self);
 }
 
-spAttachment* _spMeshAttachment_copy (spAttachment* attachment) {
-	spMeshAttachment* copy;
-	spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment);
+spAttachment *_spMeshAttachment_copy(spAttachment *attachment) {
+	spMeshAttachment *copy;
+	spMeshAttachment *self = SUB_CAST(spMeshAttachment, attachment);
 	if (self->parentMesh)
 		return SUPER(SUPER(spMeshAttachment_newLinkedMesh(self)));
 	copy = spMeshAttachment_create(attachment->name);
@@ -86,8 +86,8 @@ spAttachment* _spMeshAttachment_copy (spAttachment* attachment) {
 	return SUPER(SUPER(copy));
 }
 
-spMeshAttachment* spMeshAttachment_newLinkedMesh (spMeshAttachment* self) {
-	spMeshAttachment* copy = spMeshAttachment_create(self->super.super.name);
+spMeshAttachment *spMeshAttachment_newLinkedMesh(spMeshAttachment *self) {
+	spMeshAttachment *copy = spMeshAttachment_create(self->super.super.name);
 
 	copy->rendererObject = self->rendererObject;
 	copy->regionU = self->regionU;
@@ -109,80 +109,81 @@ spMeshAttachment* spMeshAttachment_newLinkedMesh (spMeshAttachment* self) {
 	return copy;
 }
 
-spMeshAttachment* spMeshAttachment_create (const char* name) {
-	spMeshAttachment* self = NEW(spMeshAttachment);
+spMeshAttachment *spMeshAttachment_create(const char *name) {
+	spMeshAttachment *self = NEW(spMeshAttachment);
 	_spVertexAttachment_init(SUPER(self));
 	spColor_setFromFloats(&self->color, 1, 1, 1, 1);
 	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_MESH, _spMeshAttachment_dispose, _spMeshAttachment_copy);
 	return self;
 }
 
-void spMeshAttachment_updateUVs (spMeshAttachment* self) {
+void spMeshAttachment_updateUVs(spMeshAttachment *self) {
 	int i, n;
-	float* uvs;
+	float *uvs;
 	float u, v, width, height;
 	int verticesLength = SUPER(self)->worldVerticesLength;
 	FREE(self->uvs);
 	uvs = self->uvs = MALLOC(float, verticesLength);
 	n = verticesLength;
-	u = self->regionU; v = self->regionV;
+	u = self->regionU;
+	v = self->regionV;
 
 	switch (self->regionDegrees) {
-	case 90: {
-		float textureWidth = self->regionHeight / (self->regionU2 - self->regionU);
-		float textureHeight = self->regionWidth / (self->regionV2 - self->regionV);
-		u -= (self->regionOriginalHeight - self->regionOffsetY - self->regionHeight) / textureWidth;
-		v -= (self->regionOriginalWidth - self->regionOffsetX - self->regionWidth) / textureHeight;
-		width = self->regionOriginalHeight / textureWidth;
-		height = self->regionOriginalWidth / textureHeight;
-		for (i = 0; i < n; i += 2) {
-			uvs[i] = u + self->regionUVs[i + 1] * width;
-			uvs[i + 1] = v + (1 - self->regionUVs[i]) * height;
+		case 90: {
+			float textureWidth = self->regionHeight / (self->regionU2 - self->regionU);
+			float textureHeight = self->regionWidth / (self->regionV2 - self->regionV);
+			u -= (self->regionOriginalHeight - self->regionOffsetY - self->regionHeight) / textureWidth;
+			v -= (self->regionOriginalWidth - self->regionOffsetX - self->regionWidth) / textureHeight;
+			width = self->regionOriginalHeight / textureWidth;
+			height = self->regionOriginalWidth / textureHeight;
+			for (i = 0; i < n; i += 2) {
+				uvs[i] = u + self->regionUVs[i + 1] * width;
+				uvs[i + 1] = v + (1 - self->regionUVs[i]) * height;
+			}
+			return;
 		}
-		return;
-	}
-	case 180: {
-		float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
-		float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
-		u -= (self->regionOriginalWidth - self->regionOffsetX - self->regionWidth) / textureWidth;
-		v -= self->regionOffsetY / textureHeight;
-		width = self->regionOriginalWidth / textureWidth;
-		height = self->regionOriginalHeight / textureHeight;
-		for (i = 0; i < n; i += 2) {
-			uvs[i] = u + (1 - self->regionUVs[i]) * width;
-			uvs[i + 1] = v + (1 - self->regionUVs[i + 1]) * height;
+		case 180: {
+			float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
+			float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
+			u -= (self->regionOriginalWidth - self->regionOffsetX - self->regionWidth) / textureWidth;
+			v -= self->regionOffsetY / textureHeight;
+			width = self->regionOriginalWidth / textureWidth;
+			height = self->regionOriginalHeight / textureHeight;
+			for (i = 0; i < n; i += 2) {
+				uvs[i] = u + (1 - self->regionUVs[i]) * width;
+				uvs[i + 1] = v + (1 - self->regionUVs[i + 1]) * height;
+			}
+			return;
 		}
-		return;
-	}
-	case 270: {
-		float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
-		float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
-		u -= self->regionOffsetY / textureWidth;
-		v -= self->regionOffsetX / textureHeight;
-		width = self->regionOriginalHeight / textureWidth;
-		height = self->regionOriginalWidth / textureHeight;
-		for (i = 0; i < n; i += 2) {
-			uvs[i] = u + (1 - self->regionUVs[i + 1]) * width;
-			uvs[i + 1] = v + self->regionUVs[i] * height;
+		case 270: {
+			float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
+			float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
+			u -= self->regionOffsetY / textureWidth;
+			v -= self->regionOffsetX / textureHeight;
+			width = self->regionOriginalHeight / textureWidth;
+			height = self->regionOriginalWidth / textureHeight;
+			for (i = 0; i < n; i += 2) {
+				uvs[i] = u + (1 - self->regionUVs[i + 1]) * width;
+				uvs[i + 1] = v + self->regionUVs[i] * height;
+			}
+			return;
 		}
-		return;
-	}
-	default: {
-		float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
-		float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
-		u -= self->regionOffsetX / textureWidth;
-		v -= (self->regionOriginalHeight - self->regionOffsetY - self->regionHeight) / textureHeight;
-		width = self->regionOriginalWidth / textureWidth;
-		height = self->regionOriginalHeight / textureHeight;
-		for (i = 0; i < n; i += 2) {
-			uvs[i] = u + self->regionUVs[i] * width;
-			uvs[i + 1] = v + self->regionUVs[i + 1] * height;
+		default: {
+			float textureWidth = self->regionWidth / (self->regionU2 - self->regionU);
+			float textureHeight = self->regionHeight / (self->regionV2 - self->regionV);
+			u -= self->regionOffsetX / textureWidth;
+			v -= (self->regionOriginalHeight - self->regionOffsetY - self->regionHeight) / textureHeight;
+			width = self->regionOriginalWidth / textureWidth;
+			height = self->regionOriginalHeight / textureHeight;
+			for (i = 0; i < n; i += 2) {
+				uvs[i] = u + self->regionUVs[i] * width;
+				uvs[i + 1] = v + self->regionUVs[i + 1] * height;
+			}
 		}
 	}
-	}
 }
 
-void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh) {
+void spMeshAttachment_setParentMesh(spMeshAttachment *self, spMeshAttachment *parentMesh) {
 	CONST_CAST(spMeshAttachment*, self->parentMesh) = parentMesh;
 	if (parentMesh) {
 		self->super.bones = parentMesh->super.bones;

+ 7 - 7
spine-c/spine-c/src/spine/PathAttachment.c

@@ -30,8 +30,8 @@
 #include <spine/PathAttachment.h>
 #include <spine/extension.h>
 
-void _spPathAttachment_dispose (spAttachment* attachment) {
-	spPathAttachment* self = SUB_CAST(spPathAttachment, attachment);
+void _spPathAttachment_dispose(spAttachment *attachment) {
+	spPathAttachment *self = SUB_CAST(spPathAttachment, attachment);
 
 	_spVertexAttachment_deinit(SUPER(self));
 
@@ -39,9 +39,9 @@ void _spPathAttachment_dispose (spAttachment* attachment) {
 	FREE(self);
 }
 
-spAttachment* _spPathAttachment_copy (spAttachment* attachment) {
-	spPathAttachment* copy = spPathAttachment_create(attachment->name);
-	spPathAttachment* self = SUB_CAST(spPathAttachment, attachment);
+spAttachment *_spPathAttachment_copy(spAttachment *attachment) {
+	spPathAttachment *copy = spPathAttachment_create(attachment->name);
+	spPathAttachment *self = SUB_CAST(spPathAttachment, attachment);
 	spVertexAttachment_copyTo(SUPER(self), SUPER(copy));
 	copy->lengthsLength = self->lengthsLength;
 	copy->lengths = MALLOC(float, self->lengthsLength);
@@ -51,8 +51,8 @@ spAttachment* _spPathAttachment_copy (spAttachment* attachment) {
 	return SUPER(SUPER(copy));
 }
 
-spPathAttachment* spPathAttachment_create (const char* name) {
-	spPathAttachment* self = NEW(spPathAttachment);
+spPathAttachment *spPathAttachment_create(const char *name) {
+	spPathAttachment *self = NEW(spPathAttachment);
 	_spVertexAttachment_init(SUPER(self));
 	_spAttachment_init(SUPER(SUPER(self)), name, SP_ATTACHMENT_PATH, _spPathAttachment_dispose, _spPathAttachment_copy);
 	return self;

+ 106 - 104
spine-c/spine-c/src/spine/PathConstraint.c

@@ -36,7 +36,7 @@
 #define PATHCONSTRAINT_AFTER -3
 #define EPSILON 0.00001f
 
-spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const spSkeleton* skeleton) {
+spPathConstraint *spPathConstraint_create(spPathConstraintData *data, const spSkeleton *skeleton) {
 	int i;
 	spPathConstraint *self = NEW(spPathConstraint);
 	CONST_CAST(spPathConstraintData*, self->data) = data;
@@ -63,7 +63,7 @@ spPathConstraint* spPathConstraint_create (spPathConstraintData* data, const spS
 	return self;
 }
 
-void spPathConstraint_dispose (spPathConstraint* self) {
+void spPathConstraint_dispose(spPathConstraint *self) {
 	FREE(self->bones);
 	FREE(self->spaces);
 	if (self->positions) FREE(self->positions);
@@ -73,21 +73,21 @@ void spPathConstraint_dispose (spPathConstraint* self) {
 	FREE(self);
 }
 
-void spPathConstraint_update (spPathConstraint* self) {
+void spPathConstraint_update(spPathConstraint *self) {
 	int i, p, n;
 	float length, setupLength, x, y, dx, dy, s, sum;
-	float* spaces, *lengths, *positions;
+	float *spaces, *lengths, *positions;
 	float spacing;
 	float boneX, boneY, offsetRotation;
 	int/*bool*/tip;
-    float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY;
+	float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY;
 	int lengthSpacing;
-	spPathAttachment* attachment = (spPathAttachment*)self->target->attachment;
-	spPathConstraintData* data = self->data;
+	spPathAttachment *attachment = (spPathAttachment *) self->target->attachment;
+	spPathConstraintData *data = self->data;
 	int tangents = data->rotateMode == SP_ROTATE_MODE_TANGENT, scale = data->rotateMode == SP_ROTATE_MODE_CHAIN_SCALE;
 	int boneCount = self->bonesCount, spacesCount = tangents ? boneCount : boneCount + 1;
-	spBone** bones = self->bones;
-	spBone* pa;
+	spBone **bones = self->bones;
+	spBone *pa;
 
 	if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
 	if ((attachment == 0) || (attachment->super.super.type != SP_ATTACHMENT_PATH)) return;
@@ -102,70 +102,70 @@ void spPathConstraint_update (spPathConstraint* self) {
 	lengths = 0;
 	spacing = self->spacing;
 
-    if (scale) {
-        if (self->lengthsCount != boneCount) {
-            if (self->lengths) FREE(self->lengths);
-            self->lengths = MALLOC(float, boneCount);
-            self->lengthsCount = boneCount;
-        }
-        lengths = self->lengths;
-    }
+	if (scale) {
+		if (self->lengthsCount != boneCount) {
+			if (self->lengths) FREE(self->lengths);
+			self->lengths = MALLOC(float, boneCount);
+			self->lengthsCount = boneCount;
+		}
+		lengths = self->lengths;
+	}
 
-    switch (data->spacingMode) {
-        case SP_SPACING_MODE_PERCENT:
-            if (scale) {
-                for (i = 0, n = spacesCount - 1; i < n; i++) {
-                    spBone* bone = bones[i];
-                    setupLength = bone->data->length;
-                    if (setupLength < EPSILON)
-                        lengths[i] = 0;
-                    else {
-                        x = setupLength * bone->a;
-                        y = setupLength * bone->c;
-                        lengths[i] = SQRT(x * x + y * y);
-                    }
-                }
-            }
-            for (i = 1, n = spacesCount; i < n; i++) spaces[i] = spacing;
-            break;
-        case SP_SPACING_MODE_PROPORTIONAL:
-            sum = 0;
-            for (i = 0; i < boneCount;) {
-                spBone* bone = bones[i];
-                setupLength = bone->data->length;
-                if (setupLength < EPSILON) {
-                    if (scale) lengths[i] = 0;
-                    spaces[++i] = spacing;
-                } else {
-                    x = setupLength * bone->a, y = setupLength * bone->c;
-                    length = SQRT(x * x + y * y);
-                    if (scale) lengths[i] = length;
-                    spaces[++i] = length;
-                    sum += length;
-                }
-            }
-            if (sum > 0) {
-                sum = spacesCount / sum * spacing;
-                for (i = 1; i < spacesCount; i++)
-                    spaces[i] *= sum;
-            }
-            break;
-        default:
-            lengthSpacing = data->spacingMode == SP_SPACING_MODE_LENGTH;
-            for (i = 0, n = spacesCount - 1; i < n;) {
-                spBone* bone = bones[i];
-                setupLength = bone->data->length;
-                if (setupLength < EPSILON) {
-                    if (scale) lengths[i] = 0;
-                    spaces[++i] = spacing;
-                } else {
-                    x = setupLength * bone->a, y = setupLength * bone->c;
-                    length = SQRT(x * x + y * y);
-                    if (scale) lengths[i] = length;
-                    spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
-                }
-            }
-    }
+	switch (data->spacingMode) {
+		case SP_SPACING_MODE_PERCENT:
+			if (scale) {
+				for (i = 0, n = spacesCount - 1; i < n; i++) {
+					spBone *bone = bones[i];
+					setupLength = bone->data->length;
+					if (setupLength < EPSILON)
+						lengths[i] = 0;
+					else {
+						x = setupLength * bone->a;
+						y = setupLength * bone->c;
+						lengths[i] = SQRT(x * x + y * y);
+					}
+				}
+			}
+			for (i = 1, n = spacesCount; i < n; i++) spaces[i] = spacing;
+			break;
+		case SP_SPACING_MODE_PROPORTIONAL:
+			sum = 0;
+			for (i = 0; i < boneCount;) {
+				spBone *bone = bones[i];
+				setupLength = bone->data->length;
+				if (setupLength < EPSILON) {
+					if (scale) lengths[i] = 0;
+					spaces[++i] = spacing;
+				} else {
+					x = setupLength * bone->a, y = setupLength * bone->c;
+					length = SQRT(x * x + y * y);
+					if (scale) lengths[i] = length;
+					spaces[++i] = length;
+					sum += length;
+				}
+			}
+			if (sum > 0) {
+				sum = spacesCount / sum * spacing;
+				for (i = 1; i < spacesCount; i++)
+					spaces[i] *= sum;
+			}
+			break;
+		default:
+			lengthSpacing = data->spacingMode == SP_SPACING_MODE_LENGTH;
+			for (i = 0, n = spacesCount - 1; i < n;) {
+				spBone *bone = bones[i];
+				setupLength = bone->data->length;
+				if (setupLength < EPSILON) {
+					if (scale) lengths[i] = 0;
+					spaces[++i] = spacing;
+				} else {
+					x = setupLength * bone->a, y = setupLength * bone->c;
+					length = SQRT(x * x + y * y);
+					if (scale) lengths[i] = length;
+					spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
+				}
+			}
+	}
 
 	positions = spPathConstraint_computeWorldPositions(self, attachment, spacesCount, tangents);
 	boneX = positions[0], boneY = positions[1], offsetRotation = self->data->offsetRotation;
@@ -178,7 +178,7 @@ void spPathConstraint_update (spPathConstraint* self) {
 		offsetRotation *= pa->a * pa->d - pa->b * pa->c > 0 ? DEG_RAD : -DEG_RAD;
 	}
 	for (i = 0, p = 3; i < boneCount; i++, p += 3) {
-		spBone* bone = bones[i];
+		spBone *bone = bones[i];
 		CONST_CAST(float, bone->worldX) += (boneX - bone->worldX) * mixX;
 		CONST_CAST(float, bone->worldY) += (boneY - bone->worldY) * mixY;
 		x = positions[p], y = positions[p + 1], dx = x - boneX, dy = y - boneY;
@@ -225,22 +225,23 @@ void spPathConstraint_update (spPathConstraint* self) {
 	}
 }
 
-static void _addBeforePosition(float p, float* temp, int i, float* out, int o) {
+static void _addBeforePosition(float p, float *temp, int i, float *out, int o) {
 	float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = ATAN2(dy, dx);
 	out[o] = x1 + p * COS(r);
 	out[o + 1] = y1 + p * SIN(r);
 	out[o + 2] = r;
 }
 
-static void _addAfterPosition (float p, float* temp, int i, float* out, int o) {
+static void _addAfterPosition(float p, float *temp, int i, float *out, int o) {
 	float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = ATAN2(dy, dx);
 	out[o] = x1 + p * COS(r);
 	out[o + 1] = y1 + p * SIN(r);
 	out[o + 2] = r;
 }
 
-static void _addCurvePosition (float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
-		float* out, int o, int/*bool*/tangents) {
+static void
+_addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
+				  float *out, int o, int/*bool*/tangents) {
 	float tt, ttt, u, uu, uuu;
 	float ut, ut3, uut3, utt3;
 	float x, y;
@@ -263,14 +264,15 @@ static void _addCurvePosition (float p, float x1, float y1, float cx1, float cy1
 	}
 }
 
-float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents) {
+float *spPathConstraint_computeWorldPositions(spPathConstraint *self, spPathAttachment *path, int spacesCount,
+											  int/*bool*/ tangents) {
 	int i, o, w, curve, segment, /*bool*/closed, verticesLength, curveCount, prevCurve;
-	float* out, *curves, *segments;
+	float *out, *curves, *segments;
 	float tmpx, tmpy, dddfx, dddfy, ddfx, ddfy, dfx, dfy, pathLength, curveLength, p;
 	float x1, y1, cx1, cy1, cx2, cy2, x2, y2, multiplier;
-	spSlot* target = self->target;
+	spSlot *target = self->target;
 	float position = self->position;
-	float* spaces = self->spaces, *world = 0;
+	float *spaces = self->spaces, *world = 0;
 	if (self->positionsCount != spacesCount * 3 + 2) {
 		if (self->positions) FREE(self->positions);
 		self->positions = MALLOC(float, spacesCount * 3 + 2);
@@ -281,20 +283,20 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
 	verticesLength = path->super.worldVerticesLength, curveCount = verticesLength / 6, prevCurve = PATHCONSTRAINT_NONE;
 
 	if (!path->constantSpeed) {
-		float* lengths = path->lengths;
+		float *lengths = path->lengths;
 		curveCount -= closed ? 1 : 2;
 		pathLength = lengths[curveCount];
 		if (self->data->positionMode == SP_POSITION_MODE_PERCENT) position += pathLength;
-        switch (self->data->spacingMode) {
-            case SP_SPACING_MODE_PERCENT:
-                multiplier = pathLength;
-                break;
-            case SP_SPACING_MODE_PROPORTIONAL:
-                multiplier = pathLength / spacesCount;
-                break;
-            default:
-                multiplier = 1;
-        }
+		switch (self->data->spacingMode) {
+			case SP_SPACING_MODE_PERCENT:
+				multiplier = pathLength;
+				break;
+			case SP_SPACING_MODE_PROPORTIONAL:
+				multiplier = pathLength / spacesCount;
+				break;
+			default:
+				multiplier = 1;
+		}
 
 		if (self->worldCount != 8) {
 			if (self->world) FREE(self->world);
@@ -348,7 +350,7 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
 					spVertexAttachment_computeWorldVertices(SUPER(path), target, curve * 6 + 2, 8, world, 0, 2);
 			}
 			_addCurvePosition(p, world[0], world[1], world[2], world[3], world[4], world[5], world[6], world[7], out, o,
-				tangents || (i > 0 && space == 0));
+							  tangents || (i > 0 && space == 0));
 		}
 		return out;
 	}
@@ -419,18 +421,18 @@ float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAtta
 		y1 = y2;
 	}
 
-    if (self->data->positionMode == SP_POSITION_MODE_PERCENT) position *= pathLength;
+	if (self->data->positionMode == SP_POSITION_MODE_PERCENT) position *= pathLength;
 
-    switch (self->data->spacingMode) {
-        case SP_SPACING_MODE_PERCENT:
-            multiplier = pathLength;
-            break;
-        case SP_SPACING_MODE_PROPORTIONAL:
-            multiplier = pathLength / spacesCount;
-            break;
-        default:
-            multiplier = 1;
-    }
+	switch (self->data->spacingMode) {
+		case SP_SPACING_MODE_PERCENT:
+			multiplier = pathLength;
+			break;
+		case SP_SPACING_MODE_PROPORTIONAL:
+			multiplier = pathLength / spacesCount;
+			break;
+		default:
+			multiplier = 1;
+	}
 
 	segments = self->segments;
 	curveLength = 0;

+ 3 - 3
spine-c/spine-c/src/spine/PathConstraintData.c

@@ -30,13 +30,13 @@
 #include <spine/PathConstraintData.h>
 #include <spine/extension.h>
 
-spPathConstraintData* spPathConstraintData_create (const char* name) {
-	spPathConstraintData* self = NEW(spPathConstraintData);
+spPathConstraintData *spPathConstraintData_create(const char *name) {
+	spPathConstraintData *self = NEW(spPathConstraintData);
 	MALLOC_STR(self->name, name);
 	return self;
 }
 
-void spPathConstraintData_dispose (spPathConstraintData* self) {
+void spPathConstraintData_dispose(spPathConstraintData *self) {
 	FREE(self->name);
 	FREE(self->bones);
 	FREE(self);

+ 9 - 9
spine-c/spine-c/src/spine/PointAttachment.c

@@ -30,15 +30,15 @@
 #include <spine/PointAttachment.h>
 #include <spine/extension.h>
 
-void _spPointAttachment_dispose (spAttachment* attachment) {
-	spPointAttachment* self = SUB_CAST(spPointAttachment, attachment);
+void _spPointAttachment_dispose(spAttachment *attachment) {
+	spPointAttachment *self = SUB_CAST(spPointAttachment, attachment);
 	_spAttachment_deinit(attachment);
 	FREE(self);
 }
 
-spAttachment* _spPointAttachment_copy (spAttachment* attachment) {
-	spPointAttachment* self = SUB_CAST(spPointAttachment, attachment);
-	spPointAttachment* copy = spPointAttachment_create(attachment->name);
+spAttachment *_spPointAttachment_copy(spAttachment *attachment) {
+	spPointAttachment *self = SUB_CAST(spPointAttachment, attachment);
+	spPointAttachment *copy = spPointAttachment_create(attachment->name);
 	copy->x = self->x;
 	copy->y = self->y;
 	copy->rotation = self->rotation;
@@ -46,18 +46,18 @@ spAttachment* _spPointAttachment_copy (spAttachment* attachment) {
 	return SUPER(copy);
 }
 
-spPointAttachment* spPointAttachment_create (const char* name) {
-	spPointAttachment* self = NEW(spPointAttachment);
+spPointAttachment *spPointAttachment_create(const char *name) {
+	spPointAttachment *self = NEW(spPointAttachment);
 	_spAttachment_init(SUPER(self), name, SP_ATTACHMENT_POINT, _spPointAttachment_dispose, _spPointAttachment_copy);
 	return self;
 }
 
-void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y) {
+void spPointAttachment_computeWorldPosition(spPointAttachment *self, spBone *bone, float *x, float *y) {
 	*x = self->x * bone->a + self->y * bone->b + bone->worldX;
 	*y = self->x * bone->c + self->y * bone->d + bone->worldY;
 }
 
-float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone) {
+float spPointAttachment_computeWorldRotation(spPointAttachment *self, spBone *bone) {
 	float cosine, sine, x, y;
 	cosine = COS_DEG(self->rotation);
 	sine = SIN_DEG(self->rotation);

+ 13 - 12
spine-c/spine-c/src/spine/RegionAttachment.c

@@ -34,16 +34,16 @@ typedef enum {
 	BLX = 0, BLY, ULX, ULY, URX, URY, BRX, BRY
 } spVertexIndex;
 
-void _spRegionAttachment_dispose (spAttachment* attachment) {
-	spRegionAttachment* self = SUB_CAST(spRegionAttachment, attachment);
+void _spRegionAttachment_dispose(spAttachment *attachment) {
+	spRegionAttachment *self = SUB_CAST(spRegionAttachment, attachment);
 	_spAttachment_deinit(attachment);
 	FREE(self->path);
 	FREE(self);
 }
 
-spAttachment* _spRegionAttachment_copy (spAttachment* attachment) {
-	spRegionAttachment* self = SUB_CAST(spRegionAttachment, attachment);
-	spRegionAttachment* copy = spRegionAttachment_create(attachment->name);
+spAttachment *_spRegionAttachment_copy(spAttachment *attachment) {
+	spRegionAttachment *self = SUB_CAST(spRegionAttachment, attachment);
+	spRegionAttachment *copy = spRegionAttachment_create(attachment->name);
 	copy->regionWidth = self->regionWidth;
 	copy->regionHeight = self->regionHeight;
 	copy->regionOffsetX = self->regionOffsetX;
@@ -65,8 +65,8 @@ spAttachment* _spRegionAttachment_copy (spAttachment* attachment) {
 	return SUPER(copy);
 }
 
-spRegionAttachment* spRegionAttachment_create (const char* name) {
-	spRegionAttachment* self = NEW(spRegionAttachment);
+spRegionAttachment *spRegionAttachment_create(const char *name) {
+	spRegionAttachment *self = NEW(spRegionAttachment);
 	self->scaleX = 1;
 	self->scaleY = 1;
 	spColor_setFromFloats(&self->color, 1, 1, 1, 1);
@@ -74,8 +74,8 @@ spRegionAttachment* spRegionAttachment_create (const char* name) {
 	return self;
 }
 
-void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, float degrees) {
-    if (degrees == 90) {
+void spRegionAttachment_setUVs(spRegionAttachment *self, float u, float v, float u2, float v2, float degrees) {
+	if (degrees == 90) {
 		self->uvs[URX] = u;
 		self->uvs[URY] = v2;
 		self->uvs[BRX] = u;
@@ -96,7 +96,7 @@ void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, floa
 	}
 }
 
-void spRegionAttachment_updateOffset (spRegionAttachment* self) {
+void spRegionAttachment_updateOffset(spRegionAttachment *self) {
 	float regionScaleX = self->width / self->regionOriginalWidth * self->scaleX;
 	float regionScaleY = self->height / self->regionOriginalHeight * self->scaleY;
 	float localX = -self->width / 2 * self->scaleX + self->regionOffsetX * regionScaleX;
@@ -123,8 +123,9 @@ void spRegionAttachment_updateOffset (spRegionAttachment* self) {
 	self->offset[BRY] = localYCos + localX2Sin;
 }
 
-void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride) {
-	const float* offsets = self->offset;
+void spRegionAttachment_computeWorldVertices(spRegionAttachment *self, spBone *bone, float *vertices, int offset,
+											 int stride) {
+	const float *offsets = self->offset;
 	float x = bone->worldX, y = bone->worldY;
 	float offsetX, offsetY;
 

+ 182 - 164
spine-c/spine-c/src/spine/Skeleton.c

@@ -38,7 +38,7 @@ typedef enum {
 
 typedef struct {
 	_spUpdateType type;
-	void* object;
+	void *object;
 } _spUpdate;
 
 typedef struct {
@@ -46,15 +46,15 @@ typedef struct {
 
 	int updateCacheCount;
 	int updateCacheCapacity;
-	_spUpdate* updateCache;
+	_spUpdate *updateCache;
 } _spSkeleton;
 
-spSkeleton* spSkeleton_create (spSkeletonData* data) {
+spSkeleton *spSkeleton_create(spSkeletonData *data) {
 	int i;
-	int* childrenCounts;
+	int *childrenCounts;
 
-	_spSkeleton* internal = NEW(_spSkeleton);
-	spSkeleton* self = SUPER(internal);
+	_spSkeleton *internal = NEW(_spSkeleton);
+	spSkeleton *self = SUPER(internal);
 	CONST_CAST(spSkeletonData*, self->data) = data;
 
 	self->bonesCount = self->data->bonesCount;
@@ -62,25 +62,25 @@ spSkeleton* spSkeleton_create (spSkeletonData* data) {
 	childrenCounts = CALLOC(int, self->bonesCount);
 
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBoneData* boneData = self->data->bones[i];
-		spBone* newBone;
+		spBoneData *boneData = self->data->bones[i];
+		spBone *newBone;
 		if (!boneData->parent)
 			newBone = spBone_create(boneData, self, 0);
 		else {
-			spBone* parent = self->bones[boneData->parent->index];
+			spBone *parent = self->bones[boneData->parent->index];
 			newBone = spBone_create(boneData, self, parent);
 			++childrenCounts[boneData->parent->index];
 		}
 		self->bones[i] = newBone;
 	}
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBoneData* boneData = self->data->bones[i];
-		spBone* bone = self->bones[i];
+		spBoneData *boneData = self->data->bones[i];
+		spBone *bone = self->bones[i];
 		CONST_CAST(spBone**, bone->children) = MALLOC(spBone*, childrenCounts[boneData->index]);
 	}
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = self->bones[i];
-		spBone* parent = bone->parent;
+		spBone *bone = self->bones[i];
+		spBone *parent = bone->parent;
 		if (parent)
 			parent->children[parent->childrenCount++] = bone;
 	}
@@ -90,12 +90,12 @@ spSkeleton* spSkeleton_create (spSkeletonData* data) {
 	self->slots = MALLOC(spSlot*, self->slotsCount);
 	for (i = 0; i < self->slotsCount; ++i) {
 		spSlotData *slotData = data->slots[i];
-		spBone* bone = self->bones[slotData->boneData->index];
+		spBone *bone = self->bones[slotData->boneData->index];
 		self->slots[i] = spSlot_create(slotData, bone);
 	}
 
 	self->drawOrder = MALLOC(spSlot*, self->slotsCount);
-	memcpy(self->drawOrder, self->slots, sizeof(spSlot*) * self->slotsCount);
+	memcpy(self->drawOrder, self->slots, sizeof(spSlot *) * self->slotsCount);
 
 	self->ikConstraintsCount = data->ikConstraintsCount;
 	self->ikConstraints = MALLOC(spIkConstraint*, self->ikConstraintsCount);
@@ -124,9 +124,9 @@ spSkeleton* spSkeleton_create (spSkeletonData* data) {
 	return self;
 }
 
-void spSkeleton_dispose (spSkeleton* self) {
+void spSkeleton_dispose(spSkeleton *self) {
 	int i;
-	_spSkeleton* internal = SUB_CAST(_spSkeleton, self);
+	_spSkeleton *internal = SUB_CAST(_spSkeleton, self);
 
 	FREE(internal->updateCache);
 
@@ -154,11 +154,12 @@ void spSkeleton_dispose (spSkeleton* self) {
 	FREE(self);
 }
 
-static void _addToUpdateCache(_spSkeleton* const internal, _spUpdateType type, void *object) {
-	_spUpdate* update;
+static void _addToUpdateCache(_spSkeleton *const internal, _spUpdateType type, void *object) {
+	_spUpdate *update;
 	if (internal->updateCacheCount == internal->updateCacheCapacity) {
 		internal->updateCacheCapacity *= 2;
-		internal->updateCache = (_spUpdate*)realloc(internal->updateCache, sizeof(_spUpdate) * internal->updateCacheCapacity);
+		internal->updateCache = (_spUpdate *) realloc(internal->updateCache,
+													  sizeof(_spUpdate) * internal->updateCacheCapacity);
 	}
 	update = internal->updateCache + internal->updateCacheCount;
 	update->type = type;
@@ -166,16 +167,17 @@ static void _addToUpdateCache(_spSkeleton* const internal, _spUpdateType type, v
 	++internal->updateCacheCount;
 }
 
-static void _sortBone(_spSkeleton* const internal, spBone* bone) {
+static void _sortBone(_spSkeleton *const internal, spBone *bone) {
 	if (bone->sorted) return;
 	if (bone->parent) _sortBone(internal, bone->parent);
 	bone->sorted = 1;
 	_addToUpdateCache(internal, SP_UPDATE_BONE, bone);
 }
 
-static void _sortPathConstraintAttachmentBones(_spSkeleton* const internal, spAttachment* attachment, spBone* slotBone) {
-	spPathAttachment* pathAttachment = (spPathAttachment*)attachment;
-	int* pathBones;
+static void
+_sortPathConstraintAttachmentBones(_spSkeleton *const internal, spAttachment *attachment, spBone *slotBone) {
+	spPathAttachment *pathAttachment = (spPathAttachment *) attachment;
+	int *pathBones;
 	int pathBonesCount;
 	if (pathAttachment->super.super.type != SP_ATTACHMENT_PATH) return;
 	pathBones = pathAttachment->super.bones;
@@ -183,42 +185,45 @@ static void _sortPathConstraintAttachmentBones(_spSkeleton* const internal, spAt
 	if (pathBones == 0)
 		_sortBone(internal, slotBone);
 	else {
-		spBone** bones = internal->super.bones;
+		spBone **bones = internal->super.bones;
 		int i = 0, n;
 
-        for (i = 0, n = pathBonesCount; i < n;) {
-            int nn = pathBones[i++];
-            nn += i;
-            while (i < nn)
-                _sortBone(internal, bones[pathBones[i++]]);
-        }
+		for (i = 0, n = pathBonesCount; i < n;) {
+			int nn = pathBones[i++];
+			nn += i;
+			while (i < nn)
+				_sortBone(internal, bones[pathBones[i++]]);
+		}
 	}
 }
 
-static void _sortPathConstraintAttachment(_spSkeleton* const internal, spSkin* skin, int slotIndex, spBone* slotBone) {
-	_Entry* entry = SUB_CAST(_spSkin, skin)->entries;
+static void _sortPathConstraintAttachment(_spSkeleton *const internal, spSkin *skin, int slotIndex, spBone *slotBone) {
+	_Entry *entry = SUB_CAST(_spSkin, skin)->entries;
 	while (entry) {
 		if (entry->slotIndex == slotIndex) _sortPathConstraintAttachmentBones(internal, entry->attachment, slotBone);
 		entry = entry->next;
 	}
 }
 
-static void _sortReset(spBone** bones, int bonesCount) {
+static void _sortReset(spBone **bones, int bonesCount) {
 	int i;
 	for (i = 0; i < bonesCount; ++i) {
-		spBone* bone = bones[i];
+		spBone *bone = bones[i];
 		if (!bone->active) continue;
 		if (bone->sorted) _sortReset(bone->children, bone->childrenCount);
 		bone->sorted = 0;
 	}
 }
 
-static void _sortIkConstraint (_spSkeleton* const internal, spIkConstraint* constraint) {
-	spBone* target = constraint->target;
-	spBone** constrained;
-	spBone* parent;
+static void _sortIkConstraint(_spSkeleton *const internal, spIkConstraint *constraint) {
+	spBone *target = constraint->target;
+	spBone **constrained;
+	spBone *parent;
 
-	constraint->active = constraint->target->active && (!constraint->data->skinRequired || (internal->super.skin != 0 && spIkConstraintDataArray_contains(internal->super.skin->ikConstraints, constraint->data)));
+	constraint->active = constraint->target->active && (!constraint->data->skinRequired || (internal->super.skin != 0 &&
+																							spIkConstraintDataArray_contains(
+																									internal->super.skin->ikConstraints,
+																									constraint->data)));
 	if (!constraint->active) return;
 
 	_sortBone(internal, target);
@@ -228,29 +233,33 @@ static void _sortIkConstraint (_spSkeleton* const internal, spIkConstraint* cons
 	_sortBone(internal, parent);
 
 	if (constraint->bonesCount == 1) {
-	    _addToUpdateCache(internal, SP_UPDATE_IK_CONSTRAINT, constraint);
-	    _sortReset(parent->children, parent->childrenCount);
-    } else {
-		spBone* child = constrained[constraint->bonesCount - 1];
+		_addToUpdateCache(internal, SP_UPDATE_IK_CONSTRAINT, constraint);
+		_sortReset(parent->children, parent->childrenCount);
+	} else {
+		spBone *child = constrained[constraint->bonesCount - 1];
 		_sortBone(internal, child);
 
-        _addToUpdateCache(internal, SP_UPDATE_IK_CONSTRAINT, constraint);
+		_addToUpdateCache(internal, SP_UPDATE_IK_CONSTRAINT, constraint);
 
-        _sortReset(parent->children, parent->childrenCount);
-        child->sorted = 1;
+		_sortReset(parent->children, parent->childrenCount);
+		child->sorted = 1;
 	}
 }
 
-static void _sortPathConstraint(_spSkeleton* const internal, spPathConstraint* constraint) {
-	spSlot* slot = constraint->target;
+static void _sortPathConstraint(_spSkeleton *const internal, spPathConstraint *constraint) {
+	spSlot *slot = constraint->target;
 	int slotIndex = slot->data->index;
-	spBone* slotBone = slot->bone;
+	spBone *slotBone = slot->bone;
 	int i, n, boneCount;
-	spAttachment* attachment;
-	spBone** constrained;
-	spSkeleton* skeleton = SUPER_CAST(spSkeleton, internal);
-
-	constraint->active = constraint->target->bone->active && (!constraint->data->skinRequired || (internal->super.skin != 0 && spPathConstraintDataArray_contains(internal->super.skin->pathConstraints, constraint->data)));
+	spAttachment *attachment;
+	spBone **constrained;
+	spSkeleton *skeleton = SUPER_CAST(spSkeleton, internal);
+
+	constraint->active = constraint->target->bone->active && (!constraint->data->skinRequired ||
+															  (internal->super.skin != 0 &&
+															   spPathConstraintDataArray_contains(
+																	   internal->super.skin->pathConstraints,
+																	   constraint->data)));
 	if (!constraint->active) return;
 
 	if (skeleton->skin) _sortPathConstraintAttachment(internal, skeleton->skin, slotIndex, slotBone);
@@ -260,7 +269,8 @@ static void _sortPathConstraint(_spSkeleton* const internal, spPathConstraint* c
 		_sortPathConstraintAttachment(internal, skeleton->data->skins[i], slotIndex, slotBone);
 
 	attachment = slot->attachment;
-	if (attachment && attachment->type == SP_ATTACHMENT_PATH) _sortPathConstraintAttachmentBones(internal, attachment, slotBone);
+	if (attachment && attachment->type == SP_ATTACHMENT_PATH)
+		_sortPathConstraintAttachmentBones(internal, attachment, slotBone);
 
 	constrained = constraint->bones;
 	boneCount = constraint->bonesCount;
@@ -275,12 +285,15 @@ static void _sortPathConstraint(_spSkeleton* const internal, spPathConstraint* c
 		constrained[i]->sorted = 1;
 }
 
-static void _sortTransformConstraint(_spSkeleton* const internal, spTransformConstraint* constraint) {
+static void _sortTransformConstraint(_spSkeleton *const internal, spTransformConstraint *constraint) {
 	int i, boneCount;
-	spBone** constrained;
-	spBone* child;
+	spBone **constrained;
+	spBone *child;
 
-	constraint->active = constraint->target->active && (!constraint->data->skinRequired || (internal->super.skin != 0 && spTransformConstraintDataArray_contains(internal->super.skin->transformConstraints, constraint->data)));
+	constraint->active = constraint->target->active && (!constraint->data->skinRequired || (internal->super.skin != 0 &&
+																							spTransformConstraintDataArray_contains(
+																									internal->super.skin->transformConstraints,
+																									constraint->data)));
 	if (!constraint->active) return;
 
 	_sortBone(internal, constraint->target);
@@ -306,31 +319,32 @@ static void _sortTransformConstraint(_spSkeleton* const internal, spTransformCon
 		constrained[i]->sorted = 1;
 }
 
-void spSkeleton_updateCache (spSkeleton* self) {
+void spSkeleton_updateCache(spSkeleton *self) {
 	int i, ii;
-	spBone** bones;
-	spIkConstraint** ikConstraints;
-	spPathConstraint** pathConstraints;
-	spTransformConstraint** transformConstraints;
+	spBone **bones;
+	spIkConstraint **ikConstraints;
+	spPathConstraint **pathConstraints;
+	spTransformConstraint **transformConstraints;
 	int ikCount, transformCount, pathCount, constraintCount;
-	_spSkeleton* internal = SUB_CAST(_spSkeleton, self);
+	_spSkeleton *internal = SUB_CAST(_spSkeleton, self);
 
-	internal->updateCacheCapacity = self->bonesCount + self->ikConstraintsCount + self->transformConstraintsCount + self->pathConstraintsCount;
+	internal->updateCacheCapacity =
+			self->bonesCount + self->ikConstraintsCount + self->transformConstraintsCount + self->pathConstraintsCount;
 	FREE(internal->updateCache);
 	internal->updateCache = MALLOC(_spUpdate, internal->updateCacheCapacity);
 	internal->updateCacheCount = 0;
 
 	bones = self->bones;
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = bones[i];
+		spBone *bone = bones[i];
 		bone->sorted = bone->data->skinRequired;
 		bone->active = !bone->sorted;
 	}
 
 	if (self->skin) {
-		spBoneDataArray* skinBones = self->skin->bones;
-		for(i = 0; i < skinBones->size; i++) {
-			spBone* bone = self->bones[skinBones->items[i]->index];
+		spBoneDataArray *skinBones = self->skin->bones;
+		for (i = 0; i < skinBones->size; i++) {
+			spBone *bone = self->bones[skinBones->items[i]->index];
 			do {
 				bone->sorted = 0;
 				bone->active = -1;
@@ -343,14 +357,16 @@ void spSkeleton_updateCache (spSkeleton* self) {
 	ikConstraints = self->ikConstraints;
 	transformConstraints = self->transformConstraints;
 	pathConstraints = self->pathConstraints;
-	ikCount = self->ikConstraintsCount; transformCount = self->transformConstraintsCount; pathCount = self->pathConstraintsCount;
+	ikCount = self->ikConstraintsCount;
+	transformCount = self->transformConstraintsCount;
+	pathCount = self->pathConstraintsCount;
 	constraintCount = ikCount + transformCount + pathCount;
 
 	i = 0;
 	continue_outer:
 	for (; i < constraintCount; i++) {
 		for (ii = 0; ii < ikCount; ii++) {
-			spIkConstraint* ikConstraint = ikConstraints[ii];
+			spIkConstraint *ikConstraint = ikConstraints[ii];
 			if (ikConstraint->data->order == i) {
 				_sortIkConstraint(internal, ikConstraint);
 				i++;
@@ -359,7 +375,7 @@ void spSkeleton_updateCache (spSkeleton* self) {
 		}
 
 		for (ii = 0; ii < transformCount; ii++) {
-			spTransformConstraint* transformConstraint = transformConstraints[ii];
+			spTransformConstraint *transformConstraint = transformConstraints[ii];
 			if (transformConstraint->data->order == i) {
 				_sortTransformConstraint(internal, transformConstraint);
 				i++;
@@ -368,7 +384,7 @@ void spSkeleton_updateCache (spSkeleton* self) {
 		}
 
 		for (ii = 0; ii < pathCount; ii++) {
-			spPathConstraint* pathConstraint = pathConstraints[ii];
+			spPathConstraint *pathConstraint = pathConstraints[ii];
 			if (pathConstraint->data->order == i) {
 				_sortPathConstraint(internal, pathConstraint);
 				i++;
@@ -381,82 +397,82 @@ void spSkeleton_updateCache (spSkeleton* self) {
 		_sortBone(internal, self->bones[i]);
 }
 
-void spSkeleton_updateWorldTransform (const spSkeleton* self) {
+void spSkeleton_updateWorldTransform(const spSkeleton *self) {
 	int i;
-	_spSkeleton* internal = SUB_CAST(_spSkeleton, self);
+	_spSkeleton *internal = SUB_CAST(_spSkeleton, self);
 	for (i = 0; i < internal->updateCacheCount; ++i) {
-		_spUpdate* update = internal->updateCache + i;
+		_spUpdate *update = internal->updateCache + i;
 		switch (update->type) {
-		case SP_UPDATE_BONE:
-			spBone_updateWorldTransform((spBone*)update->object);
-			break;
-		case SP_UPDATE_IK_CONSTRAINT:
-            spIkConstraint_update((spIkConstraint *) update->object);
-			break;
-		case SP_UPDATE_TRANSFORM_CONSTRAINT:
-            spTransformConstraint_update((spTransformConstraint *) update->object);
-			break;
-		case SP_UPDATE_PATH_CONSTRAINT:
-            spPathConstraint_update((spPathConstraint *) update->object);
-			break;
+			case SP_UPDATE_BONE:
+				spBone_updateWorldTransform((spBone *) update->object);
+				break;
+			case SP_UPDATE_IK_CONSTRAINT:
+				spIkConstraint_update((spIkConstraint *) update->object);
+				break;
+			case SP_UPDATE_TRANSFORM_CONSTRAINT:
+				spTransformConstraint_update((spTransformConstraint *) update->object);
+				break;
+			case SP_UPDATE_PATH_CONSTRAINT:
+				spPathConstraint_update((spPathConstraint *) update->object);
+				break;
 		}
 	}
 }
 
-void spSkeleton_updateWorldTransformWith (const spSkeleton* self, const spBone *parent) {
+void spSkeleton_updateWorldTransformWith(const spSkeleton *self, const spBone *parent) {
 /* Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection. */
-    int i;
-    float rotationY, la, lb, lc, ld;
-    _spUpdate *updateCache;
-    _spSkeleton* internal = SUB_CAST(_spSkeleton, self);
-    spBone *rootBone = self->root;
-    float pa = parent->a, pb = parent->b, pc = parent->c, pd = parent->d;
-    CONST_CAST(float, rootBone->worldX) = pa * self->x + pb * self->y + parent->worldX;
-    CONST_CAST(float, rootBone->worldY) = pc * self->x + pd * self->y + parent->worldY;
-
-    rotationY = rootBone->rotation + 90 + rootBone->shearY;
-    la = COS_DEG(rootBone->rotation + rootBone->shearX) * rootBone->scaleX;
-    lb = COS_DEG(rotationY) * rootBone->scaleY;
-    lc = SIN_DEG(rootBone->rotation + rootBone->shearX) * rootBone->scaleX;
-    ld = SIN_DEG(rotationY) * rootBone->scaleY;
-    CONST_CAST(float, rootBone->a) = (pa * la + pb * lc) * self->scaleX;
-    CONST_CAST(float, rootBone->b) = (pa * lb + pb * ld) * self->scaleX;
-    CONST_CAST(float, rootBone->c) = (pc * la + pd * lc) * self->scaleY;
-    CONST_CAST(float, rootBone->d) = (pc * lb + pd * ld) * self->scaleY;
-
-    /* Update everything except root bone. */
-    updateCache = internal->updateCache;
-    for (i = 0; i < internal->updateCacheCount; ++i) {
-        _spUpdate* update = internal->updateCache + i;
-        switch (update->type) {
-            case SP_UPDATE_BONE:
-                if ((spBone*)update->object != rootBone) spBone_updateWorldTransform((spBone*)update->object);
-                break;
-            case SP_UPDATE_IK_CONSTRAINT:
-                spIkConstraint_update((spIkConstraint *) update->object);
-                break;
-            case SP_UPDATE_TRANSFORM_CONSTRAINT:
-                spTransformConstraint_update((spTransformConstraint *) update->object);
-                break;
-            case SP_UPDATE_PATH_CONSTRAINT:
-                spPathConstraint_update((spPathConstraint *) update->object);
-                break;
-        }
-    }
+	int i;
+	float rotationY, la, lb, lc, ld;
+	_spUpdate *updateCache;
+	_spSkeleton *internal = SUB_CAST(_spSkeleton, self);
+	spBone *rootBone = self->root;
+	float pa = parent->a, pb = parent->b, pc = parent->c, pd = parent->d;
+	CONST_CAST(float, rootBone->worldX) = pa * self->x + pb * self->y + parent->worldX;
+	CONST_CAST(float, rootBone->worldY) = pc * self->x + pd * self->y + parent->worldY;
+
+	rotationY = rootBone->rotation + 90 + rootBone->shearY;
+	la = COS_DEG(rootBone->rotation + rootBone->shearX) * rootBone->scaleX;
+	lb = COS_DEG(rotationY) * rootBone->scaleY;
+	lc = SIN_DEG(rootBone->rotation + rootBone->shearX) * rootBone->scaleX;
+	ld = SIN_DEG(rotationY) * rootBone->scaleY;
+	CONST_CAST(float, rootBone->a) = (pa * la + pb * lc) * self->scaleX;
+	CONST_CAST(float, rootBone->b) = (pa * lb + pb * ld) * self->scaleX;
+	CONST_CAST(float, rootBone->c) = (pc * la + pd * lc) * self->scaleY;
+	CONST_CAST(float, rootBone->d) = (pc * lb + pd * ld) * self->scaleY;
+
+	/* Update everything except root bone. */
+	updateCache = internal->updateCache;
+	for (i = 0; i < internal->updateCacheCount; ++i) {
+		_spUpdate *update = internal->updateCache + i;
+		switch (update->type) {
+			case SP_UPDATE_BONE:
+				if ((spBone *) update->object != rootBone) spBone_updateWorldTransform((spBone *) update->object);
+				break;
+			case SP_UPDATE_IK_CONSTRAINT:
+				spIkConstraint_update((spIkConstraint *) update->object);
+				break;
+			case SP_UPDATE_TRANSFORM_CONSTRAINT:
+				spTransformConstraint_update((spTransformConstraint *) update->object);
+				break;
+			case SP_UPDATE_PATH_CONSTRAINT:
+				spPathConstraint_update((spPathConstraint *) update->object);
+				break;
+		}
+	}
 }
 
-void spSkeleton_setToSetupPose (const spSkeleton* self) {
+void spSkeleton_setToSetupPose(const spSkeleton *self) {
 	spSkeleton_setBonesToSetupPose(self);
 	spSkeleton_setSlotsToSetupPose(self);
 }
 
-void spSkeleton_setBonesToSetupPose (const spSkeleton* self) {
+void spSkeleton_setBonesToSetupPose(const spSkeleton *self) {
 	int i;
 	for (i = 0; i < self->bonesCount; ++i)
 		spBone_setToSetupPose(self->bones[i]);
 
 	for (i = 0; i < self->ikConstraintsCount; ++i) {
-		spIkConstraint* ikConstraint = self->ikConstraints[i];
+		spIkConstraint *ikConstraint = self->ikConstraints[i];
 		ikConstraint->bendDirection = ikConstraint->data->bendDirection;
 		ikConstraint->compress = ikConstraint->data->compress;
 		ikConstraint->stretch = ikConstraint->data->stretch;
@@ -465,63 +481,63 @@ void spSkeleton_setBonesToSetupPose (const spSkeleton* self) {
 	}
 
 	for (i = 0; i < self->transformConstraintsCount; ++i) {
-		spTransformConstraint* constraint = self->transformConstraints[i];
-		spTransformConstraintData* data = constraint->data;
-        constraint->mixRotate = data->mixRotate;
-        constraint->mixX = data->mixX;
-        constraint->mixY = data->mixY;
-        constraint->mixScaleX = data->mixScaleX;
-        constraint->mixScaleY = data->mixScaleY;
-        constraint->mixShearY = data->mixShearY;
+		spTransformConstraint *constraint = self->transformConstraints[i];
+		spTransformConstraintData *data = constraint->data;
+		constraint->mixRotate = data->mixRotate;
+		constraint->mixX = data->mixX;
+		constraint->mixY = data->mixY;
+		constraint->mixScaleX = data->mixScaleX;
+		constraint->mixScaleY = data->mixScaleY;
+		constraint->mixShearY = data->mixShearY;
 	}
 
 	for (i = 0; i < self->pathConstraintsCount; ++i) {
-		spPathConstraint* constraint = self->pathConstraints[i];
-		spPathConstraintData* data = constraint->data;
+		spPathConstraint *constraint = self->pathConstraints[i];
+		spPathConstraintData *data = constraint->data;
 		constraint->position = data->position;
 		constraint->spacing = data->spacing;
-        constraint->mixRotate = data->mixRotate;
-        constraint->mixX = data->mixX;
-        constraint->mixY = data->mixY;
+		constraint->mixRotate = data->mixRotate;
+		constraint->mixX = data->mixX;
+		constraint->mixY = data->mixY;
 	}
 }
 
-void spSkeleton_setSlotsToSetupPose (const spSkeleton* self) {
+void spSkeleton_setSlotsToSetupPose(const spSkeleton *self) {
 	int i;
-	memcpy(self->drawOrder, self->slots, self->slotsCount * sizeof(spSlot*));
+	memcpy(self->drawOrder, self->slots, self->slotsCount * sizeof(spSlot *));
 	for (i = 0; i < self->slotsCount; ++i)
 		spSlot_setToSetupPose(self->slots[i]);
 }
 
-spBone* spSkeleton_findBone (const spSkeleton* self, const char* boneName) {
+spBone *spSkeleton_findBone(const spSkeleton *self, const char *boneName) {
 	int i;
 	for (i = 0; i < self->bonesCount; ++i)
 		if (strcmp(self->data->bones[i]->name, boneName) == 0) return self->bones[i];
 	return 0;
 }
 
-int spSkeleton_findBoneIndex (const spSkeleton* self, const char* boneName) {
+int spSkeleton_findBoneIndex(const spSkeleton *self, const char *boneName) {
 	int i;
 	for (i = 0; i < self->bonesCount; ++i)
 		if (strcmp(self->data->bones[i]->name, boneName) == 0) return i;
 	return -1;
 }
 
-spSlot* spSkeleton_findSlot (const spSkeleton* self, const char* slotName) {
+spSlot *spSkeleton_findSlot(const spSkeleton *self, const char *slotName) {
 	int i;
 	for (i = 0; i < self->slotsCount; ++i)
 		if (strcmp(self->data->slots[i]->name, slotName) == 0) return self->slots[i];
 	return 0;
 }
 
-int spSkeleton_findSlotIndex (const spSkeleton* self, const char* slotName) {
+int spSkeleton_findSlotIndex(const spSkeleton *self, const char *slotName) {
 	int i;
 	for (i = 0; i < self->slotsCount; ++i)
 		if (strcmp(self->data->slots[i]->name, slotName) == 0) return i;
 	return -1;
 }
 
-int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
+int spSkeleton_setSkinByName(spSkeleton *self, const char *skinName) {
 	spSkin *skin;
 	if (!skinName) {
 		spSkeleton_setSkin(self, 0);
@@ -533,7 +549,7 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
 	return 1;
 }
 
-void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
+void spSkeleton_setSkin(spSkeleton *self, spSkin *newSkin) {
 	if (self->skin == newSkin) return;
 	if (newSkin) {
 		if (self->skin)
@@ -542,9 +558,9 @@ void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
 			/* No previous skin, attach setup pose attachments. */
 			int i;
 			for (i = 0; i < self->slotsCount; ++i) {
-				spSlot* slot = self->slots[i];
+				spSlot *slot = self->slots[i];
 				if (slot->data->attachmentName) {
-					spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
+					spAttachment *attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
 					if (attachment) spSlot_setAttachment(slot, attachment);
 				}
 			}
@@ -554,12 +570,13 @@ void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
 	spSkeleton_updateCache(self);
 }
 
-spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName) {
+spAttachment *
+spSkeleton_getAttachmentForSlotName(const spSkeleton *self, const char *slotName, const char *attachmentName) {
 	int slotIndex = spSkeletonData_findSlotIndex(self->data, slotName);
 	return spSkeleton_getAttachmentForSlotIndex(self, slotIndex, attachmentName);
 }
 
-spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int slotIndex, const char* attachmentName) {
+spAttachment *spSkeleton_getAttachmentForSlotIndex(const spSkeleton *self, int slotIndex, const char *attachmentName) {
 	if (slotIndex == -1) return 0;
 	if (self->skin) {
 		spAttachment *attachment = spSkin_getAttachment(self->skin, slotIndex, attachmentName);
@@ -572,7 +589,7 @@ spAttachment* spSkeleton_getAttachmentForSlotIndex (const spSkeleton* self, int
 	return 0;
 }
 
-int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char* attachmentName) {
+int spSkeleton_setAttachment(spSkeleton *self, const char *slotName, const char *attachmentName) {
 	int i;
 	for (i = 0; i < self->slotsCount; ++i) {
 		spSlot *slot = self->slots[i];
@@ -580,7 +597,7 @@ int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char
 			if (!attachmentName)
 				spSlot_setAttachment(slot, 0);
 			else {
-				spAttachment* attachment = spSkeleton_getAttachmentForSlotIndex(self, i, attachmentName);
+				spAttachment *attachment = spSkeleton_getAttachmentForSlotIndex(self, i, attachmentName);
 				if (!attachment) return 0;
 				spSlot_setAttachment(slot, attachment);
 			}
@@ -590,27 +607,28 @@ int spSkeleton_setAttachment (spSkeleton* self, const char* slotName, const char
 	return 0;
 }
 
-spIkConstraint* spSkeleton_findIkConstraint (const spSkeleton* self, const char* constraintName) {
+spIkConstraint *spSkeleton_findIkConstraint(const spSkeleton *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->ikConstraintsCount; ++i)
 		if (strcmp(self->ikConstraints[i]->data->name, constraintName) == 0) return self->ikConstraints[i];
 	return 0;
 }
 
-spTransformConstraint* spSkeleton_findTransformConstraint (const spSkeleton* self, const char* constraintName) {
+spTransformConstraint *spSkeleton_findTransformConstraint(const spSkeleton *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->transformConstraintsCount; ++i)
-		if (strcmp(self->transformConstraints[i]->data->name, constraintName) == 0) return self->transformConstraints[i];
+		if (strcmp(self->transformConstraints[i]->data->name, constraintName) == 0)
+			return self->transformConstraints[i];
 	return 0;
 }
 
-spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self, const char* constraintName) {
+spPathConstraint *spSkeleton_findPathConstraint(const spSkeleton *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->pathConstraintsCount; ++i)
 		if (strcmp(self->pathConstraints[i]->data->name, constraintName) == 0) return self->pathConstraints[i];
 	return 0;
 }
 
-void spSkeleton_update (spSkeleton* self, float deltaTime) {
+void spSkeleton_update(spSkeleton *self, float deltaTime) {
 	self->time += deltaTime;
 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 496 - 471
spine-c/spine-c/src/spine/SkeletonBinary.c


+ 35 - 30
spine-c/spine-c/src/spine/SkeletonBounds.c

@@ -31,19 +31,19 @@
 #include <limits.h>
 #include <spine/extension.h>
 
-spPolygon* spPolygon_create (int capacity) {
-	spPolygon* self = NEW(spPolygon);
+spPolygon *spPolygon_create(int capacity) {
+	spPolygon *self = NEW(spPolygon);
 	self->capacity = capacity;
 	CONST_CAST(float*, self->vertices) = MALLOC(float, capacity);
 	return self;
 }
 
-void spPolygon_dispose (spPolygon* self) {
+void spPolygon_dispose(spPolygon *self) {
 	FREE(self->vertices);
 	FREE(self);
 }
 
-int/*bool*/spPolygon_containsPoint (spPolygon* self, float x, float y) {
+int/*bool*/spPolygon_containsPoint(spPolygon *self, float x, float y) {
 	int prevIndex = self->count - 2;
 	int inside = 0;
 	int i;
@@ -52,14 +52,15 @@ int/*bool*/spPolygon_containsPoint (spPolygon* self, float x, float y) {
 		float prevY = self->vertices[prevIndex + 1];
 		if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) {
 			float vertexX = self->vertices[i];
-			if (vertexX + (y - vertexY) / (prevY - vertexY) * (self->vertices[prevIndex] - vertexX) < x) inside = !inside;
+			if (vertexX + (y - vertexY) / (prevY - vertexY) * (self->vertices[prevIndex] - vertexX) < x)
+				inside = !inside;
 		}
 		prevIndex = i;
 	}
 	return inside;
 }
 
-int/*bool*/spPolygon_intersectsSegment (spPolygon* self, float x1, float y1, float x2, float y2) {
+int/*bool*/spPolygon_intersectsSegment(spPolygon *self, float x1, float y1, float x2, float y2) {
 	float width12 = x1 - x2, height12 = y1 - y2;
 	float det1 = x1 * y2 - y1 * x2;
 	float x3 = self->vertices[self->count - 2], y3 = self->vertices[self->count - 1];
@@ -72,7 +73,8 @@ int/*bool*/spPolygon_intersectsSegment (spPolygon* self, float x1, float y1, flo
 		float x = (det1 * width34 - width12 * det2) / det3;
 		if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1))) {
 			float y = (det1 * height34 - height12 * det2) / det3;
-			if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1))) return 1;
+			if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)))
+				return 1;
 		}
 		x3 = x4;
 		y3 = y4;
@@ -87,11 +89,11 @@ typedef struct {
 	int capacity;
 } _spSkeletonBounds;
 
-spSkeletonBounds* spSkeletonBounds_create () {
+spSkeletonBounds *spSkeletonBounds_create() {
 	return SUPER(NEW(_spSkeletonBounds));
 }
 
-void spSkeletonBounds_dispose (spSkeletonBounds* self) {
+void spSkeletonBounds_dispose(spSkeletonBounds *self) {
 	int i;
 	for (i = 0; i < SUB_CAST(_spSkeletonBounds, self)->capacity; ++i)
 		if (self->polygons[i]) spPolygon_dispose(self->polygons[i]);
@@ -100,40 +102,40 @@ void spSkeletonBounds_dispose (spSkeletonBounds* self) {
 	FREE(self);
 }
 
-void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/*bool*/updateAabb) {
+void spSkeletonBounds_update(spSkeletonBounds *self, spSkeleton *skeleton, int/*bool*/updateAabb) {
 	int i;
 
-	_spSkeletonBounds* internal = SUB_CAST(_spSkeletonBounds, self);
+	_spSkeletonBounds *internal = SUB_CAST(_spSkeletonBounds, self);
 	if (internal->capacity < skeleton->slotsCount) {
-		spPolygon** newPolygons;
+		spPolygon **newPolygons;
 
 		FREE(self->boundingBoxes);
 		self->boundingBoxes = MALLOC(spBoundingBoxAttachment*, skeleton->slotsCount);
 
 		newPolygons = CALLOC(spPolygon*, skeleton->slotsCount);
-		memcpy(newPolygons, self->polygons, sizeof(spPolygon*) * internal->capacity);
+		memcpy(newPolygons, self->polygons, sizeof(spPolygon *) * internal->capacity);
 		FREE(self->polygons);
 		self->polygons = newPolygons;
 
 		internal->capacity = skeleton->slotsCount;
 	}
 
-	self->minX = (float)INT_MAX;
-	self->minY = (float)INT_MAX;
-	self->maxX = (float)INT_MIN;
-	self->maxY = (float)INT_MIN;
+	self->minX = (float) INT_MAX;
+	self->minY = (float) INT_MAX;
+	self->maxX = (float) INT_MIN;
+	self->maxY = (float) INT_MIN;
 
 	self->count = 0;
 	for (i = 0; i < skeleton->slotsCount; ++i) {
-		spPolygon* polygon;
-		spBoundingBoxAttachment* boundingBox;
-		spAttachment* attachment;
+		spPolygon *polygon;
+		spBoundingBoxAttachment *boundingBox;
+		spAttachment *attachment;
 
-		spSlot* slot = skeleton->slots[i];
+		spSlot *slot = skeleton->slots[i];
 		if (!slot->bone->active) continue;
 		attachment = slot->attachment;
 		if (!attachment || attachment->type != SP_ATTACHMENT_BOUNDING_BOX) continue;
-		boundingBox = (spBoundingBoxAttachment*)attachment;
+		boundingBox = (spBoundingBoxAttachment *) attachment;
 		self->boundingBoxes[self->count] = boundingBox;
 
 		polygon = self->polygons[self->count];
@@ -160,17 +162,18 @@ void spSkeletonBounds_update (spSkeletonBounds* self, spSkeleton* skeleton, int/
 	}
 }
 
-int/*bool*/spSkeletonBounds_aabbContainsPoint (spSkeletonBounds* self, float x, float y) {
+int/*bool*/spSkeletonBounds_aabbContainsPoint(spSkeletonBounds *self, float x, float y) {
 	return x >= self->minX && x <= self->maxX && y >= self->minY && y <= self->maxY;
 }
 
-int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2) {
+int/*bool*/spSkeletonBounds_aabbIntersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2) {
 	float m, x, y;
 	if ((x1 <= self->minX && x2 <= self->minX)
 		|| (y1 <= self->minY && y2 <= self->minY)
 		|| (x1 >= self->maxX && x2 >= self->maxX)
 		|| (y1 >= self->maxY && y2 >= self->maxY)
-	) return 0;
+			)
+		return 0;
 	m = (y2 - y1) / (x2 - x1);
 	y = m * (self->minX - x1) + y1;
 	if (y > self->minY && y < self->maxY) return 1;
@@ -183,25 +186,27 @@ int/*bool*/spSkeletonBounds_aabbIntersectsSegment (spSkeletonBounds* self, float
 	return 0;
 }
 
-int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton (spSkeletonBounds* self, spSkeletonBounds* bounds) {
-	return self->minX < bounds->maxX && self->maxX > bounds->minX && self->minY < bounds->maxY && self->maxY > bounds->minY;
+int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton(spSkeletonBounds *self, spSkeletonBounds *bounds) {
+	return self->minX < bounds->maxX && self->maxX > bounds->minX && self->minY < bounds->maxY &&
+		   self->maxY > bounds->minY;
 }
 
-spBoundingBoxAttachment* spSkeletonBounds_containsPoint (spSkeletonBounds* self, float x, float y) {
+spBoundingBoxAttachment *spSkeletonBounds_containsPoint(spSkeletonBounds *self, float x, float y) {
 	int i;
 	for (i = 0; i < self->count; ++i)
 		if (spPolygon_containsPoint(self->polygons[i], x, y)) return self->boundingBoxes[i];
 	return 0;
 }
 
-spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBounds* self, float x1, float y1, float x2, float y2) {
+spBoundingBoxAttachment *
+spSkeletonBounds_intersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2) {
 	int i;
 	for (i = 0; i < self->count; ++i)
 		if (spPolygon_intersectsSegment(self->polygons[i], x1, y1, x2, y2)) return self->boundingBoxes[i];
 	return 0;
 }
 
-spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox) {
+spPolygon *spSkeletonBounds_getPolygon(spSkeletonBounds *self, spBoundingBoxAttachment *boundingBox) {
 	int i;
 	for (i = 0; i < self->count; ++i)
 		if (self->boundingBoxes[i] == boundingBox) return self->polygons[i];

+ 58 - 43
spine-c/spine-c/src/spine/SkeletonClipping.c

@@ -30,8 +30,8 @@
 #include <spine/SkeletonClipping.h>
 #include <spine/extension.h>
 
-spSkeletonClipping* spSkeletonClipping_create() {
-	spSkeletonClipping* clipping = CALLOC(spSkeletonClipping, 1);
+spSkeletonClipping *spSkeletonClipping_create() {
+	spSkeletonClipping *clipping = CALLOC(spSkeletonClipping, 1);
 
 	clipping->triangulator = spTriangulator_create();
 	clipping->clippingPolygon = spFloatArray_create(128);
@@ -44,7 +44,7 @@ spSkeletonClipping* spSkeletonClipping_create() {
 	return clipping;
 }
 
-void spSkeletonClipping_dispose(spSkeletonClipping* self) {
+void spSkeletonClipping_dispose(spSkeletonClipping *self) {
 	spTriangulator_dispose(self->triangulator);
 	spFloatArray_dispose(self->clippingPolygon);
 	spFloatArray_dispose(self->clipOutput);
@@ -55,12 +55,13 @@ void spSkeletonClipping_dispose(spSkeletonClipping* self) {
 	FREE(self);
 }
 
-static void _makeClockwise (spFloatArray* polygon) {
+static void _makeClockwise(spFloatArray *polygon) {
 	int i, n, lastX;
-	float* vertices = polygon->items;
+	float *vertices = polygon->items;
 	int verticeslength = polygon->size;
 
-	float area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x, p1y, p2x, p2y;
+	float area =
+			vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x, p1y, p2x, p2y;
 	for (i = 0, n = verticeslength - 3; i < n; i += 2) {
 		p1x = vertices[i];
 		p1y = vertices[i + 1];
@@ -80,9 +81,9 @@ static void _makeClockwise (spFloatArray* polygon) {
 	}
 }
 
-int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClippingAttachment* clip) {
+int spSkeletonClipping_clipStart(spSkeletonClipping *self, spSlot *slot, spClippingAttachment *clip) {
 	int i, n;
-	float* vertices;
+	float *vertices;
 	if (self->clipAttachment) return 0;
 	self->clipAttachment = clip;
 
@@ -90,9 +91,11 @@ int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClipp
 	vertices = spFloatArray_setSize(self->clippingPolygon, n)->items;
 	spVertexAttachment_computeWorldVertices(SUPER(clip), slot, 0, n, vertices, 0, 2);
 	_makeClockwise(self->clippingPolygon);
-	self->clippingPolygons = spTriangulator_decompose(self->triangulator, self->clippingPolygon, spTriangulator_triangulate(self->triangulator, self->clippingPolygon));
+	self->clippingPolygons = spTriangulator_decompose(self->triangulator, self->clippingPolygon,
+													  spTriangulator_triangulate(self->triangulator,
+																				 self->clippingPolygon));
 	for (i = 0, n = self->clippingPolygons->size; i < n; i++) {
-		spFloatArray* polygon = self->clippingPolygons->items[i];
+		spFloatArray *polygon = self->clippingPolygons->items[i];
 		_makeClockwise(polygon);
 		spFloatArray_add(polygon, polygon->items[0]);
 		spFloatArray_add(polygon, polygon->items[1]);
@@ -100,11 +103,11 @@ int spSkeletonClipping_clipStart(spSkeletonClipping* self, spSlot* slot, spClipp
 	return self->clippingPolygons->size;
 }
 
-void spSkeletonClipping_clipEnd(spSkeletonClipping* self, spSlot* slot) {
+void spSkeletonClipping_clipEnd(spSkeletonClipping *self, spSlot *slot) {
 	if (self->clipAttachment != 0 && self->clipAttachment->endSlot == slot->data) spSkeletonClipping_clipEnd2(self);
 }
 
-void spSkeletonClipping_clipEnd2(spSkeletonClipping* self) {
+void spSkeletonClipping_clipEnd2(spSkeletonClipping *self) {
 	if (!self->clipAttachment) return;
 	self->clipAttachment = 0;
 	self->clippingPolygons = 0;
@@ -114,18 +117,20 @@ void spSkeletonClipping_clipEnd2(spSkeletonClipping* self) {
 	spFloatArray_clear(self->clippingPolygon);
 }
 
-int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping* self) {
+int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping *self) {
 	return self->clipAttachment != 0;
 }
 
-int /*boolean*/ _clip(spSkeletonClipping* self, float x1, float y1, float x2, float y2, float x3, float y3, spFloatArray* clippingArea, spFloatArray* output) {
+int /*boolean*/
+_clip(spSkeletonClipping *self, float x1, float y1, float x2, float y2, float x3, float y3, spFloatArray *clippingArea,
+	  spFloatArray *output) {
 	int i;
-	spFloatArray* originalOutput = output;
+	spFloatArray *originalOutput = output;
 	int clipped = 0;
-	float* clippingVertices;
+	float *clippingVertices;
 	int clippingVerticesLast;
 
-	spFloatArray* input = 0;
+	spFloatArray *input = 0;
 	if (clippingArea->size % 4 >= 2) {
 		input = output;
 		output = self->scratch;
@@ -147,12 +152,12 @@ int /*boolean*/ _clip(spSkeletonClipping* self, float x1, float y1, float x2, fl
 	clippingVerticesLast = clippingArea->size - 4;
 	for (i = 0;; i += 2) {
 		int ii;
-		spFloatArray* temp;
+		spFloatArray *temp;
 		float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
 		float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];
 		float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;
 
-		float* inputVertices = input->items;
+		float *inputVertices = input->items;
 		int inputVerticesLength = input->size - 2, outputStart = output->size;
 		for (ii = 0; ii < inputVerticesLength; ii += 2) {
 			float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
@@ -217,13 +222,14 @@ int /*boolean*/ _clip(spSkeletonClipping* self, float x1, float y1, float x2, fl
 	return clipped;
 }
 
-void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices, int verticesLength, unsigned short* triangles, int trianglesLength, float* uvs, int stride) {
+void spSkeletonClipping_clipTriangles(spSkeletonClipping *self, float *vertices, int verticesLength,
+									  unsigned short *triangles, int trianglesLength, float *uvs, int stride) {
 	int i;
-	spFloatArray* clipOutput = self->clipOutput;
-	spFloatArray* clippedVertices = self->clippedVertices;
-	spFloatArray* clippedUVs = self->clippedUVs;
-	spUnsignedShortArray* clippedTriangles = self->clippedTriangles;
-	spFloatArray** polygons = self->clippingPolygons->items;
+	spFloatArray *clipOutput = self->clipOutput;
+	spFloatArray *clippedVertices = self->clippedVertices;
+	spFloatArray *clippedUVs = self->clippedUVs;
+	spUnsignedShortArray *clippedTriangles = self->clippedTriangles;
+	spFloatArray **polygons = self->clippingPolygons->items;
 	int polygonsCount = self->clippingPolygons->size;
 
 	short index = 0;
@@ -240,27 +246,34 @@ void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices,
 		float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
 
 		vertexOffset = triangles[i + 1] * stride;
-		x2 = vertices[vertexOffset]; y2 = vertices[vertexOffset + 1];
-		u2 = uvs[vertexOffset]; v2 = uvs[vertexOffset + 1];
+		x2 = vertices[vertexOffset];
+		y2 = vertices[vertexOffset + 1];
+		u2 = uvs[vertexOffset];
+		v2 = uvs[vertexOffset + 1];
 
 		vertexOffset = triangles[i + 2] * stride;
-		x3 = vertices[vertexOffset]; y3 = vertices[vertexOffset + 1];
-		u3 = uvs[vertexOffset]; v3 = uvs[vertexOffset + 1];
+		x3 = vertices[vertexOffset];
+		y3 = vertices[vertexOffset + 1];
+		u3 = uvs[vertexOffset];
+		v3 = uvs[vertexOffset + 1];
 
 		for (p = 0; p < polygonsCount; p++) {
 			int s = clippedVertices->size;
 			if (_clip(self, x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
 				int ii;
 				float d0, d1, d2, d4, d;
-				unsigned short* clippedTrianglesItems;
+				unsigned short *clippedTrianglesItems;
 				int clipOutputCount;
-				float* clipOutputItems;
-				float* clippedVerticesItems;
-				float* clippedUVsItems;
+				float *clipOutputItems;
+				float *clippedVerticesItems;
+				float *clippedUVsItems;
 
 				int clipOutputLength = clipOutput->size;
 				if (clipOutputLength == 0) continue;
-				d0 = y2 - y3; d1 = x3 - x2; d2 = x1 - x3; d4 = y3 - y1;
+				d0 = y2 - y3;
+				d1 = x3 - x2;
+				d2 = x1 - x3;
+				d4 = y3 - y1;
 				d = 1 / (d0 * d2 + d1 * (y1 - y3));
 
 				clipOutputCount = clipOutputLength >> 1;
@@ -272,7 +285,8 @@ void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices,
 					float x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
 					clippedVerticesItems[s] = x;
 					clippedVerticesItems[s + 1] = y;
-					c0 = x - x3; c1 = y - y3;
+					c0 = x - x3;
+					c1 = y - y3;
 					a = (d0 * c0 + d1 * c1) * d;
 					b = (d4 * c0 + d2 * c1) * d;
 					c = 1 - a - b;
@@ -282,20 +296,21 @@ void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices,
 				}
 
 				s = clippedTriangles->size;
-				clippedTrianglesItems = spUnsignedShortArray_setSize(clippedTriangles, s + 3 * (clipOutputCount - 2))->items;
+				clippedTrianglesItems = spUnsignedShortArray_setSize(clippedTriangles,
+																	 s + 3 * (clipOutputCount - 2))->items;
 				clipOutputCount--;
 				for (ii = 1; ii < clipOutputCount; ii++) {
 					clippedTrianglesItems[s] = index;
-					clippedTrianglesItems[s + 1] = (unsigned short)(index + ii);
-					clippedTrianglesItems[s + 2] = (unsigned short)(index + ii + 1);
+					clippedTrianglesItems[s + 1] = (unsigned short) (index + ii);
+					clippedTrianglesItems[s + 2] = (unsigned short) (index + ii + 1);
 					s += 3;
 				}
 				index += clipOutputCount + 1;
 
 			} else {
-				unsigned short* clippedTrianglesItems;
-				float* clippedVerticesItems = spFloatArray_setSize(clippedVertices, s + (3 << 1))->items;
-				float* clippedUVsItems = spFloatArray_setSize(clippedUVs, s + (3 << 1))->items;
+				unsigned short *clippedTrianglesItems;
+				float *clippedVerticesItems = spFloatArray_setSize(clippedVertices, s + (3 << 1))->items;
+				float *clippedUVsItems = spFloatArray_setSize(clippedUVs, s + (3 << 1))->items;
 				clippedVerticesItems[s] = x1;
 				clippedVerticesItems[s + 1] = y1;
 				clippedVerticesItems[s + 2] = x2;
@@ -313,8 +328,8 @@ void spSkeletonClipping_clipTriangles(spSkeletonClipping* self, float* vertices,
 				s = clippedTriangles->size;
 				clippedTrianglesItems = spUnsignedShortArray_setSize(clippedTriangles, s + 3)->items;
 				clippedTrianglesItems[s] = index;
-				clippedTrianglesItems[s + 1] = (unsigned short)(index + 1);
-				clippedTrianglesItems[s + 2] = (unsigned short)(index + 2);
+				clippedTrianglesItems[s + 1] = (unsigned short) (index + 1);
+				clippedTrianglesItems[s + 2] = (unsigned short) (index + 2);
 				index += 3;
 				i += 3;
 				goto continue_outer;

+ 28 - 27
spine-c/spine-c/src/spine/SkeletonData.c

@@ -31,11 +31,11 @@
 #include <string.h>
 #include <spine/extension.h>
 
-spSkeletonData* spSkeletonData_create () {
+spSkeletonData *spSkeletonData_create() {
 	return NEW(spSkeletonData);
 }
 
-void spSkeletonData_dispose (spSkeletonData* self) {
+void spSkeletonData_dispose(spSkeletonData *self) {
 	int i;
 
 	for (i = 0; i < self->stringsCount; ++i)
@@ -80,93 +80,94 @@ void spSkeletonData_dispose (spSkeletonData* self) {
 	FREE(self);
 }
 
-spBoneData* spSkeletonData_findBone (const spSkeletonData* self, const char* boneName) {
+spBoneData *spSkeletonData_findBone(const spSkeletonData *self, const char *boneName) {
 	int i;
 	for (i = 0; i < self->bonesCount; ++i)
 		if (strcmp(self->bones[i]->name, boneName) == 0) return self->bones[i];
 	return 0;
 }
 
-int spSkeletonData_findBoneIndex (const spSkeletonData* self, const char* boneName) {
+int spSkeletonData_findBoneIndex(const spSkeletonData *self, const char *boneName) {
 	int i;
 	for (i = 0; i < self->bonesCount; ++i)
 		if (strcmp(self->bones[i]->name, boneName) == 0) return i;
 	return -1;
 }
 
-spSlotData* spSkeletonData_findSlot (const spSkeletonData* self, const char* slotName) {
+spSlotData *spSkeletonData_findSlot(const spSkeletonData *self, const char *slotName) {
 	int i;
 	for (i = 0; i < self->slotsCount; ++i)
 		if (strcmp(self->slots[i]->name, slotName) == 0) return self->slots[i];
 	return 0;
 }
 
-int spSkeletonData_findSlotIndex (const spSkeletonData* self, const char* slotName) {
+int spSkeletonData_findSlotIndex(const spSkeletonData *self, const char *slotName) {
 	int i;
 	for (i = 0; i < self->slotsCount; ++i)
 		if (strcmp(self->slots[i]->name, slotName) == 0) return i;
 	return -1;
 }
 
-spSkin* spSkeletonData_findSkin (const spSkeletonData* self, const char* skinName) {
+spSkin *spSkeletonData_findSkin(const spSkeletonData *self, const char *skinName) {
 	int i;
 	for (i = 0; i < self->skinsCount; ++i)
 		if (strcmp(self->skins[i]->name, skinName) == 0) return self->skins[i];
 	return 0;
 }
 
-spEventData* spSkeletonData_findEvent (const spSkeletonData* self, const char* eventName) {
+spEventData *spSkeletonData_findEvent(const spSkeletonData *self, const char *eventName) {
 	int i;
 	for (i = 0; i < self->eventsCount; ++i)
 		if (strcmp(self->events[i]->name, eventName) == 0) return self->events[i];
 	return 0;
 }
 
-spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName) {
+spAnimation *spSkeletonData_findAnimation(const spSkeletonData *self, const char *animationName) {
 	int i;
 	for (i = 0; i < self->animationsCount; ++i)
 		if (strcmp(self->animations[i]->name, animationName) == 0) return self->animations[i];
 	return 0;
 }
 
-spIkConstraintData* spSkeletonData_findIkConstraint (const spSkeletonData* self, const char* constraintName) {
+spIkConstraintData *spSkeletonData_findIkConstraint(const spSkeletonData *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->ikConstraintsCount; ++i)
 		if (strcmp(self->ikConstraints[i]->name, constraintName) == 0) return self->ikConstraints[i];
 	return 0;
 }
 
-int spSkeletonData_findIkConstraintIndex (const spSkeletonData* self, const char* constraintName) {
-    int i;
-    for (i = 0; i < self->ikConstraintsCount; ++i)
-        if (strcmp(self->ikConstraints[i]->name, constraintName) == 0) return i;
-    return -1;
+int spSkeletonData_findIkConstraintIndex(const spSkeletonData *self, const char *constraintName) {
+	int i;
+	for (i = 0; i < self->ikConstraintsCount; ++i)
+		if (strcmp(self->ikConstraints[i]->name, constraintName) == 0) return i;
+	return -1;
 }
 
-spTransformConstraintData* spSkeletonData_findTransformConstraint (const spSkeletonData* self, const char* constraintName) {
+spTransformConstraintData *
+spSkeletonData_findTransformConstraint(const spSkeletonData *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->transformConstraintsCount; ++i)
 		if (strcmp(self->transformConstraints[i]->name, constraintName) == 0) return self->transformConstraints[i];
 	return 0;
 }
 
-int spSkeletonData_findTransformConstraintIndex (const spSkeletonData* self, const char* constraintName) {
-    int i;
-    for (i = 0; i < self->transformConstraintsCount; ++i)
-        if (strcmp(self->transformConstraints[i]->name, constraintName) == 0) return i;
-    return -1;
+int spSkeletonData_findTransformConstraintIndex(const spSkeletonData *self, const char *constraintName) {
+	int i;
+	for (i = 0; i < self->transformConstraintsCount; ++i)
+		if (strcmp(self->transformConstraints[i]->name, constraintName) == 0) return i;
+	return -1;
 }
 
-spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName) {
+spPathConstraintData *spSkeletonData_findPathConstraint(const spSkeletonData *self, const char *constraintName) {
 	int i;
 	for (i = 0; i < self->pathConstraintsCount; ++i)
 		if (strcmp(self->pathConstraints[i]->name, constraintName) == 0) return self->pathConstraints[i];
 	return 0;
 }
 
-int spSkeletonData_findPathConstraintIndex (const spSkeletonData* self, const char* constraintName) {
-    int i;
-    for (i = 0; i < self->pathConstraintsCount; ++i)
-        if (strcmp(self->pathConstraints[i]->name, constraintName) == 0) return i;
-    return -1;
+int spSkeletonData_findPathConstraintIndex(const spSkeletonData *self, const char *constraintName) {
+	int i;
+	for (i = 0; i < self->pathConstraintsCount; ++i)
+		if (strcmp(self->pathConstraints[i]->name, constraintName) == 0) return i;
+	return -1;
 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 355 - 292
spine-c/spine-c/src/spine/SkeletonJson.c


+ 47 - 40
spine-c/spine-c/src/spine/Skin.c

@@ -32,38 +32,41 @@
 #include <stdio.h>
 
 _SP_ARRAY_IMPLEMENT_TYPE(spBoneDataArray, spBoneData*)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spIkConstraintDataArray, spIkConstraintData*)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spTransformConstraintDataArray, spTransformConstraintData*)
+
 _SP_ARRAY_IMPLEMENT_TYPE(spPathConstraintDataArray, spPathConstraintData*)
 
-_Entry* _Entry_create (int slotIndex, const char* name, spAttachment* attachment) {
-	_Entry* self = NEW(_Entry);
+_Entry *_Entry_create(int slotIndex, const char *name, spAttachment *attachment) {
+	_Entry *self = NEW(_Entry);
 	self->slotIndex = slotIndex;
 	MALLOC_STR(self->name, name);
 	self->attachment = attachment;
 	return self;
 }
 
-void _Entry_dispose (_Entry* self) {
+void _Entry_dispose(_Entry *self) {
 	spAttachment_dispose(self->attachment);
 	FREE(self->name);
 	FREE(self);
 }
 
-static _SkinHashTableEntry* _SkinHashTableEntry_create (_Entry* entry) {
-	_SkinHashTableEntry* self = NEW(_SkinHashTableEntry);
+static _SkinHashTableEntry *_SkinHashTableEntry_create(_Entry *entry) {
+	_SkinHashTableEntry *self = NEW(_SkinHashTableEntry);
 	self->entry = entry;
 	return self;
 }
 
-static void _SkinHashTableEntry_dispose (_SkinHashTableEntry* self) {
+static void _SkinHashTableEntry_dispose(_SkinHashTableEntry *self) {
 	FREE(self);
 }
 
 /**/
 
-spSkin* spSkin_create (const char* name) {
-	spSkin* self = SUPER(NEW(_spSkin));
+spSkin *spSkin_create(const char *name) {
+	spSkin *self = SUPER(NEW(_spSkin));
 	MALLOC_STR(self->name, name);
 	self->bones = spBoneDataArray_create(4);
 	self->ikConstraints = spIkConstraintDataArray_create(4);
@@ -72,24 +75,24 @@ spSkin* spSkin_create (const char* name) {
 	return self;
 }
 
-void spSkin_dispose (spSkin* self) {
-	_Entry* entry = SUB_CAST(_spSkin, self)->entries;
+void spSkin_dispose(spSkin *self) {
+	_Entry *entry = SUB_CAST(_spSkin, self)->entries;
 
 	while (entry) {
-		_Entry* nextEntry = entry->next;
+		_Entry *nextEntry = entry->next;
 		_Entry_dispose(entry);
 		entry = nextEntry;
 	}
 
 	{
-		_SkinHashTableEntry** currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable;
+		_SkinHashTableEntry **currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable;
 		int i;
 
 		for (i = 0; i < SKIN_ENTRIES_HASH_TABLE_SIZE; ++i, ++currentHashtableEntry) {
-			_SkinHashTableEntry* hashtableEntry = *currentHashtableEntry;
+			_SkinHashTableEntry *hashtableEntry = *currentHashtableEntry;
 
 			while (hashtableEntry) {
-				_SkinHashTableEntry* nextEntry = hashtableEntry->next;
+				_SkinHashTableEntry *nextEntry = hashtableEntry->next;
 				_SkinHashTableEntry_dispose(hashtableEntry);
 				hashtableEntry = nextEntry;
 			}
@@ -104,9 +107,10 @@ void spSkin_dispose (spSkin* self) {
 	FREE(self);
 }
 
-void spSkin_setAttachment (spSkin* self, int slotIndex, const char* name, spAttachment* attachment) {
-	_SkinHashTableEntry* existingEntry = 0;
-	_SkinHashTableEntry* hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE];
+void spSkin_setAttachment(spSkin *self, int slotIndex, const char *name, spAttachment *attachment) {
+	_SkinHashTableEntry *existingEntry = 0;
+	_SkinHashTableEntry *hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int) slotIndex %
+																			   SKIN_ENTRIES_HASH_TABLE_SIZE];
 	while (hashEntry) {
 		if (hashEntry->entry->slotIndex == slotIndex && strcmp(hashEntry->entry->name, name) == 0) {
 			existingEntry = hashEntry;
@@ -121,31 +125,33 @@ void spSkin_setAttachment (spSkin* self, int slotIndex, const char* name, spAtta
 		if (hashEntry->entry->attachment) spAttachment_dispose(hashEntry->entry->attachment);
 		hashEntry->entry->attachment = attachment;
 	} else {
-		_Entry* newEntry = _Entry_create(slotIndex, name, attachment);
+		_Entry *newEntry = _Entry_create(slotIndex, name, attachment);
 		newEntry->next = SUB_CAST(_spSkin, self)->entries;
 		SUB_CAST(_spSkin, self)->entries = newEntry;
 		{
-			unsigned int hashTableIndex = (unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE;
-			_SkinHashTableEntry** hashTable = SUB_CAST(_spSkin, self)->entriesHashTable;
+			unsigned int hashTableIndex = (unsigned int) slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE;
+			_SkinHashTableEntry **hashTable = SUB_CAST(_spSkin, self)->entriesHashTable;
 
-			_SkinHashTableEntry* newHashEntry = _SkinHashTableEntry_create(newEntry);
+			_SkinHashTableEntry *newHashEntry = _SkinHashTableEntry_create(newEntry);
 			newHashEntry->next = hashTable[hashTableIndex];
 			SUB_CAST(_spSkin, self)->entriesHashTable[hashTableIndex] = newHashEntry;
 		}
 	}
 }
 
-spAttachment* spSkin_getAttachment (const spSkin* self, int slotIndex, const char* name) {
-	const _SkinHashTableEntry* hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int)slotIndex % SKIN_ENTRIES_HASH_TABLE_SIZE];
+spAttachment *spSkin_getAttachment(const spSkin *self, int slotIndex, const char *name) {
+	const _SkinHashTableEntry *hashEntry = SUB_CAST(_spSkin, self)->entriesHashTable[(unsigned int) slotIndex %
+																					 SKIN_ENTRIES_HASH_TABLE_SIZE];
 	while (hashEntry) {
-		if (hashEntry->entry->slotIndex == slotIndex && strcmp(hashEntry->entry->name, name) == 0) return hashEntry->entry->attachment;
+		if (hashEntry->entry->slotIndex == slotIndex && strcmp(hashEntry->entry->name, name) == 0)
+			return hashEntry->entry->attachment;
 		hashEntry = hashEntry->next;
 	}
 	return 0;
 }
 
-const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int attachmentIndex) {
-	const _Entry* entry = SUB_CAST(_spSkin, self)->entries;
+const char *spSkin_getAttachmentName(const spSkin *self, int slotIndex, int attachmentIndex) {
+	const _Entry *entry = SUB_CAST(_spSkin, self)->entries;
 	int i = 0;
 	while (entry) {
 		if (entry->slotIndex == slotIndex) {
@@ -157,7 +163,7 @@ const char* spSkin_getAttachmentName (const spSkin* self, int slotIndex, int att
 	return 0;
 }
 
-void spSkin_attachAll (const spSkin* self, spSkeleton* skeleton, const spSkin* oldSkin) {
+void spSkin_attachAll(const spSkin *self, spSkeleton *skeleton, const spSkin *oldSkin) {
 	const _Entry *entry = SUB_CAST(_spSkin, oldSkin)->entries;
 	while (entry) {
 		spSlot *slot = skeleton->slots[entry->slotIndex];
@@ -169,9 +175,9 @@ void spSkin_attachAll (const spSkin* self, spSkeleton* skeleton, const spSkin* o
 	}
 }
 
-void spSkin_addSkin(spSkin* self, const spSkin* other) {
+void spSkin_addSkin(spSkin *self, const spSkin *other) {
 	int i = 0;
-	spSkinEntry* entry;
+	spSkinEntry *entry;
 
 	for (i = 0; i < other->bones->size; i++) {
 		if (!spBoneDataArray_contains(self->bones, other->bones->items[i]))
@@ -200,9 +206,9 @@ void spSkin_addSkin(spSkin* self, const spSkin* other) {
 	}
 }
 
-void spSkin_copySkin(spSkin* self, const spSkin* other) {
+void spSkin_copySkin(spSkin *self, const spSkin *other) {
 	int i = 0;
-	spSkinEntry* entry;
+	spSkinEntry *entry;
 
 	for (i = 0; i < other->bones->size; i++) {
 		if (!spBoneDataArray_contains(self->bones, other->bones->items[i]))
@@ -227,25 +233,26 @@ void spSkin_copySkin(spSkin* self, const spSkin* other) {
 	entry = spSkin_getAttachments(other);
 	while (entry) {
 		if (entry->attachment->type == SP_ATTACHMENT_MESH) {
-			spMeshAttachment* attachment = spMeshAttachment_newLinkedMesh(SUB_CAST(spMeshAttachment, entry->attachment));
+			spMeshAttachment *attachment = spMeshAttachment_newLinkedMesh(
+					SUB_CAST(spMeshAttachment, entry->attachment));
 			spSkin_setAttachment(self, entry->slotIndex, entry->name, SUPER(SUPER(attachment)));
 		} else {
-			spAttachment* attachment = entry->attachment ? spAttachment_copy(entry->attachment) : 0;
+			spAttachment *attachment = entry->attachment ? spAttachment_copy(entry->attachment) : 0;
 			spSkin_setAttachment(self, entry->slotIndex, entry->name, attachment);
 		}
 		entry = entry->next;
 	}
 }
 
-spSkinEntry* spSkin_getAttachments(const spSkin* self) {
+spSkinEntry *spSkin_getAttachments(const spSkin *self) {
 	return SUB_CAST(_spSkin, self)->entries;
 }
 
-void spSkin_clear(spSkin* self) {
-	_Entry* entry = SUB_CAST(_spSkin, self)->entries;
+void spSkin_clear(spSkin *self) {
+	_Entry *entry = SUB_CAST(_spSkin, self)->entries;
 
 	while (entry) {
-		_Entry* nextEntry = entry->next;
+		_Entry *nextEntry = entry->next;
 		_Entry_dispose(entry);
 		entry = nextEntry;
 	}
@@ -253,14 +260,14 @@ void spSkin_clear(spSkin* self) {
 	SUB_CAST(_spSkin, self)->entries = 0;
 
 	{
-		_SkinHashTableEntry** currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable;
+		_SkinHashTableEntry **currentHashtableEntry = SUB_CAST(_spSkin, self)->entriesHashTable;
 		int i;
 
 		for (i = 0; i < SKIN_ENTRIES_HASH_TABLE_SIZE; ++i, ++currentHashtableEntry) {
-			_SkinHashTableEntry* hashtableEntry = *currentHashtableEntry;
+			_SkinHashTableEntry *hashtableEntry = *currentHashtableEntry;
 
 			while (hashtableEntry) {
-				_SkinHashTableEntry* nextEntry = hashtableEntry->next;
+				_SkinHashTableEntry *nextEntry = hashtableEntry->next;
 				_SkinHashTableEntry_dispose(hashtableEntry);
 				hashtableEntry = nextEntry;
 			}

+ 10 - 10
spine-c/spine-c/src/spine/Slot.c

@@ -35,8 +35,8 @@ typedef struct {
 	float attachmentTime;
 } _spSlot;
 
-spSlot* spSlot_create (spSlotData* data, spBone* bone) {
-	spSlot* self = SUPER(NEW(_spSlot));
+spSlot *spSlot_create(spSlotData *data, spBone *bone) {
+	spSlot *self = SUPER(NEW(_spSlot));
 	CONST_CAST(spSlotData*, self->data) = data;
 	CONST_CAST(spBone*, self->bone) = bone;
 	spColor_setFromFloats(&self->color, 1, 1, 1, 1);
@@ -45,36 +45,36 @@ spSlot* spSlot_create (spSlotData* data, spBone* bone) {
 	return self;
 }
 
-void spSlot_dispose (spSlot* self) {
+void spSlot_dispose(spSlot *self) {
 	FREE(self->deform);
 	FREE(self->darkColor);
 	FREE(self);
 }
 
-void spSlot_setAttachment (spSlot* self, spAttachment* attachment) {
+void spSlot_setAttachment(spSlot *self, spAttachment *attachment) {
 	if (attachment == self->attachment) return;
 	CONST_CAST(spAttachment*, self->attachment) = attachment;
 	SUB_CAST(_spSlot, self)->attachmentTime = self->bone->skeleton->time;
 	self->deformCount = 0;
 }
 
-void spSlot_setAttachmentTime (spSlot* self, float time) {
+void spSlot_setAttachmentTime(spSlot *self, float time) {
 	SUB_CAST(_spSlot, self)->attachmentTime = self->bone->skeleton->time - time;
 }
 
-float spSlot_getAttachmentTime (const spSlot* self) {
-	return self->bone->skeleton->time - SUB_CAST(_spSlot, self) ->attachmentTime;
+float spSlot_getAttachmentTime(const spSlot *self) {
+	return self->bone->skeleton->time - SUB_CAST(_spSlot, self)->attachmentTime;
 }
 
-void spSlot_setToSetupPose (spSlot* self) {
+void spSlot_setToSetupPose(spSlot *self) {
 	spColor_setFromColor(&self->color, &self->data->color);
 	if (self->darkColor) spColor_setFromColor(self->darkColor, self->data->darkColor);
 
 	if (!self->data->attachmentName)
 		spSlot_setAttachment(self, 0);
 	else {
-		spAttachment* attachment = spSkeleton_getAttachmentForSlotIndex(
-			self->bone->skeleton, self->data->index, self->data->attachmentName);
+		spAttachment *attachment = spSkeleton_getAttachmentForSlotIndex(
+				self->bone->skeleton, self->data->index, self->data->attachmentName);
 		CONST_CAST(spAttachment*, self->attachment) = 0;
 		spSlot_setAttachment(self, attachment);
 	}

+ 4 - 4
spine-c/spine-c/src/spine/SlotData.c

@@ -30,8 +30,8 @@
 #include <spine/SlotData.h>
 #include <spine/extension.h>
 
-spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData) {
-	spSlotData* self = NEW(spSlotData);
+spSlotData *spSlotData_create(const int index, const char *name, spBoneData *boneData) {
+	spSlotData *self = NEW(spSlotData);
 	CONST_CAST(int, self->index) = index;
 	MALLOC_STR(self->name, name);
 	CONST_CAST(spBoneData*, self->boneData) = boneData;
@@ -39,14 +39,14 @@ spSlotData* spSlotData_create (const int index, const char* name, spBoneData* bo
 	return self;
 }
 
-void spSlotData_dispose (spSlotData* self) {
+void spSlotData_dispose(spSlotData *self) {
 	FREE(self->name);
 	FREE(self->attachmentName);
 	FREE(self->darkColor);
 	FREE(self);
 }
 
-void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName) {
+void spSlotData_setAttachmentName(spSlotData *self, const char *attachmentName) {
 	FREE(self->attachmentName);
 	if (attachmentName)
 		MALLOC_STR(self->attachmentName, attachmentName);

+ 68 - 64
spine-c/spine-c/src/spine/TransformConstraint.c

@@ -31,16 +31,16 @@
 #include <spine/Skeleton.h>
 #include <spine/extension.h>
 
-spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const spSkeleton* skeleton) {
+spTransformConstraint *spTransformConstraint_create(spTransformConstraintData *data, const spSkeleton *skeleton) {
 	int i;
-	spTransformConstraint* self = NEW(spTransformConstraint);
+	spTransformConstraint *self = NEW(spTransformConstraint);
 	CONST_CAST(spTransformConstraintData*, self->data) = data;
-    self->mixRotate = data->mixRotate;
-    self->mixX = data->mixX;
-    self->mixY = data->mixY;
-    self->mixScaleX = data->mixScaleX;
-    self->mixScaleY = data->mixScaleY;
-    self->mixShearY = data->mixShearY;
+	self->mixRotate = data->mixRotate;
+	self->mixX = data->mixX;
+	self->mixY = data->mixY;
+	self->mixScaleX = data->mixScaleX;
+	self->mixScaleY = data->mixScaleY;
+	self->mixShearY = data->mixShearY;
 	self->bonesCount = data->bonesCount;
 	CONST_CAST(spBone**, self->bones) = MALLOC(spBone*, self->bonesCount);
 	for (i = 0; i < self->bonesCount; ++i)
@@ -49,23 +49,24 @@ spTransformConstraint* spTransformConstraint_create (spTransformConstraintData*
 	return self;
 }
 
-void spTransformConstraint_dispose (spTransformConstraint* self) {
+void spTransformConstraint_dispose(spTransformConstraint *self) {
 	FREE(self->bones);
 	FREE(self);
 }
 
-void _spTransformConstraint_applyAbsoluteWorld (spTransformConstraint* self) {
-    float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
-            mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
-    int /*bool*/ translate = mixX != 0 || mixY != 0;
-	spBone* target = self->target;
+void _spTransformConstraint_applyAbsoluteWorld(spTransformConstraint *self) {
+	float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
+			mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
+	int /*bool*/ translate = mixX != 0 || mixY != 0;
+	spBone *target = self->target;
 	float ta = target->a, tb = target->b, tc = target->c, td = target->d;
 	float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD;
-	float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY = self->data->offsetShearY * degRadReflect;
+	float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY =
+			self->data->offsetShearY * degRadReflect;
 	int i;
 	float a, b, c, d, r, cosine, sine, x, y, s, by;
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = self->bones[i];
+		spBone *bone = self->bones[i];
 
 		if (mixRotate != 0) {
 			a = bone->a, b = bone->b, c = bone->c, d = bone->d;
@@ -88,17 +89,17 @@ void _spTransformConstraint_applyAbsoluteWorld (spTransformConstraint* self) {
 		}
 
 		if (mixScaleX > 0) {
-            s = SQRT(bone->a * bone->a + bone->c * bone->c);
-            if (s != 0) s = (s + (SQRT(ta * ta + tc * tc) - s + self->data->offsetScaleX) * mixScaleX) / s;
-            CONST_CAST(float, bone->a) *= s;
-            CONST_CAST(float, bone->c) *= s;
+			s = SQRT(bone->a * bone->a + bone->c * bone->c);
+			if (s != 0) s = (s + (SQRT(ta * ta + tc * tc) - s + self->data->offsetScaleX) * mixScaleX) / s;
+			CONST_CAST(float, bone->a) *= s;
+			CONST_CAST(float, bone->c) *= s;
+		}
+		if (mixScaleY != 0) {
+			s = SQRT(bone->b * bone->b + bone->d * bone->d);
+			if (s != 0) s = (s + (SQRT(tb * tb + td * td) - s + self->data->offsetScaleY) * mixScaleY) / s;
+			CONST_CAST(float, bone->b) *= s;
+			CONST_CAST(float, bone->d) *= s;
 		}
-        if (mixScaleY != 0) {
-            s = SQRT(bone->b * bone->b + bone->d * bone->d);
-            if (s != 0) s = (s + (SQRT(tb * tb + td * td) - s + self->data->offsetScaleY) * mixScaleY) / s;
-            CONST_CAST(float, bone->b) *= s;
-            CONST_CAST(float, bone->d) *= s;
-        }
 
 		if (mixShearY > 0) {
 			b = bone->b, d = bone->d;
@@ -115,18 +116,19 @@ void _spTransformConstraint_applyAbsoluteWorld (spTransformConstraint* self) {
 	}
 }
 
-void _spTransformConstraint_applyRelativeWorld (spTransformConstraint* self) {
-    float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
-            mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
-    int /*bool*/ translate = mixX != 0 || mixY != 0;
-	spBone* target = self->target;
+void _spTransformConstraint_applyRelativeWorld(spTransformConstraint *self) {
+	float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
+			mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
+	int /*bool*/ translate = mixX != 0 || mixY != 0;
+	spBone *target = self->target;
 	float ta = target->a, tb = target->b, tc = target->c, td = target->d;
 	float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD;
-	float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY = self->data->offsetShearY * degRadReflect;
+	float offsetRotation = self->data->offsetRotation * degRadReflect, offsetShearY =
+			self->data->offsetShearY * degRadReflect;
 	int i;
 	float a, b, c, d, r, cosine, sine, x, y, s;
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = self->bones[i];
+		spBone *bone = self->bones[i];
 
 		if (mixRotate != 0) {
 			a = bone->a, b = bone->b, c = bone->c, d = bone->d;
@@ -148,11 +150,11 @@ void _spTransformConstraint_applyRelativeWorld (spTransformConstraint* self) {
 			CONST_CAST(float, bone->worldY) += (y * mixY);
 		}
 
-        if (mixScaleX != 0) {
-            s = (SQRT(ta * ta + tc * tc) - 1 + self->data->offsetScaleX) * mixScaleX + 1;
-            CONST_CAST(float, bone->a) *= s;
-            CONST_CAST(float, bone->c) *= s;
-        }
+		if (mixScaleX != 0) {
+			s = (SQRT(ta * ta + tc * tc) - 1 + self->data->offsetScaleX) * mixScaleX + 1;
+			CONST_CAST(float, bone->a) *= s;
+			CONST_CAST(float, bone->c) *= s;
+		}
 		if (mixScaleY > 0) {
 			s = (SQRT(tb * tb + td * td) - 1 + self->data->offsetScaleY) * mixScaleY + 1;
 			CONST_CAST(float, bone->b) *= s;
@@ -174,22 +176,22 @@ void _spTransformConstraint_applyRelativeWorld (spTransformConstraint* self) {
 	}
 }
 
-void _spTransformConstraint_applyAbsoluteLocal (spTransformConstraint* self) {
-    float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
-            mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
-	spBone* target = self->target;
+void _spTransformConstraint_applyAbsoluteLocal(spTransformConstraint *self) {
+	float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
+			mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
+	spBone *target = self->target;
 	int i;
 	float rotation, r, x, y, scaleX, scaleY, shearY;
 
 	if (!target->appliedValid) spBone_updateAppliedTransform(target);
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = self->bones[i];
+		spBone *bone = self->bones[i];
 		if (!bone->appliedValid) spBone_updateAppliedTransform(bone);
 
 		rotation = bone->arotation;
 		if (mixRotate != 0) {
 			r = target->arotation - rotation + self->data->offsetRotation;
-			r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
+			r -= (16384 - (int) (16384.499999999996 - r / 360)) * 360;
 			rotation += r * mixRotate;
 		}
 
@@ -198,15 +200,15 @@ void _spTransformConstraint_applyAbsoluteLocal (spTransformConstraint* self) {
 		y += (target->ay - y + self->data->offsetY) * mixY;
 
 		scaleX = bone->ascaleX, scaleY = bone->ascaleY;
-        if (mixScaleX != 0 && scaleX != 0)
-            scaleX = (scaleX + (target->ascaleX - scaleX + self->data->offsetScaleX) * mixScaleX) / scaleX;
-        if (mixScaleY != 0 && scaleY != 0)
-            scaleY = (scaleY + (target->ascaleY - scaleY + self->data->offsetScaleY) * mixScaleY) / scaleY;
+		if (mixScaleX != 0 && scaleX != 0)
+			scaleX = (scaleX + (target->ascaleX - scaleX + self->data->offsetScaleX) * mixScaleX) / scaleX;
+		if (mixScaleY != 0 && scaleY != 0)
+			scaleY = (scaleY + (target->ascaleY - scaleY + self->data->offsetScaleY) * mixScaleY) / scaleY;
 
 		shearY = bone->ashearY;
 		if (mixShearY != 0) {
 			r = target->ashearY - shearY + self->data->offsetShearY;
-			r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
+			r -= (16384 - (int) (16384.499999999996 - r / 360)) * 360;
 			shearY += r * mixShearY;
 		}
 
@@ -214,34 +216,36 @@ void _spTransformConstraint_applyAbsoluteLocal (spTransformConstraint* self) {
 	}
 }
 
-void _spTransformConstraint_applyRelativeLocal (spTransformConstraint* self) {
-    float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
-            mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
-	spBone* target = self->target;
+void _spTransformConstraint_applyRelativeLocal(spTransformConstraint *self) {
+	float mixRotate = self->mixRotate, mixX = self->mixX, mixY = self->mixY, mixScaleX = self->mixScaleX,
+			mixScaleY = self->mixScaleY, mixShearY = self->mixShearY;
+	spBone *target = self->target;
 	int i;
 	float rotation, x, y, scaleX, scaleY, shearY;
 
 	if (!target->appliedValid) spBone_updateAppliedTransform(target);
 
 	for (i = 0; i < self->bonesCount; ++i) {
-		spBone* bone = self->bones[i];
+		spBone *bone = self->bones[i];
 		if (!bone->appliedValid) spBone_updateAppliedTransform(bone);
 
-        rotation = bone->arotation + (target->arotation + self->data->offsetRotation) * mixRotate;
-        x = bone->ax + (target->ax + self->data->offsetX) * mixX;
-        y = bone->ay + (target->ay + self->data->offsetY) * mixY;
-        scaleX = (bone->ascaleX * ((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1);
-        scaleY = (bone->ascaleY * ((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1);
-        shearY = bone->ashearY + (target->ashearY + self->data-> offsetShearY) * mixShearY;
+		rotation = bone->arotation + (target->arotation + self->data->offsetRotation) * mixRotate;
+		x = bone->ax + (target->ax + self->data->offsetX) * mixX;
+		y = bone->ay + (target->ay + self->data->offsetY) * mixY;
+		scaleX = (bone->ascaleX * ((target->ascaleX - 1 + self->data->offsetScaleX) * mixScaleX) + 1);
+		scaleY = (bone->ascaleY * ((target->ascaleY - 1 + self->data->offsetScaleY) * mixScaleY) + 1);
+		shearY = bone->ashearY + (target->ashearY + self->data->offsetShearY) * mixShearY;
 
-        spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY);
+		spBone_updateWorldTransformWith(bone, x, y, rotation, scaleX, scaleY, bone->ashearX, shearY);
 	}
 }
 
-void spTransformConstraint_update (spTransformConstraint* self) {
-    if (self->mixRotate == 0 && self->mixX == 0 && self->mixY == 0 && self->mixScaleX == 0 && self->mixScaleX == 0 && self->mixShearY == 0) return;
+void spTransformConstraint_update(spTransformConstraint *self) {
+	if (self->mixRotate == 0 && self->mixX == 0 && self->mixY == 0 && self->mixScaleX == 0 && self->mixScaleX == 0 &&
+		self->mixShearY == 0)
+		return;
 
-    if (self->data->local) {
+	if (self->data->local) {
 		if (self->data->relative)
 			_spTransformConstraint_applyRelativeLocal(self);
 		else

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä