فهرست منبع

Move macros to dedicate header

Daniele Bartolini 12 سال پیش
والد
کامیت
e746c760d1
5فایلهای تغییر یافته به همراه41 افزوده شده و 36 حذف شده
  1. 1 0
      engine/core/Log.h
  2. 39 0
      engine/core/Macros.h
  3. 0 9
      engine/core/Types.h
  4. 0 27
      engine/core/mem/Memory.h
  5. 1 0
      engine/lua/LuaEnvironment.h

+ 1 - 0
engine/core/Log.h

@@ -29,6 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include <cstdio>
 #include <cstdarg>
 #include "Types.h"
+#include "Macros.h"
 
 namespace crown
 {

+ 39 - 0
engine/core/Macros.h

@@ -0,0 +1,39 @@
+/*
+Copyright (c) 2013 Daniele Bartolini, Michele Rossi
+Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifdef _MSC_VER
+	#define CE_ALIGNOF(x) __alignof(x)
+	#define CE_EXPORT __declspec(dllexport)
+	#define CE_INLINE __inline
+	#define CE_THREAD __declspec(thread)
+#elif defined __GNUG__
+	#define CE_ALIGNOF(x) __alignof__(x)
+	#define CE_EXPORT __attribute__ ((visibility("default")))
+	#define CE_INLINE inline
+	#define CE_THREAD __thread
+#else
+	#error "Compiler not supported"
+#endif

+ 0 - 9
engine/core/Types.h

@@ -28,17 +28,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include <cstddef>
 #include <stdint.h>
-
 #include "Config.h"
 
-#ifdef WINDOWS
-	#define CE_EXPORT __declspec(dllexport)
-	#define CE_INLINE __inline
-#else
-	#define CE_EXPORT __attribute__ ((visibility("default")))
-	#define CE_INLINE inline
-#endif
-
 typedef uint32_t StringId32;
 typedef uint64_t StringId64;
 

+ 0 - 27
engine/core/mem/Memory.h

@@ -65,32 +65,5 @@ inline void* align_top(void* p, size_t align)
 	return (void*) ptr;
 }
 
-// /// Dumps the memory content pointed by @a p
-// inline void dump(void* p, size_t size, size_t word_size)
-// {
-// 	uint8_t* mem = (uint8_t*) p;
-
-// 	for (size_t i = 0; i < size; i++, mem++)
-// 	{
-// 		if (i % word_size == 0)
-// 		{
-// 			os::printf("\n");
-// 			os::printf("[.. %.4X] ", (size_t)mem);
-// 		}
-
-// 		os::printf("%.2X ", *mem);
-// 	}
-
-// 	os::printf("\n");
-// }
-
-#ifdef _MSC_VER
-	#define CE_ALIGNOF(x) __alignof(x)
-#elif defined __GNUG__
-	#define CE_ALIGNOF(x) __alignof__(x)
-#else
-	#error "Compiler not supported."
-#endif
-
 } // namespace memory
 } // namespace crown

+ 1 - 0
engine/lua/LuaEnvironment.h

@@ -29,6 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "lua.hpp"
 #include "Config.h"
 #include "Types.h"
+#include "Macros.h"
 
 namespace crown
 {