as_config.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. /*
  2. AngelCode Scripting Library
  3. Copyright (c) 2003-2013 Andreas Jonsson
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any
  6. damages arising from the use of this software.
  7. Permission is granted to anyone to use this software for any
  8. purpose, including commercial applications, and to alter it and
  9. redistribute it freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you
  11. must not claim that you wrote the original software. If you use
  12. this software in a product, an acknowledgment in the product
  13. documentation would be appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and
  15. must not be misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source
  17. distribution.
  18. The original version of this library can be located at:
  19. http://www.angelcode.com/angelscript/
  20. Andreas Jonsson
  21. [email protected]
  22. */
  23. //
  24. // as_config.h
  25. //
  26. // this file is used for configuring the compilation of the library
  27. //
  28. #ifndef AS_CONFIG_H
  29. #define AS_CONFIG_H
  30. //
  31. // Features
  32. //-----------------------------------------
  33. // AS_NO_THREADS
  34. // Turns off support for multithreading. By turning off
  35. // this when it's not needed a bit of performance is gained.
  36. // AS_WINDOWS_THREADS
  37. // If the library should be compiled using windows threads.
  38. // AS_POSIX_THREADS
  39. // If the library should be compiled using posix threads.
  40. // AS_NO_ATOMIC
  41. // If the compiler/platform doesn't support atomic instructions
  42. // then this should be defined to use critical sections instead.
  43. // AS_DEBUG
  44. // This flag can be defined to make the library write some extra output when
  45. // compiling and executing scripts.
  46. // AS_DEPRECATED
  47. // If this flag is defined then some backwards compatibility is maintained.
  48. // There is no guarantee for how well deprecated functionality will work though
  49. // so it is best to exchange it for the new functionality as soon as possible.
  50. // AS_NO_CLASS_METHODS
  51. // Disables the possibility to add class methods. Can increase the
  52. // portability of the library.
  53. // AS_MAX_PORTABILITY
  54. // Disables all platform specific code. Only the asCALL_GENERIC calling
  55. // convention will be available in with this flag set.
  56. // AS_DOUBLEBYTE_CHARSET
  57. // When this flag is defined, the parser will treat all characters in strings
  58. // that are greater than 127 as lead characters and automatically include the
  59. // next character in the script without checking its value. This should be
  60. // compatible with common encoding schemes, e.g. Big5. Shift-JIS is not compatible
  61. // though as it encodes some single byte characters above 127.
  62. //
  63. // If support for international text is desired, it is recommended that UTF-8
  64. // is used as this is supported natively by the compiler without the use for this
  65. // preprocessor flag.
  66. // AS_NO_COMPILER
  67. // Compiles the library without support for compiling scripts. This is intended
  68. // for those applications that will load pre-compiled bytecode and wants to decrease
  69. // the size of the executable.
  70. // AS_NO_EXCEPTIONS
  71. // Define this if exception handling is turned off or not available on the target platform.
  72. // AS_NO_MEMBER_INIT
  73. // Disable the support for initialization of class members directly in the declaration.
  74. // This was as a form to maintain backwards compatibility with versions before 2.26.0
  75. // if the new order of the member initialization caused null pointer exceptions in older
  76. // scripts (e.g. if a base class accessed members of a derived class through a virtual method).
  77. //
  78. // Library usage
  79. //------------------------------------------
  80. // ANGELSCRIPT_EXPORT
  81. // This flag should be defined when compiling the library as a lib or dll.
  82. // ANGELSCRIPT_DLL_LIBRARY_IMPORT
  83. // This flag should be defined when using AngelScript as a dll with automatic
  84. // library import.
  85. // ANGELSCRIPT_DLL_MANUAL_IMPORT
  86. // This flag should be defined when using AngelScript as a dll with manual
  87. // loading of the library.
  88. //
  89. // Compiler differences
  90. //-----------------------------------------
  91. // asVSNPRINTF(a,b,c,d)
  92. // Some compilers use different names for this function. You must
  93. // define this macro to map to the proper function.
  94. // ASM_AT_N_T or ASM_INTEL
  95. // You should choose what inline assembly syntax to use when compiling.
  96. // VALUE_OF_BOOLEAN_TRUE
  97. // This flag allows to customize the exact value of boolean true.
  98. // AS_SIZEOF_BOOL
  99. // On some target platforms the sizeof(bool) is 4, but on most it is 1.
  100. // STDCALL
  101. // This is used to declare a function to use the stdcall calling convention.
  102. // AS_USE_NAMESPACE
  103. // Adds the AngelScript namespace on the declarations.
  104. // AS_NO_MEMORY_H
  105. // Some compilers don't come with the memory.h header file.
  106. //
  107. // How to identify different compilers
  108. //-----------------------------------------
  109. // MS Visual C++
  110. // _MSC_VER is defined
  111. // __MWERKS__ is not defined
  112. // Metrowerks
  113. // _MSC_VER is defined
  114. // __MWERKS__ is defined
  115. // GNU C based compilers
  116. // __GNUC__ is defined
  117. // Embarcadero C++Builder
  118. // __BORLANDC__ is defined
  119. //
  120. // CPU differences
  121. //---------------------------------------
  122. // AS_USE_DOUBLE_AS_FLOAT
  123. // If there is no 64 bit floating point type, then this constant can be defined
  124. // to treat double like normal floats.
  125. // AS_X86
  126. // Use assembler code for the x86 CPU family
  127. // AS_SH4
  128. // Use assembler code for the SH4 CPU family
  129. // AS_MIPS
  130. // Use assembler code for the MIPS CPU family
  131. // AS_PPC
  132. // Use assembler code for the 32bit PowerPC CPU family
  133. // AS_PPC_64
  134. // Use assembler code for the 64bit PowerPC CPU family
  135. // AS_XENON
  136. // Use assembler code for the Xenon (XBOX360) CPU family
  137. // AS_ARM
  138. // Use assembler code for the ARM CPU family
  139. // AS_X64_GCC
  140. // Use GCC assembler code for the X64 AMD/Intel CPU family
  141. // AS_X64_MSVC
  142. // Use MSVC assembler code for the X64 AMD/Intel CPU family
  143. // AS_64BIT_PTR
  144. // Define this to make the engine store all pointers in 64bit words.
  145. // AS_BIG_ENDIAN
  146. // Define this for CPUs that use big endian memory layout, e.g. PPC
  147. //
  148. // Target systems
  149. //--------------------------------
  150. // This group shows a few of the flags used to identify different target systems.
  151. // Sometimes there are differences on different target systems, while both CPU and
  152. // compiler is the same for both, when this is so these flags are used to produce the
  153. // right code.
  154. // AS_WIN - Microsoft Windows
  155. // AS_LINUX - Linux
  156. // AS_MAC - Apple Macintosh
  157. // AS_BSD - BSD based OS (FreeBSD, DragonFly, OpenBSD, etc)
  158. // AS_XBOX - Microsoft XBox
  159. // AS_XBOX360 - Microsoft XBox 360
  160. // AS_PSP - Sony Playstation Portable
  161. // AS_PS2 - Sony Playstation 2
  162. // AS_PS3 - Sony Playstation 3
  163. // AS_DC - Sega Dreamcast
  164. // AS_GC - Nintendo GameCube
  165. // AS_WII - Nintendo Wii
  166. // AS_WIIU - Nintendo Wii U
  167. // AS_IPHONE - Apple IPhone
  168. // AS_ANDROID - Android
  169. // AS_HAIKU - Haiku
  170. // AS_ILLUMOS - Illumos like (OpenSolaris, OpenIndiana, NCP, etc)
  171. // AS_MARMALADE - Marmalade cross platform SDK (a layer on top of the OS)
  172. //
  173. // Calling conventions
  174. //-----------------------------------------
  175. // GNU_STYLE_VIRTUAL_METHOD
  176. // This constant should be defined if method pointers store index for virtual
  177. // functions in the same location as the function pointer. In such cases the method
  178. // is identified as virtual if the least significant bit is set.
  179. // MULTI_BASE_OFFSET(x)
  180. // This macro is used to retrieve the offset added to the object pointer in order to
  181. // implicitly cast the object to the base object. x is the method pointer received by
  182. // the register function.
  183. // HAVE_VIRTUAL_BASE_OFFSET
  184. // Define this constant if the compiler stores the virtual base offset in the method
  185. // pointers. If it is not stored in the pointers then AngelScript have no way of
  186. // identifying a method as coming from a class with virtual inheritance.
  187. // VIRTUAL_BASE_OFFSET(x)
  188. // This macro is used to retrieve the offset added to the object pointer in order to
  189. // find the virtual base object. x is the method pointer received by the register
  190. // function;
  191. // COMPLEX_RETURN_MASK
  192. // This constant shows what attributes determine if an object is returned in memory
  193. // or in the registers as normal structures
  194. // COMPLEX_MASK
  195. // This constant shows what attributes determine if an object is implicitly passed
  196. // by reference or not, even if the argument is declared by value
  197. // THISCALL_RETURN_SIMPLE_IN_MEMORY
  198. // CDECL_RETURN_SIMPLE_IN_MEMORY
  199. // STDCALL_RETURN_SIMPLE_IN_MEMORY
  200. // When these constants are defined then the corresponding calling convention always
  201. // return classes/structs in memory regardless of size or complexity.
  202. // THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  203. // STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  204. // CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  205. // Specifies the minimum size in dwords a class/struct needs to be to be passed in memory
  206. // CALLEE_POPS_HIDDEN_RETURN_POINTER
  207. // This constant should be defined if the callee pops the hidden return pointer,
  208. // used when returning an object in memory.
  209. // THISCALL_CALLEE_POPS_HIDDEN_RETURN_POINTER
  210. // This constant should be defined if the callee pops the hidden return pointer
  211. // for thiscall functions; used when returning an object in memory.
  212. // THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  213. // With this constant defined AngelScript will pass the object pointer on the stack
  214. // THISCALL_CALLEE_POPS_ARGUMENTS
  215. // If the callee pops arguments for class methods then define this constant
  216. // COMPLEX_OBJS_PASSED_BY_REF
  217. // Some compilers always pass certain objects by reference. GNUC for example does
  218. // this if the the class has a defined destructor.
  219. // AS_LARGE_OBJS_PASSED_BY_REF
  220. // If this is defined large objects are passed by reference, whether they are complex or not
  221. // AS_LARGE_OBJ_MIN_SIZE
  222. // This is the size of objects determined as large ones
  223. // AS_CALLEE_DESTROY_OBJ_BY_VAL
  224. // When an object is passed by value the called function is the one responsible
  225. // for calling the destructor before returning.
  226. // HAS_128_BIT_PRIMITIVES
  227. // 64bit processors often support 128bit primitives. These may require special
  228. // treatment when passed in function arguments or returned by functions.
  229. // SPLIT_OBJS_BY_MEMBER_TYPES
  230. // On some platforms objects with primitive members are split over different
  231. // register types when passed by value to functions.
  232. //
  233. // Detect compiler
  234. //------------------------------------------------
  235. #define VALUE_OF_BOOLEAN_TRUE 1
  236. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 0
  237. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 0
  238. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 0
  239. #define THISCALL_CALLEE_POPS_HIDDEN_RETURN_POINTER
  240. // Embarcadero C++Builder
  241. #if defined(__BORLANDC__)
  242. #ifndef _Windows
  243. #error "Configuration doesn't yet support BCC for Linux or Mac OS."
  244. #endif
  245. #if defined(_M_X64)
  246. #error "Configuration doesn't yet support BCC for AMD64."
  247. #endif
  248. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+1))
  249. #define HAVE_VIRTUAL_BASE_OFFSET
  250. #define VIRTUAL_BASE_OFFSET(x) (*((asDWORD*)(&x)+2))
  251. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  252. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  253. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  254. #undef STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  255. #undef CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  256. #undef THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  257. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  258. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  259. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  260. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  261. #define COMPLEX_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR)
  262. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR)
  263. #define STDCALL __stdcall
  264. #define AS_SIZEOF_BOOL 1
  265. #define AS_WINDOWS_THREADS
  266. #undef THISCALL_CALLEE_POPS_HIDDEN_RETURN_POINTER
  267. #define AS_WIN
  268. #define AS_X86
  269. #define ASM_INTEL
  270. #define asVSNPRINTF(a, b, c, d) _vsnprintf(a, b, c, d)
  271. #define fmodf(a,b) fmod(a,b)
  272. #define UNREACHABLE_RETURN
  273. #endif
  274. // Microsoft Visual C++
  275. #if defined(_MSC_VER) && !defined(__MWERKS__)
  276. #if _MSC_VER <= 1200 // MSVC6
  277. // Disable the useless warnings about truncated symbol names for template instances
  278. #pragma warning( disable : 4786 )
  279. #endif
  280. #ifdef _M_X64
  281. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+2))
  282. #define VIRTUAL_BASE_OFFSET(x) (*((asDWORD*)(&x)+4))
  283. #else
  284. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+1))
  285. #define VIRTUAL_BASE_OFFSET(x) (*((asDWORD*)(&x)+3))
  286. #endif
  287. #define HAVE_VIRTUAL_BASE_OFFSET
  288. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  289. #define THISCALL_PASS_OBJECT_POINTER_IN_ECX
  290. // http://www.madewithmarmalade.com/
  291. #if defined(__S3E__)
  292. #ifndef AS_MARMALADE
  293. // From now on we'll use the below define
  294. #define AS_MARMALADE
  295. #endif
  296. // Marmalade doesn't use the Windows libraries
  297. #define asVSNPRINTF(a, b, c, d) vsnprintf(a, b, c, d)
  298. // Marmalade doesn't seem to have proper support for
  299. // atomic instructions or read/write locks, so we turn off
  300. // multithread support
  301. //#define AS_POSIX_THREADS
  302. #define AS_NO_THREADS
  303. #define AS_NO_ATOMIC
  304. // Marmalade has it's own way of identifying the CPU target
  305. // Note, when building for ARM, the gnuc compiler will always
  306. // be used so we don't need to check for it here
  307. #if defined(I3D_ARCH_X86)
  308. #define AS_X86
  309. #endif
  310. #else
  311. #if _MSC_VER < 1500 // MSVC++ 9 (aka MSVC++ .NET 2008)
  312. #define asVSNPRINTF(a, b, c, d) _vsnprintf(a, b, c, d)
  313. #else
  314. #define asVSNPRINTF(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
  315. #endif
  316. #define AS_WINDOWS_THREADS
  317. #endif
  318. #define THISCALL_CALLEE_POPS_ARGUMENTS
  319. #define STDCALL __stdcall
  320. #define AS_SIZEOF_BOOL 1
  321. #define ASM_INTEL // Intel style for inline assembly on microsoft compilers
  322. #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
  323. #define AS_WIN
  324. #endif
  325. #if _XBOX_VER >= 200
  326. // 360 uses a Xenon processor (which is a modified 64bit PPC)
  327. #define AS_XBOX360
  328. #define AS_XENON
  329. #define AS_BIG_ENDIAN
  330. #else
  331. #if defined(_XBOX) || (defined(_M_IX86) && !defined(__LP64__))
  332. #define AS_X86
  333. #elif defined(_M_X64)
  334. #define AS_X64_MSVC
  335. #define AS_CALLEE_DESTROY_OBJ_BY_VAL
  336. #define AS_LARGE_OBJS_PASSED_BY_REF
  337. #define AS_LARGE_OBJ_MIN_SIZE 3
  338. #define COMPLEX_OBJS_PASSED_BY_REF
  339. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_ASSIGNMENT | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  340. #define COMPLEX_MASK (asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  341. #endif
  342. #endif
  343. #ifdef _ARM_
  344. #define AS_ARM
  345. #define AS_CALLEE_DESTROY_OBJ_BY_VAL
  346. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  347. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  348. #define COMPLEX_OBJS_PASSED_BY_REF
  349. #define COMPLEX_MASK asOBJ_APP_CLASS_ASSIGNMENT
  350. #define COMPLEX_RETURN_MASK asOBJ_APP_CLASS_ASSIGNMENT
  351. #endif
  352. #ifndef COMPLEX_MASK
  353. #define COMPLEX_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_ASSIGNMENT)
  354. #endif
  355. #ifndef COMPLEX_RETURN_MASK
  356. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_ASSIGNMENT)
  357. #endif
  358. #define UNREACHABLE_RETURN
  359. #endif
  360. // Metrowerks CodeWarrior (experimental, let me know if something isn't working)
  361. #if defined(__MWERKS__) && !defined(EPPC) // JWC -- If Wii DO NOT use this even when using Metrowerks Compiler. Even though they are called Freescale...
  362. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+1))
  363. #define HAVE_VIRTUAL_BASE_OFFSET
  364. #define VIRTUAL_BASE_OFFSET(x) (*((asDWORD*)(&x)+3))
  365. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  366. #define THISCALL_PASS_OBJECT_POINTER_IN_ECX
  367. #define asVSNPRINTF(a, b, c, d) _vsnprintf(a, b, c, d)
  368. #define THISCALL_CALLEE_POPS_ARGUMENTS
  369. #define COMPLEX_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_ASSIGNMENT)
  370. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_CONSTRUCTOR | asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_ASSIGNMENT)
  371. #define AS_SIZEOF_BOOL 1
  372. #define AS_WINDOWS_THREADS
  373. #define STDCALL __stdcall
  374. // Support native calling conventions on x86, but not 64bit yet
  375. #if defined(_M_IX86) && !defined(__LP64__)
  376. #define AS_X86
  377. #define ASM_INTEL // Intel style for inline assembly
  378. #endif
  379. #define UNREACHABLE_RETURN
  380. #endif
  381. // SN Systems ProDG
  382. #if defined(__SNC__) || defined(SNSYS)
  383. #define GNU_STYLE_VIRTUAL_METHOD
  384. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+1))
  385. #define CALLEE_POPS_HIDDEN_RETURN_POINTER
  386. #define COMPLEX_OBJS_PASSED_BY_REF
  387. #define ASM_AT_N_T // AT&T style inline assembly
  388. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR)
  389. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR)
  390. #define AS_SIZEOF_BOOL 1
  391. #define asVSNPRINTF(a, b, c, d) vsnprintf(a, b, c, d)
  392. // SN doesnt seem to like STDCALL.
  393. // Maybe it can work with some fiddling, but I can't imagine linking to
  394. // any STDCALL functions with a console anyway...
  395. #define STDCALL
  396. // Linux specific
  397. #ifdef __linux__
  398. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  399. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  400. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  401. #endif
  402. // Support native calling conventions on x86, but not 64bit yet
  403. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  404. #define AS_X86
  405. // PS3
  406. #elif (defined(__PPC__) || defined(__ppc__)) && defined(__PPU__)
  407. // Support native calling conventions on PS3
  408. #define AS_PS3
  409. #define AS_PPC_64
  410. // PSP
  411. #elif defined(__psp__)
  412. #define AS_NO_MEMORY_H
  413. #define AS_MIPS
  414. #define AS_PSP
  415. #endif
  416. #define UNREACHABLE_RETURN
  417. #endif
  418. // GNU C (and MinGW or Cygwin on Windows)
  419. // Use the following command to determine predefined macros: echo . | mingw32-g++ -dM -E -
  420. #if (defined(__GNUC__) && !defined(__SNC__)) || defined(EPPC) || defined(__CYGWIN__) // JWC -- use this instead for Wii
  421. #define GNU_STYLE_VIRTUAL_METHOD
  422. #if !defined( __amd64__ )
  423. #define MULTI_BASE_OFFSET(x) (*((asDWORD*)(&x)+1))
  424. #else
  425. #define MULTI_BASE_OFFSET(x) (*((asQWORD*)(&x)+1))
  426. #endif
  427. #define asVSNPRINTF(a, b, c, d) vsnprintf(a, b, c, d)
  428. #define CALLEE_POPS_HIDDEN_RETURN_POINTER
  429. #define COMPLEX_OBJS_PASSED_BY_REF
  430. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR)
  431. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR)
  432. #define AS_NO_MEMORY_H
  433. #define AS_SIZEOF_BOOL 1
  434. #define STDCALL __attribute__((stdcall))
  435. #define ASM_AT_N_T
  436. // WII U
  437. #if defined(__ghs__)
  438. #define AS_WIIU
  439. // Native calling conventions are not yet supported
  440. #define AS_MAX_PORTABILITY
  441. // Marmalade is a cross platform SDK. It uses g++ to compile for iOS and Android
  442. #elif defined(__S3E__)
  443. #ifndef AS_MARMALADE
  444. // From now on we'll use the below define
  445. #define AS_MARMALADE
  446. #endif
  447. // STDCALL is not available on Marmalade when compiled for iOS or Android
  448. #undef STDCALL
  449. #define STDCALL
  450. // Marmalade doesn't seem to have proper support for
  451. // atomic instructions or read/write locks
  452. #define AS_NO_THREADS
  453. #define AS_NO_ATOMIC
  454. // Identify for which CPU the library is being built
  455. #if defined(I3D_ARCH_X86)
  456. #define AS_X86
  457. #elif defined(I3D_ARCH_ARM)
  458. #define AS_ARM
  459. // Marmalade appear to use the same ABI as Android when built for ARM
  460. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  461. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  462. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  463. #undef THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  464. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  465. #undef CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  466. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  467. #undef STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  468. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  469. #undef GNU_STYLE_VIRTUAL_METHOD
  470. #undef COMPLEX_MASK
  471. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  472. #undef COMPLEX_RETURN_MASK
  473. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  474. #define AS_CALLEE_DESTROY_OBJ_BY_VAL
  475. #endif
  476. // MacOSX and IPhone
  477. #elif defined(__APPLE__)
  478. #include <TargetConditionals.h>
  479. // Is this a Mac or an IPhone (or other iOS device)?
  480. #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1
  481. #define AS_IPHONE
  482. #else
  483. #define AS_MAC
  484. #endif
  485. // The sizeof bool is different depending on the target CPU
  486. #undef AS_SIZEOF_BOOL
  487. #if defined(__ppc__)
  488. #define AS_SIZEOF_BOOL 4
  489. // STDCALL is not available on PPC
  490. #undef STDCALL
  491. #define STDCALL
  492. #else
  493. #define AS_SIZEOF_BOOL 1
  494. #endif
  495. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  496. // Support native calling conventions on Mac OS X + Intel 32bit CPU
  497. #define AS_X86
  498. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  499. #undef COMPLEX_MASK
  500. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  501. #undef COMPLEX_RETURN_MASK
  502. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  503. #elif defined(__LP64__) && !defined(__ppc__) && !defined(__PPC__)
  504. // http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/140-x86-64_Function_Calling_Conventions/x86_64.html#//apple_ref/doc/uid/TP40005035-SW1
  505. #define AS_X64_GCC
  506. #define HAS_128_BIT_PRIMITIVES
  507. #define SPLIT_OBJS_BY_MEMBER_TYPES
  508. #undef COMPLEX_MASK
  509. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  510. #undef COMPLEX_RETURN_MASK
  511. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  512. #define AS_LARGE_OBJS_PASSED_BY_REF
  513. #define AS_LARGE_OBJ_MIN_SIZE 5
  514. // STDCALL is not available on 64bit Mac
  515. #undef STDCALL
  516. #define STDCALL
  517. #elif (defined(__ppc__) || defined(__PPC__)) && !defined(__LP64__)
  518. // Support native calling conventions on Mac OS X + PPC 32bit CPU
  519. #define AS_PPC
  520. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  521. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  522. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  523. #undef COMPLEX_MASK
  524. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  525. #undef COMPLEX_RETURN_MASK
  526. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  527. #elif (defined(__ppc__) || defined(__PPC__)) && defined(__LP64__)
  528. #define AS_PPC_64
  529. #elif (defined(_ARM_) || defined(__arm__))
  530. // The IPhone use an ARM processor
  531. #define AS_ARM
  532. #define AS_CALLEE_DESTROY_OBJ_BY_VAL
  533. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  534. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  535. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  536. #undef GNU_STYLE_VIRTUAL_METHOD
  537. #undef THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  538. #undef CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  539. #undef STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  540. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  541. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  542. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  543. #define COMPLEX_OBJS_PASSED_BY_REF
  544. #undef COMPLEX_MASK
  545. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  546. #undef COMPLEX_RETURN_MASK
  547. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  548. // STDCALL is not available on ARM
  549. #undef STDCALL
  550. #define STDCALL
  551. #else
  552. // Unknown CPU type
  553. #define AS_MAX_PORTABILITY
  554. #endif
  555. #define AS_POSIX_THREADS
  556. // Windows
  557. #elif defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
  558. // On Windows the simple classes are returned in the EAX:EDX registers
  559. //#define THISCALL_RETURN_SIMPLE_IN_MEMORY
  560. //#define CDECL_RETURN_SIMPLE_IN_MEMORY
  561. //#define STDCALL_RETURN_SIMPLE_IN_MEMORY
  562. #undef COMPLEX_MASK
  563. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  564. #undef COMPLEX_RETURN_MASK
  565. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  566. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  567. // Support native calling conventions on Intel 32bit CPU
  568. #define AS_X86
  569. // As of version 4.7 MinGW changed the ABI, presumably
  570. // to be better aligned with how MSVC works
  571. #if (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) || __GNUC__ > 4
  572. #undef CALLEE_POPS_HIDDEN_RETURN_POINTER
  573. #define THISCALL_CALLEE_POPS_ARGUMENTS
  574. #else
  575. // Earlier versions than 4.7
  576. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  577. #endif
  578. #elif defined(__x86_64__)
  579. #define AS_X64_MINGW
  580. #define AS_LARGE_OBJS_PASSED_BY_REF
  581. #define AS_LARGE_OBJ_MIN_SIZE 3
  582. #define COMPLEX_OBJS_PASSED_BY_REF
  583. #else
  584. #define AS_MAX_PORTABILITY
  585. #endif
  586. #define AS_WIN
  587. #define AS_WINDOWS_THREADS
  588. // Linux
  589. #elif defined(__linux__) && !defined(ANDROID) && !defined(__ANDROID__)
  590. #undef COMPLEX_MASK
  591. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  592. #undef COMPLEX_RETURN_MASK
  593. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  594. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  595. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  596. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  597. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  598. // Support native calling conventions on Intel 32bit CPU
  599. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  600. #define AS_X86
  601. #elif defined(__LP64__)
  602. #define AS_X64_GCC
  603. #define HAS_128_BIT_PRIMITIVES
  604. #define SPLIT_OBJS_BY_MEMBER_TYPES
  605. #define AS_LARGE_OBJS_PASSED_BY_REF
  606. #define AS_LARGE_OBJ_MIN_SIZE 5
  607. // STDCALL is not available on 64bit Linux
  608. #undef STDCALL
  609. #define STDCALL
  610. #elif defined(__ARMEL__) || defined(__arm__)
  611. #define AS_ARM
  612. #define AS_NO_ATOMIC
  613. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  614. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  615. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  616. #undef THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  617. #undef CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  618. #undef STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  619. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  620. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  621. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  622. #elif defined(__mips__)
  623. #define AS_MIPS
  624. #define AS_BIG_ENDIAN
  625. #define AS_USE_DOUBLE_AS_FLOAT
  626. // Native calling conventions for Linux/Mips do not work yet.
  627. #define AS_MAX_PORTABILITY
  628. #else
  629. #define AS_MAX_PORTABILITY
  630. #endif
  631. #define AS_LINUX
  632. #define AS_POSIX_THREADS
  633. #if !( ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) )
  634. // Only with GCC 4.1 was the atomic instructions available
  635. #define AS_NO_ATOMIC
  636. #endif
  637. // Free BSD
  638. #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
  639. #define AS_BSD
  640. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  641. #undef COMPLEX_MASK
  642. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  643. #undef COMPLEX_RETURN_MASK
  644. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  645. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  646. #define AS_X86
  647. #elif defined(__LP64__)
  648. #define AS_X64_GCC
  649. #define HAS_128_BIT_PRIMITIVES
  650. #define SPLIT_OBJS_BY_MEMBER_TYPES
  651. #undef COMPLEX_MASK
  652. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  653. #undef COMPLEX_RETURN_MASK
  654. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  655. #define AS_LARGE_OBJS_PASSED_BY_REF
  656. #define AS_LARGE_OBJ_MIN_SIZE 5
  657. #undef STDCALL
  658. #define STDCALL
  659. #else
  660. #define AS_MAX_PORTABILITY
  661. #endif
  662. #define AS_POSIX_THREADS
  663. #if !( ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) )
  664. // Only with GCC 4.1 was the atomic instructions available
  665. #define AS_NO_ATOMIC
  666. #endif
  667. // PSP and PS2
  668. #elif defined(__PSP__) || defined(__psp__) || defined(_EE_) || defined(_PSP) || defined(_PS2)
  669. // Support native calling conventions on MIPS architecture
  670. #if (defined(_MIPS_ARCH) || defined(_mips) || defined(__MIPSEL__)) && !defined(__LP64__)
  671. #define AS_MIPS
  672. #else
  673. #define AS_MAX_PORTABILITY
  674. #endif
  675. // PS3
  676. #elif (defined(__PPC__) || defined(__ppc__)) && defined(__PPU__)
  677. // Support native calling conventions on PS3
  678. #define AS_PS3
  679. #define AS_PPC_64
  680. #define SPLIT_OBJS_BY_MEMBER_TYPES
  681. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  682. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  683. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  684. // PS3 doesn't have STDCALL
  685. #undef STDCALL
  686. #define STDCALL
  687. // Dreamcast
  688. #elif __SH4_SINGLE_ONLY__
  689. // Support native calling conventions on Dreamcast
  690. #define AS_DC
  691. #define AS_SH4
  692. // Wii JWC - Close to PS3 just no PPC_64 and AS_PS3
  693. #elif defined(EPPC)
  694. #define AS_WII
  695. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  696. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  697. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  698. #undef STDCALL
  699. #define STDCALL
  700. // Android
  701. #elif defined(ANDROID) || defined(__ANDROID__)
  702. #define AS_ANDROID
  703. #define AS_NO_ATOMIC
  704. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  705. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  706. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  707. #undef THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  708. #undef CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  709. #undef STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE
  710. #define THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  711. #define CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  712. #define STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE 2
  713. #if (defined(_ARM_) || defined(__arm__))
  714. // The stdcall calling convention is not used on the arm cpu
  715. #undef STDCALL
  716. #define STDCALL
  717. #undef GNU_STYLE_VIRTUAL_METHOD
  718. #undef COMPLEX_MASK
  719. #define COMPLEX_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  720. #undef COMPLEX_RETURN_MASK
  721. #define COMPLEX_RETURN_MASK (asOBJ_APP_CLASS_DESTRUCTOR | asOBJ_APP_CLASS_COPY_CONSTRUCTOR)
  722. #define AS_ARM
  723. #define AS_CALLEE_DESTROY_OBJ_BY_VAL
  724. #endif
  725. // Haiku OS
  726. #elif __HAIKU__
  727. #define AS_HAIKU
  728. // Only x86-32 is currently supported by Haiku, but they do plan to support
  729. // x86-64 and PowerPC in the future, so should go ahead and check the platform
  730. // for future compatibility
  731. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  732. #define AS_X86
  733. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  734. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  735. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  736. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  737. #else
  738. #define AS_MAX_PORTABILITY
  739. #endif
  740. #define AS_POSIX_THREADS
  741. #if !( ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) )
  742. // Only with GCC 4.1 was the atomic instructions available
  743. #define AS_NO_ATOMIC
  744. #endif
  745. // Illumos
  746. #elif defined(__sun)
  747. #if (defined(i386) || defined(__i386) || defined(__i386__)) && !defined(__LP64__)
  748. #define THISCALL_RETURN_SIMPLE_IN_MEMORY
  749. #define CDECL_RETURN_SIMPLE_IN_MEMORY
  750. #define STDCALL_RETURN_SIMPLE_IN_MEMORY
  751. // Support native calling conventions on Intel 32bit CPU
  752. #define THISCALL_PASS_OBJECT_POINTER_ON_THE_STACK
  753. #define AS_X86
  754. #elif defined(__LP64__)
  755. #define AS_X64_GCC
  756. #define HAS_128_BIT_PRIMITIVES
  757. #define SPLIT_OBJS_BY_MEMBER_TYPES
  758. // STDCALL is not available on 64bit Linux
  759. #undef STDCALL
  760. #define STDCALL
  761. #else
  762. #define AS_MAX_PORTABILITY
  763. #endif
  764. #define AS_ILLUMOS
  765. #define AS_POSIX_THREADS
  766. #if !( ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 1) || __GNUC__ > 4) )
  767. // Only with GCC 4.1 was the atomic instructions available
  768. #define AS_NO_ATOMIC
  769. #endif
  770. #endif
  771. #define UNREACHABLE_RETURN
  772. #endif
  773. //
  774. // Detect target hardware
  775. //------------------------------------------------
  776. // X86, Intel, AMD, etc, i.e. most PCs
  777. #if defined(__i386__) || defined(_M_IX86)
  778. // Nothing special here
  779. #endif
  780. // MIPS architecture (generally PS2 and PSP consoles, potentially supports N64 as well)
  781. #if defined(_MIPS_ARCH) || defined(_mips) || defined(__MIPSEL__) || defined(__PSP__) || defined(__psp__) || defined(_EE_) || defined(_PSP) || defined(_PS2)
  782. #define AS_USE_DOUBLE_AS_FLOAT // use 32bit floats instead of doubles
  783. #endif
  784. // PowerPC, e.g. Mac, GameCube, PS3, XBox 360, Wii
  785. #if defined(__PPC__) || defined(__ppc__) || defined(_PPC_) || defined(EPPC)
  786. #define AS_BIG_ENDIAN
  787. // Gamecube
  788. #if defined(_GC)
  789. #define AS_USE_DOUBLE_AS_FLOAT
  790. #endif
  791. #endif
  792. // Dreamcast console
  793. #ifdef __SH4_SINGLE_ONLY__
  794. #define AS_USE_DOUBLE_AS_FLOAT // use 32bit floats instead of doubles
  795. #endif
  796. // If there are no current support for native calling
  797. // conventions, then compile with AS_MAX_PORTABILITY
  798. #if (!defined(AS_X86) && !defined(AS_SH4) && !defined(AS_MIPS) && !defined(AS_PPC) && !defined(AS_PPC_64) && !defined(AS_XENON) && !defined(AS_X64_GCC) && !defined(AS_X64_MSVC) && !defined(AS_ARM) && !defined(AS_X64_MINGW))
  799. #ifndef AS_MAX_PORTABILITY
  800. #define AS_MAX_PORTABILITY
  801. #endif
  802. #endif
  803. // If the platform doesn't support atomic instructions we can't allow
  804. // multithreading as the reference counters won't be threadsafe
  805. #if defined(AS_NO_ATOMIC) && !defined(AS_NO_THREADS)
  806. #define AS_NO_THREADS
  807. #endif
  808. // If the form of threads to use hasn't been chosen
  809. // then the library will be compiled without support
  810. // for multithreading
  811. #if !defined(AS_POSIX_THREADS) && !defined(AS_WINDOWS_THREADS)
  812. #define AS_NO_THREADS
  813. #endif
  814. // The assert macro
  815. #if defined(ANDROID)
  816. #if defined(AS_DEBUG)
  817. #include <android/log.h>
  818. #include <stdlib.h>
  819. #define asASSERT(x) \
  820. do { \
  821. if (!(x)) { \
  822. __android_log_print(ANDROID_LOG_ERROR, "AngelScript", "Assert failed at %s:%d - %s", __FILE__, __LINE__, #x); \
  823. exit(1); \
  824. } \
  825. } while (0)
  826. #else
  827. #define asASSERT(x)
  828. #endif
  829. #else
  830. #include <assert.h>
  831. #define asASSERT(x) assert(x)
  832. #endif
  833. //
  834. // Internal defines (do not change these)
  835. //----------------------------------------------------------------
  836. #define ARG_W(b) ((asWORD*)&b)
  837. #define ARG_DW(b) ((asDWORD*)&b)
  838. #define ARG_QW(b) ((asQWORD*)&b)
  839. #define ARG_PTR(b) ((asPWORD*)&b)
  840. #define BCARG_W(b) ((asWORD*)&(b)[1])
  841. #define BCARG_DW(b) ((asDWORD*)&(b)[1])
  842. #define BCARG_QW(b) ((asQWORD*)&(b)[1])
  843. #define BCARG_PTR(b) ((asPWORD*)&(b)[1])
  844. // This macro is used to avoid warnings about unused variables.
  845. // Usually where the variables are only used in debug mode.
  846. #define UNUSED_VAR(x) (void)(x)
  847. #include "../include/angelscript.h"
  848. #include "as_memory.h"
  849. #ifdef AS_USE_NAMESPACE
  850. using namespace AngelScript;
  851. #endif
  852. #endif