From a8793a5048280f97e85d640f146cf52dc19fb6f7 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Thu, 5 Jan 2017 21:27:05 -0500 Subject: [PATCH 01/21] a reminder that this isn't safe for dedicated servers that run a long time --- Engine/source/console/simManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index a216c09b6..b1ee96f5c 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -99,7 +99,7 @@ U32 postEvent(SimObject *destObject, SimEvent* event,U32 time) Mutex::lockMutex(gEventQueueMutex); - if( time == -1 ) + if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix time = gCurrentTime; event->time = time; From 92e4376b7e185ae50ef46f3467a77eb68d80f3b4 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Thu, 5 Jan 2017 22:48:23 -0500 Subject: [PATCH 02/21] Started variadic templates in engine API --- Engine/source/console/engineAPI.h | 1345 ++--------------------------- 1 file changed, 59 insertions(+), 1286 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index c2b940f01..a0b9d8900 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -23,6 +23,9 @@ #ifndef _ENGINEAPI_H_ #define _ENGINEAPI_H_ +#include +#include + #ifndef _CONSOLETYPES_H_ #include "console/consoleTypes.h" #endif @@ -333,953 +336,19 @@ struct EngineUnmarshallData< ConsoleValueRef > /// @{ // Helper type to factor out commonalities between function and method trampolines. -template< typename T > -struct _EngineTrampoline -{ - struct Args {}; + + +template struct _EngineTrampoline { + struct Args {}; }; -template< typename R, typename A > -struct _EngineTrampoline< R( A ) > +template< typename R, typename ...ArgTs > +struct _EngineTrampoline< R( ArgTs ... ) > { - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - }; + typedef std::tuple Args; + std::tuple argT; }; -template< typename R, typename A, typename B > -struct _EngineTrampoline< R( A, B ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C > -struct _EngineTrampoline< R( A, B, C ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineTrampoline< R( A, B, C, D ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineTrampoline< R( A, B, C, D, E ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineTrampoline< R( A, B, C, D, E, F ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineTrampoline< R( A, B, C, D, E, F, G ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineTrampoline< R( A, B, C, D, E, F, G, H ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< H >::ValueType h() const - { - return EngineTypeTraits< H >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< H >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineTrampoline< R( A, B, C, D, E, F, G, H, I ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< H >::ValueType h() const - { - return EngineTypeTraits< H >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< H >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< I >::ValueType i() const - { - return EngineTypeTraits< I >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< I >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineTrampoline< R( A, B, C, D, E, F, G, H, I, J ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< H >::ValueType h() const - { - return EngineTypeTraits< H >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< H >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< I >::ValueType i() const - { - return EngineTypeTraits< I >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< I >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< J >::ValueType j() const - { - return EngineTypeTraits< J >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< J >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineTrampoline< R( A, B, C, D, E, F, G, H, I, J, K ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< K >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< H >::ValueType h() const - { - return EngineTypeTraits< H >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< H >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< I >::ValueType i() const - { - return EngineTypeTraits< I >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< I >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< J >::ValueType j() const - { - return EngineTypeTraits< J >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< J >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< K >::ValueType k() const - { - return EngineTypeTraits< K >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< K >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) ] ) ) ); - } - }; -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineTrampoline< R( A, B, C, D, E, F, G, H, I, J, K, L ) > -{ - struct Args - { - char data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< K >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< L >::ArgumentValueType ) ]; - - typename EngineTypeTraits< A >::ValueType a() const - { - return EngineTypeTraits< A >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< A >::ArgumentValueType* > - ( &data[ 0 ] ) ) ); - } - - typename EngineTypeTraits< B >::ValueType b() const - { - return EngineTypeTraits< B >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< B >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< C >::ValueType c() const - { - return EngineTypeTraits< C >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< C >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< D >::ValueType d() const - { - return EngineTypeTraits< D >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< D >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< E >::ValueType e() const - { - return EngineTypeTraits< E >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< E >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< F >::ValueType f() const - { - return EngineTypeTraits< F >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< F >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< G >::ValueType g() const - { - return EngineTypeTraits< G >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< G >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< H >::ValueType h() const - { - return EngineTypeTraits< H >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< H >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< I >::ValueType i() const - { - return EngineTypeTraits< I >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< I >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< J >::ValueType j() const - { - return EngineTypeTraits< J >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< J >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< K >::ValueType k() const - { - return EngineTypeTraits< K >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< K >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) ] ) ) ); - } - - typename EngineTypeTraits< L >::ValueType l() const - { - return EngineTypeTraits< L >::ArgumentToValue( - *( reinterpret_cast< const typename EngineTypeTraits< L >::ArgumentValueType* > - ( &data[ sizeof( typename EngineTypeTraits< A >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< B >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< C >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< D >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< E >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< F >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< G >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< H >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< I >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< J >::ArgumentValueType ) + - sizeof( typename EngineTypeTraits< K >::ArgumentValueType ) ] ) ) ); - } - }; -}; - - template< typename T > struct _EngineFunctionTrampolineBase : public _EngineTrampoline< T > { @@ -1290,125 +359,30 @@ struct _EngineFunctionTrampolineBase : public _EngineTrampoline< T > template< typename T > struct _EngineFunctionTrampoline {}; -template< typename R > -struct _EngineFunctionTrampoline< R() > : public _EngineFunctionTrampolineBase< R() > +template< typename R, typename ...ArgTs > +struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) > { - static R jmp( R ( *fn )(), const typename _EngineFunctionTrampolineBase< R() >::Args& args ) +private: + using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >; + using ArgsType = typename Super::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { + return R( fn(std::get(args) ...) ); + } + + using SeqType = typename Gens::type; +public: + static R jmp(typename Super::FunctionType fn, const ArgsType& args ) { - return R( fn() ); + return dispatchHelper(fn, args, SeqType()); } }; - -template< typename R, typename A > -struct _EngineFunctionTrampoline< R( A ) > : public _EngineFunctionTrampolineBase< R( A ) > -{ - static R jmp( R ( *fn )( A ), const typename _EngineFunctionTrampolineBase< R( A ) >::Args& args ) - { - return R( fn( args.a() ) ); - } -}; - -template< typename R, typename A, typename B > -struct _EngineFunctionTrampoline< R( A, B ) > : public _EngineFunctionTrampolineBase< R( A, B ) > -{ - static R jmp( R ( *fn )( A, B ), const typename _EngineFunctionTrampolineBase< R( A, B ) >::Args& args ) - { - return R( fn( args.a(), args.b() ) ); - } -}; - -template< typename R, typename A, typename B, typename C > -struct _EngineFunctionTrampoline< R( A, B, C ) > : public _EngineFunctionTrampolineBase< R( A, B, C ) > -{ - static R jmp( R ( *fn )( A, B, C ), const typename _EngineFunctionTrampolineBase< R( A, B, C ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineFunctionTrampoline< R( A, B, C, D ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D ) > -{ - static R jmp( R ( *fn )( A, B, C, D ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineFunctionTrampoline< R( A, B, C, D, E ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G, H ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G, H ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G, H, I ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G, H, I ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G, H, I, J ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G, H, I, J ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G, H, I, J, K ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j(), args.k() ) ); - } -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineFunctionTrampoline< R( A, B, C, D, E, F, G, H, I, J, K, L ) > : public _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K, L ) > -{ - static R jmp( R ( *fn )( A, B, C, D, E, F, G, H, I, J, K, L ), const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K, L ) >::Args& args ) - { - return R( fn( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j(), args.k(), args.l() ) ); - } -}; - - // Trampolines for engine methods template< typename T > @@ -1417,165 +391,34 @@ struct _EngineMethodTrampolineBase : public _EngineTrampoline< T > {}; template< typename Frame, typename T > struct _EngineMethodTrampoline {}; -template< typename Frame, typename R > -struct _EngineMethodTrampoline< Frame, R() > : public _EngineMethodTrampolineBase< R() > +template< typename Frame, typename R, typename ...ArgTs > +struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) > { - typedef R( FunctionType )( typename Frame::ObjectType* ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R() >::Args& args ) + using FunctionType = R( typename Frame::ObjectType*, ArgTs ...); +private: + using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >; + using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(Frame f, const ArgsType& args, Seq) { + return R( f._exec(std::get(args) ...) ); + } + + using SeqType = typename Gens::type; +public: + static R jmp( typename Frame::ObjectType* object, const ArgsType& args ) { + Frame f; f.object = object; - return R( f._exec() ); + return dispatchHelper(f, args, SeqType()); } }; - -template< typename Frame, typename R, typename A > -struct _EngineMethodTrampoline< Frame, R( A ) > : public _EngineMethodTrampolineBase< R( A ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B > -struct _EngineMethodTrampoline< Frame, R( A, B ) > : public _EngineMethodTrampolineBase< R( A, B ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C > -struct _EngineMethodTrampoline< Frame, R( A, B, C ) > : public _EngineMethodTrampolineBase< R( A, B, C ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D ) > : public _EngineMethodTrampolineBase< R( A, B, C, D ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G, H ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G, H ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G, H ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G, H, I ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G, H, I ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G, H, I, J ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G, H, I, J ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G, H, I, J, K ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j(), args.k() ) ); - } -}; - -template< typename Frame, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineMethodTrampoline< Frame, R( A, B, C, D, E, F, G, H, I, J, K, L ) > : public _EngineMethodTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K, L ) > -{ - typedef R( FunctionType )( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K, L ); - static R jmp( typename Frame::ObjectType* object, const typename _EngineFunctionTrampolineBase< R( A, B, C, D, E, F, G, H, I, J, K, L ) >::Args& args ) - { - Frame f; - f.object = object; - return R( f._exec( args.a(), args.b(), args.c(), args.d(), args.e(), args.f(), args.g(), args.h(), args.i(), args.j(), args.k(), args.l() ) ); - } -}; - - - /// @} @@ -1671,83 +514,13 @@ struct _EngineConsoleThunkType< void > struct _EngineConsoleThunkCountArgs { - template< typename A > - U32 operator ()( A a ) - { - return 1; - } - - template< typename A, typename B > - U32 operator ()( A a, B b ) - { - return 2; - } - - template< typename A, typename B, typename C > - U32 operator ()( A a, B b, C c ) - { - return 3; - } - - template< typename A, typename B, typename C, typename D > - U32 operator ()( A a, B b, C c, D d ) - { - return 4; - } - - template< typename A, typename B, typename C, typename D, typename E > - U32 operator ()( A a, B b, C c, D d, E e ) - { - return 5; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F > - U32 operator ()( A a, B b, C c, D d, E e, F f ) - { - return 6; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g ) - { - return 7; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g, H h ) - { - return 8; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - { - return 9; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - { - return 10; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - { - return 11; - } - - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - U32 operator ()( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - { - return 12; - } - - - operator U32() const - { - return 0; - } + template U32 operator()(ArgTs... args){ + return sizeof...(ArgTs); + } + + operator U32() const{ // WHAT IS THIS?? + return 0; + } }; @@ -4651,4 +3424,4 @@ template<> struct _EngineConsoleExecCallbackHelper : public _BaseEn // Re-enable some VC warnings we disabled for this file. #pragma warning( pop ) // 4510 and 4610 -#endif // !_ENGINEAPI_H_ \ No newline at end of file +#endif // !_ENGINEAPI_H_ From 41cb22421b3557725b27433bbb64b81bc85908e5 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 02:14:38 -0500 Subject: [PATCH 03/21] This commit is broken, but has a lot of important stuff in it. Trying to figure out why my constructor thinks it doesn't take any parameters --- Engine/source/console/engineAPI.h | 857 +++--------------------- Engine/source/console/engineFunctions.h | 717 +------------------- 2 files changed, 108 insertions(+), 1466 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index a0b9d8900..ee1a34c7b 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -437,6 +437,7 @@ inline const char* _EngineConsoleThunkReturnValue( const T& value ) { return EngineMarshallData( value ); } + inline bool _EngineConsoleThunkReturnValue( bool value ) { return value; @@ -518,7 +519,7 @@ struct _EngineConsoleThunkCountArgs return sizeof...(ArgTs); } - operator U32() const{ // WHAT IS THIS?? + operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros return 0; } }; @@ -527,801 +528,95 @@ struct _EngineConsoleThunkCountArgs // Encapsulation of a legacy console function invocation. +namespace engineAPI{ + namespace detail{ + template + struct ThunkHelpers { + using SelfType = ThunkHelpers; + using FunctionType = R(*)(ArgTs...); + template using MethodType = R(Frame::*)(ArgTs ...) const; + template using IthArgType = typename std::tuple_element >::type; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; + static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; + + template + static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) + { + return (startArgc + index) < argc + ? EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ) + : std::get(defaultArgs.mArgs); + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq){ + return fn(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq){ + return (frame->*fn)(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + using SeqType = typename Gens::type; + }; + } +} template< S32 startArgc, typename T > struct _EngineConsoleThunk {}; -template< S32 startArgc, typename R > -struct _EngineConsoleThunk< startArgc, R() > +template< S32 startArgc, typename R, typename ...ArgTs > +struct _EngineConsoleThunk< startArgc, R(ArgTs...) > { - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 0; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )(), const _EngineFunctionDefaultArguments< void() >& ) +private: + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; +public: + typedef typename Helper::FunctionType FunctionType; + typedef typename Helper::ReturnType ReturnType; + template using MethodType = typename Helper::template MethodType; + static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + + static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) { - return _EngineConsoleThunkReturnValue( fn() ); + return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType())); } template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )() const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType* ) >& ) + static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) { - return _EngineConsoleThunkReturnValue( ( frame->*fn )() ); + return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType())); } }; -template< S32 startArgc > -struct _EngineConsoleThunk< startArgc, void() > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 0; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )(), const _EngineFunctionDefaultArguments< void() >& ) - { - fn(); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )() const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType* ) >& ) - { - return ( frame->*fn )(); - } +// Have to do a partial specialization for void-returning functions :( +template +struct _EngineConsoleThunk { +private: + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; +public: + typedef typename Helper::FunctionType FunctionType; + typedef typename Helper::ReturnType ReturnType; + template using MethodType = typename Helper::template MethodType; + static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + + static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) + { + Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()); + } + template< typename Frame > + static void thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) + { + Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()); + } }; - -template< S32 startArgc, typename R, typename A > -struct _EngineConsoleThunk< startArgc, R( A ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 1 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - - return _EngineConsoleThunkReturnValue( fn( a ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a ) ); - } -}; - -template< S32 startArgc, typename A > -struct _EngineConsoleThunk< startArgc, void( A ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 1 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - - fn( a ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - - ( frame->*fn )( a ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B > -struct _EngineConsoleThunk< startArgc, R( A, B ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 2 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b ) ); - } -}; - -template< S32 startArgc, typename A, typename B > -struct _EngineConsoleThunk< startArgc, void( A, B ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 2 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - - fn( a, b ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - - ( frame->*fn )( a, b ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C > -struct _EngineConsoleThunk< startArgc, R( A, B, C ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 3 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C > -struct _EngineConsoleThunk< startArgc, void( A, B, C ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 3 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - - fn( a, b, c ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - - ( frame->*fn )( a, b, c ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 4 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 4 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - - fn( a, b, c, d ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - - ( frame->*fn )( a, b, c, d ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 5 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 5 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - - fn( a, b, c, d, e ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - - ( frame->*fn )( a, b, c, d, e ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 6 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 6 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - - fn( a, b, c, d, e, f ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - - ( frame->*fn )( a, b, c, d, e, f ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 7 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 7 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - - fn( a, b, c, d, e, f, g ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - - ( frame->*fn )( a, b, c, d, e, f, g ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 8 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g, h ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G, H ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 8 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - - fn( a, b, c, d, e, f, g, h ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G, H ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - - ( frame->*fn )( a, b, c, d, e, f, g, h ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 9 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g, h, i ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G, H, I ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 9 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - - fn( a, b, c, d, e, f, g, h, i ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G, H, I ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - - ( frame->*fn )( a, b, c, d, e, f, g, h, i ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 10 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g, h, i, j ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 10 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - - fn( a, b, c, d, e, f, g, h, i, j ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - - ( frame->*fn )( a, b, c, d, e, f, g, h, i, j ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J, K ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 11 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.k ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g, h, i, j, k ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J, K ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.l ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J, K ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 11 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.k ) ); - - fn( a, b, c, d, e, f, g, h, i, j, k ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J, K ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.l ) ); - - ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k ); - } -}; - - -template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J, K, L ) > -{ - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static const S32 NUM_ARGS = 12 + startArgc; - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J, K, L ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K, L ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.k ) ); - L l = ( startArgc + 11 < argc ? EngineUnmarshallData< L >()( argv[ startArgc + 11 ] ) : L( defaultArgs.l ) ); - - return _EngineConsoleThunkReturnValue( fn( a, b, c, d, e, f, g, h, i, j, k, l ) ); - } - template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, R ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J, K, L ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K, L ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.l ) ); - L l = ( startArgc + 11 < argc ? EngineUnmarshallData< L >()( argv[ startArgc + 11 ] ) : L( defaultArgs.l ) ); - - return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k, l ) ); - } -}; - -template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J, K, L ) > -{ - typedef void ReturnType; - static const S32 NUM_ARGS = 12 + startArgc; - static void thunk( S32 argc, ConsoleValueRef *argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J, K, L ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K, L ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.a ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.b ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.c ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.d ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.e ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.f ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.g ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.h ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.i ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.j ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.k ) ); - L l = ( startArgc + 11 < argc ? EngineUnmarshallData< L >()( argv[ startArgc + 11 ] ) : L( defaultArgs.l ) ); - - fn( a, b, c, d, e, f, g, h, i, j, k, l ); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, void ( Frame::*fn )( A, B, C, D, E, F, G, H, I, J, K, L ) const, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, A, B, C, D, E, F, G, H, I, J, K, L ) >& defaultArgs ) - { - A a = ( startArgc + 0 < argc ? EngineUnmarshallData< A >()( argv[ startArgc + 0 ] ) : A( defaultArgs.b ) ); - B b = ( startArgc + 1 < argc ? EngineUnmarshallData< B >()( argv[ startArgc + 1 ] ) : B( defaultArgs.c ) ); - C c = ( startArgc + 2 < argc ? EngineUnmarshallData< C >()( argv[ startArgc + 2 ] ) : C( defaultArgs.d ) ); - D d = ( startArgc + 3 < argc ? EngineUnmarshallData< D >()( argv[ startArgc + 3 ] ) : D( defaultArgs.e ) ); - E e = ( startArgc + 4 < argc ? EngineUnmarshallData< E >()( argv[ startArgc + 4 ] ) : E( defaultArgs.f ) ); - F f = ( startArgc + 5 < argc ? EngineUnmarshallData< F >()( argv[ startArgc + 5 ] ) : F( defaultArgs.g ) ); - G g = ( startArgc + 6 < argc ? EngineUnmarshallData< G >()( argv[ startArgc + 6 ] ) : G( defaultArgs.h ) ); - H h = ( startArgc + 7 < argc ? EngineUnmarshallData< H >()( argv[ startArgc + 7 ] ) : H( defaultArgs.i ) ); - I i = ( startArgc + 8 < argc ? EngineUnmarshallData< I >()( argv[ startArgc + 8 ] ) : I( defaultArgs.j ) ); - J j = ( startArgc + 9 < argc ? EngineUnmarshallData< J >()( argv[ startArgc + 9 ] ) : J( defaultArgs.k ) ); - K k = ( startArgc + 10 < argc ? EngineUnmarshallData< K >()( argv[ startArgc + 10 ] ) : K( defaultArgs.l ) ); - L l = ( startArgc + 11 < argc ? EngineUnmarshallData< L >()( argv[ startArgc + 11 ] ) : L( defaultArgs.l ) ); - - ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k, l ); - } -}; - - - /// @} /// @name API Definition Macros diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index dedefcf35..fc97a81d1 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -87,693 +87,40 @@ struct EngineFunctionDefaultArguments // Structure encapsulating default arguments to an engine API function. template< typename T > struct _EngineFunctionDefaultArguments {}; -template<> -struct _EngineFunctionDefaultArguments< void() > : public EngineFunctionDefaultArguments -{ - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } -}; -template< typename A > -struct _EngineFunctionDefaultArguments< void( A ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( A a ) - : a( a ) - { mNumDefaultArgs = 1; } -}; -template< typename A, typename B > -struct _EngineFunctionDefaultArguments< void( A, B ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( B b ) - : b( b ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( A a, B b ) - : a( a ), - b( b ) - { mNumDefaultArgs = 2; } -}; -template< typename A, typename B, typename C > -struct _EngineFunctionDefaultArguments< void( A, B, C ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( C c ) - : c( c ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( B b, C c ) - : b( b ), - c( c ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( A a, B b, C c ) - : a( a ), - b( b ), - c( c ) - { mNumDefaultArgs = 3; } -}; -template< typename A, typename B, typename C, typename D > -struct _EngineFunctionDefaultArguments< void( A, B, C, D ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( D d ) - : d( d ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( C c, D d ) - : c( c ), - d( d ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( B b, C c, D d ) - : b( b ), - c( c ), - d( d ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d ) - : a( a ), - b( b ), - c( c ), - d( d ) - { mNumDefaultArgs = 4; } -}; -template< typename A, typename B, typename C, typename D, typename E > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( E e ) - : e( e ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( D d, E e ) - : d( d ), - e( e ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( C c, D d, E e ) - : c( c ), - d( d ), - e( e ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e ) - : b( b ), - c( c ), - d( d ), - e( e ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ) - { mNumDefaultArgs = 5; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( F f ) - : f( f ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( E e, F f ) - : e( e ), - f( f ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( D d, E e, F f ) - : d( d ), - e( e ), - f( f ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f ) - : c( c ), - d( d ), - e( e ), - f( f ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ) - { mNumDefaultArgs = 6; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( G g ) - : g( g ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( F f, G g ) - : f( f ), - g( g ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( E e, F f, G g ) - : e( e ), - f( f ), - g( g ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g ) - : d( d ), - e( e ), - f( f ), - g( g ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ) - { mNumDefaultArgs = 7; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - typename EngineTypeTraits< H >::DefaultArgumentValueStoreType h; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( H h ) - : h( h ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( G g, H h ) - : g( g ), - h( h ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( F f, G g, H h ) - : f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( E e, F f, G g, H h ) - : e( e ), - f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g, H h ) - : d( d ), - e( e ), - f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g, H h ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g, H h ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 7; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g, H h ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ) - { mNumDefaultArgs = 8; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - typename EngineTypeTraits< H >::DefaultArgumentValueStoreType h; - typename EngineTypeTraits< I >::DefaultArgumentValueStoreType i; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( I i ) - : i( i ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( H h, I i ) - : h( h ), - i( i ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( G g, H h, I i ) - : g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( F f, G g, H h, I i ) - : f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( E e, F f, G g, H h, I i ) - : e( e ), - f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g, H h, I i ) - : d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g, H h, I i ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 7; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g, H h, I i ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 8; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ) - { mNumDefaultArgs = 9; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - typename EngineTypeTraits< H >::DefaultArgumentValueStoreType h; - typename EngineTypeTraits< I >::DefaultArgumentValueStoreType i; - typename EngineTypeTraits< J >::DefaultArgumentValueStoreType j; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( J j ) - : j( j ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( I i, J j ) - : i( i ), - j( j ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( H h, I i, J j ) - : h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( G g, H h, I i, J j ) - : g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( F f, G g, H h, I i, J j ) - : f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( E e, F f, G g, H h, I i, J j ) - : e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g, H h, I i, J j ) - : d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 7; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g, H h, I i, J j ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 8; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g, H h, I i, J j ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 9; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ) - { mNumDefaultArgs = 10; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) > : public EngineFunctionDefaultArguments -{ - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - typename EngineTypeTraits< H >::DefaultArgumentValueStoreType h; - typename EngineTypeTraits< I >::DefaultArgumentValueStoreType i; - typename EngineTypeTraits< J >::DefaultArgumentValueStoreType j; - typename EngineTypeTraits< K >::DefaultArgumentValueStoreType k; - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( K k ) - : k( k ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( J j, K k ) - : j( j ), - k( k ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( I i, J j, K k ) - : i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( H h, I i, J j, K k ) - : h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( G g, H h, I i, J j, K k ) - : g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( F f, G g, H h, I i, J j, K k ) - : f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( E e, F f, G g, H h, I i, J j, K k ) - : e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 7; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g, H h, I i, J j, K k ) - : d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 8; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g, H h, I i, J j, K k ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 9; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 10; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ) - { mNumDefaultArgs = 11; } -}; -template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K, L ) > : public EngineFunctionDefaultArguments +template +struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments { - typename EngineTypeTraits< A >::DefaultArgumentValueStoreType a; - typename EngineTypeTraits< B >::DefaultArgumentValueStoreType b; - typename EngineTypeTraits< C >::DefaultArgumentValueStoreType c; - typename EngineTypeTraits< D >::DefaultArgumentValueStoreType d; - typename EngineTypeTraits< E >::DefaultArgumentValueStoreType e; - typename EngineTypeTraits< F >::DefaultArgumentValueStoreType f; - typename EngineTypeTraits< G >::DefaultArgumentValueStoreType g; - typename EngineTypeTraits< H >::DefaultArgumentValueStoreType h; - typename EngineTypeTraits< I >::DefaultArgumentValueStoreType i; - typename EngineTypeTraits< J >::DefaultArgumentValueStoreType j; - typename EngineTypeTraits< K >::DefaultArgumentValueStoreType k; - typename EngineTypeTraits< L >::DefaultArgumentValueStoreType l; - - _EngineFunctionDefaultArguments() - { mNumDefaultArgs = 0; } - _EngineFunctionDefaultArguments( L l ) - : l( l ) - { mNumDefaultArgs = 1; } - _EngineFunctionDefaultArguments( K k, L l ) - : k( k ), - l( l ) - { mNumDefaultArgs = 2; } - _EngineFunctionDefaultArguments( J j, K k, L l ) - : j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 3; } - _EngineFunctionDefaultArguments( I i, J j, K k, L l ) - : i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 4; } - _EngineFunctionDefaultArguments( H h, I i, J j, K k, L l ) - : h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 5; } - _EngineFunctionDefaultArguments( G g, H h, I i, J j, K k, L l ) - : g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 6; } - _EngineFunctionDefaultArguments( F f, G g, H h, I i, J j, K k, L l ) - : f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 7; } - _EngineFunctionDefaultArguments( E e, F f, G g, H h, I i, J j, K k, L l ) - : e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 8; } - _EngineFunctionDefaultArguments( D d, E e, F f, G g, H h, I i, J j, K k, L l ) - : d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 9; } - _EngineFunctionDefaultArguments( C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - : c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 10; } - _EngineFunctionDefaultArguments( B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - : b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 11; } - _EngineFunctionDefaultArguments( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - : a( a ), - b( b ), - c( c ), - d( d ), - e( e ), - f( f ), - g( g ), - h( h ), - i( i ), - j( j ), - k( k ), - l( l ) - { mNumDefaultArgs = 12; } + + + template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; + + std::tuple ...> mArgs; +private: + using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; + + template struct Seq {}; + template struct Gens : Gens {}; + + template struct Gens<0, I...>{ typedef Seq type; }; + + template + void copyHelper(std::tuple ...> defaultArgs, Seq) { + constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); + std::tie(std::get(mArgs)...) = defaultArgs; + } + + template using MaybeVoidEnabled = typename std::enable_if::type; + + template MaybeVoidEnabled tailInit(DefVST ...tail) { + mNumDefaultArgs = sizeof...(TailTs); + copyHelper(std::make_tuple(tail...), typename Gens::type()); + }; +public: + template _EngineFunctionDefaultArguments(DefVST ...tail) + { + tailInit(tail...); + } }; #pragma pack( pop ) From dd1b6959f45a68dae9c5eb9ee4dc92f7a4c9ea67 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 03:17:53 -0500 Subject: [PATCH 04/21] slightly better organization, but same compiling problem --- Engine/source/console/engineFunctions.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index fc97a81d1..86f57feb8 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -91,10 +91,7 @@ struct _EngineFunctionDefaultArguments {}; template struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments { - - template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; - std::tuple ...> mArgs; private: using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; @@ -105,22 +102,24 @@ private: template struct Gens<0, I...>{ typedef Seq type; }; template - void copyHelper(std::tuple ...> defaultArgs, Seq) { + static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); - std::tie(std::get(mArgs)...) = defaultArgs; + std::tie(std::get(args)...) = defaultArgs; } - template using MaybeVoidEnabled = typename std::enable_if::type; + template using MaybeSelfEnabled = typename std::enable_if::type; - template MaybeVoidEnabled tailInit(DefVST ...tail) { - mNumDefaultArgs = sizeof...(TailTs); - copyHelper(std::make_tuple(tail...), typename Gens::type()); + template static MaybeSelfEnabled tailInit(DefVST ...tail) { + std::tuple argsT; + std::tuple tailT = std::make_tuple(tail...); + SelfType::copyHelper(argsT, tailT, typename Gens::type()); + return argsT; }; + public: - template _EngineFunctionDefaultArguments(DefVST ...tail) - { - tailInit(tail...); - } + template _EngineFunctionDefaultArguments(DefVST ...tail) + : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(tailInit(tail...)) + {} }; #pragma pack( pop ) From 0ab089468f3066495a33b4191054706558021443 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 14:06:04 -0500 Subject: [PATCH 05/21] Fixed up the passing of the tuple types --- Engine/source/console/engineFunctions.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 86f57feb8..d0b4fa719 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -109,16 +109,16 @@ private: template using MaybeSelfEnabled = typename std::enable_if::type; - template static MaybeSelfEnabled tailInit(DefVST ...tail) { - std::tuple argsT; - std::tuple tailT = std::make_tuple(tail...); - SelfType::copyHelper(argsT, tailT, typename Gens::type()); + template static MaybeSelfEnabled tailInit(TailTs ...tail) { + std::tuple...> argsT; + std::tuple...> tailT = std::make_tuple(tail...); + SelfType::copyHelper(argsT, tailT, typename Gens::type()); return argsT; }; public: - template _EngineFunctionDefaultArguments(DefVST ...tail) - : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(tailInit(tail...)) + template _EngineFunctionDefaultArguments(TailTs ...tail) + : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) {} }; From 3f6c269f6ac38841c115d149aa8342782948597e Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 14:50:41 -0500 Subject: [PATCH 06/21] Fixed type inference for nulls in console functions --- Engine/source/T3D/aiPlayer.cpp | 6 +++--- Engine/source/T3D/fx/particleEmitterNode.cpp | 2 +- Engine/source/T3D/fx/ribbonNode.cpp | 3 +-- Engine/source/T3D/tsStatic.cpp | 4 ++-- Engine/source/app/badWordFilter.cpp | 2 +- Engine/source/console/consoleTypes.h | 1 + Engine/source/console/engineAPI.h | 9 ++++++--- Engine/source/console/engineFunctions.h | 2 ++ Engine/source/console/enginePrimitives.h | 2 ++ Engine/source/gfx/gfxShader.cpp | 2 +- Engine/source/gfx/video/videoCapture.cpp | 4 ++-- Engine/source/gui/core/guiCanvas.cpp | 2 +- Engine/source/gui/editor/guiEditCtrl.cpp | 4 ++-- Engine/source/gui/editor/guiMenuBar.cpp | 2 +- Engine/source/lighting/lightManager.cpp | 2 +- Engine/source/scene/sceneContainer.cpp | 2 +- Engine/source/sim/actionMap.cpp | 2 +- 17 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index 88b500205..7565f7831 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -1317,7 +1317,7 @@ bool AIPlayer::checkInLos(GameBase* target, bool _useMuzzle, bool _checkEnabled) return hit; } -DefineEngineMethod(AIPlayer, checkInLos, bool, (ShapeBase* obj, bool useMuzzle, bool checkEnabled),(NULL, false, false), +DefineEngineMethod(AIPlayer, checkInLos, bool, (ShapeBase* obj, bool useMuzzle, bool checkEnabled),(nullAsType(), false, false), "@brief Check whether an object is in line of sight.\n" "@obj Object to check. (If blank, it will check the current target).\n" "@useMuzzle Use muzzle position. Otherwise use eye position. (defaults to false).\n" @@ -1366,7 +1366,7 @@ bool AIPlayer::checkInFoV(GameBase* target, F32 camFov, bool _checkEnabled) return (dot > mCos(camFov)); } -DefineEngineMethod(AIPlayer, checkInFoV, bool, (ShapeBase* obj, F32 fov, bool checkEnabled), (NULL, 45.0f, false), +DefineEngineMethod(AIPlayer, checkInFoV, bool, (ShapeBase* obj, F32 fov, bool checkEnabled), (nullAsType(), 45.0f, false), "@brief Check whether an object is within a specified veiw cone.\n" "@obj Object to check. (If blank, it will check the current target).\n" "@fov view angle in degrees.(Defaults to 45)\n" @@ -1440,7 +1440,7 @@ F32 AIPlayer::getTargetDistance(GameBase* target, bool _checkEnabled) return (getPosition() - target->getPosition()).len(); } -DefineEngineMethod(AIPlayer, getTargetDistance, F32, (ShapeBase* obj, bool checkEnabled), (NULL, false), +DefineEngineMethod(AIPlayer, getTargetDistance, F32, (ShapeBase* obj, bool checkEnabled), (nullAsType(), false), "@brief The distance to a given object.\n" "@obj Object to check. (If blank, it will check the current target).\n" "@checkEnabled check whether the object can take damage and if so is still alive.(Defaults to false)\n") diff --git a/Engine/source/T3D/fx/particleEmitterNode.cpp b/Engine/source/T3D/fx/particleEmitterNode.cpp index bb362417b..e03e5a1a7 100644 --- a/Engine/source/T3D/fx/particleEmitterNode.cpp +++ b/Engine/source/T3D/fx/particleEmitterNode.cpp @@ -395,7 +395,7 @@ void ParticleEmitterNode::setEmitterDataBlock(ParticleEmitterData* data) } -DefineEngineMethod(ParticleEmitterNode, setEmitterDataBlock, void, (ParticleEmitterData* emitterDatablock), (NULL), +DefineEngineMethod(ParticleEmitterNode, setEmitterDataBlock, void, (ParticleEmitterData* emitterDatablock), (nullAsType()), "Assigns the datablock for this emitter node.\n" "@param emitterDatablock ParticleEmitterData datablock to assign\n" "@tsexample\n" diff --git a/Engine/source/T3D/fx/ribbonNode.cpp b/Engine/source/T3D/fx/ribbonNode.cpp index 2582fbe6f..7e73fbc59 100644 --- a/Engine/source/T3D/fx/ribbonNode.cpp +++ b/Engine/source/T3D/fx/ribbonNode.cpp @@ -39,7 +39,6 @@ ConsoleDocClass( RibbonNodeData, ConsoleDocClass( RibbonNode, "" ); - //----------------------------------------------------------------------------- // RibbonNodeData //----------------------------------------------------------------------------- @@ -299,7 +298,7 @@ void RibbonNode::setRibbonDatablock(RibbonData* data) mRibbonDatablock = data; } -DefineEngineMethod(RibbonNode, setRibbonDatablock, void, (RibbonData* ribbonDatablock), (0), +DefineEngineMethod(RibbonNode, setRibbonDatablock, void, (RibbonData* ribbonDatablock), (nullAsType()), "Assigns the datablock for this ribbon node.\n" "@param ribbonDatablock RibbonData datablock to assign\n" "@tsexample\n" diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 3997d40dd..0f7b69ef3 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1256,7 +1256,7 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),, // This method is able to change materials per map to with others. The material that is being replaced is being mapped to // unmapped_mat as a part of this transition -DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Material* oldMat, Material* newMat ),("",NULL,NULL), +DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Material* oldMat, Material* newMat ),("",nullAsType(),nullAsType()), "@brief Change one of the materials on the shape.\n\n" "This method changes materials per mapTo with others. The material that " @@ -1323,4 +1323,4 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),, ) { return object->getShapeFileName(); -} \ No newline at end of file +} diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index 7f1dd51a6..e267f5032 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -254,7 +254,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),, return gBadWordFilter->addBadWord(badWord); } -DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (NULL, NULL), +DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType(), nullAsType()), "@brief Replaces the characters in a string with designated text\n\n" "Uses the bad word filter to determine which characters within the string will be replaced.\n\n" diff --git a/Engine/source/console/consoleTypes.h b/Engine/source/console/consoleTypes.h index 8080a8830..8b64d4fa1 100644 --- a/Engine/source/console/consoleTypes.h +++ b/Engine/source/console/consoleTypes.h @@ -39,6 +39,7 @@ #include "console/engineStructs.h" #endif +template constexpr T nullAsType(){ return nullptr; } /// @file /// Legacy TS-based console type definitions. diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index ee1a34c7b..c4976ad55 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -547,9 +547,12 @@ namespace engineAPI{ template static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) { - return (startArgc + index) < argc - ? EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ) - : std::get(defaultArgs.mArgs); + if((startArgc + index) < argc) + { + return EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ); + } else { + return std::get(defaultArgs.mArgs); + } } template diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index d0b4fa719..4346b39cf 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -23,6 +23,8 @@ #ifndef _ENGINEFUNCTIONS_H_ #define _ENGINEFUNCTIONS_H_ +#include + #ifndef _ENGINEEXPORTS_H_ #include "console/engineExports.h" #endif diff --git a/Engine/source/console/enginePrimitives.h b/Engine/source/console/enginePrimitives.h index 72f1899e7..7f0b37670 100644 --- a/Engine/source/console/enginePrimitives.h +++ b/Engine/source/console/enginePrimitives.h @@ -41,6 +41,8 @@ DECLARE_PRIMITIVE_R(S32); DECLARE_PRIMITIVE_R(U32); DECLARE_PRIMITIVE_R(F32); DECLARE_PRIMITIVE_R(F64); +DECLARE_PRIMITIVE_R(U64); +DECLARE_PRIMITIVE_R(S64); DECLARE_PRIMITIVE_R(void*); diff --git a/Engine/source/gfx/gfxShader.cpp b/Engine/source/gfx/gfxShader.cpp index 54f1893e6..1fc35a995 100644 --- a/Engine/source/gfx/gfxShader.cpp +++ b/Engine/source/gfx/gfxShader.cpp @@ -178,7 +178,7 @@ void GFXShader::_unlinkBuffer( GFXShaderConstBuffer *buf ) DefineEngineFunction( addGlobalShaderMacro, void, - ( const char *name, const char *value ), ( NULL ), + ( const char *name, const char *value ), ( nullAsType() ), "Adds a global shader macro which will be merged with the script defined " "macros on every shader. The macro will replace the value of an existing " "macro of the same name. For the new macro to take effect all the shaders " diff --git a/Engine/source/gfx/video/videoCapture.cpp b/Engine/source/gfx/video/videoCapture.cpp index 230baf501..0af46af10 100644 --- a/Engine/source/gfx/video/videoCapture.cpp +++ b/Engine/source/gfx/video/videoCapture.cpp @@ -340,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),, DefineEngineFunction( playJournalToVideo, void, ( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ), - ( NULL, "THEORA", 30.0f, Point2I::Zero ), + ( nullAsType(), "THEORA", 30.0f, Point2I::Zero ), "Load a journal file and capture it video.\n" "@ingroup Rendering\n" ) { @@ -357,4 +357,4 @@ DefineEngineFunction( playJournalToVideo, void, VIDCAP->waitForCanvas(); Journal::Play( journalFile ); -} \ No newline at end of file +} diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index a3f2344f2..400e50d73 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -2147,7 +2147,7 @@ ConsoleDocFragment _popDialog2( "void popDialog();" ); -DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (NULL), "(GuiControl ctrl=NULL)" +DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType()), "(GuiControl ctrl=NULL)" "@hide") { if (gui) diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index f972ec8ca..5c4c09fb3 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2582,7 +2582,7 @@ DefineConsoleMethod( GuiEditCtrl, moveSelection, void, (S32 dx, S32 dy), , "Move //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), (NULL), "( string fileName=null ) - Save selection to file or clipboard.") +DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Save selection to file or clipboard.") { object->saveSelection( filename ); @@ -2590,7 +2590,7 @@ DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, loadSelection, void, (const char * filename), (NULL), "( string fileName=null ) - Load selection from file or clipboard.") +DefineConsoleMethod( GuiEditCtrl, loadSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Load selection from file or clipboard.") { object->loadSelection( filename ); diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index 4a9a4cefa..ea16d4728 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId) } DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd), - ("","",0,NULL,-1,""), + ("","",0,nullAsType(),-1,""), "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" "@param menu Menu name or menu Id to add the new item to.\n" "@param menuItemText Text for the new menu item.\n" diff --git a/Engine/source/lighting/lightManager.cpp b/Engine/source/lighting/lightManager.cpp index f53f5284d..2f8ddd5ee 100644 --- a/Engine/source/lighting/lightManager.cpp +++ b/Engine/source/lighting/lightManager.cpp @@ -442,7 +442,7 @@ DefineEngineFunction( setLightManager, bool, ( const char *name ),, return gClientSceneGraph->setLightManager( name ); } -DefineEngineFunction( lightScene, bool, ( const char *completeCallbackFn, const char *mode ), ( NULL, NULL ), +DefineEngineFunction( lightScene, bool, ( const char *completeCallbackFn, const char *mode ), ( nullAsType(), nullAsType() ), "Will generate static lighting for the scene if supported by the active light manager.\n\n" "If mode is \"forceAlways\", the lightmaps will be regenerated regardless of whether " "lighting cache files can be written to. If mode is \"forceWritable\", then the lightmaps " diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index f5a271794..fbcd485aa 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -1602,7 +1602,7 @@ DefineEngineFunction( containerSearchCurrRadiusDist, F32, ( bool useClientContai //TODO: make RayInfo an API type DefineEngineFunction( containerRayCast, const char*, - ( Point3F start, Point3F end, U32 mask, SceneObject *pExempt, bool useClientContainer ), ( NULL, false ), + ( Point3F start, Point3F end, U32 mask, SceneObject *pExempt, bool useClientContainer ), ( nullAsType(), false ), "@brief Cast a ray from start to end, checking for collision against items matching mask.\n\n" "If pExempt is specified, then it is temporarily excluded from collision checks (For " diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index e4455d458..a1b5c6ac2 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1991,7 +1991,7 @@ DefineEngineMethod( ActionMap, unbindObj, bool, ( const char* device, const char return object->processUnbind( device, action, simObject ); } -DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ), ( NULL, false ), +DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ), ( nullAsType(), false ), "@brief Saves the ActionMap to a file or dumps it to the console.\n\n" "@param fileName The file path to save the ActionMap to. If a filename is not specified " " the ActionMap will be dumped to the console.\n" From 59672d98ff28939feeab901c451e522695a24535 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 14:55:21 -0500 Subject: [PATCH 07/21] Another set of templates converted to be variadic --- Engine/source/console/engineAPI.h | 93 ++----------------------------- 1 file changed, 4 insertions(+), 89 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index c4976ad55..3ed1ad21e 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -1128,98 +1128,13 @@ struct _EngineCallbackHelper : mThis( pThis ), mFn( fn ) {} - template< typename R > - R call() const + template< typename R, typename ...ArgTs > + R call(ArgTs ...args) const { - typedef R( FunctionType )( EngineObject* ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis ) ); + typedef R( FunctionType )( EngineObject*, ArgTs... ); + return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, args... ) ); } - - template< typename R, typename A > - R call( A a ) const - { - typedef R( FunctionType )( EngineObject*, A ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a ) ); - } - - template< typename R, typename A, typename B > - R call( A a, B b ) const - { - typedef R( FunctionType )( EngineObject*, A, B ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b ) ); - } - - template< typename R, typename A, typename B, typename C > - R call( A a, B b, C c ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c ) ); - } - - template< typename R, typename A, typename B, typename C, typename D > - R call( A a, B b, C c, D d ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E > - R call( A a, B b, C c, D d, E e ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > - R call( A a, B b, C c, D d, E e, F f ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - R call( A a, B b, C c, D d, E e, F f, G g ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - R call( A a, B b, C c, D d, E e, F f, G g, H h ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g, h ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g, h, i ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j, k ) ); - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) const - { - typedef R( FunctionType )( EngineObject*, A, B, C, D, E, F, G, H, I, J, K, L ); - return R( reinterpret_cast< FunctionType* >( const_cast(mFn) )( mThis, a, b, c, d, e, f, g, h, i, j, k, l ) ); - } - }; From 0acdb884943da3b80d30a726f36e680fa0ef3a0c Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 15:45:06 -0500 Subject: [PATCH 08/21] so many variadics. --- Engine/source/console/engineAPI.h | 1424 +---------------------------- 1 file changed, 45 insertions(+), 1379 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 3ed1ad21e..896bf336a 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -567,6 +567,14 @@ namespace engineAPI{ using SeqType = typename Gens::type; }; + + struct MarshallHelpers { + template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} + template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){ + EngineMarshallData(head, argc, argv); + marshallEach(argc, argv, tail...); + } + }; } } @@ -1165,6 +1173,8 @@ public: // Base helper for console callbacks struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper { +private: + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis ) @@ -1173,493 +1183,29 @@ public: mArgc = mInitialArgc = pThis ? 2 : 1 ; mCallbackName = callbackName; } - - template< typename R > - R call() + + template< typename R, typename ...ArgTs > + R call(ArgTs ...args) { if (Con::isMainThread()) { ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc, mArgv); + CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); + + Helper::marshallEach(mArgc, mArgv, args...); + return R( EngineUnmarshallData< R >()( _exec() ) ); } else { SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc, NULL, false, &cb); + SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc + sizeof...(ArgTs), NULL, false, &cb); evt->populateArgs(mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - - - template< typename R, typename A > - R call( A a ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+1, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+1, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B > - R call( A a, B b ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+2, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+2, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C > - R call( A a, B b, C c ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+3, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+3, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D > - R call( A a, B b, C c, D d ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+4, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+4, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E > - R call( A a, B b, C c, D d, E e ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+5, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+5, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > - R call( A a, B b, C c, D d, E e, F f ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+6, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+6, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - R call( A a, B b, C c, D d, E e, F f, G g ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+7, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+7, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - R call( A a, B b, C c, D d, E e, F f, G g, H h ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+8, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+8, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+9, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+9, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+10, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+10, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+11, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+11, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+12, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+12, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - + + Helper::marshallEach(mArgc, mArgv, args...); + Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); @@ -1672,6 +1218,8 @@ public: // Override for when first parameter is presumably a SimObject*, in which case A will be absorbed as the callback template struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { +private: + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleExecCallbackHelper( SimObject* pThis ) @@ -1682,457 +1230,41 @@ public: } - template< typename R, typename A > - R call( A a ) + template< typename R, typename SCB, typename ...ArgTs > + R call( SCB simCB , ArgTs ...args ) { if (Con::isMainThread()) { ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+0, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); + CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv); + mArgv[ 0 ].value->setStackStringValue(simCB); - + Helper::marshallEach(mArgc, mArgv, args...); return R( EngineUnmarshallData< R >()( _exec() ) ); } else { SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+0, NULL, true, &cb); + SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, true, &cb); evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - + mArgv[ 0 ].value->setStackStringValue(simCB); + + Helper::marshallEach(mArgc, mArgv, args...); Sim::postEvent(mThis, evt, Sim::getCurrentTime()); return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); } } - - template< typename R, typename A, typename B > - R call( A a, B b ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+1, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+1, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C > - R call( A a, B b, C c ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+2, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+2, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D > - R call( A a, B b, C c, D d ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+3, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+3, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E > - R call( A a, B b, C c, D d, E e ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+4, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+4, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > - R call( A a, B b, C c, D d, E e, F f ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+5, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+5, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - R call( A a, B b, C c, D d, E e, F f, G g ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+6, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+6, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - R call( A a, B b, C c, D d, E e, F f, G g, H h ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+7, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+7, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+8, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+8, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+9, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+9, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+10, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+10, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+11, mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+11, NULL, true, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(a); - - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - - Sim::postEvent(mThis, evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - }; // Override for when first parameter is const char* template<> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { +private: + using Helper = engineAPI::detail::MarshallHelpers; +public: _EngineConsoleExecCallbackHelper( const char *callbackName ) { mThis = NULL; @@ -2140,498 +1272,32 @@ template<> struct _EngineConsoleExecCallbackHelper : public _BaseEn mCallbackName = StringTable->insert(callbackName); } - template< typename R > - R call() + template< typename R, typename ...ArgTs > + R call(ArgTs ...args) { if (Con::isMainThread()) { ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc, mArgv); + CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); + + Helper::marshallEach(mArgc, mArgv, args...); + return R( EngineUnmarshallData< R >()( _exec() ) ); } else { SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc, NULL, false, &cb); + SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, false, &cb); evt->populateArgs(mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); + + Helper::marshallEach(mArgc, mArgv, args...); Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); } - } - - - - template< typename R, typename A > - R call( A a ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+1, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+1, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B > - R call( A a, B b ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+2, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+2, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C > - R call( A a, B b, C c ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+3, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+3, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D > - R call( A a, B b, C c, D d ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+4, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+4, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E > - R call( A a, B b, C c, D d, E e ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+5, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+5, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > - R call( A a, B b, C c, D d, E e, F f ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+6, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+6, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > - R call( A a, B b, C c, D d, E e, F f, G g ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+7, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+7, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - R call( A a, B b, C c, D d, E e, F f, G g, H h ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+8, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+8, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+9, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+9, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+10, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+10, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+11, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+11, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - - template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > - R call( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l ) - { - if (Con::isMainThread()) - { - ConsoleStackFrameSaver sav; sav.save(); - CSTK.reserveValues(mArgc+12, mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - - return R( EngineUnmarshallData< R >()( _exec() ) ); - } - else - { - SimConsoleThreadExecCallback cb; - SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+12, NULL, false, &cb); - evt->populateArgs(mArgv); - mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - EngineMarshallData( a, mArgc, mArgv ); - EngineMarshallData( b, mArgc, mArgv ); - EngineMarshallData( c, mArgc, mArgv ); - EngineMarshallData( d, mArgc, mArgv ); - EngineMarshallData( e, mArgc, mArgv ); - EngineMarshallData( f, mArgc, mArgv ); - EngineMarshallData( g, mArgc, mArgv ); - EngineMarshallData( h, mArgc, mArgv ); - EngineMarshallData( i, mArgc, mArgv ); - EngineMarshallData( j, mArgc, mArgv ); - EngineMarshallData( k, mArgc, mArgv ); - EngineMarshallData( l, mArgc, mArgv ); - - Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); - - return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); - } - } - + } }; // Re-enable some VC warnings we disabled for this file. From 06a7c953f9948280850996a97ea4261822576f9d Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 15:50:56 -0500 Subject: [PATCH 09/21] executef converted --- Engine/source/console/console.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index c1219dc86..e863c60f1 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -912,18 +912,12 @@ namespace Con /// /// @see _EngineConsoleExecCallbackHelper /// - template ConsoleValueRef executef(A a) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(); } - template ConsoleValueRef executef(A a, B b) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b); } - template ConsoleValueRef executef(A a, B b, C c) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c); } - template ConsoleValueRef executef(A a, B b, C c, D d) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g, H h) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g, h); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g, H h, I i) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g, h, i); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g, h, i, j); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g, h, i, j, k); } - template ConsoleValueRef executef(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l) { _EngineConsoleExecCallbackHelper callback( a ); return callback.template call(b, c, d, e, f, g, h, i, j, k, l); } + template + ConsoleValueRef executef(R r, ArgTs ...argTs) + { + _EngineConsoleExecCallbackHelper callback( r ); + return callback.template call(argTs...); + } /// } }; From 1eeec6a1f71f654e634b991f8d2fc56426ad9c51 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 16:11:50 -0500 Subject: [PATCH 10/21] TSShapeConstruct commands converted --- Engine/source/console/engineAPI.h | 2 +- Engine/source/ts/tsShapeConstruct.h | 71 ++++------------------------- 2 files changed, 9 insertions(+), 64 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 896bf336a..c59b1f670 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -1154,7 +1154,7 @@ struct _BaseEngineConsoleCallbackHelper public: /// Matches up to storeArgs. - static const U32 MAX_ARGUMENTS = 11; + static constexpr U32 MAX_ARGUMENTS = 11; SimObject* mThis; S32 mInitialArgc; diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index 24dffe0da..f1dc86d9d 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -97,7 +97,8 @@ public: { eCommandType type; // Command type StringTableEntry name; // Command name - String argv[10]; // Command arguments + static constexpr U32 MAX_ARGS = 10; + String argv[MAX_ARGS]; // Command arguments S32 argc; // Number of arguments Command() : type(CmdInvalid), name(0), argc(0) { } Command( const char* _name ) @@ -105,68 +106,12 @@ public: { name = StringTable->insert( _name ); } - - // Helper functions to fill in the command arguments - inline void addArgs() { } - - template< typename A > - inline void addArgs( A a ) - { - argv[argc++] = EngineMarshallData( a ); - } - template< typename A, typename B > void addArgs( A a, B b ) - { - addArgs( a ); - addArgs( b ); - } - template< typename A, typename B, typename C > - inline void addArgs( A a, B b, C c ) - { - addArgs( a ); - addArgs( b, c ); - } - template< typename A, typename B, typename C, typename D > - inline void addArgs( A a, B b, C c, D d ) - { - addArgs( a ); - addArgs( b, c, d ); - } - template< typename A, typename B, typename C, typename D, typename E > - inline void addArgs( A a, B b, C c, D d, E e ) - { - addArgs( a ); - addArgs( b, c, d, e ); - } - template< typename A, typename B, typename C, typename D, typename E, typename F > - inline void addArgs( A a, B b, C c, D d, E e, F f ) - { - addArgs( a ); - addArgs( b, c, d, e, f ); - } - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G > - inline void addArgs( A a, B b, C c, D d, E e, F f, G g ) - { - addArgs( a ); - addArgs( b, c, d, e, f, g ); - } - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > - inline void addArgs( A a, B b, C c, D d, E e, F f, G g, H h ) - { - addArgs( a ); - addArgs( b, c, d, e, f, g, h ); - } - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > - inline void addArgs( A a, B b, C c, D d, E e, F f, G g, H h, I i ) - { - addArgs( a ); - addArgs( b, c, d, e, f, g, h, i ); - } - template< typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > - inline void addArgs( A a, B b, C c, D d, E e, F f, G g, H h, I i, J j ) - { - addArgs( a ); - addArgs( b, c, d, e, f, g, h, i, j ); - } + + // Helper functions to fill in the command arguments + template inline void addArgs(ArgTs ...args){ + using Helper = engineAPI::detail::MarshallHelpers; + Helper::marshallEach(argc, argv, args...); + } }; Vector mCommands; From 1eb0134a1f93630ad2c40c756fdee3ea4aaaba8d Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 16:36:25 -0500 Subject: [PATCH 11/21] minor fixes, and converted the type table --- Engine/source/console/engineAPI.h | 16 +- Engine/source/console/engineTypeInfo.h | 392 +------------------------ Engine/source/ts/tsShapeConstruct.h | 2 +- 3 files changed, 28 insertions(+), 382 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index c59b1f670..829893641 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -568,7 +568,15 @@ namespace engineAPI{ using SeqType = typename Gens::type; }; - struct MarshallHelpers { + template struct MarshallHelpers { + template static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){} + template static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){ + argv[argc++] = EngineMarshallData(head); + marshallEach(argc, argv, tail...); + } + }; + + template<> struct MarshallHelpers { template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){ EngineMarshallData(head, argc, argv); @@ -1174,7 +1182,7 @@ public: struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis ) @@ -1219,7 +1227,7 @@ public: template struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleExecCallbackHelper( SimObject* pThis ) @@ -1263,7 +1271,7 @@ public: template<> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleExecCallbackHelper( const char *callbackName ) { diff --git a/Engine/source/console/engineTypeInfo.h b/Engine/source/console/engineTypeInfo.h index 52d713e9e..7a9f7122c 100644 --- a/Engine/source/console/engineTypeInfo.h +++ b/Engine/source/console/engineTypeInfo.h @@ -648,395 +648,33 @@ template< typename T > const EngineFunctionTypeInfo< T > _EngineFunctionTypeTrai // Function Argument Type Infos. //-------------------------------------------------------------------------- -template< typename R > -struct _EngineArgumentTypeTable< R() > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 0; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; -#ifdef TORQUE_COMPILER_GCC - static const EngineTypeInfo* const ARGS[ 0 ]; + +#ifdef TORQUE_COMILER_GCC +#define ARGS_SIZE_SAFE(wanted) (wanted) #else - static const EngineTypeInfo* const ARGS[ 1 ]; +#define ARGS_SIZE_SAFE(wanted) (((wanted) < 1) ? 1 : (wanted)) #endif - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R > const EngineTypeInfo* const _EngineArgumentTypeTable< R() >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -#ifdef TORQUE_COMPILER_GCC -template< typename R > const EngineTypeInfo* const _EngineArgumentTypeTable< R() >::ARGS[ 0 ] = {}; -#else -template< typename R > const EngineTypeInfo* const _EngineArgumentTypeTable< R() >::ARGS[ 1 ] = {}; -#endif -template< typename R > -struct _EngineArgumentTypeTable< R( ... ) > : public _EngineArgumentTypeTable< R() > +template< typename R, typename ...ArgTs > +struct _EngineArgumentTypeTable< R( ArgTs ... ) > : public EngineArgumentTypeTable { - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A > -struct _EngineArgumentTypeTable< R( A ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 1; + static const U32 NUM_ARGUMENTS = sizeof...(ArgTs); static const bool VARIADIC = false; static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 1 ]; + static const EngineTypeInfo* const ARGS[ ARGS_SIZE_SAFE(sizeof...(ArgTs)) ]; _EngineArgumentTypeTable() : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} }; -template< typename R, typename A > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A ) >::ARGS[ 1 ] = +template< typename R, typename ...ArgTs > +const EngineTypeInfo* const _EngineArgumentTypeTable< R( ArgTs ... ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); +template< typename R, typename ...ArgTs > +const EngineTypeInfo* const _EngineArgumentTypeTable< R( ArgTs ... ) >::ARGS[ ARGS_SIZE_SAFE(sizeof...(ArgTs)) ] = { - TYPE< typename EngineTypeTraits< A >::Type >() + TYPE< typename EngineTypeTraits< ArgTs >::Type >() ... }; -template< typename R, typename A > -struct _EngineArgumentTypeTable< R( A, ... ) > : public _EngineArgumentTypeTable< R( A ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B > -struct _EngineArgumentTypeTable< R( A, B ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 2; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 2 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B ) >::ARGS[ 2 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >() -}; -template< typename R, typename A, typename B > -struct _EngineArgumentTypeTable< R( A, B, ... ) > : public _EngineArgumentTypeTable< R( A, B ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C > -struct _EngineArgumentTypeTable< R( A, B, C ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 3; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 3 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C ) >::ARGS[ 3 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >() -}; -template< typename R, typename A, typename B, typename C > -struct _EngineArgumentTypeTable< R( A, B, C, ... ) > : public _EngineArgumentTypeTable< R( A, B, C ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineArgumentTypeTable< R( A, B, C, D ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 4; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 4 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D ) >::ARGS[ 4 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineArgumentTypeTable< R( A, B, C, D, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineArgumentTypeTable< R( A, B, C, D, E ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 5; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 5 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E ) >::ARGS[ 5 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 6; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 6 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F ) >::ARGS[ 6 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 7; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 7 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G ) >::ARGS[ 7 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 8; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 8 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H ) >::ARGS[ 8 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >(), - TYPE< typename EngineTypeTraits< H >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 9; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 9 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I ) >::ARGS[ 9 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >(), - TYPE< typename EngineTypeTraits< H >::Type >(), - TYPE< typename EngineTypeTraits< I >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 10; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 10 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J ) >::ARGS[ 10 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >(), - TYPE< typename EngineTypeTraits< H >::Type >(), - TYPE< typename EngineTypeTraits< I >::Type >(), - TYPE< typename EngineTypeTraits< J >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 11; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 11 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K ) >::ARGS[ 11 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >(), - TYPE< typename EngineTypeTraits< H >::Type >(), - TYPE< typename EngineTypeTraits< I >::Type >(), - TYPE< typename EngineTypeTraits< J >::Type >(), - TYPE< typename EngineTypeTraits< K >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K ) > -{ - static const bool VARIADIC = true; - _EngineArgumentTypeTable() {} -}; - -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, L ) > : public EngineArgumentTypeTable -{ - static const U32 NUM_ARGUMENTS = 12; - static const bool VARIADIC = false; - static const EngineTypeInfo* const RETURN; - static const EngineTypeInfo* const ARGS[ 12 ]; - - _EngineArgumentTypeTable() - : EngineArgumentTypeTable( TYPE< typename EngineTypeTraits< R >::Type >(), NUM_ARGUMENTS, ARGS ) {} -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, L ) >::RETURN = TYPE< typename EngineTypeTraits< R >::Type >(); -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -const EngineTypeInfo* const _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, L ) >::ARGS[ 12 ] = -{ - TYPE< typename EngineTypeTraits< A >::Type >(), - TYPE< typename EngineTypeTraits< B >::Type >(), - TYPE< typename EngineTypeTraits< C >::Type >(), - TYPE< typename EngineTypeTraits< D >::Type >(), - TYPE< typename EngineTypeTraits< E >::Type >(), - TYPE< typename EngineTypeTraits< F >::Type >(), - TYPE< typename EngineTypeTraits< G >::Type >(), - TYPE< typename EngineTypeTraits< H >::Type >(), - TYPE< typename EngineTypeTraits< I >::Type >(), - TYPE< typename EngineTypeTraits< J >::Type >(), - TYPE< typename EngineTypeTraits< K >::Type >(), - TYPE< typename EngineTypeTraits< L >::Type >() -}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, L, ... ) > : public _EngineArgumentTypeTable< R( A, B, C, D, E, F, G, H, I, J, K, L ) > +template< typename R, typename ... ArgTs > +struct _EngineArgumentTypeTable< R( ArgTs ..., ... ) > : public _EngineArgumentTypeTable< R( ArgTs ... ) > { static const bool VARIADIC = true; _EngineArgumentTypeTable() {} diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index f1dc86d9d..78c3a8f9f 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -109,7 +109,7 @@ public: // Helper functions to fill in the command arguments template inline void addArgs(ArgTs ...args){ - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; Helper::marshallEach(argc, argv, args...); } }; From 60b3ce3d6ec801e7da02f807ec5235ed473a5701 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 16:48:26 -0500 Subject: [PATCH 12/21] finished variadic conversion --- Engine/source/console/engineTypes.h | 56 +++-------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/Engine/source/console/engineTypes.h b/Engine/source/console/engineTypes.h index 65e81e5d6..321e39686 100644 --- a/Engine/source/console/engineTypes.h +++ b/Engine/source/console/engineTypes.h @@ -284,58 +284,10 @@ template< typename T > const EngineTypeInfo* const _EngineFunctionTypeTraits< T // are not guaranteed to be any meaningful value or base types to the engine type system. #define T( x ) typename EngineTypeTraits< x >::ValueType -template< typename R > -struct _EngineTypeTraits< R() > : public _EngineFunctionTypeTraits< T( R )() > {}; -template< typename R > -struct _EngineTypeTraits< R( ... ) > : public _EngineFunctionTypeTraits< T( R )( ... ) > {}; -template< typename R, typename A > -struct _EngineTypeTraits< R( A ) > : public _EngineFunctionTypeTraits< T( R )( T( A ) ) > {}; -template< typename R, typename A > -struct _EngineTypeTraits< R( A, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), ... ) > {}; -template< typename R, typename A, typename B > -struct _EngineTypeTraits< R( A, B ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ) ) > {}; -template< typename R, typename A, typename B > -struct _EngineTypeTraits< R( A, B, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), ... ) > {}; -template< typename R, typename A, typename B, typename C > -struct _EngineTypeTraits< R( A, B, C ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ) ) > {}; -template< typename R, typename A, typename B, typename C > -struct _EngineTypeTraits< R( A, B, C, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineTypeTraits< R( A, B, C, D ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D > -struct _EngineTypeTraits< R( A, B, C, D, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineTypeTraits< R( A, B, C, D, E ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E > -struct _EngineTypeTraits< R( A, B, C, D, E, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineTypeTraits< R( A, B, C, D, E, F ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F > -struct _EngineTypeTraits< R( A, B, C, D, E, F, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J, K ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ), T( K ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J, K, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ), T( K ), ... ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J, K, L ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ), T( K ), T( L ) ) > {}; -template< typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L > -struct _EngineTypeTraits< R( A, B, C, D, E, F, G, H, I, J, K, L, ... ) > : public _EngineFunctionTypeTraits< T( R )( T( A ), T( B ), T( C ), T( D ), T( E ), T( F ), T( G ), T( H ), T( I ), T( J ), T( K ), T( L ), ... ) > {}; +template +struct _EngineTypeTraits< R(ArgTs ...) > : public _EngineFunctionTypeTraits {}; +template +struct _EngineTypeTraits< R(ArgTs ..., ...) > : public _EngineFunctionTypeTraits {}; #undef T From 45ae5e71cba30210aebaf1a41c457b28e5d9b2ae Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 18:04:28 -0500 Subject: [PATCH 13/21] fixed lots of tabs and space --- Engine/source/T3D/aiPlayer.cpp | 46 +- Engine/source/T3D/tsStatic.cpp | 42 +- Engine/source/app/badWordFilter.cpp | 34 +- Engine/source/console/CMDscan.cpp | 1484 ++++++++--------- Engine/source/console/SimXMLDocument.cpp | 142 +- Engine/source/console/SimXMLDocument.h | 24 +- Engine/source/console/arrayObject.h | 2 +- Engine/source/console/cmdgram.cpp | 386 ++--- Engine/source/console/cmdgram.h | 144 +- Engine/source/console/codeBlock.cpp | 8 +- Engine/source/console/compiledEval.cpp | 16 +- Engine/source/console/console.cpp | 68 +- Engine/source/console/console.h | 68 +- Engine/source/console/consoleDoc.cpp | 4 +- Engine/source/console/consoleFunctions.cpp | 130 +- Engine/source/console/consoleInternal.cpp | 14 +- Engine/source/console/consoleLogger.cpp | 56 +- Engine/source/console/consoleObject.cpp | 58 +- Engine/source/console/consoleParser.cpp | 44 +- Engine/source/console/consoleParser.h | 30 +- Engine/source/console/engineAPI.h | 274 +-- Engine/source/console/engineFunctions.h | 54 +- Engine/source/console/fieldBrushObject.cpp | 24 +- Engine/source/console/fileSystemFunctions.cpp | 150 +- Engine/source/console/persistenceManager.cpp | 62 +- Engine/source/console/scriptFilename.cpp | 22 +- Engine/source/console/scriptObjects.cpp | 84 +- Engine/source/console/sim.cpp | 22 +- Engine/source/console/simDictionary.cpp | 8 +- Engine/source/console/simDictionary.h | 2 +- Engine/source/console/simEvents.cpp | 8 +- Engine/source/console/simManager.cpp | 12 +- Engine/source/console/simObject.cpp | 20 +- Engine/source/console/simObject.h | 2 +- Engine/source/console/simObjectMemento.cpp | 46 +- Engine/source/console/simObjectMemento.h | 2 +- Engine/source/console/simPersistSet.cpp | 14 +- Engine/source/console/simSerialize.cpp | 14 +- Engine/source/console/stringStack.cpp | 2 +- Engine/source/console/telnetConsole.cpp | 12 +- Engine/source/console/telnetDebugger.cpp | 30 +- Engine/source/console/typeValidators.cpp | 56 +- Engine/source/gfx/video/videoCapture.cpp | 2 +- Engine/source/gui/core/guiCanvas.cpp | 488 +++--- Engine/source/gui/editor/guiEditCtrl.cpp | 24 +- Engine/source/gui/editor/guiMenuBar.cpp | 248 +-- Engine/source/lighting/lightManager.cpp | 14 +- Engine/source/platform/platformNet.h | 56 +- Engine/source/platform/profiler.cpp | 78 +- Engine/source/platformMac/macFileIO.mm | 158 +- Engine/source/scene/sceneContainer.cpp | 6 +- Engine/source/sim/actionMap.cpp | 582 +++---- Engine/source/ts/tsShapeConstruct.h | 14 +- 53 files changed, 2695 insertions(+), 2695 deletions(-) diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index 7565f7831..28f8ec6e5 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -35,9 +35,9 @@ static U32 sAIPlayerLoSMask = TerrainObjectType | StaticShapeObjectType | Static IMPLEMENT_CO_NETOBJECT_V1(AIPlayer); ConsoleDocClass( AIPlayer, - "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" + "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" - "The AIPlayer provides a Player object that may be controlled from script. You control " + "The AIPlayer provides a Player object that may be controlled from script. You control " "where the player moves and how fast. You may also set where the AIPlayer is aiming at " "-- either a location or another game object.\n\n" @@ -70,19 +70,19 @@ ConsoleDocClass( AIPlayer, "position to the center of the target's bounding box. The LOS ray test only checks against interiors, " "statis shapes, and terrain.\n\n" - "@tsexample\n" - "// Create the demo player object\n" - "%player = new AiPlayer()\n" - "{\n" - " dataBlock = DemoPlayer;\n" - " path = \"\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create the demo player object\n" + "%player = new AiPlayer()\n" + "{\n" + " dataBlock = DemoPlayer;\n" + " path = \"\";\n" + "};\n" + "@endtsexample\n\n" - "@see Player for a list of all inherited functions, variables, and base description\n" + "@see Player for a list of all inherited functions, variables, and base description\n" - "@ingroup AI\n" - "@ingroup gameObjects\n"); + "@ingroup AI\n" + "@ingroup gameObjects\n"); /** * Constructor */ @@ -147,7 +147,7 @@ void AIPlayer::initPersistFields() addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ), "@brief Distance considered in firing range for callback purposes."); - + endGroup( "AI" ); #ifdef TORQUE_NAVIGATION_ENABLED @@ -399,11 +399,11 @@ bool AIPlayer::getAIMove(Move *movePtr) { clearPath(); mMoveState = ModeStop; - throwCallback("onTargetInRange"); + throwCallback("onTargetInRange"); } else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius) { - throwCallback("onTargetInFiringRange"); + throwCallback("onTargetInFiringRange"); } } } @@ -854,7 +854,7 @@ DefineEngineMethod(AIPlayer, getPathDestination, Point3F, (),, "@see setPathDestination()\n") { - return object->getPathDestination(); + return object->getPathDestination(); } void AIPlayer::followNavPath(NavPath *path) @@ -1148,7 +1148,7 @@ DefineEngineMethod( AIPlayer, setMoveSpeed, void, ( F32 speed ),, "@see getMoveDestination()\n") { - object->setMoveSpeed(speed); + object->setMoveSpeed(speed); } DefineEngineMethod( AIPlayer, getMoveSpeed, F32, ( ),, @@ -1186,7 +1186,7 @@ DefineEngineMethod( AIPlayer, getMoveDestination, Point3F, (),, "@see setMoveDestination()\n") { - return object->getMoveDestination(); + return object->getMoveDestination(); } DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, @@ -1196,7 +1196,7 @@ DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, "@see getAimLocation()\n") { - object->setAimLocation(target); + object->setAimLocation(target); } DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, @@ -1212,7 +1212,7 @@ DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, "@see setAimLocation()\n" "@see setAimObject()\n") { - return object->getAimLocation(); + return object->getAimLocation(); } ConsoleDocFragment _setAimObject( @@ -1240,7 +1240,7 @@ ConsoleDocFragment _setAimObject( DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )" "Sets the bot's target object. Optionally set an offset from target location." - "@hide") + "@hide") { // Find the target @@ -1262,7 +1262,7 @@ DefineEngineMethod( AIPlayer, getAimObject, S32, (),, "@see setAimObject()\n") { - GameBase* obj = object->getAimObject(); + GameBase* obj = object->getAimObject(); return obj? obj->getId(): -1; } diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 0f7b69ef3..84b3b0797 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1222,17 +1222,17 @@ DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0), "@return the name of the indexed material.\n" "@see getTargetCount()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetName(index); - } + return obj->getShapeInstance()->getTargetName(index); + } - return ""; + return ""; } DefineEngineMethod( TSStatic, getTargetCount, S32,(),, @@ -1240,17 +1240,17 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),, "@return the number of materials in the shape.\n" "@see getTargetName()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetCount(); - } + return obj->getShapeInstance()->getTargetCount(); + } - return -1; + return -1; } // This method is able to change materials per map to with others. The material that is being replaced is being mapped to @@ -1317,10 +1317,10 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),, "@return the shape filename\n\n" "@tsexample\n" - "// Acquire the model filename used on this shape.\n" - "%modelFilename = %obj.getModelFile();\n" + "// Acquire the model filename used on this shape.\n" + "%modelFilename = %obj.getModelFile();\n" "@endtsexample\n" ) { - return object->getShapeFileName(); + return object->getShapeFileName(); } diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index e267f5032..d0547e5ee 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -65,7 +65,7 @@ void BadWordFilter::create() { Con::addVariable("pref::enableBadWordFilter", TypeBool, &filteringEnabled, "@brief If true, the bad word filter will be enabled.\n\n" - "@ingroup Game"); + "@ingroup Game"); gBadWordFilter = new BadWordFilter; gBadWordFilter->addBadWord("shit"); gBadWordFilter->addBadWord("fuck"); @@ -251,7 +251,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),, "@ingroup Game") { - return gBadWordFilter->addBadWord(badWord); + return gBadWordFilter->addBadWord(badWord); } DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType(), nullAsType()), @@ -279,17 +279,17 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const "@ingroup Game") { - const char *replaceStr = NULL; + const char *replaceStr = NULL; - if(replacementChars) - replaceStr = replacementChars; - else - replaceStr = gBadWordFilter->getDefaultReplaceStr(); + if(replacementChars) + replaceStr = replacementChars; + else + replaceStr = gBadWordFilter->getDefaultReplaceStr(); - char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString); - gBadWordFilter->filterString(ret, replaceStr); - return ret; + char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); + dStrcpy(ret, baseString); + gBadWordFilter->filterString(ret, replaceStr); + return ret; } DefineEngineFunction(containsBadWords, bool, (const char* text),, @@ -316,17 +316,17 @@ DefineEngineFunction(containsBadWords, bool, (const char* text),, "// Otherwise print the original text\n" "if(containsBadWords(%userText))\n" "{\n" - " // Filter the string\n" - " %filteredText = filterString(%userText, %replacementChars);\n\n" - " // Print filtered text\n" - " echo(%filteredText);\n" + " // Filter the string\n" + " %filteredText = filterString(%userText, %replacementChars);\n\n" + " // Print filtered text\n" + " echo(%filteredText);\n" "}\n" "else\n" - " echo(%userText);\n\n" + " echo(%userText);\n\n" "@endtsexample\n" "@ingroup Game") { - return gBadWordFilter->containsBadWords(text); + return gBadWordFilter->containsBadWords(text); } diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 6aedd587f..4a1c132b9 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -49,15 +49,15 @@ /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch @@ -128,10 +128,10 @@ extern FILE *yyin, *yyout; * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -141,14 +141,14 @@ extern FILE *yyin, *yyout; /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) @@ -160,61 +160,61 @@ typedef unsigned int yy_size_t; struct yy_buffer_state - { - FILE *yy_input_file; + { + FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; static YY_BUFFER_STATE yy_current_buffer = 0; @@ -228,15 +228,15 @@ static YY_BUFFER_STATE yy_current_buffer = 0; /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -264,18 +264,18 @@ static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) @@ -294,11 +294,11 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 @@ -715,21 +715,21 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -770,280 +770,280 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION YY_DECL - { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + { + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 105 "CMDscan.l" ; #line 785 "CMDscan.cpp" - if ( yy_init ) - { - yy_init = 0; + if ( yy_init ) + { + yy_init = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); - } + yy_load_buffer_state(); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of yytext. */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 338 ); + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 338 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; case 1: YY_RULE_SETUP #line 107 "CMDscan.l" { } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 108 "CMDscan.l" { return(Sc_ScanDocBlock()); } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 109 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 110 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 111 "CMDscan.l" {lineIndex++;} - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 112 "CMDscan.l" { return(Sc_ScanString(STRATOM)); } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 113 "CMDscan.l" { return(Sc_ScanString(TAGATOM)); } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 114 "CMDscan.l" { CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 115 "CMDscan.l" { CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 116 "CMDscan.l" { CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 117 "CMDscan.l" { CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 118 "CMDscan.l" { CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 119 "CMDscan.l" { CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 120 "CMDscan.l" { CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 121 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 122 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 123 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 124 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 125 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 126 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 127 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 128 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 129 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 130 "CMDscan.l" { CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 131 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 132 "CMDscan.l" { CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 133 "CMDscan.l" { CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 134 "CMDscan.l" { CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 135 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 136 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 137 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 138 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 139 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 140 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 141 "CMDscan.l" { CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 142 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 143 "CMDscan.l" @@ -1070,7 +1070,7 @@ YY_RULE_SETUP break; } } - YY_BREAK + YY_BREAK case 38: #line 167 "CMDscan.l" case 39: @@ -1121,475 +1121,475 @@ case 61: YY_RULE_SETUP #line 189 "CMDscan.l" { CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 190 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 191 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 192 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 193 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 194 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 195 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 196 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 197 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 198 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 199 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 200 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 201 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 202 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 203 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 204 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 205 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 206 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 207 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 208 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 209 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 210 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 211 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 212 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 213 "CMDscan.l" { CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 214 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 215 "CMDscan.l" { return(Sc_ScanVar()); } - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 216 "CMDscan.l" { return Sc_ScanIdent(); } - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 217 "CMDscan.l" return(Sc_ScanHex()); - YY_BREAK + YY_BREAK case 90: YY_RULE_SETUP #line 218 "CMDscan.l" { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 219 "CMDscan.l" return Sc_ScanNum(); - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 220 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 221 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 222 "CMDscan.l" ECHO; - YY_BREAK + YY_BREAK #line 1291 "CMDscan.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); + yyterminate(); - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() - { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; - int ret_val; + { + char *dest = yy_current_buffer->yy_ch_buf; + char *source = yytext_ptr; + int number_to_move, i; + int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } - /* Try to read more data. */ + /* Try to read more data. */ - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT - YY_FATAL_ERROR( + YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; #endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - return ret_val; - } + return ret_val; + } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() - { - yy_state_type yy_current_state; - char *yy_cp; + { + yy_state_type yy_current_state; + char *yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } - return yy_current_state; - } + return yy_current_state; + } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS @@ -1598,27 +1598,27 @@ static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif - { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; + { + int yy_is_jam; + char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 223); + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 223); - return yy_is_jam ? 0 : yy_current_state; - } + return yy_is_jam ? 0 : yy_current_state; + } #ifndef YY_NO_UNPUT @@ -1629,40 +1629,40 @@ static void yyunput( c, yy_bp ) int c; char *yy_bp; #endif - { - char *yy_cp = yy_c_buf_p; + { + char *yy_cp = yy_c_buf_p; - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yy_n_chars + 2; + char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus @@ -1670,69 +1670,69 @@ static int yyinput() #else static int input() #endif - { - int c; + { + int c; - *yy_c_buf_p = yy_hold_char; + *yy_c_buf_p = yy_hold_char; - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; - case EOB_ACT_LAST_MATCH: + case EOB_ACT_LAST_MATCH: #ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); #else - YY_FATAL_ERROR( - "unexpected last match in input()" ); + YY_FATAL_ERROR( + "unexpected last match in input()" ); #endif - } - } - } + } + } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; - return c; - } + return c; + } #ifdef YY_USE_PROTOS @@ -1741,13 +1741,13 @@ void yyrestart( FILE *input_file ) void yyrestart( input_file ) FILE *input_file; #endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } #ifdef YY_USE_PROTOS @@ -1756,28 +1756,28 @@ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif - { - if ( yy_current_buffer == new_buffer ) - return; + { + if ( yy_current_buffer == new_buffer ) + return; - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + yy_current_buffer = new_buffer; + yy_load_buffer_state(); - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } #ifdef YY_USE_PROTOS @@ -1785,12 +1785,12 @@ void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } #ifdef YY_USE_PROTOS @@ -1800,28 +1800,28 @@ YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer( b, file ); - return b; - } + return b; + } #ifdef YY_USE_PROTOS @@ -1830,18 +1830,18 @@ void yy_delete_buffer( YY_BUFFER_STATE b ) void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + yy_flex_free( (void *) b ); + } #ifndef YY_ALWAYS_INTERACTIVE @@ -1859,22 +1859,22 @@ FILE *file; #endif - { - yy_flush_buffer( b ); + { + yy_flush_buffer( b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; + b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; + b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif - } + } #ifdef YY_USE_PROTOS @@ -1884,24 +1884,24 @@ void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif - { - b->yy_n_chars = 0; + { + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } #ifndef YY_NO_SCAN_BUFFER @@ -1912,33 +1912,33 @@ YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer( b ); - return b; - } + return b; + } #endif @@ -1949,13 +1949,13 @@ YY_BUFFER_STATE yy_scan_string( yyconst char *str ) YY_BUFFER_STATE yy_scan_string( str ) yyconst char *str; #endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; + { + int len; + for ( len = 0; str[len]; ++len ) + ; - return yy_scan_bytes( str, len ); - } + return yy_scan_bytes( str, len ); + } #endif @@ -1967,34 +1967,34 @@ YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; - } + return b; + } #endif @@ -2005,49 +2005,49 @@ static void yy_push_state( int new_state ) static void yy_push_state( new_state ) int new_state; #endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + yy_start_stack[yy_start_stack_ptr++] = YY_START; - BEGIN(new_state); - } + BEGIN(new_state); + } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } #endif #ifndef YY_EXIT_FAILURE @@ -2060,10 +2060,10 @@ static void yy_fatal_error( yyconst char msg[] ) static void yy_fatal_error( msg ) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } @@ -2071,16 +2071,16 @@ char msg[]; #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ @@ -2094,11 +2094,11 @@ char *s1; yyconst char *s2; int n; #endif - { - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } + { + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } #endif @@ -2108,9 +2108,9 @@ static void *yy_flex_alloc( yy_size_t size ) static void *yy_flex_alloc( size ) yy_size_t size; #endif - { - return (void *) malloc( size ); - } + { + return (void *) malloc( size ); + } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) @@ -2119,16 +2119,16 @@ static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) @@ -2136,16 +2136,16 @@ static void yy_flex_free( void *ptr ) static void yy_flex_free( ptr ) void *ptr; #endif - { - free( ptr ); - } + { + free( ptr ); + } #if YY_MAIN int main() - { - yylex(); - return 0; - } + { + yylex(); + return 0; + } #endif #line 222 "CMDscan.l" diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 840f36ca8..faa4a6017 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -49,40 +49,40 @@ ConsoleDocClass( SimXMLDocument, "// Thanks to Rex Hiebert for this example\n" "// Given the following XML\n" "\n" - "\n" - " \n" - " Triangle\n" - " Square\n" - " Circle\n" - "
\n" - " \n" - " Pyramid\n" - " Cube\n" - " Sphere\n" - "
\n" - "
\n\n" + "\n" + " \n" + " Triangle\n" + " Square\n" + " Circle\n" + "
\n" + " \n" + " Pyramid\n" + " Cube\n" + " Sphere\n" + "
\n" + "
\n\n" "// Using SimXMLDocument by itself\n" "function readXmlExample(%filename)\n" - "{\n" - " %xml = new SimXMLDocument() {};\n" - " %xml.loadFile(%filename);\n\n" - " %xml.pushChildElement(\"DataTables\");\n" - " %xml.pushFirstChildElement(\"table\");\n" - " while(true)\n" - " {\n" - " echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n" - " %xml.pushFirstChildElement(\"rec\");\n" - " while (true)\n" - " {\n" - " %id = %xml.attribute(\"id\");\n" - " %desc = %xml.getData();\n" - " echo(\" Shape\" SPC %id SPC %desc);\n" - " if (!%xml.nextSiblingElement(\"rec\")) break;\n" - " }\n" - " %xml.popElement();\n" - " if (!%xml.nextSiblingElement(\"table\")) break;\n" - " }\n" - "}\n\n" + "{\n" + " %xml = new SimXMLDocument() {};\n" + " %xml.loadFile(%filename);\n\n" + " %xml.pushChildElement(\"DataTables\");\n" + " %xml.pushFirstChildElement(\"table\");\n" + " while(true)\n" + " {\n" + " echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n" + " %xml.pushFirstChildElement(\"rec\");\n" + " while (true)\n" + " {\n" + " %id = %xml.attribute(\"id\");\n" + " %desc = %xml.getData();\n" + " echo(\" Shape\" SPC %id SPC %desc);\n" + " if (!%xml.nextSiblingElement(\"rec\")) break;\n" + " }\n" + " %xml.popElement();\n" + " if (!%xml.nextSiblingElement(\"table\")) break;\n" + " }\n" + "}\n\n" "// Thanks to Scott Peal for this example\n" "// Using FileObject in conjunction with SimXMLDocument\n" @@ -90,45 +90,45 @@ ConsoleDocClass( SimXMLDocument, "// \n" "// \n" "// \n" - "function getModelsInCatagory()\n" - "{\n" - " %file = \"./Catalog.xml\";\n" - " %fo = new FileObject();\n" - " %text = \"\";\n\n" - " if(%fo.openForRead(%file))\n" - " {\n" - " while(!%fo.isEOF())\n" - " {\n" - " %text = %text @ %fo.readLine();\n" - " if (!%fo.isEOF()) %text = %text @ \"\\n\";\n" - " }\n" - " }\n" - " else\n" - " {\n" - " echo(\"Unable to locate the file: \" @ %file);\n" - " }\n\n" - " %fo.delete();\n\n" - " %xml = new SimXMLDocument() {};\n" - " %xml.parse(%text);\n" - " // \"Get\" inside of the root element, \"Models\".\n" - " %xml.pushChildElement(0);\n\n" - " // \"Get\" into the first child element\n" - " if (%xml.pushFirstChildElement(\"Model\"))\n" - " {\n" - " while (true)\n" - " {\n" - " // \n" - " // Here, i read the element's attributes.\n" - " // You might want to save these values in an array or call the %xml.getElementValue()\n" - " // if you have a different XML structure.\n\n" - " %catagory = %xml.attribute(\"catagory\");\n" - " %name = %xml.attribute(\"name\");\n" - " %path = %xml.attribute(\"path\");\n\n" - " // now, read the next \"Model\"\n" - " if (!%xml.nextSiblingElement(\"Model\")) break;\n" - " }\n" - " }\n" - "}\n" + "function getModelsInCatagory()\n" + "{\n" + " %file = \"./Catalog.xml\";\n" + " %fo = new FileObject();\n" + " %text = \"\";\n\n" + " if(%fo.openForRead(%file))\n" + " {\n" + " while(!%fo.isEOF())\n" + " {\n" + " %text = %text @ %fo.readLine();\n" + " if (!%fo.isEOF()) %text = %text @ \"\\n\";\n" + " }\n" + " }\n" + " else\n" + " {\n" + " echo(\"Unable to locate the file: \" @ %file);\n" + " }\n\n" + " %fo.delete();\n\n" + " %xml = new SimXMLDocument() {};\n" + " %xml.parse(%text);\n" + " // \"Get\" inside of the root element, \"Models\".\n" + " %xml.pushChildElement(0);\n\n" + " // \"Get\" into the first child element\n" + " if (%xml.pushFirstChildElement(\"Model\"))\n" + " {\n" + " while (true)\n" + " {\n" + " // \n" + " // Here, i read the element's attributes.\n" + " // You might want to save these values in an array or call the %xml.getElementValue()\n" + " // if you have a different XML structure.\n\n" + " %catagory = %xml.attribute(\"catagory\");\n" + " %name = %xml.attribute(\"name\");\n" + " %path = %xml.attribute(\"path\");\n\n" + " // now, read the next \"Model\"\n" + " if (!%xml.nextSiblingElement(\"Model\")) break;\n" + " }\n" + " }\n" + "}\n" "@endtsexample\n\n" "@note SimXMLDocument is a wrapper around TinyXml, a standard XML library. If you're familiar " diff --git a/Engine/source/console/SimXMLDocument.h b/Engine/source/console/SimXMLDocument.h index 3f6e2661c..342917cff 100644 --- a/Engine/source/console/SimXMLDocument.h +++ b/Engine/source/console/SimXMLDocument.h @@ -45,7 +45,7 @@ class SimXMLDocument: public SimObject { // This typedef is required for tie ins with the script language. // -------------------------------------------------------------------------- - protected: + protected: typedef SimObject Parent; // -------------------------------------------------------------------------- @@ -85,8 +85,8 @@ class SimXMLDocument: public SimObject bool nextSiblingElement(const char* rName); // push child element at index onto stack. bool pushChildElement(S32 index); - // Get element value - const char* elementValue(); + // Get element value + const char* elementValue(); // Pop last element off of stack. void popElement(void); @@ -94,16 +94,16 @@ class SimXMLDocument: public SimObject // Get attribute from top element on element stack. const char* attribute(const char* rAttribute); - // Does the attribute exist in the current element + // Does the attribute exist in the current element bool attributeExists(const char* rAttribute); - // Obtain the name of the current element's first or last attribute - const char* firstAttribute(); - const char* lastAttribute(); + // Obtain the name of the current element's first or last attribute + const char* firstAttribute(); + const char* lastAttribute(); - // Move through the current element's attributes to obtain their names - const char* nextAttribute(); - const char* prevAttribute(); + // Move through the current element's attributes to obtain their names + const char* nextAttribute(); + const char* prevAttribute(); // Set attribute of top element on element stack. void setAttribute(const char* rAttribute, const char* rVal); @@ -139,8 +139,8 @@ class SimXMLDocument: public SimObject TiXmlDocument* m_qDocument; // Stack of nodes. Vector m_paNode; - // The current attribute - TiXmlAttribute* m_CurrentAttribute; + // The current attribute + TiXmlAttribute* m_CurrentAttribute; public: DECLARE_CONOBJECT(SimXMLDocument); diff --git a/Engine/source/console/arrayObject.h b/Engine/source/console/arrayObject.h index caab6dbd5..81531b6c2 100644 --- a/Engine/source/console/arrayObject.h +++ b/Engine/source/console/arrayObject.h @@ -102,7 +102,7 @@ public: /// Returns the value for a given index. /// Will return a null value for an invalid index - const String& getValueFromIndex( S32 index ) const; + const String& getValueFromIndex( S32 index ) const; /// S32 getIndexFromKeyValue( const String &key, const String &value ) const; diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 064394aaa..39fe8d3c3 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -11,78 +11,78 @@ #define yychar CMDchar #define yydebug CMDdebug #define yynerrs CMDnerrs -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 #line 1 "cmdgram.y" @@ -182,9 +182,9 @@ typedef -#define YYFINAL 388 -#define YYFLAG -32768 -#define YYNTBASE 100 +#define YYFINAL 388 +#define YYFLAG -32768 +#define YYNTBASE 100 #define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140) @@ -502,7 +502,7 @@ static const short yypgoto[] = {-32768, }; -#define YYLAST 3042 +#define YYLAST 3042 static const short yytable[] = { 47, @@ -1183,50 +1183,50 @@ void *alloca (); It is replaced by the list of actions, each action as one case of the switch. */ -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 #ifndef YYPURE -#define YYLEX yylex() +#define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval, &yylloc) +#define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +#define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif @@ -1235,27 +1235,27 @@ while (0) #ifndef YYPURE -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ #ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #endif -int yynerrs; /* number of parse errors so far */ +int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ +int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif @@ -1275,9 +1275,9 @@ int yydebug; /* nonzero means print parse trace */ int yyparse (void); #endif -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities @@ -1337,17 +1337,17 @@ yyparse(YYPARSE_PARAM) int yyn; short *yyssp; YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; @@ -1367,9 +1367,9 @@ yyparse(YYPARSE_PARAM) #endif #endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ int yylen; @@ -1381,7 +1381,7 @@ yyparse(YYPARSE_PARAM) yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack @@ -1416,20 +1416,20 @@ yynewstate: #ifdef yyoverflow /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ + the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ + but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); #else yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; @@ -1439,13 +1439,13 @@ yynewstate: #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } + { + yyerror("parser stack overflow"); + return 2; + } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); @@ -1464,11 +1464,11 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); + fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) - YYABORT; + YYABORT; } #if YYDEBUG != 0 @@ -1498,21 +1498,21 @@ yynewstate: { #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Reading a token: "); + fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ - if (yychar <= 0) /* This means end of input. */ + if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ + yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Now at end of input.\n"); + fprintf(stderr, "Now at end of input.\n"); #endif } else @@ -1521,15 +1521,15 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ #ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); + YYPRINT (stderr, yychar, yylval); #endif - fprintf (stderr, ")\n"); - } + fprintf (stderr, ")\n"); + } #endif } @@ -1549,7 +1549,7 @@ yynewstate: if (yyn < 0) { if (yyn == YYFLAG) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1600,11 +1600,11 @@ yyreduce: int i; fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif @@ -2265,7 +2265,7 @@ case 162: short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif @@ -2315,44 +2315,44 @@ yyerrlab: /* here on detecting error */ yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; + { + int size = 0; + char *msg; + int x, count; - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror("parse error"); } goto yyerrlab1; @@ -2364,11 +2364,11 @@ yyerrlab1: /* here on error raised explicitly by an action */ /* return failure if at end of input */ if (yychar == YYEOF) - YYABORT; + YYABORT; #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; @@ -2377,7 +2377,7 @@ yyerrlab1: /* here on error raised explicitly by an action */ /* Else will try to reuse lookahead token after shifting the error token. */ - yyerrstatus = 3; /* Each real token shifted decrements this */ + yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; @@ -2405,7 +2405,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */ short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif @@ -2424,7 +2424,7 @@ yyerrhandle: if (yyn < 0) { if (yyn == YYFLAG) - goto yyerrpop; + goto yyerrpop; yyn = -yyn; goto yyreduce; } diff --git a/Engine/source/console/cmdgram.h b/Engine/source/console/cmdgram.h index 83736a565..fc22f3df2 100644 --- a/Engine/source/console/cmdgram.h +++ b/Engine/source/console/cmdgram.h @@ -15,78 +15,78 @@ typedef union { AssignDecl asn; IfStmtNode* ifnode; } YYSTYPE; -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 extern YYSTYPE CMDlval; diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 1559f41d8..904558bef 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -455,8 +455,8 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso) { - AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); + // This will return true, but return value is ignored char *script; chompUTF8BOM( inScript, &script ); @@ -572,8 +572,8 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame) { - AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); + // Check for a UTF8 script file char *string; chompUTF8BOM( inString, &string ); diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index d61a8f353..f189d6268 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -242,7 +242,7 @@ inline void ExprEvalState::setCurVarName(StringTableEntry name) else if( getStackDepth() > 0 ) currentVariable = getCurrentFrame().lookup(name); if(!currentVariable && gWarnUndefinedScriptVariables) - Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); + Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); } inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) @@ -316,7 +316,7 @@ inline void ExprEvalState::setCopyVariable() default: currentVariable->setStringValue(copyVariable->getStringValue()); break; - } + } } } @@ -398,7 +398,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const // Ensure that the variable has a value if (!prevVal) - return; + return; static const StringTableEntry xyzw[] = { @@ -419,7 +419,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const // Insert the value into the specified // component of the string. if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); + dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); else if ( subField == xyzw[1] || subField == rgba[1] ) dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") ); @@ -1020,7 +1020,7 @@ breakContinue: dataBlock->deleteObject(); currentNewObject = NULL; ip = failJump; - + // Prevent stack value corruption CSTK.popFrame(); STR.popFrame(); @@ -1164,8 +1164,8 @@ breakContinue: // This fixes a bug when not explicitly returning a value. case OP_RETURN_VOID: - STR.setStringValue(""); - // We're falling thru here on purpose. + STR.setStringValue(""); + // We're falling thru here on purpose. case OP_RETURN: retValue = STR.getStringValuePtr(); @@ -1437,7 +1437,7 @@ breakContinue: case OP_SAVEVAR_STR: gEvalState.setStringVariable(STR.getStringValue()); break; - + case OP_SAVEVAR_VAR: // this basically handles %var1 = %var2 gEvalState.setCopyVariable(); diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index d6e8908b4..2a070814b 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -278,8 +278,8 @@ bool useTimestamp = false; ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console."); DefineConsoleFunction( cls, void, (), , "()" - "@brief Clears the console output.\n\n" - "@ingroup Console") + "@brief Clears the console output.\n\n" + "@ingroup Console") { if(consoleLogLocked) return; @@ -288,17 +288,17 @@ DefineConsoleFunction( cls, void, (), , "()" }; DefineConsoleFunction( getClipboard, const char*, (), , "()" - "@brief Get text from the clipboard.\n\n" - "@internal") + "@brief Get text from the clipboard.\n\n" + "@internal") { - return Platform::getClipboard(); + return Platform::getClipboard(); }; DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)" "@brief Set the system clipboard.\n\n" - "@internal") + "@internal") { - return Platform::setClipboard(text); + return Platform::setClipboard(text); }; ConsoleFunctionGroupEnd( Clipboard ); @@ -332,25 +332,25 @@ void init() // Variables setVariable("Con::prompt", "% "); addVariable("Con::logBufferEnabled", TypeBool, &logBufferEnabled, "If true, the log buffer will be enabled.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::printLevel", TypeS32, &printLevel, "@brief This is deprecated.\n\n" "It is no longer in use and does nothing.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::warnUndefinedVariables", TypeBool, &gWarnUndefinedScriptVariables, "If true, a warning will be displayed in the console whenever a undefined variable is used in script.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable( "instantGroup", TypeRealString, &gInstantGroup, "The group that objects will be added to when they are created.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::objectCopyFailures", TypeS32, &gObjectCopyFailures, "If greater than zero then it counts the number of object creation " "failures based on a missing copy object and does not report an error..\n" - "@ingroup Console\n"); + "@ingroup Console\n"); // Current script file name and root addVariable( "Con::File", TypeString, &gCurrentFile, "The currently executing script file.\n" - "@ingroup FileSystem\n"); + "@ingroup FileSystem\n"); addVariable( "Con::Root", TypeString, &gCurrentRoot, "The mod folder for the currently executing script file.\n" - "@ingroup FileSystem\n" ); + "@ingroup FileSystem\n" ); // alwaysUseDebugOutput determines whether to send output to the platform's // "debug" system. see winConsole for an example. @@ -364,14 +364,14 @@ void init() addVariable("Con::alwaysUseDebugOutput", TypeBool, &alwaysUseDebugOutput, "@brief Determines whether to send output to the platform's \"debug\" system.\n\n" "@note This is disabled in shipping builds.\n" - "@ingroup Console"); + "@ingroup Console"); #else alwaysUseDebugOutput = false; #endif // controls whether a timestamp is prepended to every console message addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); // Plug us into the journaled console input signal. smConsoleInput.notify(postConsoleInput); @@ -599,7 +599,7 @@ static void log(const char *string) static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, const char* fmt, va_list argptr) { if (!active) - return; + return; Con::active = false; char buffer[8192]; @@ -781,7 +781,7 @@ Dictionary::Entry *getAddVariableEntry(const char *name) StringTableEntry stName = StringTable->insert(name); Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName); if (!entry) - entry = gEvalState.globalVars.add(stName); + entry = gEvalState.globalVars.add(stName); return entry; } @@ -791,7 +791,7 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name) StringTableEntry stName = StringTable->insert(name); Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName); if (!entry) - entry = gEvalState.getCurrentFrame().add(stName); + entry = gEvalState.getCurrentFrame().add(stName); return entry; } @@ -802,7 +802,7 @@ void setVariable(const char *name, const char *value) if (getVariableObjectField(name, &obj, &objField)) { - obj->setDataField(StringTable->insert(objField), 0, value); + obj->setDataField(StringTable->insert(objField), 0, value); } else { @@ -824,13 +824,13 @@ void setBoolVariable(const char *varName, bool value) if (getVariableObjectField(varName, &obj, &objField)) { - obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0"); + obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0"); } else { varName = prependDollar(varName); Dictionary::Entry *entry = getAddVariableEntry(varName); - entry->setStringValue(value ? "1" : "0"); + entry->setStringValue(value ? "1" : "0"); } } @@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char scratchBuffer[32]; + dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); + obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); } else { @@ -860,15 +860,15 @@ void setFloatVariable(const char *varName, F32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char scratchBuffer[32]; + dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); + obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); } else { varName = prependDollar(varName); Dictionary::Entry *entry = getAddVariableEntry(varName); - entry->setFloatValue(value); + entry->setFloatValue(value); } } @@ -1020,7 +1020,7 @@ F32 getFloatVariable(const char *varName, F32 def) else { Dictionary::Entry *entry = getVariableEntry(varName); - return entry ? entry->getFloatValue() : def; + return entry ? entry->getFloatValue() : def; } } @@ -1308,8 +1308,8 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript) // Let's do a sanity check to complain about DSOs in the future. // - // MM: This doesn't seem to be working correctly for now so let's just not issue - // the warning until someone knows how to resolve it. + // MM: This doesn't seem to be working correctly for now so let's just not issue + // the warning until someone knows how to resolve it. // //if(compiled && rCom && rScr && Platform::compareFileTimes(comModifyTime, scrModifyTime) < 0) //{ @@ -1515,7 +1515,7 @@ ConsoleValueRef execute(S32 argc, ConsoleValueRef argv[]) #endif ConsoleStackFrameSaver stackSaver; stackSaver.save(); - return _internalExecute(argc, argv); + return _internalExecute(argc, argv); #ifdef TORQUE_MULTITHREAD } else @@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue() U32 stringLen = dStrlen(internalValue); U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line - + if (bufferLen == 0) sval = (char *) dMalloc(newLen); else if(newLen > bufferLen) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index e863c60f1..f2d56c843 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -95,8 +95,8 @@ struct ConsoleLogEntry Script, GUI, Network, - GGConnect, - NUM_TYPE + GGConnect, + NUM_TYPE } mType; /// Indicates the actual log entry. @@ -897,28 +897,28 @@ template struct _EngineConsoleExecCallbackHelper; namespace Con { - /// @name Console Execution - executef - /// { - /// - /// Implements a script function thunk which automatically converts parameters to relevant console types. - /// Can be used as follows: - /// - Con::executef("functionName", ...); - /// - Con::executef(mySimObject, "functionName", ...); - /// - /// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to - /// convert a parameter which EngineMarshallType does not have a specialization for. - /// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h" - /// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required. - /// - /// @see _EngineConsoleExecCallbackHelper - /// - template - ConsoleValueRef executef(R r, ArgTs ...argTs) - { - _EngineConsoleExecCallbackHelper callback( r ); - return callback.template call(argTs...); - } - /// } + /// @name Console Execution - executef + /// { + /// + /// Implements a script function thunk which automatically converts parameters to relevant console types. + /// Can be used as follows: + /// - Con::executef("functionName", ...); + /// - Con::executef(mySimObject, "functionName", ...); + /// + /// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to + /// convert a parameter which EngineMarshallType does not have a specialization for. + /// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h" + /// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required. + /// + /// @see _EngineConsoleExecCallbackHelper + /// + template + ConsoleValueRef executef(R r, ArgTs ...argTs) + { + _EngineConsoleExecCallbackHelper callback( r ); + return callback.template call(argTs...); + } + /// } }; extern void expandEscape(char *dest, const char *src); @@ -1143,19 +1143,19 @@ class ConsoleStackFrameSaver { public: - bool mSaved; + bool mSaved; - ConsoleStackFrameSaver() : mSaved(false) - { - } + ConsoleStackFrameSaver() : mSaved(false) + { + } - ~ConsoleStackFrameSaver() - { - restore(); - } + ~ConsoleStackFrameSaver() + { + restore(); + } - void save(); - void restore(); + void save(); + void restore(); }; diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index 41c5e8027..b442841a4 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -45,7 +45,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi "@brief Dumps all declared console classes to the console.\n\n" "@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n" "@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n" - "@ingroup Logging") + "@ingroup Logging") { Namespace::dumpClasses( dumpScript, dumpEngine ); } @@ -54,7 +54,7 @@ DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEn "@brief Dumps all declared console functions to the console.\n" "@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n" "@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n" - "@ingroup Logging") + "@ingroup Logging") { Namespace::dumpFunctions( dumpScript, dumpEngine ); } diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 7f8fbf1c0..1cf0335c0 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -463,12 +463,12 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle, U32 sublen = dStrlen( needle ); U32 strlen = dStrlen( haystack ); S32 start = strlen - offset; - + if(start < 0 || start > strlen) return -1; if (start + sublen > strlen) - start = strlen - sublen; + start = strlen - sublen; for(; start >= 0; start--) if(!dStrncmp(haystack + start, needle, sublen)) return start; @@ -1022,15 +1022,15 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 //---------------------------------------------------------------- DefineConsoleFunction(ColorFloatToInt, ColorI, (ColorF color), , - "Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n" - "@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" - "@return Converted color value (0 - 255)\n\n" - "@tsexample\n" - "ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n" - "@endtsexample\n" - "@ingroup Strings") + "Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n" + "@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" + "@return Converted color value (0 - 255)\n\n" + "@tsexample\n" + "ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n" + "@endtsexample\n" + "@ingroup Strings") { - return (ColorI)color; + return (ColorI)color; } DefineConsoleFunction(ColorIntToFloat, ColorF, (ColorI color), , @@ -1201,8 +1201,8 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),, ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]" "Adds case sensitive strings to the StringTable.") { - for(int i = 1; i < argc; i++) - StringTable->insert(argv[i], true); + for(int i = 1; i < argc; i++) + StringTable->insert(argv[i], true); } //============================================================================= @@ -1645,7 +1645,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t "@endtsexample\n\n" "@ingroup Strings" ) { - char buffer[4096]; + char buffer[4096]; dStrncpy(buffer, str1, 4096); char *str = buffer; @@ -1812,7 +1812,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),, "{\n" " onChatMessage(detag(%msgString), %voice, %pitch);\n" "}\n" - "@endtsexample\n\n" + "@endtsexample\n\n" "@see \\ref syntaxDataTypes under Tagged %Strings\n" "@see getTag()\n" @@ -2017,8 +2017,8 @@ DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),, //----------------------------------------------------------------------------- DefineEngineFunction( setLogMode, void, ( S32 mode ),, - "@brief Determines how log files are written.\n\n" - "Sets the operational mode of the console logging system.\n\n" + "@brief Determines how log files are written.\n\n" + "Sets the operational mode of the console logging system.\n\n" "@param mode Parameter specifying the logging mode. This can be:\n" "- 1: Open and close the console log file for each seperate string of output. This will ensure that all " "parts get written out to disk and that no parts remain in intermediate buffers even if the process crashes.\n" @@ -2030,8 +2030,8 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),, "combined by binary OR with 0x4 to cause the logging system to flush all console log messages that had already been " "issued to the console system into the newly created log file.\n\n" - "@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead." - "@ingroup Logging" ) + "@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead." + "@ingroup Logging" ) { Con::setLogMode( mode ); } @@ -2144,7 +2144,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),, DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/splash.bmp"), "Display a startup splash window suitable for showing while the engine still starts up.\n\n" "@note This is currently only implemented on Windows.\n\n" - "@param path relative path to splash screen image to display.\n" + "@param path relative path to splash screen image to display.\n" "@return True if the splash window could be successfully initialized.\n\n" "@ingroup Platform" ) { @@ -2390,19 +2390,19 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val } DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)" - "@brief Determines if a function exists or not\n\n" - "@param funcName String containing name of the function\n" - "@return True if the function exists, false if not\n" - "@ingroup Scripting") + "@brief Determines if a function exists or not\n\n" + "@param funcName String containing name of the function\n" + "@return True if the function exists, false if not\n" + "@ingroup Scripting") { return Con::isFunction(funcName); } DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)" - "@brief Provides the name of the package the function belongs to\n\n" - "@param funcName String containing name of the function\n" - "@return The name of the function's package\n" - "@ingroup Packages") + "@brief Provides the name of the package the function belongs to\n\n" + "@param funcName String containing name of the function\n" + "@return The name of the function's package\n" + "@ingroup Packages") { Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) ); if( !nse ) @@ -2412,11 +2412,11 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ) } DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" - "@brief Determines if a class/namespace method exists\n\n" - "@param namespace Class or namespace, such as Player\n" - "@param method Name of the function to search for\n" - "@return True if the method exists, false if not\n" - "@ingroup Scripting\n") + "@brief Determines if a class/namespace method exists\n\n" + "@param namespace Class or namespace, such as Player\n" + "@param method Name of the function to search for\n" + "@return True if the method exists, false if not\n" + "@ingroup Scripting\n") { Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) ); Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) ); @@ -2427,11 +2427,11 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth } DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" - "@brief Provides the name of the package the method belongs to\n\n" - "@param namespace Class or namespace, such as Player\n" - "@param method Name of the funciton to search for\n" - "@return The name of the method's package\n" - "@ingroup Packages") + "@brief Provides the name of the package the method belongs to\n\n" + "@param namespace Class or namespace, such as Player\n" + "@param method Name of the funciton to search for\n" + "@return The name of the method's package\n" + "@ingroup Packages") { Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) ); if( !ns ) @@ -2445,13 +2445,13 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c } DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)" - "@brief Determines if a variable exists and contains a value\n" - "@param varName Name of the variable to search for\n" - "@return True if the variable was defined in script, false if not\n" + "@brief Determines if a variable exists and contains a value\n" + "@param varName Name of the variable to search for\n" + "@return True if the variable was defined in script, false if not\n" "@tsexample\n" "isDefined( \"$myVar\" );\n" "@endtsexample\n\n" - "@ingroup Scripting") + "@ingroup Scripting") { if(String::isEmpty(varName)) { @@ -2590,10 +2590,10 @@ DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()" } DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)" - "@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n" - "@param File path of mod folder\n" - "@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n" - "@internal") + "@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n" + "@param File path of mod folder\n" + "@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n" + "@internal") { StringTableEntry modPath = Con::getModNameFromPath(path); return modPath ? modPath : ""; @@ -2602,11 +2602,11 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , //----------------------------------------------------------------------------- DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])" - "@brief Pushes the current $instantGroup on a stack " - "and sets it to the given value (or clears it).\n\n" - "@note Currently only used for editors\n" - "@ingroup Editors\n" - "@internal") + "@brief Pushes the current $instantGroup on a stack " + "and sets it to the given value (or clears it).\n\n" + "@note Currently only used for editors\n" + "@ingroup Editors\n" + "@internal") { if( group.size() > 0 ) Con::pushInstantGroup( group ); @@ -2615,10 +2615,10 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group] } DefineConsoleFunction( popInstantGroup, void, (), , "()" - "@brief Pop and restore the last setting of $instantGroup off the stack.\n\n" - "@note Currently only used for editors\n\n" - "@ingroup Editors\n" - "@internal") + "@brief Pop and restore the last setting of $instantGroup off the stack.\n\n" + "@note Currently only used for editors\n\n" + "@ingroup Editors\n" + "@internal") { Con::popInstantGroup(); } @@ -2626,8 +2626,8 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()" //----------------------------------------------------------------------------- DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])" - "@note Appears to be useless in Torque 3D, should be deprecated\n" - "@internal") + "@note Appears to be useless in Torque 3D, should be deprecated\n" + "@internal") { const char *filename = Platform::getPrefsPath(relativeFileName); if(filename == NULL || *filename == 0) @@ -2639,13 +2639,13 @@ DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileNam //----------------------------------------------------------------------------- ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )" - "@brief Manually execute a special script file that contains game or editor preferences\n\n" - "@param relativeFileName Name and path to file from project folder\n" - "@param noCalls Deprecated\n" - "@param journalScript Deprecated\n" - "@return True if script was successfully executed\n" - "@note Appears to be useless in Torque 3D, should be deprecated\n" - "@ingroup Scripting") + "@brief Manually execute a special script file that contains game or editor preferences\n\n" + "@param relativeFileName Name and path to file from project folder\n" + "@param noCalls Deprecated\n" + "@param journalScript Deprecated\n" + "@return True if script was successfully executed\n" + "@note Appears to be useless in Torque 3D, should be deprecated\n" + "@ingroup Scripting") { const char *filename = Platform::getPrefsPath(argv[1]); if(filename == NULL || *filename == 0) @@ -2786,8 +2786,8 @@ DefineEngineFunction( isToolBuild, bool, (),, } DefineEngineFunction( getMaxDynamicVerts, S32, (),, - "Get max number of allowable dynamic vertices in a single vertex buffer.\n\n" - "@return the max number of allowable dynamic vertices in a single vertex buffer" ) + "Get max number of allowable dynamic vertices in a single vertex buffer.\n\n" + "@return the max number of allowable dynamic vertices in a single vertex buffer" ) { return MAX_DYNAMIC_VERTS / 2; } diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index c562b85c0..c9016e8dc 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -510,7 +510,7 @@ void ConsoleValue::setStringValue(const char * value) return; } */ - if (value == typeValueEmpty) + if (value == typeValueEmpty) { if (bufferLen > 0) { @@ -544,7 +544,7 @@ void ConsoleValue::setStringValue(const char * value) // may as well pad to the next cache line U32 newLen = ((stringLen + 1) + 15) & ~15; - + if(bufferLen == 0) sval = (char *) dMalloc(newLen); else if(newLen > bufferLen) @@ -573,7 +573,7 @@ void ConsoleValue::setStackStringValue(const char *value) bufferLen = 0; } - if (value == typeValueEmpty) + if (value == typeValueEmpty) { sval = typeValueEmpty; fval = 0.f; @@ -607,7 +607,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) if(type <= ConsoleValue::TypeInternalString) { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); - if (bufferLen > 0) + if (bufferLen > 0) { dFree(sval); bufferLen = 0; @@ -1418,14 +1418,14 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE case StringCallbackType: return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv))); case IntCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case FloatCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case VoidCallbackType: cb.mVoidCallbackFunc(state->thisObject, argc, argv); return ConsoleValueRef(); case BoolCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); } return ConsoleValueRef(); diff --git a/Engine/source/console/consoleLogger.cpp b/Engine/source/console/consoleLogger.cpp index cc0e2afaf..84347a332 100644 --- a/Engine/source/console/consoleLogger.cpp +++ b/Engine/source/console/consoleLogger.cpp @@ -226,20 +226,20 @@ void ConsoleLogger::log( const char *consoleLine ) //----------------------------------------------------------------------------- DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file" - "@tsexample\n" - "// Create the logger\n" - "// Will automatically start writing to testLogging.txt with normal priority\n" - "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" - "// Send something to the console, with the logger consumes and writes to file\n" - "echo(\"This is logged to the file\");\n\n" - "// Stop logging, but do not delete the logger\n" - "logger.detach();\n\n" - "echo(\"This is not logged to the file\");\n\n" - "// Attach the logger to the console again\n" - "logger.attach();\n\n" - "// Logging has resumed\n" - "echo(\"Logging has resumed\");" - "@endtsexample\n\n") + "@tsexample\n" + "// Create the logger\n" + "// Will automatically start writing to testLogging.txt with normal priority\n" + "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" + "// Send something to the console, with the logger consumes and writes to file\n" + "echo(\"This is logged to the file\");\n\n" + "// Stop logging, but do not delete the logger\n" + "logger.detach();\n\n" + "echo(\"This is not logged to the file\");\n\n" + "// Attach the logger to the console again\n" + "logger.attach();\n\n" + "// Logging has resumed\n" + "echo(\"Logging has resumed\");" + "@endtsexample\n\n") { ConsoleLogger *logger = static_cast( object ); return logger->attach(); @@ -248,20 +248,20 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger //----------------------------------------------------------------------------- DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file" - "@tsexample\n" - "// Create the logger\n" - "// Will automatically start writing to testLogging.txt with normal priority\n" - "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" - "// Send something to the console, with the logger consumes and writes to file\n" - "echo(\"This is logged to the file\");\n\n" - "// Stop logging, but do not delete the logger\n" - "logger.detach();\n\n" - "echo(\"This is not logged to the file\");\n\n" - "// Attach the logger to the console again\n" - "logger.attach();\n\n" - "// Logging has resumed\n" - "echo(\"Logging has resumed\");" - "@endtsexample\n\n") + "@tsexample\n" + "// Create the logger\n" + "// Will automatically start writing to testLogging.txt with normal priority\n" + "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" + "// Send something to the console, with the logger consumes and writes to file\n" + "echo(\"This is logged to the file\");\n\n" + "// Stop logging, but do not delete the logger\n" + "logger.detach();\n\n" + "echo(\"This is not logged to the file\");\n\n" + "// Attach the logger to the console again\n" + "logger.attach();\n\n" + "// Logging has resumed\n" + "echo(\"Logging has resumed\");" + "@endtsexample\n\n") { ConsoleLogger *logger = static_cast( object ); return logger->detach(); diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 43ffda293..2d9ba2a1e 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -334,15 +334,15 @@ AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *oth static char replacebuf[1024]; static char* suppressSpaces(const char* in_pname) { - U32 i = 0; - char chr; - do - { - chr = in_pname[i]; - replacebuf[i++] = (chr != 32) ? chr : '_'; - } while(chr); + U32 i = 0; + char chr; + do + { + chr = in_pname[i]; + replacebuf[i++] = (chr != 32) ? chr : '_'; + } while(chr); - return replacebuf; + return replacebuf; } void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDocs) @@ -740,8 +740,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu //------------------------------------------------------------------------------ DefineEngineFunction( isClass, bool, ( const char* identifier ),, - "@brief Returns true if the passed identifier is the name of a declared class.\n\n" - "@ingroup Console") + "@brief Returns true if the passed identifier is the name of a declared class.\n\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( identifier ); return rep != NULL; @@ -765,10 +765,10 @@ DefineEngineFunction( isMemberOfClass, bool, ( const char* className, const char } DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* className ),, - "@brief Returns the description string for the named class.\n\n" - "@param className The name of the class.\n" - "@return The class description in string format.\n" - "@ingroup Console") + "@brief Returns the description string for the named class.\n\n" + "@param className The name of the class.\n" + "@return The class description in string format.\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( className ); if( rep ) @@ -779,9 +779,9 @@ DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* classNam } DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className ),, - "@brief Returns the category of the given class.\n\n" - "@param className The name of the class.\n" - "@ingroup Console") + "@brief Returns the category of the given class.\n\n" + "@param className The name of the class.\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( className ); if( rep ) @@ -792,12 +792,12 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className } DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ), - "@brief Returns a list of classes that derive from the named class.\n\n" + "@brief Returns a list of classes that derive from the named class.\n\n" "If the named class is omitted this dumps all the classes.\n" "@param className The optional base class name.\n" - "@return A tab delimited list of classes.\n" + "@return A tab delimited list of classes.\n" "@ingroup Editors\n" - "@internal") + "@internal") { AbstractClassRep *base = NULL; if(className && *className) @@ -822,11 +822,11 @@ DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* classN } DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String category ),, - "@brief Provide a list of classes that belong to the given category.\n\n" - "@param category The category name.\n" - "@return A tab delimited list of classes.\n" - "@ingroup Editors\n" - "@internal") + "@brief Provide a list of classes that belong to the given category.\n\n" + "@param category The category name.\n" + "@return A tab delimited list of classes.\n" + "@ingroup Editors\n" + "@internal") { U32 categoryLength = category.length(); @@ -914,10 +914,10 @@ DefineEngineFunction( dumpNetStats, void, (),, } DefineEngineFunction( sizeof, S32, ( const char *objectOrClass ),, - "@brief Determines the memory consumption of a class or object.\n\n" - "@param objectOrClass The object or class being measured.\n" - "@return Returns the total size of an object in bytes.\n" - "@ingroup Debugging\n") + "@brief Determines the memory consumption of a class or object.\n\n" + "@param objectOrClass The object or class being measured.\n" + "@return Returns the total size of an object in bytes.\n" + "@ingroup Debugging\n") { AbstractClassRep *acr = NULL; SimObject *obj = Sim::findObject(objectOrClass); diff --git a/Engine/source/console/consoleParser.cpp b/Engine/source/console/consoleParser.cpp index 2491ea738..e2dd339f5 100644 --- a/Engine/source/console/consoleParser.cpp +++ b/Engine/source/console/consoleParser.cpp @@ -35,21 +35,21 @@ static ConsoleParser *gDefaultParser = NULL; void freeConsoleParserList(void) { - while(gParserList) - { + while(gParserList) + { ConsoleParser * pParser = gParserList; - gParserList = pParser->next; - delete pParser; - } + gParserList = pParser->next; + delete pParser; + } - gDefaultParser = NULL; + gDefaultParser = NULL; } bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnParse p, fnRestart r, fnSetScanBuffer ssb, bool def) { - AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments"); + AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments"); - ConsoleParser * pParser = new ConsoleParser; + ConsoleParser * pParser = new ConsoleParser; pParser->ext = ext; pParser->getCurrentFile = gcf; @@ -69,23 +69,23 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP ConsoleParser * getParserForFile(const char *filename) { - if(filename == NULL) - return gDefaultParser; + if(filename == NULL) + return gDefaultParser; - char *ptr = dStrrchr((char *)filename, '.'); - if(ptr != NULL) - { - ptr++; + char *ptr = dStrrchr((char *)filename, '.'); + if(ptr != NULL) + { + ptr++; - ConsoleParser *p; - for(p = gParserList; p; p = p->next) - { - if(dStricmp(ptr, p->ext) == 0) - return p; - } - } + ConsoleParser *p; + for(p = gParserList; p; p = p->next) + { + if(dStricmp(ptr, p->ext) == 0) + return p; + } + } - return gDefaultParser; + return gDefaultParser; } } // end namespace Con diff --git a/Engine/source/console/consoleParser.h b/Engine/source/console/consoleParser.h index d033f75f4..ac1badaae 100644 --- a/Engine/source/console/consoleParser.h +++ b/Engine/source/console/consoleParser.h @@ -57,15 +57,15 @@ typedef void (*fnSetScanBuffer)(const char *sb, const char *fn); //----------------------------------------------------------------------------- struct ConsoleParser { - struct ConsoleParser *next; //!< Next object in list or NULL + struct ConsoleParser *next; //!< Next object in list or NULL - char *ext; //!< Filename extension handled by this parser - - fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function - fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function - fnParse parse; //!< Parse lexer function - fnRestart restart; //!< Restart lexer function - fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function + char *ext; //!< Filename extension handled by this parser + + fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function + fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function + fnParse parse; //!< Parse lexer function + fnRestart restart; //!< Restart lexer function + fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function }; // Macros @@ -74,18 +74,18 @@ struct ConsoleParser /// \brief Declare a parser's function prototypes //----------------------------------------------------------------------------- #define CON_DECLARE_PARSER(prefix) \ - const char * prefix##GetCurrentFile(); \ - S32 prefix##GetCurrentLine(); \ - void prefix##SetScanBuffer(const char *sb, const char *fn); \ - S32 prefix##parse(); \ - void prefix##restart(FILE *input_file) + const char * prefix##GetCurrentFile(); \ + S32 prefix##GetCurrentLine(); \ + void prefix##SetScanBuffer(const char *sb, const char *fn); \ + S32 prefix##parse(); \ + void prefix##restart(FILE *input_file) //----------------------------------------------------------------------------- /// \brief Helper macro to add console parsers //----------------------------------------------------------------------------- #define CON_ADD_PARSER(prefix, ext, def) \ - Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \ - prefix##restart, prefix##SetScanBuffer, def) + Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \ + prefix##restart, prefix##SetScanBuffer, def) //----------------------------------------------------------------------------- /// \brief Free the console parser list diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 829893641..79decae13 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -339,14 +339,14 @@ struct EngineUnmarshallData< ConsoleValueRef > template struct _EngineTrampoline { - struct Args {}; + struct Args {}; }; template< typename R, typename ...ArgTs > struct _EngineTrampoline< R( ArgTs ... ) > { - typedef std::tuple Args; - std::tuple argT; + typedef std::tuple Args; + std::tuple argT; }; template< typename T > @@ -363,21 +363,21 @@ template< typename R, typename ...ArgTs > struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) > { private: - using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >; - using ArgsType = typename Super::Args; - - template struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { - return R( fn(std::get(args) ...) ); - } + using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >; + using ArgsType = typename Super::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { + return R( fn(std::get(args) ...) ); + } - using SeqType = typename Gens::type; + using SeqType = typename Gens::type; public: - static R jmp(typename Super::FunctionType fn, const ArgsType& args ) + static R jmp(typename Super::FunctionType fn, const ArgsType& args ) { return dispatchHelper(fn, args, SeqType()); } @@ -394,25 +394,25 @@ struct _EngineMethodTrampoline {}; template< typename Frame, typename R, typename ...ArgTs > struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) > { - using FunctionType = R( typename Frame::ObjectType*, ArgTs ...); + using FunctionType = R( typename Frame::ObjectType*, ArgTs ...); private: - using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >; - using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args; - - template struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static R dispatchHelper(Frame f, const ArgsType& args, Seq) { - return R( f._exec(std::get(args) ...) ); - } - - using SeqType = typename Gens::type; + using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >; + using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static R dispatchHelper(Frame f, const ArgsType& args, Seq) { + return R( f._exec(std::get(args) ...) ); + } + + using SeqType = typename Gens::type; public: static R jmp( typename Frame::ObjectType* object, const ArgsType& args ) { - + Frame f; f.object = object; return dispatchHelper(f, args, SeqType()); @@ -515,13 +515,13 @@ struct _EngineConsoleThunkType< void > struct _EngineConsoleThunkCountArgs { - template U32 operator()(ArgTs... args){ - return sizeof...(ArgTs); - } - - operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros - return 0; - } + template U32 operator()(ArgTs... args){ + return sizeof...(ArgTs); + } + + operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros + return 0; + } }; @@ -529,61 +529,61 @@ struct _EngineConsoleThunkCountArgs // Encapsulation of a legacy console function invocation. namespace engineAPI{ - namespace detail{ - template - struct ThunkHelpers { - using SelfType = ThunkHelpers; - using FunctionType = R(*)(ArgTs...); - template using MethodType = R(Frame::*)(ArgTs ...) const; - template using IthArgType = typename std::tuple_element >::type; - - template struct Seq {}; - template struct Gens : Gens {}; - template struct Gens<0, I...>{ typedef Seq type; }; - - typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; - - template - static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) - { - if((startArgc + index) < argc) - { - return EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ); - } else { - return std::get(defaultArgs.mArgs); - } - } - - template - static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq){ - return fn(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); - } - - template - static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq){ - return (frame->*fn)(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); - } - - using SeqType = typename Gens::type; - }; - - template struct MarshallHelpers { - template static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){} - template static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){ - argv[argc++] = EngineMarshallData(head); - marshallEach(argc, argv, tail...); - } - }; - - template<> struct MarshallHelpers { - template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} - template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){ - EngineMarshallData(head, argc, argv); - marshallEach(argc, argv, tail...); - } - }; - } + namespace detail{ + template + struct ThunkHelpers { + using SelfType = ThunkHelpers; + using FunctionType = R(*)(ArgTs...); + template using MethodType = R(Frame::*)(ArgTs ...) const; + template using IthArgType = typename std::tuple_element >::type; + + template struct Seq {}; + template struct Gens : Gens {}; + template struct Gens<0, I...>{ typedef Seq type; }; + + typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; + static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; + + template + static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) + { + if((startArgc + index) < argc) + { + return EngineUnmarshallData< IthArgType >()( argv[ startArgc + index ] ); + } else { + return std::get(defaultArgs.mArgs); + } + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq){ + return fn(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + template + static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq){ + return (frame->*fn)(SelfType::getRealArgValue(argc, argv, defaultArgs) ...); + } + + using SeqType = typename Gens::type; + }; + + template struct MarshallHelpers { + template static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){} + template static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){ + argv[argc++] = EngineMarshallData(head); + marshallEach(argc, argv, tail...); + } + }; + + template<> struct MarshallHelpers { + template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){} + template static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){ + EngineMarshallData(head, argc, argv); + marshallEach(argc, argv, tail...); + } + }; + } } template< S32 startArgc, typename T > @@ -593,22 +593,22 @@ template< S32 startArgc, typename R, typename ...ArgTs > struct _EngineConsoleThunk< startArgc, R(ArgTs...) > { private: - using Helper = engineAPI::detail::ThunkHelpers; - using SeqType = typename Helper::SeqType; + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; public: - typedef typename Helper::FunctionType FunctionType; - typedef typename Helper::ReturnType ReturnType; - template using MethodType = typename Helper::template MethodType; - static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; - + typedef typename Helper::FunctionType FunctionType; + typedef typename Helper::ReturnType ReturnType; + template using MethodType = typename Helper::template MethodType; + static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) { - return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType())); + return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType())); } template< typename Frame > - static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) + static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) { - return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType())); + return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType())); } }; @@ -616,23 +616,23 @@ public: template struct _EngineConsoleThunk { private: - using Helper = engineAPI::detail::ThunkHelpers; - using SeqType = typename Helper::SeqType; + using Helper = engineAPI::detail::ThunkHelpers; + using SeqType = typename Helper::SeqType; public: - typedef typename Helper::FunctionType FunctionType; - typedef typename Helper::ReturnType ReturnType; - template using MethodType = typename Helper::template MethodType; - static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; - - static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) - { - Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()); - } - template< typename Frame > - static void thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) - { - Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()); - } + typedef typename Helper::FunctionType FunctionType; + typedef typename Helper::ReturnType ReturnType; + template using MethodType = typename Helper::template MethodType; + static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + + static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) + { + Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()); + } + template< typename Frame > + static void thunk( S32 argc, ConsoleValueRef *argv, MethodType fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs) + { + Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()); + } }; @@ -1182,7 +1182,7 @@ public: struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis ) @@ -1191,7 +1191,7 @@ public: mArgc = mInitialArgc = pThis ? 2 : 1 ; mCallbackName = callbackName; } - + template< typename R, typename ...ArgTs > R call(ArgTs ...args) { @@ -1200,9 +1200,9 @@ public: ConsoleStackFrameSaver sav; sav.save(); CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - Helper::marshallEach(mArgc, mArgv, args...); - + + Helper::marshallEach(mArgc, mArgv, args...); + return R( EngineUnmarshallData< R >()( _exec() ) ); } else @@ -1211,9 +1211,9 @@ public: SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc + sizeof...(ArgTs), NULL, false, &cb); evt->populateArgs(mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - Helper::marshallEach(mArgc, mArgv, args...); - + + Helper::marshallEach(mArgc, mArgv, args...); + Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); @@ -1227,7 +1227,7 @@ public: template struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleExecCallbackHelper( SimObject* pThis ) @@ -1247,7 +1247,7 @@ public: CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv); mArgv[ 0 ].value->setStackStringValue(simCB); - Helper::marshallEach(mArgc, mArgv, args...); + Helper::marshallEach(mArgc, mArgv, args...); return R( EngineUnmarshallData< R >()( _exec() ) ); } @@ -1257,8 +1257,8 @@ public: SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, true, &cb); evt->populateArgs(mArgv); mArgv[ 0 ].value->setStackStringValue(simCB); - - Helper::marshallEach(mArgc, mArgv, args...); + + Helper::marshallEach(mArgc, mArgv, args...); Sim::postEvent(mThis, evt, Sim::getCurrentTime()); @@ -1271,7 +1271,7 @@ public: template<> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper { private: - using Helper = engineAPI::detail::MarshallHelpers; + using Helper = engineAPI::detail::MarshallHelpers; public: _EngineConsoleExecCallbackHelper( const char *callbackName ) { @@ -1288,9 +1288,9 @@ public: ConsoleStackFrameSaver sav; sav.save(); CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - Helper::marshallEach(mArgc, mArgv, args...); - + + Helper::marshallEach(mArgc, mArgv, args...); + return R( EngineUnmarshallData< R >()( _exec() ) ); } else @@ -1299,8 +1299,8 @@ public: SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, false, &cb); evt->populateArgs(mArgv); mArgv[ 0 ].value->setStackStringValue(mCallbackName); - - Helper::marshallEach(mArgc, mArgv, args...); + + Helper::marshallEach(mArgc, mArgv, args...); Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime()); return R( EngineUnmarshallData< R >()( cb.waitForResult() ) ); diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 4346b39cf..08249ec16 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -93,35 +93,35 @@ struct _EngineFunctionDefaultArguments {}; template struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments { - template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; - std::tuple ...> mArgs; + template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; + std::tuple ...> mArgs; private: - using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; - - template struct Seq {}; - template struct Gens : Gens {}; - - template struct Gens<0, I...>{ typedef Seq type; }; - - template - static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { - constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); - std::tie(std::get(args)...) = defaultArgs; - } - - template using MaybeSelfEnabled = typename std::enable_if::type; - - template static MaybeSelfEnabled tailInit(TailTs ...tail) { - std::tuple...> argsT; - std::tuple...> tailT = std::make_tuple(tail...); - SelfType::copyHelper(argsT, tailT, typename Gens::type()); - return argsT; - }; - + using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; + + template struct Seq {}; + template struct Gens : Gens {}; + + template struct Gens<0, I...>{ typedef Seq type; }; + + template + static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { + constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); + std::tie(std::get(args)...) = defaultArgs; + } + + template using MaybeSelfEnabled = typename std::enable_if::type; + + template static MaybeSelfEnabled tailInit(TailTs ...tail) { + std::tuple...> argsT; + std::tuple...> tailT = std::make_tuple(tail...); + SelfType::copyHelper(argsT, tailT, typename Gens::type()); + return argsT; + }; + public: - template _EngineFunctionDefaultArguments(TailTs ...tail) - : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) - {} + template _EngineFunctionDefaultArguments(TailTs ...tail) + : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) + {} }; #pragma pack( pop ) diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index d0eaf541c..484178dec 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -109,15 +109,15 @@ void FieldBrushObject::destroyFields() static char replacebuf[1024]; static char* suppressSpaces(const char* in_pname) { - U32 i = 0; - char chr; - do - { - chr = in_pname[i]; - replacebuf[i++] = (chr != 32) ? chr : '_'; - } while(chr); + U32 i = 0; + char chr; + do + { + chr = in_pname[i]; + replacebuf[i++] = (chr != 32) ? chr : '_'; + } while(chr); - return replacebuf; + return replacebuf; } //----------------------------------------------------------------------------- @@ -125,7 +125,7 @@ static char* suppressSpaces(const char* in_pname) //----------------------------------------------------------------------------- DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n" "@param simObject Object to query static-field groups on.\n" - "@return Space-seperated static-field group list.") + "@return Space-seperated static-field group list.") { // Fetch selected object. SimObject* pSimObject = dynamic_cast( Sim::findObject( simObjName ) ); @@ -194,7 +194,7 @@ DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* sim DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n" "@param simObject Object to query static-fields on.\n" "@param groupList groups to filter static-fields against.\n" - "@return Space-seperated static-field list.") + "@return Space-seperated static-field list.") { // Fetch selected object. SimObject* pSimObject = dynamic_cast( Sim::findObject( simObjName ) ); @@ -369,7 +369,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim DefineConsoleMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n" "@param simObject Object to copy static-fields from.\n" "@param fieldList fields to filter static-fields against.\n" - "@return No return value.") + "@return No return value.") { // Fetch selected object. SimObject* pSimObject = dynamic_cast( Sim::findObject( simObjName ) ); @@ -502,7 +502,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList //----------------------------------------------------------------------------- DefineConsoleMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n" "@param simObject Object to paste static-fields to.\n" - "@return No return value.") + "@return No return value.") { // Fetch selected object. SimObject* pSimObject = dynamic_cast( Sim::findObject( simObjName ) ); diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index d5ee048ca..d8531ff7c 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -210,7 +210,7 @@ DefineEngineFunction( findNextFile, String, ( const char* pattern ), ( "" ), //----------------------------------------------------------------------------- DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ), ( "", true ), - "@brief Returns the number of files in the directory tree that match the given patterns\n\n" + "@brief Returns the number of files in the directory tree that match the given patterns\n\n" "This function differs from getFileCountMultiExpr() in that it supports a single search " "pattern being passed in.\n\n" @@ -246,7 +246,7 @@ DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ), //----------------------------------------------------------------------------- DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool recurse ), ( "", true), - "@brief Returns the first file in the directory system matching the given patterns.\n\n" + "@brief Returns the first file in the directory system matching the given patterns.\n\n" "Use the corresponding findNextFileMultiExpr() to step through " "the results. If you're only interested in the number of files returned by the " @@ -259,10 +259,10 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool "call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders " "a previous search invalid.\n\n" - "@param pattern The path and file name pattern to match against, such as *.cs. Separate " + "@param pattern The path and file name pattern to match against, such as *.cs. Separate " "multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n" - "@param recurse If true, the search will exhaustively recurse into subdirectories " - "of the given path and match the given filename patterns.\n" + "@param recurse If true, the search will exhaustively recurse into subdirectories " + "of the given path and match the given filename patterns.\n" "@return String of the first matching file path, or an empty string if no matching " "files were found.\n\n" @@ -280,7 +280,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool "@see findNextFileMultiExpr()" "@see getFileCountMultiExpr()" "@see findFirstFile()" - "@ingroup FileSearches") + "@ingroup FileSearches") { S32 numResults = buildFileList(pattern, recurse, true); @@ -302,7 +302,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""), "@brief Returns the next file matching a search begun in findFirstFileMultiExpr().\n\n" - "@param pattern The path and file name pattern to match against. This is optional " + "@param pattern The path and file name pattern to match against. This is optional " "and may be left out as it is not used by the code. It is here for legacy reasons.\n" "@return String of the next matching file path, or an empty string if no matching " "files were found.\n\n" @@ -319,7 +319,7 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), ("" "@endtsexample\n\n" "@see findFirstFileMultiExpr()" - "@ingroup FileSearches") + "@ingroup FileSearches") { if ( sgFindFilesPos + 1 > sgFindFilesResults.size() ) return String(); @@ -328,16 +328,16 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), ("" } DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool recurse ), ( "", true), - "@brief Returns the number of files in the directory tree that match the given patterns\n\n" + "@brief Returns the number of files in the directory tree that match the given patterns\n\n" "If you're interested in a list of files that match the given patterns and not just " "the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\n\n" - "@param pattern The path and file name pattern to match against, such as *.cs. Separate " + "@param pattern The path and file name pattern to match against, such as *.cs. Separate " "multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n" - "@param recurse If true, the search will exhaustively recurse into subdirectories " - "of the given path and match the given filename pattern.\n" - "@return Number of files located using the patterns\n\n" + "@param recurse If true, the search will exhaustively recurse into subdirectories " + "of the given path and match the given filename pattern.\n" + "@return Number of files located using the patterns\n\n" "@tsexample\n" "// Count all DTS or Collada models\n" @@ -347,7 +347,7 @@ DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool rec "@see findFirstFileMultiExpr()" "@see findNextFileMultiExpr()" - "@ingroup FileSearches") + "@ingroup FileSearches") { S32 numResults = buildFileList(pattern, recurse, true); @@ -399,14 +399,14 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),, } DefineEngineFunction( IsDirectory, bool, ( const char* directory ),, - "@brief Determines if a specified directory exists or not\n\n" + "@brief Determines if a specified directory exists or not\n\n" - "@param directory String containing path in the form of \"foo/bar\"\n" + "@param directory String containing path in the form of \"foo/bar\"\n" "@return Returns true if the directory was found.\n" - "@note Do not include a trailing slash '/'.\n" + "@note Do not include a trailing slash '/'.\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { String dir(Torque::Path::CleanSeparators(directory)); Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), dir.c_str()); @@ -416,12 +416,12 @@ DefineEngineFunction( IsDirectory, bool, ( const char* directory ),, } DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),, - "@brief Determines if a file name can be written to using File I/O\n\n" + "@brief Determines if a file name can be written to using File I/O\n\n" - "@param fileName Name and path of file to check\n" - "@return Returns true if the file can be written to.\n" + "@param fileName Name and path of file to check\n" + "@return Returns true if the file can be written to.\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { String filename(Torque::Path::CleanSeparators(fileName)); Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), filename.c_str()); @@ -434,32 +434,32 @@ DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),, } DefineEngineFunction(startFileChangeNotifications, void, (),, - "@brief Start watching resources for file changes\n\n" + "@brief Start watching resources for file changes\n\n" "Typically this is called during initializeCore().\n\n" "@see stopFileChangeNotifications()\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { Torque::FS::StartFileChangeNotifications(); } DefineEngineFunction(stopFileChangeNotifications, void, (),, - "@brief Stop watching resources for file changes\n\n" + "@brief Stop watching resources for file changes\n\n" "Typically this is called during shutdownCore().\n\n" "@see startFileChangeNotifications()\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { Torque::FS::StopFileChangeNotifications(); } DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), ( "", 0 ), - "@brief Gathers a list of directories starting at the given path.\n\n" + "@brief Gathers a list of directories starting at the given path.\n\n" - "@param path String containing the path of the directory\n" - "@param depth Depth of search, as in how many subdirectories to parse through\n" - "@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n" + "@param path String containing the path of the directory\n" + "@param depth Depth of search, as in how many subdirectories to parse through\n" + "@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { // Grab the full path. char fullpath[1024]; @@ -508,23 +508,23 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), } DefineEngineFunction(fileSize, S32, ( const char* fileName ),, - "@brief Determines the size of a file on disk\n\n" + "@brief Determines the size of a file on disk\n\n" - "@param fileName Name and path of the file to check\n" - "@return Returns filesize in bytes, or -1 if no file\n" + "@param fileName Name and path of the file to check\n" + "@return Returns filesize in bytes, or -1 if no file\n" - "@ingroup FileSystem") + "@ingroup FileSystem") { Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName); return Platform::getFileSize( sgScriptFilenameBuffer ); } DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),, - "@brief Returns a platform specific formatted string with the last modified time for the file.\n\n" + "@brief Returns a platform specific formatted string with the last modified time for the file.\n\n" - "@param fileName Name and path of file to check\n" - "@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n" - "@ingroup FileSystem") + "@param fileName Name and path of file to check\n" + "@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n" + "@ingroup FileSystem") { Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName); @@ -566,12 +566,12 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),, } DefineEngineFunction(fileDelete, bool, ( const char* path ),, - "@brief Delete a file from the hard drive\n\n" + "@brief Delete a file from the hard drive\n\n" - "@param path Name and path of the file to delete\n" - "@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n" - "@return True if file was successfully deleted\n" - "@ingroup FileSystem") + "@param path Name and path of the file to delete\n" + "@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n" + "@return True if file was successfully deleted\n" + "@ingroup FileSystem") { static char fileName[1024]; static char sandboxFileName[1024]; @@ -586,11 +586,11 @@ DefineEngineFunction(fileDelete, bool, ( const char* path ),, //---------------------------------------------------------------- DefineEngineFunction(fileExt, String, ( const char* fileName ),, - "@brief Get the extension of a file\n\n" + "@brief Get the extension of a file\n\n" - "@param fileName Name and path of file\n" - "@return String containing the extension, such as \".exe\" or \".cs\"\n" - "@ingroup FileSystem") + "@param fileName Name and path of file\n" + "@return String containing the extension, such as \".exe\" or \".cs\"\n" + "@ingroup FileSystem") { const char *ret = dStrrchr(fileName, '.'); if(ret) @@ -626,11 +626,11 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),, } DefineEngineFunction(fileName, String, ( const char* fileName ),, - "@brief Get only the file name of a path and file name string (removes path)\n\n" + "@brief Get only the file name of a path and file name string (removes path)\n\n" - "@param fileName Name and path of file to check\n" - "@return String containing the file name, minus the path\n" - "@ingroup FileSystem") + "@param fileName Name and path of file to check\n" + "@return String containing the file name, minus the path\n" + "@ingroup FileSystem") { S32 pathLen = dStrlen( fileName ); FrameTemp szPathCopy( pathLen + 1); @@ -649,11 +649,11 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),, } DefineEngineFunction(filePath, String, ( const char* fileName ),, - "@brief Get the path of a file (removes name and extension)\n\n" + "@brief Get the path of a file (removes name and extension)\n\n" - "@param fileName Name and path of file to check\n" - "@return String containing the path, minus name and extension\n" - "@ingroup FileSystem") + "@param fileName Name and path of file to check\n" + "@return String containing the path, minus name and extension\n" + "@ingroup FileSystem") { S32 pathLen = dStrlen( fileName ); FrameTemp szPathCopy( pathLen + 1); @@ -672,10 +672,10 @@ DefineEngineFunction(filePath, String, ( const char* fileName ),, } DefineEngineFunction(getWorkingDirectory, String, (),, - "@brief Reports the current directory\n\n" + "@brief Reports the current directory\n\n" - "@return String containing full file path of working directory\n" - "@ingroup FileSystem") + "@return String containing full file path of working directory\n" + "@ingroup FileSystem") { return Platform::getCurrentDirectory(); } @@ -687,13 +687,13 @@ DefineEngineFunction(getWorkingDirectory, String, (),, // are not currently built with TORQUE_TOOLS defined. DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd ), ( "", ""), - "@brief Converts a relative file path to a full path\n\n" + "@brief Converts a relative file path to a full path\n\n" - "For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n" - "@param path Name of file or path to check\n" + "For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n" + "@param path Name of file or path to check\n" "@param cwd Optional current working directory from which to build the full path.\n" - "@return String containing non-relative directory of path\n" - "@ingroup FileSystem") + "@return String containing non-relative directory of path\n" + "@ingroup FileSystem") { static const U32 bufSize = 512; char *buf = Con::getReturnBuffer(bufSize); @@ -702,25 +702,25 @@ DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd ) } DefineEngineFunction(makeRelativePath, String, ( const char* path, const char* to ), ( "", ""), - "@brief Turns a full or local path to a relative one\n\n" + "@brief Turns a full or local path to a relative one\n\n" "For example, \"./game/art\" becomes \"game/art\"\n" "@param path Full path (may include a file) to convert\n" "@param to Optional base path used for the conversion. If not supplied the current " "working directory is used.\n" - "@returns String containing relative path\n" - "@ingroup FileSystem") + "@returns String containing relative path\n" + "@ingroup FileSystem") { return Platform::makeRelativePathName( path, dStrlen(to) > 1 ? to : NULL ); } DefineEngineFunction(pathConcat, String, ( const char* path, const char* file), ( "", ""), - "@brief Combines two separate strings containing a file path and file name together into a single string\n\n" + "@brief Combines two separate strings containing a file path and file name together into a single string\n\n" - "@param path String containing file path\n" - "@param file String containing file name\n" - "@return String containing concatenated file name and path\n" - "@ingroup FileSystem") + "@param path String containing file path\n" + "@param file String containing file name\n" + "@return String containing concatenated file name and path\n" + "@ingroup FileSystem") { static const U32 bufSize = 1024; char *buf = Con::getReturnBuffer(bufSize); @@ -731,10 +731,10 @@ DefineEngineFunction(pathConcat, String, ( const char* path, const char* file), //----------------------------------------------------------------------------- DefineEngineFunction(getExecutableName, String, (),, - "@brief Gets the name of the game's executable\n\n" + "@brief Gets the name of the game's executable\n\n" - "@return String containing this game's executable name\n" - "@ingroup FileSystem") + "@return String containing this game's executable name\n" + "@ingroup FileSystem") { return Platform::getExecutableName(); } diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index 322626801..7db907475 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -34,22 +34,22 @@ IMPLEMENT_CONOBJECT(PersistenceManager); ConsoleDocClass( PersistenceManager, - "@brief this class manages updating SimObjects in the file they were " - "created in non-destructively (mostly aimed at datablocks and materials).\n\n" + "@brief this class manages updating SimObjects in the file they were " + "created in non-destructively (mostly aimed at datablocks and materials).\n\n" - "Basic scripting interface:\n\n" - " - Creation: new PersistenceManager(FooManager);\n" - " - Flag objects as dirty: FooManager.setDirty();\n" - " - Remove objects from dirty list: FooManager.removeDirty();\n" - " - List all currently dirty objects: FooManager.listDirty();\n" - " - Check to see if an object is dirty: FooManager.isDirty();\n" - " - Save dirty objects to their files: FooManager.saveDirty();\n\n" - "@note Dirty objects don't update their files until saveDirty() is " - "called so you can change their properties after you flag them as dirty\n\n" - "@note Currently only used by editors, not intended for actual game development\n\n" - "@ingroup Console\n" - "@ingroup Editors\n" - "@internal"); + "Basic scripting interface:\n\n" + " - Creation: new PersistenceManager(FooManager);\n" + " - Flag objects as dirty: FooManager.setDirty();\n" + " - Remove objects from dirty list: FooManager.removeDirty();\n" + " - List all currently dirty objects: FooManager.listDirty();\n" + " - Check to see if an object is dirty: FooManager.isDirty();\n" + " - Save dirty objects to their files: FooManager.saveDirty();\n\n" + "@note Dirty objects don't update their files until saveDirty() is " + "called so you can change their properties after you flag them as dirty\n\n" + "@note Currently only used by editors, not intended for actual game development\n\n" + "@ingroup Console\n" + "@ingroup Editors\n" + "@internal"); PersistenceManager::PersistenceManager() { @@ -890,7 +890,7 @@ PersistenceManager::ParsedObject* PersistenceManager::findParsedObject(SimObject { const ParsedProperty &prop = testObj->properties[j]; - if ( dStrcmp( prop.name, "internalName" ) == 0 && + if ( dStrcmp( prop.name, "internalName" ) == 0 && dStrcmp( prop.value, object->getInternalName() ) == 0 ) return testObj; else if ( dStrcmp(prop.name, "internalName") == 0) @@ -2037,24 +2037,24 @@ bool PersistenceManager::saveDirtyObject(SimObject* object) const char *name = object->getName(); if (name) { - Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)", - dirtyObject.fileName, object->getClassName(), name, object->getId()); - } - else - { - Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)", - dirtyObject.fileName, object->getClassName(), object->getId()); - } + Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)", + dirtyObject.fileName, object->getClassName(), name, object->getId()); + } + else + { + Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)", + dirtyObject.fileName, object->getClassName(), object->getId()); + } - return false; - } + return false; + } // if the file exists then lets update and save - if(mCurrentFile) - { - updateObject(object); + if(mCurrentFile) + { + updateObject(object); saveDirtyFile(); - } + } break; } @@ -2230,7 +2230,7 @@ DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objNa "Remove a SimObject from the dirty list.") { SimObject *dirtyObject = NULL; - if (dStrcmp( objName,"")!=0) + if (dStrcmp( objName,"")!=0) { if (!Sim::findObject(objName, dirtyObject)) { diff --git a/Engine/source/console/scriptFilename.cpp b/Engine/source/console/scriptFilename.cpp index 60c81f200..7a72756af 100644 --- a/Engine/source/console/scriptFilename.cpp +++ b/Engine/source/console/scriptFilename.cpp @@ -343,10 +343,10 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src) //----------------------------------------------------------------------------- ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)" - "@brief Grabs the full path of a specified file\n\n" - "@param filename Name of the local file to locate\n" - "@return String containing the full filepath on disk\n" - "@ingroup FileSystem") + "@brief Grabs the full path of a specified file\n\n" + "@param filename Name of the local file to locate\n" + "@return String containing the full filepath on disk\n" + "@ingroup FileSystem") { TORQUE_UNUSED(argc); static const U32 bufSize = 1024; @@ -356,9 +356,9 @@ ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)" } ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)" - "@brief Retrofits a filepath that uses old Torque style\n\n" - "@return String containing filepath with new formatting\n" - "@ingroup FileSystem") + "@brief Retrofits a filepath that uses old Torque style\n\n" + "@return String containing filepath with new formatting\n" + "@ingroup FileSystem") { TORQUE_UNUSED(argc); static const U32 bufSize = 1024; @@ -372,7 +372,7 @@ ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)" //----------------------------------------------------------------------------- ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)" - "@internal Editor use only") + "@internal Editor use only") { TORQUE_UNUSED(argc); static const U32 bufSize = 1024; @@ -382,7 +382,7 @@ ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)" } ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string path[, bool toolsOnly])" - "@internal Editor use only") + "@internal Editor use only") { if(argc == 4) Con::setScriptPathExpando(argv[1], argv[2], dAtob(argv[3])); @@ -391,13 +391,13 @@ ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string p } ConsoleToolFunction(removeScriptPathExpando, void, 2, 2, "(string expando)" - "@internal Editor use only") + "@internal Editor use only") { Con::removeScriptPathExpando(argv[1]); } ConsoleToolFunction(isScriptPathExpando, bool, 2, 2, "(string expando)" - "@internal Editor use only") + "@internal Editor use only") { return Con::isScriptPathExpando(argv[1]); } diff --git a/Engine/source/console/scriptObjects.cpp b/Engine/source/console/scriptObjects.cpp index e5916fb64..6218e4e3d 100644 --- a/Engine/source/console/scriptObjects.cpp +++ b/Engine/source/console/scriptObjects.cpp @@ -53,13 +53,13 @@ ConsoleDocClass( ScriptObject, ); IMPLEMENT_CALLBACK( ScriptObject, onAdd, void, ( SimObjectId ID ), ( ID ), - "Called when this ScriptObject is added to the system.\n" - "@param ID Unique object ID assigned when created (%this in script).\n" + "Called when this ScriptObject is added to the system.\n" + "@param ID Unique object ID assigned when created (%this in script).\n" ); IMPLEMENT_CALLBACK( ScriptObject, onRemove, void, ( SimObjectId ID ), ( ID ), - "Called when this ScriptObject is removed from the system.\n" - "@param ID Unique object ID assigned when created (%this in script).\n" + "Called when this ScriptObject is removed from the system.\n" + "@param ID Unique object ID assigned when created (%this in script).\n" ); ScriptObject::ScriptObject() @@ -105,18 +105,18 @@ ConsoleDocClass( ScriptTickObject, ); IMPLEMENT_CALLBACK( ScriptTickObject, onInterpolateTick, void, ( F32 delta ), ( delta ), - "This is called every frame, but only if the object is set to process ticks.\n" - "@param delta The time delta for this frame.\n" + "This is called every frame, but only if the object is set to process ticks.\n" + "@param delta The time delta for this frame.\n" ); IMPLEMENT_CALLBACK( ScriptTickObject, onProcessTick, void, (), (), - "Called once every 32ms if this object is set to process ticks.\n" + "Called once every 32ms if this object is set to process ticks.\n" ); IMPLEMENT_CALLBACK( ScriptTickObject, onAdvanceTime, void, ( F32 timeDelta ), ( timeDelta ), - "This is called every frame regardless if the object is set to process ticks, but only " + "This is called every frame regardless if the object is set to process ticks, but only " "if the callOnAdvanceTime property is set to true.\n" - "@param timeDelta The time delta for this frame.\n" + "@param timeDelta The time delta for this frame.\n" "@see callOnAdvanceTime\n" ); @@ -188,37 +188,37 @@ DefineEngineMethod( ScriptTickObject, isProcessingTicks, bool, ( ),, IMPLEMENT_CONOBJECT(ScriptGroup); ConsoleDocClass( ScriptGroup, - "@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n" + "@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n" - "@tsexample\n" - "// First container, SimGroup containing a ScriptGroup\n" - "new SimGroup(Scenes)\n" - "{\n" - " // Subcontainer, ScriptGroup containing variables\n" - " // related to a cut scene and a starting WayPoint\n" - " new ScriptGroup(WelcomeScene)\n" - " {\n" - " class = \"Scene\";\n" - " pathName = \"Pathx\";\n" - " description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n" - " pathTime = \"0\";\n" - " title = \"Welcome to Orc Town\";\n\n" - " new WayPoint(start)\n" - " {\n" - " position = \"163.873 -103.82 208.354\";\n" - " rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n" - " scale = \"1 1 1\";\n" - " dataBlock = \"WayPointMarker\";\n" - " team = \"0\";\n" - " };\n" - " };\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// First container, SimGroup containing a ScriptGroup\n" + "new SimGroup(Scenes)\n" + "{\n" + " // Subcontainer, ScriptGroup containing variables\n" + " // related to a cut scene and a starting WayPoint\n" + " new ScriptGroup(WelcomeScene)\n" + " {\n" + " class = \"Scene\";\n" + " pathName = \"Pathx\";\n" + " description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n" + " pathTime = \"0\";\n" + " title = \"Welcome to Orc Town\";\n\n" + " new WayPoint(start)\n" + " {\n" + " position = \"163.873 -103.82 208.354\";\n" + " rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n" + " scale = \"1 1 1\";\n" + " dataBlock = \"WayPointMarker\";\n" + " team = \"0\";\n" + " };\n" + " };\n" + "};\n" + "@endtsexample\n\n" - "@see SimGroup\n" + "@see SimGroup\n" - "@ingroup Console\n" - "@ingroup Scripting" + "@ingroup Console\n" + "@ingroup Scripting" ); ScriptGroup::ScriptGroup() @@ -226,13 +226,13 @@ ScriptGroup::ScriptGroup() } IMPLEMENT_CALLBACK( ScriptGroup, onAdd, void, ( SimObjectId ID ), ( ID ), - "Called when this ScriptGroup is added to the system.\n" - "@param ID Unique object ID assigned when created (%this in script).\n" + "Called when this ScriptGroup is added to the system.\n" + "@param ID Unique object ID assigned when created (%this in script).\n" ); IMPLEMENT_CALLBACK( ScriptGroup, onRemove, void, ( SimObjectId ID ), ( ID ), - "Called when this ScriptObject is removed from the system.\n" - "@param ID Unique object ID assigned when created (%this in script).\n" + "Called when this ScriptObject is removed from the system.\n" + "@param ID Unique object ID assigned when created (%this in script).\n" ); bool ScriptGroup::onAdd() @@ -248,7 +248,7 @@ bool ScriptGroup::onAdd() void ScriptGroup::onRemove() { // Call onRemove in script! - onRemove_callback(getId()); + onRemove_callback(getId()); Parent::onRemove(); } diff --git a/Engine/source/console/sim.cpp b/Engine/source/console/sim.cpp index e0465050f..0ea902b5c 100644 --- a/Engine/source/console/sim.cpp +++ b/Engine/source/console/sim.cpp @@ -139,7 +139,7 @@ DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass , const char * spawnProperties , const char * spawnScript ),("","","","") ,"spawnObject(class [, dataBlock, name, properties, script])" - "@hide") + "@hide") { SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript); @@ -203,12 +203,12 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, nextNameObject; - obj->nextNameObject = (SimObject*)-1; + obj->nextNameObject = (SimObject*)-1; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -164,7 +164,7 @@ void SimNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //---------------------------------------------------------------------------- @@ -279,7 +279,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) if(*walk == obj) { *walk = obj->nextManagerNameObject; - obj->nextManagerNameObject = (SimObject*)-1; + obj->nextManagerNameObject = (SimObject*)-1; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -293,7 +293,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/Engine/source/console/simDictionary.h b/Engine/source/console/simDictionary.h index bbfb0f385..1247d504e 100644 --- a/Engine/source/console/simDictionary.h +++ b/Engine/source/console/simDictionary.h @@ -61,7 +61,7 @@ struct StringTableEntryEq } }; -typedef std::unordered_map StringDictDef; +typedef std::unordered_map StringDictDef; typedef std::unordered_map SimObjectIdDictDef; #endif diff --git a/Engine/source/console/simEvents.cpp b/Engine/source/console/simEvents.cpp index bc1e1789c..ab87f5f0b 100644 --- a/Engine/source/console/simEvents.cpp +++ b/Engine/source/console/simEvents.cpp @@ -39,10 +39,10 @@ SimConsoleEvent::SimConsoleEvent(S32 argc, ConsoleValueRef *argv, bool onObject) mArgv[i].value = new ConsoleValue(); mArgv[i].value->type = ConsoleValue::TypeInternalString; mArgv[i].value->init(); - if (argv) - { - mArgv[i].value->setStringValue((const char*)argv[i]); - } + if (argv) + { + mArgv[i].value->setStringValue((const char*)argv[i]); + } } } diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index b1ee96f5c..4f12fa85f 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -93,13 +93,13 @@ static void shutdownEventQueue() U32 postEvent(SimObject *destObject, SimEvent* event,U32 time) { - AssertFatal(time == -1 || time >= getCurrentTime(), + AssertFatal(time == -1 || time >= getCurrentTime(), "Sim::postEvent() - Event time must be greater than or equal to the current time." ); AssertFatal(destObject, "Sim::postEvent() - Destination object for event doesn't exist."); Mutex::lockMutex(gEventQueueMutex); - if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix + if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix time = gCurrentTime; event->time = time; @@ -256,7 +256,7 @@ void advanceToTime(SimTime targetTime) event->process(obj); delete event; } - gCurrentTime = targetTime; + gCurrentTime = targetTime; Mutex::unlockMutex(gEventQueueMutex); } @@ -393,7 +393,7 @@ SimObject* findObject(const char* name) SimObject* findObject(SimObjectId id) { - return gIdDictionary->find(id); + return gIdDictionary->find(id); } SimObject *spawnObject(String spawnClass, String spawnDataBlock, String spawnName, @@ -600,7 +600,7 @@ SimDataBlockGroup::SimDataBlockGroup() S32 QSORT_CALLBACK SimDataBlockGroup::compareModifiedKey(const void* a,const void* b) { - const SimDataBlock* dba = *((const SimDataBlock**)a); + const SimDataBlock* dba = *((const SimDataBlock**)a); const SimDataBlock* dbb = *((const SimDataBlock**)b); return dba->getModifiedKey() - dbb->getModifiedKey(); @@ -612,6 +612,6 @@ void SimDataBlockGroup::sort() if(mLastModifiedKey != SimDataBlock::getNextModifiedKey()) { mLastModifiedKey = SimDataBlock::getNextModifiedKey(); - dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey); + dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey); } } diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index b07bc6840..73a1ffa3d 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -81,7 +81,7 @@ SimObject::SimObject() mFlags.set( ModStaticFields | ModDynamicFields ); mFieldDictionary = NULL; - mCanSaveFieldDictionary = true; + mCanSaveFieldDictionary = true; mClassName = NULL; mSuperClassName = NULL; @@ -592,7 +592,7 @@ void SimObject::setDeclarationLine(U32 lineNumber) bool SimObject::registerObject() { AssertFatal( !mFlags.test( Added ), "reigsterObject - Object already registered!"); - mFlags.clear(Deleted | Removed); + mFlags.clear(Deleted | Removed); if(smForceId) { @@ -609,11 +609,11 @@ bool SimObject::registerObject() AssertFatal(Sim::gIdDictionary && Sim::gNameDictionary, "SimObject::registerObject - tried to register an object before Sim::init()!"); - Sim::gIdDictionary->insert(this); + Sim::gIdDictionary->insert(this); Sim::gNameDictionary->insert(this); - // Notify object + // Notify object bool ret = onAdd(); if(!ret) @@ -661,10 +661,10 @@ void SimObject::deleteObject() void SimObject::_destroySelf() { - AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" ); - AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" ); + AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" ); + AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" ); - mFlags.set( Deleted ); + mFlags.set( Deleted ); if( mFlags.test( Added ) ) unregisterObject(); @@ -1308,7 +1308,7 @@ void SimObject::dumpClassHierarchy() while(pRep) { Con::warnf("%s ->", pRep->getClassName()); - pRep = pRep->getParentClass(); + pRep = pRep->getParentClass(); } } @@ -1376,7 +1376,7 @@ bool SimObject::isChildOfGroup(SimGroup* pGroup) if(pGroup == dynamic_cast(this)) return true; - SimGroup* temp = mGroup; + SimGroup* temp = mGroup; while(temp) { if(temp == pGroup) @@ -2884,7 +2884,7 @@ DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className ) return true; } - pRep = pRep->getParentClass(); + pRep = pRep->getParentClass(); } return false; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 8a38e8675..6cba1beff 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -826,7 +826,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks virtual bool readObject(Stream *stream); /// Set whether fields created at runtime should be saved. Default is true. - void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; } + void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; } /// Get whether fields created at runtime should be saved. Default is true. bool getCanSaveDynamicFields( ) { return mCanSaveFieldDictionary;} diff --git a/Engine/source/console/simObjectMemento.cpp b/Engine/source/console/simObjectMemento.cpp index 839ae0846..ef2e8f732 100644 --- a/Engine/source/console/simObjectMemento.cpp +++ b/Engine/source/console/simObjectMemento.cpp @@ -30,7 +30,7 @@ SimObjectMemento::SimObjectMemento() : mState( NULL ), - mIsDatablock( false ) + mIsDatablock( false ) { } @@ -45,16 +45,16 @@ void SimObjectMemento::save( SimObject *object ) dFree( mState ); mObjectName = String::EmptyString; - // Use a stream to save the state. + // Use a stream to save the state. MemStream stream( 256 ); U32 writeFlags = 0; - SimDataBlock* db = dynamic_cast(object); - if( !db ) - stream.write( sizeof( "return " ) - 1, "return " ); - else + SimDataBlock* db = dynamic_cast(object); + if( !db ) + stream.write( sizeof( "return " ) - 1, "return " ); + else { - mIsDatablock = true; + mIsDatablock = true; // Cull the datablock name from the output so that // we can easily replace it in case the datablock's name @@ -64,7 +64,7 @@ void SimObjectMemento::save( SimObject *object ) writeFlags |= SimObject::NoName; } - + object->write( stream, 0, writeFlags ); stream.write( (UTF8)0 ); @@ -82,9 +82,9 @@ SimObject *SimObjectMemento::restore() const // TODO: We could potentially make this faster by // caching the CodeBlock generated from the string - SimObject* object; - if( !mIsDatablock ) - { + SimObject* object; + if( !mIsDatablock ) + { // Set the redefine behavior to automatically giving // the new objects unique names. This will restore the // old names if they are still available or give reasonable @@ -95,22 +95,22 @@ SimObject *SimObjectMemento::restore() const // Read the object. - const UTF8* result = Con::evaluate( mState ); + const UTF8* result = Con::evaluate( mState ); // Restore the redefine behavior. Con::setVariable( "$Con::redefineBehavior", oldRedefineBehavior ); - if ( !result || !result[ 0 ] ) - return NULL; + if ( !result || !result[ 0 ] ) + return NULL; // Look up the object. - U32 objectId = dAtoi( result ); - object = Sim::findObject( objectId ); - } - else - { + U32 objectId = dAtoi( result ); + object = Sim::findObject( objectId ); + } + else + { String objectName = mObjectName; // For datablocks, it's getting a little complicated. Datablock definitions cannot be used @@ -140,16 +140,16 @@ SimObject *SimObjectMemento::restore() const dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ] ); } - Con::evaluate( tempBuffer ); + Con::evaluate( tempBuffer ); if( tempBuffer != mState ) dFree( tempBuffer ); if( objectName == String::EmptyString ) - return NULL; + return NULL; - object = Sim::findObject( objectName ); - } + object = Sim::findObject( objectName ); + } return object; } diff --git a/Engine/source/console/simObjectMemento.h b/Engine/source/console/simObjectMemento.h index 8fc029726..45b8a9e4d 100644 --- a/Engine/source/console/simObjectMemento.h +++ b/Engine/source/console/simObjectMemento.h @@ -42,7 +42,7 @@ protected: /// The captured object's name. String mObjectName; - bool mIsDatablock; + bool mIsDatablock; public: diff --git a/Engine/source/console/simPersistSet.cpp b/Engine/source/console/simPersistSet.cpp index 1fe272478..2dea6416e 100644 --- a/Engine/source/console/simPersistSet.cpp +++ b/Engine/source/console/simPersistSet.cpp @@ -29,13 +29,13 @@ IMPLEMENT_CONOBJECT( SimPersistSet ); ConsoleDocClass( SimPersistSet, - "@brief A SimSet that can be safely persisted.\n\n" - "Uses SimPersistIDs to reference objects in the set " - "while persisted on disk. This allows the set to resolve " - "its references no matter whether they are loaded before or " - "after the set is created.\n\n" - "Not intended for game development, for editors or internal use only.\n\n " - "@internal"); + "@brief A SimSet that can be safely persisted.\n\n" + "Uses SimPersistIDs to reference objects in the set " + "while persisted on disk. This allows the set to resolve " + "its references no matter whether they are loaded before or " + "after the set is created.\n\n" + "Not intended for game development, for editors or internal use only.\n\n " + "@internal"); //----------------------------------------------------------------------------- diff --git a/Engine/source/console/simSerialize.cpp b/Engine/source/console/simSerialize.cpp index e3f64be4c..6a7a84b17 100644 --- a/Engine/source/console/simSerialize.cpp +++ b/Engine/source/console/simSerialize.cpp @@ -213,18 +213,18 @@ SimObject *loadObjectStream(Stream *stream) //----------------------------------------------------------------------------- DefineEngineFunction(saveObject, bool, ( SimObject *object, const char *filename ),, - "@brief Serialize the object to a file.\n\n" - "@param object The object to serialize.\n" - "@param filename The file name and path.\n" - "@ingroup Console\n") + "@brief Serialize the object to a file.\n\n" + "@param object The object to serialize.\n" + "@param filename The file name and path.\n" + "@ingroup Console\n") { return object && Sim::saveObject(object, filename); } DefineEngineFunction(loadObject, SimObject*, ( const char *filename ),, - "@brief Loads a serialized object from a file.\n\n" - "@param Name and path to text file containing the object\n" - "@ingroup Console\n") + "@brief Loads a serialized object from a file.\n\n" + "@param Name and path to text file containing the object\n" + "@ingroup Console\n") { return Sim::loadObjectStream(filename); } diff --git a/Engine/source/console/stringStack.cpp b/Engine/source/console/stringStack.cpp index 45fd83740..681de2898 100644 --- a/Engine/source/console/stringStack.cpp +++ b/Engine/source/console/stringStack.cpp @@ -121,7 +121,7 @@ bool ConsoleValueStack::reserveValues(U32 count, ConsoleValueRef *outValues) //Con::printf("[%i]CSTK reserveValues %i", mStackPos, count); for (U32 i=0; isetTelnetParameters(port, consolePass, listenPass, remoteEcho); + TelConsole->setTelnetParameters(port, consolePass, listenPass, remoteEcho); } static void telnetCallback(U32 level, const char *consoleLine) { TORQUE_UNUSED(level); if (TelConsole) - TelConsole->processConsoleLine(consoleLine); + TelConsole->processConsoleLine(consoleLine); } TelnetConsole::TelnetConsole() @@ -121,9 +121,9 @@ void TelnetConsole::setTelnetParameters(S32 port, const char *telnetPassword, co mAcceptPort = port; if(mAcceptPort != -1 && mAcceptPort != 0) { - NetAddress address; - Net::getIdealListenAddress(&address); - address.port = mAcceptPort; + NetAddress address; + Net::getIdealListenAddress(&address); + address.port = mAcceptPort; mAcceptSocket = Net::openSocket(); Net::bindAddress(address, mAcceptSocket); diff --git a/Engine/source/console/telnetDebugger.cpp b/Engine/source/console/telnetDebugger.cpp index 8f95aaf9f..7db6e9710 100644 --- a/Engine/source/console/telnetDebugger.cpp +++ b/Engine/source/console/telnetDebugger.cpp @@ -115,8 +115,8 @@ MODULE_END; DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password, bool waitForClient ), (false), "( int port, string password, bool waitForClient )" "Open a debug server port on the specified port, requiring the specified password, " - "and optionally waiting for the debug client to connect.\n" - "@internal Primarily used for Torsion and other debugging tools") + "and optionally waiting for the debug client to connect.\n" + "@internal Primarily used for Torsion and other debugging tools") { if (TelDebugger) { @@ -126,17 +126,17 @@ DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password, DefineConsoleFunction( dbgIsConnected, bool, (), , "()" "Returns true if a script debugging client is connected else return false.\n" - "@internal Primarily used for Torsion and other debugging tools") + "@internal Primarily used for Torsion and other debugging tools") { return TelDebugger && TelDebugger->isConnected(); } DefineConsoleFunction( dbgDisconnect, void, (), , "()" "Forcibly disconnects any attached script debugging client.\n" - "@internal Primarily used for Torsion and other debugging tools") + "@internal Primarily used for Torsion and other debugging tools") { if (TelDebugger) - TelDebugger->disconnect(); + TelDebugger->disconnect(); } static void debuggerConsumer(U32 level, const char *line) @@ -244,9 +244,9 @@ void TelnetDebugger::setDebugParameters(S32 port, const char *password, bool wai mAcceptPort = port; if(mAcceptPort != -1 && mAcceptPort != 0) { - NetAddress address; - Net::getIdealListenAddress(&address); - address.port = mAcceptPort; + NetAddress address; + Net::getIdealListenAddress(&address); + address.port = mAcceptPort; mAcceptSocket = Net::openSocket(); Net::bindAddress(address, mAcceptSocket); @@ -588,7 +588,7 @@ void TelnetDebugger::addAllBreakpoints(CodeBlock *code) // TODO: This assumes that the OS file names are case // insensitive... Torque needs a dFilenameCmp() function. if( dStricmp( cur->fileName, code->name ) == 0 ) - { + { cur->code = code; // Find the fist breakline starting from and @@ -741,7 +741,7 @@ void TelnetDebugger::removeBreakpoint(const char *fileName, S32 line) { Breakpoint *brk = *bp; *bp = brk->next; - if ( brk->code ) + if ( brk->code ) brk->code->clearBreakpoint(brk->lineNumber); dFree(brk->testExpression); delete brk; @@ -754,7 +754,7 @@ void TelnetDebugger::removeAllBreakpoints() while(walk) { Breakpoint *temp = walk->next; - if ( walk->code ) + if ( walk->code ) walk->code->clearBreakpoint(walk->lineNumber); dFree(walk->testExpression); delete walk; @@ -792,10 +792,10 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled ) for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) walk->clearAllBreaks(); for(Breakpoint *w = mBreakpoints; w; w = w->next) - { - if ( w->code ) + { + if ( w->code ) w->code->setBreakpoint(w->lineNumber); - } + } mBreakOnNextStatement = false; } } @@ -848,7 +848,7 @@ void TelnetDebugger::debugStepOut() setBreakOnNextStatement( false ); mStackPopBreakIndex = gEvalState.getStackDepth() - 1; if ( mStackPopBreakIndex == 0 ) - mStackPopBreakIndex = -1; + mStackPopBreakIndex = -1; mProgramPaused = false; send("RUNNING\r\n"); } diff --git a/Engine/source/console/typeValidators.cpp b/Engine/source/console/typeValidators.cpp index 11249daf7..6b2ea7475 100644 --- a/Engine/source/console/typeValidators.cpp +++ b/Engine/source/console/typeValidators.cpp @@ -49,42 +49,42 @@ void TypeValidator::consoleError(SimObject *object, const char *format, ...) void FRangeValidator::validateType(SimObject *object, void *typePtr) { - F32 *v = (F32 *) typePtr; - if(*v < minV || *v > maxV) - { - consoleError(object, "Must be between %g and %g", minV, maxV); - if(*v < minV) - *v = minV; - else if(*v > maxV) - *v = maxV; - } + F32 *v = (F32 *) typePtr; + if(*v < minV || *v > maxV) + { + consoleError(object, "Must be between %g and %g", minV, maxV); + if(*v < minV) + *v = minV; + else if(*v > maxV) + *v = maxV; + } } void IRangeValidator::validateType(SimObject *object, void *typePtr) { - S32 *v = (S32 *) typePtr; - if(*v < minV || *v > maxV) - { - consoleError(object, "Must be between %d and %d", minV, maxV); - if(*v < minV) - *v = minV; - else if(*v > maxV) - *v = maxV; - } + S32 *v = (S32 *) typePtr; + if(*v < minV || *v > maxV) + { + consoleError(object, "Must be between %d and %d", minV, maxV); + if(*v < minV) + *v = minV; + else if(*v > maxV) + *v = maxV; + } } void IRangeValidatorScaled::validateType(SimObject *object, void *typePtr) { - S32 *v = (S32 *) typePtr; - *v /= factor; - if(*v < minV || *v > maxV) - { - consoleError(object, "Scaled value must be between %d and %d", minV, maxV); - if(*v < minV) - *v = minV; - else if(*v > maxV) - *v = maxV; - } + S32 *v = (S32 *) typePtr; + *v /= factor; + if(*v < minV || *v > maxV) + { + consoleError(object, "Scaled value must be between %d and %d", minV, maxV); + if(*v < minV) + *v = minV; + else if(*v > maxV) + *v = maxV; + } } void Point3NormalizeValidator::validateType(SimObject *object, void *typePtr) diff --git a/Engine/source/gfx/video/videoCapture.cpp b/Engine/source/gfx/video/videoCapture.cpp index 0af46af10..8f7b7e52e 100644 --- a/Engine/source/gfx/video/videoCapture.cpp +++ b/Engine/source/gfx/video/videoCapture.cpp @@ -340,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),, DefineEngineFunction( playJournalToVideo, void, ( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ), - ( nullAsType(), "THEORA", 30.0f, Point2I::Zero ), + ( nullAsType(), "THEORA", 30.0f, Point2I::Zero ), "Load a journal file and capture it video.\n" "@ingroup Rendering\n" ) { diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 400e50d73..0c91ec54f 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -52,42 +52,42 @@ IMPLEMENT_CONOBJECT(GuiCanvas); ConsoleDocClass( GuiCanvas, - "@brief A canvas on which rendering occurs.\n\n" + "@brief A canvas on which rendering occurs.\n\n" - "@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n" + "@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n" - "@subsection GuiCanvas_content_contentcontrol Content Control\n" - "A content control is the top level GuiControl for a screen. This GuiControl " - "will be the parent control for all other GuiControls on that particular " - "screen.\n\n" + "@subsection GuiCanvas_content_contentcontrol Content Control\n" + "A content control is the top level GuiControl for a screen. This GuiControl " + "will be the parent control for all other GuiControls on that particular " + "screen.\n\n" - "@subsection GuiCanvas_content_dialogs Dialogs\n\n" + "@subsection GuiCanvas_content_dialogs Dialogs\n\n" - "A dialog is essentially another screen, only it gets overlaid on top of the " - "current content control, and all input goes to the dialog. This is most akin " - "to the \"Open File\" dialog box found in most operating systems. When you " - "choose to open a file, and the \"Open File\" dialog pops up, you can no longer " - "send input to the application, and must complete or cancel the open file " - "request. Torque keeps track of layers of dialogs. The dialog with the highest " - "layer is on top and will get all the input, unless the dialog is " - "modeless, which is a profile option.\n\n" + "A dialog is essentially another screen, only it gets overlaid on top of the " + "current content control, and all input goes to the dialog. This is most akin " + "to the \"Open File\" dialog box found in most operating systems. When you " + "choose to open a file, and the \"Open File\" dialog pops up, you can no longer " + "send input to the application, and must complete or cancel the open file " + "request. Torque keeps track of layers of dialogs. The dialog with the highest " + "layer is on top and will get all the input, unless the dialog is " + "modeless, which is a profile option.\n\n" - "@see GuiControlProfile\n\n" + "@see GuiControlProfile\n\n" - "@section GuiCanvas_dirty Dirty Rectangles\n\n" + "@section GuiCanvas_dirty Dirty Rectangles\n\n" - "The GuiCanvas is based on dirty regions. " - "Every frame the canvas paints only the areas of the canvas that are 'dirty' " - "or need updating. In most cases, this only is the area under the mouse cursor. " - "This is why if you look in guiCanvas.cc the call to glClear is commented out. " - - "What you will see is a black screen, except in the dirty regions, where the " - "screen will be painted normally. If you are making an animated GuiControl " - "you need to add your control to the dirty areas of the canvas.\n\n" + "The GuiCanvas is based on dirty regions. " + "Every frame the canvas paints only the areas of the canvas that are 'dirty' " + "or need updating. In most cases, this only is the area under the mouse cursor. " + "This is why if you look in guiCanvas.cc the call to glClear is commented out. " + + "What you will see is a black screen, except in the dirty regions, where the " + "screen will be painted normally. If you are making an animated GuiControl " + "you need to add your control to the dirty areas of the canvas.\n\n" - "@see GuiControl\n\n" + "@see GuiControl\n\n" - "@ingroup GuiCore\n"); + "@ingroup GuiCore\n"); ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear @@ -209,29 +209,29 @@ bool GuiCanvas::onAdd() //If we're recording, store the intial video resolution if (Journal::IsRecording()) { - Journal::Write(vm.resolution.x); - Journal::Write(vm.resolution.y); - Journal::Write(vm.fullScreen); + Journal::Write(vm.resolution.x); + Journal::Write(vm.resolution.y); + Journal::Write(vm.fullScreen); } //If we're playing, read the intial video resolution from the journal if (Journal::IsPlaying()) { - Journal::Read(&vm.resolution.x); - Journal::Read(&vm.resolution.y); - Journal::Read(&vm.fullScreen); + Journal::Read(&vm.resolution.x); + Journal::Read(&vm.resolution.y); + Journal::Read(&vm.fullScreen); } if (a && a->mType != NullDevice) { mPlatformWindow = WindowManager->createWindow(newDevice, vm); - //Disable window resizing if recording ir playing a journal - if (Journal::IsRecording() || Journal::IsPlaying()) - mPlatformWindow->lockSize(true); - - // Set a minimum on the window size so people can't break us by resizing tiny. - mPlatformWindow->setMinimumWindowSize(Point2I(640,480)); + //Disable window resizing if recording ir playing a journal + if (Journal::IsRecording() || Journal::IsPlaying()) + mPlatformWindow->lockSize(true); + + // Set a minimum on the window size so people can't break us by resizing tiny. + mPlatformWindow->setMinimumWindowSize(Point2I(640,480)); // Now, we have to hook in our event callbacks so we'll get // appropriate events from the window. @@ -326,12 +326,12 @@ CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal; void GuiCanvas::handleResize( WindowId did, S32 width, S32 height ) { getCanvasSizeChangeSignal().trigger(this); - if (Journal::IsPlaying() && mPlatformWindow) - { - mPlatformWindow->lockSize(false); - mPlatformWindow->setSize(Point2I(width, height)); - mPlatformWindow->lockSize(true); - } + if (Journal::IsPlaying() && mPlatformWindow) + { + mPlatformWindow->lockSize(false); + mPlatformWindow->setSize(Point2I(width, height)); + mPlatformWindow->lockSize(true); + } // Notify the scripts if ( isMethod( "onResize" ) ) @@ -342,9 +342,9 @@ void GuiCanvas::handlePaintEvent(WindowId did) { bool canRender = mPlatformWindow->isVisible() && GFX->allowRender() && !GFX->canCurrentlyRender(); - // Do the screenshot first. + // Do the screenshot first. if ( gScreenShot != NULL && gScreenShot->isPending() && canRender ) - gScreenShot->capture( this ); + gScreenShot->capture( this ); // If the video capture is waiting for a canvas, start the capture if ( VIDCAP->isWaitingForCanvas() && canRender ) @@ -560,19 +560,19 @@ bool GuiCanvas::tabNext(void) //save the old GuiControl *oldResponder = mFirstResponder; - GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder); + GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder); if ( !newResponder ) newResponder = ctrl->findFirstTabable(); - if ( newResponder && newResponder != oldResponder ) - { - newResponder->setFirstResponder(); + if ( newResponder && newResponder != oldResponder ) + { + newResponder->setFirstResponder(); // CodeReview Can this get killed? Note tabPrev code. BJG - 3/25/07 -// if ( oldResponder ) -// oldResponder->onLoseFirstResponder(); +// if ( oldResponder ) +// oldResponder->onLoseFirstResponder(); return true; - } + } } return false; } @@ -585,30 +585,30 @@ bool GuiCanvas::tabPrev(void) //save the old GuiControl *oldResponder = mFirstResponder; - GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder); - if ( !newResponder ) + GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder); + if ( !newResponder ) newResponder = ctrl->findLastTabable(); - if ( newResponder && newResponder != oldResponder ) - { - newResponder->setFirstResponder(); - + if ( newResponder && newResponder != oldResponder ) + { + newResponder->setFirstResponder(); + // CodeReview As with tabNext() above, looks like this can now go. DAW - 7/05/09 - //if ( oldResponder ) - // oldResponder->onLoseFirstResponder(); + //if ( oldResponder ) + // oldResponder->onLoseFirstResponder(); return true; - } + } } return false; } bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent) { - // First call the general input handler (on the extremely off-chance that it will be handled): - if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent)) + // First call the general input handler (on the extremely off-chance that it will be handled): + if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent)) { - return(true); + return(true); } switch (inputEvent.deviceType) @@ -1786,9 +1786,9 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) addUpdateRegion(pos - Point2I(2, 2), Point2I(cext.x + 4, cext.y + 4)); } - mLastCursorEnabled = cursorVisible; - mLastCursor = mouseCursor; - mLastCursorPt = cursorPos; + mLastCursorEnabled = cursorVisible; + mLastCursor = mouseCursor; + mLastCursorPt = cursorPos; // Begin GFX PROFILE_START(GFXBeginScene); @@ -1830,7 +1830,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) resetUpdateRegions(); - // Make sure we have a clean matrix state + // Make sure we have a clean matrix state // before we start rendering anything! GFX->setWorldMatrix( MatrixF::Identity ); GFX->setViewMatrix( MatrixF::Identity ); @@ -2039,46 +2039,46 @@ void GuiCanvas::resetUpdateRegions() void GuiCanvas::setFirstResponder( GuiControl* newResponder ) { - GuiControl* oldResponder = mFirstResponder; - Parent::setFirstResponder( newResponder ); + GuiControl* oldResponder = mFirstResponder; + Parent::setFirstResponder( newResponder ); if( oldResponder == mFirstResponder ) return; - if( oldResponder && ( oldResponder != newResponder ) ) - oldResponder->onLoseFirstResponder(); + if( oldResponder && ( oldResponder != newResponder ) ) + oldResponder->onLoseFirstResponder(); if( newResponder && ( newResponder != oldResponder ) ) newResponder->onGainFirstResponder(); } DefineEngineMethod( GuiCanvas, getContent, S32, (),, - "@brief Get the GuiControl which is being used as the content.\n\n" + "@brief Get the GuiControl which is being used as the content.\n\n" - "@tsexample\n" - "Canvas.getContent();\n" - "@endtsexample\n\n" + "@tsexample\n" + "Canvas.getContent();\n" + "@endtsexample\n\n" - "@return ID of current content control") + "@return ID of current content control") { - GuiControl *ctrl = object->getContentControl(); + GuiControl *ctrl = object->getContentControl(); if(ctrl) return ctrl->getId(); return -1; } DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),, - "@brief Set the content of the canvas to a specified control.\n\n" + "@brief Set the content of the canvas to a specified control.\n\n" - "@param ctrl ID or name of GuiControl to set content to\n\n" + "@param ctrl ID or name of GuiControl to set content to\n\n" - "@tsexample\n" - "Canvas.setContent(PlayGui);\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setContent(PlayGui);\n" + "@endtsexample\n\n") { - // Not using old error reporting until we modify the engineAPI - mperry + // Not using old error reporting until we modify the engineAPI - mperry - //GuiControl *gui = NULL; + //GuiControl *gui = NULL; // if(argv[2][0]) // { // if (!Sim::findObject(argv[2], gui)) @@ -2088,11 +2088,11 @@ DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),, // } // } - if(!ctrl) - { - Con::errorf("GuiCanvas::setContent - Invalid control specified')"); - return; - } + if(!ctrl) + { + Con::errorf("GuiCanvas::setContent - Invalid control specified')"); + return; + } //set the new content control object->setContentControl(ctrl); @@ -2111,11 +2111,11 @@ ConsoleDocFragment _pushDialog( ); DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)" - "@hide") + "@hide") { GuiControl *gui; - if (! Sim::findObject(ctrlName, gui)) + if (! Sim::findObject(ctrlName, gui)) { Con::printf("pushDialog(): Invalid control: %s", ctrlName); return; @@ -2148,7 +2148,7 @@ ConsoleDocFragment _popDialog2( ); DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType()), "(GuiControl ctrl=NULL)" - "@hide") + "@hide") { if (gui) object->popDialogControl(gui); @@ -2157,160 +2157,160 @@ DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType } ConsoleDocFragment _popLayer1( - "@brief Removes the top most layer of dialogs\n\n" - "@tsexample\n" - "Canvas.popLayer();\n" - "@endtsexample\n\n", - "GuiCanvas", - "void popLayer();" + "@brief Removes the top most layer of dialogs\n\n" + "@tsexample\n" + "Canvas.popLayer();\n" + "@endtsexample\n\n", + "GuiCanvas", + "void popLayer();" ); ConsoleDocFragment _popLayer2( - "@brief Removes a specified layer of dialogs\n\n" - "@param layer Number of the layer to pop\n\n" - "@tsexample\n" - "Canvas.popLayer(1);\n" - "@endtsexample\n\n", - "GuiCanvas", - "void popLayer(S32 layer);" + "@brief Removes a specified layer of dialogs\n\n" + "@param layer Number of the layer to pop\n\n" + "@tsexample\n" + "Canvas.popLayer(1);\n" + "@endtsexample\n\n", + "GuiCanvas", + "void popLayer(S32 layer);" ); DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)" - "@hide") + "@hide") { object->popDialogControl(layer); } DefineEngineMethod( GuiCanvas, cursorOn, void, (),, - "@brief Turns on the mouse cursor.\n\n" - "@tsexample\n" - "Canvas.cursorOn();\n" - "@endtsexample\n\n") + "@brief Turns on the mouse cursor.\n\n" + "@tsexample\n" + "Canvas.cursorOn();\n" + "@endtsexample\n\n") { - object->setCursorON(true); + object->setCursorON(true); } DefineEngineMethod( GuiCanvas, cursorOff, void, (),, - "@brief Turns on the mouse off.\n\n" - "@tsexample\n" - "Canvas.cursorOff();\n" - "@endtsexample\n\n") + "@brief Turns on the mouse off.\n\n" + "@tsexample\n" + "Canvas.cursorOff();\n" + "@endtsexample\n\n") { - object->setCursorON(false); + object->setCursorON(false); } DefineEngineMethod( GuiCanvas, setCursor, void, (GuiCursor* cursor),, - "@brief Sets the cursor for the canvas.\n\n" + "@brief Sets the cursor for the canvas.\n\n" - "@param cursor Name of the GuiCursor to use\n\n" + "@param cursor Name of the GuiCursor to use\n\n" - "@tsexample\n" - "Canvas.setCursor(\"DefaultCursor\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setCursor(\"DefaultCursor\");\n" + "@endtsexample\n\n") { - if(!cursor) - { - Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID"); - return; - } - object->setCursor(cursor); + if(!cursor) + { + Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID"); + return; + } + object->setCursor(cursor); } DefineEngineMethod( GuiCanvas, renderFront, void, ( bool enable ),, - "@brief This turns on/off front-buffer rendering.\n\n" + "@brief This turns on/off front-buffer rendering.\n\n" - "@param enable True if all rendering should be done to the front buffer\n\n" + "@param enable True if all rendering should be done to the front buffer\n\n" - "@tsexample\n" - "Canvas.renderFront(false);\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.renderFront(false);\n" + "@endtsexample\n\n") { - object->setRenderFront(enable); + object->setRenderFront(enable); } DefineEngineMethod( GuiCanvas, showCursor, void, (),, - "@brief Enable rendering of the cursor.\n\n" + "@brief Enable rendering of the cursor.\n\n" - "@tsexample\n" - "Canvas.showCursor();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.showCursor();\n" + "@endtsexample\n\n") { - object->showCursor(true); + object->showCursor(true); } DefineEngineMethod( GuiCanvas, hideCursor, void, (),, - "@brief Disable rendering of the cursor.\n\n" + "@brief Disable rendering of the cursor.\n\n" - "@tsexample\n" - "Canvas.hideCursor();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.hideCursor();\n" + "@endtsexample\n\n") { - object->showCursor(false); + object->showCursor(false); } DefineEngineMethod( GuiCanvas, isCursorOn, bool, (),, - "@brief Determines if mouse cursor is enabled.\n\n" + "@brief Determines if mouse cursor is enabled.\n\n" - "@tsexample\n" - "// Is cursor on?\n" - "if(Canvas.isCursorOn())\n" - " echo(\"Canvas cursor is on\");\n" - "@endtsexample\n\n" - "@return Returns true if the cursor is on.\n\n") + "@tsexample\n" + "// Is cursor on?\n" + "if(Canvas.isCursorOn())\n" + " echo(\"Canvas cursor is on\");\n" + "@endtsexample\n\n" + "@return Returns true if the cursor is on.\n\n") { - return object->isCursorON(); + return object->isCursorON(); } DefineEngineMethod( GuiCanvas, isCursorShown, bool, (),, - "@brief Determines if mouse cursor is rendering.\n\n" + "@brief Determines if mouse cursor is rendering.\n\n" - "@tsexample\n" - "// Is cursor rendering?\n" - "if(Canvas.isCursorShown())\n" - " echo(\"Canvas cursor is rendering\");\n" - "@endtsexample\n\n" - "@return Returns true if the cursor is rendering.\n\n") + "@tsexample\n" + "// Is cursor rendering?\n" + "if(Canvas.isCursorShown())\n" + " echo(\"Canvas cursor is rendering\");\n" + "@endtsexample\n\n" + "@return Returns true if the cursor is rendering.\n\n") { - return object->isCursorShown(); + return object->isCursorShown(); } DefineEngineMethod( GuiCanvas, repaint, void, ( S32 elapsedMS ), (0), - "@brief Force canvas to redraw.\n" + "@brief Force canvas to redraw.\n" "If the elapsed time is greater than the time since the last paint " "then the repaint will be skipped.\n" "@param elapsedMS The optional elapsed time in milliseconds.\n\n" - "@tsexample\n" - "Canvas.repaint();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.repaint();\n" + "@endtsexample\n\n") { - object->repaint(elapsedMS < 0 ? 0 : elapsedMS); + object->repaint(elapsedMS < 0 ? 0 : elapsedMS); } DefineEngineMethod( GuiCanvas, reset, void, (),, - "@brief Reset the update regions for the canvas.\n\n" + "@brief Reset the update regions for the canvas.\n\n" - "@tsexample\n" - "Canvas.reset();\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.reset();\n" + "@endtsexample\n\n") { - object->resetUpdateRegions(); + object->resetUpdateRegions(); } DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),, - "@brief Get the current position of the cursor in screen-space. Note that this position" + "@brief Get the current position of the cursor in screen-space. Note that this position" " might be outside the Torque window. If you want to get the position within the Canvas," " call screenToClient on the result.\n\n" "@see Canvas::screenToClient()\n\n" - "@param param Description\n\n" - "@tsexample\n" - "%cursorPos = Canvas.getCursorPos();\n" - "@endtsexample\n\n" - "@return Screen coordinates of mouse cursor, in format \"X Y\"") + "@param param Description\n\n" + "@tsexample\n" + "%cursorPos = Canvas.getCursorPos();\n" + "@endtsexample\n\n" + "@return Screen coordinates of mouse cursor, in format \"X Y\"") { - return object->getCursorPos(); + return object->getCursorPos(); } ConsoleDocFragment _setCursorPos1( @@ -2334,21 +2334,21 @@ ConsoleDocFragment _setCursorPos2( ); DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)" - "@hide") + "@hide") { object->setCursorPos(pos); } DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, - "@brief Gets the gui control under the mouse.\n\n" - "@tsexample\n" - "%underMouse = Canvas.getMouseControl();\n" - "@endtsexample\n\n" + "@brief Gets the gui control under the mouse.\n\n" + "@tsexample\n" + "%underMouse = Canvas.getMouseControl();\n" + "@endtsexample\n\n" - "@return ID of the gui control, if one was found. NULL otherwise") + "@return ID of the gui control, if one was found. NULL otherwise") { - GuiControl* control = object->getMouseControl(); + GuiControl* control = object->getMouseControl(); if (control) return control->getId(); @@ -2356,18 +2356,18 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, } DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, - "@brief Used to exclude/prevent all other instances using the same identifier specified\n\n" + "@brief Used to exclude/prevent all other instances using the same identifier specified\n\n" - "@note Not used on OSX, Xbox, or in Win debug builds\n\n" + "@note Not used on OSX, Xbox, or in Win debug builds\n\n" - "@param appIdentifier Name of the app set up for exclusive use.\n" + "@param appIdentifier Name of the app set up for exclusive use.\n" - "@return False if another app is running that specified the same appIdentifier\n\n" + "@return False if another app is running that specified the same appIdentifier\n\n" - "@ingroup Platform\n" - "@ingroup GuiCore") + "@ingroup Platform\n" + "@ingroup GuiCore") { - // mac/360 can only run one instance in general. + // mac/360 can only run one instance in general. #if !defined(TORQUE_OS_MAC) && !defined(TORQUE_OS_XENON) && !defined(TORQUE_DEBUG) && !defined(TORQUE_OS_LINUX) return Platform::excludeOtherInstances(appIdentifer); #else @@ -2377,82 +2377,82 @@ DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, } DefineEngineMethod( GuiCanvas, getExtent, Point2I, (),, - "@brief Returns the dimensions of the canvas\n\n" + "@brief Returns the dimensions of the canvas\n\n" - "@tsexample\n" - "%extent = Canvas.getExtent();\n" - "@endtsexample\n\n" + "@tsexample\n" + "%extent = Canvas.getExtent();\n" + "@endtsexample\n\n" - "@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"") + "@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"") { - return object->getExtent(); + return object->getExtent(); } DefineEngineMethod( GuiCanvas, setWindowTitle, void, ( const char* newTitle),, - "@brief Change the title of the OS window.\n\n" + "@brief Change the title of the OS window.\n\n" - "@param newTitle String containing the new name\n\n" + "@param newTitle String containing the new name\n\n" - "@tsexample\n" - "Canvas.setWindowTitle(\"Documentation Rocks!\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "Canvas.setWindowTitle(\"Documentation Rocks!\");\n" + "@endtsexample\n\n") { - object->setWindowTitle(newTitle); + object->setWindowTitle(newTitle); } DefineEngineMethod( GuiCanvas, findFirstMatchingMonitor, S32, (const char* name),, - "@brief Find the first monitor index that matches the given name.\n\n" + "@brief Find the first monitor index that matches the given name.\n\n" "The actual match algorithm depends on the implementation.\n" "@param name The name to search for.\n\n" - "@return The number of monitors attached to the system, including the default monoitor.") + "@return The number of monitors attached to the system, including the default monoitor.") { return PlatformWindowManager::get()->findFirstMatchingMonitor(name); } DefineEngineMethod( GuiCanvas, getMonitorCount, S32, (),, - "@brief Gets the number of monitors attached to the system.\n\n" + "@brief Gets the number of monitors attached to the system.\n\n" - "@return The number of monitors attached to the system, including the default monoitor.") + "@return The number of monitors attached to the system, including the default monoitor.") { return PlatformWindowManager::get()->getMonitorCount(); } DefineEngineMethod( GuiCanvas, getMonitorName, const char*, (S32 index),, - "@brief Gets the name of the requested monitor.\n\n" + "@brief Gets the name of the requested monitor.\n\n" "@param index The monitor index.\n\n" - "@return The name of the requested monitor.") + "@return The name of the requested monitor.") { return PlatformWindowManager::get()->getMonitorName(index); } DefineEngineMethod( GuiCanvas, getMonitorRect, RectI, (S32 index),, - "@brief Gets the region of the requested monitor.\n\n" + "@brief Gets the region of the requested monitor.\n\n" "@param index The monitor index.\n\n" - "@return The rectangular region of the requested monitor.") + "@return The rectangular region of the requested monitor.") { return PlatformWindowManager::get()->getMonitorRect(index); } DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),, - "@brief Gets the current screen mode as a string.\n\n" + "@brief Gets the current screen mode as a string.\n\n" - "The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). " - "You will need to parse out each one for individual use.\n\n" + "The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). " + "You will need to parse out each one for individual use.\n\n" - "@tsexample\n" - "%screenWidth = getWord(Canvas.getVideoMode(), 0);\n" - "%screenHeight = getWord(Canvas.getVideoMode(), 1);\n" - "%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n" - "%bitdepth = getWord(Canvas.getVideoMode(), 3);\n" - "%refreshRate = getWord(Canvas.getVideoMode(), 4);\n" - "@endtsexample\n\n" + "@tsexample\n" + "%screenWidth = getWord(Canvas.getVideoMode(), 0);\n" + "%screenHeight = getWord(Canvas.getVideoMode(), 1);\n" + "%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n" + "%bitdepth = getWord(Canvas.getVideoMode(), 3);\n" + "%refreshRate = getWord(Canvas.getVideoMode(), 4);\n" + "@endtsexample\n\n" - "@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.") + "@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.") { - // Grab the video mode. + // Grab the video mode. if (!object->getPlatformWindow()) return ""; @@ -2463,17 +2463,17 @@ DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),, DefineEngineMethod( GuiCanvas, getModeCount, S32, (),, - "@brief Gets the number of modes available on this device.\n\n" + "@brief Gets the number of modes available on this device.\n\n" - "@param param Description\n\n" + "@param param Description\n\n" - "@tsexample\n" - "%modeCount = Canvas.getModeCount()\n" - "@endtsexample\n\n" + "@tsexample\n" + "%modeCount = Canvas.getModeCount()\n" + "@endtsexample\n\n" - "@return The number of video modes supported by the device") + "@return The number of video modes supported by the device") { - if (!object->getPlatformWindow()) + if (!object->getPlatformWindow()) return 0; // Grab the available mode list from the device. @@ -2485,12 +2485,12 @@ DefineEngineMethod( GuiCanvas, getModeCount, S32, (),, } DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),, - "@brief Gets information on the specified mode of this device.\n\n" - "@param modeId Index of the mode to get data from.\n" - "@return A video mode string given an adapter and mode index.\n\n" - "@see GuiCanvas::getVideoMode()") + "@brief Gets information on the specified mode of this device.\n\n" + "@param modeId Index of the mode to get data from.\n" + "@return A video mode string given an adapter and mode index.\n\n" + "@see GuiCanvas::getVideoMode()") { - if (!object->getPlatformWindow()) + if (!object->getPlatformWindow()) return 0; // Grab the available mode list from the device. @@ -2515,14 +2515,14 @@ DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),, DefineEngineMethod( GuiCanvas, toggleFullscreen, void, (),, - "@brief toggle canvas from fullscreen to windowed mode or back.\n\n" + "@brief toggle canvas from fullscreen to windowed mode or back.\n\n" - "@tsexample\n" - "// If we are in windowed mode, the following will put is in fullscreen\n" - "Canvas.toggleFullscreen();" - "@endtsexample\n\n") + "@tsexample\n" + "// If we are in windowed mode, the following will put is in fullscreen\n" + "Canvas.toggleFullscreen();" + "@endtsexample\n\n") { - if (Platform::getWebDeployment()) + if (Platform::getWebDeployment()) return; if (!object->getPlatformWindow()) @@ -2693,7 +2693,7 @@ DefineConsoleMethod( GuiCanvas, setVideoMode, void, "\\param fullscreen Specify true to run fullscreen or false to run in a window\n" "\\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n" "\\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window" - "\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" ) + "\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" ) { if (!object->getPlatformWindow()) return; diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 5c4c09fb3..aa002f05d 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -716,16 +716,16 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) ctOffset = getCurrentAddSet()->localToGlobalCoord(Point2I(0,0)); RectI box(ctOffset.x, ctOffset.y, cext.x, cext.y); - box.inset( -5, -5 ); + box.inset( -5, -5 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); + box.inset( 1, 1 ); + drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); + box.inset( 1, 1 ); drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); - box.inset( 1, 1 ); - drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) ); } Vector::iterator i; bool multisel = mSelectedControls.size() > 1; @@ -2481,16 +2481,16 @@ DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." ) { - if (ctrl) - object->setContentControl(ctrl); + if (ctrl) + object->setContentControl(ctrl); } //----------------------------------------------------------------------------- DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { - if (ctrl) - object->addNewControl(ctrl); + if (ctrl) + object->addNewControl(ctrl); } //----------------------------------------------------------------------------- @@ -2518,7 +2518,7 @@ DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected co DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { - if (ctrl) + if (ctrl) object->setSelection(ctrl, false); } @@ -2526,7 +2526,7 @@ DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiContr DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)") { - if (addSet) + if (addSet) object->setCurrentAddSet(addSet); } diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index ea16d4728..688531a87 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -81,8 +81,8 @@ ConsoleDocClass( GuiMenuBar, "@tsexample\n" "new GuiMenuBar(newMenuBar)\n" "{\n" - " Padding = \"0\";\n" - " //Properties not specific to this control have been omitted from this example.\n" + " Padding = \"0\";\n" + " //Properties not specific to this control have been omitted from this example.\n" "};\n\n" "// Add a menu to the menu bar\n" "newMenuBar.addMenu(0,\"New Menu\");\n\n" @@ -105,7 +105,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMouseInMenu, void, (bool isInMenu),( isInMenu "// Mouse enters or persists within the menu, causing the callback to occur.\n" "GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -119,14 +119,14 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuSelect, void, ( S32 menuId, const char* me "// A menu has been selected, causing the callback to occur.\n" "GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" ); IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText ), - ( menuId, menuText, menuItemId, menuItemText ), + ( menuId, menuText, menuItemId, menuItemText ), "@brief Called whenever an item in a menu is selected.\n\n" "@param menuId Index id of the menu which contains the selected menu item\n" "@param menuText Text of the menu which contains the selected menu item\n\n" @@ -136,7 +136,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char "// A menu item has been selected, causing the callback to occur.\n" "GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -149,7 +149,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const ch "@tsexample\n" "GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n" "{\n" - " // Code to run when the callback occurs\n" + " // Code to run when the callback occurs\n" "}\n" "@endtsexample\n\n" "@see GuiTickCtrl\n\n" @@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId) } DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd), - ("","",0,nullAsType(),-1,""), + ("","",0,nullAsType(),-1,""), "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" "@param menu Menu name or menu Id to add the new item to.\n" "@param menuItemText Text for the new menu item.\n" @@ -637,7 +637,7 @@ DefineEngineMethod(GuiMenuBar, setMenuItemSubmenuState, void, (const char* menuT } DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText, - int submenuItemId, const char* accelerator, int checkGroup),, + int submenuItemId, const char* accelerator, int checkGroup),, "@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n" "@param menuTarget Menu to affect a submenu in\n" "@param menuItem Menu item to affect\n" @@ -814,21 +814,21 @@ void GuiMenuBar::addMenu(const char *menuText, U32 menuId) GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu) { - if(dIsdigit(menu[0])) - { - U32 id = dAtoi(menu); + if(dIsdigit(menu[0])) + { + U32 id = dAtoi(menu); for (U32 i = 0; i < mMenuList.size(); ++i) if (id == mMenuList[i]->id) return mMenuList[i]; - return NULL; - } - else - { + return NULL; + } + else + { for (U32 i = 0; i < mMenuList.size(); ++i) if (!dStricmp(menu, mMenuList[i]->text)) return mMenuList[i]; - return NULL; - } + return NULL; + } } GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem) @@ -981,13 +981,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt U32 id = dAtoi(menuItem); for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) if(id == walk->id) - { - if(walk->isSubmenu && walk->submenu) - { + { + if(walk->isSubmenu && walk->submenu) + { return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } + } + return NULL; + } return NULL; } else @@ -995,13 +995,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt // Search by name for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem) if(!dStricmp(menuItem, walk->text)) - { - if(walk->isSubmenu && walk->submenu) - { + { + if(walk->isSubmenu && walk->submenu) + { return GuiMenuBar::findMenuItem(walk->submenu, submenuItem); - } - return NULL; - } + } + return NULL; + } return NULL; } } @@ -1021,7 +1021,7 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, if(submenu && !submenu->isSubmenu) { Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text); - return; + return; } // allocate the new menu item @@ -1074,7 +1074,7 @@ void GuiMenuBar::removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem) if(menuItem && !menuItem->isSubmenu) { Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text); - return; + return; } GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem); @@ -1087,7 +1087,7 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem) if(menuitem && !menuitem->isSubmenu) { Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu"); - return; + return; } while(menuitem->submenu->firstMenuItem) @@ -1175,33 +1175,33 @@ void GuiMenuBar::onPreRender() if (!mMenuList[i]->visible) continue; - // Bounds depends on if there is a bitmap to be drawn or not + // Bounds depends on if there is a bitmap to be drawn or not if (mMenuList[i]->bitmapIndex == -1) - { + { // Text only mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); } else - { + { // Will the bitmap and text be draw? if (!mMenuList[i]->drawBitmapOnly) - { + { // Draw the bitmap and the text RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } else - { + } else + { // Only the bitmap will be drawn RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } - } + } + } curX += mMenuList[i]->bounds.extent.x; } - mouseOverMenu = NULL; - mouseDownMenu = NULL; + mouseOverMenu = NULL; + mouseDownMenu = NULL; } } @@ -1222,35 +1222,35 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) void GuiMenuBar::onMouseMove(const GuiEvent &event) { Menu *hit = findHitMenu(event.mousePoint); - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) + if(hit != mouseOverMenu) + { + // If we need to, reset the mouse over menu counter and indicate + // that we should track it. + if(hit) mMouseOverCounter = 0; - if(!mCountMouseOver) - { + if(!mCountMouseOver) + { // We've never started the counter, so start it. if(hit) mCountMouseOver = true; - } + } - mouseOverMenu = hit; - setUpdate(); - } + mouseOverMenu = hit; + setUpdate(); + } } void GuiMenuBar::onMouseLeave(const GuiEvent &event) { if(mouseOverMenu) - setUpdate(); - mouseOverMenu = NULL; + setUpdate(); + mouseOverMenu = NULL; // As we've left the control, don't track how long the mouse has been // within it. if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount) { - onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu + onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu } mCountMouseOver = false; mMouseOverCounter = 0; @@ -1259,38 +1259,38 @@ void GuiMenuBar::onMouseLeave(const GuiEvent &event) void GuiMenuBar::onMouseDragged(const GuiEvent &event) { Menu *hit = findHitMenu(event.mousePoint); - - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) + + if(hit != mouseOverMenu) + { + // If we need to, reset the mouse over menu counter and indicate + // that we should track it. + if(hit) mMouseOverCounter = 0; - if(!mCountMouseOver) - { + if(!mCountMouseOver) + { // We've never started the counter, so start it. if(hit) mCountMouseOver = true; - } + } - mouseOverMenu = hit; + mouseOverMenu = hit; mouseDownMenu = hit; - setUpdate(); + setUpdate(); onAction(); - } + } } void GuiMenuBar::onMouseDown(const GuiEvent &event) { mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint); - setUpdate(); + setUpdate(); onAction(); } void GuiMenuBar::onMouseUp(const GuiEvent &event) { mouseDownMenu = NULL; - setUpdate(); + setUpdate(); } void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) @@ -1320,20 +1320,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin; start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2; - // Draw the border + // Draw the border if (mMenuList[i]->drawBorder) - { + { RectI highlightBounds = bounds; highlightBounds.inset(1,1); if (mMenuList[i] == mouseDownMenu) renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL ); else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); - } + } - // Do we draw a bitmap? + // Do we draw a bitmap? if (mMenuList[i]->bitmapIndex != -1) - { + { S32 index = mMenuList[i]->bitmapIndex * 3; if (mMenuList[i] == mouseDownMenu) ++index; @@ -1342,24 +1342,24 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I bitmapstart(start); + Point2I bitmapstart(start); bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2; drawUtil->clearBitmapModulation(); drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect); - // Should we also draw the text? + // Should we also draw the text? if (!mMenuList[i]->drawBitmapOnly) - { + { start.x += mBitmapMargin; drawUtil->setBitmapModulation( fontColor ); drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } - } else - { + } + } else + { drawUtil->setBitmapModulation( fontColor ); drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } + } } renderChildControls( offset, updateRect ); @@ -1381,7 +1381,7 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator continue; } EventDescriptor accelEvent; - ActionMap::createEventDescriptor(item->accelerator, &accelEvent); + ActionMap::createEventDescriptor(item->accelerator, &accelEvent); //now we have a modifier, and a key, add them to the canvas inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags); @@ -1412,7 +1412,7 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) { // first, call the script callback for menu selection: onMenuSelect_callback(mMenuList[i]->id, mMenuList[i]->text); - + if(item->visible) menuItemSelected(mMenuList[i], item); return; @@ -1551,15 +1551,15 @@ void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event) void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell) { - // If this text list control is part of a submenu, then don't worry about - // passing this along - if(!isSubMenu) - { - RectI globalbounds(getBounds()); - Point2I globalpoint = localToGlobalCoord(globalbounds.point); - globalbounds.point = globalpoint; - mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); - } + // If this text list control is part of a submenu, then don't worry about + // passing this along + if(!isSubMenu) + { + RectI globalbounds(getBounds()); + Point2I globalpoint = localToGlobalCoord(globalbounds.point); + globalbounds.point = globalpoint; + mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); + } } //------------------------------------------------------------------------------ @@ -1582,9 +1582,9 @@ bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint) S32 yt = parentCoordPoint.y - getTop(); if(findHitControl(Point2I(xt,yt)) == this) - return false; + return false; else - return true; + return true; // return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight(); } @@ -1609,7 +1609,7 @@ void GuiMenuBar::onSleep() void GuiMenuBar::closeMenu() { // First close any open submenu - closeSubmenu(); + closeSubmenu(); // Get the selection from the text list: S32 selectionIndex = mTextList->getSelectedCell().y; @@ -1657,25 +1657,25 @@ void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Po } if(list) - { + { // If the highlighted item has changed... if(mouseOverSubmenu != list) - { + { closeSubmenu(); mouseOverSubmenu = NULL; // Check if this is a submenu. If so, open the submenu. if(list->isSubmenu) - { - // If there are submenu items, then open the submenu + { + // If there are submenu items, then open the submenu if(list->submenu->firstMenuItem) - { - mouseOverSubmenu = list; - onSubmenuAction(selstore, bounds, cellSize); - } - } - } - } + { + mouseOverSubmenu = list; + onSubmenuAction(selstore, bounds, cellSize); + } + } + } + } } } @@ -1745,11 +1745,11 @@ void GuiMenuBar::onAction() char buf[512]; - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if(walk->isSubmenu) - isSubmenu = 2; + // If this menu item is a submenu, then set the isSubmenu to 2 to indicate + // an arrow should be drawn. Otherwise set the isSubmenu normally. + char isSubmenu = 1; + if(walk->isSubmenu) + isSubmenu = 2; char bitmapIndex = 1; if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) @@ -1861,8 +1861,8 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2 char buf[512]; - // Can't have submenus within submenus. - char isSubmenu = 1; + // Can't have submenus within submenus. + char isSubmenu = 1; char bitmapIndex = 1; if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) @@ -1916,7 +1916,7 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2 void GuiMenuBar::closeSubmenu() { if(!mSubmenuBackground || !mSubmenuTextList) - return; + return; // Get the selection from the text list: S32 selectionIndex = mSubmenuTextList->getSelectedCell().y; @@ -1934,8 +1934,8 @@ void GuiMenuBar::closeSubmenu() if ( selectionIndex != -1 ) { MenuItem *list = NULL; - if(mouseOverSubmenu) - { + if(mouseOverSubmenu) + { list = mouseOverSubmenu->submenu->firstMenuItem; while(selectionIndex && list) @@ -1943,7 +1943,7 @@ void GuiMenuBar::closeSubmenu() list = list->nextMenuItem; selectionIndex--; } - } + } if(list) menuItemSelected(list->submenuParentMenu, list); } @@ -1981,13 +1981,13 @@ void GuiMenuBar::processTick() { // If we're at a particular number of ticks, notify the script function if(mMouseOverCounter < mMouseHoverAmount) - { + { ++mMouseOverCounter; - } else if(mMouseOverCounter == mMouseHoverAmount) - { + } else if(mMouseOverCounter == mMouseHoverAmount) + { ++mMouseOverCounter; - onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu - } + onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu + } } } diff --git a/Engine/source/lighting/lightManager.cpp b/Engine/source/lighting/lightManager.cpp index 2f8ddd5ee..58f0949c2 100644 --- a/Engine/source/lighting/lightManager.cpp +++ b/Engine/source/lighting/lightManager.cpp @@ -306,7 +306,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, GFXShaderConstHandle *lightInvRadiusSqSC, GFXShaderConstHandle *lightSpotDirSC, GFXShaderConstHandle *lightSpotAngleSC, - GFXShaderConstHandle *lightSpotFalloffSC, + GFXShaderConstHandle *lightSpotFalloffSC, GFXShaderConstBuffer *shaderConsts ) { PROFILE_SCOPE( LightManager_Update4LightConsts ); @@ -317,7 +317,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, lightInvRadiusSqSC->isValid() || lightSpotDirSC->isValid() || lightSpotAngleSC->isValid() || - lightSpotFalloffSC->isValid() ) + lightSpotFalloffSC->isValid() ) { PROFILE_SCOPE( LightManager_Update4LightConsts_setLights ); @@ -326,7 +326,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, static AlignedArray lightColors( 4, sizeof( Point4F ) ); static Point4F lightInvRadiusSq; static Point4F lightSpotAngle; - static Point4F lightSpotFalloff; + static Point4F lightSpotFalloff; F32 range; // Need to clear the buffers so that we don't leak @@ -359,10 +359,10 @@ void LightManager::_update4LightConsts( const SceneData &sgData, lightSpotDirs[2][i] = lightDir.z; if ( light->getType() == LightInfo::Spot ) - { + { lightSpotAngle[i] = mCos( mDegToRad( light->getOuterConeAngle() / 2.0f ) ); - lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] ); - } + lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] ); + } // Prescale the light color by the brightness to // avoid doing this in the shader. @@ -379,7 +379,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData, shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs ); shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle ); - shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff ); + shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff ); } diff --git a/Engine/source/platform/platformNet.h b/Engine/source/platform/platformNet.h index 4e8de1d70..c07c2d9f6 100644 --- a/Engine/source/platform/platformNet.h +++ b/Engine/source/platform/platformNet.h @@ -78,8 +78,8 @@ struct NetAddress bool isSameAddress(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; switch (type) { @@ -102,32 +102,32 @@ struct NetAddress bool isSameAddressAndPort(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; - switch (type) - { - case NetAddress::IPAddress: - return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port; - break; - case NetAddress::IPV6Address: - return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port; - break; - case NetAddress::IPBroadcastAddress: - return true; - break; - case NetAddress::IPV6MulticastAddress: - return true; - break; - } + switch (type) + { + case NetAddress::IPAddress: + return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port; + break; + case NetAddress::IPV6Address: + return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port; + break; + case NetAddress::IPBroadcastAddress: + return true; + break; + case NetAddress::IPV6MulticastAddress: + return true; + break; + } - return false; + return false; } bool isEqual(const NetAddress &other) const { - if (type != other.type) - return false; + if (type != other.type) + return false; switch (type) { @@ -193,7 +193,7 @@ struct Net WouldBlock, NotASocket, UnknownError, - NeedHostLookup + NeedHostLookup }; enum ConnectionState { @@ -214,11 +214,11 @@ struct Net static bool smMulticastEnabled; static bool smIpv4Enabled; static bool smIpv6Enabled; - - static ConnectionNotifyEvent* smConnectionNotify; - static ConnectionAcceptedEvent* smConnectionAccept; - static ConnectionReceiveEvent* smConnectionReceive; - static PacketReceiveEvent* smPacketReceive; + + static ConnectionNotifyEvent* smConnectionNotify; + static ConnectionAcceptedEvent* smConnectionAccept; + static ConnectionReceiveEvent* smConnectionReceive; + static PacketReceiveEvent* smPacketReceive; static bool init(); diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 7460ad315..c8f68915b 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -135,26 +135,26 @@ U32 endHighResolutionTimer(U32 time[2]) void startHighResolutionTimer(U32 time[2]) { - U64 now = mach_absolute_time(); - AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); - memcpy(time, &now, sizeof(U64)); + U64 now = mach_absolute_time(); + AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); + memcpy(time, &now, sizeof(U64)); } U32 endHighResolutionTimer(U32 time[2]) { - static mach_timebase_info_data_t sTimebaseInfo = {0, 0}; - - U64 now = mach_absolute_time(); - AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); - U64 then; - memcpy(&then, time, sizeof(U64)); - - if(sTimebaseInfo.denom == 0){ - mach_timebase_info(&sTimebaseInfo); - } - // Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing. - U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom; - - return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow + static mach_timebase_info_data_t sTimebaseInfo = {0, 0}; + + U64 now = mach_absolute_time(); + AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]"); + U64 then; + memcpy(&then, time, sizeof(U64)); + + if(sTimebaseInfo.denom == 0){ + mach_timebase_info(&sTimebaseInfo); + } + // Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing. + U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom; + + return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow } #else @@ -730,37 +730,37 @@ DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool //----------------------------------------------------------------------------- DefineEngineFunction( profilerEnable, void, ( bool enable ),, - "@brief Enables or disables the profiler.\n\n" - "Data is only gathered while the profiler is enabled.\n\n" - "@note Profiler is not available in shipping builds.\n" - "T3D has predefined profiling areas surrounded by markers, " - "but you may need to define additional markers (in C++) around areas you wish to profile," - " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" - "@ingroup Debugging\n" ) + "@brief Enables or disables the profiler.\n\n" + "Data is only gathered while the profiler is enabled.\n\n" + "@note Profiler is not available in shipping builds.\n" + "T3D has predefined profiling areas surrounded by markers, " + "but you may need to define additional markers (in C++) around areas you wish to profile," + " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" + "@ingroup Debugging\n" ) { if(gProfiler) gProfiler->enable(enable); } DefineEngineFunction(profilerDump, void, (),, - "@brief Dumps current profiling stats to the console window.\n\n" - "@note Markers disabled with profilerMarkerEnable() will be skipped over. " - "If the profiler is currently running, it will be disabled.\n" - "@ingroup Debugging") + "@brief Dumps current profiling stats to the console window.\n\n" + "@note Markers disabled with profilerMarkerEnable() will be skipped over. " + "If the profiler is currently running, it will be disabled.\n" + "@ingroup Debugging") { if(gProfiler) gProfiler->dumpToConsole(); } DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),, - "@brief Dumps current profiling stats to a file.\n\n" - "@note If the profiler is currently running, it will be disabled.\n" - "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " - "Will attempt to create the file if it does not already exist.\n" - "@tsexample\n" - "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" - "@endtsexample\n\n" - "@ingroup Debugging" ) + "@brief Dumps current profiling stats to a file.\n\n" + "@note If the profiler is currently running, it will be disabled.\n" + "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " + "Will attempt to create the file if it does not already exist.\n" + "@tsexample\n" + "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" + "@endtsexample\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->dumpToFile(fileName); @@ -768,9 +768,9 @@ DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),, DefineEngineFunction( profilerReset, void, (),, "@brief Resets the profiler, clearing it of all its data.\n\n" - "If the profiler is currently running, it will first be disabled. " - "All markers will retain their current enabled/disabled status.\n\n" - "@ingroup Debugging" ) + "If the profiler is currently running, it will first be disabled. " + "All markers will retain their current enabled/disabled status.\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->reset(); diff --git a/Engine/source/platformMac/macFileIO.mm b/Engine/source/platformMac/macFileIO.mm index 2815b5af4..b6fae59d1 100644 --- a/Engine/source/platformMac/macFileIO.mm +++ b/Engine/source/platformMac/macFileIO.mm @@ -68,54 +68,54 @@ bool dFileTouch(const char *path) //----------------------------------------------------------------------------- bool dPathCopy(const char* source, const char* dest, bool nooverwrite) { - if(source == NULL || dest == NULL) - return false; - - @autoreleasepool { - NSFileManager *manager = [NSFileManager defaultManager]; - - NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; - NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; - NSString *ndestFolder = [ndest stringByDeletingLastPathComponent]; - - if(! [manager fileExistsAtPath:nsource]) - { - Con::errorf("dPathCopy: no file exists at %s",source); - return false; - } - - if( [manager fileExistsAtPath:ndest] ) - { - if(nooverwrite) - { - Con::errorf("dPathCopy: file already exists at %s",dest); - return false; - } - Con::warnf("Deleting files at path: %s", dest); - if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest]) - { - Con::errorf("Copy failed! Could not delete files at path: %s", dest); - return false; - } - } - - if([manager fileExistsAtPath:ndestFolder] == NO) - { - ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash - Platform::createPath([ndestFolder UTF8String]); - } - - bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil]; - // n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify - // because this is surprising behavior for a method called copy. - if( ![manager fileExistsAtPath:ndest] ) - { - Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening"); - ret = false; - } - return ret; - } - + if(source == NULL || dest == NULL) + return false; + + @autoreleasepool { + NSFileManager *manager = [NSFileManager defaultManager]; + + NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; + NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; + NSString *ndestFolder = [ndest stringByDeletingLastPathComponent]; + + if(! [manager fileExistsAtPath:nsource]) + { + Con::errorf("dPathCopy: no file exists at %s",source); + return false; + } + + if( [manager fileExistsAtPath:ndest] ) + { + if(nooverwrite) + { + Con::errorf("dPathCopy: file already exists at %s",dest); + return false; + } + Con::warnf("Deleting files at path: %s", dest); + if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest]) + { + Con::errorf("Copy failed! Could not delete files at path: %s", dest); + return false; + } + } + + if([manager fileExistsAtPath:ndestFolder] == NO) + { + ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash + Platform::createPath([ndestFolder UTF8String]); + } + + bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil]; + // n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify + // because this is surprising behavior for a method called copy. + if( ![manager fileExistsAtPath:ndest] ) + { + Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening"); + ret = false; + } + return ret; + } + } //----------------------------------------------------------------------------- @@ -124,36 +124,36 @@ bool dFileRename(const char *source, const char *dest) { if(source == NULL || dest == NULL) return false; - - @autoreleasepool { - NSFileManager *manager = [NSFileManager defaultManager]; - - NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; - NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; - - if(! [manager fileExistsAtPath:nsource]) - { - Con::errorf("dFileRename: no file exists at %s",source); - return false; - } - - if( [manager fileExistsAtPath:ndest] ) - { - Con::warnf("dFileRename: Deleting files at path: %s", dest); - } - - bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil]; - // n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify - // because this is surprising behavior for a method called rename. - - if( ![manager fileExistsAtPath:ndest] ) - { - Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening"); - ret = false; - } - - return ret; - } + + @autoreleasepool { + NSFileManager *manager = [NSFileManager defaultManager]; + + NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)]; + NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)]; + + if(! [manager fileExistsAtPath:nsource]) + { + Con::errorf("dFileRename: no file exists at %s",source); + return false; + } + + if( [manager fileExistsAtPath:ndest] ) + { + Con::warnf("dFileRename: Deleting files at path: %s", dest); + } + + bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil]; + // n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify + // because this is surprising behavior for a method called rename. + + if( ![manager fileExistsAtPath:ndest] ) + { + Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening"); + ret = false; + } + + return ret; + } } //----------------------------------------------------------------------------- @@ -857,7 +857,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve while (d = readdir(dip)) { - bool isDir; + bool isDir; isDir = false; if (d->d_type == DT_UNKNOWN) { diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index fbcd485aa..7ccb8b0b6 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -892,7 +892,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } @@ -991,7 +991,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } @@ -1088,7 +1088,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en *info = ri; info->point.interpolate(start, end, info->t); currentT = ri.t; - info->distance = (start - info->point).len(); + info->distance = (start - info->point).len(); } } } diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index a1b5c6ac2..88bcde89e 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -36,138 +36,138 @@ IMPLEMENT_CONOBJECT(ActionMap); ConsoleDocClass( ActionMap, - "@brief ActionMaps assign platform input events to console commands.\n\n" + "@brief ActionMaps assign platform input events to console commands.\n\n" - "Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick " - "or some other input device. This allows users of the game to map keys and actions according to their own preferences. " - "Game action maps are arranged in a stack for processing so individual parts of the game can define specific " - "actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n" + "Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick " + "or some other input device. This allows users of the game to map keys and actions according to their own preferences. " + "Game action maps are arranged in a stack for processing so individual parts of the game can define specific " + "actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n" - "@section ActionMap_creation Creating an ActionMap\n" + "@section ActionMap_creation Creating an ActionMap\n" - "The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple " - "three step process.\n\n" - "1. Check to see if the ActionMap exists\n" - "2. Delete it if it exists\n" - "3. Instantiate the ActionMap\n\n" + "The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple " + "three step process.\n\n" + "1. Check to see if the ActionMap exists\n" + "2. Delete it if it exists\n" + "3. Instantiate the ActionMap\n\n" - "The following is an example of how to create a new ActionMap:\n" + "The following is an example of how to create a new ActionMap:\n" - "@tsexample\n" - "if ( isObject( moveMap ) )\n" - " moveMap.delete();\n" - "new ActionMap(moveMap);" - "@endtsexample\n\n\n" - - "@section ActionMap_binding Binding Functions\n" - "Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n" - "* Mouse\n\n" - "* Keyboard\n\n" - "* Joystick/Gamepad\n\n" - "* Xbox 360 Controller\n\n" + "@tsexample\n" + "if ( isObject( moveMap ) )\n" + " moveMap.delete();\n" + "new ActionMap(moveMap);" + "@endtsexample\n\n\n" + + "@section ActionMap_binding Binding Functions\n" + "Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n" + "* Mouse\n\n" + "* Keyboard\n\n" + "* Joystick/Gamepad\n\n" + "* Xbox 360 Controller\n\n" - "The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, " + "The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, " "but different in how the event is interpreted. With bind(), " - "you specify a device, action to bind, then a function to be called when the event happens.\n\n" + "you specify a device, action to bind, then a function to be called when the event happens.\n\n" - "@tsexample\n" - "// Simple function that prints to console\n" - "// %val - Sent by the device letting the user know\n" - "// if an input was pressed (true) or released (false)\n" - "function testInput(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Key is down\");\n" - " else\n" - " echo(\"Key was released\");\n" - "}\n\n" - "// Bind the \'K\' key to the testInput function\n" - "moveMap.bind(keyboard, \"k\", testInput);\n\n" - "@endtsexample\n\n\n" + "@tsexample\n" + "// Simple function that prints to console\n" + "// %val - Sent by the device letting the user know\n" + "// if an input was pressed (true) or released (false)\n" + "function testInput(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Key is down\");\n" + " else\n" + " echo(\"Key was released\");\n" + "}\n\n" + "// Bind the \'K\' key to the testInput function\n" + "moveMap.bind(keyboard, \"k\", testInput);\n\n" + "@endtsexample\n\n\n" - "bindCmd is an alternative method for binding commands. This function is similar to bind(), " + "bindCmd is an alternative method for binding commands. This function is similar to bind(), " "except two functions are set to be called when the event is processed.\n\n" - "One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). " + "One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). " "When using bindCmd(), pass the functions as strings rather than the function names.\n\n" - "@tsexample\n" - "// Print to the console when the spacebar is pressed\n" - "function onSpaceDown()\n" - "{\n" - " echo(\"Space bar down!\");\n" - "}\n\n" + "@tsexample\n" + "// Print to the console when the spacebar is pressed\n" + "function onSpaceDown()\n" + "{\n" + " echo(\"Space bar down!\");\n" + "}\n\n" - "// Print to the console when the spacebar is released\n" - "function onSpaceUp()\n" - "{\n" - " echo(\"Space bar up!\");\n" - "}\n\n" + "// Print to the console when the spacebar is released\n" + "function onSpaceUp()\n" + "{\n" + " echo(\"Space bar up!\");\n" + "}\n\n" - "// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n" - "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" - "@endtsexample\n\n" - - "@section ActionMap_switching Switching ActionMaps\n" - "Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls " - "in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n" + "// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n" + "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" + "@endtsexample\n\n" + + "@section ActionMap_switching Switching ActionMaps\n" + "Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls " + "in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n" - "First, create two separate ActionMaps:\n\n" - "@tsexample\n" - "// Create the two ActionMaps\n" - "if ( isObject( moveMap ) )\n" - " moveMap.delete();\n" - "new ActionMap(moveMap);\n\n" - "if ( isObject( carMap ) )\n" - " carMap.delete();\n" - "new ActionMap(carMap);\n\n" - "@endtsexample\n\n" + "First, create two separate ActionMaps:\n\n" + "@tsexample\n" + "// Create the two ActionMaps\n" + "if ( isObject( moveMap ) )\n" + " moveMap.delete();\n" + "new ActionMap(moveMap);\n\n" + "if ( isObject( carMap ) )\n" + " carMap.delete();\n" + "new ActionMap(carMap);\n\n" + "@endtsexample\n\n" - "Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n" - "@tsexample\n" - "// Print to the console the player is jumping\n" - "function playerJump(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Player jumping!\");\n" - "}\n\n" - "// Print to the console the vehicle is charging\n" - "function turboCharge()\n" - "{\n" - " if(%val)\n" - " echo(\"Vehicle turbo charging!\");\n" - "}\n" - "@endtsexample\n\n" - - "You are now ready to bind functions to your ActionMaps' devices:\n\n" + "Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n" + "@tsexample\n" + "// Print to the console the player is jumping\n" + "function playerJump(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Player jumping!\");\n" + "}\n\n" + "// Print to the console the vehicle is charging\n" + "function turboCharge()\n" + "{\n" + " if(%val)\n" + " echo(\"Vehicle turbo charging!\");\n" + "}\n" + "@endtsexample\n\n" + + "You are now ready to bind functions to your ActionMaps' devices:\n\n" - "@tsexample\n" - "// Bind the spacebar to the playerJump function\n" - "// when moveMap is the active ActionMap\n" - "moveMap.bind(keyboard, \"space\", playerJump);\n\n" - "// Bind the spacebar to the turboCharge function\n" - "// when carMap is the active ActionMap\n" - "carMap.bind(keyboard, \"space\", turboCharge);\n" - "@endtsexample\n" + "@tsexample\n" + "// Bind the spacebar to the playerJump function\n" + "// when moveMap is the active ActionMap\n" + "moveMap.bind(keyboard, \"space\", playerJump);\n\n" + "// Bind the spacebar to the turboCharge function\n" + "// when carMap is the active ActionMap\n" + "carMap.bind(keyboard, \"space\", turboCharge);\n" + "@endtsexample\n" - "Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n" + "Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n" - "@tsexample\n" - "// Make moveMap the active action map\n" - "// You should now be able to activate playerJump with spacebar\n" - "moveMap.push();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Make moveMap the active action map\n" + "// You should now be able to activate playerJump with spacebar\n" + "moveMap.push();\n" + "@endtsexample\n\n" - "To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n" + "To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n" - "@tsexample\n" - "// Deactivate moveMap\n" - "moveMap.pop();\n\n" - "// Activate carMap\n" - "carMap.push();\n\n" - "@endtsexample\n\n\n" + "@tsexample\n" + "// Deactivate moveMap\n" + "moveMap.pop();\n\n" + "// Activate carMap\n" + "carMap.push();\n\n" + "@endtsexample\n\n\n" - "@ingroup Input" - + "@ingroup Input" + ); // This is used for determing keys that have ascii codes for the foreign keyboards. IsAlpha doesn't work on foreign keys. @@ -775,32 +775,32 @@ const char* ActionMap::getBinding( const char* command ) // const char* ActionMap::getCommand( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::BindCmd ) - { - S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2; - char* returnString = Con::getReturnBuffer( bufferLen ); - dSprintf( returnString, bufferLen, "%s\t%s", - ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ), - ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); - return( returnString ); - } - else - return( mapNode->consoleFunction ); - } - } - } + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::BindCmd ) + { + S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2; + char* returnString = Con::getReturnBuffer( bufferLen ); + dSprintf( returnString, bufferLen, "%s\t%s", + ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ), + ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); + return( returnString ); + } + else + return( mapNode->consoleFunction ); + } + } + } - return( "" ); + return( "" ); } //------------------------------------------------------------------------------ @@ -808,92 +808,92 @@ const char* ActionMap::getCommand( const char* device, const char* action ) // Obviously, this should only be used for axes. bool ActionMap::isInverted( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - return( mapNode->flags & Node::Inverted ); - } - } + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + return( mapNode->flags & Node::Inverted ); + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( false ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( false ); } //------------------------------------------------------------------------------ F32 ActionMap::getScale( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::HasScale ) - return( mapNode->scaleFactor ); + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::HasScale ) + return( mapNode->scaleFactor ); else return( 1.0f ); } - } - } + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( 1.0f ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( 1.0f ); } //------------------------------------------------------------------------------ const char* ActionMap::getDeadZone( const char* device, const char* action ) { - U32 deviceType; - U32 deviceInst; - if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) - { - EventDescriptor eventDescriptor; - if ( createEventDescriptor( action, &eventDescriptor ) ) - { - const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); - if ( mapNode ) - { - if ( mapNode->flags & Node::HasDeadZone ) + U32 deviceType; + U32 deviceInst; + if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) + { + EventDescriptor eventDescriptor; + if ( createEventDescriptor( action, &eventDescriptor ) ) + { + const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); + if ( mapNode ) + { + if ( mapNode->flags & Node::HasDeadZone ) { - char buf[64]; - dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); - char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf ); - return( returnString ); - } - else - return( "0 0" ); - } - } - } + char buf[64]; + dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); + char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); + dStrcpy( returnString, buf ); + return( returnString ); + } + else + return( "0 0" ); + } + } + } - Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); - return( "" ); + Con::errorf( "The input event specified by %s %s is not in this action map!", device, action ); + return( "" ); } //------------------------------------------------------------------------------ const char* ActionMap::buildActionString( const InputEventInfo* event ) { - const char* modifierString = getModifierString( event->modifier ); + const char* modifierString = getModifierString( event->modifier ); - char objectBuffer[64]; - if ( !getKeyString( event->objInst, objectBuffer ) ) - return( "" ); + char objectBuffer[64]; + if ( !getKeyString( event->objInst, objectBuffer ) ) + return( "" ); - U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2; - char* returnString = Con::getReturnBuffer( returnLen ); - dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer ); - return( returnString ); + U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2; + char* returnString = Con::getReturnBuffer( returnLen ); + dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer ); + return( returnString ); } //------------------------------------------------------------------------------ @@ -989,15 +989,15 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch //------------------------------------------------------------------------------ const char* ActionMap::getModifierString(const U32 modifiers) { - U32 realModifiers = modifiers; - if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT ) - realModifiers |= SI_SHIFT; - if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL ) - realModifiers |= SI_CTRL; - if ( modifiers & SI_LALT || modifiers & SI_RALT ) - realModifiers |= SI_ALT; - if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT ) - realModifiers |= SI_MAC_OPT; + U32 realModifiers = modifiers; + if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT ) + realModifiers |= SI_SHIFT; + if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL ) + realModifiers |= SI_CTRL; + if ( modifiers & SI_LALT || modifiers & SI_RALT ) + realModifiers |= SI_ALT; + if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT ) + realModifiers |= SI_MAC_OPT; switch (realModifiers & (SI_SHIFT|SI_CTRL|SI_ALT|SI_MAC_OPT)) { @@ -1820,19 +1820,19 @@ static ConsoleDocFragment _ActionMapbind1( "@param command The function to bind to the action. Function must have a single boolean argument.\n" "@return True if the binding was successful, false if the device was unknown or description failed.\n\n" "@tsexample\n" - "// Simple function that prints to console\n" - "// %val - Sent by the device letting the user know\n" - "// if an input was pressed (true) or released (false)\n" - "function testInput(%val)\n" - "{\n" - " if(%val)\n" - " echo(\"Key is down\");\n" - " else\n" - " echo(\"Key was released\");\n" - "}\n\n" - "// Bind the \'K\' key to the testInput function\n" - "moveMap.bind(keyboard, k, testInput);\n\n" - "@endtsexample\n\n\n", + "// Simple function that prints to console\n" + "// %val - Sent by the device letting the user know\n" + "// if an input was pressed (true) or released (false)\n" + "function testInput(%val)\n" + "{\n" + " if(%val)\n" + " echo(\"Key is down\");\n" + " else\n" + " echo(\"Key was released\");\n" + "}\n\n" + "// Bind the \'K\' key to the testInput function\n" + "moveMap.bind(keyboard, k, testInput);\n\n" + "@endtsexample\n\n\n", "ActionMap", "bool bind( string device, string action, string command );"); @@ -1854,22 +1854,22 @@ static ConsoleDocFragment _ActionMapbind2( "@param command The function bound to the action. Must take in a single argument.\n" "@return True if the binding was successful, false if the device was unknown or description failed.\n\n" "@tsexample\n" - "// Simple function that adjusts the pitch of the camera based on the " + "// Simple function that adjusts the pitch of the camera based on the " "mouse's movement along the X axis.\n" - "function testPitch(%val)\n" - "{\n" - " %pitchAdj = getMouseAdjustAmount(%val);\n" - " $mvPitch += %pitchAdj;\n" - "}\n\n" - "// Bind the mouse's X axis to the testPitch function\n" - "// DI is flagged, meaning input is inverted and has a deadzone\n" - "%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n" - "@endtsexample\n\n\n", + "function testPitch(%val)\n" + "{\n" + " %pitchAdj = getMouseAdjustAmount(%val);\n" + " $mvPitch += %pitchAdj;\n" + "}\n\n" + "// Bind the mouse's X axis to the testPitch function\n" + "// DI is flagged, meaning input is inverted and has a deadzone\n" + "%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n" + "@endtsexample\n\n\n", "ActionMap", "bool bind( string device, string action, string flag, string deadZone, string scale, string command );"); ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )" - "@hide") + "@hide") { StringStackWrapper args(argc - 2, argv + 2); return object->processBind( args.count(), args, NULL ); @@ -1918,7 +1918,7 @@ static ConsoleDocFragment _ActionMapbindObj2( "bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );"); ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)" - "@hide") + "@hide") { SimObject* simObject = Sim::findObject(argv[argc - 1]); if ( simObject == NULL ) @@ -1941,20 +1941,20 @@ DefineEngineMethod( ActionMap, bindCmd, bool, ( const char* device, const char* "@param makeCmd The command to execute when the device/action is made.\n" "@param breakCmd [optional] The command to execute when the device or action is unmade.\n" "@return True the bind was successful, false if the device was unknown or description failed.\n" - "@tsexample\n" - "// Print to the console when the spacebar is pressed\n" - "function onSpaceDown()\n" - "{\n" - " echo(\"Space bar down!\");\n" - "}\n\n" - "// Print to the console when the spacebar is released\n" - "function onSpaceUp()\n" - "{\n" - " echo(\"Space bar up!\");\n" - "}\n\n" + "@tsexample\n" + "// Print to the console when the spacebar is pressed\n" + "function onSpaceDown()\n" + "{\n" + " echo(\"Space bar down!\");\n" + "}\n\n" + "// Print to the console when the spacebar is released\n" + "function onSpaceUp()\n" + "{\n" + " echo(\"Space bar up!\");\n" + "}\n\n" "// Bind the commands onSpaceDown() and onSpaceUp() to spacebar events\n\n" - "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" - "@endtsexample\n\n") + "moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n" + "@endtsexample\n\n") { return object->processBindCmd( device, action, makeCmd, breakCmd ); } @@ -1964,9 +1964,9 @@ DefineEngineMethod( ActionMap, unbind, bool, ( const char* device, const char* a "@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n" "@return True if the unbind was successful, false if the device was unknown or description failed.\n\n" - "@tsexample\n" - "moveMap.unbind(\"keyboard\", \"space\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "moveMap.unbind(\"keyboard\", \"space\");\n" + "@endtsexample\n\n") { return object->processUnbind( device, action ); } @@ -1977,7 +1977,7 @@ DefineEngineMethod( ActionMap, unbindObj, bool, ( const char* device, const char "@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n" "@param obj The object to perform unbind against.\n" "@return True if the unbind was successful, false if the device was unknown or description failed.\n" - "@tsexample\n" + "@tsexample\n" "moveMap.unbindObj(\"keyboard\", \"numpad1\", \"rangeChange\", %player);" "@endtsexample\n\n\n") { @@ -1996,10 +1996,10 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ) "@param fileName The file path to save the ActionMap to. If a filename is not specified " " the ActionMap will be dumped to the console.\n" "@param append Whether to write the ActionMap at the end of the file or overwrite it.\n" - "@tsexample\n" - "// Write out the actionmap into the config.cs file\n" + "@tsexample\n" + "// Write out the actionmap into the config.cs file\n" "moveMap.save( \"scripts/client/config.cs\" );" - "@endtsexample\n\n") + "@endtsexample\n\n") { char buffer[1024]; @@ -2015,7 +2015,7 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append ) DefineEngineFunction( getCurrentActionMap, ActionMap*, (),, "@brief Returns the current %ActionMap.\n" "@see ActionMap" - "@ingroup Input") + "@ingroup Input") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); return dynamic_cast< ActionMap* >( pActionMapSet->last() ); @@ -2024,10 +2024,10 @@ DefineEngineFunction( getCurrentActionMap, ActionMap*, (),, DefineEngineMethod( ActionMap, push, void, (),, "@brief Push the ActionMap onto the %ActionMap stack.\n\n" "Activates an ActionMap and placees it at the top of the ActionMap stack.\n\n" - "@tsexample\n" - "// Make moveMap the active action map\n" - "moveMap.push();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Make moveMap the active action map\n" + "moveMap.push();\n" + "@endtsexample\n\n" "@see ActionMap") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); @@ -2037,10 +2037,10 @@ DefineEngineMethod( ActionMap, push, void, (),, DefineEngineMethod( ActionMap, pop, void, (),, "@brief Pop the ActionMap off the %ActionMap stack.\n\n" "Deactivates an %ActionMap and removes it from the @ActionMap stack.\n" - "@tsexample\n" - "// Deactivate moveMap\n" - "moveMap.pop();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Deactivate moveMap\n" + "moveMap.pop();\n" + "@endtsexample\n\n" "@see ActionMap") { SimSet* pActionMapSet = Sim::getActiveActionMapSet(); @@ -2053,20 +2053,20 @@ DefineEngineMethod( ActionMap, getBinding, const char*, ( const char* command ), "@param command The function to search bindings for.\n" "@return The binding against the specified command. Returns an empty string(\"\") " "if a binding wasn't found.\n" - "@tsexample\n" - "// Find what the function \"jump()\" is bound to in moveMap\n" - "%bind = moveMap.getBinding( \"jump\" );\n\n" - "if ( %bind !$= \"\" )\n" - "{\n" - "// Find out what device is used in the binding\n" - " %device = getField( %bind, 0 );\n\n" - "// Find out what action (such as a key) is used in the binding\n" - " %action = getField( %bind, 1 );\n" - "}\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Find what the function \"jump()\" is bound to in moveMap\n" + "%bind = moveMap.getBinding( \"jump\" );\n\n" + "if ( %bind !$= \"\" )\n" + "{\n" + "// Find out what device is used in the binding\n" + " %device = getField( %bind, 0 );\n\n" + "// Find out what action (such as a key) is used in the binding\n" + " %action = getField( %bind, 1 );\n" + "}\n" + "@endtsexample\n\n" "@see getField") { - return object->getBinding( command ); + return object->getBinding( command ); } DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, const char* action ),, @@ -2074,15 +2074,15 @@ DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, co "@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return The command against the specified device and action.\n" - "@tsexample\n" - "// Find what function is bound to a device\'s action\n" - "// In this example, \"jump()\" was assigned to the space key in another script\n" - "%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n" - "// Should print \"jump\" in the console\n" - "echo(%command)\n" - "@endtsexample\n\n") + "@tsexample\n" + "// Find what function is bound to a device\'s action\n" + "// In this example, \"jump()\" was assigned to the space key in another script\n" + "%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n" + "// Should print \"jump\" in the console\n" + "echo(%command)\n" + "@endtsexample\n\n") { - return object->getCommand( device, action ); + return object->getCommand( device, action ); } DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const char* action ),, @@ -2091,12 +2091,12 @@ DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const cha "@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return True if the specified device and action is inverted.\n" - "@tsexample\n" + "@tsexample\n" "%if ( moveMap.isInverted( \"mouse\", \"xaxis\"))\n" " echo(\"Mouse's xAxis is inverted\");" - "@endtsexample\n\n") + "@endtsexample\n\n") { - return object->isInverted( device, action ); + return object->isInverted( device, action ); } DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* action ),, @@ -2104,11 +2104,11 @@ DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* "@param device The device that was bound. Can be keyboard, mouse, joystick or gamepad.\n" "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return Any scaling applied to the specified device and action.\n" - "@tsexample\n" - "%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n" + "@endtsexample\n\n") { - return object->getScale( device, action ); + return object->getScale( device, action ); } DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, const char* action ),, @@ -2117,11 +2117,11 @@ DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, c "@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n" "@return The dead zone for the specified device and action. Returns \"0 0\" if there is no dead zone " "or an empty string(\"\") if the mapping was not found.\n" - "@tsexample\n" - "%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n" - "@endtsexample\n\n") + "@tsexample\n" + "%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n" + "@endtsexample\n\n") { - return object->getDeadZone( device, action ); + return object->getDeadZone( device, action ); } //------------------------------------------------------------------------------ diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index 78c3a8f9f..f3de7f490 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -97,7 +97,7 @@ public: { eCommandType type; // Command type StringTableEntry name; // Command name - static constexpr U32 MAX_ARGS = 10; + static constexpr U32 MAX_ARGS = 10; String argv[MAX_ARGS]; // Command arguments S32 argc; // Number of arguments Command() : type(CmdInvalid), name(0), argc(0) { } @@ -106,12 +106,12 @@ public: { name = StringTable->insert( _name ); } - - // Helper functions to fill in the command arguments - template inline void addArgs(ArgTs ...args){ - using Helper = engineAPI::detail::MarshallHelpers; - Helper::marshallEach(argc, argv, args...); - } + + // Helper functions to fill in the command arguments + template inline void addArgs(ArgTs ...args){ + using Helper = engineAPI::detail::MarshallHelpers; + Helper::marshallEach(argc, argv, args...); + } }; Vector mCommands; From a7cb22b8777a6261d3f1a759c83579f7ac200e17 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 18:41:47 -0500 Subject: [PATCH 14/21] something went squiffy in the last set of merges --- Engine/source/platform/platformNet.cpp | 8 ++++---- Engine/source/platform/test/netTest.cpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 4d5b6ca18..f2464b9bc 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -492,10 +492,10 @@ template T ReservedSocketList::resolve(NetSocket socketToResolve) return entry.used ? entry.value : -1; } -static ConnectionNotifyEvent* smConnectionNotify = NULL; -static ConnectionAcceptedEvent* smConnectionAccept = NULL; -static ConnectionReceiveEvent* smConnectionReceive = NULL; -static PacketReceiveEvent* smPacketReceive = NULL; +ConnectionNotifyEvent* Net::smConnectionNotify = NULL; +ConnectionAcceptedEvent* Net::smConnectionAccept = NULL; +ConnectionReceiveEvent* Net::smConnectionReceive = NULL; +PacketReceiveEvent* Net::smPacketReceive = NULL; ConnectionNotifyEvent& Net::getConnectionNotifyEvent() { diff --git a/Engine/source/platform/test/netTest.cpp b/Engine/source/platform/test/netTest.cpp index 889d150f2..741e89ce0 100644 --- a/Engine/source/platform/test/netTest.cpp +++ b/Engine/source/platform/test/netTest.cpp @@ -76,8 +76,8 @@ TEST(Net, TCPRequest) handler.mDataReceived = 0; // Hook into the signals. - Net::smConnectionNotify .notify(&handler, &TcpHandle::notify); - Net::smConnectionReceive.notify(&handler, &TcpHandle::receive); + Net::smConnectionNotify ->notify(&handler, &TcpHandle::notify); + Net::smConnectionReceive->notify(&handler, &TcpHandle::receive); // Open a TCP connection to garagegames.com handler.mSocket = Net::openConnectTo("72.246.107.193:80"); @@ -85,8 +85,8 @@ TEST(Net, TCPRequest) while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {} // Unhook from the signals. - Net::smConnectionNotify .remove(&handler, &TcpHandle::notify); - Net::smConnectionReceive.remove(&handler, &TcpHandle::receive); + Net::smConnectionNotify ->remove(&handler, &TcpHandle::notify); + Net::smConnectionReceive->remove(&handler, &TcpHandle::receive); EXPECT_GT(handler.mDataReceived, 0) << "Didn't get any data back!"; @@ -139,8 +139,8 @@ struct JournalHandle mDataReceived = 0; // Hook into the signals. - Net::smConnectionNotify .notify(this, &JournalHandle::notify); - Net::smConnectionReceive.notify(this, &JournalHandle::receive); + Net::smConnectionNotify ->notify(this, &JournalHandle::notify); + Net::smConnectionReceive->notify(this, &JournalHandle::receive); // Open a TCP connection to garagegames.com mSocket = Net::openConnectTo("72.246.107.193:80"); @@ -149,8 +149,8 @@ struct JournalHandle while(Process::processEvents()) {} // Unhook from the signals. - Net::smConnectionNotify .remove(this, &JournalHandle::notify); - Net::smConnectionReceive.remove(this, &JournalHandle::receive); + Net::smConnectionNotify ->remove(this, &JournalHandle::notify); + Net::smConnectionReceive->remove(this, &JournalHandle::receive); EXPECT_GT(mDataReceived, 0) << "Didn't get any data back!"; From dc73228ccfbfe85510f1b258a5257d9706c59a9d Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 23:03:49 -0500 Subject: [PATCH 15/21] fixed a typo from upstream --- Engine/source/T3D/staticShape.cpp | 132 +++++++++++++++--------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/Engine/source/T3D/staticShape.cpp b/Engine/source/T3D/staticShape.cpp index 1ffd5436c..6548e2161 100644 --- a/Engine/source/T3D/staticShape.cpp +++ b/Engine/source/T3D/staticShape.cpp @@ -45,48 +45,48 @@ static const U32 sgAllowedDynamicTypes = 0xffffff; IMPLEMENT_CO_DATABLOCK_V1(StaticShapeData); ConsoleDocClass( StaticShapeData, - "@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n" + "@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n" - "When it comes to placing 3D objects in the scene, you effectively have two options:\n\n" - "1. TSStatic objects\n\n" - "2. ShapeBase derived objects\n\n" + "When it comes to placing 3D objects in the scene, you effectively have two options:\n\n" + "1. TSStatic objects\n\n" + "2. ShapeBase derived objects\n\n" - "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " - "will use one of its child classes instead. Several game related objects are derived " - "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" + "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " + "will use one of its child classes instead. Several game related objects are derived " + "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" - "When you need a 3D object with datablock capabilities, you will use an object derived " - "from ShapeBase. When you need an object with extremely low overhead, and with no other " - "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" + "When you need a 3D object with datablock capabilities, you will use an object derived " + "from ShapeBase. When you need an object with extremely low overhead, and with no other " + "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" - "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " - "additional functionality you see in Player, Item, Vehicle or the other game play " - "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " + "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " + "additional functionality you see in Player, Item, Vehicle or the other game play " + "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " "a datablock provides a location for common variables as well as having access to " "various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n" - "@tsexample\n" - "// Create a StaticShape using a datablock\n" - "datablock StaticShapeData(BasicShapeData)\n" - "{\n" - " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" - " testVar = \"Simple string, not a stock variable\";\n" - "};\n\n" - "new StaticShape()\n" - "{\n" - " dataBlock = \"BasicShapeData\";\n" - " position = \"0.0 0.0 0.0\";\n" - " rotation = \"1 0 0 0\";\n" - " scale = \"1 1 1\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create a StaticShape using a datablock\n" + "datablock StaticShapeData(BasicShapeData)\n" + "{\n" + " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" + " testVar = \"Simple string, not a stock variable\";\n" + "};\n\n" + "new StaticShape()\n" + "{\n" + " dataBlock = \"BasicShapeData\";\n" + " position = \"0.0 0.0 0.0\";\n" + " rotation = \"1 0 0 0\";\n" + " scale = \"1 1 1\";\n" + "};\n" + "@endtsexample\n\n" - "@see StaticShape\n" + "@see StaticShape\n" "@see ShapeBaseData\n" - "@see TSStatic\n\n" + "@see TSStatic\n\n" - "@ingroup gameObjects\n" - "@ingroup Datablocks"); + "@ingroup gameObjects\n" + "@ingroup Datablocks"); StaticShapeData::StaticShapeData() { @@ -128,47 +128,47 @@ void StaticShapeData::unpackData(BitStream* stream) IMPLEMENT_CO_NETOBJECT_V1(StaticShape); ConsoleDocClass( StaticShape, - "@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n" + "@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n" - "When it comes to placing 3D objects in the scene, you technically have two options:\n\n" - "1. TSStatic objects\n\n" - "2. ShapeBase derived objects\n\n" + "When it comes to placing 3D objects in the scene, you technically have two options:\n\n" + "1. TSStatic objects\n\n" + "2. ShapeBase derived objects\n\n" - "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " - "will use one of its child classes instead. Several game related objects are derived " - "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" + "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " + "will use one of its child classes instead. Several game related objects are derived " + "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" - "When you need a 3D object with datablock capabilities, you will use an object derived " - "from ShapeBase. When you need an object with extremely low overhead, and with no other " - "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" + "When you need a 3D object with datablock capabilities, you will use an object derived " + "from ShapeBase. When you need an object with extremely low overhead, and with no other " + "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" - "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " - "additional functionality you see in Player, Item, Vehicle or the other game play " - "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " + "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " + "additional functionality you see in Player, Item, Vehicle or the other game play " + "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " "a datablock provides a location for common variables as well as having access to " "various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n" - "@tsexample\n" - "// Create a StaticShape using a datablock\n" - "datablock StaticShapeData(BasicShapeData)\n" - "{\n" - " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" - " testVar = \"Simple string, not a stock variable\";\n" - "};\n\n" - "new StaticShape()\n" - "{\n" - " dataBlock = \"BasicShapeData\";\n" - " position = \"0.0 0.0 0.0\";\n" - " rotation = \"1 0 0 0\";\n" - " scale = \"1 1 1\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create a StaticShape using a datablock\n" + "datablock StaticShapeData(BasicShapeData)\n" + "{\n" + " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" + " testVar = \"Simple string, not a stock variable\";\n" + "};\n\n" + "new StaticShape()\n" + "{\n" + " dataBlock = \"BasicShapeData\";\n" + " position = \"0.0 0.0 0.0\";\n" + " rotation = \"1 0 0 0\";\n" + " scale = \"1 1 1\";\n" + "};\n" + "@endtsexample\n\n" - "@see StaticShapeData\n" - "@see ShapeBase\n" - "@see TSStatic\n\n" + "@see StaticShapeData\n" + "@see ShapeBase\n" + "@see TSStatic\n\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); StaticShape::StaticShape() { @@ -240,7 +240,7 @@ void StaticShape::setTransform(const MatrixF& mat) setMaskBits(PositionMask); } -void StaticShape::onUnmount(ShapeBase*,S32) +void StaticShape::onUnmount(SceneObject*,S32) { // Make sure the client get's the final server pos. setMaskBits(PositionMask); @@ -303,7 +303,7 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream) // Marked internal, as this is flagged to be deleted // [8/1/2010 mperry] DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)" - "@internal") + "@internal") { if(!object->isServerObject()) return; From ce51070fc467280a8f44badac71722a310cd9442 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 6 Jan 2017 23:04:49 -0500 Subject: [PATCH 16/21] whitespace updates --- Engine/source/T3D/camera.cpp | 2 +- Engine/source/T3D/decal/decalManager.cpp | 40 +-- Engine/source/T3D/physics/bullet/btBody.cpp | 18 +- Engine/source/T3D/physics/bullet/btWorld.cpp | 2 +- Engine/source/T3D/physics/physicsShape.cpp | 8 +- Engine/source/T3D/physics/physx3/px3Body.cpp | 82 +++--- Engine/source/T3D/physics/physx3/px3Body.h | 6 +- Engine/source/T3D/physics/physx3/px3World.cpp | 266 +++++++++--------- Engine/source/T3D/physics/physx3/px3World.h | 90 +++--- Engine/source/T3D/player.cpp | 38 +-- Engine/source/T3D/shapeImage.cpp | 6 +- Engine/source/environment/river.cpp | 228 +++++++-------- Engine/source/gfx/gl/gfxGLStateBlock.cpp | 32 +-- .../source/gui/containers/guiRolloutCtrl.cpp | 14 +- Engine/source/navigation/navMesh.cpp | 8 +- .../renderInstance/renderPrePassMgr.cpp | 2 +- 16 files changed, 421 insertions(+), 421 deletions(-) diff --git a/Engine/source/T3D/camera.cpp b/Engine/source/T3D/camera.cpp index a2acc3838..3a3fb9e4d 100644 --- a/Engine/source/T3D/camera.cpp +++ b/Engine/source/T3D/camera.cpp @@ -1351,7 +1351,7 @@ void Camera::consoleInit() // ExtendedMove support Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex, "@brief The ExtendedMove position/rotation index used for camera movements.\n\n" - "@ingroup BaseCamera\n"); + "@ingroup BaseCamera\n"); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index 2d2491a7f..812fa099d 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -546,7 +546,7 @@ void DecalManager::removeDecal( DecalInstance *inst ) // Remove the decal from the instance vector. - if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() ) + if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() ) mDecalInstanceVec[ inst->mId ] = NULL; // Release its geometry (if it has any). @@ -674,23 +674,23 @@ DecalInstance* DecalManager::raycast( const Point3F &start, const Point3F &end, if ( !worldSphere.intersectsRay( start, end ) ) continue; - - RayInfo ri; - bool containsPoint = false; - if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) ) - { - Point2F poly[4]; - poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); - poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); - poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); - poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); - - if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) ) - containsPoint = true; - } + + RayInfo ri; + bool containsPoint = false; + if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) ) + { + Point2F poly[4]; + poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); + poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); + poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); + poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); + + if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) ) + containsPoint = true; + } - if( !containsPoint ) - continue; + if( !containsPoint ) + continue; hitDecals.push_back( inst ); } @@ -1406,7 +1406,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) query.init( rootFrustum.getPosition(), rootFrustum.getTransform().getForwardVector(), rootFrustum.getFarDist() ); - query.getLights( baseRenderInst.lights, 8 ); + query.getLights( baseRenderInst.lights, 8 ); } // Submit render inst... @@ -1575,7 +1575,7 @@ void DecalManager::clearData() } mData = NULL; - mDecalInstanceVec.clear(); + mDecalInstanceVec.clear(); _freePools(); } @@ -1758,7 +1758,7 @@ DefineEngineFunction( decalManagerEditDecal, bool, ( S32 decalID, Point3F pos, P { DecalInstance *decalInstance = gDecalManager->getDecal( decalID ); if( !decalInstance ) - return false; + return false; //Internally we need Point3F tangent instead of the user friendly F32 rotAroundNormal MatrixF mat( true ); diff --git a/Engine/source/T3D/physics/bullet/btBody.cpp b/Engine/source/T3D/physics/bullet/btBody.cpp index 33d0240a4..32e8945c9 100644 --- a/Engine/source/T3D/physics/bullet/btBody.cpp +++ b/Engine/source/T3D/physics/bullet/btBody.cpp @@ -76,7 +76,7 @@ bool BtBody::init( PhysicsCollision *shape, AssertFatal( shape, "BtBody::init - Got a null collision shape!" ); AssertFatal( dynamic_cast( shape ), "BtBody::init - The collision shape is the wrong type!" ); AssertFatal( ((BtCollision*)shape)->getShape(), "BtBody::init - Got empty collision shape!" ); - + // Cleanup any previous actor. _releaseActor(); @@ -97,20 +97,20 @@ bool BtBody::init( PhysicsCollision *shape, btScalar *masses = new btScalar[ btCompound->getNumChildShapes() ]; for ( U32 j=0; j < btCompound->getNumChildShapes(); j++ ) - masses[j] = mass / btCompound->getNumChildShapes(); + masses[j] = mass / btCompound->getNumChildShapes(); btVector3 principalInertia; btTransform principal; btCompound->calculatePrincipalAxisTransform( masses, principal, principalInertia ); delete [] masses; - // Create a new compound with the shifted children. - btColShape = mCompound = new btCompoundShape(); - for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ ) - { - btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i); - mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) ); - } + // Create a new compound with the shifted children. + btColShape = mCompound = new btCompoundShape(); + for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ ) + { + btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i); + mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) ); + } localXfm = btCast( principal ); } diff --git a/Engine/source/T3D/physics/bullet/btWorld.cpp b/Engine/source/T3D/physics/bullet/btWorld.cpp index 0ad7418b8..0e71666d1 100644 --- a/Engine/source/T3D/physics/bullet/btWorld.cpp +++ b/Engine/source/T3D/physics/bullet/btWorld.cpp @@ -53,7 +53,7 @@ bool BtWorld::initWorld( bool isServer, ProcessList *processList ) { // Collision configuration contains default setup for memory, collision setup. mCollisionConfiguration = new btDefaultCollisionConfiguration(); - mDispatcher = new btCollisionDispatcher( mCollisionConfiguration ); + mDispatcher = new btCollisionDispatcher( mCollisionConfiguration ); btVector3 worldMin( -2000, -2000, -1000 ); btVector3 worldMax( 2000, 2000, 1000 ); diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 627b38a35..662fa9769 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -242,7 +242,7 @@ void PhysicsShapeData::onRemove() void PhysicsShapeData::_onResourceChanged( const Torque::Path &path ) { - if ( path != Path( shapeName ) ) + if ( path != Path( shapeName ) ) return; // Reload the changed shape. @@ -360,8 +360,8 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer ) Vector mHulls; }; - DecompDesc d; - d.mVcount = polyList.mVertexList.size(); + DecompDesc d; + d.mVcount = polyList.mVertexList.size(); d.mVertices = doubleVerts.address(); d.mTcount = polyList.mIndexList.size() / 3; d.mIndices = polyList.mIndexList.address(); @@ -659,7 +659,7 @@ void PhysicsShape::onRemove() PhysicsPlugin::getPhysicsResetSignal().remove( this, &PhysicsShape::_onPhysicsReset ); if ( mDestroyedShape ) - mDestroyedShape->deleteObject(); + mDestroyedShape->deleteObject(); } // Remove the resource change signal. diff --git a/Engine/source/T3D/physics/physx3/px3Body.cpp b/Engine/source/T3D/physics/physx3/px3Body.cpp index 2d5fb46f7..ec4e3b979 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.cpp +++ b/Engine/source/T3D/physics/physx3/px3Body.cpp @@ -80,7 +80,7 @@ bool Px3Body::init( PhysicsCollision *shape, AssertFatal( shape, "Px3Body::init - Got a null collision shape!" ); AssertFatal( dynamic_cast( shape ), "Px3Body::init - The collision shape is the wrong type!" ); AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" ); - + // Cleanup any previous actor. _releaseActor(); @@ -94,10 +94,10 @@ bool Px3Body::init( PhysicsCollision *shape, if ( isKinematic ) { - mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); - physx::PxRigidDynamic *actor = mActor->is(); - actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); - actor->setMass(getMax( mass, 1.0f )); + mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); + physx::PxRigidDynamic *actor = mActor->is(); + actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); + actor->setMass(getMax( mass, 1.0f )); } else if ( mass > 0.0f ) { @@ -107,7 +107,7 @@ bool Px3Body::init( PhysicsCollision *shape, { mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY())); mIsStatic = true; - } + } mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f); @@ -115,22 +115,22 @@ bool Px3Body::init( PhysicsCollision *shape, const Vector &shapes = mColShape->getShapes(); for ( U32 i=0; i < shapes.size(); i++ ) { - Px3CollisionDesc* desc = shapes[i]; - if( mass > 0.0f ) - { - if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH) - { - Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); - } - } - physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); - physx::PxFilterData colData; - if(isDebris) - colData.word0 = PX3_DEBRIS; - else if(isTrigger) + Px3CollisionDesc* desc = shapes[i]; + if( mass > 0.0f ) + { + if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH) + { + Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); + } + } + physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); + physx::PxFilterData colData; + if(isDebris) + colData.word0 = PX3_DEBRIS; + else if(isTrigger) colData.word0 = PX3_TRIGGER; - else - colData.word0 = PX3_DEFAULT; + else + colData.word0 = PX3_DEFAULT; //set local pose - actor->createShape with a local pose is deprecated in physx 3.3 pShape->setLocalPose(desc->pose); @@ -145,8 +145,8 @@ bool Px3Body::init( PhysicsCollision *shape, //mass & intertia has to be set after creating the shape if ( mass > 0.0f ) { - physx::PxRigidDynamic *actor = mActor->is(); - physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); + physx::PxRigidDynamic *actor = mActor->is(); + physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); } // This sucks, but it has to happen if we want @@ -178,9 +178,9 @@ void Px3Body::setMaterial( F32 restitution, actor->wakeUp(); } - mMaterial->setRestitution(restitution); - mMaterial->setStaticFriction(staticFriction); - mMaterial->setDynamicFriction(friction); + mMaterial->setRestitution(restitution); + mMaterial->setStaticFriction(staticFriction); + mMaterial->setDynamicFriction(friction); } @@ -189,7 +189,7 @@ void Px3Body::setSleepThreshold( F32 linear, F32 angular ) AssertFatal( mActor, "Px3Body::setSleepThreshold - The actor is null!" ); if(mIsStatic) - return; + return; physx::PxRigidDynamic *actor = mActor->is(); physx::PxF32 massNormalized= (linear*linear+angular*angular)/2.0f; @@ -200,7 +200,7 @@ void Px3Body::setDamping( F32 linear, F32 angular ) { AssertFatal( mActor, "Px3Body::setDamping - The actor is null!" ); if(mIsStatic) - return; + return; physx::PxRigidDynamic *actor = mActor->is(); actor->setLinearDamping( linear ); @@ -227,7 +227,7 @@ F32 Px3Body::getMass() const { AssertFatal( mActor, "PxBody::getCMassPosition - The actor is null!" ); if(mIsStatic) - return 0; + return 0; const physx::PxRigidDynamic *actor = mActor->is(); return actor->getMass(); @@ -237,7 +237,7 @@ Point3F Px3Body::getCMassPosition() const { AssertFatal( mActor, "Px3Body::getCMassPosition - The actor is null!" ); if(mIsStatic) - return px3Cast(mActor->getGlobalPose().p); + return px3Cast(mActor->getGlobalPose().p); physx::PxRigidDynamic *actor = mActor->is(); physx::PxTransform pose = actor->getGlobalPose() * actor->getCMassLocalPose(); @@ -326,11 +326,11 @@ Box3F Px3Body::getWorldBounds() U32 shapeCount = mActor->getNbShapes(); - physx::PxShape **shapes = new physx::PxShape*[shapeCount]; - mActor->getShapes(shapes, shapeCount); + physx::PxShape **shapes = new physx::PxShape*[shapeCount]; + mActor->getShapes(shapes, shapeCount); for ( U32 i = 0; i < shapeCount; i++ ) { - // Get the shape's bounds. + // Get the shape's bounds. shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor); // Combine them into the total bounds. bounds.include( shapeBounds ); @@ -355,11 +355,11 @@ void Px3Body::setSimulationEnabled( bool enabled ) mWorld->releaseWriteLock(); U32 shapeCount = mActor->getNbShapes(); - physx::PxShape **shapes = new physx::PxShape*[shapeCount]; - mActor->getShapes(shapes, shapeCount); + physx::PxShape **shapes = new physx::PxShape*[shapeCount]; + mActor->getShapes(shapes, shapeCount); for ( S32 i = 0; i < mActor->getNbShapes(); i++ ) { - shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//????? + shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//????? } delete [] shapes; @@ -377,10 +377,10 @@ void Px3Body::setTransform( const MatrixF &transform ) mActor->setGlobalPose(px3Cast(transform),false); if(mIsStatic) - return; + return; - physx::PxRigidDynamic *actor = mActor->is(); - bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; + physx::PxRigidDynamic *actor = mActor->is(); + bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; // If its dynamic we have more to do. if ( isDynamic() && !kinematic ) { @@ -412,8 +412,8 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force ) physx::PxRigidDynamic *actor = mActor->is(); if ( mIsEnabled && isDynamic() ) physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast(force), - px3Cast(origin), - physx::PxForceMode::eIMPULSE); + px3Cast(origin), + physx::PxForceMode::eIMPULSE); } diff --git a/Engine/source/T3D/physics/physx3/px3Body.h b/Engine/source/T3D/physics/physx3/px3Body.h index 7873293bc..30f6f8895 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.h +++ b/Engine/source/T3D/physics/physx3/px3Body.h @@ -41,9 +41,9 @@ class Px3Collision; struct Px3CollisionDesc; namespace physx{ - class PxRigidActor; - class PxMaterial; - class PxShape; + class PxRigidActor; + class PxMaterial; + class PxShape; } diff --git a/Engine/source/T3D/physics/physx3/px3World.cpp b/Engine/source/T3D/physics/physx3/px3World.cpp index 026d77832..a3732634e 100644 --- a/Engine/source/T3D/physics/physx3/px3World.cpp +++ b/Engine/source/T3D/physics/physx3/px3World.cpp @@ -71,113 +71,113 @@ Px3World::~Px3World() physx::PxCooking *Px3World::getCooking() { - return smCooking; + return smCooking; } bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *serverWorld) { - // If either the client or the server still exist - // then we cannot reset the SDK. - if ( clientWorld || serverWorld ) - return false; + // If either the client or the server still exist + // then we cannot reset the SDK. + if ( clientWorld || serverWorld ) + return false; - if(smPvdConnection) - smPvdConnection->release(); + if(smPvdConnection) + smPvdConnection->release(); - if(smCooking) - smCooking->release(); + if(smCooking) + smCooking->release(); - if(smCpuDispatcher) - smCpuDispatcher->release(); + if(smCpuDispatcher) + smCpuDispatcher->release(); // Destroy the existing SDK. - if ( gPhysics3SDK ) - { - PxCloseExtensions(); - gPhysics3SDK->release(); - } + if ( gPhysics3SDK ) + { + PxCloseExtensions(); + gPhysics3SDK->release(); + } if(smErrorCallback) { SAFE_DELETE(smErrorCallback); } - if(smFoundation) - { - smFoundation->release(); - SAFE_DELETE(smErrorCallback); - } + if(smFoundation) + { + smFoundation->release(); + SAFE_DELETE(smErrorCallback); + } - // If we're not supposed to restart... return. - if ( destroyOnly ) + // If we're not supposed to restart... return. + if ( destroyOnly ) return true; - bool memTrack = false; + bool memTrack = false; #ifdef TORQUE_DEBUG - memTrack = true; + memTrack = true; #endif - smErrorCallback = new Px3ConsoleStream; - smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); - smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); - gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); + smErrorCallback = new Px3ConsoleStream; + smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); + smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); + gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); - if ( !gPhysics3SDK ) - { - Con::errorf( "PhysX3 failed to initialize!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + if ( !gPhysics3SDK ) + { + Con::errorf( "PhysX3 failed to initialize!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); + Platform::forceShutdown( -1 ); - // We shouldn't get here, but this shuts up - // source diagnostic tools. - return false; - } + // We shouldn't get here, but this shuts up + // source diagnostic tools. + return false; + } - if(!PxInitExtensions(*gPhysics3SDK)) - { - Con::errorf( "PhysX3 failed to initialize extensions!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + if(!PxInitExtensions(*gPhysics3SDK)) + { + Con::errorf( "PhysX3 failed to initialize extensions!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); - return false; - } + Platform::forceShutdown( -1 ); + return false; + } - smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); - if(!smCooking) - { - Con::errorf( "PhysX3 failed to initialize cooking!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); + if(!smCooking) + { + Con::errorf( "PhysX3 failed to initialize cooking!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); - return false; - } + Platform::forceShutdown( -1 ); + return false; + } #ifdef TORQUE_DEBUG - physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); - smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), - "localhost", 5425, 100, connectionFlags); + physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); + smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), + "localhost", 5425, 100, connectionFlags); #endif - return true; + return true; } void Px3World::destroyWorld() { - getPhysicsResults(); + getPhysicsResults(); mRenderBuffer = NULL; - // Release the tick processing signals. - if ( mProcessList ) - { - mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults ); - mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics ); - mProcessList = NULL; - } + // Release the tick processing signals. + if ( mProcessList ) + { + mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults ); + mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics ); + mProcessList = NULL; + } if(mControllerManager) { @@ -185,13 +185,13 @@ void Px3World::destroyWorld() mControllerManager = NULL; } - // Destroy the scene. - if ( mScene ) - { - // Release the scene. - mScene->release(); - mScene = NULL; - } + // Destroy the scene. + if ( mScene ) + { + // Release the scene. + mScene->release(); + mScene = NULL; + } } bool Px3World::initWorld( bool isServer, ProcessList *processList ) @@ -203,7 +203,7 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList ) } mIsServer = isServer; - + physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale()); sceneDesc.gravity = px3Cast(mGravity); @@ -217,26 +217,26 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList ) sceneDesc.cpuDispatcher = smCpuDispatcher; Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); } - + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS; sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader; - mScene = gPhysics3SDK->createScene(sceneDesc); + mScene = gPhysics3SDK->createScene(sceneDesc); //cache renderbuffer for use with debug drawing mRenderBuffer = const_cast(&mScene->getRenderBuffer()); - physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); - mScene->setDominanceGroupPair(0,31,debrisDominance); + physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); + mScene->setDominanceGroupPair(0,31,debrisDominance); mControllerManager = PxCreateControllerManager(*mScene); - AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" ); - mProcessList = processList; - mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults ); - mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f ); + AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" ); + mProcessList = processList; + mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults ); + mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f ); - return true; + return true; } // Most of this borrowed from bullet physics library, see btDiscreteDynamicsWorld.cpp bool Px3World::_simulate(const F32 dt) @@ -249,21 +249,21 @@ bool Px3World::_simulate(const F32 dt) numSimulationSubSteps = S32(mAccumulator / smPhysicsStepTime); mAccumulator -= numSimulationSubSteps * smPhysicsStepTime; } - if (numSimulationSubSteps) - { - //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt - S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; - - for (S32 i=0;ifetchResults(true); - mScene->simulate(smPhysicsStepTime); - } - } - - mIsSimulating = true; + if (numSimulationSubSteps) + { + //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt + S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; + + for (S32 i=0;ifetchResults(true); + mScene->simulate(smPhysicsStepTime); + } + } + + mIsSimulating = true; - return true; + return true; } void Px3World::tickPhysics( U32 elapsedMs ) @@ -290,45 +290,45 @@ void Px3World::tickPhysics( U32 elapsedMs ) void Px3World::getPhysicsResults() { - if ( !mScene || !mIsSimulating ) - return; + if ( !mScene || !mIsSimulating ) + return; - PROFILE_SCOPE(Px3World_GetPhysicsResults); + PROFILE_SCOPE(Px3World_GetPhysicsResults); - // Get results from scene. - mScene->fetchResults(true); - mIsSimulating = false; - mTickCount++; + // Get results from scene. + mScene->fetchResults(true); + mIsSimulating = false; + mTickCount++; // Con::printf( "%s PhysXWorld::getPhysicsResults!", this == smClientWorld ? "Client" : "Server" ); } void Px3World::releaseWriteLocks() { - Px3World *world = dynamic_cast( PHYSICSMGR->getWorld( "server" ) ); + Px3World *world = dynamic_cast( PHYSICSMGR->getWorld( "server" ) ); - if ( world ) - world->releaseWriteLock(); + if ( world ) + world->releaseWriteLock(); - world = dynamic_cast( PHYSICSMGR->getWorld( "client" ) ); + world = dynamic_cast( PHYSICSMGR->getWorld( "client" ) ); - if ( world ) - world->releaseWriteLock(); + if ( world ) + world->releaseWriteLock(); } void Px3World::releaseWriteLock() { - if ( !mScene || !mIsSimulating ) - return; + if ( !mScene || !mIsSimulating ) + return; - PROFILE_SCOPE(PxWorld_ReleaseWriteLock); + PROFILE_SCOPE(PxWorld_ReleaseWriteLock); - // We use checkResults here to release the write lock - // but we do not change the simulation flag or increment - // the tick count... we may have gotten results, but the - // simulation hasn't really ticked! - mScene->checkResults( true ); - //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); + // We use checkResults here to release the write lock + // but we do not change the simulation flag or increment + // the tick count... we may have gotten results, but the + // simulation hasn't really ticked! + mScene->checkResults( true ); + //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); } void Px3World::lockScenes() @@ -390,7 +390,7 @@ void Px3World::unlockScene() bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ) { - physx::PxVec3 orig = px3Cast( startPnt ); + physx::PxVec3 orig = px3Cast( startPnt ); physx::PxVec3 dir = px3Cast( endPnt - startPnt ); physx::PxF32 maxDist = dir.magnitude(); dir.normalize(); @@ -404,11 +404,11 @@ bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo physx::PxRaycastBuffer buf; if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData)) - return false; + return false; if(!buf.hasBlock) - return false; + return false; - const physx::PxRaycastHit hit = buf.block; + const physx::PxRaycastHit hit = buf.block; physx::PxRigidActor *actor = hit.actor; PhysicsUserData *userData = PhysicsUserData::cast( actor->userData ); @@ -456,15 +456,15 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL); physx::PxQueryFilterData filterData; if(bodyTypes & BT_Static) - filterData.flags |= physx::PxQueryFlag::eSTATIC; + filterData.flags |= physx::PxQueryFlag::eSTATIC; if(bodyTypes & BT_Dynamic) - filterData.flags |= physx::PxQueryFlag::eDYNAMIC; + filterData.flags |= physx::PxQueryFlag::eDYNAMIC; filterData.data.word0 = groups; physx::PxRaycastBuffer buf; if( !mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData) ) - return NULL; + return NULL; if(!buf.hasBlock) return NULL; @@ -478,7 +478,7 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo void Px3World::explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ) { - physx::PxVec3 nxPos = px3Cast( pos ); + physx::PxVec3 nxPos = px3Cast( pos ); const physx::PxU32 bufferSize = 10; physx::PxSphereGeometry worldSphere(radius); physx::PxTransform pose(nxPos); @@ -520,14 +520,14 @@ void Px3World::setEnabled( bool enabled ) physx::PxController* Px3World::createController( physx::PxControllerDesc &desc ) { - if ( !mScene ) - return NULL; + if ( !mScene ) + return NULL; - // We need the writelock! - releaseWriteLock(); - physx::PxController* pController = mControllerManager->createController(desc); - AssertFatal( pController, "Px3World::createController - Got a null!" ); - return pController; + // We need the writelock! + releaseWriteLock(); + physx::PxController* pController = mControllerManager->createController(desc); + AssertFatal( pController, "Px3World::createController - Got a null!" ); + return pController; } static ColorI getDebugColor( physx::PxU32 packed ) diff --git a/Engine/source/T3D/physics/physx3/px3World.h b/Engine/source/T3D/physics/physx3/px3World.h index 72e67ddb9..5399c3f0a 100644 --- a/Engine/source/T3D/physics/physx3/px3World.h +++ b/Engine/source/T3D/physics/physx3/px3World.h @@ -42,66 +42,66 @@ class FixedStepper; enum Px3CollisionGroup { - PX3_DEFAULT = BIT(0), - PX3_PLAYER = BIT(1), - PX3_DEBRIS = BIT(2), - PX3_TRIGGER = BIT(3), + PX3_DEFAULT = BIT(0), + PX3_PLAYER = BIT(1), + PX3_DEBRIS = BIT(2), + PX3_TRIGGER = BIT(3), }; class Px3World : public PhysicsWorld { protected: - physx::PxScene* mScene; - bool mIsEnabled; - bool mIsSimulating; - bool mIsServer; + physx::PxScene* mScene; + bool mIsEnabled; + bool mIsSimulating; + bool mIsServer; bool mIsSceneLocked; - U32 mTickCount; - ProcessList *mProcessList; - F32 mEditorTimeScale; - bool mErrorReport; + U32 mTickCount; + ProcessList *mProcessList; + F32 mEditorTimeScale; + bool mErrorReport; physx::PxRenderBuffer *mRenderBuffer; - physx::PxControllerManager* mControllerManager; - static Px3ConsoleStream *smErrorCallback; - static physx::PxDefaultAllocator smMemoryAlloc; - static physx::PxFoundation* smFoundation; - static physx::PxCooking *smCooking; - static physx::PxProfileZoneManager* smProfileZoneManager; - static physx::PxDefaultCpuDispatcher* smCpuDispatcher; - static physx::PxVisualDebuggerConnection* smPvdConnection; - F32 mAccumulator; - bool _simulate(const F32 dt); + physx::PxControllerManager* mControllerManager; + static Px3ConsoleStream *smErrorCallback; + static physx::PxDefaultAllocator smMemoryAlloc; + static physx::PxFoundation* smFoundation; + static physx::PxCooking *smCooking; + static physx::PxProfileZoneManager* smProfileZoneManager; + static physx::PxDefaultCpuDispatcher* smCpuDispatcher; + static physx::PxVisualDebuggerConnection* smPvdConnection; + F32 mAccumulator; + bool _simulate(const F32 dt); public: - Px3World(); - virtual ~Px3World(); + Px3World(); + virtual ~Px3World(); - virtual bool initWorld( bool isServer, ProcessList *processList ); - virtual void destroyWorld(); - virtual void onDebugDraw( const SceneRenderState *state ); - virtual void reset() {} - virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); - virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); - virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); - virtual bool isEnabled() const { return mIsEnabled; } - physx::PxScene* getScene(){ return mScene;} - void setEnabled( bool enabled ); - U32 getTick() { return mTickCount; } + virtual bool initWorld( bool isServer, ProcessList *processList ); + virtual void destroyWorld(); + virtual void onDebugDraw( const SceneRenderState *state ); + virtual void reset() {} + virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); + virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); + virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); + virtual bool isEnabled() const { return mIsEnabled; } + physx::PxScene* getScene(){ return mScene;} + void setEnabled( bool enabled ); + U32 getTick() { return mTickCount; } void tickPhysics( U32 elapsedMs ); - void getPhysicsResults(); - void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } - const F32 getEditorTimeScale() const { return mEditorTimeScale; } - void releaseWriteLock(); - bool isServer(){return mIsServer;} - physx::PxController* createController( physx::PxControllerDesc &desc ); + void getPhysicsResults(); + void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } + const F32 getEditorTimeScale() const { return mEditorTimeScale; } + void releaseWriteLock(); + bool isServer(){return mIsServer;} + physx::PxController* createController( physx::PxControllerDesc &desc ); void lockScene(); void unlockScene(); - //static - static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); - static void releaseWriteLocks(); - static physx::PxCooking *getCooking(); + //static + static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); + static void releaseWriteLocks(); + static physx::PxCooking *getCooking(); static void lockScenes(); static void unlockScenes(); }; diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 93cd4f722..1623e4819 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -6652,7 +6652,7 @@ DefineEngineMethod( Player, setActionThread, bool, ( const char* name, bool hold "@tsexample\n" "// Place the player in a sitting position after being mounted\n" "%player.setActionThread( \"sitting\", true, true );\n" - "@endtsexample\n") + "@endtsexample\n") { return object->setActionThread( name, hold, true, fsp); } @@ -6700,11 +6700,11 @@ DefineEngineMethod( Player, clearControlObject, void, (),, "Returns control to the player. This internally calls " "Player::setControlObject(0).\n" "@tsexample\n" - "%player.clearControlObject();\n" + "%player.clearControlObject();\n" "echo(%player.getControlObject()); //<-- Returns 0, player assumes control\n" "%player.setControlObject(%vehicle);\n" "echo(%player.getControlObject()); //<-- Returns %vehicle, player controls the vehicle now.\n" - "@endtsexample\n" + "@endtsexample\n" "@note If the player does not have a control object, the player will receive all moves " "from its GameConnection. If you're looking to remove control from the player itself " "(i.e. stop sending moves to the player) use GameConnection::setControlObject() to transfer " @@ -6762,63 +6762,63 @@ void Player::consoleInit() "@brief Determines if the player is rendered or not.\n\n" "Used on the client side to disable the rendering of all Player objects. This is " "mainly for the tools or debugging.\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::renderMyItems",TypeBool, &sRenderMyItems, "@brief Determines if mounted shapes are rendered or not.\n\n" "Used on the client side to disable the rendering of all Player mounted objects. This is " "mainly used for the tools or debugging.\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::renderCollision", TypeBool, &sRenderPlayerCollision, "@brief Determines if the player's collision mesh should be rendered.\n\n" "This is mainly used for the tools and debugging.\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::minWarpTicks",TypeF32,&sMinWarpTicks, "@brief Fraction of tick at which instant warp occures on the client.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::maxWarpTicks",TypeS32,&sMaxWarpTicks, "@brief When a warp needs to occur due to the client being too far off from the server, this is the " "maximum number of ticks we'll allow the client to warp to catch up.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::maxPredictionTicks",TypeS32,&sMaxPredictionTicks, "@brief Maximum number of ticks to predict on the client from the last known move obtained from the server.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::maxImpulseVelocity", TypeF32, &sMaxImpulseVelocity, "@brief The maximum velocity allowed due to a single impulse.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); // Move triggers Con::addVariable("$player::jumpTrigger", TypeS32, &sJumpTrigger, "@brief The move trigger index used for player jumping.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::crouchTrigger", TypeS32, &sCrouchTrigger, "@brief The move trigger index used for player crouching.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::proneTrigger", TypeS32, &sProneTrigger, "@brief The move trigger index used for player prone pose.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::sprintTrigger", TypeS32, &sSprintTrigger, "@brief The move trigger index used for player sprinting.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::imageTrigger0", TypeS32, &sImageTrigger0, "@brief The move trigger index used to trigger mounted image 0.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::imageTrigger1", TypeS32, &sImageTrigger1, "@brief The move trigger index used to trigger mounted image 1 or alternate fire " "on mounted image 0.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::jumpJetTrigger", TypeS32, &sJumpJetTrigger, "@brief The move trigger index used for player jump jetting.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); Con::addVariable("$player::vehicleDismountTrigger", TypeS32, &sVehicleDismountTrigger, "@brief The move trigger index used to dismount player.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); // ExtendedMove support Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex, "@brief The ExtendedMove position/rotation index used for head movements.\n\n" - "@ingroup GameObjects\n"); + "@ingroup GameObjects\n"); } //-------------------------------------------------------------------------- diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 7ae902ed8..627e8e433 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -80,7 +80,7 @@ EndImplementEnumType; ImplementEnumType( ShapeBaseImageLightType, "@brief The type of light to attach to this ShapeBaseImage.\n\n" "@ingroup gameObjects\n\n") - { ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" }, + { ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" }, { ShapeBaseImageData::ConstantLight, "ConstantLight", "A constant emitting light is attached.\n" }, { ShapeBaseImageData::SpotLight, "SpotLight", "A spotlight is attached.\n" }, { ShapeBaseImageData::PulsingLight, "PulsingLight", "A pusling light is attached.\n" }, @@ -1532,7 +1532,7 @@ bool ShapeBase::unmountImage(U32 imageSlot) { AssertFatal(imageSlotcreateSource( stateData.sound, &getRenderTransform(), &velocity )); + image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity )); } // Play animation diff --git a/Engine/source/environment/river.cpp b/Engine/source/environment/river.cpp index 73c63a4ca..2ac9f2b97 100644 --- a/Engine/source/environment/river.cpp +++ b/Engine/source/environment/river.cpp @@ -77,12 +77,12 @@ ConsoleDocClass( River, #define NODE_RADIUS 15.0f static U32 gIdxArray[6][2][3] = { - { { 0, 4, 5 }, { 0, 5, 1 }, }, // Top Face - { { 2, 6, 4 }, { 2, 4, 0 }, }, // Left Face - { { 1, 5, 7 }, { 1, 7, 3 }, }, // Right Face - { { 2, 3, 7 }, { 2, 7, 6 }, }, // Bottom Face - { { 0, 1, 3 }, { 0, 3, 2 }, }, // Front Face - { { 4, 6, 7 }, { 4, 7, 5 }, }, // Back Face + { { 0, 4, 5 }, { 0, 5, 1 }, }, // Top Face + { { 2, 6, 4 }, { 2, 4, 0 }, }, // Left Face + { { 1, 5, 7 }, { 1, 7, 3 }, }, // Right Face + { { 2, 3, 7 }, { 2, 7, 6 }, }, // Bottom Face + { { 0, 1, 3 }, { 0, 3, 2 }, }, // Front Face + { { 4, 6, 7 }, { 4, 7, 5 }, }, // Back Face }; struct RiverHitSegment @@ -93,10 +93,10 @@ struct RiverHitSegment static S32 QSORT_CALLBACK compareHitSegments(const void* a,const void* b) { - const RiverHitSegment *fa = (RiverHitSegment*)a; - const RiverHitSegment *fb = (RiverHitSegment*)b; + const RiverHitSegment *fa = (RiverHitSegment*)a; + const RiverHitSegment *fb = (RiverHitSegment*)b; - return mSign(fb->t - fa->t); + return mSign(fb->t - fa->t); } static Point3F sSegmentPointComparePoints[4]; @@ -655,17 +655,17 @@ void River::consoleInit() Parent::consoleInit(); Con::addVariable( "$River::EditorOpen", TypeBool, &River::smEditorOpen, "For editor use.\n" - "@ingroup Editors\n" ); + "@ingroup Editors\n" ); Con::addVariable( "$River::showWalls", TypeBool, &River::smShowWalls, "For editor use.\n" - "@ingroup Editors\n" ); + "@ingroup Editors\n" ); Con::addVariable( "$River::showNodes", TypeBool, &River::smShowNodes, "For editor use.\n" - "@ingroup Editors\n"); + "@ingroup Editors\n"); Con::addVariable( "$River::showSpline", TypeBool, &River::smShowSpline, "For editor use.\n" - "@ingroup Editors\n" ); + "@ingroup Editors\n" ); Con::addVariable( "$River::showRiver", TypeBool, &River::smShowRiver, "For editor use.\n" - "@ingroup Editors\n" ); - Con::addVariable( "$River::showWireframe", TypeBool, &River::smWireframe, "For editor use.\n" - "@ingroup Editors\n"); + "@ingroup Editors\n" ); + Con::addVariable( "$River::showWireframe", TypeBool, &River::smWireframe, "For editor use.\n" + "@ingroup Editors\n"); } bool River::addNodeFromField( void *object, const char *index, const char *data ) @@ -816,7 +816,7 @@ void River::innerRender( SceneRenderState *state ) _makeRenderBatches( camPosition ); - if ( !River::smShowRiver ) + if ( !River::smShowRiver ) return; // If no material... we're done. @@ -851,7 +851,7 @@ void River::innerRender( SceneRenderState *state ) U32 vertCount = ( endVert - startVert ) + 1; U32 idxCount = ( endIdx - startIdx ) + 1; U32 triangleCount = idxCount / 3; - + AssertFatal( startVert < mLowVertCount, "River, bad draw call!" ); AssertFatal( startVert + vertCount <= mLowVertCount, "River, bad draw call!" ); AssertFatal( triangleCount <= mLowTriangleCount, "River, bad draw call!" ); @@ -962,7 +962,7 @@ U32 River::packUpdate(NetConnection * con, U32 mask, BitStream * stream) stream->write( mSegmentsPerBatch ); stream->write( mDepthScale ); stream->write( mMaxDivisionSize ); - stream->write( mColumnCount ); + stream->write( mColumnCount ); stream->write( mFlowMagnitude ); stream->write( mLodDistance ); @@ -1045,7 +1045,7 @@ void River::unpackUpdate(NetConnection * con, BitStream * stream) // RiverMask if(stream->readFlag()) { - MatrixF ObjectMatrix; + MatrixF ObjectMatrix; stream->readAffineTransform(&ObjectMatrix); Parent::setTransform(ObjectMatrix); @@ -1053,7 +1053,7 @@ void River::unpackUpdate(NetConnection * con, BitStream * stream) stream->read( &mSegmentsPerBatch ); stream->read( &mDepthScale ); stream->read( &mMaxDivisionSize ); - stream->read( &mColumnCount ); + stream->read( &mColumnCount ); stream->read( &mFlowMagnitude ); stream->read( &mLodDistance ); @@ -1198,56 +1198,56 @@ void River::setScale( const VectorF &scale ) bool River::castRay(const Point3F &s, const Point3F &e, RayInfo* info) { - Point3F start = s; - Point3F end = e; - mObjToWorld.mulP(start); - mObjToWorld.mulP(end); + Point3F start = s; + Point3F end = e; + mObjToWorld.mulP(start); + mObjToWorld.mulP(end); - F32 out = 1.0f; // The output fraction/percentage along the line defined by s and e - VectorF norm(0.0f, 0.0f, 0.0f); // The normal of the face intersected + F32 out = 1.0f; // The output fraction/percentage along the line defined by s and e + VectorF norm(0.0f, 0.0f, 0.0f); // The normal of the face intersected - Vector hitSegments; + Vector hitSegments; - for ( U32 i = 0; i < mSegments.size(); i++ ) - { - const RiverSegment &segment = mSegments[i]; + for ( U32 i = 0; i < mSegments.size(); i++ ) + { + const RiverSegment &segment = mSegments[i]; - F32 t; - VectorF n; + F32 t; + VectorF n; - if ( segment.worldbounds.collideLine( start, end, &t, &n ) ) - { - hitSegments.increment(); - hitSegments.last().t = t; - hitSegments.last().idx = i; - } - } + if ( segment.worldbounds.collideLine( start, end, &t, &n ) ) + { + hitSegments.increment(); + hitSegments.last().t = t; + hitSegments.last().idx = i; + } + } - dQsort( hitSegments.address(), hitSegments.size(), sizeof(RiverHitSegment), compareHitSegments ); + dQsort( hitSegments.address(), hitSegments.size(), sizeof(RiverHitSegment), compareHitSegments ); U32 idx0, idx1, idx2; F32 t; - for ( U32 i = 0; i < hitSegments.size(); i++ ) - { - U32 segIdx = hitSegments[i].idx; - const RiverSegment &segment = mSegments[segIdx]; + for ( U32 i = 0; i < hitSegments.size(); i++ ) + { + U32 segIdx = hitSegments[i].idx; + const RiverSegment &segment = mSegments[segIdx]; - // Each segment has 6 faces - for ( U32 j = 0; j < 6; j++ ) - { - if ( j == 4 && segIdx != 0 ) - continue; + // Each segment has 6 faces + for ( U32 j = 0; j < 6; j++ ) + { + if ( j == 4 && segIdx != 0 ) + continue; - if ( j == 5 && segIdx != mSegments.size() - 1 ) - continue; + if ( j == 5 && segIdx != mSegments.size() - 1 ) + continue; - // Each face has 2 triangles - for ( U32 k = 0; k < 2; k++ ) - { - idx0 = gIdxArray[j][k][0]; - idx1 = gIdxArray[j][k][1]; - idx2 = gIdxArray[j][k][2]; + // Each face has 2 triangles + for ( U32 k = 0; k < 2; k++ ) + { + idx0 = gIdxArray[j][k][0]; + idx1 = gIdxArray[j][k][1]; + idx2 = gIdxArray[j][k][2]; const Point3F &v0 = segment[idx0]; const Point3F &v1 = segment[idx1]; @@ -1257,40 +1257,40 @@ bool River::castRay(const Point3F &s, const Point3F &e, RayInfo* info) v2, v1, v0, NULL, &t ) ) - continue; + continue; - if ( t >= 0.0f && t < 1.0f && t < out ) - { - out = t; + if ( t >= 0.0f && t < 1.0f && t < out ) + { + out = t; // optimize this, can be calculated easily within // the collision test norm = PlaneF( v0, v1, v2 ); - } - } - } + } + } + } - if (out >= 0.0f && out < 1.0f) - break; - } + if (out >= 0.0f && out < 1.0f) + break; + } - if (out >= 0.0f && out < 1.0f) - { - info->t = out; - info->normal = norm; - info->point.interpolate(start, end, out); - info->face = -1; - info->object = this; + if (out >= 0.0f && out < 1.0f) + { + info->t = out; + info->normal = norm; + info->point.interpolate(start, end, out); + info->face = -1; + info->object = this; - return true; - } + return true; + } - return false; + return false; } bool River::collideBox(const Point3F &start, const Point3F &end, RayInfo* info) { - return false; + return false; } bool River::buildPolyList( PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF& sphere ) @@ -1656,8 +1656,8 @@ void River::_generateVerts() // These will depend on the level of subdivision per segment // calculated below. mHighVertCount = 0; - mHighTriangleCount = 0; - + mHighTriangleCount = 0; + // Calculate the number of row/column subdivisions per each // RiverSegment. @@ -1671,18 +1671,18 @@ void River::_generateVerts() mColumnCount = mCeil( greatestWidth / mMaxDivisionSize ); - for ( U32 i = 0; i < mSegments.size(); i++ ) - { + for ( U32 i = 0; i < mSegments.size(); i++ ) + { RiverSegment &segment = mSegments[i]; const RiverSlice *slice = segment.slice0; - const RiverSlice *nextSlice = segment.slice1; + const RiverSlice *nextSlice = segment.slice1; - // Calculate the size of divisions in the forward direction ( p00 -> p01 ) - F32 segLength = (nextSlice->p1 - slice->p1).len(); + // Calculate the size of divisions in the forward direction ( p00 -> p01 ) + F32 segLength = (nextSlice->p1 - slice->p1).len(); - // A division count of one is actually NO subdivision, - // the segment corners are the only verts in this segment. - U32 numRows = 1; + // A division count of one is actually NO subdivision, + // the segment corners are the only verts in this segment. + U32 numRows = 1; if ( segLength > 0.0f ) numRows = mCeil( segLength / mMaxDivisionSize ); @@ -1693,33 +1693,33 @@ void River::_generateVerts() // column data member we initialize all segments in the river to // the same (River::mColumnCount) - // Calculate the size of divisions in the right direction ( p00 -> p10 ) - // F32 segWidth = ( ( p11 - p01 ).len() + ( p10 - p00 ).len() ) * 0.5f; + // Calculate the size of divisions in the right direction ( p00 -> p10 ) + // F32 segWidth = ( ( p11 - p01 ).len() + ( p10 - p00 ).len() ) * 0.5f; - // U32 numColumns = 5; - //F32 columnSize = segWidth / numColumns; + // U32 numColumns = 5; + //F32 columnSize = segWidth / numColumns; - //while ( columnSize > mMaxDivisionSize ) - //{ - // numColumns++; - // columnSize = segWidth / numColumns; - //} - + //while ( columnSize > mMaxDivisionSize ) + //{ + // numColumns++; + // columnSize = segWidth / numColumns; + //} + // Save the calculated numb of columns / rows for this segment. segment.columns = mColumnCount; segment.rows = numRows; - + // Save the corresponding number of verts/prims segment.numVerts = ( 1 + mColumnCount ) * ( 1 + numRows ); segment.numTriangles = mColumnCount * numRows * 2; - mHighVertCount += segment.numVerts; - mHighTriangleCount += segment.numTriangles; - } + mHighVertCount += segment.numVerts; + mHighTriangleCount += segment.numTriangles; + } // Number of low detail verts/prims. - mLowVertCount = mSlices.size() * 2; - mLowTriangleCount = mSegments.size() * 2; + mLowVertCount = mSlices.size() * 2; + mLowTriangleCount = mSegments.size() * 2; // Allocate the low detail VertexBuffer, // this will stay in memory and will never need to change. @@ -1728,8 +1728,8 @@ void River::_generateVerts() GFXWaterVertex *lowVertPtr = mVB_low.lock(); U32 vertCounter = 0; - // The texCoord.y value start/end for a segment - // as we loop through them. + // The texCoord.y value start/end for a segment + // as we loop through them. F32 textCoordV = 0; // @@ -1760,7 +1760,7 @@ void River::_generateVerts() { // Increment the textCoordV for the next slice. F32 segLen = ( mSlices[i+1].p1 - slice.p1 ).len(); - textCoordV += segLen; + textCoordV += segLen; } } @@ -1771,8 +1771,8 @@ void River::_generateVerts() // // Create the low-detail prim buffer(s) - // - mPB_low.set( GFX, mLowTriangleCount * 3, mLowTriangleCount, GFXBufferTypeStatic ); + // + mPB_low.set( GFX, mLowTriangleCount * 3, mLowTriangleCount, GFXBufferTypeStatic ); U16 *lowIdxBuff; mPB_low.lock(&lowIdxBuff); @@ -1784,13 +1784,13 @@ void River::_generateVerts() U32 offset = 0; // Fill the low-detail PrimitiveBuffer - for ( U32 i = 0; i < mSegments.size(); i++ ) - { + for ( U32 i = 0; i < mSegments.size(); i++ ) + { //const RiverSegment &segment = mSegments[i]; - + // Two triangles formed by the corner points of this segment // into the the low detail primitive buffer. - p00 = offset; + p00 = offset; p01 = p00 + 2; p11 = p01 + 1; p10 = p00 + 1; diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.cpp b/Engine/source/gfx/gl/gfxGLStateBlock.cpp index 87d2b5953..1a104ab27 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.cpp +++ b/Engine/source/gfx/gl/gfxGLStateBlock.cpp @@ -40,32 +40,32 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) : mCachedHashValue(desc.getHashValue()) { if( !GFXGL->mCapabilities.samplerObjects ) - return; + return; static Map mSamplersMap; - for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i) - { - GLuint &id = mSamplerObjects[i]; - GFXSamplerStateDesc &ssd = mDesc.samplers[i]; + for(int i = 0; i < TEXTURE_STAGE_COUNT; ++i) + { + GLuint &id = mSamplerObjects[i]; + GFXSamplerStateDesc &ssd = mDesc.samplers[i]; Map::Iterator itr = mSamplersMap.find(ssd); if(itr == mSamplersMap.end()) { - glGenSamplers(1, &id); + glGenSamplers(1, &id); - glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, minificationFilter(ssd.minFilter, ssd.mipFilter, 1) ); - glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]); - glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]); - glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]); - glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); - if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) - glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); + glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, minificationFilter(ssd.minFilter, ssd.mipFilter, 1) ); + glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GFXGLTextureFilter[ssd.magFilter]); + glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]); + glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]); + glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); + if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) + glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); mSamplersMap[ssd] = id; } else id = itr->value; - } + } } GFXGLStateBlock::~GFXGLStateBlock() @@ -171,9 +171,9 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState) for (U32 i = 0; i < getMin(getOwningDevice()->getNumSamplers(), (U32) TEXTURE_STAGE_COUNT); i++) { if(!oldState || oldState->mSamplerObjects[i] != mSamplerObjects[i]) - glBindSampler(i, mSamplerObjects[i] ); + glBindSampler(i, mSamplerObjects[i] ); } - } + } // TODO: states added for detail blend } diff --git a/Engine/source/gui/containers/guiRolloutCtrl.cpp b/Engine/source/gui/containers/guiRolloutCtrl.cpp index ea5201021..6f2272d9a 100644 --- a/Engine/source/gui/containers/guiRolloutCtrl.cpp +++ b/Engine/source/gui/containers/guiRolloutCtrl.cpp @@ -462,9 +462,9 @@ void GuiRolloutCtrl::processTick() newHeight -= mAnimateStep; if( !mIsAnimating ) - { + { mIsExpanded = false; - } + } } else // We're expanding ourself (Showing our contents) { @@ -559,13 +559,13 @@ void GuiRolloutCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( pChild ) { if ( !mIsExpanded && !mIsAnimating && pChild->isVisible() ) - { + { pChild->setVisible( false ); - } + } else if ( (mIsExpanded || mIsAnimating) && !pChild->isVisible() ) - { + { pChild->setVisible( true ); - } + } } renderChildControls( offset, updateRect ); @@ -614,7 +614,7 @@ DefineEngineMethod( GuiRolloutCtrl, toggleCollapse, void, (),, if( object->isExpanded() ) object->collapse(); else - object->expand(); + object->expand(); } //----------------------------------------------------------------------------- diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index 64c20a93b..2d4b0ad7e 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -1143,10 +1143,10 @@ void NavMesh::buildLinks() // Iterate over links for(U32 j = 0; j < mLinkIDs.size(); j++) { - if (mLinksUnsynced[j]) - { + if (mLinksUnsynced[j]) + { if(tile.box.isContained(getLinkStart(j)) || - tile.box.isContained(getLinkEnd(j))) + tile.box.isContained(getLinkEnd(j))) { // Mark tile for build. mDirtyTiles.push_back_unique(i); @@ -1161,7 +1161,7 @@ void NavMesh::buildLinks() } } } - } + } if(mDirtyTiles.size()) ctx->startTimer(RC_TIMER_TOTAL); } diff --git a/Engine/source/renderInstance/renderPrePassMgr.cpp b/Engine/source/renderInstance/renderPrePassMgr.cpp index 6175c3eec..81f8782eb 100644 --- a/Engine/source/renderInstance/renderPrePassMgr.cpp +++ b/Engine/source/renderInstance/renderPrePassMgr.cpp @@ -843,7 +843,7 @@ void ProcessedPrePassMaterial::addStateBlockDesc(const GFXStateBlockDesc& desc) if ( isTranslucent ) { prePassStateBlock.setBlend( true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha ); - prePassStateBlock.setColorWrites(false, false, false, true); + prePassStateBlock.setColorWrites(false, false, false, true); } // Enable z reads, but only enable zwrites if we're not translucent. From 6bbb05e60ea439dfac668dd0b965eaf886ad3bf4 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Tue, 10 Jan 2017 23:20:48 -0500 Subject: [PATCH 17/21] Removed constexpr use to support VS2013 --- Engine/source/console/consoleTypes.h | 2 +- Engine/source/console/engineAPI.h | 8 ++++---- Engine/source/console/engineFunctions.h | 3 +-- Engine/source/ts/tsShapeConstruct.h | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Engine/source/console/consoleTypes.h b/Engine/source/console/consoleTypes.h index 8b64d4fa1..1285a213d 100644 --- a/Engine/source/console/consoleTypes.h +++ b/Engine/source/console/consoleTypes.h @@ -39,7 +39,7 @@ #include "console/engineStructs.h" #endif -template constexpr T nullAsType(){ return nullptr; } +template inline const T nullAsType(){ return nullptr; } /// @file /// Legacy TS-based console type definitions. diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 79decae13..049cce54d 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -542,7 +542,7 @@ namespace engineAPI{ template struct Gens<0, I...>{ typedef Seq type; }; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; - static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; + static const S32 NUM_ARGS = sizeof...(ArgTs) + startArgc; template static IthArgType getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs) @@ -599,7 +599,7 @@ public: typedef typename Helper::FunctionType FunctionType; typedef typename Helper::ReturnType ReturnType; template using MethodType = typename Helper::template MethodType; - static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + static const S32 NUM_ARGS = Helper::NUM_ARGS; static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) { @@ -622,7 +622,7 @@ public: typedef typename Helper::FunctionType FunctionType; typedef typename Helper::ReturnType ReturnType; template using MethodType = typename Helper::template MethodType; - static constexpr S32 NUM_ARGS = Helper::NUM_ARGS; + static const S32 NUM_ARGS = Helper::NUM_ARGS; static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs) { @@ -1162,7 +1162,7 @@ struct _BaseEngineConsoleCallbackHelper public: /// Matches up to storeArgs. - static constexpr U32 MAX_ARGUMENTS = 11; + static const U32 MAX_ARGUMENTS = 11; SimObject* mThis; S32 mInitialArgc; diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 08249ec16..cbe5b1971 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -105,8 +105,7 @@ private: template static void copyHelper(std::tuple ...> &args, std::tuple ...> &defaultArgs, Seq) { - constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs)); - std::tie(std::get(args)...) = defaultArgs; + std::tie(std::get(args)...) = defaultArgs; } template using MaybeSelfEnabled = typename std::enable_if::type; diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index f3de7f490..7826e0507 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -97,7 +97,7 @@ public: { eCommandType type; // Command type StringTableEntry name; // Command name - static constexpr U32 MAX_ARGS = 10; + static const U32 MAX_ARGS = 10; String argv[MAX_ARGS]; // Command arguments S32 argc; // Number of arguments Command() : type(CmdInvalid), name(0), argc(0) { } From ad4a5e5a88efb56777b63d4edc3584aad832a357 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Wed, 11 Jan 2017 17:11:37 -0500 Subject: [PATCH 18/21] reindented --- .../sdl/src/joystick/SDL_gamecontrollerdb.h | 4 ++-- Engine/lib/sdl/src/main/haiku/SDL_BApp.h | 2 +- Engine/lib/sdl/src/video/haiku/SDL_BWin.h | 2 +- Engine/lib/sdl/src/video/x11/SDL_x11sym.h | 4 ++-- Engine/source/T3D/vehicles/guiSpeedometer.cpp | 20 +++++++++---------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h index 1e623cbb8..4c29087d3 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h @@ -40,8 +40,8 @@ static const char *s_ControllerMappings [] = "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h index 9672d462c..76605cc69 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h @@ -194,7 +194,7 @@ public: _current_context->UnlockGL(); _current_context = newContext; if (_current_context) - _current_context->LockGL(); + _current_context->LockGL(); } private: /* Event management */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h index a353e1aca..4a4aaa584 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h @@ -532,7 +532,7 @@ private: msg.AddInt32("key-state", keyState); msg.AddInt32("key-scancode", keyCode); if (keyUtf8 != NULL) { - msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); + msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); } be_app->PostMessage(&msg); } diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h index 7290412b7..c797f94e3 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h @@ -45,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char * SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return) -SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) +SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return) SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return) @@ -199,7 +199,7 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),) SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return) SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return) SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) -SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) +SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) #endif diff --git a/Engine/source/T3D/vehicles/guiSpeedometer.cpp b/Engine/source/T3D/vehicles/guiSpeedometer.cpp index b43f65951..847c24a8c 100644 --- a/Engine/source/T3D/vehicles/guiSpeedometer.cpp +++ b/Engine/source/T3D/vehicles/guiSpeedometer.cpp @@ -156,7 +156,7 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect) if (!conn) return; - // Requires either a vehicle control object or a vehicle-mounted player + // Requires either a vehicle control object or a vehicle-mounted player Vehicle* vehicle = dynamic_cast(conn->getControlObject()); if(!vehicle){ Player * player = dynamic_cast(conn->getControlObject()); @@ -183,20 +183,20 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect) F32 fillOffset = GFX->getFillConventionOffset(); // Find the fill offset Point2F viewCenter(offset.x + fillOffset + center.x, offset.y + fillOffset + center.y); - // Handle rotation calculations + // Handle rotation calculations F32 rotation, spinAngle; rotation = mMinAngle + (mMaxAngle - mMinAngle) * (mSpeed / mMaxSpeed); spinAngle = mDegToRad(rotation); MatrixF rotMatrix(EulerF(0.0, 0.0, spinAngle)); - // Set up the needle vertex list - Point3F vertList[5]; - vertList[0].set(+mNeedleLength,-mNeedleWidth,0); - vertList[1].set(+mNeedleLength,+mNeedleWidth,0); - vertList[2].set(-mTailLength ,+mNeedleWidth,0); - vertList[3].set(-mTailLength ,-mNeedleWidth,0); - vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start! - + // Set up the needle vertex list + Point3F vertList[5]; + vertList[0].set(+mNeedleLength,-mNeedleWidth,0); + vertList[1].set(+mNeedleLength,+mNeedleWidth,0); + vertList[2].set(-mTailLength ,+mNeedleWidth,0); + vertList[3].set(-mTailLength ,-mNeedleWidth,0); + vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start! + // Create a GFXStateBlock description if one has not been set. if (mBlendSB.isNull()) { From 332c06ae8292b50388d353d44314a3003eca9972 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Wed, 11 Jan 2017 23:21:29 -0500 Subject: [PATCH 19/21] Replaced StringTable->insert("") with StringTable->EmptyString() --- Engine/source/T3D/fx/fxFoliageReplicator.h | 48 +- Engine/source/T3D/fx/fxShapeReplicator.h | 2 +- Engine/source/T3D/fx/precipitation.cpp | 8 +- Engine/source/T3D/fx/ribbon.cpp | 6 +- Engine/source/T3D/missionMarker.cpp | 14 +- Engine/source/T3D/player.cpp | 8 +- Engine/source/T3D/shapeBase.cpp | 214 +++--- Engine/source/console/SimXMLDocument.cpp | 30 +- Engine/source/console/astAlloc.cpp | 2 +- Engine/source/console/codeBlock.cpp | 2 +- Engine/source/console/fieldBrushObject.cpp | 4 +- Engine/source/console/persistenceManager.cpp | 2 +- .../source/gui/buttons/guiIconButtonCtrl.cpp | 36 +- .../gui/buttons/guiToggleButtonCtrl.cpp | 4 +- .../gui/buttons/guiToolboxButtonCtrl.cpp | 4 +- Engine/source/gui/containers/guiFormCtrl.cpp | 8 +- Engine/source/gui/containers/guiPaneCtrl.cpp | 18 +- .../source/gui/containers/guiWindowCtrl.cpp | 18 +- .../gui/controls/guiGameListMenuCtrl.cpp | 4 +- Engine/source/gui/controls/guiListBoxCtrl.cpp | 138 ++-- Engine/source/gui/controls/guiMLTextCtrl.cpp | 56 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 164 ++--- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 300 ++++---- Engine/source/gui/controls/guiTextCtrl.cpp | 44 +- .../source/gui/controls/guiTextEditCtrl.cpp | 138 ++-- .../source/gui/controls/guiTreeViewCtrl.cpp | 370 +++++----- .../gui/editor/guiParticleGraphCtrl.cpp | 640 +++++++++--------- .../source/gui/game/guiChunkedBitmapCtrl.cpp | 6 +- Engine/source/gui/worldEditor/undoActions.cpp | 32 +- Engine/source/navigation/navMesh.cpp | 4 +- Engine/source/navigation/navPath.cpp | 4 +- Engine/source/platform/menus/popupMenu.cpp | 20 +- .../platform/nativeDialogs/fileDialog.cpp | 8 +- 33 files changed, 1178 insertions(+), 1178 deletions(-) diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.h b/Engine/source/T3D/fx/fxFoliageReplicator.h index e40554454..c9f8a0804 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.h +++ b/Engine/source/T3D/fx/fxFoliageReplicator.h @@ -64,16 +64,16 @@ class fxFoliageItem { public: - MatrixF Transform; - F32 Width; - F32 Height; - Box3F FoliageBox; - bool Flipped; + MatrixF Transform; + F32 Width; + F32 Height; + Box3F FoliageBox; + bool Flipped; F32 SwayPhase; F32 SwayTimeRatio; - F32 LightPhase; + F32 LightPhase; F32 LightTimeRatio; - U32 LastFrameSerialID; + U32 LastFrameSerialID; }; //------------------------------------------------------------------------------ @@ -104,9 +104,9 @@ public: Box3F QuadrantBox; fxFoliageQuadrantNode* QuadrantChildNode[4]; Vector RenderList; - // Used in DrawIndexPrimitive call. - U32 startIndex; - U32 primitiveCount; + // Used in DrawIndexPrimitive call. + U32 startIndex; + U32 primitiveCount; }; @@ -152,7 +152,7 @@ protected: void CreateFoliage(void); void DestroyFoliage(void); - void DestroyFoliageItems(); + void DestroyFoliageItems(); void SyncFoliageReplicators(void); @@ -172,11 +172,11 @@ protected: Vector mReplicatedFoliage; fxFoliageRenderList mFrustumRenderSet; - GFXVertexBufferHandle mVertexBuffer; - GFXPrimitiveBufferHandle mPrimBuffer; + GFXVertexBufferHandle mVertexBuffer; + GFXPrimitiveBufferHandle mPrimBuffer; GFXShaderRef mShader; ShaderData* mShaderData; - GBitmap* mAlphaLookup; + GBitmap* mAlphaLookup; MRandomLCG RandomGen; F32 mFadeInGradient; @@ -193,8 +193,8 @@ protected: U32 mNextAllocatedNodeIdx; // Next Allocated Node Index. U32 mBillboardsAcquired; // Billboards Acquired. - // Used for alpha lookup in the pixel shader - GFXTexHandle mAlphaTexture; + // Used for alpha lookup in the pixel shader + GFXTexHandle mAlphaTexture; GFXStateBlockRef mPlacementSB; GFXStateBlockRef mRenderSB; @@ -223,15 +223,15 @@ protected: bool mDirty; - + void SetupShader(); - void SetupBuffers(); + void SetupBuffers(); void renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance*); - void renderBuffers(SceneRenderState* state); - void renderArc(const F32 fRadiusX, const F32 fRadiusY); - void renderPlacementArea(const F32 ElapsedTime); - void renderQuad(fxFoliageQuadrantNode* quadNode, const MatrixF& RenderTransform, const bool UseDebug); - void computeAlphaTex(); + void renderBuffers(SceneRenderState* state); + void renderArc(const F32 fRadiusX, const F32 fRadiusY); + void renderPlacementArea(const F32 ElapsedTime); + void renderQuad(fxFoliageQuadrantNode* quadNode, const MatrixF& RenderTransform, const bool UseDebug); + void computeAlphaTex(); public: fxFoliageReplicator(); ~fxFoliageReplicator(); @@ -325,7 +325,7 @@ public: mUseDebugInfo = false; mDebugBoxHeight = 1.0f; mSeed = 1376312589; - mFoliageFile = StringTable->insert(""); + mFoliageFile = StringTable->EmptyString(); mFoliageTexture = GFXTexHandle(); mFoliageCount = 10; mFoliageRetries = 100; diff --git a/Engine/source/T3D/fx/fxShapeReplicator.h b/Engine/source/T3D/fx/fxShapeReplicator.h index 8cd9efa4e..e83f0e113 100644 --- a/Engine/source/T3D/fx/fxShapeReplicator.h +++ b/Engine/source/T3D/fx/fxShapeReplicator.h @@ -153,7 +153,7 @@ public: { // Set Defaults. mSeed = 1376312589; - mShapeFile = StringTable->insert(""); + mShapeFile = StringTable->EmptyString(); mShapeCount = 10; mShapeRetries = 100; mInnerRadiusX = 0; diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index 19855e26f..232e8ca72 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -129,10 +129,10 @@ PrecipitationData::PrecipitationData() { soundProfile = NULL; - mDropName = StringTable->insert(""); - mDropShaderName = StringTable->insert(""); - mSplashName = StringTable->insert(""); - mSplashShaderName = StringTable->insert(""); + mDropName = StringTable->EmptyString(); + mDropShaderName = StringTable->EmptyString(); + mSplashName = StringTable->EmptyString(); + mSplashShaderName = StringTable->EmptyString(); mDropsPerSide = 4; mSplashesPerSide = 2; diff --git a/Engine/source/T3D/fx/ribbon.cpp b/Engine/source/T3D/fx/ribbon.cpp index 6ebcfc932..ef5276857 100644 --- a/Engine/source/T3D/fx/ribbon.cpp +++ b/Engine/source/T3D/fx/ribbon.cpp @@ -57,7 +57,7 @@ RibbonData::RibbonData() mUseFadeOut = false; mFadeAwayStep = 0.032f; segmentsPerUpdate = 1; - mMatName = StringTable->insert(""); + mMatName = StringTable->EmptyString(); mTileScale = 1.0f; mFixedTexcoords = false; mSegmentSkipAmount = 0; @@ -318,7 +318,7 @@ void Ribbon::processTick(const Move* move) safeDeleteObject(); return; //} - //mSegmentPoints.pop_back(); + //mSegmentPoints.pop_back(); } @@ -456,7 +456,7 @@ void Ribbon::setShaderParams() { F32 length = (F32)mDataBlock->mRibbonLength; Point3F radius(numSegments / length, numSegments, length); MaterialParameters* matParams = mRibbonMat->getMaterialParameters(); - matParams->setSafe( mRadiusSC, radius ); + matParams->setSafe( mRadiusSC, radius ); } //-------------------------------------------------------------------------- diff --git a/Engine/source/T3D/missionMarker.cpp b/Engine/source/T3D/missionMarker.cpp index 3a043b095..1480e2f1f 100644 --- a/Engine/source/T3D/missionMarker.cpp +++ b/Engine/source/T3D/missionMarker.cpp @@ -225,7 +225,7 @@ ConsoleDocClass( WayPoint, WayPoint::WayPoint() { - mName = StringTable->insert(""); + mName = StringTable->EmptyString(); } void WayPoint::setHidden(bool hidden) @@ -256,7 +256,7 @@ void WayPoint::inspectPostApply() { Parent::inspectPostApply(); if(!mName || !mName[0]) - mName = StringTable->insert(""); + mName = StringTable->EmptyString(); setMaskBits(UpdateNameMask|UpdateTeamMask); } @@ -281,7 +281,7 @@ void WayPoint::unpackUpdate(NetConnection * con, BitStream * stream) void WayPoint::initPersistFields() { - addGroup("Misc"); + addGroup("Misc"); addField("markerName", TypeCaseString, Offset(mName, WayPoint), "Unique name representing this waypoint"); endGroup("Misc"); Parent::initPersistFields(); @@ -363,7 +363,7 @@ bool SpawnSphere::onAdd() if (!isGhost()) { - onAdd_callback( getId()); + onAdd_callback( getId()); if (mAutoSpawn) spawnObject(); @@ -527,7 +527,7 @@ ConsoleDocClass( CameraBookmark, CameraBookmark::CameraBookmark() { - mName = StringTable->insert(""); + mName = StringTable->EmptyString(); } bool CameraBookmark::onAdd() @@ -571,7 +571,7 @@ void CameraBookmark::inspectPostApply() { Parent::inspectPostApply(); if(!mName || !mName[0]) - mName = StringTable->insert(""); + mName = StringTable->EmptyString(); setMaskBits(UpdateNameMask); if( isMethod("onInspectPostApply") ) @@ -595,7 +595,7 @@ void CameraBookmark::unpackUpdate(NetConnection * con, BitStream * stream) void CameraBookmark::initPersistFields() { - //addGroup("Misc"); + //addGroup("Misc"); //addField("name", TypeCaseString, Offset(mName, CameraBookmark)); //endGroup("Misc"); diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 1623e4819..916a64c39 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -257,15 +257,15 @@ PlayerData::PlayerData() firstPersonShadows = false; // Used for third person image rendering - imageAnimPrefix = StringTable->insert(""); + imageAnimPrefix = StringTable->EmptyString(); allowImageStateAnimation = false; // Used for first person image rendering - imageAnimPrefixFP = StringTable->insert(""); + imageAnimPrefixFP = StringTable->EmptyString(); for (U32 i=0; iinsert(""); + shapeNameFP[i] = StringTable->EmptyString(); mCRCFP[i] = 0; mValidShapeFP[i] = false; } @@ -418,7 +418,7 @@ PlayerData::PlayerData() jumpTowardsNormal = true; - physicsPlayerType = StringTable->insert(""); + physicsPlayerType = StringTable->EmptyString(); dMemset( actionList, 0, sizeof(actionList) ); } diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 670446ab3..829a78bf6 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -152,13 +152,13 @@ ShapeBaseData::ShapeBaseData() shadowMaxVisibleDistance( 80.0f ), shadowProjectionDistance( 10.0f ), shadowSphereAdjust( 1.0f ), - shapeName( StringTable->insert("") ), - cloakTexName( StringTable->insert("") ), + shapeName( StringTable->EmptyString() ), + cloakTexName( StringTable->EmptyString() ), cubeDescId( 0 ), reflectorDesc( NULL ), debris( NULL ), debrisID( 0 ), - debrisShapeName( StringTable->insert("") ), + debrisShapeName( StringTable->EmptyString() ), explosion( NULL ), explosionID( 0 ), underwaterExplosion( NULL ), @@ -447,12 +447,12 @@ bool ShapeBaseData::_setMass( void* object, const char* index, const char* data { ShapeBaseData* shape = reinterpret_cast< ShapeBaseData* >( object ); - F32 mass = dAtof(data); + F32 mass = dAtof(data); - if (mass <= 0) - mass = 0.01f; + if (mass <= 0) + mass = 0.01f; - shape->mass = mass; + shape->mass = mass; return false; } @@ -935,8 +935,8 @@ ShapeBase::ShapeBase() mScriptThread[i].thread = 0; mScriptThread[i].state = Thread::Stop; mScriptThread[i].atEnd = false; - mScriptThread[i].timescale = 1.f; - mScriptThread[i].position = -1.f; + mScriptThread[i].timescale = 1.f; + mScriptThread[i].position = -1.f; } for (i = 0; i < MaxTriggerKeys; i++) @@ -1042,7 +1042,7 @@ bool ShapeBase::onAdd() } /* - if(mDataBlock->cloakTexName != StringTable->insert("")) + if(mDataBlock->cloakTexName != StringTable->EmptyString()) mCloakTexture = TextureHandle(mDataBlock->cloakTexName, MeshTexture, false); */ // Accumulation and environment mapping @@ -1512,8 +1512,8 @@ void ShapeBase::onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query) eyeTransform.getColumn(1, &query->orientation); // Get the visible distance. - if (getSceneManager() != NULL) - query->visibleDistance = getSceneManager()->getVisibleDistance(); + if (getSceneManager() != NULL) + query->visibleDistance = getSceneManager()->getVisibleDistance(); Parent::onCameraScopeQuery( cr, query ); } @@ -2154,18 +2154,18 @@ void ShapeBase::updateAudioPos() const char *ShapeBase::getThreadSequenceName( U32 slot ) { - Thread& st = mScriptThread[slot]; - if ( st.sequence == -1 ) - { - // Invalid Animation. - return ""; - } + Thread& st = mScriptThread[slot]; + if ( st.sequence == -1 ) + { + // Invalid Animation. + return ""; + } - // Name Index - const U32 nameIndex = getShape()->sequences[st.sequence].nameIndex; + // Name Index + const U32 nameIndex = getShape()->sequences[st.sequence].nameIndex; - // Return Name. - return getShape()->getName( nameIndex ); + // Return Name. + return getShape()->getName( nameIndex ); } bool ShapeBase::setThreadSequence(U32 slot, S32 seq, bool reset) @@ -2200,39 +2200,39 @@ bool ShapeBase::setThreadSequence(U32 slot, S32 seq, bool reset) void ShapeBase::updateThread(Thread& st) { - switch (st.state) - { - case Thread::Stop: - { - mShapeInstance->setTimeScale( st.thread, 1.f ); - mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f ); - } // Drop through to pause state + switch (st.state) + { + case Thread::Stop: + { + mShapeInstance->setTimeScale( st.thread, 1.f ); + mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f ); + } // Drop through to pause state - case Thread::Pause: - { - mShapeInstance->setTimeScale( st.thread, 0.f ); - } break; + case Thread::Pause: + { + mShapeInstance->setTimeScale( st.thread, 0.f ); + } break; - case Thread::Play: - { - if (st.atEnd) - { - mShapeInstance->setTimeScale(st.thread,1); - mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f ); - mShapeInstance->setTimeScale(st.thread,0); + case Thread::Play: + { + if (st.atEnd) + { + mShapeInstance->setTimeScale(st.thread,1); + mShapeInstance->setPos( st.thread, ( st.timescale > 0.f ) ? 1.0f : 0.0f ); + mShapeInstance->setTimeScale(st.thread,0); st.state = Thread::Stop; - } - else - { - if ( st.position != -1.f ) - { - mShapeInstance->setTimeScale( st.thread, 1.f ); - mShapeInstance->setPos( st.thread, st.position ); - } + } + else + { + if ( st.position != -1.f ) + { + mShapeInstance->setTimeScale( st.thread, 1.f ); + mShapeInstance->setPos( st.thread, st.position ); + } - mShapeInstance->setTimeScale(st.thread, st.timescale ); - } - } break; + mShapeInstance->setTimeScale(st.thread, st.timescale ); + } + } break; case Thread::Destroy: { @@ -2244,7 +2244,7 @@ void ShapeBase::updateThread(Thread& st) st.thread = 0; } } break; - } + } } bool ShapeBase::stopThread(U32 slot) @@ -2297,50 +2297,50 @@ bool ShapeBase::playThread(U32 slot) bool ShapeBase::setThreadPosition( U32 slot, F32 pos ) { - Thread& st = mScriptThread[slot]; - if (st.sequence != -1) - { - setMaskBits(ThreadMaskN << slot); - st.position = pos; - st.atEnd = false; - updateThread(st); + Thread& st = mScriptThread[slot]; + if (st.sequence != -1) + { + setMaskBits(ThreadMaskN << slot); + st.position = pos; + st.atEnd = false; + updateThread(st); - return true; - } - return false; + return true; + } + return false; } bool ShapeBase::setThreadDir(U32 slot,bool forward) { - Thread& st = mScriptThread[slot]; - if (st.sequence != -1) - { - if ( ( st.timescale >= 0.f ) != forward ) - { - setMaskBits(ThreadMaskN << slot); - st.timescale *= -1.f ; - st.atEnd = false; - updateThread(st); - } - return true; - } - return false; + Thread& st = mScriptThread[slot]; + if (st.sequence != -1) + { + if ( ( st.timescale >= 0.f ) != forward ) + { + setMaskBits(ThreadMaskN << slot); + st.timescale *= -1.f ; + st.atEnd = false; + updateThread(st); + } + return true; + } + return false; } bool ShapeBase::setThreadTimeScale( U32 slot, F32 timeScale ) { - Thread& st = mScriptThread[slot]; - if (st.sequence != -1) - { - if (st.timescale != timeScale) - { - setMaskBits(ThreadMaskN << slot); - st.timescale = timeScale; - updateThread(st); - } - return true; - } - return false; + Thread& st = mScriptThread[slot]; + if (st.sequence != -1) + { + if (st.timescale != timeScale) + { + setMaskBits(ThreadMaskN << slot); + st.timescale = timeScale; + updateThread(st); + } + return true; + } + return false; } void ShapeBase::advanceThreads(F32 dt) @@ -2349,7 +2349,7 @@ void ShapeBase::advanceThreads(F32 dt) Thread& st = mScriptThread[i]; if (st.thread) { if (!mShapeInstance->getShape()->sequences[st.sequence].isCyclic() && !st.atEnd && - ( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0: + ( ( st.timescale > 0.f )? mShapeInstance->getPos(st.thread) >= 1.0: mShapeInstance->getPos(st.thread) <= 0)) { st.atEnd = true; updateThread(st); @@ -4392,7 +4392,7 @@ DefineEngineMethod( ShapeBase, isEnabled, bool, (),, DefineEngineMethod(ShapeBase, blowUp, void, (),, "@brief Explodes an object into pieces.") { - object->blowUp(); + object->blowUp(); } DefineEngineMethod( ShapeBase, applyDamage, void, ( F32 amount ),, @@ -4696,22 +4696,22 @@ void ShapeBase::consoleInit() "@see ShapeBase::setDamageFlash()\n" "@see ShapeBase::getDamageFlash()\n" "@note Relies on the flash postFx.\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); Con::addVariable("SB::WODec", TypeF32, &sWhiteoutDec, "Speed to reduce the whiteout effect per tick.\n\n" "@see ShapeBase::setWhiteOut()\n" "@see ShapeBase::getWhiteOut" "@note Relies on the flash postFx.\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); Con::addVariable("SB::FullCorrectionDistance", TypeF32, &sFullCorrectionDistance, "@brief Distance at which a weapon's muzzle vector is fully corrected to match where the player is looking.\n\n" "When a weapon image has correctMuzzleVector set and the Player is in 1st person, the muzzle vector from the " "weapon is modified to match where the player is looking. Beyond the FullCorrectionDistance the muzzle vector " "is always corrected. Between FullCorrectionDistance and the player, the weapon's muzzle vector is adjusted so that " "the closer the aim point is to the player, the closer the muzzle vector is to the true (non-corrected) one.\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); Con::addVariable("SB::CloakSpeed", TypeF32, &sCloakSpeed, "@brief Time to cloak, in seconds.\n\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); } void ShapeBase::_updateHiddenMeshes() @@ -4832,17 +4832,17 @@ DefineEngineMethod( ShapeBase, getTargetName, const char*, ( S32 index ),, "@see getTargetCount()\n") { - ShapeBase *obj = dynamic_cast< ShapeBase* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((ShapeBase*)obj->getClientObject()) - obj = (ShapeBase*)obj->getClientObject(); + ShapeBase *obj = dynamic_cast< ShapeBase* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((ShapeBase*)obj->getClientObject()) + obj = (ShapeBase*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetName(index); - } + return obj->getShapeInstance()->getTargetName(index); + } - return ""; + return ""; } DefineEngineMethod( ShapeBase, getTargetCount, S32, (),, @@ -4861,7 +4861,7 @@ DefineEngineMethod( ShapeBase, getTargetCount, S32, (),, if (obj->getShapeInstance() != NULL) return obj->getShapeInstance()->getTargetCount(); - } + } return -1; } @@ -4938,10 +4938,10 @@ DefineEngineMethod( ShapeBase, getModelFile, const char *, (),, "@return the shape filename\n\n" ) { - GameBaseData * datablock = object->getDataBlock(); - if( !datablock ) - return String::EmptyString; + GameBaseData * datablock = object->getDataBlock(); + if( !datablock ) + return String::EmptyString; - const char *fieldName = StringTable->insert( String("shapeFile") ); + const char *fieldName = StringTable->insert( String("shapeFile") ); return datablock->getDataField( fieldName, NULL ); } diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index faa4a6017..b2960105b 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -504,13 +504,13 @@ const char* SimXMLDocument::elementValue() { if(m_paNode.empty()) { - return StringTable->insert(""); + return StringTable->EmptyString(); } const S32 iLastElement = m_paNode.size() - 1; TiXmlElement* pNode = m_paNode[iLastElement]; if(!pNode) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return pNode->Value(); @@ -545,18 +545,18 @@ const char* SimXMLDocument::attribute(const char* rAttribute) { if(m_paNode.empty()) { - return StringTable->insert(""); + return StringTable->EmptyString(); } const S32 iLastElement = m_paNode.size() - 1; TiXmlElement* pNode = m_paNode[iLastElement]; if(!pNode) { - return StringTable->insert(""); + return StringTable->EmptyString(); } if(!pNode->Attribute(rAttribute)) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return pNode->Attribute(rAttribute); @@ -629,20 +629,20 @@ const char* SimXMLDocument::firstAttribute() // Get the current element if(m_paNode.empty()) { - return StringTable->insert(""); + return StringTable->EmptyString(); } const S32 iLastElement = m_paNode.size() - 1; TiXmlElement* pNode = m_paNode[iLastElement]; if(!pNode) { - return StringTable->insert(""); + return StringTable->EmptyString(); } // Gets its first attribute, if any m_CurrentAttribute = pNode->FirstAttribute(); if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return m_CurrentAttribute->Name(); @@ -666,20 +666,20 @@ const char* SimXMLDocument::lastAttribute() // Get the current element if(m_paNode.empty()) { - return StringTable->insert(""); + return StringTable->EmptyString(); } const S32 iLastElement = m_paNode.size() - 1; TiXmlElement* pNode = m_paNode[iLastElement]; if(!pNode) { - return StringTable->insert(""); + return StringTable->EmptyString(); } // Gets its last attribute, if any m_CurrentAttribute = pNode->LastAttribute(); if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return m_CurrentAttribute->Name(); @@ -703,14 +703,14 @@ const char* SimXMLDocument::nextAttribute() { if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } // Gets its next attribute, if any m_CurrentAttribute = m_CurrentAttribute->Next(); if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return m_CurrentAttribute->Name(); @@ -734,14 +734,14 @@ const char* SimXMLDocument::prevAttribute() { if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } // Gets its next attribute, if any m_CurrentAttribute = m_CurrentAttribute->Previous(); if(!m_CurrentAttribute) { - return StringTable->insert(""); + return StringTable->EmptyString(); } return m_CurrentAttribute->Name(); diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index 19809a1e2..fb69f49d5 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -411,7 +411,7 @@ ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, if(parentObject) ret->parentObject = parentObject; else - ret->parentObject = StringTable->insert(""); + ret->parentObject = StringTable->EmptyString(); return ret; } diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 904558bef..192b50f0f 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -435,7 +435,7 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) if(offset < globalSize) ste = StringTable->insert(globalStrings + offset); else - ste = StringTable->insert(""); + ste = StringTable->EmptyString(); U32 count; st.read(&count); while(count--) diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 484178dec..407a57cb3 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -41,8 +41,8 @@ ConsoleDocClass( FieldBrushObject, FieldBrushObject::FieldBrushObject() { // Reset Description. - mDescription = StringTable->insert(""); - mSortName = StringTable->insert(""); + mDescription = StringTable->EmptyString(); + mSortName = StringTable->EmptyString(); } diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index 7db907475..c4af549ed 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -328,7 +328,7 @@ void PersistenceManager::parseObject() if (mParser.tokenICmp(")")) { - mCurrentObject->name = StringTable->insert(""); + mCurrentObject->name = StringTable->EmptyString(); mCurrentObject->nameLine = mParser.getCurrentLine(); mCurrentObject->namePosition = mParser.getTokenLineOffset(); diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index b4aed4ec7..e9d654d2a 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -59,21 +59,21 @@ ConsoleDocClass( GuiIconButtonCtrl, "has been clicked.\n\n" "@tsexample\n" - "new GuiIconButtonCtrl(TestIconButton)\n" - "{\n" - " buttonMargin = \"4 4\";\n" - " iconBitmap = \"art/gui/lagIcon.png\";\n" - " iconLocation = \"Center\";\n" - " sizeIconToButton = \"0\";\n" - " makeIconSquare = \"1\";\n" - " textLocation = \"Bottom\";\n" - " textMargin = \"-2\";\n" - " autoSize = \"0\";\n" - " text = \"Lag Icon\";\n" - " textID = \"\"STR_LAG\"\";\n" - " buttonType = \"PushButton\";\n" - " profile = \"GuiIconButtonProfile\";\n" - "};\n" + "new GuiIconButtonCtrl(TestIconButton)\n" + "{\n" + " buttonMargin = \"4 4\";\n" + " iconBitmap = \"art/gui/lagIcon.png\";\n" + " iconLocation = \"Center\";\n" + " sizeIconToButton = \"0\";\n" + " makeIconSquare = \"1\";\n" + " textLocation = \"Bottom\";\n" + " textMargin = \"-2\";\n" + " autoSize = \"0\";\n" + " text = \"Lag Icon\";\n" + " textID = \"\"STR_LAG\"\";\n" + " buttonType = \"PushButton\";\n" + " profile = \"GuiIconButtonProfile\";\n" + "};\n" "@endtsexample\n\n" "@see GuiControl\n" @@ -85,7 +85,7 @@ ConsoleDocClass( GuiIconButtonCtrl, GuiIconButtonCtrl::GuiIconButtonCtrl() { - mBitmapName = StringTable->insert(""); + mBitmapName = StringTable->EmptyString(); mTextLocation = TextLocLeft; mIconLocation = IconLocLeft; mTextMargin = 4; @@ -94,7 +94,7 @@ GuiIconButtonCtrl::GuiIconButtonCtrl() mFitBitmapToButton = false; mMakeIconSquare = false; - mErrorBitmapName = StringTable->insert(""); + mErrorBitmapName = StringTable->EmptyString(); mErrorTextureHandle = NULL; mAutoSize = false; @@ -130,7 +130,7 @@ void GuiIconButtonCtrl::initPersistFields() addField( "sizeIconToButton", TypeBool, Offset( mFitBitmapToButton, GuiIconButtonCtrl ),"If true, the icon will be scaled to be the same size as the button.\n"); addField( "makeIconSquare", TypeBool, Offset( mMakeIconSquare, GuiIconButtonCtrl ),"If true, will make sure the icon is square.\n"); addField( "textLocation", TYPEID< TextLocation >(), Offset( mTextLocation, GuiIconButtonCtrl ),"Where to place the text on the control.\n" - "Options are 0 (None), 1 (Bottom), 2 (Right), 3 (Top), 4 (Left), 5 (Center).\n"); + "Options are 0 (None), 1 (Bottom), 2 (Right), 3 (Top), 4 (Left), 5 (Center).\n"); addField( "textMargin", TypeS32, Offset( mTextMargin, GuiIconButtonCtrl ),"Margin between the icon and the text.\n"); addField( "autoSize", TypeBool, Offset( mAutoSize, GuiIconButtonCtrl ),"If true, the text and icon will be automatically sized to the size of the control.\n"); Parent::initPersistFields(); diff --git a/Engine/source/gui/buttons/guiToggleButtonCtrl.cpp b/Engine/source/gui/buttons/guiToggleButtonCtrl.cpp index e5aa4b0f5..a2aaaa6c9 100644 --- a/Engine/source/gui/buttons/guiToggleButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiToggleButtonCtrl.cpp @@ -49,7 +49,7 @@ ConsoleDocClass( GuiToggleButtonCtrl, GuiToggleButtonCtrl::GuiToggleButtonCtrl() { setExtent(140, 30); - mButtonText = StringTable->insert(""); + mButtonText = StringTable->EmptyString(); mStateOn = false; mButtonType = ButtonTypeCheck; } @@ -60,7 +60,7 @@ void GuiToggleButtonCtrl::onPreRender() // If we have a script variable, make sure we're in sync if ( mConsoleVariable[0] ) - mStateOn = Con::getBoolVariable( mConsoleVariable ); + mStateOn = Con::getBoolVariable( mConsoleVariable ); } void GuiToggleButtonCtrl::onRender(Point2I offset, diff --git a/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp b/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp index 9242d8aff..ad65b5782 100644 --- a/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp @@ -43,7 +43,7 @@ ConsoleDocClass( GuiToolboxButtonCtrl, //------------------------------------- GuiToolboxButtonCtrl::GuiToolboxButtonCtrl() { - mNormalBitmapName = StringTable->insert(""); + mNormalBitmapName = StringTable->EmptyString(); mLoweredBitmapName = StringTable->insert("sceneeditor/client/images/buttondown"); mHoverBitmapName = StringTable->insert("sceneeditor/client/images/buttonup"); setMinExtent(Point2I(16,16)); @@ -225,4 +225,4 @@ void GuiToolboxButtonCtrl::renderButton(GFXTexHandle &texture, Point2I &offset, GFX->getDrawUtil()->drawBitmap(texture, finalOffset); renderChildControls( offset, updateRect); } -} \ No newline at end of file +} diff --git a/Engine/source/gui/containers/guiFormCtrl.cpp b/Engine/source/gui/containers/guiFormCtrl.cpp index e87bcb6d2..f94e6c234 100644 --- a/Engine/source/gui/containers/guiFormCtrl.cpp +++ b/Engine/source/gui/containers/guiFormCtrl.cpp @@ -50,8 +50,8 @@ GuiFormCtrl::GuiFormCtrl() mCaption = "[none]"; mUseSmallCaption = false; - mContentLibrary = StringTable->insert(""); - mContent = StringTable->insert(""); + mContentLibrary = StringTable->EmptyString(); + mContent = StringTable->EmptyString(); mCanSaveFieldDictionary = true; mIsContainer = true; @@ -158,7 +158,7 @@ void GuiFormCtrl::addObject(SimObject *newObj ) GuiControl* parent = getParent(); if ( parent ) - parent->addObject( newObj ); + parent->addObject( newObj ); return; } @@ -213,7 +213,7 @@ bool GuiFormCtrl::resize(const Point2I &newPosition, const Point2I &newExtent) static char buf[256]; mUseSmallCaption = true; - mSmallCaption = StringTable->insert(""); + mSmallCaption = StringTable->EmptyString(); S32 strlen = dStrlen((const char*)mCaption); for(S32 i=strlen; i>=0; --i) diff --git a/Engine/source/gui/containers/guiPaneCtrl.cpp b/Engine/source/gui/containers/guiPaneCtrl.cpp index 1637b0b30..4d2ae5e61 100644 --- a/Engine/source/gui/containers/guiPaneCtrl.cpp +++ b/Engine/source/gui/containers/guiPaneCtrl.cpp @@ -68,7 +68,7 @@ GuiPaneControl::GuiPaneControl() mMouseOver = false; mDepressed = false; mCaption = "A Pane"; - mCaptionID = StringTable->insert(""); + mCaptionID = StringTable->EmptyString(); mIsContainer = true; mOriginalExtents.set(10,10); @@ -108,7 +108,7 @@ bool GuiPaneControl::onWake() } if(mCaptionID && *mCaptionID != 0) - setCaptionID(mCaptionID); + setCaptionID(mCaptionID); mProfile->constructBitmapArray(); if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size()) @@ -131,19 +131,19 @@ bool GuiPaneControl::onWake() void GuiPaneControl::setCaptionID(const char *id) { - S32 n = Con::getIntVariable(id, -1); - if(n != -1) - { - mCaptionID = StringTable->insert(id); - setCaptionID(n); - } + S32 n = Con::getIntVariable(id, -1); + if(n != -1) + { + mCaptionID = StringTable->insert(id); + setCaptionID(n); + } } //----------------------------------------------------------------------------- void GuiPaneControl::setCaptionID(S32 id) { - mCaption = getGUIString(id); + mCaption = getGUIString(id); } //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 84be45148..df8838fa1 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -231,7 +231,7 @@ void GuiWindowCtrl::moveFromCollapseGroup() parent->mCollapseGroupVec[groupVec].first()->mCollapseGroupNum = -1; parent->mCollapseGroupVec[groupVec].erase(U32(0)); parent->mCollapseGroupVec[groupVec].setSize(groupVecCount - 1); - parent->mCollapseGroupVec.erase(groupVec); + parent->mCollapseGroupVec.erase(groupVec); } } @@ -381,7 +381,7 @@ void GuiWindowCtrl::refreshCollapseGroups() if( !parent ) return; - CollapseGroupNumVec collapseGroupNumVec; + CollapseGroupNumVec collapseGroupNumVec; // iterate through the collided array, renumbering the windows pointers S32 assignGroupNum = 0; @@ -463,7 +463,7 @@ void GuiWindowCtrl::handleCollapseGroup() if( !parent ) return; - CollapseGroupNumVec collapseGroupNumVec; + CollapseGroupNumVec collapseGroupNumVec; if( mIsCollapsed ) // minimize window up to its header bar { @@ -529,7 +529,7 @@ void GuiWindowCtrl::handleCollapseGroup() if((*iter)->mCollapseGroupNum > mCollapseGroupNum) { Point2I newChildPosition = (*iter)->getPosition(); - newChildPosition.y += moveChildYBy; + newChildPosition.y += moveChildYBy; (*iter)->resize(newChildPosition, (*iter)->getExtent()); } } @@ -547,7 +547,7 @@ bool GuiWindowCtrl::resizeCollapseGroup(bool resizeX, bool resizeY, Point2I resi if( !parent ) return false; - CollapseGroupNumVec collapseGroupNumVec; + CollapseGroupNumVec collapseGroupNumVec; bool canResize = true; CollapseGroupNumVec::iterator iter = parent->mCollapseGroupVec[mCollapseGroup].begin(); @@ -980,7 +980,7 @@ void GuiWindowCtrl::onMouseDragged(const GuiEvent &event) moveWithCollapseGroup(newPosition); if(mCanCollapse && mCollapseGroup >= 0 && mResizeWindow == true ) - { + { // Resize the window if allowed if( newExtent.y >= getMinExtent().y && newExtent.x >= getMinExtent().x) { @@ -1212,7 +1212,7 @@ void GuiWindowCtrl::onMouseUp(const GuiEvent &event) // We're either moving out of a collapse group or moving to another one // Not valid for windows not previously in a group if( mCollapseGroup >= 0 && - (snapType == -1 || (hitWindow && snapType >= 0 && mCollapseGroup != hitWindow->mCollapseGroup))) + (snapType == -1 || (hitWindow && snapType >= 0 && mCollapseGroup != hitWindow->mCollapseGroup))) moveFromCollapseGroup(); // No window to connect to @@ -1512,7 +1512,7 @@ void GuiWindowCtrl::setCloseCommand(const char *newCmd) if (newCmd) mCloseCommand = StringTable->insert(newCmd); else - mCloseCommand = StringTable->insert(""); + mCloseCommand = StringTable->EmptyString(); } //----------------------------------------------------------------------------- @@ -1830,7 +1830,7 @@ void GuiWindowCtrl::parentResized(const RectI &oldParentRect, const RectI &newPa // Only for collpasing groups, if were not, then do it like normal windows if( mCanCollapse && mCollapseGroup >= 0 ) - { + { bool resizeMe = false; // Only the group window should control positioning diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 760a0246a..e64f2c7c0 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -38,7 +38,7 @@ GuiGameListMenuCtrl::GuiGameListMenuCtrl() VECTOR_SET_ASSOCIATION(mRows); // initialize the control callbacks - mCallbackOnA = StringTable->insert(""); + mCallbackOnA = StringTable->EmptyString(); mCallbackOnB = mCallbackOnA; mCallbackOnX = mCallbackOnA; mCallbackOnY = mCallbackOnA; @@ -572,7 +572,7 @@ StringTableEntry GuiGameListMenuCtrl::getRowLabel(S32 rowIndex) const if (! isValidRowIndex(rowIndex)) { // not a valid row index, don't do anything - return StringTable->insert(""); + return StringTable->EmptyString(); } return mRows[rowIndex]->mLabel; } diff --git a/Engine/source/gui/controls/guiListBoxCtrl.cpp b/Engine/source/gui/controls/guiListBoxCtrl.cpp index 22108ee3d..992d64903 100644 --- a/Engine/source/gui/controls/guiListBoxCtrl.cpp +++ b/Engine/source/gui/controls/guiListBoxCtrl.cpp @@ -52,9 +52,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onMouseDragged, void, (),(), "@tsexample\n" "// Mouse is dragged across the control, causing the callback to occur.\n" "GuiListBoxCtrl::onMouseDragged(%this)\n" - " {\n" - " // Code to run whenever the mouse is dragged across the control\n" - " }\n" + " {\n" + " // Code to run whenever the mouse is dragged across the control\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -64,9 +64,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onClearSelection, void, (),(), "@tsexample\n" "// A selected item is cleared, causing the callback to occur.\n" "GuiListBoxCtrl::onClearSelection(%this)\n" - " {\n" - " // Code to run whenever a selected item is cleared\n" - " }\n" + " {\n" + " // Code to run whenever a selected item is cleared\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -78,9 +78,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onUnSelect, void, ( S32 index, const char* i "@tsexample\n" "// A selected item is unselected, causing the callback to occur\n" "GuiListBoxCtrl::onUnSelect(%this, %indexId, %itemText)\n" - " {\n" - " // Code to run whenever a selected list item is unselected\n" - " }\n" + " {\n" + " // Code to run whenever a selected list item is unselected\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -92,9 +92,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onSelect, void, ( S32 index , const char* it "@tsexample\n" "// An item in the list is selected, causing the callback to occur\n" "GuiListBoxCtrl::onSelect(%this, %index, %itemText)\n" - " {\n" - " // Code to run whenever an item in the list is selected\n" - " }\n" + " {\n" + " // Code to run whenever an item in the list is selected\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -104,9 +104,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onDoubleClick, void, (),(), "@tsexample\n" "// An item in the list is double clicked, causing the callback to occur.\n" "GuiListBoxCtrl::onDoubleClick(%this)\n" - " {\n" - " // Code to run whenever an item in the control has been double clicked\n" - " }\n" + " {\n" + " // Code to run whenever an item in the control has been double clicked\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -121,9 +121,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onMouseUp, void, ( S32 itemHit, S32 mouseCli "@tsexample\n" "// Mouse was previously clicked down, and now has been released, causing the callback to occur.\n" "GuiListBoxCtrl::onMouseUp(%this, %itemHit, %mouseClickCount)\n" - " {\n" - " // Code to call whenever the mouse has been clicked and released on the control\n" - " }\n" + " {\n" + " // Code to call whenever the mouse has been clicked and released on the control\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -133,9 +133,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onDeleteKey, void, (),(), "@tsexample\n" "// The delete key on the keyboard has been pressed while this control is in focus, causing the callback to occur.\n" "GuiListBoxCtrl::onDeleteKey(%this)\n" - " {\n" - " // Code to call whenever the delete key is pressed\n" - " }\n" + " {\n" + " // Code to call whenever the delete key is pressed\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -146,10 +146,10 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, isObjectMirrored, bool, ( const char* indexI "@tsexample\n" "// Engine has requested of the script level to determine if a list entry is mirrored or not.\n" "GuiListBoxCtrl::isObjectMirrored(%this, %indexIdString)\n" - " {\n" - " // Perform code required to check and see if the list item at the index id is mirrored or not.\n" - " return %isMirrored;\n" - " }\n" + " {\n" + " // Perform code required to check and see if the list item at the index id is mirrored or not.\n" + " return %isMirrored;\n" + " }\n" "@endtsexample\n\n" "@return A boolean value on if the list item is mirrored or not.\n\n" "@see GuiControl\n\n" @@ -234,7 +234,7 @@ void GuiListBoxCtrl::clearItems() // Free our vector lists mItems.clear(); mSelectedItems.clear(); - mFilteredItems.clear(); + mFilteredItems.clear(); } DefineEngineMethod( GuiListBoxCtrl, clearSelection, void, (),, @@ -1511,8 +1511,8 @@ void GuiListBoxCtrl::_mirror() break; } } - - for ( U32 j = 0; j < mFilteredItems.size(); j++ ) + + for ( U32 j = 0; j < mFilteredItems.size(); j++ ) { if ( (SimObjectId)(uintptr_t)(mFilteredItems[j]->itemData) == curId ) { @@ -1530,7 +1530,7 @@ void GuiListBoxCtrl::_mirror() StringTableEntry GuiListBoxCtrl::_makeMirrorItemName( SimObject *inObj ) { - StringTableEntry outName = StringTable->insert(""); + StringTableEntry outName = StringTable->EmptyString(); if ( mMakeNameCallback.isNotEmpty() ) { @@ -1571,37 +1571,37 @@ DefineEngineMethod( GuiListBoxCtrl, addFilteredItem, void, (const char* newItem) "@endtsexample\n\n" "@see GuiControl") { - String item(newItem); - if( item == String::EmptyString ) - return; + String item(newItem); + if( item == String::EmptyString ) + return; - object->addFilteredItem( item ); + object->addFilteredItem( item ); } void GuiListBoxCtrl::addFilteredItem( String item ) { - // Delete from selected items list - for ( S32 i = 0; i < mSelectedItems.size(); i++ ) - { - String itemText = mSelectedItems[i]->itemText; - if ( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) - { - mSelectedItems.erase_fast( i ); - break; - } - } + // Delete from selected items list + for ( S32 i = 0; i < mSelectedItems.size(); i++ ) + { + String itemText = mSelectedItems[i]->itemText; + if ( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) + { + mSelectedItems.erase_fast( i ); + break; + } + } - for ( S32 i = 0; i < mItems.size(); i++ ) - { - String itemText = mItems[i]->itemText; - if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) - { - mItems[i]->isSelected = false; - mFilteredItems.push_front( mItems[i] ); - mItems.erase( &mItems[i] ); - break; - } - } + for ( S32 i = 0; i < mItems.size(); i++ ) + { + String itemText = mItems[i]->itemText; + if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) + { + mItems[i]->isSelected = false; + mFilteredItems.push_front( mItems[i] ); + mItems.erase( &mItems[i] ); + break; + } + } } DefineEngineMethod( GuiListBoxCtrl, removeFilteredItem, void, ( const char* itemName ),, @@ -1615,23 +1615,23 @@ DefineEngineMethod( GuiListBoxCtrl, removeFilteredItem, void, ( const char* item "@endtsexample\n\n" "@see GuiControl") { - String item(itemName); - if( item == String::EmptyString ) - return; + String item(itemName); + if( item == String::EmptyString ) + return; - object->removeFilteredItem( item ); + object->removeFilteredItem( item ); } void GuiListBoxCtrl::removeFilteredItem( String item ) { - for ( S32 i = 0; i < mFilteredItems.size(); i++ ) - { - String itemText = mFilteredItems[i]->itemText; - if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) - { - mItems.push_front( mFilteredItems[i] ); - mFilteredItems.erase( &mFilteredItems[i] ); - break; - } - } -} \ No newline at end of file + for ( S32 i = 0; i < mFilteredItems.size(); i++ ) + { + String itemText = mFilteredItems[i]->itemText; + if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 ) + { + mItems.push_front( mFilteredItems[i] ); + mFilteredItems.erase( &mFilteredItems[i] ); + break; + } + } +} diff --git a/Engine/source/gui/controls/guiMLTextCtrl.cpp b/Engine/source/gui/controls/guiMLTextCtrl.cpp index 1a4f64814..e61a82cc5 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.cpp +++ b/Engine/source/gui/controls/guiMLTextCtrl.cpp @@ -66,9 +66,9 @@ IMPLEMENT_CALLBACK( GuiMLTextCtrl, onURL, void, ( const char* url ),( url ), "@tsexample\n" "// A URL address was clicked on in the control, causing the callback to occur.\n" "GuiMLTextCtrl::onUrl(%this,%url)\n" - " {\n" - " // Code to run whenever a URL was clicked on\n" - " }\n" + " {\n" + " // Code to run whenever a URL was clicked on\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -80,9 +80,9 @@ IMPLEMENT_CALLBACK( GuiMLTextCtrl, onResize, void, ( S32 width, S32 maxY ),( wid "@tsexample\n" "// Control size changed, causing the callback to occur.\n" "GuiMLTextCtrl::onResize(%this,%width,%maxY)\n" - " {\n" - " // Code to call when the control size changes\n" - " }\n" + " {\n" + " // Code to call when the control size changes\n" + " }\n" "@endtsexample\n\n" "@see GuiControl\n\n" ); @@ -191,17 +191,17 @@ DefineEngineMethod( GuiMLTextCtrl, scrollToBottom, void, (),, } DefineEngineFunction(StripMLControlChars, const char*, (const char* inString),, - "@brief Strip TorqueML control characters from the specified string, returning a 'clean' version.\n\n" - "@param inString String to strip TorqueML control characters from.\n" - "@tsexample\n" - "// Define the string to strip TorqueML control characters from\n" - "%string = \"How Now Brown Cow\";\n\n" - "// Request the stripped version of the string\n" - "%strippedString = StripMLControlChars(%string);\n" - "@endtsexample\n\n" - "@return Version of the inputted string with all TorqueML characters removed.\n\n" - "@see References\n\n" - "@ingroup GuiCore") + "@brief Strip TorqueML control characters from the specified string, returning a 'clean' version.\n\n" + "@param inString String to strip TorqueML control characters from.\n" + "@tsexample\n" + "// Define the string to strip TorqueML control characters from\n" + "%string = \"How Now Brown Cow\";\n\n" + "// Request the stripped version of the string\n" + "%strippedString = StripMLControlChars(%string);\n" + "@endtsexample\n\n" + "@return Version of the inputted string with all TorqueML characters removed.\n\n" + "@see References\n\n" + "@ingroup GuiCore") { return GuiMLTextCtrl::stripControlChars(inString); } @@ -251,7 +251,7 @@ GuiMLTextCtrl::GuiMLTextCtrl() mIsEditCtrl( false ), mCursorPosition( false ), mMaxBufferSize( -1 ), - mInitialText( StringTable->insert("") ), + mInitialText( StringTable->EmptyString() ), mSelectionActive( false ), mSelectionStart( 0 ), mSelectionEnd( 0 ), @@ -267,7 +267,7 @@ GuiMLTextCtrl::GuiMLTextCtrl() mFontList( NULL ) { mActive = true; - //mInitialText = StringTable->insert(""); + //mInitialText = StringTable->EmptyString(); Sim::findObject("InputDeniedSound", mDeniedSound); } @@ -293,7 +293,7 @@ void GuiMLTextCtrl::initPersistFields() addField("deniedSound", TypeSFXTrackName, Offset(mDeniedSound, GuiMLTextCtrl), "If the text will not fit in the control, the deniedSound is played."); addField("text", TypeCaseString, Offset( mInitialText, GuiMLTextCtrl ), "Text to display in this control."); addField("useURLMouseCursor", TypeBool, Offset(mUseURLMouseCursor, GuiMLTextCtrl), "If true, the mouse cursor will turn into a hand cursor while over a link in the text.\n" - "This is dependant on the markup language used by the GuiMLTextCtrl\n"); + "This is dependant on the markup language used by the GuiMLTextCtrl\n"); endGroup( "Text" ); @@ -649,9 +649,9 @@ void GuiMLTextCtrl::ensureCursorOnScreen() // If our parent isn't a scroll control, or we're not the only control // in the content region, bail... GuiControl* pParent = getParent(); - GuiScrollCtrl *sc = dynamic_cast(pParent); - if(!sc) - return; + GuiScrollCtrl *sc = dynamic_cast(pParent); + if(!sc) + return; // Ok. Now we know that our parent is a scroll control. Let's find the // top of the cursor, and it's bottom. We can then scroll the parent control @@ -661,7 +661,7 @@ void GuiMLTextCtrl::ensureCursorOnScreen() ColorI color; getCursorPositionAndColor(cursorTopP, cursorBottomP, color); - sc->scrollRectVisible(RectI(cursorTopP.x, cursorTopP.y, 1, cursorBottomP.y - cursorTopP.y)); + sc->scrollRectVisible(RectI(cursorTopP.x, cursorTopP.y, 1, cursorBottomP.y - cursorTopP.y)); } //-------------------------------------- @@ -840,7 +840,7 @@ void GuiMLTextCtrl::onMouseUp(const GuiEvent& event) // Convert URL from UTF16 to UTF8. UTF8* url = mTextBuffer.createSubstring8(mHitURL->textStart, mHitURL->len); - onURL_callback(url); + onURL_callback(url); delete[] url; mHitURL = NULL; @@ -1018,7 +1018,7 @@ void GuiMLTextCtrl::scrollToTag( U32 id ) Con::warnf( ConsoleLogEntry::General, "GuiMLTextCtrl::scrollToTag - tag id %d not found!", id ); return; } - pappy->scrollRectVisible(RectI(0, tag->y, 1, 1)); + pappy->scrollRectVisible(RectI(0, tag->y, 1, 1)); } //-------------------------------------------------------------------------- @@ -1028,7 +1028,7 @@ void GuiMLTextCtrl::scrollToTop() GuiScrollCtrl *pappy = dynamic_cast(getParent()); if ( !pappy ) return; - pappy->scrollRectVisible(RectI(0,0,0,0)); + pappy->scrollRectVisible(RectI(0,0,0,0)); } //-------------------------------------------------------------------------- @@ -2134,7 +2134,7 @@ textemit: emitNewLine(mScanPos); setHeight( mMaxY ); onResize_callback( getWidth(), mMaxY ); - + //make sure the cursor is still visible - this handles if we're a child of a scroll ctrl... ensureCursorOnScreen(); } diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index aabce4d11..af172221a 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -233,31 +233,31 @@ void GuiPopupTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selec IMPLEMENT_CONOBJECT(GuiPopUpMenuCtrl); ConsoleDocClass( GuiPopUpMenuCtrl, - "@brief A control that allows to select a value from a drop-down list.\n\n" + "@brief A control that allows to select a value from a drop-down list.\n\n" - "For a nearly identical GUI with additional features, use GuiPopUpMenuCtrlEx.\n\n" + "For a nearly identical GUI with additional features, use GuiPopUpMenuCtrlEx.\n\n" - "@tsexample\n" - "new GuiPopUpMenuCtrl()\n" - "{\n" - " maxPopupHeight = \"200\";\n" - " sbUsesNAColor = \"0\";\n" - " reverseTextList = \"0\";\n" - " bitmapBounds = \"16 16\";\n" - " maxLength = \"1024\";\n" - " position = \"56 31\";\n" - " extent = \"64 64\";\n" - " minExtent = \"8 2\";\n" - " profile = \"GuiPopUpMenuProfile\";\n" - " tooltipProfile = \"GuiToolTipProfile\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "new GuiPopUpMenuCtrl()\n" + "{\n" + " maxPopupHeight = \"200\";\n" + " sbUsesNAColor = \"0\";\n" + " reverseTextList = \"0\";\n" + " bitmapBounds = \"16 16\";\n" + " maxLength = \"1024\";\n" + " position = \"56 31\";\n" + " extent = \"64 64\";\n" + " minExtent = \"8 2\";\n" + " profile = \"GuiPopUpMenuProfile\";\n" + " tooltipProfile = \"GuiToolTipProfile\";\n" + "};\n" + "@endtsexample\n\n" - "@note This is definitely going to be deprecated soon.\n\n" + "@note This is definitely going to be deprecated soon.\n\n" - "@see GuiPopUpMenuCtrlEx for more features and better explanations.\n" + "@see GuiPopUpMenuCtrlEx for more features and better explanations.\n" - "@ingroup GuiControls\n"); + "@ingroup GuiControls\n"); GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void) { @@ -277,9 +277,9 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void) mRenderScrollInNA = false; // Added mBackgroundCancel = false; // Added mReverseTextList = false; // Added - Don't reverse text list if displaying up - mBitmapName = StringTable->insert(""); // Added + mBitmapName = StringTable->EmptyString(); // Added mBitmapBounds.set(16, 16); // Added - mIdMax = -1; + mIdMax = -1; } //------------------------------------------------------------------------------ @@ -302,11 +302,11 @@ void GuiPopUpMenuCtrl::initPersistFields(void) //------------------------------------------------------------------------------ DefineConsoleMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") { - object->addEntry(name, idNum, scheme); + object->addEntry(name, idNum, scheme); } DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), , - "(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)") + "(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)") { object->addScheme( id, fontColor, fontColorHL, fontColorSEL ); @@ -492,43 +492,43 @@ void GuiPopUpMenuCtrl::clear() setText(""); mSelIndex = -1; mRevNum = 0; - mIdMax = -1; + mIdMax = -1; } //------------------------------------------------------------------------------ void GuiPopUpMenuCtrl::clearEntry( S32 entry ) -{ - if( entry == -1 ) - return; +{ + if( entry == -1 ) + return; - U32 i = 0; - for ( ; i < mEntries.size(); i++ ) + U32 i = 0; + for ( ; i < mEntries.size(); i++ ) { if ( mEntries[i].id == entry ) break; } - mEntries.erase( i ); + mEntries.erase( i ); - if( mEntries.size() <= 0 ) - { - mEntries.setSize(0); - setText(""); - mSelIndex = -1; - mRevNum = 0; - } - else - { - if (entry < mSelIndex) - { - mSelIndex--; - } - else if( entry == mSelIndex ) - { - setText(""); - mSelIndex = -1; - } - } + if( mEntries.size() <= 0 ) + { + mEntries.setSize(0); + setText(""); + mSelIndex = -1; + mRevNum = 0; + } + else + { + if (entry < mSelIndex) + { + mSelIndex--; + } + else if( entry == mSelIndex ) + { + setText(""); + mSelIndex = -1; + } + } } //------------------------------------------------------------------------------ @@ -620,21 +620,21 @@ void GuiPopUpMenuCtrl::addEntry( const char *buf, S32 id, U32 scheme ) //Con::printf( "GuiPopupMenuCtrlEx::addEntry - Invalid buffer!" ); return; } - - // Ensure that there are no other entries with exactly the same name - for ( U32 i = 0; i < mEntries.size(); i++ ) + + // Ensure that there are no other entries with exactly the same name + for ( U32 i = 0; i < mEntries.size(); i++ ) { if ( dStrcmp( mEntries[i].buf, buf ) == 0 ) return; } - // If we don't give an id, create one from mIdMax - if( id == -1 ) - id = mIdMax + 1; - - // Increase mIdMax when an id is greater than it - if( id > mIdMax ) - mIdMax = id; + // If we don't give an id, create one from mIdMax + if( id == -1 ) + id = mIdMax + 1; + + // Increase mIdMax when an id is greater than it + if( id > mIdMax ) + mIdMax = id; Entry e; dStrcpy( e.buf, buf ); @@ -802,28 +802,28 @@ void GuiPopUpMenuCtrl::setFirstSelected( bool bNotifyScript ) setText( mEntries[0].buf ); } - // Execute the popup console command: - if( bNotifyScript ) + // Execute the popup console command: + if( bNotifyScript ) { if ( isMethod( "onSelect" ) ) Con::executef( this, "onSelect", Con::getIntArg( mEntries[ mSelIndex ].id ), mEntries[mSelIndex].buf ); - execConsoleCallback(); - } - } - else - { - if ( mReplaceText ) // Only change the displayed text if appropriate. - setText(""); - - mSelIndex = -1; - - if( bNotifyScript ) - { - Con::executef( this, "onCancel" ); execConsoleCallback(); } - } + } + else + { + if ( mReplaceText ) // Only change the displayed text if appropriate. + setText(""); + + mSelIndex = -1; + + if( bNotifyScript ) + { + Con::executef( this, "onCancel" ); + execConsoleCallback(); + } + } } //------------------------------------------------------------------------------ @@ -1278,11 +1278,11 @@ void GuiPopUpMenuCtrl::onAction() if ( setScroll ) { // Resize the text list - Point2I cellSize; - mTl->getCellSize( cellSize ); - cellSize.x = width - mSc->scrollBarThickness() - sbBorder; - mTl->setCellSize( cellSize ); - mTl->setWidth( cellSize.x ); + Point2I cellSize; + mTl->getCellSize( cellSize ); + cellSize.x = width - mSc->scrollBarThickness() - sbBorder; + mTl->setCellSize( cellSize ); + mTl->setWidth( cellSize.x ); if ( mSelIndex ) mTl->scrollCellVisible( Point2I( 0, mSelIndex ) ); @@ -1315,7 +1315,7 @@ void GuiPopUpMenuCtrl::addChildren() else { // Use the children's profile rather than the parent's profile, if it exists. - mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile ); + mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile ); } mSc->setField( "hScrollBar", "AlwaysOff" ); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 0d90b9d73..3c6415117 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -30,27 +30,27 @@ #include "console/engineAPI.h" ConsoleDocClass( GuiPopUpMenuCtrlEx, - "@brief A control that allows to select a value from a drop-down list.\n\n" + "@brief A control that allows to select a value from a drop-down list.\n\n" - "This is essentially a GuiPopUpMenuCtrl, but with quite a few more features.\n\n" + "This is essentially a GuiPopUpMenuCtrl, but with quite a few more features.\n\n" - "@tsexample\n" - "new GuiPopUpMenuCtrlEx()\n" - "{\n" - " maxPopupHeight = \"200\";\n" - " sbUsesNAColor = \"0\";\n" - " reverseTextList = \"0\";\n" - " bitmapBounds = \"16 16\";\n" - " hotTrackCallback = \"0\";\n" - " extent = \"64 64\";\n" - " profile = \"GuiDefaultProfile\";\n" - " tooltipProfile = \"GuiToolTipProfile\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "new GuiPopUpMenuCtrlEx()\n" + "{\n" + " maxPopupHeight = \"200\";\n" + " sbUsesNAColor = \"0\";\n" + " reverseTextList = \"0\";\n" + " bitmapBounds = \"16 16\";\n" + " hotTrackCallback = \"0\";\n" + " extent = \"64 64\";\n" + " profile = \"GuiDefaultProfile\";\n" + " tooltipProfile = \"GuiToolTipProfile\";\n" + "};\n" + "@endtsexample\n\n" - "@see GuiPopUpMenuCtrl\n" + "@see GuiPopUpMenuCtrl\n" - "@ingroup GuiControls\n"); + "@ingroup GuiControls\n"); static ColorI colorWhite(255,255,255); // Added @@ -328,10 +328,10 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void) mRenderScrollInNA = false; // Added mBackgroundCancel = false; // Added mReverseTextList = false; // Added - Don't reverse text list if displaying up - mBitmapName = StringTable->insert(""); // Added + mBitmapName = StringTable->EmptyString(); // Added mBitmapBounds.set(16, 16); // Added mHotTrackItems = false; - mIdMax = -1; + mIdMax = -1; } //------------------------------------------------------------------------------ @@ -355,13 +355,13 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void) //------------------------------------------------------------------------------ ConsoleDocFragment _GuiPopUpMenuCtrlExAdd( - "@brief Adds an entry to the list\n\n" - "@param name String containing the name of the entry\n" - "@param idNum Numerical value assigned to the name\n" - "@param scheme Optional ID associated with a scheme " - "for font coloring, highlight coloring, and selection coloring\n\n", - "GuiPopUpMenuCtrlEx", - "void add(string name, S32 idNum, S32 scheme=0);" + "@brief Adds an entry to the list\n\n" + "@param name String containing the name of the entry\n" + "@param idNum Numerical value assigned to the name\n" + "@param scheme Optional ID associated with a scheme " + "for font coloring, highlight coloring, and selection coloring\n\n", + "GuiPopUpMenuCtrlEx", + "void add(string name, S32 idNum, S32 scheme=0);" ); DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") @@ -370,23 +370,23 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNu } DefineEngineMethod( GuiPopUpMenuCtrlEx, addCategory, void, (const char* text),, - "@brief Add a category to the list.\n\n" + "@brief Add a category to the list.\n\n" - "Acts as a separator between entries, allowing for sub-lists\n\n" + "Acts as a separator between entries, allowing for sub-lists\n\n" - "@param text Name of the new category\n\n") + "@param text Name of the new category\n\n") { - object->addEntry(text, -1, 0); + object->addEntry(text, -1, 0); } DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL),, - "@brief Create a new scheme and add it to the list of choices for when a new text entry is added.\n\n" - "@param id Numerical id associated with this scheme\n" - "@param fontColor The base text font color. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n" - "@param fontColorHL Color of text when being highlighted. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n" - "@param fontColorSel Color of text when being selected. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n") + "@brief Create a new scheme and add it to the list of choices for when a new text entry is added.\n\n" + "@param id Numerical id associated with this scheme\n" + "@param fontColor The base text font color. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n" + "@param fontColorHL Color of text when being highlighted. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n" + "@param fontColorSel Color of text when being selected. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n") { - /*ColorI fontColor, fontColorHL, fontColorSEL; + /*ColorI fontColor, fontColorHL, fontColorSEL; U32 r, g, b; char buf[64]; @@ -457,127 +457,127 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol //} DefineEngineMethod( GuiPopUpMenuCtrlEx, setText, void, ( const char* text),, - "@brief Set the current text to a specified value.\n\n" - "@param text String containing new text to set\n\n") + "@brief Set the current text to a specified value.\n\n" + "@param text String containing new text to set\n\n") { - object->setText(text); + object->setText(text); } DefineEngineMethod( GuiPopUpMenuCtrlEx, getText, const char*, (),, - "@brief Get the.\n\n" + "@brief Get the.\n\n" - "Detailed description\n\n" + "Detailed description\n\n" - "@param param Description\n\n" + "@param param Description\n\n" - "@tsexample\n" - "// Comment\n" - "code();\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Comment\n" + "code();\n" + "@endtsexample\n\n" - "@return Returns current text in string format") + "@return Returns current text in string format") { - return object->getText(); + return object->getText(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, clear, void, (),, - "@brief Clear the popup list.\n\n") + "@brief Clear the popup list.\n\n") { - object->clear(); + object->clear(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, sort, void, (),, - "@brief Sort the list alphabetically.\n\n") + "@brief Sort the list alphabetically.\n\n") { - object->sort(); + object->sort(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, sortID, void, (),, - "@brief Sort the list by ID.\n\n") + "@brief Sort the list by ID.\n\n") { - object->sortID(); + object->sortID(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, forceOnAction, void, (),, - "@brief Manually for the onAction function, which updates everything in this control.\n\n") + "@brief Manually for the onAction function, which updates everything in this control.\n\n") { - object->onAction(); + object->onAction(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, forceClose, void, (),, - "@brief Manually force this control to collapse and close.\n\n") + "@brief Manually force this control to collapse and close.\n\n") { - object->closePopUp(); + object->closePopUp(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, getSelected, S32, (),, - "@brief Get the current selection of the menu.\n\n" - "@return Returns the ID of the currently selected entry") + "@brief Get the current selection of the menu.\n\n" + "@return Returns the ID of the currently selected entry") { - return object->getSelected(); + return object->getSelected(); } ConsoleDocFragment _GuiPopUpMenuCtrlExsetSelected( - "brief Manually set an entry as selected int his control\n\n" - "@param id The ID of the entry to select\n" - "@param scripCallback Optional boolean that forces the script callback if true\n", - "GuiPopUpMenuCtrlEx", - "setSelected(int id, bool scriptCallback=true);" + "brief Manually set an entry as selected int his control\n\n" + "@param id The ID of the entry to select\n" + "@param scripCallback Optional boolean that forces the script callback if true\n", + "GuiPopUpMenuCtrlEx", + "setSelected(int id, bool scriptCallback=true);" ); DefineConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])" - "@hide") + "@hide") { object->setSelected( id, scriptCallback ); } ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected( - "brief Manually set the selection to the first entry\n\n" - "@param scripCallback Optional boolean that forces the script callback if true\n", - "GuiPopUpMenuCtrlEx", - "setSelected(bool scriptCallback=true);" + "brief Manually set the selection to the first entry\n\n" + "@param scripCallback Optional boolean that forces the script callback if true\n", + "GuiPopUpMenuCtrlEx", + "setSelected(bool scriptCallback=true);" ); DefineConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])" - "@hide") + "@hide") { object->setFirstSelected( scriptCallback ); } DefineEngineMethod( GuiPopUpMenuCtrlEx, setNoneSelected, void, ( S32 param),, - "@brief Clears selection in the menu.\n\n") + "@brief Clears selection in the menu.\n\n") { - object->setNoneSelected(); + object->setNoneSelected(); } DefineEngineMethod( GuiPopUpMenuCtrlEx, getTextById, const char*, (S32 id),, - "@brief Get the text of an entry based on an ID.\n\n" - "@param id The ID assigned to the entry being queried\n\n" - "@return String contained by the specified entry, NULL if empty or bad ID") + "@brief Get the text of an entry based on an ID.\n\n" + "@param id The ID assigned to the entry being queried\n\n" + "@return String contained by the specified entry, NULL if empty or bad ID") { - return(object->getTextById(id)); + return(object->getTextById(id)); } DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), , - "@brief Get color of an entry's box\n\n" - "@param id ID number of entry to query\n\n" - "@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255") + "@brief Get color of an entry's box\n\n" + "@param id ID number of entry to query\n\n" + "@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255") { ColorI color; object->getColoredBox(color, id); - return color; + return color; } DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), , - "@brief This fills the popup with a classrep's field enumeration type info.\n\n" + "@brief This fills the popup with a classrep's field enumeration type info.\n\n" "More of a helper function than anything. If console access to the field list is added, " "at least for the enumerated types, then this should go away.\n\n" - "@param class Name of the class containing the enum\n" - "@param enum Name of the enum value to acces\n") + "@param class Name of the class containing the enum\n" + "@param enum Name of the enum value to acces\n") { AbstractClassRep * classRep = AbstractClassRep::getClassList(); @@ -630,24 +630,24 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * cl //------------------------------------------------------------------------------ DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)" "Returns the id of the first entry containing the specified text or -1 if not found." - "@param text String value used for the query\n\n" - "@return Numerical ID of entry containing the text.") + "@param text String value used for the query\n\n" + "@return Numerical ID of entry containing the text.") { return( object->findText( text ) ); } //------------------------------------------------------------------------------ DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), , - "@brief Get the size of the menu\n\n" - "@return Number of entries in the menu\n") + "@brief Get the size of the menu\n\n" + "@return Number of entries in the menu\n") { return( object->getNumEntries() ); } //------------------------------------------------------------------------------ DefineConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), , - "@brief Flag that causes each new text addition to replace the current entry\n\n" - "@param True to turn on replacing, false to disable it") + "@brief Flag that causes each new text addition to replace the current entry\n\n" + "@param True to turn on replacing, false to disable it") { object->replaceText(boolVal); } @@ -697,43 +697,43 @@ void GuiPopUpMenuCtrlEx::clear() setText(""); mSelIndex = -1; mRevNum = 0; - mIdMax = -1; + mIdMax = -1; } //------------------------------------------------------------------------------ void GuiPopUpMenuCtrlEx::clearEntry( S32 entry ) { - if( entry == -1 ) - return; + if( entry == -1 ) + return; - U32 i = 0; - for ( ; i < mEntries.size(); i++ ) + U32 i = 0; + for ( ; i < mEntries.size(); i++ ) { if ( mEntries[i].id == entry ) break; } - mEntries.erase( i ); + mEntries.erase( i ); - if( mEntries.size() <= 0 ) - { - mEntries.setSize(0); - setText(""); - mSelIndex = -1; - mRevNum = 0; - } - else - { - if( entry == mSelIndex ) - { - setText(""); - mSelIndex = -1; - } - else - { - mSelIndex--; - } - } + if( mEntries.size() <= 0 ) + { + mEntries.setSize(0); + setText(""); + mSelIndex = -1; + mRevNum = 0; + } + else + { + if( entry == mSelIndex ) + { + setText(""); + mSelIndex = -1; + } + else + { + mSelIndex--; + } + } } //------------------------------------------------------------------------------ @@ -797,9 +797,9 @@ void GuiPopUpMenuCtrlEx::sort() if( size > 0 ) dQsort( mEntries.address(), size, sizeof(Entry), textCompare); - // Entries need to re-Id themselves - for( U32 i = 0; i < mEntries.size(); i++ ) - mEntries[i].id = i; + // Entries need to re-Id themselves + for( U32 i = 0; i < mEntries.size(); i++ ) + mEntries[i].id = i; } // Added to sort by entry ID @@ -810,9 +810,9 @@ void GuiPopUpMenuCtrlEx::sortID() if( size > 0 ) dQsort( mEntries.address(), size, sizeof(Entry), idCompare); - // Entries need to re-Id themselves - for( U32 i = 0; i < mEntries.size(); i++ ) - mEntries[i].id = i; + // Entries need to re-Id themselves + for( U32 i = 0; i < mEntries.size(); i++ ) + mEntries[i].id = i; } //------------------------------------------------------------------------------ @@ -823,21 +823,21 @@ void GuiPopUpMenuCtrlEx::addEntry(const char *buf, S32 id, U32 scheme) //Con::printf( "GuiPopupMenuCtrlEx::addEntry - Invalid buffer!" ); return; } - - // Ensure that there are no other entries with exactly the same name - for ( U32 i = 0; i < mEntries.size(); i++ ) + + // Ensure that there are no other entries with exactly the same name + for ( U32 i = 0; i < mEntries.size(); i++ ) { if ( dStrcmp( mEntries[i].buf, buf ) == 0 ) return; } - // If we don't give an id, create one from mIdMax - if( id == -1 ) - id = mIdMax + 1; - - // Increase mIdMax when an id is greater than it - if( id > mIdMax ) - mIdMax = id; + // If we don't give an id, create one from mIdMax + if( id == -1 ) + id = mIdMax + 1; + + // Increase mIdMax when an id is greater than it + if( id > mIdMax ) + mIdMax = id; Entry e; dStrcpy( e.buf, buf ); @@ -992,20 +992,20 @@ void GuiPopUpMenuCtrlEx::setFirstSelected( bool bNotifyScript ) if ( isMethod( "onSelect" ) ) Con::executef( this, "onSelect", idval, mEntries[mSelIndex].buf ); - // Execute the popup console command: - if ( bNotifyScript ) - execConsoleCallback(); + // Execute the popup console command: + if ( bNotifyScript ) + execConsoleCallback(); } - else - { - if ( mReplaceText ) // Only change the displayed text if appropriate. - setText(""); - - mSelIndex = -1; + else + { + if ( mReplaceText ) // Only change the displayed text if appropriate. + setText(""); + + mSelIndex = -1; - if ( bNotifyScript ) - Con::executef( this, "onCancel" ); - } + if ( bNotifyScript ) + Con::executef( this, "onCancel" ); + } } //------------------------------------------------------------------------------ @@ -1500,11 +1500,11 @@ void GuiPopUpMenuCtrlEx::onAction() if ( setScroll ) { // Resize the text list - Point2I cellSize; - mTl->getCellSize( cellSize ); - cellSize.x = width - mSc->scrollBarThickness() - sbBorder; - mTl->setCellSize( cellSize ); - mTl->setWidth( cellSize.x ); + Point2I cellSize; + mTl->getCellSize( cellSize ); + cellSize.x = width - mSc->scrollBarThickness() - sbBorder; + mTl->setCellSize( cellSize ); + mTl->setWidth( cellSize.x ); if ( mSelIndex ) mTl->scrollCellVisible( Point2I( 0, mSelIndex ) ); @@ -1536,7 +1536,7 @@ void GuiPopUpMenuCtrlEx::addChildren() else { // Use the children's profile rather than the parent's profile, if it exists. - mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile ); + mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile ); } mSc->setField( "hScrollBar", "AlwaysOff" ); mSc->setField( "vScrollBar", "dynamic" ); diff --git a/Engine/source/gui/controls/guiTextCtrl.cpp b/Engine/source/gui/controls/guiTextCtrl.cpp index e1079d8e0..8759e3973 100644 --- a/Engine/source/gui/controls/guiTextCtrl.cpp +++ b/Engine/source/gui/controls/guiTextCtrl.cpp @@ -37,13 +37,13 @@ ConsoleDocClass( GuiTextCtrl, "@brief GUI control object this displays a single line of text, without TorqueML.\n\n" "@tsexample\n" - " new GuiTextCtrl()\n" - " {\n" - " text = \"Hello World\";\n" - " textID = \"\"STR_HELLO\"\";\n" - " maxlength = \"1024\";\n" - " //Properties not specific to this control have been omitted from this example.\n" - " };\n" + " new GuiTextCtrl()\n" + " {\n" + " text = \"Hello World\";\n" + " textID = \"\"STR_HELLO\"\";\n" + " maxlength = \"1024\";\n" + " //Properties not specific to this control have been omitted from this example.\n" + " };\n" "@endtsexample\n\n" "@see GuiControl\n" @@ -54,8 +54,8 @@ ConsoleDocClass( GuiTextCtrl, GuiTextCtrl::GuiTextCtrl() { //default fonts - mInitialText = StringTable->insert(""); - mInitialTextID = StringTable->insert(""); + mInitialText = StringTable->EmptyString(); + mInitialTextID = StringTable->EmptyString(); mText[0] = '\0'; mMaxStrLen = GuiTextCtrl::MAX_STRING_LENGTH; } @@ -84,7 +84,7 @@ DefineEngineMethod( GuiTextCtrl, setTextID, void, (const char* textID),, "@see GuiControl" "@see Localization") { - object->setTextID( textID ); + object->setTextID( textID ); } void GuiTextCtrl::initPersistFields() @@ -117,7 +117,7 @@ void GuiTextCtrl::inspectPostApply() { Parent::inspectPostApply(); if(mInitialTextID && *mInitialTextID != 0) - setTextID(mInitialTextID); + setTextID(mInitialTextID); else if( mConsoleVariable[ 0 ] ) setText( getVariable() ); else @@ -135,7 +135,7 @@ bool GuiTextCtrl::onWake() return false; } if(mInitialTextID && *mInitialTextID != 0) - setTextID(mInitialTextID); + setTextID(mInitialTextID); if ( mConsoleVariable[0] ) { @@ -202,19 +202,19 @@ void GuiTextCtrl::setText(const char *txt) void GuiTextCtrl::setTextID(const char *id) { - S32 n = Con::getIntVariable(id, -1); - if(n != -1) - { - mInitialTextID = StringTable->insert(id); - setTextID(n); - } + S32 n = Con::getIntVariable(id, -1); + if(n != -1) + { + mInitialTextID = StringTable->insert(id); + setTextID(n); + } } void GuiTextCtrl::setTextID(S32 id) { - const UTF8 *str = getGUIString(id); - if(str) - setText((const char*)str); - //mInitialTextID = id; + const UTF8 *str = getGUIString(id); + if(str) + setText((const char*)str); + //mInitialTextID = id; } void GuiTextCtrl::onPreRender() diff --git a/Engine/source/gui/controls/guiTextEditCtrl.cpp b/Engine/source/gui/controls/guiTextEditCtrl.cpp index 99a1342c0..968fe17a6 100644 --- a/Engine/source/gui/controls/guiTextEditCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditCtrl.cpp @@ -46,17 +46,17 @@ ConsoleDocClass( GuiTextEditCtrl, "@tsexample\n" " new GuiTextEditCtrl(MessageHud_Edit)\n" - " {\n" - " text = \"Hello World\";\n" - " validate = \"validateCommand();\"\n" - " escapeCommand = \"escapeCommand();\";\n" - " historySize = \"5\";\n" - " tabComplete = \"true\";\n" - " deniedSound = \"DeniedSoundProfile\";\n" - " sinkAllKeyEvents = \"true\";\n" - " password = \"true\";\n" - " passwordMask = \"*\";\n" - " //Properties not specific to this control have been omitted from this example.\n" + " {\n" + " text = \"Hello World\";\n" + " validate = \"validateCommand();\"\n" + " escapeCommand = \"escapeCommand();\";\n" + " historySize = \"5\";\n" + " tabComplete = \"true\";\n" + " deniedSound = \"DeniedSoundProfile\";\n" + " sinkAllKeyEvents = \"true\";\n" + " password = \"true\";\n" + " passwordMask = \"*\";\n" + " //Properties not specific to this control have been omitted from this example.\n" " };\n" "@endtsexample\n\n" @@ -72,9 +72,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onTabComplete, void, (const char* val),( va "@tsexample\n" "// Tab key has been pressed, causing the callback to occur.\n" "GuiTextEditCtrl::onTabComplete(%this,%val)\n" - " {\n" - " //Code to run when the onTabComplete callback occurs\n" - " }\n" + " {\n" + " //Code to run when the onTabComplete callback occurs\n" + " }\n" "@endtsexample\n\n" "@see GuiTextCtrl\n" "@see GuiControl\n\n" @@ -85,9 +85,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onReturn, void, (),(), "@tsexample\n" "// Return or Enter key was pressed, causing the callback to occur.\n" "GuiTextEditCtrl::onReturn(%this)\n" - " {\n" - " // Code to run when the onReturn callback occurs\n" - " }\n" + " {\n" + " // Code to run when the onReturn callback occurs\n" + " }\n" "@endtsexample\n\n" "@see GuiTextCtrl\n" "@see GuiControl\n\n" @@ -98,9 +98,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onValidate, void, (),(), "@tsexample\n" "// The control gets validated, causing the callback to occur\n" "GuiTextEditCtrl::onValidated(%this)\n" - " {\n" - " // Code to run when the control is validated\n" - " }\n" + " {\n" + " // Code to run when the control is validated\n" + " }\n" "@endtsexample\n\n" "@see GuiTextCtrl\n" "@see GuiControl\n\n" @@ -139,7 +139,7 @@ GuiTextEditCtrl::GuiTextEditCtrl() mHistoryBuf = NULL; #if defined(__MACOSX__) - UTF8 bullet[4] = { 0xE2, 0x80, 0xA2, 0 }; + UTF8 bullet[4] = { 0xE2, 0x80, 0xA2, 0 }; mPasswordMask = StringTable->insert( bullet ); #else @@ -710,10 +710,10 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event) case KEY_TAB: if ( mTabComplete ) { - onTabComplete_callback("1"); + onTabComplete_callback("1"); return true; } - break; // We don't want to fall through if we don't handle the TAB here. + break; // We don't want to fall through if we don't handle the TAB here. case KEY_HOME: mBlockStart = 0; @@ -779,10 +779,10 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event) } return true; - case KEY_RETURN: - case KEY_NUMPADENTER: + case KEY_RETURN: + case KEY_NUMPADENTER: - return dealWithEnter(false); + return dealWithEnter(false); default: break; @@ -998,7 +998,7 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event) case KEY_RETURN: case KEY_NUMPADENTER: - return dealWithEnter(true); + return dealWithEnter(true); case KEY_UP: { @@ -1155,7 +1155,7 @@ dealWithBackspace: case KEY_TAB: if ( mTabComplete ) { - onTabComplete_callback("0"); + onTabComplete_callback("0"); return( true ); } case KEY_UP: @@ -1208,9 +1208,9 @@ bool GuiTextEditCtrl::dealWithEnter( bool clearResponder ) return true; } } - - if( clearResponder ) - clearFirstResponder(); + + if( clearResponder ) + clearFirstResponder(); return true; } @@ -1222,13 +1222,13 @@ void GuiTextEditCtrl::setFirstResponder() GuiCanvas *root = getRoot(); if (root != NULL) { - root->enableKeyboardTranslation(); + root->enableKeyboardTranslation(); - // If the native OS accelerator keys are not disabled - // then some key events like Delete, ctrl+V, etc may - // not make it down to us. - root->setNativeAcceleratorsEnabled( false ); + // If the native OS accelerator keys are not disabled + // then some key events like Delete, ctrl+V, etc may + // not make it down to us. + root->setNativeAcceleratorsEnabled( false ); } } @@ -1237,8 +1237,8 @@ void GuiTextEditCtrl::onLoseFirstResponder() GuiCanvas *root = getRoot(); if( root ) { - root->setNativeAcceleratorsEnabled( true ); - root->disableKeyboardTranslation(); + root->setNativeAcceleratorsEnabled( true ); + root->disableKeyboardTranslation(); } //execute the validate command @@ -1546,29 +1546,29 @@ void GuiTextEditCtrl::handleCharInput( U16 ascii ) //see if it's a number field if ( mProfile->mNumbersOnly ) { - if (ascii == '-') - { - //a minus sign only exists at the beginning, and only a single minus sign - if (mCursorPos != 0 && !isAllTextSelected()) - { - invalidText(); - return; - } + if (ascii == '-') + { + //a minus sign only exists at the beginning, and only a single minus sign + if (mCursorPos != 0 && !isAllTextSelected()) + { + invalidText(); + return; + } - if (mInsertOn && (mTextBuffer.getChar(0) == '-')) - { - invalidText(); - return; - } - } - // BJTODO: This is probably not unicode safe. - else if (ascii != '.' && (ascii < '0' || ascii > '9')) - { - invalidText(); - return; - } - else - validText(); + if (mInsertOn && (mTextBuffer.getChar(0) == '-')) + { + invalidText(); + return; + } + } + // BJTODO: This is probably not unicode safe. + else if (ascii != '.' && (ascii < '0' || ascii > '9')) + { + invalidText(); + return; + } + else + validText(); } //save the current state @@ -1684,7 +1684,7 @@ DefineEngineMethod( GuiTextEditCtrl, getText, const char*, (),, "@see GuiControl") { if( !object->hasText() ) - return StringTable->insert(""); + return StringTable->EmptyString(); char *retBuffer = Con::getReturnBuffer( GuiTextEditCtrl::MAX_STRING_LENGTH ); object->getText( retBuffer ); @@ -1778,22 +1778,22 @@ DefineEngineMethod( GuiTextEditCtrl, forceValidateText, void, (),, } DefineEngineMethod(GuiTextEditCtrl, invalidText, void, (bool playSound), (true), - "@brief Trigger the invalid sound and make the box red.nn" - "@param playSound Play the invalid text sound or not.n") + "@brief Trigger the invalid sound and make the box red.nn" + "@param playSound Play the invalid text sound or not.n") { - object->invalidText(playSound); + object->invalidText(playSound); } DefineEngineMethod(GuiTextEditCtrl, validText, void, (), , - "@brief Restores the box to normal color.nn") + "@brief Restores the box to normal color.nn") { - object->validText(); + object->validText(); } DefineEngineMethod(GuiTextEditCtrl, isValidText, bool, (), , - "@brief Returns if the text is set to valid or not.n" - "@Return true if text is set to valid, false if not.nn") + "@brief Returns if the text is set to valid or not.n" + "@Return true if text is set to valid, false if not.nn") { - return object->isValidText(); + return object->isValidText(); } diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index c98fc90aa..e4fb9ab00 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -43,9 +43,9 @@ IMPLEMENT_CONOBJECT(GuiTreeViewCtrl); ConsoleDocClass( GuiTreeViewCtrl, - "@brief Hierarchical list of text items with optional icons.\n\n" + "@brief Hierarchical list of text items with optional icons.\n\n" - "Can also be used to inspect SimObject hierarchies, primarily within editors.\n\n" + "Can also be used to inspect SimObject hierarchies, primarily within editors.\n\n" "GuiTreeViewCtrls can either display arbitrary user-defined trees or can be used to display SimObject hierarchies where " "each parent node in the tree is a SimSet or SimGroup and each leaf node is a SimObject.\n\n" @@ -59,30 +59,30 @@ ConsoleDocClass( GuiTreeViewCtrl, "Each item in the tree has a distinct numeric ID that is unique within its tree. The ID of the root item, which is always " "present on a tree, is 0.\n\n" - "@tsexample\n" - "new GuiTreeViewCtrl(DatablockEditorTree)\n" - "{\n" - " tabSize = \"16\";\n" - " textOffset = \"2\";\n" - " fullRowSelect = \"0\";\n" - " itemHeight = \"21\";\n" - " destroyTreeOnSleep = \"0\";\n" - " MouseDragging = \"0\";\n" - " MultipleSelections = \"1\";\n" - " DeleteObjectAllowed = \"1\";\n" - " DragToItemAllowed = \"0\";\n" - " ClearAllOnSingleSelection = \"1\";\n" - " showRoot = \"1\";\n" - " internalNamesOnly = \"0\";\n" - " objectNamesOnly = \"0\";\n" - " compareToObjectID = \"0\";\n" - " Profile = \"GuiTreeViewProfile\";\n" - " tooltipprofile = \"GuiToolTipProfile\";\n" - " hovertime = \"1000\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "new GuiTreeViewCtrl(DatablockEditorTree)\n" + "{\n" + " tabSize = \"16\";\n" + " textOffset = \"2\";\n" + " fullRowSelect = \"0\";\n" + " itemHeight = \"21\";\n" + " destroyTreeOnSleep = \"0\";\n" + " MouseDragging = \"0\";\n" + " MultipleSelections = \"1\";\n" + " DeleteObjectAllowed = \"1\";\n" + " DragToItemAllowed = \"0\";\n" + " ClearAllOnSingleSelection = \"1\";\n" + " showRoot = \"1\";\n" + " internalNamesOnly = \"0\";\n" + " objectNamesOnly = \"0\";\n" + " compareToObjectID = \"0\";\n" + " Profile = \"GuiTreeViewProfile\";\n" + " tooltipprofile = \"GuiToolTipProfile\";\n" + " hovertime = \"1000\";\n" + "};\n" + "@endtsexample\n\n" - "@ingroup GuiContainers\n"); + "@ingroup GuiContainers\n"); IMPLEMENT_CALLBACK( GuiTreeViewCtrl, onDeleteObject, bool, ( SimObject* object ), ( object ), "" ); IMPLEMENT_CALLBACK( GuiTreeViewCtrl, isValidDragTarget, bool, ( S32 id, const char* value ), ( id, value ), "" ); @@ -511,7 +511,7 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf) if( showInternalNameOnly() ) dSprintf( buf, bufLen, "%s", hasInternalName ? pInternalName : "(none)" ); - else if( showObjectNameOnly() ) + else if( showObjectNameOnly() ) { if( !hasObjectName && mState.test( ShowClassNameForUnnamed ) ) dSprintf( buf, bufLen, "%s", pClassName ); @@ -801,7 +801,7 @@ GuiTreeViewCtrl::GuiTreeViewCtrl() mStart = 0; mPossibleRenameItem = NULL; mRenamingItem = NULL; - mTempItem = NULL; + mTempItem = NULL; mRenameCtrl = NULL; mDraggedToItem = 0; @@ -845,7 +845,7 @@ GuiTreeViewCtrl::GuiTreeViewCtrl() mClearAllOnSingleSelection = true; - mBitmapBase = StringTable->insert(""); + mBitmapBase = StringTable->EmptyString(); mTexRollover = NULL; mTexSelected = NULL; @@ -1902,7 +1902,7 @@ void GuiTreeViewCtrl::onPreRender() if(mFlags.test(RebuildVisible)) { buildVisibleTree(); - mFlags.clear(RebuildVisible); + mFlags.clear(RebuildVisible); } } @@ -2084,39 +2084,39 @@ void GuiTreeViewCtrl::syncSelection() } else if (mVisibleItems[i]->isInspectorData()) { - if(mCompareToObjectID) - { - if (mVisibleItems[i]->getObject() && mVisibleItems[i]->getObject()->getId() == mSelected[j]) - { - // check to see if it is on the visible items list. - bool addToSelectedItems = true; - for (S32 k = 0; k < mSelectedItems.size(); k++) - { - if (mSelectedItems[k]->isInspectorData() && mSelectedItems[k]->getObject() ) - { - if (mSelected[j] == mSelectedItems[k]->getObject()->getId()) - { - // don't add it - addToSelectedItems = false; - } - } - else - { - if (mSelected[j] == mSelectedItems[k]->mId) - { - // don't add it - addToSelectedItems = false; - } - } - } - if (addToSelectedItems) - { - mVisibleItems[i]->mState.set(Item::Selected, true); - mSelectedItems.push_front(mVisibleItems[i]); - break; - } - } - } + if(mCompareToObjectID) + { + if (mVisibleItems[i]->getObject() && mVisibleItems[i]->getObject()->getId() == mSelected[j]) + { + // check to see if it is on the visible items list. + bool addToSelectedItems = true; + for (S32 k = 0; k < mSelectedItems.size(); k++) + { + if (mSelectedItems[k]->isInspectorData() && mSelectedItems[k]->getObject() ) + { + if (mSelected[j] == mSelectedItems[k]->getObject()->getId()) + { + // don't add it + addToSelectedItems = false; + } + } + else + { + if (mSelected[j] == mSelectedItems[k]->mId) + { + // don't add it + addToSelectedItems = false; + } + } + } + if (addToSelectedItems) + { + mVisibleItems[i]->mState.set(Item::Selected, true); + mSelectedItems.push_front(mVisibleItems[i]); + break; + } + } + } } } @@ -2200,14 +2200,14 @@ void GuiTreeViewCtrl::addSelection( S32 itemOrObjectId, bool update, bool isLast } const S32 itemId = item->getID(); - - // Ok, we have an item to select which isn't already selected.... + + // Ok, we have an item to select which isn't already selected.... // Do we want to allow more than one selected item? if( !mMultipleSelections ) clearSelection(); - // Add this object id to the vector of selected objectIds + // Add this object id to the vector of selected objectIds // if it is not already. bool foundMatch = false; for ( S32 i = 0; i < mSelected.size(); i++) @@ -2228,21 +2228,21 @@ void GuiTreeViewCtrl::addSelection( S32 itemOrObjectId, bool update, bool isLast // Callback Start // Set and add the selection to the selected items group - item->mState.set(Item::Selected, true); - mSelectedItems.push_front(item); + item->mState.set(Item::Selected, true); + mSelectedItems.push_front(item); if ( item->isInspectorData() && item->getObject() ) { SimObject *obj = item->getObject(); - + onAddSelection_callback( obj->getId(), isLastSelection ); } else { onAddSelection_callback( item->mId, isLastSelection ); } - // Callback end + // Callback end mFlags.set( RebuildVisible ); if( update ) @@ -2262,7 +2262,7 @@ void GuiTreeViewCtrl::onItemSelected( Item *item ) if (item->isInspectorData()) { SimObject* object = item->getObject(); - if( object ) + if( object ) onSelect_callback( object->getId() ); if( !item->isParent() && object ) onInspect_callback( object->getId() ); @@ -2590,9 +2590,9 @@ void GuiTreeViewCtrl::deleteSelection() } else { - Vector delSelection; - delSelection = mSelectedItems; - mSelectedItems.clear(); + Vector delSelection; + delSelection = mSelectedItems; + mSelectedItems.clear(); while (!delSelection.empty()) { Item * item = delSelection.front(); @@ -2600,7 +2600,7 @@ void GuiTreeViewCtrl::deleteSelection() if ( item->mParent ) _deleteItem( item ); - delSelection.pop_front(); + delSelection.pop_front(); } } @@ -2642,7 +2642,7 @@ bool GuiTreeViewCtrl::onKeyDown( const GuiEvent& event ) return true; } - //call a generic bit of script that will let the subclass know that a key was pressed + //call a generic bit of script that will let the subclass know that a key was pressed onKeyDown_callback( event.modifier, event.keyCode ); } @@ -3028,29 +3028,29 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) return; } - BitSet32 hitFlags = 0; + BitSet32 hitFlags = 0; Item *item; - bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); + bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); mRenamingItem = NULL; - if( hitCheck ) - { - if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL ) - { - if ( item == mPossibleRenameItem ) + if( hitCheck ) + { + if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL ) + { + if ( item == mPossibleRenameItem ) showItemRenameCtrl( item ); - } - else // If mouseUp occurs on the same item as mouse down - { - bool wasSelected = isSelected( item ); - bool multiSelect = getSelectedItemsCount() > 1; - if( wasSelected && multiSelect && item == mTempItem ) - { - clearSelection(); - addSelection( item->mId ); - } - } - } + } + else // If mouseUp occurs on the same item as mouse down + { + bool wasSelected = isSelected( item ); + bool multiSelect = getSelectedItemsCount() > 1; + if( wasSelected && multiSelect && item == mTempItem ) + { + clearSelection(); + addSelection( item->mId ); + } + } + } mPossibleRenameItem = NULL; @@ -3482,7 +3482,7 @@ void GuiTreeViewCtrl::onMouseDragged(const GuiEvent &event) if( mDragStartInSelection ) onMouseDragged_callback(); - if(!mSupportMouseDragging) + if(!mSupportMouseDragging) return; if( !mActive || !mAwake || !mVisible ) @@ -3652,7 +3652,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) mPossibleRenameItem = NULL; mRenamingItem = NULL; - mTempItem = NULL; + mTempItem = NULL; // if( event.modifier & SI_MULTISELECT ) @@ -3704,10 +3704,10 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) //select up for (S32 j = (mCurrentDragCell); j < firstSelectedIndex; j++) { - if( j != (firstSelectedIndex - 1) ) - addSelection(mVisibleItems[j]->mId, false, false); - else - addSelection(mVisibleItems[j]->mId, false); + if( j != (firstSelectedIndex - 1) ) + addSelection(mVisibleItems[j]->mId, false, false); + else + addSelection(mVisibleItems[j]->mId, false); } } else @@ -3715,10 +3715,10 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) // select down for (S32 j = firstSelectedIndex+1; j < (mCurrentDragCell+1); j++) { - if( j != mCurrentDragCell ) - addSelection(mVisibleItems[j]->mId, false, false); - else - addSelection(mVisibleItems[j]->mId, false); + if( j != mCurrentDragCell ) + addSelection(mVisibleItems[j]->mId, false, false); + else + addSelection(mVisibleItems[j]->mId, false); } } @@ -3736,39 +3736,39 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) } else if ( !hitFlags.test(OnImage) ) { - mTempItem = item; + mTempItem = item; bool wasSelected = isSelected( item ); bool multiSelect = getSelectedItemsCount() > 1; - - if( !wasSelected || !multiSelect ) - { - if ( mClearAllOnSingleSelection ) - clearSelection(); + + if( !wasSelected || !multiSelect ) + { + if ( mClearAllOnSingleSelection ) + clearSelection(); - if ( !wasSelected || mClearAllOnSingleSelection ) - addSelection( item->mId ); + if ( !wasSelected || mClearAllOnSingleSelection ) + addSelection( item->mId ); - if ( wasSelected && - !multiSelect && - mCanRenameObjects && - hitFlags.test(OnText) && - mFlags.test(IsEditable) && - item->isInspectorData() && - item->getObject() && + if ( wasSelected && + !multiSelect && + mCanRenameObjects && + hitFlags.test(OnText) && + mFlags.test(IsEditable) && + item->isInspectorData() && + item->getObject() && item->getObject()->isNameChangeAllowed() && - item != mRoot && - event.mouseClickCount == 1 ) - { - mPossibleRenameItem = item; + item != mRoot && + event.mouseClickCount == 1 ) + { + mPossibleRenameItem = item; - if ( isMethod( "canRenameObject" ) ) - { - if( canRenameObject_callback( item->getObject() ) ) - mPossibleRenameItem = NULL; - } - } - } + if ( isMethod( "canRenameObject" ) ) + { + if( canRenameObject_callback( item->getObject() ) ) + mPossibleRenameItem = NULL; + } + } + } } @@ -4221,7 +4221,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool ) if( item->mState.test(Item::MouseOverText) ) { - fontColor = mProfile->mFontColorHL; + fontColor = mProfile->mFontColorHL; } drawer->setBitmapModulation( fontColor ); @@ -4551,9 +4551,9 @@ void GuiTreeViewCtrl::inspectorSearch(Item * item, Item * parent, SimSet * paren bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item ) { - for ( U32 i = 0; i < mItems.size(); i++ ) - { - Item *pItem = mItems[i]; + for ( U32 i = 0; i < mItems.size(); i++ ) + { + Item *pItem = mItems[i]; if ( !pItem ) continue; @@ -4565,16 +4565,16 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item ) continue; #endif - SimObject *pObj = pItem->getObject(); + SimObject *pObj = pItem->getObject(); - if ( pObj && pObj == object ) - { - *item = pItem; - return true; - } - } + if ( pObj && pObj == object ) + { + *item = pItem; + return true; + } + } - return false; + return false; } //----------------------------------------------------------------------------- @@ -4592,7 +4592,7 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate) } // Skip the next stuff unless we're expanded... - if(!item->isExpanded() && !bForceFullUpdate && !( item == mRoot && !mShowRoot ) ) + if(!item->isExpanded() && !bForceFullUpdate && !( item == mRoot && !mShowRoot ) ) return true; // Verify that we have all the kids we should in here... @@ -4704,8 +4704,8 @@ S32 GuiTreeViewCtrl::findItemByName(const char *name) { if ( !mItems[i] ) continue; - if( mItems[i]->mState.test( Item::InspectorData ) ) - continue; + if( mItems[i]->mState.test( Item::InspectorData ) ) + continue; if (mItems[i] && dStrcmp(mItems[i]->getText(),name) == 0) return mItems[i]->mId; } @@ -4721,10 +4721,10 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name) { if (!mItems[i]) continue; - if( mItems[i]->mState.test( Item::InspectorData ) ) - continue; - if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0) - return mItems[i]->mId; + if( mItems[i]->mState.test( Item::InspectorData ) ) + continue; + if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0) + return mItems[i]->mId; } return 0; @@ -4746,13 +4746,13 @@ StringTableEntry GuiTreeViewCtrl::getTextToRoot( S32 itemId, const char * delimi if(!item) { Con::errorf(ConsoleLogEntry::General, "GuiTreeViewCtrl::getTextToRoot: invalid start item id!"); - return StringTable->insert(""); + return StringTable->EmptyString(); } if(item->isInspectorData()) { Con::errorf(ConsoleLogEntry::General, "GuiTreeViewCtrl::getTextToRoot: cannot get text to root of inspector data items"); - return StringTable->insert(""); + return StringTable->EmptyString(); } char bufferOne[1024]; @@ -4874,7 +4874,7 @@ DefineEngineMethod( GuiTreeViewCtrl, insertItem, S32, ( S32 parentId, const char DefineEngineMethod( GuiTreeViewCtrl, insertObject, S32, ( S32 parentId, SimObject* obj, bool OKToEdit ), (false), "Inserts object as a child to the given parent." ) { - return object->insertObject(parentId, obj, OKToEdit); + return object->insertObject(parentId, obj, OKToEdit); } //----------------------------------------------------------------------------- @@ -4967,10 +4967,10 @@ DefineEngineMethod( GuiTreeViewCtrl, removeChildSelectionByValue, void, ( S32 pa if(parentItem) { GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(value); - if(child) - { + if(child) + { object->removeSelection(child->getID()); - } + } } } @@ -5038,7 +5038,7 @@ DefineEngineMethod( GuiTreeViewCtrl, open, void, ( const char * objName, bool ok DefineEngineMethod( GuiTreeViewCtrl, setItemTooltip, bool, ( S32 itemId, const char* tooltip), , "Set the tooltip to show for the given item.\n\n" "@param itemId TreeItemID of item to set the tooltip for.\n" - "@param tooltip String tooltip to set for the item." + "@param tooltip String tooltip to set for the item." "@return True if successfully found the item, false if not") { GuiTreeViewCtrl::Item* item = object->getItem( itemId ); @@ -5228,11 +5228,11 @@ const char* GuiTreeViewCtrl::getSelectedObjectList() { S32 id = item->getObject()->getId(); //get the current length of the buffer - U32 len = dStrlen(buff); + U32 len = dStrlen(buff); //the start of the buffer where we want to write char* buffPart = buff+len; //the size of the remaining buffer (-1 cause dStrlen doesn't count the \0) - S32 size = bufSize-len-1; + S32 size = bufSize-len-1; //write it: if(size < 1) { @@ -5283,7 +5283,7 @@ DefineEngineMethod( GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, co "@param delimiter (Optional) delimiter to use between each branch concatenation." "@return text from the current node to the root.") { - if (!dStrcmp(delimiter, "" )) + if (!dStrcmp(delimiter, "" )) { Con::warnf("GuiTreeViewCtrl::getTextToRoot - Invalid number of arguments!"); return (""); @@ -5296,31 +5296,31 @@ DefineEngineMethod( GuiTreeViewCtrl, getSelectedItemList, const char*, (), , "@return space separated list of selected item ids.") { const U32 bufSize = 1024; - char* buff = Con::getReturnBuffer(bufSize); - dSprintf(buff, bufSize, ""); + char* buff = Con::getReturnBuffer(bufSize); + dSprintf(buff, bufSize, ""); const Vector< S32 >& selected = object->getSelected(); - for(int i = 0; i < selected.size(); i++) - { - S32 id = selected[i]; - //get the current length of the buffer - U32 len = dStrlen(buff); - //the start of the buffer where we want to write - char* buffPart = buff+len; - //the size of the remaining buffer (-1 cause dStrlen doesn't count the \0) - S32 size = bufSize-len-1; - //write it: - if(size < 1) - { - Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list"); - return buff; - } + for(int i = 0; i < selected.size(); i++) + { + S32 id = selected[i]; + //get the current length of the buffer + U32 len = dStrlen(buff); + //the start of the buffer where we want to write + char* buffPart = buff+len; + //the size of the remaining buffer (-1 cause dStrlen doesn't count the \0) + S32 size = bufSize-len-1; + //write it: + if(size < 1) + { + Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list"); + return buff; + } - dSprintf(buffPart,size,"%d ", id); - } + dSprintf(buffPart,size,"%d ", id); + } //mSelected - return buff; + return buff; } S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId) @@ -5331,8 +5331,8 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId) continue; SimObject* pObj = mItems[i]->getObject(); - if( pObj && pObj->getId() == iObjId ) - return mItems[i]->mId; + if( pObj && pObj->getId() == iObjId ) + return mItems[i]->mId; } return -1; @@ -5341,7 +5341,7 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId) //------------------------------------------------------------------------------ DefineEngineMethod( GuiTreeViewCtrl, findItemByObjectId, S32, (S32 objectId), , "Find an item by its object id and returns the Tree Item ID for it.\n\n" - "@param objectId Object id you want the item id for." + "@param objectId Object id you want the item id for." "@return Tree Item Id for the given object ID.") { return(object->findItemByObjectId(objectId)); @@ -5389,7 +5389,7 @@ bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID) //------------------------------------------------------------------------------ DefineEngineMethod( GuiTreeViewCtrl, scrollVisibleByObjectId, S32, (S32 objectId), , "Show item by object id.\n\n" - "@param objectId Object id you want to scroll to." + "@param objectId Object id you want to scroll to." "@return True if successful, false if not.") { return(object->scrollVisibleByObjectId(objectId)); @@ -5400,7 +5400,7 @@ DefineEngineMethod( GuiTreeViewCtrl, scrollVisibleByObjectId, S32, (S32 objectId //FIXME: this clashes with SimSet.sort() DefineEngineMethod( GuiTreeViewCtrl, sort, void, (S32 parentId, bool traverseHierarchy, bool parentsFirst, bool caseSensitive), (0, false, false, true), "Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy." - "@param parentId TreeItemID of parent/root to sort all the items under. Use 0 to sort the entire tree." + "@param parentId TreeItemID of parent/root to sort all the items under. Use 0 to sort the entire tree." "@param traverseHierarchy True to traverse the hierarchy, false to not." "@param parentsFirst True to sort the parents first." "@param caseSensitive True to pay attention to case, false to ignore it.") @@ -5531,7 +5531,7 @@ DefineEngineMethod( GuiTreeViewCtrl, isItemSelected, bool, ( S32 id ),, "@return True if the given item/object is currently selected in the tree." ) { const Vector< GuiTreeViewCtrl::Item* >& selectedItems = object->getSelectedItems(); - for( S32 i = 0; i < selectedItems.size(); ++ i ) + for( S32 i = 0; i < selectedItems.size(); ++ i ) if( selectedItems[ i ]->mId == id ) return true; diff --git a/Engine/source/gui/editor/guiParticleGraphCtrl.cpp b/Engine/source/gui/editor/guiParticleGraphCtrl.cpp index 1f9465760..68ecf81c4 100644 --- a/Engine/source/gui/editor/guiParticleGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiParticleGraphCtrl.cpp @@ -43,16 +43,16 @@ GuiParticleGraphCtrl::GuiParticleGraphCtrl() for(S32 i = 0; i < MaxPlots; i++) { - mPlots[i].mGraphColor = ColorF(1.0, 1.0, 1.0); - VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData); - mPlots[i].mGraphMax.x = 1; - mPlots[i].mGraphMax.y = 50; - mPlots[i].mGraphMin.x = 0; - mPlots[i].mGraphMin.y = 0; - mPlots[i].mGraphType = Polyline; - mPlots[i].mGraphName = StringTable->insert(""); - mPlots[i].mHidden = false; - mPlots[i].mGraphScale = 0.05f; + mPlots[i].mGraphColor = ColorF(1.0, 1.0, 1.0); + VECTOR_SET_ASSOCIATION(mPlots[i].mGraphData); + mPlots[i].mGraphMax.x = 1; + mPlots[i].mGraphMax.y = 50; + mPlots[i].mGraphMin.x = 0; + mPlots[i].mGraphMin.y = 0; + mPlots[i].mGraphType = Polyline; + mPlots[i].mGraphName = StringTable->EmptyString(); + mPlots[i].mHidden = false; + mPlots[i].mGraphScale = 0.05f; } mPlots[0].mGraphColor = ColorF(1.0f, 0.2f, 0.2f); @@ -127,87 +127,87 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect) // Fetch Draw Utility. GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); - if (mProfile->mBorder) - { - const RectI bounds = getBounds(); - RectI rect(offset.x, offset.y, bounds.extent.x, bounds.extent.y); - pDrawUtil->drawRect(rect, mProfile->mBorderColor); - } + if (mProfile->mBorder) + { + const RectI bounds = getBounds(); + RectI rect(offset.x, offset.y, bounds.extent.x, bounds.extent.y); + pDrawUtil->drawRect(rect, mProfile->mBorderColor); + } GuiControlProfile* profile = dynamic_cast(Sim::findObject("GuiDefaultProfile")); Resource font = profile->mFont; - GFXVideoMode videoMode = GFXInit::getDesktopResolution(); + GFXVideoMode videoMode = GFXInit::getDesktopResolution(); - ColorF color(1.0f, 1.0f, 1.0f, 0.5f); - pDrawUtil->drawRectFill(updateRect, color); + ColorF color(1.0f, 1.0f, 1.0f, 0.5f); + pDrawUtil->drawRectFill(updateRect, color); - for (S32 k = 0; k < MaxPlots; k++) - { - // Nothing to graph - if ((mPlots[k].mGraphData.size() == 0) || (mPlots[k].mHidden == true)) - continue; - + for (S32 k = 0; k < MaxPlots; k++) + { + // Nothing to graph + if ((mPlots[k].mGraphData.size() == 0) || (mPlots[k].mHidden == true)) + continue; + Point2F graphExtent = getGraphExtent(k); - // Adjust scale to max value + 5% so we can see high value - F32 ScaleX = (F32(getExtent().x) / (graphExtent.x*(1.00 + (mPlots[k].mGraphScale)))); - F32 ScaleY = (F32(getExtent().y) / (graphExtent.y*(1.00 + (mPlots[k].mGraphScale)))); + // Adjust scale to max value + 5% so we can see high value + F32 ScaleX = (F32(getExtent().x) / (graphExtent.x*(1.00 + (mPlots[k].mGraphScale)))); + F32 ScaleY = (F32(getExtent().y) / (graphExtent.y*(1.00 + (mPlots[k].mGraphScale)))); - if((mPlots[k].mGraphType == Point) || (mPlots[k].mGraphType == Polyline)) - { + if((mPlots[k].mGraphType == Point) || (mPlots[k].mGraphType == Polyline)) + { S32 posX; - S32 posY; - S32 lastPosX = 0; - S32 lastPosY = 0; - Point2F plotPoint; + S32 posY; + S32 lastPosX = 0; + S32 lastPosY = 0; + Point2F plotPoint; - S32 size = 32; + S32 size = 32; - for (S32 sample = 0; sample < mPlots[k].mGraphData.size(); sample++) - { - S32 temp; + for (S32 sample = 0; sample < mPlots[k].mGraphData.size(); sample++) + { + S32 temp; - temp = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample); + temp = (S32)(((F32)getExtent().x / (F32)mPlots[k].mGraphData.size()) * (F32)sample); - // calculate the point positions + // calculate the point positions plotPoint = getPlotPoint(k, sample); - posX = (S32)((plotPoint.x - mPlots[k].mGraphMin.x) * (ScaleX /(1.00 + mPlots[k].mGraphScale))); - posY = (getExtent().y) - (S32)((plotPoint.y - mPlots[k].mGraphMin.y) * ScaleY); + posX = (S32)((plotPoint.x - mPlots[k].mGraphMin.x) * (ScaleX /(1.00 + mPlots[k].mGraphScale))); + posY = (getExtent().y) - (S32)((plotPoint.y - mPlots[k].mGraphMin.y) * ScaleY); posX += getExtent().x * (mPlots[k].mGraphScale); - posY /= (1.00 + (mPlots[k].mGraphScale)); + posY /= (1.00 + (mPlots[k].mGraphScale)); posX = localToGlobalCoord(Point2I(posX, posY)).x; - posY = localToGlobalCoord(Point2I(posX, posY)).y; + posY = localToGlobalCoord(Point2I(posX, posY)).y; - // check if this isn't our first loop through, if it is we won't have starting points + // check if this isn't our first loop through, if it is we won't have starting points if(sample > 0) - { - pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor ); - } else - { + { + pDrawUtil->drawLine( lastPosX, lastPosY , posX, posY , mPlots[k].mGraphColor ); + } else + { mPlots[k].mNutList.clear(); - } + } mPlots[k].mNutList.push_back( Point2F(posX, posY) ); - // store the last positions to be the starting points drawn into a line next loop - lastPosX = posX; - lastPosY = posY; + // store the last positions to be the starting points drawn into a line next loop + lastPosX = posX; + lastPosY = posY; //Con::printf("red %f green %f blue %f", mPlots[k].mGraphColor.red, mPlots[k].mGraphColor.green, mPlots[k].mGraphColor.blue); - if(mSelectedPoint != -1) - { - mLastSelectedPoint = mSelectedPoint; - } + if(mSelectedPoint != -1) + { + mLastSelectedPoint = mSelectedPoint; + } ColorI nutColor (mPlots[k].mGraphColor); - if(k == mSelectedPlot && sample == mLastSelectedPoint) + if(k == mSelectedPlot && sample == mLastSelectedPoint) { // grab the colors for the nut F32 red = mPlots[k].mGraphColor.red; @@ -224,51 +224,51 @@ void GuiParticleGraphCtrl::onRender(Point2I offset, const RectI &updateRect) } // draw the seleciton nut - drawNut( Point2I(posX, posY), 3, mOutlineColor, nutColor ); + drawNut( Point2I(posX, posY), 3, mOutlineColor, nutColor ); - if((mLastSelectedPoint != -1) || (mRenderAllPoints == true)) - { + if((mLastSelectedPoint != -1) || (mRenderAllPoints == true)) + { if((k == mSelectedPlot && sample == mLastSelectedPoint) || (mRenderAllPoints == true)) - { + { char number[32]; - Point2I comparePos = localToGlobalCoord(Point2I(getPosition().x, getPosition().y)); + Point2I comparePos = localToGlobalCoord(Point2I(getPosition().x, getPosition().y)); dSprintf(number, 32, "%4.3f %4.3f", plotPoint.x, plotPoint.y); S32 textWidth = (S32)font->getStrWidth((const UTF8*)number);; - textWidth /= 2; + textWidth /= 2; - if((((S32)posX - (textWidth/2)) < comparePos.x) || (((S32)posX - textWidth) <= 0)) - { + if((((S32)posX - (textWidth/2)) < comparePos.x) || (((S32)posX - textWidth) <= 0)) + { posX += (textWidth/1.5); - } else if((posX + (textWidth * 1.8)) > (comparePos.x + getExtent().x) || ((posX + textWidth) >= videoMode.resolution.x)) - { + } else if((posX + (textWidth * 1.8)) > (comparePos.x + getExtent().x) || ((posX + textWidth) >= videoMode.resolution.x)) + { posX -= (textWidth * 1.5); - } + } - if((((S32)posY) < comparePos.y) || (((S32)posY - textWidth) <= 0)) - { + if((((S32)posY) < comparePos.y) || (((S32)posY - textWidth) <= 0)) + { posY += 40; - } - - pDrawUtil->setBitmapModulation( profile->mFontColor ); - pDrawUtil->drawText( font, Point2I(posX, posY + 5) - Point2I(size >> 1, size), number ); - pDrawUtil->clearBitmapModulation(); - } - } - } - } - } + } + + pDrawUtil->setBitmapModulation( profile->mFontColor ); + pDrawUtil->drawText( font, Point2I(posX, posY + 5) - Point2I(size >> 1, size), number ); + pDrawUtil->clearBitmapModulation(); + } + } + } + } + } - if(mRenderNextGraphTooltip == true && mRenderGraphTooltip == true) - { + if(mRenderNextGraphTooltip == true && mRenderGraphTooltip == true) + { char argBuffer[1][32]; dSprintf(argBuffer[0], 32, "%s", getGraphName(mTooltipSelectedPlot)); - renderGraphTooltip(mCursorPos, argBuffer[0]); - } + renderGraphTooltip(mCursorPos, argBuffer[0]); + } } S32 GuiParticleGraphCtrl::addPlotPoint(S32 plotID, Point2F v, bool setAdded) @@ -302,44 +302,44 @@ S32 GuiParticleGraphCtrl::addPlotPoint(S32 plotID, Point2F v, bool setAdded) for(S32 i = 0; i < mPlots[plotID].mGraphData.size(); i++) { - if(mFabs(v.x - mPlots[plotID].mGraphData[i].x) < 0.001) - { - if(mAutoRemove == true) - { + if(mFabs(v.x - mPlots[plotID].mGraphData[i].x) < 0.001) + { + if(mAutoRemove == true) + { changePlotPoint(plotID, i, v); - plotChanged = true; - mPlotIndex = i; - } else - { + plotChanged = true; + mPlotIndex = i; + } else + { mPlotIndex = -1; - } - - plotAdded = true; - - break; - } else if(v.x < mPlots[plotID].mGraphData[i].x) - { + } + + plotAdded = true; + + break; + } else if(v.x < mPlots[plotID].mGraphData[i].x) + { insertPlotPoint(plotID, i, v); - plotAdded = true; - mPlotIndex = i; - break; - } + plotAdded = true; + mPlotIndex = i; + break; + } } if(plotAdded == false) { - mPlots[plotID].mGraphData.push_back( v ); - mPlotIndex = mPlots[plotID].mGraphData.size() - 1; + mPlots[plotID].mGraphData.push_back( v ); + mPlotIndex = mPlots[plotID].mGraphData.size() - 1; } if(mAutoMax == true) { // Keep record of maximum data value for scaling purposes. if(v.y > mPlots[plotID].mGraphMax.y) - mPlots[plotID].mGraphMax.y = v.y; + mPlots[plotID].mGraphMax.y = v.y; if(v.x > mPlots[plotID].mGraphMax.x) - mPlots[plotID].mGraphMax.x = v.x; + mPlots[plotID].mGraphMax.x = v.x; } if(plotChanged == true) @@ -348,8 +348,8 @@ S32 GuiParticleGraphCtrl::addPlotPoint(S32 plotID, Point2F v, bool setAdded) } else if(mPlotIndex != -1 && setAdded) { mPointWasAdded = true; - mAddedPoint = v; - mAddedPointIndex = mPlotIndex; + mAddedPoint = v; + mAddedPointIndex = mPlotIndex; } return mPlotIndex; @@ -367,10 +367,10 @@ void GuiParticleGraphCtrl::insertPlotPoint(S32 plotID, S32 i, Point2F v) { // Keep record of maximum data value for scaling purposes. if(v.y > mPlots[plotID].mGraphMax.y) - mPlots[plotID].mGraphMax.y = v.y; + mPlots[plotID].mGraphMax.y = v.y; if(v.x > mPlots[plotID].mGraphMax.x) - mPlots[plotID].mGraphMax.x = v.x; + mPlots[plotID].mGraphMax.x = v.x; } // Argument Buffer. @@ -477,7 +477,7 @@ S32 GuiParticleGraphCtrl::getPlotIndex(S32 plotID, F32 x, F32 y) compareY = mPlots[plotID].mGraphData[i].y; // - //if((x == compareX) && (y == compareY)) + //if((x == compareX) && (y == compareY)) if((mFabs(x - compareX) < 0.001) && (mFabs(y - compareY) < 0.001)) return i; } @@ -487,16 +487,16 @@ S32 GuiParticleGraphCtrl::getPlotIndex(S32 plotID, F32 x, F32 y) void GuiParticleGraphCtrl::setGraphType(S32 plotID, const char *graphType) { - AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!"); - if(!dStricmp(graphType,"Bar")) - mPlots[plotID].mGraphType = Bar; - else if(!dStricmp(graphType,"Filled")) - mPlots[plotID].mGraphType = Filled; - else if(!dStricmp(graphType,"Point")) - mPlots[plotID].mGraphType = Point; - else if(!dStricmp(graphType,"Polyline")) - mPlots[plotID].mGraphType = Polyline; - else AssertWarn(true, "Invalid graph type!"); + AssertFatal(plotID > -1 && plotID < MaxPlots, "Invalid plot specified!"); + if(!dStricmp(graphType,"Bar")) + mPlots[plotID].mGraphType = Bar; + else if(!dStricmp(graphType,"Filled")) + mPlots[plotID].mGraphType = Filled; + else if(!dStricmp(graphType,"Point")) + mPlots[plotID].mGraphType = Point; + else if(!dStricmp(graphType,"Polyline")) + mPlots[plotID].mGraphType = Polyline; + else AssertWarn(true, "Invalid graph type!"); } void GuiParticleGraphCtrl::setSelectedPlot(S32 plotID) @@ -565,8 +565,8 @@ void GuiParticleGraphCtrl::setRenderGraphTooltip(bool renderGraphTooltip) void GuiParticleGraphCtrl::drawNut(const Point2I &nut, S32 size, ColorI &outlineColor, ColorI &nutColor) { - // Fetch Draw Utility. - GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); + // Fetch Draw Utility. + GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); //Con::printf("r %d g %d b %d", nutColor.red, nutColor.green, nutColor.blue); S32 NUT_SIZE = size; @@ -588,17 +588,17 @@ Point2I GuiParticleGraphCtrl::findHitNut( Point2I hitPoint ) { for(S32 i = 0; i < MaxPlots; i++) { - if ( (mPlots[i].mGraphData.size() == 0) || (mPlots[i].mHidden == true)) + if ( (mPlots[i].mGraphData.size() == 0) || (mPlots[i].mHidden == true)) continue; for (S32 j = 0 ; j < mPlots[i].mNutList.size(); j++ ) { - if( inNut (Point2I( mPlots[i].mNutList[j].x, mPlots[i].mNutList[j].y), hitPoint.x, hitPoint.y) ) - { + if( inNut (Point2I( mPlots[i].mNutList[j].x, mPlots[i].mNutList[j].y), hitPoint.x, hitPoint.y) ) + { mTooltipSelectedPlot = i; - return Point2I(i,j); - } - } + return Point2I(i,j); + } + } } return Point2I(-1,-1); @@ -718,7 +718,7 @@ StringTableEntry GuiParticleGraphCtrl::getGraphName(S32 plotID) void GuiParticleGraphCtrl::onMouseMove(const GuiEvent &event) { mCursorPos = event.mousePoint; - + Point2I hitNut = findHitNut(event.mousePoint); if( hitNut != Point2I(-1,-1) ) @@ -745,8 +745,8 @@ void GuiParticleGraphCtrl::onMouseDown(const GuiEvent &event) if( hitNut != Point2I(-1,-1) ) { - if(event.mouseClickCount == 2) - { + if(event.mouseClickCount == 2) + { Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y); S32 point = removePlotPoint(hitNut.x, hitNut.y); @@ -755,31 +755,31 @@ void GuiParticleGraphCtrl::onMouseDown(const GuiEvent &event) dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%d", point); - dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); + dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); - + // Call Scripts. Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); - } else - { - setSelectedPlot(hitNut.x); + } else + { + setSelectedPlot(hitNut.x); setSelectedPoint(hitNut.y); - mOriginalSelectedPoint = hitNut.y; + mOriginalSelectedPoint = hitNut.y; - char argBuffer[32]; + char argBuffer[32]; dSprintf(argBuffer, 32, "%d", hitNut.y); // Call Scripts. Con::executef(this, "onPlotPointSelectedMouseDown", argBuffer); - } + } } else if( mSelectedPlot != -1 ) { - Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); - mLastSelectedPoint = addPlotPoint(mSelectedPlot, mousePos); + Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); + mLastSelectedPoint = addPlotPoint(mSelectedPlot, mousePos); - // Argument Buffer. + // Argument Buffer. char argBuffer[32]; dSprintf(argBuffer, 32, "%f %f", convertToGraphCoord(mSelectedPlot, event.mousePoint).x, convertToGraphCoord(mSelectedPlot, event.mousePoint).y); @@ -787,41 +787,41 @@ void GuiParticleGraphCtrl::onMouseDown(const GuiEvent &event) // Call Scripts. Con::executef(this, "onMouseDragged", argBuffer); - return; + return; } } void GuiParticleGraphCtrl::onMouseUp(const GuiEvent &event) { if(mSelectedPoint != -1) - mLastSelectedPoint = mSelectedPoint; + mLastSelectedPoint = mSelectedPoint; if(mPointWasAdded == true) { if(mSelectedPoint == -1) - { - // Argument Buffer. + { + // Argument Buffer. char argBuffer[3][32]; dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); - dSprintf(argBuffer[2], 32, "%d", mAddedPointIndex); + dSprintf(argBuffer[2], 32, "%d", mAddedPointIndex); // Call Scripts. Con::executef(this, "onPlotPointAdded", argBuffer[0], argBuffer[1], argBuffer[2]); - } else - { + } else + { // Argument Buffer. char argBuffer[4][32]; dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); - dSprintf(argBuffer[2], 32, "%d", mOriginalSelectedPoint); - dSprintf(argBuffer[3], 32, "%d", mAddedPointIndex); + dSprintf(argBuffer[2], 32, "%d", mOriginalSelectedPoint); + dSprintf(argBuffer[3], 32, "%d", mAddedPointIndex); // Call Scripts. Con::executef(this, "onPlotPointChangedUp", argBuffer[0], argBuffer[1], argBuffer[2], argBuffer[3]); - } + } } mPointWasAdded = false; @@ -835,37 +835,37 @@ void GuiParticleGraphCtrl::onMouseDragged(const GuiEvent &event) if(mSelectedPoint != -1) { - Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); + Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint); if(mPointXMovementClamped == true) - { + { F32 prevXPos = getPlotPoint(mSelectedPlot, mSelectedPoint).x; - if(mousePos.x != prevXPos) - { - mousePos.x = prevXPos; - } - } + if(mousePos.x != prevXPos) + { + mousePos.x = prevXPos; + } + } - removePlotPoint(mSelectedPlot, mSelectedPoint); - S32 point = addPlotPoint(mSelectedPlot, mousePos); + removePlotPoint(mSelectedPlot, mSelectedPoint); + S32 point = addPlotPoint(mSelectedPlot, mousePos); if(point != -1) - { + { setSelectedPoint(point); - mLastMousePos = mousePos; + mLastMousePos = mousePos; // Argument Buffer. char argBuffer[3][32]; dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%f %f", mAddedPoint.x, mAddedPoint.y); - dSprintf(argBuffer[2], 32, "%d", point); + dSprintf(argBuffer[2], 32, "%d", point); // Call Scripts. Con::executef(this, "onPlotPointChangedMove", argBuffer[0], argBuffer[1], argBuffer[2]); - } else - { + } else + { point = addPlotPoint(mSelectedPlot, mLastMousePos); - } + } } // Argument Buffer. @@ -891,7 +891,7 @@ void GuiParticleGraphCtrl::onRightMouseDown(const GuiEvent &event) dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%d", point); - dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); + dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); // Call Scripts. Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); @@ -912,12 +912,12 @@ void GuiParticleGraphCtrl::onRightMouseDragged(const GuiEvent &event) Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y); S32 point = removePlotPoint(hitNut.x, hitNut.y); - // Argument Buffer. + // Argument Buffer. char argBuffer[3][32]; dSprintf(argBuffer[0], 32, "%d", mSelectedPlot); dSprintf(argBuffer[1], 32, "%d", point); - dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); + dSprintf(argBuffer[2], 32, "%f %f", plotPoint.x, plotPoint.y); // Call Scripts. Con::executef(this, "onPlotPointRemoved", argBuffer[0], argBuffer[1], argBuffer[2]); @@ -987,12 +987,12 @@ bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntr RectI rect(offset, textBounds); GFX->setClipRect(rect); - // Fetch Draw Utility. - GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); + // Fetch Draw Utility. + GFXDrawUtil* pDrawUtil = GFX->getDrawUtil(); // Draw Filler bit, then border on top of that - pDrawUtil->drawRectFill(rect, ColorI(mTooltipProfile->mFillColor.red, mTooltipProfile->mFillColor.green, mTooltipProfile->mFillColor.blue, 200) ); - pDrawUtil->drawRect( rect, mTooltipProfile->mBorderColor ); + pDrawUtil->drawRectFill(rect, ColorI(mTooltipProfile->mFillColor.red, mTooltipProfile->mFillColor.green, mTooltipProfile->mFillColor.blue, 200) ); + pDrawUtil->drawRect( rect, mTooltipProfile->mBorderColor ); // Draw the text centered in the tool tip box pDrawUtil->setBitmapModulation( mTooltipProfile->mFontColor ); @@ -1006,102 +1006,102 @@ bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntr DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , "(int point)" "Set the selected point on the graph.\n" - "@return No return value") + "@return No return value") { if(point >= object->mPlots[object->mSelectedPlot].mGraphData.size() || point < 0) { - Con::errorf("Invalid point to select."); - return; + Con::errorf("Invalid point to select."); + return; } object->setSelectedPoint( point ); } DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , "(int plotID)" "Set the selected plot (a.k.a. graph)." - "@return No return value" ) + "@return No return value" ) { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); - return; + Con::errorf("Invalid plotID."); + return; } object->setSelectedPlot( plotID ); } DefineConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int plotID)" "Clear the graph of the given plot." - "@return No return value") + "@return No return value") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); - return; + Con::errorf("Invalid plotID."); + return; } object->clearGraph( plotID ); } DefineConsoleMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()" "Clear all of the graphs." - "@return No return value") + "@return No return value") { object->clearAllGraphs(); } DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)" "Add a data point to the given plot." - "@return") + "@return") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); - return -2; + Con::errorf("Invalid plotID."); + return -2; } return object->addPlotPoint( plotID, Point2F(x, y), setAdded); } DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n" "Insert a data point to the given plot and plot position.\n" - "@param plotID The plot you want to access\n" - "@param i The data point.\n" - "@param x,y The plot position.\n" - "@return No return value.") + "@param plotID The plot you want to access\n" + "@param i The data point.\n" + "@param x,y The plot position.\n" + "@return No return value.") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); - return; + Con::errorf("Invalid plotID."); + return; } object->insertPlotPoint( plotID, i, Point2F(x, y)); } DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)" "Change a data point to the given plot and plot position.\n" - "@param plotID The plot you want to access\n" - "@param i The data point.\n" - "@param x,y The plot position.\n" - "@return No return value.") + "@param plotID The plot you want to access\n" + "@param i The data point.\n" + "@param x,y The plot position.\n" + "@return No return value.") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); - return -1; + Con::errorf("Invalid plotID."); + return -1; } return object->changePlotPoint( plotID, i, Point2F(x, y)); } DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() " "Gets the selected Plot (a.k.a. graph).\n" - "@return The plot's ID.") + "@return The plot's ID.") { return object->getSelectedPlot(); } DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()" "Gets the selected Point on the Plot (a.k.a. graph)." - "@return The last selected point ID") + "@return The last selected point ID") { - return object->getSelectedPoint(); + return object->getSelectedPoint(); } DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32 samples), , "(int plotID, int samples)" @@ -1110,27 +1110,27 @@ DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S3 if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } if(samples > object->MaxDataPoints) { - Con::errorf("Invalid sample."); + Con::errorf("Invalid sample."); } return object->isExistingPoint(plotID, samples); } DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32 samples), , "(int plotID, int samples)" "Get a data point from the plot specified, samples from the start of the graph." - "@return The data point ID") + "@return The data point ID") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } if(samples > object->MaxDataPoints) { - Con::errorf("Invalid sample."); + Con::errorf("Invalid sample."); } @@ -1139,26 +1139,26 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S3 DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n" "Gets the index of the point passed on the plotID passed (graph ID).\n" - "@param plotID The plot you wish to check.\n" - "@param x,y The coordinates of the point to get.\n" - "@return Returns the index of the point.\n") + "@param plotID The plot you wish to check.\n" + "@param x,y The coordinates of the point to get.\n" + "@return Returns the index of the point.\n") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } return object->getPlotIndex(plotID, x, y); } DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (S32 plotID), , "(int plotID)" "Get the color of the graph passed." - "@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"") + "@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } return object->getGraphColor(plotID); @@ -1167,24 +1167,24 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (S32 plotID), , DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "(int plotID) " "Get the minimum values of the graph ranges.\n" - "@return Returns the minimum of the range formatted as \"x-min y-min\"") + "@return Returns the minimum of the range formatted as \"x-min y-min\"") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } return object->getGraphMin(plotID); } DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "(int plotID) " - "Get the maximum values of the graph ranges.\n" - "@return Returns the maximum of the range formatted as \"x-max y-max\"") + "Get the maximum values of the graph ranges.\n" + "@return Returns the maximum of the range formatted as \"x-max y-max\"") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } return object->getGraphMax(plotID); @@ -1192,12 +1192,12 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) " "Get the name of the graph passed.\n" - "@return Returns the name of the plot") + "@return Returns the name of the plot") { if(plotID > object->MaxPlots) { - Con::errorf("Invalid plotID."); + Con::errorf("Invalid plotID."); } const U32 bufSize = 64; @@ -1208,170 +1208,170 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 minX, F32 minY), , "(int plotID, float minX, float minY) " - "Set the min values of the graph of plotID.\n" - "@param plotID The plot to modify\n" - "@param minX,minY The minimum bound of the value range.\n" - "@return No return value.") + "Set the min values of the graph of plotID.\n" + "@param plotID The plot to modify\n" + "@param minX,minY The minimum bound of the value range.\n" + "@return No return value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMin(plotID, Point2F(minX, minY)); + object->setGraphMin(plotID, Point2F(minX, minY)); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 minX), , "(int plotID, float minX) " - "Set the min X value of the graph of plotID.\n" - "@param plotID The plot to modify.\n" - "@param minX The minimum x value.\n" - "@return No return Value.") + "Set the min X value of the graph of plotID.\n" + "@param plotID The plot to modify.\n" + "@param minX The minimum x value.\n" + "@return No return Value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMinX(plotID, minX); + object->setGraphMinX(plotID, minX); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 minX), , "(int plotID, float minY) " - "Set the min Y value of the graph of plotID." - "@param plotID The plot to modify.\n" - "@param minY The minimum y value.\n" - "@return No return Value.") + "Set the min Y value of the graph of plotID." + "@param plotID The plot to modify.\n" + "@param minY The minimum y value.\n" + "@return No return Value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMinY(plotID, minX); + object->setGraphMinY(plotID, minX); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 maxX, F32 maxY), , "(int plotID, float maxX, float maxY) " - "Set the max values of the graph of plotID." - "@param plotID The plot to modify\n" - "@param maxX,maxY The maximum bound of the value range.\n" - "@return No return value.") + "Set the max values of the graph of plotID." + "@param plotID The plot to modify\n" + "@param maxX,maxY The maximum bound of the value range.\n" + "@return No return value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMax(plotID, Point2F(maxX, maxY)); + object->setGraphMax(plotID, Point2F(maxX, maxY)); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 maxX), , "(int plotID, float maxX)" - "Set the max X value of the graph of plotID." - "@param plotID The plot to modify.\n" - "@param maxX The maximum x value.\n" - "@return No return Value.") + "Set the max X value of the graph of plotID." + "@param plotID The plot to modify.\n" + "@param maxX The maximum x value.\n" + "@return No return Value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMaxX(plotID, maxX); + object->setGraphMaxX(plotID, maxX); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 maxX), , "(int plotID, float maxY)" - "Set the max Y value of the graph of plotID." - "@param plotID The plot to modify.\n" - "@param maxY The maximum y value.\n" - "@return No return Value.") + "Set the max Y value of the graph of plotID." + "@param plotID The plot to modify.\n" + "@param maxY The maximum y value.\n" + "@return No return Value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphMaxY(plotID, maxX); + object->setGraphMaxY(plotID, maxX); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool isHidden), , "(int plotID, bool isHidden)" - "Set whether the graph number passed is hidden or not." - "@return No return value.") + "Set whether the graph number passed is hidden or not." + "@return No return value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphHidden(plotID, isHidden); + object->setGraphHidden(plotID, isHidden); } DefineConsoleMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), , "(bool autoMax) " - "Set whether the max will automatically be set when adding points " - "(ie if you add a value over the current max, the max is increased to that value).\n" - "@return No return value.") + "Set whether the max will automatically be set when adding points " + "(ie if you add a value over the current max, the max is increased to that value).\n" + "@return No return value.") { - object->setAutoGraphMax(autoMax); + object->setAutoGraphMax(autoMax); } DefineConsoleMethod(GuiParticleGraphCtrl, setAutoRemove, void, (bool autoRemove), , "(bool autoRemove) " - "Set whether or not a point should be deleted when you drag another one over it." - "@return No return value.") + "Set whether or not a point should be deleted when you drag another one over it." + "@return No return value.") { - object->setAutoRemove(autoRemove); + object->setAutoRemove(autoRemove); } DefineConsoleMethod(GuiParticleGraphCtrl, setRenderAll, void, (bool autoRemove), , "(bool renderAll)" - "Set whether or not a position should be rendered on every point or just the last selected." - "@return No return value.") + "Set whether or not a position should be rendered on every point or just the last selected." + "@return No return value.") { - object->setRenderAll(autoRemove); + object->setRenderAll(autoRemove); } DefineConsoleMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, (bool autoRemove), , "(bool clamped)" - "Set whether the x position of the selected graph point should be clamped" - "@return No return value.") + "Set whether the x position of the selected graph point should be clamped" + "@return No return value.") { - object->setPointXMovementClamped(autoRemove); + object->setPointXMovementClamped(autoRemove); } DefineConsoleMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, (bool autoRemove), , "(bool renderGraphTooltip)" - "Set whether or not to render the graph tooltip." - "@return No return value.") + "Set whether or not to render the graph tooltip." + "@return No return value.") { - object->setRenderGraphTooltip(autoRemove); + object->setRenderGraphTooltip(autoRemove); } DefineConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const char * graphName), , "(int plotID, string graphName) " - "Set the name of the given plot.\n" - "@param plotID The plot to modify.\n" - "@param graphName The name to set on the plot.\n" - "@return No return value.") + "Set the name of the given plot.\n" + "@param plotID The plot to modify.\n" + "@param graphName The name to set on the plot.\n" + "@return No return value.") { - if(plotID > object->MaxPlots) - { - Con::errorf("Invalid plotID."); - return; - } + if(plotID > object->MaxPlots) + { + Con::errorf("Invalid plotID."); + return; + } - object->setGraphName(plotID, graphName); + object->setGraphName(plotID, graphName); } DefineConsoleMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, (), , "()" - "This will reset the currently selected point to nothing." - "@return No return value.") + "This will reset the currently selected point to nothing." + "@return No return value.") { - object->resetSelectedPoint(); + object->resetSelectedPoint(); } diff --git a/Engine/source/gui/game/guiChunkedBitmapCtrl.cpp b/Engine/source/gui/game/guiChunkedBitmapCtrl.cpp index 735607224..d0f9549e1 100644 --- a/Engine/source/gui/game/guiChunkedBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiChunkedBitmapCtrl.cpp @@ -65,10 +65,10 @@ ConsoleDocClass( GuiChunkedBitmapCtrl, void GuiChunkedBitmapCtrl::initPersistFields() { - addGroup("GuiChunkedBitmapCtrl"); + addGroup("GuiChunkedBitmapCtrl"); addField( "bitmap", TypeFilename, Offset( mBitmapName, GuiChunkedBitmapCtrl ), "This is the bitmap to render to the control." ); addField( "useVariable", TypeBool, Offset( mUseVariable, GuiChunkedBitmapCtrl ), "This decides whether to use the \"bitmap\" file " - "or a bitmap stored in \"variable\""); + "or a bitmap stored in \"variable\""); addField( "tile", TypeBool, Offset( mTile, GuiChunkedBitmapCtrl ), "This is no longer in use"); endGroup("GuiChunkedBitmapCtrl"); Parent::initPersistFields(); @@ -86,7 +86,7 @@ DefineEngineMethod( GuiChunkedBitmapCtrl, setBitmap, void, (const char* filename GuiChunkedBitmapCtrl::GuiChunkedBitmapCtrl() { - mBitmapName = StringTable->insert(""); + mBitmapName = StringTable->EmptyString(); mUseVariable = false; mTile = false; } diff --git a/Engine/source/gui/worldEditor/undoActions.cpp b/Engine/source/gui/worldEditor/undoActions.cpp index 6c71a0831..d88b72bcd 100644 --- a/Engine/source/gui/worldEditor/undoActions.cpp +++ b/Engine/source/gui/worldEditor/undoActions.cpp @@ -32,9 +32,9 @@ IMPLEMENT_CONOBJECT( MECreateUndoAction ); ConsoleDocClass( MECreateUndoAction, - "@brief Material Editor create undo instance\n\n" - "Not intended for game development, for editors or internal use only.\n\n " - "@internal"); + "@brief Material Editor create undo instance\n\n" + "Not intended for game development, for editors or internal use only.\n\n " + "@internal"); MECreateUndoAction::MECreateUndoAction( const UTF8* actionName ) : UndoAction( actionName ) @@ -62,7 +62,7 @@ DefineEngineMethod( MECreateUndoAction, addObject, void, ( SimObject* obj),, "Add the object being created to an undo action.\n" "@param obj Object being created you want to create the undo for.") { - if (obj) + if (obj) object->addObject( obj ); } @@ -117,9 +117,9 @@ void MECreateUndoAction::redo() IMPLEMENT_CONOBJECT( MEDeleteUndoAction ); ConsoleDocClass( MEDeleteUndoAction, - "@brief Material Editor delete undo instance\n\n" - "Not intended for game development, for editors or internal use only.\n\n " - "@internal"); + "@brief Material Editor delete undo instance\n\n" + "Not intended for game development, for editors or internal use only.\n\n " + "@internal"); MEDeleteUndoAction::MEDeleteUndoAction( const UTF8 *actionName ) : UndoAction( actionName ) @@ -169,7 +169,7 @@ DefineEngineMethod( MEDeleteUndoAction, deleteObject, void, ( SimObject* obj),, "Delete the object and add it to the undo action.\n" "@param obj Object to delete and add to the undo action.") { - if (obj) + if (obj) object->deleteObject( obj ); } @@ -210,16 +210,16 @@ void MEDeleteUndoAction::redo() IMPLEMENT_CONOBJECT( InspectorFieldUndoAction ); ConsoleDocClass( InspectorFieldUndoAction, - "@brief Inspector Field undo action instance\n\n" - "Not intended for game development, for editors or internal use only.\n\n " - "@internal"); + "@brief Inspector Field undo action instance\n\n" + "Not intended for game development, for editors or internal use only.\n\n " + "@internal"); InspectorFieldUndoAction::InspectorFieldUndoAction() { mObjId = 0; mField = NULL; - mSlotName = StringTable->insert(""); - mArrayIdx = StringTable->insert(""); + mSlotName = StringTable->EmptyString(); + mArrayIdx = StringTable->EmptyString(); } InspectorFieldUndoAction::InspectorFieldUndoAction( const UTF8 *actionName ) @@ -228,8 +228,8 @@ InspectorFieldUndoAction::InspectorFieldUndoAction( const UTF8 *actionName ) mInspector = NULL; mObjId = 0; mField = NULL; - mSlotName = StringTable->insert(""); - mArrayIdx = StringTable->insert(""); + mSlotName = StringTable->EmptyString(); + mArrayIdx = StringTable->EmptyString(); } void InspectorFieldUndoAction::initPersistFields() @@ -272,4 +272,4 @@ void InspectorFieldUndoAction::undo() // Now save the previous data in this UndoAction // since an undo action must become a redo action and vice-versa mData = data; -} \ No newline at end of file +} diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index 2d4b0ad7e..7dbb40d6d 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -181,7 +181,7 @@ DefineConsoleFunction(NavMeshUpdateOne, void, (S32 meshid, S32 objid, bool remov NavMesh::NavMesh() { mTypeMask |= StaticShapeObjectType | MarkerObjectType; - mFileName = StringTable->insert(""); + mFileName = StringTable->EmptyString(); mNetFlags.clear(Ghostable); mSaveIntermediates = false; @@ -211,7 +211,7 @@ NavMesh::NavMesh() mLargeCharacters = false; mVehicles = false; - mCoverSet = StringTable->insert(""); + mCoverSet = StringTable->EmptyString(); mInnerCover = false; mCoverDist = 1.0f; mPeekDist = 0.7f; diff --git a/Engine/source/navigation/navPath.cpp b/Engine/source/navigation/navPath.cpp index a945e7f8d..9409cc193 100644 --- a/Engine/source/navigation/navPath.cpp +++ b/Engine/source/navigation/navPath.cpp @@ -170,7 +170,7 @@ const char *NavPath::getProtectedFrom(void *obj, const char *data) if(object->mFromSet) return data; else - return StringTable->insert(""); + return StringTable->EmptyString(); } const char *NavPath::getProtectedTo(void *obj, const char *data) @@ -180,7 +180,7 @@ const char *NavPath::getProtectedTo(void *obj, const char *data) if(object->mToSet) return data; else - return StringTable->insert(""); + return StringTable->EmptyString(); } IRangeValidator ValidIterations(1, S32_MAX); diff --git a/Engine/source/platform/menus/popupMenu.cpp b/Engine/source/platform/menus/popupMenu.cpp index ee8d75a82..7e8aad7ba 100644 --- a/Engine/source/platform/menus/popupMenu.cpp +++ b/Engine/source/platform/menus/popupMenu.cpp @@ -51,10 +51,10 @@ PopupMenu::PopupMenu() : mCanvas(NULL) mSubmenus = new SimSet; mSubmenus->registerObject(); - mBarTitle = StringTable->insert(""); + mBarTitle = StringTable->EmptyString(); mIsPopup = false; - mPopupGUID = sMaxPopupGUID++; + mPopupGUID = sMaxPopupGUID++; } PopupMenu::~PopupMenu() @@ -126,10 +126,10 @@ void PopupMenu::onMenuSelect() //----------------------------------------------------------------------------- void PopupMenu::handleSelectEvent(U32 popID, U32 command) -{ - if (popID == mPopupGUID && canHandleID(command)) - if (handleSelect(command)) - smSelectionEventHandled = true; +{ + if (popID == mPopupGUID && canHandleID(command)) + if (handleSelect(command)) + smSelectionEventHandled = true; } //----------------------------------------------------------------------------- @@ -138,8 +138,8 @@ void PopupMenu::onAttachToMenuBar(GuiCanvas *canvas, S32 pos, const char *title) { mCanvas = canvas; - // Attached menus must be notified of menu events - smPopupMenuEvent.notify(this, &PopupMenu::handleSelectEvent); + // Attached menus must be notified of menu events + smPopupMenuEvent.notify(this, &PopupMenu::handleSelectEvent); // Pass on to sub menus for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) @@ -160,8 +160,8 @@ void PopupMenu::onRemoveFromMenuBar(GuiCanvas *canvas) { mCanvas = NULL; - // We are no longer interested in select events, remove ourselves from the notification list in a safe way - Sim::postCurrentEvent(this, new PopUpNotifyRemoveEvent()); + // We are no longer interested in select events, remove ourselves from the notification list in a safe way + Sim::postCurrentEvent(this, new PopUpNotifyRemoveEvent()); // Pass on to sub menus for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index 08d689585..09ed1c63e 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -48,10 +48,10 @@ FileDialogData::FileDialogData() if (mDefaultPath == StringTable->lookup("") || !Platform::isDirectory(mDefaultPath)) mDefaultPath = Platform::getCurrentDirectory(); - mDefaultFile = StringTable->insert(""); - mFilters = StringTable->insert(""); - mFile = StringTable->insert(""); - mTitle = StringTable->insert(""); + mDefaultFile = StringTable->EmptyString(); + mFilters = StringTable->EmptyString(); + mFile = StringTable->EmptyString(); + mTitle = StringTable->EmptyString(); mStyle = 0; From cac515971749724b03644ae9da5f52d577536aac Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 13 Jan 2017 10:42:52 -0500 Subject: [PATCH 20/21] Somebody broke SDL when they updated it. The new version depends on AudioToolbox, so added that as dependency in torque3d.cmake --- Engine/lib/sdl/Android.mk | 0 Engine/lib/sdl/BUGS.txt | 2 +- Engine/lib/sdl/CMakeLists.txt | 183 +++-- Engine/lib/sdl/Makefile.in | 11 +- Engine/lib/sdl/Makefile.pandora | 2 +- Engine/lib/sdl/Makefile.psp | 1 + Engine/lib/sdl/Makefile.wiz | 10 +- Engine/lib/sdl/README-SDL.txt | 4 +- Engine/lib/sdl/SDL2.spec | 2 +- Engine/lib/sdl/VisualC.html | 4 +- Engine/lib/sdl/VisualC/clean.sh | 4 - Engine/lib/sdl/WhatsNew.txt | 63 ++ Engine/lib/sdl/Xcode/SDL/Info-Framework.plist | 6 +- .../Xcode/SDL/SDL.xcodeproj/project.pbxproj | 117 +-- Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info | 0 .../SDL/pkg-support/resources/ReadMe.txt | 0 .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 4 +- Engine/lib/sdl/autogen.sh | 6 + Engine/lib/sdl/build-scripts/androidbuild.sh | 8 +- .../lib/sdl/build-scripts/checker-buildbot.sh | 6 +- .../sdl/build-scripts/emscripten-buildbot.sh | 7 +- Engine/lib/sdl/build-scripts/g++-fat.sh | 6 +- Engine/lib/sdl/build-scripts/gcc-fat.sh | 8 +- Engine/lib/sdl/build-scripts/install-sh | 0 Engine/lib/sdl/build-scripts/iosbuild.sh | 0 Engine/lib/sdl/build-scripts/ltmain.sh | 0 Engine/lib/sdl/build-scripts/mkinstalldirs | 0 Engine/lib/sdl/build-scripts/nacl-buildbot.sh | 0 Engine/lib/sdl/build-scripts/naclbuild.sh | 0 .../sdl/build-scripts/raspberrypi-buildbot.sh | 0 Engine/lib/sdl/build-scripts/showrev.sh | 4 +- Engine/lib/sdl/build-scripts/strip_fPIC.sh | 0 .../lib/sdl/build-scripts/update-copyright.sh | 0 Engine/lib/sdl/build-scripts/updaterev.sh | 0 Engine/lib/sdl/cmake/sdlchecks.cmake | 98 ++- Engine/lib/sdl/configure | 289 +++++++- Engine/lib/sdl/configure.in | 200 ++++- Engine/lib/sdl/debian/changelog | 6 + Engine/lib/sdl/debian/copyright | 11 - Engine/lib/sdl/debian/libsdl2-dev.install | 1 + Engine/lib/sdl/debian/rules | 0 Engine/lib/sdl/sdl2-config.cmake.in | 1 + Engine/lib/sdl/sdl2.m4 | 54 +- Engine/lib/sdl/src/audio/SDL_audiomem.h | 25 - .../sdl/src/audio/coreaudio/SDL_coreaudio.c | 698 ------------------ Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl | 0 Engine/lib/sdl/src/dynapi/gendynapi.pl | 0 .../sdl/src/joystick/SDL_gamecontrollerdb.h | 4 +- .../lib/sdl/src/joystick/sort_controllers.py | 0 Engine/lib/sdl/src/main/haiku/SDL_BApp.h | 2 +- Engine/lib/sdl/src/video/haiku/SDL_BWin.h | 2 +- Engine/lib/sdl/src/video/sdlgenblit.pl | 0 Engine/lib/sdl/src/video/x11/SDL_x11sym.h | 4 +- Engine/lib/sdl/test/Makefile.in | 16 + Engine/lib/sdl/test/autogen.sh | 0 Engine/lib/sdl/test/configure | 0 Engine/lib/sdl/test/controllermap.c | 9 +- Engine/lib/sdl/test/gcc-fat.sh | 0 Engine/lib/sdl/test/testatomic.c | 12 +- Engine/lib/sdl/test/testaudiocapture.c | 165 +++++ Engine/lib/sdl/test/testaudiohotplug.c | 28 +- Engine/lib/sdl/test/testaudioinfo.c | 12 +- Engine/lib/sdl/test/testautomation_events.c | 4 +- Engine/lib/sdl/test/testautomation_keyboard.c | 16 +- Engine/lib/sdl/test/testautomation_main.c | 4 +- Engine/lib/sdl/test/testautomation_sdltest.c | 2 +- Engine/lib/sdl/test/testautomation_stdlib.c | 44 +- Engine/lib/sdl/test/testbounds.c | 40 + Engine/lib/sdl/test/testcustomcursor.c | 216 ++++++ Engine/lib/sdl/test/testdisplayinfo.c | 7 + Engine/lib/sdl/test/testdrawchessboard.c | 2 +- Engine/lib/sdl/test/testdropfile.c | 9 +- Engine/lib/sdl/test/testfilesystem.c | 5 +- Engine/lib/sdl/test/testgamecontroller.c | 12 +- Engine/lib/sdl/test/testgles.c | 2 +- Engine/lib/sdl/test/testgles2.c | 4 +- Engine/lib/sdl/test/testime.c | 500 ++++++++++++- Engine/lib/sdl/test/testlock.c | 12 +- Engine/lib/sdl/test/testmultiaudio.c | 11 +- Engine/lib/sdl/test/testqsort.c | 108 +++ Engine/lib/sdl/test/testrendercopyex.c | 4 +- Engine/lib/sdl/test/testshape.c | 4 + Engine/lib/sdl/test/testwm2.c | 14 +- Engine/lib/sdl/test/torturethread.c | 8 +- Engine/source/.gitattributes | 5 + Tools/CMake/torque3d.cmake | 1 + 86 files changed, 2088 insertions(+), 1041 deletions(-) mode change 100644 => 100755 Engine/lib/sdl/Android.mk delete mode 100644 Engine/lib/sdl/VisualC/clean.sh mode change 100644 => 100755 Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj mode change 100644 => 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info mode change 100644 => 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt mode change 100644 => 100755 Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj mode change 100644 => 100755 Engine/lib/sdl/autogen.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/androidbuild.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/checker-buildbot.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/emscripten-buildbot.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/g++-fat.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/gcc-fat.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/install-sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/iosbuild.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/ltmain.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/mkinstalldirs mode change 100644 => 100755 Engine/lib/sdl/build-scripts/nacl-buildbot.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/naclbuild.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/raspberrypi-buildbot.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/showrev.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/strip_fPIC.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/update-copyright.sh mode change 100644 => 100755 Engine/lib/sdl/build-scripts/updaterev.sh mode change 100644 => 100755 Engine/lib/sdl/configure mode change 100644 => 100755 Engine/lib/sdl/debian/rules delete mode 100644 Engine/lib/sdl/src/audio/SDL_audiomem.h delete mode 100644 Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c mode change 100644 => 100755 Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl mode change 100644 => 100755 Engine/lib/sdl/src/dynapi/gendynapi.pl mode change 100644 => 100755 Engine/lib/sdl/src/joystick/sort_controllers.py mode change 100644 => 100755 Engine/lib/sdl/src/video/sdlgenblit.pl mode change 100644 => 100755 Engine/lib/sdl/test/autogen.sh mode change 100644 => 100755 Engine/lib/sdl/test/configure mode change 100644 => 100755 Engine/lib/sdl/test/gcc-fat.sh create mode 100644 Engine/lib/sdl/test/testaudiocapture.c create mode 100644 Engine/lib/sdl/test/testbounds.c create mode 100644 Engine/lib/sdl/test/testcustomcursor.c create mode 100644 Engine/lib/sdl/test/testqsort.c create mode 100644 Engine/source/.gitattributes diff --git a/Engine/lib/sdl/Android.mk b/Engine/lib/sdl/Android.mk old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/BUGS.txt b/Engine/lib/sdl/BUGS.txt index c5ed3af23..6a4cbb7ad 100644 --- a/Engine/lib/sdl/BUGS.txt +++ b/Engine/lib/sdl/BUGS.txt @@ -1,7 +1,7 @@ Bugs are now managed in the SDL bug tracker, here: - http://bugzilla.libsdl.org/ + https://bugzilla.libsdl.org/ You may report bugs there, and search to see if a given issue has already been reported, discussed, and maybe even fixed. diff --git a/Engine/lib/sdl/CMakeLists.txt b/Engine/lib/sdl/CMakeLists.txt index 63244a9e2..54a23f0c7 100644 --- a/Engine/lib/sdl/CMakeLists.txt +++ b/Engine/lib/sdl/CMakeLists.txt @@ -2,8 +2,19 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") endif() -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.5) project(SDL2 C) + +# !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property +# !!! FIXME: for the SDL2 shared library (so you get an +# !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib" +# !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm +# !!! FIXME: punting for now and leaving the existing behavior. Until this +# !!! FIXME: properly resolved, this line silences a warning in CMake 3.0+. +# !!! FIXME: remove it and this comment entirely once the problem is +# !!! FIXME: properly resolved. +#cmake_policy(SET CMP0042 OLD) + include(CheckFunctionExists) include(CheckLibraryExists) include(CheckIncludeFiles) @@ -15,6 +26,7 @@ include(CheckTypeSize) include(CheckStructHasMember) include(CMakeDependentOption) include(FindPkgConfig) +include(GNUInstallDirs) set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) @@ -29,9 +41,9 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 4) -set(SDL_INTERFACE_AGE 0) -set(SDL_BINARY_AGE 4) +set(SDL_MICRO_VERSION 5) +set(SDL_INTERFACE_AGE 1) +set(SDL_BINARY_AGE 5) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Calculate a libtool-like version number @@ -147,8 +159,10 @@ endif() # Default flags, if not set otherwise if("$ENV{CFLAGS}" STREQUAL "") - if(USE_GCC OR USE_CLANG) - set(CMAKE_C_FLAGS "-g -O3") + if(CMAKE_BUILD_TYPE STREQUAL "") + if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "-g -O3") + endif() endif() else() set(CMAKE_C_FLAGS "$ENV{CFLAGS}") @@ -183,8 +197,8 @@ endif() set(SDL_LIBS "-lSDL2") set(SDL_CFLAGS "") -# Emscripten toolchain has a nonempty default value for this, and the checks -# in this file need to change that, so remember the original value, and +# Emscripten toolchain has a nonempty default value for this, and the checks +# in this file need to change that, so remember the original value, and # restore back to that afterwards. For check_function_exists() to work in # Emscripten, this value must be at its default value. set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) @@ -192,7 +206,7 @@ set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) if(CYGWIN) # We build SDL on cygwin without the UNIX emulation layer include_directories("-I/usr/include/mingw") - set(CMAKE_REQUIRED_FLAGS "-mno-cygwin") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin") check_c_source_compiles("int main(int argc, char **argv) {}" HAVE_GCC_NO_CYGWIN) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) @@ -212,7 +226,7 @@ include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include) set(OPT_DEF_ASM TRUE) if(EMSCRIPTEN) # Set up default values for the currently supported set of subsystems: - # Emscripten/Javascript does not have assembly support, a dynamic library + # Emscripten/Javascript does not have assembly support, a dynamic library # loading architecture, low-level CPU inspection or multithreading. set(OPT_DEF_ASM FALSE) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) @@ -299,6 +313,8 @@ set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") +dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) + # General source files file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/*.c @@ -334,6 +350,24 @@ set(HAVE_ASSERTIONS ${ASSERTIONS}) # Compiler option evaluation if(USE_GCC OR USE_CLANG) + # Check for -Wall first, so later things can override pieces of it. + check_c_compiler_flag(-Wall HAVE_GCC_WALL) + if(HAVE_GCC_WALL) + list(APPEND EXTRA_CFLAGS "-Wall") + if(HAIKU) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") + endif() + endif() + + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() + list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") + endif() + if(DEPENDENCY_TRACKING) check_c_source_compiles(" #if !defined(__GNUC__) || __GNUC__ < 3 @@ -375,26 +409,16 @@ if(USE_GCC OR USE_CLANG) endif() set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - check_c_compiler_flag(-Wall HAVE_GCC_WALL) - if(HAVE_GCC_WALL) - list(APPEND EXTRA_CFLAGS "-Wall") - if(HAIKU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") - endif() - endif() check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW) if(HAVE_GCC_WSHADOW) list(APPEND EXTRA_CFLAGS "-Wshadow") endif() - # --no-undefined is unsupported with clang - if(NOT USE_CLANG) - set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") - check_c_compiler_flag("" HAVE_NO_UNDEFINED) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - if(HAVE_NO_UNDEFINED) - list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") - endif() + set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") + check_c_compiler_flag("" HAVE_NO_UNDEFINED) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_NO_UNDEFINED) + list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") endif() endif() @@ -773,6 +797,16 @@ if(EMSCRIPTEN) set(SOURCE_FILES ${SOURCE_FILES} ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() + if(SDL_TIMERS) + set(SDL_TIMER_UNIX 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + + if(CLOCK_GETTIME) + set(HAVE_CLOCK_GETTIME 1) + endif() + endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) @@ -839,7 +873,7 @@ elseif(UNIX AND NOT APPLE) #include #include - int main(int argc, char **argv) + int main(int argc, char **argv) { struct kbentry kbe; kbe.kb_table = KG_CTRL; @@ -866,8 +900,24 @@ elseif(UNIX AND NOT APPLE) check_include_file("libudev.h" HAVE_LIBUDEV_H) - # !!! FIXME: this needs pkg-config to find the include path, I think. - check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H) + if(PKG_CONFIG_FOUND) + pkg_search_module(DBUS dbus-1 dbus) + if(DBUS_FOUND) + set(HAVE_DBUS_DBUS_H TRUE) + include_directories(${DBUS_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBS ${DBUS_LIBRARIES}) + endif() + + pkg_search_module(IBUS ibus-1.0 ibus) + if(IBUS_FOUND) + set(HAVE_IBUS_IBUS_H TRUE) + include_directories(${IBUS_INCLUDE_DIRS}) + list(APPEND EXTRA_LIBS ${IBUS_LIBRARIES}) + endif() + endif() + + check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H) + endif() if(INPUT_TSLIB) @@ -936,7 +986,14 @@ elseif(UNIX AND NOT APPLE) if(RPATH) set(SDL_RLD_FLAGS "") if(BSDI OR FREEBSD OR LINUX OR NETBSD) - set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags") + check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_ENABLE_NEW_DTAGS) + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir} -Wl,--enable-new-dtags") + else() + set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}") + endif() elseif(SOLARIS) set(SDL_RLD_FLAGS "-R\${libdir}") endif() @@ -1108,7 +1165,7 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) - list(APPEND EXTRA_LIBS dinput8 dxguid) + list(APPEND EXTRA_LIBS dinput8) if(CMAKE_COMPILER_IS_MINGW) list(APPEND EXTRA_LIBS dxerr8) elseif (NOT USE_WINSDK_DIRECTX) @@ -1166,16 +1223,20 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c) + file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) - set(SDL_FRAMEWORK_AUDIOUNIT 1) + set(SDL_FRAMEWORK_AUDIOTOOLBOX 1) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_IOKIT 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) + if (IOS) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) + else() + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) set(SDL_FRAMEWORK_IOKIT 1) @@ -1184,7 +1245,12 @@ elseif(APPLE) if(SDL_HAPTIC) set(SDL_HAPTIC_IOKIT 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + if (IOS) + file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/dummy/*.c) + set(SDL_HAPTIC_DUMMY 1) + else() + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) set(SDL_FRAMEWORK_IOKIT 1) @@ -1196,7 +1262,11 @@ elseif(APPLE) if(SDL_POWER) set(SDL_POWER_MACOSX 1) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + if (IOS) + file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m) + else() + file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + endif() set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) set(SDL_FRAMEWORK_CARBON 1) @@ -1243,19 +1313,25 @@ elseif(APPLE) find_library(COREAUDIO CoreAudio) list(APPEND EXTRA_LIBS ${COREAUDIO}) endif() - if(SDL_FRAMEWORK_AUDIOUNIT) - find_library(AUDIOUNIT AudioUnit) - list(APPEND EXTRA_LIBS ${AUDIOUNIT}) + if(SDL_FRAMEWORK_AUDIOTOOLBOX) + find_library(AUDIOTOOLBOX AudioToolbox) + list(APPEND EXTRA_LIBS ${AUDIOTOOLBOX}) endif() # iOS hack needed - http://code.google.com/p/ios-cmake/ ? if(SDL_VIDEO) - CheckCOCOA() - if(VIDEO_OPENGL) - set(SDL_VIDEO_OPENGL 1) - set(SDL_VIDEO_OPENGL_CGL 1) - set(SDL_VIDEO_RENDER_OGL 1) - set(HAVE_VIDEO_OPENGL TRUE) + if (IOS) + set(SDL_VIDEO_DRIVER_UIKIT 1) + file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) + set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES}) + else() + CheckCOCOA() + if(VIDEO_OPENGL) + set(SDL_VIDEO_OPENGL 1) + set(SDL_VIDEO_OPENGL_CGL 1) + set(SDL_VIDEO_RENDER_OGL 1) + set(HAVE_VIDEO_OPENGL TRUE) + endif() endif() endif() @@ -1442,6 +1518,9 @@ message(STATUS " EXTRA_LIBS: ${EXTRA_LIBS}") message(STATUS "") message(STATUS " Build Shared Library: ${SDL_SHARED}") message(STATUS " Build Static Library: ${SDL_STATIC}") +if(SDL_STATIC) + message(STATUS " Build Static Library with Position Independent Code: ${SDL_STATIC_PIC}") +endif() message(STATUS "") if(UNIX) message(STATUS "If something was not detected, although the libraries") @@ -1458,7 +1537,7 @@ add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) set(_INSTALL_LIBS "SDL2main") if(SDL_SHARED) - add_library(SDL2 SHARED ${SOURCE_FILES}) + add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) if(UNIX) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} @@ -1484,6 +1563,7 @@ if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) if(MSVC) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") @@ -1510,12 +1590,17 @@ endforeach() list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES}) install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2) -if(NOT WINDOWS OR CYGWIN) +if(NOT (WINDOWS OR CYGWIN)) if(SDL_SHARED) + if (APPLE) + set(SOEXT "dylib") + else() + set(SOEXT "so") + endif() install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.so\" \"libSDL2.so\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") + \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig @@ -1526,7 +1611,7 @@ if(NOT WINDOWS OR CYGWIN) endif() install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin) # TODO: what about the .spec file? Is it only needed for RPM creation? - install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal") + install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal") endif() ##### Uninstall target ##### diff --git a/Engine/lib/sdl/Makefile.in b/Engine/lib/sdl/Makefile.in index b66e0f5e2..a7cbddf26 100644 --- a/Engine/lib/sdl/Makefile.in +++ b/Engine/lib/sdl/Makefile.in @@ -3,6 +3,7 @@ top_builddir = . srcdir = @srcdir@ objects = build +gen = gen prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ @@ -31,6 +32,8 @@ WINDRES = @WINDRES@ TARGET = libSDL2.la OBJECTS = @OBJECTS@ +GEN_HEADERS = @GEN_HEADERS@ +GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ SDLMAIN_TARGET = libSDL2main.a @@ -39,6 +42,8 @@ SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ SDLTEST_TARGET = libSDL2_test.a SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ +WAYLAND_SCANNER = @WAYLAND_SCANNER@ + SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS GEN_DIST = SDL2.spec @@ -48,6 +53,7 @@ RUN_CMD_CC = @echo " CC " $@; RUN_CMD_CXX = @echo " CXX " $@; RUN_CMD_LTLINK = @echo " LTLINK" $@; RUN_CMD_RANLIB = @echo " RANLIB" $@; +RUN_CMD_GEN = @echo " GEN " $@; LIBTOOL += --quiet endif @@ -137,8 +143,8 @@ update-revision: .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d) -$(objects)/$(TARGET): $(OBJECTS) $(VERSION_OBJECTS) - $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) +$(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS) + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) $(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS) @@ -200,6 +206,7 @@ uninstall-data: clean: rm -rf $(objects) + rm -rf $(gen) if test -f test/Makefile; then (cd test; $(MAKE) $@); fi distclean: clean diff --git a/Engine/lib/sdl/Makefile.pandora b/Engine/lib/sdl/Makefile.pandora index bb89d52a6..8b78f2734 100644 --- a/Engine/lib/sdl/Makefile.pandora +++ b/Engine/lib/sdl/Makefile.pandora @@ -19,7 +19,7 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c \ ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c \ ./src/joystick/linux/*.c ./src/haptic/linux/*.c ./src/timer/unix/*.c \ - ./src/atomic/linux/*.c ./src/filesystem/unix/*.c \ + ./src/atomic/*.c ./src/filesystem/unix/*.c \ ./src/video/pandora/SDL_pandora.o ./src/video/pandora/SDL_pandora_events.o ./src/video/x11/*.c diff --git a/Engine/lib/sdl/Makefile.psp b/Engine/lib/sdl/Makefile.psp index 5e7dcd29a..93fb9e447 100644 --- a/Engine/lib/sdl/Makefile.psp +++ b/Engine/lib/sdl/Makefile.psp @@ -49,6 +49,7 @@ OBJS= src/SDL.o \ src/stdlib/SDL_stdlib.o \ src/stdlib/SDL_string.o \ src/thread/SDL_thread.o \ + src/thread/generic/SDL_systls.o \ src/thread/psp/SDL_syssem.o \ src/thread/psp/SDL_systhread.o \ src/thread/psp/SDL_sysmutex.o \ diff --git a/Engine/lib/sdl/Makefile.wiz b/Engine/lib/sdl/Makefile.wiz index bb7705789..0981be853 100644 --- a/Engine/lib/sdl/Makefile.wiz +++ b/Engine/lib/sdl/Makefile.wiz @@ -9,8 +9,8 @@ STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip CFLAGS = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE -TARGET_STATIC = libSDL13.a -TARGET_SHARED = libSDL13.so +TARGET_STATIC = libSDL2.a +TARGET_SHARED = libSDL2.so SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c \ @@ -43,7 +43,7 @@ clean: install: mkdir -p $(WIZSDK)/lib - mkdir -p $(WIZSDK)/include/SDL13 + mkdir -p $(WIZSDK)/include/SDL2 cp -f $(TARGET_STATIC) $(WIZSDK)/lib cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED) @@ -57,5 +57,5 @@ install: ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED) cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0 - cp -f include/*.h $(WIZSDK)/include/SDL13/ - cp -f include/*.h ../../toolchain/include/SDL13/ + cp -f include/*.h $(WIZSDK)/include/SDL2/ + cp -f include/*.h ../../toolchain/include/SDL2/ diff --git a/Engine/lib/sdl/README-SDL.txt b/Engine/lib/sdl/README-SDL.txt index fade0b958..8eaf051f7 100644 --- a/Engine/lib/sdl/README-SDL.txt +++ b/Engine/lib/sdl/README-SDL.txt @@ -2,8 +2,8 @@ Please distribute this file with the SDL runtime environment: The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games and -emulators. +designed to make it easy to write multi-media software, such as games +and emulators. The Simple DirectMedia Layer library source code is available from: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/SDL2.spec b/Engine/lib/sdl/SDL2.spec index 0fe57540f..5dfda5802 100644 --- a/Engine/lib/sdl/SDL2.spec +++ b/Engine/lib/sdl/SDL2.spec @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.0.4 +Version: 2.0.5 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/VisualC.html b/Engine/lib/sdl/VisualC.html index 89035d677..0631832e8 100644 --- a/Engine/lib/sdl/VisualC.html +++ b/Engine/lib/sdl/VisualC.html @@ -21,7 +21,7 @@

There are different solution files for the various - versions of the IDE. Please use the appropiate version + versions of the IDE. Please use the appropriate version 2008, 2010, 2012 or 2013.

@@ -101,7 +101,7 @@ files to project")

Instead of adding the files to your project it is more - desireable to add them to the linker options: Project|Properties|Linker|Command + desirable to add them to the linker options: Project|Properties|Linker|Command Line and type the names of the libraries to link with in the "Additional Options:" box.  Note: This must be done for each build configuration (e.g. Release,Debug).

diff --git a/Engine/lib/sdl/VisualC/clean.sh b/Engine/lib/sdl/VisualC/clean.sh deleted file mode 100644 index fd16f9a12..000000000 --- a/Engine/lib/sdl/VisualC/clean.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -find . -type f \( -name '*.user' -o -name '*.sdf' -o -name '*.ncb' -o -name '*.suo' \) -print -delete -find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -delete -find . -depth -type d \( -name Win32 -o -name x64 \) -exec rm -rv {} \; diff --git a/Engine/lib/sdl/WhatsNew.txt b/Engine/lib/sdl/WhatsNew.txt index 9b7139f5d..1979ac2b3 100644 --- a/Engine/lib/sdl/WhatsNew.txt +++ b/Engine/lib/sdl/WhatsNew.txt @@ -1,6 +1,69 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.0.5: +--------------------------------------------------------------------------- + +General: +* Implemented audio capture support for some platforms +* Added SDL_DequeueAudio() to retrieve audio when buffer queuing is turned on for audio capture +* Added events for dragging and dropping text +* Added events for dragging and dropping multiple items +* By default the click raising a window will not be delivered to the SDL application. You can set the hint SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH to "1" to allow that click through to the window. +* Saving a surface with an alpha channel as a BMP will use a newer BMP format that supports alpha information. You can set the hint SDL_HINT_BMP_SAVE_LEGACY_FORMAT to "1" to use the old format. +* Added SDL_GetHintBoolean() to get the boolean value of a hint +* Added SDL_RenderSetIntegerScale() to set whether to smoothly scale or use integral multiples of the viewport size when scaling the rendering output +* Added SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() to create an SDL surface with a specific pixel format +* Added SDL_GetDisplayUsableBounds() which returns the area usable for windows. For example, on Mac OS X, this subtracts the area occupied by the menu bar and dock. +* Added SDL_GetWindowBordersSize() which returns the size of the window's borders around the client area +* Added a window event SDL_WINDOWEVENT_HIT_TEST when a window had a hit test that wasn't SDL_HITTEST_NORMAL (e.g. in the title bar or window frame) +* Added SDL_SetWindowResizable() to change whether a window is resizable +* Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity() to affect the window transparency +* Added SDL_SetWindowModalFor() to set a window as modal for another window +* Added support for AUDIO_U16LSB and AUDIO_U16MSB to SDL_MixAudioFormat() +* Fixed flipped images when reading back from target textures when using the OpenGL renderer +* Fixed texture color modulation with SDL_BLENDMODE_NONE when using the OpenGL renderer +* Fixed bug where the alpha value of colorkeys was ignored when blitting in some cases + +Windows: +* Added a hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING to prevent SDL from raising a debugger exception to name threads. This exception can cause problems with .NET applications when running under a debugger. +* The hint SDL_HINT_THREAD_STACK_SIZE is now supported on Windows +* Fixed XBox controller triggers automatically being pulled at startup +* The first icon from the executable is used as the default window icon at runtime +* Fixed SDL log messages being printed twice if SDL was built with C library support +* Reset dead keys when the SDL window loses focus, so dead keys pressed in SDL applications don't affect text input into other applications. + +Mac OS X: +* Fixed selecting the dummy video driver +* The caps lock key now generates a pressed event when pressed and a released event when released, instead of a press/release event pair when pressed. +* Fixed mouse wheel events on Mac OS X 10.12 +* The audio driver has been updated to use AVFoundation for better compatibility with newer versions of Mac OS X + +Linux: +* Added support for the Fcitx IME +* Added a window event SDL_WINDOWEVENT_TAKE_FOCUS when a window manager asks the SDL window whether it wants to take focus. +* Refresh rates are now rounded instead of truncated, e.g. 59.94 Hz is rounded up to 60 Hz instead of 59. +* Added initial support for touchscreens on Raspberry Pi + +OpenBSD: +* SDL_GetBasePath() is now implemented on OpenBSD + +iOS: +* Added support for dynamically loaded objects on iOS 8 and newer + +tvOS: +* Added support for Apple TV +* Added a hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION to control whether he Apple TV remote's joystick axes will automatically match the rotation of the remote. + +Android: +* Fixed SDL not resizing window when Android screen resolution changes +* Corrected the joystick Z axis reporting for the accelerometer + +Emscripten (running in a web browser): +* Many bug fixes and improvements + + --------------------------------------------------------------------------- 2.0.4: --------------------------------------------------------------------------- diff --git a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist b/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist index bccaa8afc..da4183466 100644 --- a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist +++ b/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist @@ -11,7 +11,7 @@ CFBundleIconFile CFBundleIdentifier - org.libsdl.SDL2 + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.0.4 + 2.0.5 CFBundleSignature SDLX CFBundleVersion - 2.0.4 + 2.0.5 diff --git a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 9fc2a5019..1f16953cf --- a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -7,15 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - 007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - 007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; @@ -57,14 +51,12 @@ 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; 04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; @@ -211,14 +203,12 @@ 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; 04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD024712E6671800899322 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; 04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; @@ -387,6 +377,10 @@ 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; + 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; + 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; + 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; + 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; }; 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; @@ -406,6 +400,12 @@ 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; + 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; + 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; + A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; + A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; @@ -563,7 +563,6 @@ DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB912E6671700899322 /* SDL_audiomem.h */; }; DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; @@ -698,7 +697,6 @@ DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDA012E6671700899322 /* SDL_coreaudio.c */; }; DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; @@ -802,10 +800,7 @@ DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */; }; - DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179C0858DECD00B2BC32 /* AudioUnit.framework */; }; DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179E0858DECD00B2BC32 /* CoreAudio.framework */; }; DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; @@ -813,6 +808,7 @@ FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; + FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -826,10 +822,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; - 0073179C0858DECD00B2BC32 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 0073179E0858DECD00B2BC32 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; @@ -857,14 +850,12 @@ 04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = ""; }; 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = ""; }; 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = ""; }; - 04BDFDA012E6671700899322 /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_coreaudio.c; sourceTree = ""; }; 04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = ""; }; 04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = ""; }; 04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = ""; }; 04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = ""; }; 04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = ""; }; 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = ""; }; - 04BDFDB912E6671700899322 /* SDL_audiomem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiomem.h; sourceTree = ""; }; 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = ""; }; 04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = ""; }; 04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = ""; }; @@ -1027,6 +1018,8 @@ 56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = ""; }; 56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = ""; }; 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = ""; }; + A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = ""; }; AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = ""; }; @@ -1106,6 +1099,7 @@ F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; + FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1113,11 +1107,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */, + A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */, FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, - 007317A20858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, - 007317A30858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317A50858DECD00B2BC32 /* CoreAudio.framework in Frameworks */, 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */, 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */, 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */, @@ -1129,14 +1122,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */, - 007317A90858DECD00B2BC32 /* AudioToolbox.framework in Frameworks */, - 007317AA0858DECD00B2BC32 /* AudioUnit.framework in Frameworks */, 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317AC0858DECD00B2BC32 /* CoreAudio.framework in Frameworks */, 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */, + 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */, 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */, DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */, + 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1144,14 +1137,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */, - DB31406C17554B71006C0E22 /* AudioToolbox.framework in Frameworks */, - DB31406D17554B71006C0E22 /* AudioUnit.framework in Frameworks */, DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */, - DB31406F17554B71006C0E22 /* CoreAudio.framework in Frameworks */, DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */, + 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */, DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */, DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */, + 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1307,7 +1300,6 @@ 04BDFDB612E6671700899322 /* SDL_audiocvt.c */, 04BDFDB712E6671700899322 /* SDL_audiodev.c */, 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */, - 04BDFDB912E6671700899322 /* SDL_audiomem.h */, 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */, 04BDFDBB12E6671700899322 /* SDL_mixer.c */, 04BDFDC212E6671700899322 /* SDL_sysaudio.h */, @@ -1339,8 +1331,8 @@ 04BDFD9F12E6671700899322 /* coreaudio */ = { isa = PBXGroup; children = ( - 04BDFDA012E6671700899322 /* SDL_coreaudio.c */, 04BDFDA112E6671700899322 /* SDL_coreaudio.h */, + FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */, ); path = coreaudio; sourceTree = ""; @@ -1737,13 +1729,12 @@ BEC562FE0761C0E800A33029 /* Linked Frameworks */ = { isa = PBXGroup; children = ( + A7381E931D8B69C300B177DD /* AudioToolbox.framework */, + A7381E951D8B69D600B177DD /* CoreAudio.framework */, FA73671C19A540EF004122E4 /* CoreVideo.framework */, 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, 007317C10858E15000B2BC32 /* Carbon.framework */, - 0073179B0858DECD00B2BC32 /* AudioToolbox.framework */, - 0073179C0858DECD00B2BC32 /* AudioUnit.framework */, 0073179D0858DECD00B2BC32 /* Cocoa.framework */, - 0073179E0858DECD00B2BC32 /* CoreAudio.framework */, 0073179F0858DECD00B2BC32 /* IOKit.framework */, 00CFA89C106B4BA100758660 /* ForceFeedback.framework */, ); @@ -1840,7 +1831,6 @@ 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */, 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */, 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */, - 04BD002B12E6671800899322 /* SDL_audiomem.h in Headers */, 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */, 04BD003612E6671800899322 /* SDL_wave.h in Headers */, 04BD004212E6671800899322 /* blank_cursor.h in Headers */, @@ -1996,7 +1986,6 @@ 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */, 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */, AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - 04BD024712E6671800899322 /* SDL_audiomem.h in Headers */, 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */, 04BD025212E6671800899322 /* SDL_wave.h in Headers */, 04BD025D12E6671800899322 /* blank_cursor.h in Headers */, @@ -2151,7 +2140,6 @@ DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */, DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */, AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - DB313F7917554B71006C0E22 /* SDL_audiomem.h in Headers */, DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */, DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */, DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */, @@ -2323,7 +2311,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0630; + LastUpgradeCheck = 0730; TargetAttributes = { BECDF5FE0761BA81005FE872 = { DevelopmentTeam = EH385AYQ6F; @@ -2404,7 +2392,6 @@ 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */, 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */, 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD001812E6671800899322 /* SDL_coreaudio.c in Sources */, 04BD002612E6671800899322 /* SDL_audio.c in Sources */, 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */, 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */, @@ -2440,6 +2427,7 @@ 04BD00A812E6671800899322 /* SDL_string.c in Sources */, 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */, 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */, + FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */, 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */, 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */, 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */, @@ -2523,7 +2511,6 @@ 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */, 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */, 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD023412E6671800899322 /* SDL_coreaudio.c in Sources */, 04BD024212E6671800899322 /* SDL_audio.c in Sources */, 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */, 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */, @@ -2559,6 +2546,7 @@ 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */, 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */, 04BD02C212E6671800899322 /* SDL_string.c in Sources */, + 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */, 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */, 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */, @@ -2642,7 +2630,6 @@ DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */, DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */, DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */, - DB31400217554B71006C0E22 /* SDL_coreaudio.c in Sources */, DB31400317554B71006C0E22 /* SDL_audio.c in Sources */, DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */, DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */, @@ -2678,6 +2665,7 @@ DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */, DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */, DB31402617554B71006C0E22 /* SDL_string.c in Sources */, + 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */, DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */, DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */, @@ -2767,14 +2755,31 @@ 00CFA621106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEPLOYMENT_POSTPROCESSING = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; GCC_AUTO_VECTORIZATION = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 3; GCC_SYMBOLS_PRIVATE_EXTERN = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; SDKROOT = macosx; STRIP_STYLE = "non-global"; }; @@ -2783,15 +2788,17 @@ 00CFA622106A567900758660 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.0.0; + DYLIB_CURRENT_VERSION = 5.1.0; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; INSTALL_PATH = "@rpath"; OTHER_LDFLAGS = "-liconv"; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = framework; @@ -2827,12 +2834,30 @@ 00CFA627106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_ALTIVEC_EXTENSIONS = YES; GCC_AUTO_VECTORIZATION = YES; GCC_ENABLE_SSE3_EXTENSIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; @@ -2842,15 +2867,17 @@ 00CFA628106A568900758660 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; CLANG_LINK_OBJC_RUNTIME = NO; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.0.0; + DYLIB_CURRENT_VERSION = 5.1.0; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = /usr/X11R6/include; INFOPLIST_FILE = "Info-Framework.plist"; INSTALL_PATH = "@rpath"; OTHER_LDFLAGS = "-liconv"; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_NAME = SDL2; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = framework; diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info b/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index 59cdd631b..144d24ca5 --- a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -3934,7 +3934,7 @@ ); GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Debug; }; @@ -4060,7 +4060,7 @@ ); GCC_GENERATE_DEBUGGING_SYMBOLS = NO; HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; }; name = Release; }; diff --git a/Engine/lib/sdl/autogen.sh b/Engine/lib/sdl/autogen.sh old mode 100644 new mode 100755 index 649d7b31e..3e958e195 --- a/Engine/lib/sdl/autogen.sh +++ b/Engine/lib/sdl/autogen.sh @@ -3,6 +3,10 @@ echo "Generating build information using autoconf" echo "This may take a while ..." +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. +pushd $srcdir + # Regenerate configuration files cat acinclude/* >aclocal.m4 found=false @@ -15,5 +19,7 @@ if test x$found = xfalse; then fi (cd test; sh autogen.sh) +popd + # Run configure for this platform echo "Now you are ready to run ./configure" diff --git a/Engine/lib/sdl/build-scripts/androidbuild.sh b/Engine/lib/sdl/build-scripts/androidbuild.sh old mode 100644 new mode 100755 index 8ca3c916d..fb48e2e5b --- a/Engine/lib/sdl/build-scripts/androidbuild.sh +++ b/Engine/lib/sdl/build-scripts/androidbuild.sh @@ -87,8 +87,8 @@ else fi cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL -sed -i "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk -sed -i "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml +sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk +sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml # Copy user sources for src in "${SOURCES[@]}" @@ -105,8 +105,8 @@ do done ACTIVITY="${folder}Activity" -sed -i "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml -sed -i "s|SDLActivity|$APP|g" $BUILDPATH/build.xml +sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml +sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml # Fill in a default Activity echo "package $APP;" > "$ACTIVITY.java" diff --git a/Engine/lib/sdl/build-scripts/checker-buildbot.sh b/Engine/lib/sdl/build-scripts/checker-buildbot.sh old mode 100644 new mode 100755 index 682e7fbbb..eb014311a --- a/Engine/lib/sdl/build-scripts/checker-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/checker-buildbot.sh @@ -61,13 +61,13 @@ mkdir checker-buildbot cd checker-buildbot # You might want to do this for CMake-backed builds instead... -PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug .. +PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled .. # ...or run configure without the scan-build wrapper... -#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure +#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure --enable-assertions=enabled # ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X). -#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure +#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure --enable-assertions=enabled rm -rf analysis PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE diff --git a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh old mode 100644 new mode 100755 index db5fb8184..42eebb697 --- a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh @@ -51,13 +51,14 @@ mkdir buildbot pushd buildbot echo "Configuring..." -emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" +emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? echo "Building..." -emmake $MAKE +emmake $MAKE || exit $? echo "Moving things around..." -emmake $MAKE install +emmake $MAKE install || exit $? + # Fix up a few things to a real install path perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config mkdir -p ./usr diff --git a/Engine/lib/sdl/build-scripts/g++-fat.sh b/Engine/lib/sdl/build-scripts/g++-fat.sh old mode 100644 new mode 100755 index 29b04302f..0dbe99039 --- a/Engine/lib/sdl/build-scripts/g++-fat.sh +++ b/Engine/lib/sdl/build-scripts/g++-fat.sh @@ -6,11 +6,11 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 32-bit compiler flags (10.5 runtime compatibility) -GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \ +# Intel 32-bit compiler flags (10.6 runtime compatibility) +GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \ -I/usr/local/include" -GCC_LINK_X86="-mmacosx-version-min=10.5" +GCC_LINK_X86="-mmacosx-version-min=10.6" # Intel 64-bit compiler flags (10.6 runtime compatibility) GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \ diff --git a/Engine/lib/sdl/build-scripts/gcc-fat.sh b/Engine/lib/sdl/build-scripts/gcc-fat.sh old mode 100644 new mode 100755 index e556c1dd1..65f759d4a --- a/Engine/lib/sdl/build-scripts/gcc-fat.sh +++ b/Engine/lib/sdl/build-scripts/gcc-fat.sh @@ -6,15 +6,15 @@ DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" -# Intel 32-bit compiler flags (10.5 runtime compatibility) -GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \ +# Intel 32-bit compiler flags (10.6 runtime compatibility) +GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \ -I/usr/local/include" -GCC_LINK_X86="-mmacosx-version-min=10.5" +GCC_LINK_X86="-mmacosx-version-min=10.6" # Intel 64-bit compiler flags (10.6 runtime compatibility) GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \ --DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \ +-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \ -I/usr/local/include" GCC_LINK_X64="-mmacosx-version-min=10.6" diff --git a/Engine/lib/sdl/build-scripts/install-sh b/Engine/lib/sdl/build-scripts/install-sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/iosbuild.sh b/Engine/lib/sdl/build-scripts/iosbuild.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/ltmain.sh b/Engine/lib/sdl/build-scripts/ltmain.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/mkinstalldirs b/Engine/lib/sdl/build-scripts/mkinstalldirs old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/nacl-buildbot.sh b/Engine/lib/sdl/build-scripts/nacl-buildbot.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/naclbuild.sh b/Engine/lib/sdl/build-scripts/naclbuild.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/raspberrypi-buildbot.sh b/Engine/lib/sdl/build-scripts/raspberrypi-buildbot.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/showrev.sh b/Engine/lib/sdl/build-scripts/showrev.sh old mode 100644 new mode 100755 index 2a68fe694..517992d9c --- a/Engine/lib/sdl/build-scripts/showrev.sh +++ b/Engine/lib/sdl/build-scripts/showrev.sh @@ -2,6 +2,4 @@ # # Print the current source revision, if available -# FIXME: this prints the tip, which isn't useful if you're on a different -# branch, or just not sync'd to the tip. -hg tip --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1) +hg parents --template 'hg-{rev}:{node|short}' || (echo "hg-0:baadf00d"; exit 1) diff --git a/Engine/lib/sdl/build-scripts/strip_fPIC.sh b/Engine/lib/sdl/build-scripts/strip_fPIC.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/update-copyright.sh b/Engine/lib/sdl/build-scripts/update-copyright.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/build-scripts/updaterev.sh b/Engine/lib/sdl/build-scripts/updaterev.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/cmake/sdlchecks.cmake b/Engine/lib/sdl/cmake/sdlchecks.cmake index 7ff0985fd..b10078192 100644 --- a/Engine/lib/sdl/cmake/sdlchecks.cmake +++ b/Engine/lib/sdl/cmake/sdlchecks.cmake @@ -105,7 +105,9 @@ macro(CheckALSA) if(ALSA) CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H) if(HAVE_ASOUNDLIB_H) - CHECK_LIBRARY_EXISTS(asound snd_pcm_open "" HAVE_LIBASOUND) + CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND) + endif() + if(HAVE_LIBASOUND) set(HAVE_ALSA TRUE) file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES}) @@ -537,6 +539,27 @@ macro(CheckMir) endif() endmacro() +macro(WaylandProtocolGen _SCANNER _XML _PROTL) + set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c") + set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h") + + add_custom_command( + OUTPUT "${_WAYLAND_PROT_H_CODE}" + DEPENDS "${_XML}" + COMMAND "${_SCANNER}" + ARGS client-header "${_XML}" "${_WAYLAND_PROT_H_CODE}" + ) + + add_custom_command( + OUTPUT "${_WAYLAND_PROT_C_CODE}" + DEPENDS "${_WAYLAND_PROT_H_CODE}" + COMMAND "${_SCANNER}" + ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}" + ) + + set(SOURCE_FILES ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c") +endmacro() + # Requires: # - EGL # - PkgCheckModules @@ -545,7 +568,51 @@ endmacro() # - HAVE_DLOPEN opt macro(CheckWayland) if(VIDEO_WAYLAND) - pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon) + pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon) + + # We have to generate some protocol interface code for some various Wayland features. + if(WAYLAND_FOUND) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-client + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + RESULT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR_RC + OUTPUT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT WAYLAND_CORE_PROTOCOL_DIR_RC EQUAL 0) + set(WAYLAND_FOUND FALSE) + endif() + endif() + + if(WAYLAND_FOUND) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + RESULT_VARIABLE WAYLAND_PROTOCOLS_DIR_RC + OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT WAYLAND_PROTOCOLS_DIR_RC EQUAL 0) + set(WAYLAND_FOUND FALSE) + endif() + endif() + + if(WAYLAND_FOUND) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + RESULT_VARIABLE WAYLAND_SCANNER_RC + OUTPUT_VARIABLE WAYLAND_SCANNER + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT WAYLAND_SCANNER_RC EQUAL 0) + set(WAYLAND_FOUND FALSE) + endif() + endif() + if(WAYLAND_FOUND) link_directories( ${WAYLAND_LIBRARY_DIRS} @@ -559,6 +626,17 @@ macro(CheckWayland) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES}) + # We have to generate some protocol interface code for some unstable Wayland features. + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") + include_directories("${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") + + WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_CORE_PROTOCOL_DIR}/wayland.xml" "wayland") + + foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1) + string(REGEX REPLACE "\\-unstable\\-.*$" "" PROTSUBDIR ${_PROTL}) + WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_PROTOCOLS_DIR}/unstable/${PROTSUBDIR}/${_PROTL}.xml" "${_PROTL}") + endforeach() + if(VIDEO_WAYLAND_QT_TOUCH) set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1) endif() @@ -679,7 +757,6 @@ macro(CheckOpenGLX11) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL_GLX 1) set(SDL_VIDEO_RENDER_OGL 1) - list(APPEND EXTRA_LIBS GL) endif() endif() endmacro() @@ -767,7 +844,8 @@ macro(CheckPTHREAD) endif() # Run some tests - set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}") if(CMAKE_CROSSCOMPILING) set(HAVE_PTHREADS 1) else() @@ -829,7 +907,7 @@ macro(CheckPTHREAD) int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H) check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP) check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP) - set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c @@ -883,7 +961,8 @@ macro(CheckUSBHID) endif() endif() - set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${USB_CFLAGS}") set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}") check_c_source_compiles(" #include @@ -984,7 +1063,7 @@ macro(CheckUSBHID) set(HAVE_SDL_JOYSTICK TRUE) set(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") endif() endmacro() @@ -998,12 +1077,13 @@ macro(CheckRPI) listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") - set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") + set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}") check_c_source_compiles(" #include int main(int argc, char **argv) {}" HAVE_VIDEO_RPI) - set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_LIBRARIES) if(SDL_VIDEO AND HAVE_VIDEO_RPI) diff --git a/Engine/lib/sdl/configure b/Engine/lib/sdl/configure old mode 100644 new mode 100755 index a41f02595..5070f6e6a --- a/Engine/lib/sdl/configure +++ b/Engine/lib/sdl/configure @@ -630,6 +630,7 @@ ac_includes_default="\ #endif" ac_subst_vars='LTLIBOBJS +WAYLAND_SCANNER EXTRA_LDFLAGS BUILD_LDFLAGS EXTRA_CFLAGS @@ -637,6 +638,8 @@ BUILD_CFLAGS SDLTEST_OBJECTS SDLMAIN_OBJECTS VERSION_OBJECTS +GEN_OBJECTS +GEN_HEADERS OBJECTS INCLUDE ac_aux_dir @@ -846,7 +849,9 @@ enable_video_opengles1 enable_video_opengles2 enable_libudev enable_dbus +enable_ime enable_ibus +enable_fcitx enable_input_tslib enable_pthreads enable_pthread_sem @@ -1584,7 +1589,9 @@ Optional Features: include OpenGL ES 2.0 support [[default=yes]] --enable-libudev enable libudev support [[default=yes]] --enable-dbus enable D-Bus support [[default=yes]] + --enable-ime enable IME support [[default=yes]] --enable-ibus enable IBus support [[default=yes]] + --enable-fcitx enable fcitx support [[default=yes]] --enable-input-tslib use the Touchscreen library for input [[default=yes]] --enable-pthreads use POSIX threads for multi-threading @@ -2683,9 +2690,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=4 -SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=4 +SDL_MICRO_VERSION=5 +SDL_INTERFACE_AGE=1 +SDL_BINARY_AGE=5 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -17601,7 +17608,7 @@ LIBS="$ALSA_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 $as_echo "$ALSA_LIBS" >&6; } -min_alsa_version=0.9.0 +min_alsa_version=1.0.11 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 $as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; } no_alsa="" @@ -18650,6 +18657,43 @@ $as_echo "$have_gcc_preferred_stack_boundary" >&6; } fi } +CheckDeclarationAfterStatement() +{ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 +$as_echo_n "checking for GCC -Wdeclaration-after-statement option... " >&6; } + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int x = 0; + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_declaration_after_statement=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_declaration_after_statement" >&5 +$as_echo "$have_gcc_declaration_after_statement" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + CheckWarnAll() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -Wall option" >&5 @@ -18767,9 +18811,12 @@ $as_echo_n "checking for Wayland support... " >&6; } if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` + WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client` + WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols` video_wayland=yes fi fi @@ -18785,8 +18832,11 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND 1" >>confdefs.h $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi + + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" # Check whether --enable-wayland-shared was given. if test "${enable_wayland_shared+set}" = set; then : enableval=$enable_wayland_shared; @@ -18928,7 +18978,7 @@ int main () { - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirTouchAction actions = mir_touch_actions ; return 0; @@ -21604,6 +21654,23 @@ $as_echo "#define HAVE_DBUS_DBUS_H 1" >>confdefs.h fi } +CheckIME() +{ + # Check whether --enable-ime was given. +if test "${enable_ime+set}" = set; then : + enableval=$enable_ime; +else + enable_ime=yes +fi + + if test x$enable_ime = xyes; then + +$as_echo "#define SDL_USE_IME 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" + fi +} + CheckIBus() { # Check whether --enable-ibus was given. @@ -21677,7 +21744,11 @@ fi CFLAGS="$save_CFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_dbus != xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for IBus." >&5 +$as_echo "$as_me: WARNING: IME support is required for IBus." >&2;} + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for IBus." >&5 $as_echo "$as_me: WARNING: DBus support is required for IBus." >&2;} have_ibus_ibus_h_hdr=no @@ -21697,6 +21768,90 @@ $as_echo "#define HAVE_IBUS_IBUS_H 1" >>confdefs.h fi } +CheckFcitx() +{ + # Check whether --enable-fcitx was given. +if test "${enable_fcitx+set}" = set; then : + enableval=$enable_fcitx; +else + enable_fcitx=yes +fi + + if test x$enable_fcitx = xyes; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno; then + FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` + CFLAGS="$CFLAGS $FCITX_CFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "fcitx/frontend.h" "ac_cv_header_fcitx_frontend_h" "$ac_includes_default" +if test "x$ac_cv_header_fcitx_frontend_h" = xyes; then : + have_fcitx_frontend_h_hdr=yes +else + have_fcitx_frontend_h_hdr=no +fi + + + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IME support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: IME support is required for fcitx." >&2;} + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: DBus support is required for fcitx." >&5 +$as_echo "$as_me: WARNING: DBus support is required for fcitx." >&2;} + have_fcitx_frontend_h_hdr=no + else + +$as_echo "#define HAVE_FCITX_FRONTEND_H 1" >>confdefs.h + + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" + fi + fi + fi + fi +} + CheckTslib() { # Check whether --enable-input-tslib was given. @@ -22894,6 +23049,8 @@ fi } +CheckWarnAll + case "$host" in *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) case "$host" in @@ -22962,6 +23119,7 @@ case "$host" in *-*-minix*) ARCH=minix ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -22982,7 +23140,9 @@ case "$host" in CheckWayland CheckLibUDev CheckDBus + CheckIME CheckIBus + CheckFcitx case $ARCH in linux) CheckInputEvents @@ -23392,6 +23552,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23402,7 +23563,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h # Set up files for the audio library if test x$enable_audio = xyes; then - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi @@ -23461,6 +23622,7 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23476,7 +23638,8 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi @@ -23494,8 +23657,8 @@ $as_echo "#define SDL_JOYSTICK_IOKIT 1" >>confdefs.h $as_echo "#define SDL_HAPTIC_IOKIT 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" - have_haptic=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + have_haptic=yes fi # Set up files for the power library if test x$enable_power = xyes; then @@ -23532,10 +23695,6 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" - # If audio is used, add the AudioUnit framework - if test x$enable_audio = xyes; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" - fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -23581,6 +23740,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -23630,8 +23790,6 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ;; esac -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then @@ -23687,6 +23845,57 @@ if test x$SDLMAIN_SOURCES = x; then fi SDLTEST_SOURCES="$srcdir/src/test/*.c" +if test x$video_wayland = xyes; then + WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c' + WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h' + WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[^ ]\+,\\$(gen)/&-protocol.c,g'` + WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[^ ]\+,\\$(gen)/&-client-protocol.h,g'` + GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES" + GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS" + + WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@" + + WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@" + + WAYLAND_CORE_PROTOCOL_OBJECT=" +\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE + \$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@" + + WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([a-z\\-]\\+\\)-unstable-\\(v[0-9]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done` + + WAYLAND_PROTOCOLS_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS +$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS +$WAYLAND_CORE_PROTOCOL_OBJECT +$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE +" +fi + OBJECTS=`echo $SOURCES` DEPENDS=`echo $SOURCES | tr ' ' '\n'` for EXT in asm cc m c S; do @@ -23696,6 +23905,8 @@ for EXT in asm cc m c S; do \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` done +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` + VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.rc,$(objects)/\1.o,g'` @@ -23722,6 +23933,36 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\ if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker option --enable-new-dtags" >&5 +$as_echo_n "checking for linker option --enable-new-dtags... " >&6; } + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_enable_new_dtags" >&5 +$as_echo "$have_enable_new_dtags" >&6; } fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -23767,6 +24008,9 @@ fi + + + cat >Makefile.rules <<__EOF__ # Build rules for objects @@ -23778,6 +24022,7 @@ $DEPENDS $VERSION_DEPENDS $SDLMAIN_DEPENDS $SDLTEST_DEPENDS +$WAYLAND_PROTOCOLS_DEPENDS __EOF__ ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc" @@ -23810,11 +24055,21 @@ if test x$have_dbus_dbus_h_hdr = xyes; then else SUMMARY="${SUMMARY}Using dbus : NO\n" fi +if test x$enable_ime = xyes; then + SUMMARY="${SUMMARY}Using ime : YES\n" +else + SUMMARY="${SUMMARY}Using ime : NO\n" +fi if test x$have_ibus_ibus_h_hdr = xyes; then SUMMARY="${SUMMARY}Using ibus : YES\n" else SUMMARY="${SUMMARY}Using ibus : NO\n" fi +if test x$have_fcitx_frontend_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using fcitx : YES\n" +else + SUMMARY="${SUMMARY}Using fcitx : NO\n" +fi ac_config_commands="$ac_config_commands summary" diff --git a/Engine/lib/sdl/configure.in b/Engine/lib/sdl/configure.in index f585d01af..37c57e288 100644 --- a/Engine/lib/sdl/configure.in +++ b/Engine/lib/sdl/configure.in @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=4 -SDL_INTERFACE_AGE=0 -SDL_BINARY_AGE=4 +SDL_MICRO_VERSION=5 +SDL_INTERFACE_AGE=1 +SDL_BINARY_AGE=5 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -770,7 +770,7 @@ CheckALSA() AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]), , enable_alsa=yes) if test x$enable_audio = xyes -a x$enable_alsa = xyes; then - AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no) + AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no) # Restore all flags from before the ALSA detection runs CFLAGS="$alsa_save_CFLAGS" LDFLAGS="$alsa_save_LDFLAGS" @@ -1124,6 +1124,30 @@ CheckStackBoundary() fi } +dnl See if GCC's -Wdeclaration-after-statement is supported. +dnl This lets us catch things that would fail on a C89 compiler when using +dnl a modern GCC. +CheckDeclarationAfterStatement() +{ + AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option) + have_gcc_declaration_after_statement=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + AC_TRY_COMPILE([ + int x = 0; + ],[ + ],[ + have_gcc_declaration_after_statement=yes + ]) + AC_MSG_RESULT($have_gcc_declaration_after_statement) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_declaration_after_statement = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement" + fi +} + dnl See if GCC's -Wall is supported. CheckWarnAll() { @@ -1177,9 +1201,12 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then + if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon` WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon` + WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner` + WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client` + WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols` video_wayland=yes fi fi @@ -1190,8 +1217,11 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for if test x$enable_video_wayland_qt_touch = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) fi + + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" AC_ARG_ENABLE(wayland-shared, AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]), , enable_wayland_shared=maybe) @@ -1260,12 +1290,12 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon` save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $MIR_CFLAGS" - - dnl This will disable Mir on Ubuntu < 14.04 + + dnl This will disable Mir if >= v0.25 is not available AC_TRY_COMPILE([ #include ],[ - MirMotionToolType tool = mir_motion_tool_type_mouse; + MirTouchAction actions = mir_touch_actions ],[ video_mir=yes ]) @@ -2230,6 +2260,18 @@ AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]), fi } +dnl See if the platform wanna IME support. +CheckIME() +{ + AC_ARG_ENABLE(ime, +AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]), + , enable_ime=yes) + if test x$enable_ime = xyes; then + AC_DEFINE(SDL_USE_IME, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c" + fi +} + dnl See if the platform has libibus IME support. CheckIBus() { @@ -2250,7 +2292,10 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), have_inotify_inotify_h_hdr=no) CFLAGS="$save_CFLAGS" if test x$have_ibus_ibus_h_hdr = xyes; then - if test x$enable_dbus != xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for IBus.]) + have_ibus_ibus_h_hdr=no + elif test x$enable_dbus != xyes; then AC_MSG_WARN([DBus support is required for IBus.]) have_ibus_ibus_h_hdr=no elif test x$have_inotify_inotify_h_hdr != xyes; then @@ -2266,6 +2311,38 @@ AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]), fi } +dnl See if the platform has fcitx IME support. +CheckFcitx() +{ + AC_ARG_ENABLE(fcitx, +AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]), + , enable_fcitx=yes) + if test x$enable_fcitx = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno; then + FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx` + CFLAGS="$CFLAGS $FCITX_CFLAGS" + AC_CHECK_HEADER(fcitx/frontend.h, + have_fcitx_frontend_h_hdr=yes, + have_fcitx_frontend_h_hdr=no) + CFLAGS="$save_CFLAGS" + if test x$have_fcitx_frontend_h_hdr = xyes; then + if test x$enable_ime != xyes; then + AC_MSG_WARN([IME support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + elif test x$enable_dbus != xyes; then + AC_MSG_WARN([DBus support is required for fcitx.]) + have_fcitx_frontend_h_hdr=no + else + AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ]) + EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c" + fi + fi + fi + fi +} + dnl See if we can use the Touchscreen input library CheckTslib() { @@ -2801,6 +2878,9 @@ AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]] , enable_rpath=yes) } +dnl Do this on all platforms, before everything else (other things might want to override it). +CheckWarnAll + dnl Set up the configuration based on the host platform! case "$host" in *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) @@ -2870,6 +2950,7 @@ case "$host" in *-*-minix*) ARCH=minix ;; esac CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -2890,7 +2971,9 @@ case "$host" in CheckWayland CheckLibUDev CheckDBus + CheckIME CheckIBus + CheckFcitx case $ARCH in linux) CheckInputEvents @@ -3196,6 +3279,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ARCH=ios CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3206,7 +3290,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the audio library if test x$enable_audio = xyes; then - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi @@ -3265,6 +3349,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3278,7 +3363,8 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the audio library if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c" + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi @@ -3292,8 +3378,8 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_haptic = xyes; then AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ]) SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c" - have_haptic=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback" + have_haptic=yes fi # Set up files for the power library if test x$enable_power = xyes; then @@ -3324,10 +3410,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" - # If audio is used, add the AudioUnit framework - if test x$enable_audio = xyes; then - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit" - fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -3366,6 +3448,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi CheckVisibilityHidden + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio @@ -3407,9 +3490,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ;; esac -dnl Do this on all platforms, after everything else. -CheckWarnAll - # Verify that we have all the platform specific files we need if test x$have_joystick != xyes; then @@ -3453,6 +3533,57 @@ if test x$SDLMAIN_SOURCES = x; then fi SDLTEST_SOURCES="$srcdir/src/test/*.c" +if test x$video_wayland = xyes; then + WAYLAND_CORE_PROTOCOL_SOURCE='$(gen)/wayland-protocol.c' + WAYLAND_CORE_PROTOCOL_HEADER='$(gen)/wayland-client-protocol.h' + WAYLAND_PROTOCOLS_UNSTABLE_SOURCES=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[[^ ]]\+,\\$(gen)/&-protocol.c,g'` + WAYLAND_PROTOCOLS_UNSTABLE_HEADERS=`echo $WAYLAND_PROTOCOLS_UNSTABLE |\ + sed 's,[[^ ]]\+,\\$(gen)/&-client-protocol.h,g'` + GEN_SOURCES="$GEN_SOURCES $WAYLAND_CORE_PROTOCOL_SOURCE $WAYLAND_PROTOCOLS_UNSTABLE_SOURCES" + GEN_HEADERS="$GEN_HEADERS $WAYLAND_CORE_PROTOCOL_HEADER $WAYLAND_PROTOCOLS_UNSTABLE_HEADERS" + + WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) code \$< \$@" + + WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_HEADER: $WAYLAND_CORE_PROTOCOL_DIR/wayland.xml + \$(SHELL) \$(auxdir)/mkinstalldirs \$(gen) + \$(RUN_CMD_GEN)\$(WAYLAND_SCANNER) client-header \$< \$@" + + WAYLAND_CORE_PROTOCOL_OBJECT=" +\$(objects)/`echo $WAYLAND_CORE_PROTOCOL_SOURCE | sed 's/\$(gen)\/\(.*\).c$/\1.lo/'`: $WAYLAND_CORE_PROTOCOL_SOURCE + \$(RUN_CMD_CC)\$(LIBTOOL) --tag=CC --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \$< -o \$@" + + WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-client-protocol.h: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\$(gen)/&-protocol.c: $WAYLAND_PROTOCOLS_DIR/unstable/\1/&.xml\\\\ + \\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)\\\\ + \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@," ; done` + + WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE=`for p in $WAYLAND_PROTOCOLS_UNSTABLE;\ + do echo ; echo \$p | sed\ + "s,^\\([[a-z\\-]]\\+\\)-unstable-\\(v[[0-9]]\+\\)\$,\\\$(objects)/&-protocol.lo: \\$(gen)/&-protocol.c \\$(gen)/&-client-protocol.h\\\\ + \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@," ; done` + + WAYLAND_PROTOCOLS_DEPENDS=" +$WAYLAND_CORE_PROTOCOL_SOURCE_DEPENDS +$WAYLAND_CORE_PROTOCOL_HEADER_DEPENDS +$WAYLAND_CORE_PROTOCOL_OBJECT +$WAYLAND_PROTOCOLS_CLIENT_HEADER_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_CODE_UNSTABLE_DEPENDS +$WAYLAND_PROTOCOLS_OBJECTS_UNSTABLE +" +fi + OBJECTS=`echo $SOURCES` DEPENDS=`echo $SOURCES | tr ' ' '\n'` for EXT in asm cc m c S; do @@ -3462,6 +3593,8 @@ for EXT in asm cc m c S; do \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` done +GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` + VERSION_OBJECTS=`echo $VERSION_SOURCES` VERSION_DEPENDS=`echo $VERSION_SOURCES` VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` @@ -3488,6 +3621,19 @@ SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. if test "x$enable_rpath" = "xyes"; then if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}" + + AC_MSG_CHECKING(for linker option --enable-new-dtags) + have_enable_new_dtags=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" + AC_TRY_LINK([ + ],[ + ],[ + have_enable_new_dtags=yes + SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags" + ]) + LDFLAGS="$save_LDFLAGS" + AC_MSG_RESULT($have_enable_new_dtags) fi if test $ARCH = solaris; then SDL_RLD_FLAGS="-R\${libdir}" @@ -3526,6 +3672,8 @@ dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir) AC_SUBST(INCLUDE) AC_SUBST(OBJECTS) +AC_SUBST(GEN_HEADERS) +AC_SUBST(GEN_OBJECTS) AC_SUBST(VERSION_OBJECTS) AC_SUBST(SDLMAIN_OBJECTS) AC_SUBST(SDLTEST_OBJECTS) @@ -3534,6 +3682,7 @@ AC_SUBST(EXTRA_CFLAGS) AC_SUBST(BUILD_LDFLAGS) AC_SUBST(EXTRA_LDFLAGS) AC_SUBST(WINDRES) +AC_SUBST(WAYLAND_SCANNER) cat >Makefile.rules <<__EOF__ @@ -3546,6 +3695,7 @@ $DEPENDS $VERSION_DEPENDS $SDLMAIN_DEPENDS $SDLTEST_DEPENDS +$WAYLAND_PROTOCOLS_DEPENDS __EOF__ AC_CONFIG_FILES([ @@ -3578,11 +3728,21 @@ if test x$have_dbus_dbus_h_hdr = xyes; then else SUMMARY="${SUMMARY}Using dbus : NO\n" fi +if test x$enable_ime = xyes; then + SUMMARY="${SUMMARY}Using ime : YES\n" +else + SUMMARY="${SUMMARY}Using ime : NO\n" +fi if test x$have_ibus_ibus_h_hdr = xyes; then SUMMARY="${SUMMARY}Using ibus : YES\n" else SUMMARY="${SUMMARY}Using ibus : NO\n" fi +if test x$have_fcitx_frontend_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using fcitx : YES\n" +else + SUMMARY="${SUMMARY}Using fcitx : NO\n" +fi AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"]) AC_OUTPUT diff --git a/Engine/lib/sdl/debian/changelog b/Engine/lib/sdl/debian/changelog index 84d1b878b..6a88d2473 100644 --- a/Engine/lib/sdl/debian/changelog +++ b/Engine/lib/sdl/debian/changelog @@ -1,3 +1,9 @@ +libsdl2 (2.0.4) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.4 + + -- Sam Lantinga Thu, 07 Jan 2016 11:02:39 -0800 + libsdl2 (2.0.3) UNRELEASED; urgency=low * Updated SDL to version 2.0.3 diff --git a/Engine/lib/sdl/debian/copyright b/Engine/lib/sdl/debian/copyright index 8ce26d1c5..99c3d4496 100644 --- a/Engine/lib/sdl/debian/copyright +++ b/Engine/lib/sdl/debian/copyright @@ -31,10 +31,6 @@ Copyright: 1995 Erik Corry 1995 Brown University License: BrownUn_UnCalifornia_ErikCorry -Files: src/stdlib/SDL_qsort.c -Copyright: 1998 Gareth McCaughan -License: Gareth_McCaughan - Files: src/test/SDL_test_md5.c Copyright: 1997-2016 Sam Lantinga 1990 RSA Data Security, Inc. @@ -270,13 +266,6 @@ License: BrownUn_UnCalifornia_ErikCorry * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -License: Gareth_McCaughan - You may use it in anything you like; you may make money - out of it; you may distribute it in object form or as - part of an executable without including source code; - you don't have to credit me. (But it would be nice if - you did.) - License: Johnson_M._Hart Permission is granted for any and all use providing that this copyright is properly acknowledged. diff --git a/Engine/lib/sdl/debian/libsdl2-dev.install b/Engine/lib/sdl/debian/libsdl2-dev.install index 7f99ff427..af2c5b19d 100644 --- a/Engine/lib/sdl/debian/libsdl2-dev.install +++ b/Engine/lib/sdl/debian/libsdl2-dev.install @@ -5,4 +5,5 @@ usr/lib/*/libSDL2.a usr/lib/*/libSDL2main.a usr/lib/*/libSDL2_test.a usr/lib/*/pkgconfig/sdl2.pc +usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/share/aclocal/sdl2.m4 diff --git a/Engine/lib/sdl/debian/rules b/Engine/lib/sdl/debian/rules old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/sdl2-config.cmake.in b/Engine/lib/sdl/sdl2-config.cmake.in index e5a036adf..03efbe174 100644 --- a/Engine/lib/sdl/sdl2-config.cmake.in +++ b/Engine/lib/sdl/sdl2-config.cmake.in @@ -8,3 +8,4 @@ set(SDL2_EXEC_PREFIX "@prefix@") set(SDL2_LIBDIR "@libdir@") set(SDL2_INCLUDE_DIRS "@includedir@/SDL2") set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") +string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) diff --git a/Engine/lib/sdl/sdl2.m4 b/Engine/lib/sdl/sdl2.m4 index a03b2d270..b915f99ed 100644 --- a/Engine/lib/sdl/sdl2.m4 +++ b/Engine/lib/sdl/sdl2.m4 @@ -4,6 +4,9 @@ # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor +# +# Changelog: +# * also look for SDL2.framework under Mac OS X # serial 1 @@ -20,6 +23,10 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], + , search_sdl_framework=yes) + +AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) min_sdl_version=ifelse([$1], ,2.0.0,$1) @@ -53,14 +60,36 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run fi AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) PATH="$as_save_PATH" - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" - if test "$SDL2_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL2.framework) + if test "x$SDL2_FRAMEWORK" != x; then + sdl_framework=$SDL2_FRAMEWORK + else + for d in / ~/ /System/; do + if test -d "$dLibrary/Frameworks/SDL2.framework"; then + sdl_framework="$dLibrary/Frameworks/SDL2.framework" + fi + done + fi + + if test -d $sdl_framework; then + AC_MSG_RESULT($sdl_framework) + sdl_framework_dir=`dirname $sdl_framework` + SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" + SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + else + no_sdl=yes + fi + fi + + if test "$SDL2_CONFIG" != "no"; then + if test "x$sdl_pc" = "xno"; then + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + fi sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` @@ -141,12 +170,15 @@ int main (int argc, char *argv[]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" + + fi + if test "x$sdl_pc" = "xno"; then + if test "x$no_sdl" = "xyes"; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + fi fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) fi fi if test "x$no_sdl" = x ; then diff --git a/Engine/lib/sdl/src/audio/SDL_audiomem.h b/Engine/lib/sdl/src/audio/SDL_audiomem.h deleted file mode 100644 index 091d15c29..000000000 --- a/Engine/lib/sdl/src/audio/SDL_audiomem.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#define SDL_AllocAudioMem SDL_malloc -#define SDL_FreeAudioMem SDL_free -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c deleted file mode 100644 index 46b617dc0..000000000 --- a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.c +++ /dev/null @@ -1,698 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_COREAUDIO - -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_coreaudio.h" -#include "SDL_assert.h" - -#define DEBUG_COREAUDIO 0 - -static void COREAUDIO_CloseDevice(_THIS); - -#define CHECK_RESULT(msg) \ - if (result != noErr) { \ - COREAUDIO_CloseDevice(this); \ - SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \ - return 0; \ - } - -#if MACOSX_COREAUDIO -static const AudioObjectPropertyAddress devlist_address = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster -}; - -typedef void (*addDevFn)(const char *name, const int iscapture, AudioDeviceID devId, void *data); - -typedef struct AudioDeviceList -{ - AudioDeviceID devid; - SDL_bool alive; - struct AudioDeviceList *next; -} AudioDeviceList; - -static AudioDeviceList *output_devs = NULL; -static AudioDeviceList *capture_devs = NULL; - -static SDL_bool -add_to_internal_dev_list(const int iscapture, AudioDeviceID devId) -{ - AudioDeviceList *item = (AudioDeviceList *) SDL_malloc(sizeof (AudioDeviceList)); - if (item == NULL) { - return SDL_FALSE; - } - item->devid = devId; - item->alive = SDL_TRUE; - item->next = iscapture ? capture_devs : output_devs; - if (iscapture) { - capture_devs = item; - } else { - output_devs = item; - } - - return SDL_TRUE; -} - -static void -addToDevList(const char *name, const int iscapture, AudioDeviceID devId, void *data) -{ - if (add_to_internal_dev_list(iscapture, devId)) { - SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); - } -} - -static void -build_device_list(int iscapture, addDevFn addfn, void *addfndata) -{ - OSStatus result = noErr; - UInt32 size = 0; - AudioDeviceID *devs = NULL; - UInt32 i = 0; - UInt32 max = 0; - - result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, - &devlist_address, 0, NULL, &size); - if (result != kAudioHardwareNoError) - return; - - devs = (AudioDeviceID *) alloca(size); - if (devs == NULL) - return; - - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, - &devlist_address, 0, NULL, &size, devs); - if (result != kAudioHardwareNoError) - return; - - max = size / sizeof (AudioDeviceID); - for (i = 0; i < max; i++) { - CFStringRef cfstr = NULL; - char *ptr = NULL; - AudioDeviceID dev = devs[i]; - AudioBufferList *buflist = NULL; - int usable = 0; - CFIndex len = 0; - const AudioObjectPropertyAddress addr = { - kAudioDevicePropertyStreamConfiguration, - iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; - - const AudioObjectPropertyAddress nameaddr = { - kAudioObjectPropertyName, - iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; - - result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); - if (result != noErr) - continue; - - buflist = (AudioBufferList *) SDL_malloc(size); - if (buflist == NULL) - continue; - - result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, - &size, buflist); - - if (result == noErr) { - UInt32 j; - for (j = 0; j < buflist->mNumberBuffers; j++) { - if (buflist->mBuffers[j].mNumberChannels > 0) { - usable = 1; - break; - } - } - } - - SDL_free(buflist); - - if (!usable) - continue; - - - size = sizeof (CFStringRef); - result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); - if (result != kAudioHardwareNoError) - continue; - - len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), - kCFStringEncodingUTF8); - - ptr = (char *) SDL_malloc(len + 1); - usable = ((ptr != NULL) && - (CFStringGetCString - (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); - - CFRelease(cfstr); - - if (usable) { - len = strlen(ptr); - /* Some devices have whitespace at the end...trim it. */ - while ((len > 0) && (ptr[len - 1] == ' ')) { - len--; - } - usable = (len > 0); - } - - if (usable) { - ptr[len] = '\0'; - -#if DEBUG_COREAUDIO - printf("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", - ((iscapture) ? "capture" : "output"), - (int) *devCount, ptr, (int) dev); -#endif - addfn(ptr, iscapture, dev, addfndata); - } - SDL_free(ptr); /* addfn() would have copied the string. */ - } -} - -static void -free_audio_device_list(AudioDeviceList **list) -{ - AudioDeviceList *item = *list; - while (item) { - AudioDeviceList *next = item->next; - SDL_free(item); - item = next; - } - *list = NULL; -} - -static void -COREAUDIO_DetectDevices(void) -{ - build_device_list(SDL_TRUE, addToDevList, NULL); - build_device_list(SDL_FALSE, addToDevList, NULL); -} - -static void -build_device_change_list(const char *name, const int iscapture, AudioDeviceID devId, void *data) -{ - AudioDeviceList **list = (AudioDeviceList **) data; - AudioDeviceList *item; - for (item = *list; item != NULL; item = item->next) { - if (item->devid == devId) { - item->alive = SDL_TRUE; - return; - } - } - - add_to_internal_dev_list(iscapture, devId); /* new device, add it. */ - SDL_AddAudioDevice(iscapture, name, (void *) ((size_t) devId)); -} - -static void -reprocess_device_list(const int iscapture, AudioDeviceList **list) -{ - AudioDeviceList *item; - AudioDeviceList *prev = NULL; - for (item = *list; item != NULL; item = item->next) { - item->alive = SDL_FALSE; - } - - build_device_list(iscapture, build_device_change_list, list); - - /* free items in the list that aren't still alive. */ - item = *list; - while (item != NULL) { - AudioDeviceList *next = item->next; - if (item->alive) { - prev = item; - } else { - SDL_RemoveAudioDevice(iscapture, (void *) ((size_t) item->devid)); - if (prev) { - prev->next = item->next; - } else { - *list = item->next; - } - SDL_free(item); - } - item = next; - } -} - -/* this is called when the system's list of available audio devices changes. */ -static OSStatus -device_list_changed(AudioObjectID systemObj, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) -{ - reprocess_device_list(SDL_TRUE, &capture_devs); - reprocess_device_list(SDL_FALSE, &output_devs); - return 0; -} -#endif - -/* The CoreAudio callback */ -static OSStatus -outputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) inRefCon; - AudioBuffer *abuf; - UInt32 remaining, len; - void *ptr; - UInt32 i; - - /* Only do anything if audio is enabled and not paused */ - if (!this->enabled || this->paused) { - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - SDL_memset(abuf->mData, this->spec.silence, abuf->mDataByteSize); - } - return 0; - } - - /* No SDL conversion should be needed here, ever, since we accept - any input format in OpenAudio, and leave the conversion to CoreAudio. - */ - /* - SDL_assert(!this->convert.needed); - SDL_assert(this->spec.channels == ioData->mNumberChannels); - */ - - for (i = 0; i < ioData->mNumberBuffers; i++) { - abuf = &ioData->mBuffers[i]; - remaining = abuf->mDataByteSize; - ptr = abuf->mData; - while (remaining > 0) { - if (this->hidden->bufferOffset >= this->hidden->bufferSize) { - /* Generate the data */ - SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, - this->hidden->buffer, this->hidden->bufferSize); - SDL_UnlockMutex(this->mixer_lock); - this->hidden->bufferOffset = 0; - } - - len = this->hidden->bufferSize - this->hidden->bufferOffset; - if (len > remaining) - len = remaining; - SDL_memcpy(ptr, (char *)this->hidden->buffer + - this->hidden->bufferOffset, len); - ptr = (char *)ptr + len; - remaining -= len; - this->hidden->bufferOffset += len; - } - } - - return 0; -} - -static OSStatus -inputCallback(void *inRefCon, - AudioUnitRenderActionFlags * ioActionFlags, - const AudioTimeStamp * inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, - AudioBufferList * ioData) -{ - /* err = AudioUnitRender(afr->fAudioUnit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, afr->fAudioBuffer); */ - /* !!! FIXME: write me! */ - return noErr; -} - - -#if MACOSX_COREAUDIO -static const AudioObjectPropertyAddress alive_address = -{ - kAudioDevicePropertyDeviceIsAlive, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster -}; - -static OSStatus -device_unplugged(AudioObjectID devid, UInt32 num_addr, const AudioObjectPropertyAddress *addrs, void *data) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_bool dead = SDL_FALSE; - UInt32 isAlive = 1; - UInt32 size = sizeof (isAlive); - OSStatus error; - - if (!this->enabled) { - return 0; /* already known to be dead. */ - } - - error = AudioObjectGetPropertyData(this->hidden->deviceID, &alive_address, - 0, NULL, &size, &isAlive); - - if (error == kAudioHardwareBadDeviceError) { - dead = SDL_TRUE; /* device was unplugged. */ - } else if ((error == kAudioHardwareNoError) && (!isAlive)) { - dead = SDL_TRUE; /* device died in some other way. */ - } - - if (dead) { - SDL_OpenedAudioDeviceDisconnected(this); - } - - return 0; -} -#endif - -static void -COREAUDIO_CloseDevice(_THIS) -{ - if (this->hidden != NULL) { - if (this->hidden->audioUnitOpened) { - #if MACOSX_COREAUDIO - /* Unregister our disconnect callback. */ - AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); - #endif - - AURenderCallbackStruct callback; - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const int iscapture = this->iscapture; - const AudioUnitElement bus = - ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = - ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - - /* stop processing the audio unit */ - AudioOutputUnitStop(this->hidden->audioUnit); - - /* Remove the input callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - - #if MACOSX_COREAUDIO - CloseComponent(this->hidden->audioUnit); - #else - AudioComponentInstanceDispose(this->hidden->audioUnit); - #endif - - this->hidden->audioUnitOpened = 0; - } - SDL_free(this->hidden->buffer); - SDL_free(this->hidden); - this->hidden = NULL; - } -} - -#if MACOSX_COREAUDIO -static int -prepare_device(_THIS, void *handle, int iscapture) -{ - AudioDeviceID devid = (AudioDeviceID) ((size_t) handle); - OSStatus result = noErr; - UInt32 size = 0; - UInt32 alive = 0; - pid_t pid = 0; - - AudioObjectPropertyAddress addr = { - 0, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; - - if (handle == NULL) { - size = sizeof (AudioDeviceID); - addr.mSelector = - ((iscapture) ? kAudioHardwarePropertyDefaultInputDevice : - kAudioHardwarePropertyDefaultOutputDevice); - result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, &devid); - CHECK_RESULT("AudioHardwareGetProperty (default device)"); - } - - addr.mSelector = kAudioDevicePropertyDeviceIsAlive; - addr.mScope = iscapture ? kAudioDevicePropertyScopeInput : - kAudioDevicePropertyScopeOutput; - - size = sizeof (alive); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); - CHECK_RESULT - ("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)"); - - if (!alive) { - SDL_SetError("CoreAudio: requested device exists, but isn't alive."); - return 0; - } - - addr.mSelector = kAudioDevicePropertyHogMode; - size = sizeof (pid); - result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); - - /* some devices don't support this property, so errors are fine here. */ - if ((result == noErr) && (pid != -1)) { - SDL_SetError("CoreAudio: requested device is being hogged."); - return 0; - } - - this->hidden->deviceID = devid; - return 1; -} -#endif - -static int -prepare_audiounit(_THIS, void *handle, int iscapture, - const AudioStreamBasicDescription * strdesc) -{ - OSStatus result = noErr; - AURenderCallbackStruct callback; -#if MACOSX_COREAUDIO - ComponentDescription desc; - Component comp = NULL; -#else - AudioComponentDescription desc; - AudioComponent comp = NULL; -#endif - const AudioUnitElement output_bus = 0; - const AudioUnitElement input_bus = 1; - const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus); - const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output : - kAudioUnitScope_Input); - -#if MACOSX_COREAUDIO - if (!prepare_device(this, handle, iscapture)) { - return 0; - } -#endif - - SDL_zero(desc); - desc.componentType = kAudioUnitType_Output; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - -#if MACOSX_COREAUDIO - desc.componentSubType = kAudioUnitSubType_DefaultOutput; - comp = FindNextComponent(NULL, &desc); -#else - desc.componentSubType = kAudioUnitSubType_RemoteIO; - comp = AudioComponentFindNext(NULL, &desc); -#endif - - if (comp == NULL) { - SDL_SetError("Couldn't find requested CoreAudio component"); - return 0; - } - - /* Open & initialize the audio unit */ -#if MACOSX_COREAUDIO - result = OpenAComponent(comp, &this->hidden->audioUnit); - CHECK_RESULT("OpenAComponent"); -#else - /* - AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6 - We can't use OpenAComponent on iPhone because it is not present - */ - result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit); - CHECK_RESULT("AudioComponentInstanceNew"); -#endif - - this->hidden->audioUnitOpened = 1; - -#if MACOSX_COREAUDIO - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioOutputUnitProperty_CurrentDevice, - kAudioUnitScope_Global, 0, - &this->hidden->deviceID, - sizeof(AudioDeviceID)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)"); -#endif - - /* Set the data format of the audio unit. */ - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_StreamFormat, - scope, bus, strdesc, sizeof(*strdesc)); - CHECK_RESULT("AudioUnitSetProperty (kAudioUnitProperty_StreamFormat)"); - - /* Set the audio callback */ - SDL_memset(&callback, 0, sizeof(AURenderCallbackStruct)); - callback.inputProc = ((iscapture) ? inputCallback : outputCallback); - callback.inputProcRefCon = this; - result = AudioUnitSetProperty(this->hidden->audioUnit, - kAudioUnitProperty_SetRenderCallback, - scope, bus, &callback, sizeof(callback)); - CHECK_RESULT - ("AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)"); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate a sample buffer */ - this->hidden->bufferOffset = this->hidden->bufferSize = this->spec.size; - this->hidden->buffer = SDL_malloc(this->hidden->bufferSize); - - result = AudioUnitInitialize(this->hidden->audioUnit); - CHECK_RESULT("AudioUnitInitialize"); - - /* Finally, start processing of the audio unit */ - result = AudioOutputUnitStart(this->hidden->audioUnit); - CHECK_RESULT("AudioOutputUnitStart"); - -#if MACOSX_COREAUDIO - /* Fire a callback if the device stops being "alive" (disconnected, etc). */ - AudioObjectAddPropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); -#endif - - /* We're running! */ - return 1; -} - - -static int -COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - AudioStreamBasicDescription strdesc; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - int valid_datatype = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - - /* Setup a AudioStreamBasicDescription with the requested format */ - SDL_memset(&strdesc, '\0', sizeof(AudioStreamBasicDescription)); - strdesc.mFormatID = kAudioFormatLinearPCM; - strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked; - strdesc.mChannelsPerFrame = this->spec.channels; - strdesc.mSampleRate = this->spec.freq; - strdesc.mFramesPerPacket = 1; - - while ((!valid_datatype) && (test_format)) { - this->spec.format = test_format; - /* Just a list of valid SDL formats, so people don't pass junk here. */ - switch (test_format) { - case AUDIO_U8: - case AUDIO_S8: - case AUDIO_U16LSB: - case AUDIO_S16LSB: - case AUDIO_U16MSB: - case AUDIO_S16MSB: - case AUDIO_S32LSB: - case AUDIO_S32MSB: - case AUDIO_F32LSB: - case AUDIO_F32MSB: - valid_datatype = 1; - strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format); - if (SDL_AUDIO_ISBIGENDIAN(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; - - if (SDL_AUDIO_ISFLOAT(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (SDL_AUDIO_ISSIGNED(this->spec.format)) - strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; - break; - } - } - - if (!valid_datatype) { /* shouldn't happen, but just in case... */ - COREAUDIO_CloseDevice(this); - return SDL_SetError("Unsupported audio format"); - } - - strdesc.mBytesPerFrame = - strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8; - strdesc.mBytesPerPacket = - strdesc.mBytesPerFrame * strdesc.mFramesPerPacket; - - if (!prepare_audiounit(this, handle, iscapture, &strdesc)) { - COREAUDIO_CloseDevice(this); - return -1; /* prepare_audiounit() will call SDL_SetError()... */ - } - - return 0; /* good to go. */ -} - -static void -COREAUDIO_Deinitialize(void) -{ -#if MACOSX_COREAUDIO - AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); - free_audio_device_list(&capture_devs); - free_audio_device_list(&output_devs); -#endif -} - -static int -COREAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - /* Set the function pointers */ - impl->OpenDevice = COREAUDIO_OpenDevice; - impl->CloseDevice = COREAUDIO_CloseDevice; - impl->Deinitialize = COREAUDIO_Deinitialize; - -#if MACOSX_COREAUDIO - impl->DetectDevices = COREAUDIO_DetectDevices; - AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); -#else - impl->OnlyHasDefaultOutputDevice = 1; - - /* Set category to ambient sound so that other music continues playing. - You can change this at runtime in your own code if you need different - behavior. If this is common, we can add an SDL hint for this. - */ - AudioSessionInitialize(NULL, NULL, NULL, nil); - UInt32 category = kAudioSessionCategory_AmbientSound; - AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(UInt32), &category); -#endif - - impl->ProvidesOwnCallbackThread = 1; - - return 1; /* this audio target is available. */ -} - -AudioBootStrap COREAUDIO_bootstrap = { - "coreaudio", "CoreAudio", COREAUDIO_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_COREAUDIO */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl b/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/src/dynapi/gendynapi.pl b/Engine/lib/sdl/src/dynapi/gendynapi.pl old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h index 4c29087d3..1e623cbb8 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h @@ -40,8 +40,8 @@ static const char *s_ControllerMappings [] = "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", diff --git a/Engine/lib/sdl/src/joystick/sort_controllers.py b/Engine/lib/sdl/src/joystick/sort_controllers.py old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h index 76605cc69..9672d462c 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h @@ -194,7 +194,7 @@ public: _current_context->UnlockGL(); _current_context = newContext; if (_current_context) - _current_context->LockGL(); + _current_context->LockGL(); } private: /* Event management */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h index 4a4aaa584..a353e1aca 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h @@ -532,7 +532,7 @@ private: msg.AddInt32("key-state", keyState); msg.AddInt32("key-scancode", keyCode); if (keyUtf8 != NULL) { - msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); + msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); } be_app->PostMessage(&msg); } diff --git a/Engine/lib/sdl/src/video/sdlgenblit.pl b/Engine/lib/sdl/src/video/sdlgenblit.pl old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h index c797f94e3..7290412b7 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h @@ -45,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char * SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return) -SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) +SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return) SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return) @@ -199,7 +199,7 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),) SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return) SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return) SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) -SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) +SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) #endif diff --git a/Engine/lib/sdl/test/Makefile.in b/Engine/lib/sdl/test/Makefile.in index 9a1df774e..68f0d3dab 100644 --- a/Engine/lib/sdl/test/Makefile.in +++ b/Engine/lib/sdl/test/Makefile.in @@ -13,7 +13,10 @@ TARGETS = \ loopwavequeue$(EXE) \ testatomic$(EXE) \ testaudioinfo$(EXE) \ + testaudiocapture$(EXE) \ testautomation$(EXE) \ + testbounds$(EXE) \ + testcustomcursor$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ @@ -61,6 +64,7 @@ TARGETS = \ testrendercopyex$(EXE) \ testmessage$(EXE) \ testdisplayinfo$(EXE) \ + testqsort$(EXE) \ controllermap$(EXE) \ all: Makefile $(TARGETS) @@ -110,6 +114,9 @@ testmultiaudio$(EXE): $(srcdir)/testmultiaudio.c testaudiohotplug$(EXE): $(srcdir)/testaudiohotplug.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testaudiocapture$(EXE): $(srcdir)/testaudiocapture.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + testatomic$(EXE): $(srcdir)/testatomic.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -270,6 +277,15 @@ testmessage$(EXE): $(srcdir)/testmessage.c testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testqsort$(EXE): $(srcdir)/testqsort.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +testbounds$(EXE): $(srcdir)/testbounds.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) diff --git a/Engine/lib/sdl/test/autogen.sh b/Engine/lib/sdl/test/autogen.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/test/configure b/Engine/lib/sdl/test/configure old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/test/controllermap.c b/Engine/lib/sdl/test/controllermap.c index 3fb30d68a..d626f9f89 100644 --- a/Engine/lib/sdl/test/controllermap.c +++ b/Engine/lib/sdl/test/controllermap.c @@ -26,12 +26,9 @@ #define SCREEN_HEIGHT 480 #else #define SCREEN_WIDTH 512 -#define SCREEN_HEIGHT 317 +#define SCREEN_HEIGHT 320 #endif -#define MAP_WIDTH 512 -#define MAP_HEIGHT 317 - #define MARKER_BUTTON 1 #define MARKER_AXIS 2 @@ -47,7 +44,7 @@ typedef struct MappingStep SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) { SDL_Surface *temp; SDL_Texture *texture; @@ -226,7 +223,7 @@ WatchJoystick(SDL_Joystick * joystick) SDL_RenderCopy(screen, background, NULL, NULL); SDL_SetTextureAlphaMod(marker, alpha); SDL_SetTextureColorMod(marker, 10, 255, 21); - SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, 0); + SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, SDL_FLIP_NONE); SDL_RenderPresent(screen); if (SDL_PollEvent(&event)) { diff --git a/Engine/lib/sdl/test/gcc-fat.sh b/Engine/lib/sdl/test/gcc-fat.sh old mode 100644 new mode 100755 diff --git a/Engine/lib/sdl/test/testatomic.c b/Engine/lib/sdl/test/testatomic.c index 41cc9ab1b..d371ef31f 100644 --- a/Engine/lib/sdl/test/testatomic.c +++ b/Engine/lib/sdl/test/testatomic.c @@ -284,7 +284,7 @@ typedef struct char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)]; #endif - volatile SDL_bool active; + SDL_atomic_t active; /* Only needed for the mutex test */ SDL_mutex *mutex; @@ -305,7 +305,7 @@ static void InitEventQueue(SDL_EventQueue *queue) SDL_AtomicSet(&queue->rwcount, 0); SDL_AtomicSet(&queue->watcher, 0); #endif - queue->active = SDL_TRUE; + SDL_AtomicSet(&queue->active, 1); } static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event) @@ -538,7 +538,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_LockFree(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -551,7 +551,7 @@ static int FIFO_Reader(void* _data) if (DequeueEvent_Mutex(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; - } else if (queue->active) { + } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { @@ -571,7 +571,7 @@ static int FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; - while (queue->active) { + while (SDL_AtomicGet(&queue->active)) { SDL_AtomicLock(&queue->lock); SDL_AtomicIncRef(&queue->watcher); while (SDL_AtomicGet(&queue->rwcount) > 0) { @@ -652,7 +652,7 @@ static void RunFIFOTest(SDL_bool lock_free) } /* Shut down the queue so readers exit */ - queue.active = SDL_FALSE; + SDL_AtomicSet(&queue.active, 0); /* Wait for the readers */ while (SDL_AtomicGet(&readersRunning) > 0) { diff --git a/Engine/lib/sdl/test/testaudiocapture.c b/Engine/lib/sdl/test/testaudiocapture.c new file mode 100644 index 000000000..26321a71c --- /dev/null +++ b/Engine/lib/sdl/test/testaudiocapture.c @@ -0,0 +1,165 @@ +/* + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include "SDL.h" + +#include + +#ifdef __EMSCRIPTEN__ +#include +#endif + +static SDL_Window *window = NULL; +static SDL_Renderer *renderer = NULL; +static SDL_AudioSpec spec; +static SDL_AudioDeviceID devid_in = 0; +static SDL_AudioDeviceID devid_out = 0; + +static void +loop() +{ + SDL_bool please_quit = SDL_FALSE; + SDL_Event e; + + while (SDL_PollEvent(&e)) { + if (e.type == SDL_QUIT) { + please_quit = SDL_TRUE; + } else if (e.type == SDL_KEYDOWN) { + if (e.key.keysym.sym == SDLK_ESCAPE) { + please_quit = SDL_TRUE; + } + } else if (e.type == SDL_MOUSEBUTTONDOWN) { + if (e.button.button == 1) { + SDL_PauseAudioDevice(devid_out, SDL_TRUE); + SDL_PauseAudioDevice(devid_in, SDL_FALSE); + } + } else if (e.type == SDL_MOUSEBUTTONUP) { + if (e.button.button == 1) { + SDL_PauseAudioDevice(devid_in, SDL_TRUE); + SDL_PauseAudioDevice(devid_out, SDL_FALSE); + } + } + } + + if (SDL_GetAudioDeviceStatus(devid_in) == SDL_AUDIO_PLAYING) { + SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); + } else { + SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); + } + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + if (please_quit) { + /* stop playing back, quit. */ + SDL_Log("Shutting down.\n"); + SDL_PauseAudioDevice(devid_in, 1); + SDL_CloseAudioDevice(devid_in); + SDL_PauseAudioDevice(devid_out, 1); + SDL_CloseAudioDevice(devid_out); + SDL_DestroyRenderer(renderer); + SDL_DestroyWindow(window); + SDL_Quit(); + #ifdef __EMSCRIPTEN__ + emscripten_cancel_main_loop(); + #endif + exit(0); + } + + /* Note that it would be easier to just have a one-line function that + calls SDL_QueueAudio() as a capture device callback, but we're + trying to test the API, so we use SDL_DequeueAudio() here. */ + while (SDL_TRUE) { + Uint8 buf[1024]; + const Uint32 br = SDL_DequeueAudio(devid_in, buf, sizeof (buf)); + SDL_QueueAudio(devid_out, buf, br); + if (br < sizeof (buf)) { + break; + } + } +} + +int +main(int argc, char **argv) +{ + /* (argv[1] == NULL means "open default device.") */ + const char *devname = argv[1]; + SDL_AudioSpec wanted; + int devcount; + int i; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Load the SDL library */ + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); + return (1); + } + + window = SDL_CreateWindow("testaudiocapture", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 320, 240, 0); + renderer = SDL_CreateRenderer(window, -1, 0); + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); + + devcount = SDL_GetNumAudioDevices(SDL_TRUE); + for (i = 0; i < devcount; i++) { + SDL_Log(" Capture device #%d: '%s'\n", i, SDL_GetAudioDeviceName(i, SDL_TRUE)); + } + + SDL_zero(wanted); + wanted.freq = 44100; + wanted.format = AUDIO_F32SYS; + wanted.channels = 1; + wanted.samples = 4096; + wanted.callback = NULL; + + SDL_zero(spec); + + /* DirectSound can fail in some instances if you open the same hardware + for both capture and output and didn't open the output end first, + according to the docs, so if you're doing something like this, always + open your capture devices second in case you land in those bizarre + circumstances. */ + + SDL_Log("Opening default playback device...\n"); + devid_out = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wanted, &spec, SDL_AUDIO_ALLOW_ANY_CHANGE); + if (!devid_out) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for playback: %s!\n", SDL_GetError()); + SDL_Quit(); + exit(1); + } + + SDL_Log("Opening capture device %s%s%s...\n", + devname ? "'" : "", + devname ? devname : "[[default]]", + devname ? "'" : ""); + + devid_in = SDL_OpenAudioDevice(argv[1], SDL_TRUE, &spec, &spec, 0); + if (!devid_in) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open an audio device for capture: %s!\n", SDL_GetError()); + SDL_Quit(); + exit(1); + } + + SDL_Log("Ready! Hold down mouse or finger to record!\n"); + +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(loop, 0, 1); +#else + while (1) { loop(); SDL_Delay(16); } +#endif + + return 0; +} + diff --git a/Engine/lib/sdl/test/testaudiohotplug.c b/Engine/lib/sdl/test/testaudiohotplug.c index e13868ec2..73d480505 100644 --- a/Engine/lib/sdl/test/testaudiohotplug.c +++ b/Engine/lib/sdl/test/testaudiohotplug.c @@ -74,6 +74,12 @@ poked(int sig) done = 1; } +static const char* +devtypestr(int iscapture) +{ + return iscapture ? "capture" : "output"; +} + static void iteration() { @@ -82,10 +88,21 @@ iteration() while (SDL_PollEvent(&e)) { if (e.type == SDL_QUIT) { done = 1; + } else if (e.type == SDL_KEYUP) { + if (e.key.keysym.sym == SDLK_ESCAPE) + done = 1; } else if (e.type == SDL_AUDIODEVICEADDED) { - const char *name = SDL_GetAudioDeviceName(e.adevice.which, 0); - SDL_Log("New %s audio device: %s\n", e.adevice.iscapture ? "capture" : "output", name); - if (!e.adevice.iscapture) { + int index = e.adevice.which; + int iscapture = e.adevice.iscapture; + const char *name = SDL_GetAudioDeviceName(index, iscapture); + if (name != NULL) + SDL_Log("New %s audio device at index %u: %s\n", devtypestr(iscapture), (unsigned int) index, name); + else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Got new %s device at index %u, but failed to get the name: %s\n", + devtypestr(iscapture), (unsigned int) index, SDL_GetError()); + continue; + } + if (!iscapture) { positions[posindex] = 0; spec.userdata = &positions[posindex++]; spec.callback = fillerup; @@ -99,7 +116,7 @@ iteration() } } else if (e.type == SDL_AUDIODEVICEREMOVED) { dev = (SDL_AudioDeviceID) e.adevice.which; - SDL_Log("%s device %u removed.\n", e.adevice.iscapture ? "capture" : "output", (unsigned int) dev); + SDL_Log("%s device %u removed.\n", devtypestr(e.adevice.iscapture), (unsigned int) dev); SDL_CloseAudioDevice(dev); } } @@ -163,6 +180,7 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } + SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n"); SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); #ifdef __EMSCRIPTEN__ @@ -175,6 +193,8 @@ main(int argc, char *argv[]) #endif /* Clean up on signal */ + /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ + SDL_QuitSubSystem(SDL_INIT_AUDIO); SDL_FreeWAV(sound); SDL_Quit(); return (0); diff --git a/Engine/lib/sdl/test/testaudioinfo.c b/Engine/lib/sdl/test/testaudioinfo.c index 53bf0f5e2..485fd0a38 100644 --- a/Engine/lib/sdl/test/testaudioinfo.c +++ b/Engine/lib/sdl/test/testaudioinfo.c @@ -18,7 +18,7 @@ print_devices(int iscapture) const char *typestr = ((iscapture) ? "capture" : "output"); int n = SDL_GetNumAudioDevices(iscapture); - SDL_Log("%s devices:\n", typestr); + SDL_Log("Found %d %s device%s:\n", n, typestr, n != 1 ? "s" : ""); if (n == -1) SDL_Log(" Driver can't detect specific %s devices.\n\n", typestr); @@ -27,7 +27,11 @@ print_devices(int iscapture) else { int i; for (i = 0; i < n; i++) { - SDL_Log(" %s\n", SDL_GetAudioDeviceName(i, iscapture)); + const char *name = SDL_GetAudioDeviceName(i, iscapture); + if (name != NULL) + SDL_Log(" %d: %s\n", i, name); + else + SDL_Log(" %d Error: %s\n", i, SDL_GetError()); } SDL_Log("\n"); } @@ -55,9 +59,9 @@ main(int argc, char **argv) int i; SDL_Log("Built-in audio drivers:\n"); for (i = 0; i < n; ++i) { - SDL_Log(" %s\n", SDL_GetAudioDriver(i)); + SDL_Log(" %d: %s\n", i, SDL_GetAudioDriver(i)); } - SDL_Log("\n"); + SDL_Log("Select a driver with the SDL_AUDIODRIVER environment variable.\n"); } SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver()); diff --git a/Engine/lib/sdl/test/testautomation_events.c b/Engine/lib/sdl/test/testautomation_events.c index f9eb5bb9e..a0119bdbe 100644 --- a/Engine/lib/sdl/test/testautomation_events.c +++ b/Engine/lib/sdl/test/testautomation_events.c @@ -87,7 +87,7 @@ events_addDelEventWatch(void *arg) /* Create user event */ event.type = SDL_USEREVENT; - event.user.code = SDLTest_RandomSint32();; + event.user.code = SDLTest_RandomSint32(); event.user.data1 = (void *)&_userdataValue1; event.user.data2 = (void *)&_userdataValue2; @@ -137,7 +137,7 @@ events_addDelEventWatchWithUserdata(void *arg) /* Create user event */ event.type = SDL_USEREVENT; - event.user.code = SDLTest_RandomSint32();; + event.user.code = SDLTest_RandomSint32(); event.user.data1 = (void *)&_userdataValue1; event.user.data2 = (void *)&_userdataValue2; diff --git a/Engine/lib/sdl/test/testautomation_keyboard.c b/Engine/lib/sdl/test/testautomation_keyboard.c index 453832e25..b2c3b9ae1 100644 --- a/Engine/lib/sdl/test/testautomation_keyboard.c +++ b/Engine/lib/sdl/test/testautomation_keyboard.c @@ -401,8 +401,8 @@ keyboard_setTextInputRect(void *arg) SDL_Rect refRect; /* Normal visible refRect, origin inside */ - refRect.x = SDLTest_RandomIntegerInRange(1, 50);; - refRect.y = SDLTest_RandomIntegerInRange(1, 50);; + refRect.x = SDLTest_RandomIntegerInRange(1, 50); + refRect.y = SDLTest_RandomIntegerInRange(1, 50); refRect.w = SDLTest_RandomIntegerInRange(10, 50); refRect.h = SDLTest_RandomIntegerInRange(10, 50); _testSetTextInputRect(refRect); @@ -415,8 +415,8 @@ keyboard_setTextInputRect(void *arg) _testSetTextInputRect(refRect); /* 1Pixel refRect */ - refRect.x = SDLTest_RandomIntegerInRange(10, 50);; - refRect.y = SDLTest_RandomIntegerInRange(10, 50);; + refRect.x = SDLTest_RandomIntegerInRange(10, 50); + refRect.y = SDLTest_RandomIntegerInRange(10, 50); refRect.w = 1; refRect.h = 1; _testSetTextInputRect(refRect); @@ -450,15 +450,15 @@ keyboard_setTextInputRect(void *arg) _testSetTextInputRect(refRect); /* negative refRect */ - refRect.x = SDLTest_RandomIntegerInRange(-200, -100);; - refRect.y = SDLTest_RandomIntegerInRange(-200, -100);; + refRect.x = SDLTest_RandomIntegerInRange(-200, -100); + refRect.y = SDLTest_RandomIntegerInRange(-200, -100); refRect.w = 50; refRect.h = 50; _testSetTextInputRect(refRect); /* oversized refRect */ - refRect.x = SDLTest_RandomIntegerInRange(1, 50);; - refRect.y = SDLTest_RandomIntegerInRange(1, 50);; + refRect.x = SDLTest_RandomIntegerInRange(1, 50); + refRect.y = SDLTest_RandomIntegerInRange(1, 50); refRect.w = 5000; refRect.h = 5000; _testSetTextInputRect(refRect); diff --git a/Engine/lib/sdl/test/testautomation_main.c b/Engine/lib/sdl/test/testautomation_main.c index ef8f19e9e..ae060cdd1 100644 --- a/Engine/lib/sdl/test/testautomation_main.c +++ b/Engine/lib/sdl/test/testautomation_main.c @@ -137,7 +137,7 @@ static const SDLTest_TestCaseReference mainTest3 = static const SDLTest_TestCaseReference mainTest4 = { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED}; -/* Sequence of Platform test cases */ +/* Sequence of Main test cases */ static const SDLTest_TestCaseReference *mainTests[] = { &mainTest1, &mainTest2, @@ -146,7 +146,7 @@ static const SDLTest_TestCaseReference *mainTests[] = { NULL }; -/* Platform test suite (global) */ +/* Main test suite (global) */ SDLTest_TestSuiteReference mainTestSuite = { "Main", NULL, diff --git a/Engine/lib/sdl/test/testautomation_sdltest.c b/Engine/lib/sdl/test/testautomation_sdltest.c index ec1da8a50..54cd6e257 100644 --- a/Engine/lib/sdl/test/testautomation_sdltest.c +++ b/Engine/lib/sdl/test/testautomation_sdltest.c @@ -1093,7 +1093,7 @@ sdltest_randomIntegerInRange(void *arg) SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%d,%d], got: %d", min, max, result); /* Range with max at integer limit */ - min = long_min - (Sint32)SDLTest_RandomSint16();; + min = long_min - (Sint32)SDLTest_RandomSint16(); max = long_max; result = SDLTest_RandomIntegerInRange(min, max); SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)"); diff --git a/Engine/lib/sdl/test/testautomation_stdlib.c b/Engine/lib/sdl/test/testautomation_stdlib.c index 89245fdcb..b541995f5 100644 --- a/Engine/lib/sdl/test/testautomation_stdlib.c +++ b/Engine/lib/sdl/test/testautomation_stdlib.c @@ -253,6 +253,43 @@ stdlib_getsetenv(void *arg) return TEST_COMPLETED; } +/** + * @brief Call to SDL_sscanf + */ +#undef SDL_sscanf +int +stdlib_sscanf(void *arg) +{ + int output; + int result; + int expected_output; + int expected_result; + + expected_output = output = 123; + expected_result = -1; + result = SDL_sscanf("", "%i", &output); + SDLTest_AssertPass("Call to SDL_sscanf(\"\", \"%%i\", &output)"); + SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); + SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + + expected_output = output = 123; + expected_result = 0; + result = SDL_sscanf("a", "%i", &output); + SDLTest_AssertPass("Call to SDL_sscanf(\"a\", \"%%i\", &output)"); + SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); + SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + + output = 123; + expected_output = 2; + expected_result = 1; + result = SDL_sscanf("2", "%i", &output); + SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i\", &output)"); + SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); + SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); + + return TEST_COMPLETED; +} + /* ================= Test References ================== */ /* Standard C routine test cases */ @@ -265,12 +302,15 @@ static const SDLTest_TestCaseReference stdlibTest2 = static const SDLTest_TestCaseReference stdlibTest3 = { (SDLTest_TestCaseFp)stdlib_getsetenv, "stdlib_getsetenv", "Call to SDL_getenv and SDL_setenv", TEST_ENABLED }; +static const SDLTest_TestCaseReference stdlibTest4 = + { (SDLTest_TestCaseFp)stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED }; + /* Sequence of Standard C routine test cases */ static const SDLTest_TestCaseReference *stdlibTests[] = { - &stdlibTest1, &stdlibTest2, &stdlibTest3, NULL + &stdlibTest1, &stdlibTest2, &stdlibTest3, &stdlibTest4, NULL }; -/* Timer test suite (global) */ +/* Standard C routine test suite (global) */ SDLTest_TestSuiteReference stdlibTestSuite = { "Stdlib", NULL, diff --git a/Engine/lib/sdl/test/testbounds.c b/Engine/lib/sdl/test/testbounds.c new file mode 100644 index 000000000..b410be96c --- /dev/null +++ b/Engine/lib/sdl/test/testbounds.c @@ -0,0 +1,40 @@ +/* + Copyright (C) 1997-2014 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +int main(int argc, char **argv) +{ + int total, i; + + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError()); + return 1; + } + + total = SDL_GetNumVideoDisplays(); + for (i = 0; i < total; i++) { + SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 }; + SDL_GetDisplayBounds(i, &bounds); + SDL_GetDisplayUsableBounds(i, &usable); + SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}", + i, SDL_GetDisplayName(i), + bounds.x, bounds.y, bounds.w, bounds.h, + usable.x, usable.y, usable.w, usable.h); + } + + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/test/testcustomcursor.c b/Engine/lib/sdl/test/testcustomcursor.c new file mode 100644 index 000000000..88b5c322d --- /dev/null +++ b/Engine/lib/sdl/test/testcustomcursor.c @@ -0,0 +1,216 @@ +/* + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include +#include + +#ifdef __EMSCRIPTEN__ +#include +#endif + +#include "SDL_test_common.h" + +/* Stolen from the mailing list */ +/* Creates a new mouse cursor from an XPM */ + + +/* XPM */ +static const char *arrow[] = { + /* width height num_colors chars_per_pixel */ + " 32 32 3 1", + /* colors */ + "X c #000000", + ". c #ffffff", + " c None", + /* pixels */ + "X ", + "XX ", + "X.X ", + "X..X ", + "X...X ", + "X....X ", + "X.....X ", + "X......X ", + "X.......X ", + "X........X ", + "X.....XXXXX ", + "X..X..X ", + "X.X X..X ", + "XX X..X ", + "X X..X ", + " X..X ", + " X..X ", + " X..X ", + " XX ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "0,0" +}; + +static SDL_Cursor* +init_color_cursor(const char *file) +{ + SDL_Cursor *cursor = NULL; + SDL_Surface *surface = SDL_LoadBMP(file); + if (surface) { + cursor = SDL_CreateColorCursor(surface, 0, 0); + SDL_FreeSurface(surface); + } + return cursor; +} + +static SDL_Cursor* +init_system_cursor(const char *image[]) +{ + int i, row, col; + Uint8 data[4*32]; + Uint8 mask[4*32]; + int hot_x, hot_y; + + i = -1; + for (row=0; row<32; ++row) { + for (col=0; col<32; ++col) { + if (col % 8) { + data[i] <<= 1; + mask[i] <<= 1; + } else { + ++i; + data[i] = mask[i] = 0; + } + switch (image[4+row][col]) { + case 'X': + data[i] |= 0x01; + mask[i] |= 0x01; + break; + case '.': + mask[i] |= 0x01; + break; + case ' ': + break; + } + } + } + sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); + return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); +} + +static SDLTest_CommonState *state; +int done; +SDL_Cursor *cursor = NULL; + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void +quit(int rc) +{ + SDLTest_CommonQuit(state); + exit(rc); +} + +void +loop() +{ + int i; + SDL_Event event; + /* Check for events */ + while (SDL_PollEvent(&event)) { + SDLTest_CommonEvent(state, &event, &done); + } + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + } +#ifdef __EMSCRIPTEN__ + if (done) { + emscripten_cancel_main_loop(); + } +#endif +} + +int +main(int argc, char *argv[]) +{ + int i; + const char *color_cursor = NULL; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if (!state) { + return 1; + } + for (i = 1; i < argc;) { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if (consumed == 0) { + color_cursor = argv[i]; + break; + } + if (consumed < 0) { + SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + quit(1); + } + i += consumed; + } + + if (!SDLTest_CommonInit(state)) { + quit(2); + } + + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + + if (color_cursor) { + cursor = init_color_cursor(color_cursor); + } else { + cursor = init_system_cursor(arrow); + } + if (!cursor) { + SDL_Log("Error, couldn't create cursor\n"); + quit(2); + } + SDL_SetCursor(cursor); + + /* Main render loop */ + done = 0; +#ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(loop, 0, 1); +#else + while (!done) { + loop(); + } +#endif + + SDL_FreeCursor(cursor); + quit(0); + + /* keep the compiler happy ... */ + return(0); +} diff --git a/Engine/lib/sdl/test/testdisplayinfo.c b/Engine/lib/sdl/test/testdisplayinfo.c index c228eb6b2..f06722e88 100644 --- a/Engine/lib/sdl/test/testdisplayinfo.c +++ b/Engine/lib/sdl/test/testdisplayinfo.c @@ -51,11 +51,18 @@ main(int argc, char *argv[]) for (dpy = 0; dpy < num_displays; dpy++) { const int num_modes = SDL_GetNumDisplayModes(dpy); SDL_Rect rect = { 0, 0, 0, 0 }; + float ddpi, hdpi, vdpi; int m; SDL_GetDisplayBounds(dpy, &rect); SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes); + if (SDL_GetDisplayDPI(dpy, &ddpi, &hdpi, &vdpi) == -1) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DPI: failed to query (%s)\n", SDL_GetError()); + } else { + SDL_Log(" DPI: ddpi=%f; hdpi=%f; vdpi=%f\n", ddpi, hdpi, vdpi); + } + if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); } else { diff --git a/Engine/lib/sdl/test/testdrawchessboard.c b/Engine/lib/sdl/test/testdrawchessboard.c index f2a1469d4..af929e9c3 100644 --- a/Engine/lib/sdl/test/testdrawchessboard.c +++ b/Engine/lib/sdl/test/testdrawchessboard.c @@ -100,7 +100,7 @@ main(int argc, char *argv[]) /* Create window and renderer for given surface */ - window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN); + window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); if(!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError()); diff --git a/Engine/lib/sdl/test/testdropfile.c b/Engine/lib/sdl/test/testdropfile.c index b7f215ee8..b729b2f64 100644 --- a/Engine/lib/sdl/test/testdropfile.c +++ b/Engine/lib/sdl/test/testdropfile.c @@ -77,9 +77,14 @@ main(int argc, char *argv[]) while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); - if (event.type == SDL_DROPFILE) { + if (event.type == SDL_DROPBEGIN) { + SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); + } else if (event.type == SDL_DROPCOMPLETE) { + SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID); + } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) { + const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; char *dropped_filedir = event.drop.file; - SDL_Log("File dropped on window: %s", dropped_filedir); + SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); SDL_free(dropped_filedir); } } diff --git a/Engine/lib/sdl/test/testfilesystem.c b/Engine/lib/sdl/test/testfilesystem.c index abd301c0e..61a6d5a5a 100644 --- a/Engine/lib/sdl/test/testfilesystem.c +++ b/Engine/lib/sdl/test/testfilesystem.c @@ -32,9 +32,8 @@ main(int argc, char *argv[]) if(base_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", SDL_GetError()); - return 0; + return 1; } - SDL_Log("base path: '%s'\n", base_path); SDL_free(base_path); @@ -42,7 +41,7 @@ main(int argc, char *argv[]) if(pref_path == NULL){ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", SDL_GetError()); - return 0; + return 1; } SDL_Log("pref path: '%s'\n", pref_path); SDL_free(pref_path); diff --git a/Engine/lib/sdl/test/testgamecontroller.c b/Engine/lib/sdl/test/testgamecontroller.c index ec1dfd322..38d2f7708 100644 --- a/Engine/lib/sdl/test/testgamecontroller.c +++ b/Engine/lib/sdl/test/testgamecontroller.c @@ -29,7 +29,7 @@ #define SCREEN_HEIGHT 320 #else #define SCREEN_WIDTH 512 -#define SCREEN_HEIGHT 317 +#define SCREEN_HEIGHT 320 #endif /* This is indexed by SDL_GameControllerButton. */ @@ -67,7 +67,7 @@ SDL_bool done = SDL_FALSE; SDL_Texture *background, *button, *axis; static SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) { SDL_Surface *temp = NULL; SDL_Texture *texture = NULL; @@ -129,7 +129,7 @@ loop(void *arg) for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; ++i) { if (SDL_GameControllerGetButton(gamecontroller, (SDL_GameControllerButton)i) == SDL_PRESSED) { const SDL_Rect dst = { button_positions[i].x, button_positions[i].y, 50, 50 }; - SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, 0); + SDL_RenderCopyEx(screen, button, NULL, &dst, 0, NULL, SDL_FLIP_NONE); } } @@ -139,11 +139,11 @@ loop(void *arg) if (value < -deadzone) { const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 }; const double angle = axis_positions[i].angle; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0); + SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } else if (value > deadzone) { const SDL_Rect dst = { axis_positions[i].x, axis_positions[i].y, 50, 50 }; const double angle = axis_positions[i].angle + 180.0; - SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, 0); + SDL_RenderCopyEx(screen, axis, NULL, &dst, angle, NULL, SDL_FLIP_NONE); } } @@ -181,6 +181,8 @@ WatchGameController(SDL_GameController * gamecontroller) window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); + SDL_free(title); + title = NULL; if (window == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; diff --git a/Engine/lib/sdl/test/testgles.c b/Engine/lib/sdl/test/testgles.c index 291661a09..5be48ac56 100644 --- a/Engine/lib/sdl/test/testgles.c +++ b/Engine/lib/sdl/test/testgles.c @@ -173,7 +173,7 @@ main(int argc, char *argv[]) quit(2); } - context = SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); if (context == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); diff --git a/Engine/lib/sdl/test/testgles2.c b/Engine/lib/sdl/test/testgles2.c index af5962ba4..45b3d79a3 100644 --- a/Engine/lib/sdl/test/testgles2.c +++ b/Engine/lib/sdl/test/testgles2.c @@ -546,7 +546,7 @@ main(int argc, char *argv[]) return 0; } - context = SDL_calloc(state->num_windows, sizeof(context)); + context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(context)); if (context == NULL) { SDL_Log("Out of memory!\n"); quit(2); @@ -640,7 +640,7 @@ main(int argc, char *argv[]) } } - datas = SDL_calloc(state->num_windows, sizeof(shader_data)); + datas = (shader_data *)SDL_calloc(state->num_windows, sizeof(shader_data)); /* Set rendering settings for each context */ for (i = 0; i < state->num_windows; ++i) { diff --git a/Engine/lib/sdl/test/testime.c b/Engine/lib/sdl/test/testime.c index d6e7ea1f2..39a40f82f 100644 --- a/Engine/lib/sdl/test/testime.c +++ b/Engine/lib/sdl/test/testime.c @@ -9,7 +9,9 @@ including commercial applications, and to alter it and redistribute it freely. */ -/* A simple program to test the Input Method support in the SDL library (2.0+) */ +/* A simple program to test the Input Method support in the SDL library (2.0+) + If you build without SDL_ttf, you can use the GNU Unifont hex file instead. + Download at http://unifoundry.com/unifont.html */ #include #include @@ -22,19 +24,342 @@ #include "SDL_test_common.h" -#define DEFAULT_PTSIZE 30 -#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" +#define DEFAULT_PTSIZE 30 +#ifdef HAVE_SDL_TTF +#ifdef __MACOSX__ +#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" +#elif __WIN32__ +/* Some japanese font present on at least Windows 8.1. */ +#define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf" +#else +#define DEFAULT_FONT "NoDefaultFont.ttf" +#endif +#else +#define DEFAULT_FONT "unifont-9.0.02.hex" +#endif #define MAX_TEXT_LENGTH 256 static SDLTest_CommonState *state; static SDL_Rect textRect, markedRect; -static SDL_Color lineColor = {0,0,0,0}; -static SDL_Color backColor = {255,255,255,0}; -static SDL_Color textColor = {0,0,0,0}; +static SDL_Color lineColor = {0,0,0,255}; +static SDL_Color backColor = {255,255,255,255}; +static SDL_Color textColor = {0,0,0,255}; static char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; static int cursor = 0; #ifdef HAVE_SDL_TTF static TTF_Font *font; +#else +#define UNIFONT_MAX_CODEPOINT 0x1ffff +#define UNIFONT_NUM_GLYPHS 0x20000 +/* Using 512x512 textures that are supported everywhere. */ +#define UNIFONT_TEXTURE_WIDTH 512 +#define UNIFONT_GLYPHS_IN_ROW (UNIFONT_TEXTURE_WIDTH / 16) +#define UNIFONT_GLYPHS_IN_TEXTURE (UNIFONT_GLYPHS_IN_ROW * UNIFONT_GLYPHS_IN_ROW) +#define UNIFONT_NUM_TEXTURES ((UNIFONT_NUM_GLYPHS + UNIFONT_GLYPHS_IN_TEXTURE - 1) / UNIFONT_GLYPHS_IN_TEXTURE) +#define UNIFONT_TEXTURE_SIZE (UNIFONT_TEXTURE_WIDTH * UNIFONT_TEXTURE_WIDTH * 4) +#define UNIFONT_TEXTURE_PITCH (UNIFONT_TEXTURE_WIDTH * 4) +#define UNIFONT_DRAW_SCALE 2 +struct UnifontGlyph { + Uint8 width; + Uint8 data[32]; +} *unifontGlyph; +static SDL_Texture **unifontTexture; +static Uint8 unifontTextureLoaded[UNIFONT_NUM_TEXTURES] = {0}; + +/* Unifont loading code start */ + +static Uint8 dehex(char c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + else if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + return 255; +} + +static Uint8 dehex2(char c1, char c2) +{ + return (dehex(c1) << 4) | dehex(c2); +} + +static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np) +{ + Uint32 n = 0; + for (; len > 0; cp++, len--) + { + Uint8 c = dehex(*cp); + if (c == 255) + return 0; + n = (n << 4) | c; + } + if (np != NULL) + *np = n; + return 1; +} + +static void unifont_init(const char *fontname) +{ + Uint8 hexBuffer[65]; + Uint32 numGlyphs = 0; + int lineNumber = 1; + size_t bytesRead; + SDL_RWops *hexFile; + const size_t unifontGlyphSize = UNIFONT_NUM_GLYPHS * sizeof(struct UnifontGlyph); + const size_t unifontTextureSize = UNIFONT_NUM_TEXTURES * state->num_windows * sizeof(void *); + + /* Allocate memory for the glyph data so the file can be closed after initialization. */ + unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); + if (unifontGlyph == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); + exit(-1); + } + SDL_memset(unifontGlyph, 0, unifontGlyphSize); + + /* Allocate memory for texture pointers for all renderers. */ + unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize); + if (unifontTexture == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); + exit(-1); + } + SDL_memset(unifontTexture, 0, unifontTextureSize); + + hexFile = SDL_RWFromFile(fontname, "rb"); + if (hexFile == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); + exit(-1); + } + + /* Read all the glyph data into memory to make it accessible later when textures are created. */ + do { + int i, codepointHexSize; + size_t bytesOverread; + Uint8 glyphWidth; + Uint32 codepoint; + + bytesRead = SDL_RWread(hexFile, hexBuffer, 1, 9); + if (numGlyphs > 0 && bytesRead == 0) + break; /* EOF */ + if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unfiont: Unexpected end of hex file.\n"); + exit(-1); + } + + /* Looking for the colon that separates the codepoint and glyph data at position 2, 4, 6 and 8. */ + if (hexBuffer[2] == ':') + codepointHexSize = 2; + else if (hexBuffer[4] == ':') + codepointHexSize = 4; + else if (hexBuffer[6] == ':') + codepointHexSize = 6; + else if (hexBuffer[8] == ':') + codepointHexSize = 8; + else + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber); + exit(-1); + } + + if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber); + exit(-1); + } + if (codepoint > UNIFONT_MAX_CODEPOINT) + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT); + + /* If there was glyph data read in the last file read, move it to the front of the buffer. */ + bytesOverread = 8 - codepointHexSize; + if (codepointHexSize < 8) + SDL_memmove(hexBuffer, hexBuffer + codepointHexSize + 1, bytesOverread); + bytesRead = SDL_RWread(hexFile, hexBuffer + bytesOverread, 1, 33 - bytesOverread); + if (bytesRead < (33 - bytesOverread)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + exit(-1); + } + if (hexBuffer[32] == '\n') + glyphWidth = 8; + else + { + glyphWidth = 16; + bytesRead = SDL_RWread(hexFile, hexBuffer + 33, 1, 32); + if (bytesRead < 32) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + exit(-1); + } + } + + if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber); + exit(-1); + } + + if (codepoint <= UNIFONT_MAX_CODEPOINT) + { + if (unifontGlyph[codepoint].width > 0) + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Ignoring duplicate codepoint 0x%08x in hex file on line %d.\n", codepoint, lineNumber); + else + { + unifontGlyph[codepoint].width = glyphWidth; + /* Pack the hex data into a more compact form. */ + for (i = 0; i < glyphWidth * 2; i++) + unifontGlyph[codepoint].data[i] = dehex2(hexBuffer[i * 2], hexBuffer[i * 2 + 1]); + numGlyphs++; + } + } + + lineNumber++; + } while (bytesRead > 0); + + SDL_RWclose(hexFile); + SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); +} + +static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) +{ + int i, j; + Uint8 *row = dst; + + for (i = 0; i < width * 2; i++) + { + Uint8 data = src[i]; + for (j = 0; j < 8; j++) + { + if (data & 0x80) + { + row[0] = textColor.r; + row[1] = textColor.g; + row[2] = textColor.b; + row[3] = textColor.a; + } + else + { + row[0] = 0; + row[1] = 0; + row[2] = 0; + row[3] = 0; + } + data <<= 1; + row += 4; + } + + if (width == 8 || (width == 16 && i % 2 == 1)) + { + dst += UNIFONT_TEXTURE_PITCH; + row = dst; + } + } +} + +static void unifont_load_texture(Uint32 textureID) +{ + int i; + Uint8 * textureRGBA; + + if (textureID >= UNIFONT_NUM_TEXTURES) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); + exit(-1); + } + + textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); + if (textureRGBA == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); + exit(-1); + } + SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE); + + /* Copy the glyphs into memory in RGBA format. */ + for (i = 0; i < UNIFONT_GLYPHS_IN_TEXTURE; i++) + { + Uint32 codepoint = UNIFONT_GLYPHS_IN_TEXTURE * textureID + i; + if (unifontGlyph[codepoint].width > 0) + { + const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE; + const size_t offset = (cInTex / UNIFONT_GLYPHS_IN_ROW) * UNIFONT_TEXTURE_PITCH * 16 + (cInTex % UNIFONT_GLYPHS_IN_ROW) * 16 * 4; + unifont_make_rgba(unifontGlyph[codepoint].data, textureRGBA + offset, unifontGlyph[codepoint].width); + } + } + + /* Create textures and upload the RGBA data from above. */ + for (i = 0; i < state->num_windows; ++i) + { + SDL_Renderer *renderer = state->renderers[i]; + SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID]; + if (state->windows[i] == NULL || renderer == NULL || tex != NULL) + continue; + tex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, UNIFONT_TEXTURE_WIDTH, UNIFONT_TEXTURE_WIDTH); + if (tex == NULL) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); + exit(-1); + } + unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; + SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); + if (SDL_UpdateTexture(tex, NULL, textureRGBA, UNIFONT_TEXTURE_PITCH) != 0) + { + SDL_Log("unifont error: Failed to update texture %u data for renderer %d.\n", textureID, i); + } + } + + SDL_free(textureRGBA); + unifontTextureLoaded[textureID] = 1; +} + +static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect) +{ + SDL_Texture *texture; + const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE; + SDL_Rect srcrect; + srcrect.w = srcrect.h = 16; + if (codepoint > UNIFONT_MAX_CODEPOINT) + return 0; + if (!unifontTextureLoaded[textureID]) + unifont_load_texture(textureID); + texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID]; + if (texture != NULL) + { + const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE; + srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16; + srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16; + SDL_RenderCopy(state->renderers[rendererID], texture, &srcrect, dstrect); + } + return unifontGlyph[codepoint].width; +} + +static void unifont_cleanup() +{ + int i, j; + for (i = 0; i < state->num_windows; ++i) + { + SDL_Renderer *renderer = state->renderers[i]; + if (state->windows[i] == NULL || renderer == NULL) + continue; + for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) + { + SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j]; + if (tex != NULL) + SDL_DestroyTexture(tex); + } + } + + for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) + unifontTextureLoaded[j] = 0; + + SDL_free(unifontTexture); + SDL_free(unifontGlyph); +} + +/* Unifont code end */ #endif size_t utf8_length(unsigned char c) @@ -78,6 +403,30 @@ char *utf8_advance(char *p, size_t distance) return p; } +Uint32 utf8_decode(char *p, size_t len) +{ + Uint32 codepoint = 0; + size_t i = 0; + if (!len) + return 0; + + for (; i < len; ++i) + { + if (i == 0) + codepoint = (0xff >> len) & *p; + else + { + codepoint <<= 6; + codepoint |= 0x3f & *p; + } + if (!*p) + return 0; + p++; + } + + return codepoint; +} + void usage() { SDL_Log("usage: testime [--font fontfile]\n"); @@ -105,34 +454,61 @@ void CleanupVideo() #ifdef HAVE_SDL_TTF TTF_CloseFont(font); TTF_Quit(); +#else + unifont_cleanup(); #endif } +void _Redraw(int rendererID) { + SDL_Renderer * renderer = state->renderers[rendererID]; + SDL_Rect drawnTextRect, cursorRect, underlineRect; + drawnTextRect = textRect; + drawnTextRect.w = 0; -void _Redraw(SDL_Renderer * renderer) { - int w = 0, h = textRect.h; - SDL_Rect cursorRect, underlineRect; - - SDL_SetRenderDrawColor(renderer, 255,255,255,255); + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); SDL_RenderFillRect(renderer,&textRect); -#ifdef HAVE_SDL_TTF if (*text) { +#ifdef HAVE_SDL_TTF SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, text, textColor); - SDL_Rect dest = {textRect.x, textRect.y, textSur->w, textSur->h }; + SDL_Texture *texture; - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); + /* Vertically center text */ + drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.w = textSur->w; + drawnTextRect.h = textSur->h; + + texture = SDL_CreateTextureFromSurface(renderer,textSur); SDL_FreeSurface(textSur); - SDL_RenderCopy(renderer,texture,NULL,&dest); + SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect); SDL_DestroyTexture(texture); - TTF_SizeUTF8(font, text, &w, &h); - } -#endif +#else + char *utext = text; + Uint32 codepoint; + size_t len; + SDL_Rect dstrect; - markedRect.x = textRect.x + w; - markedRect.w = textRect.w - w; + dstrect.x = textRect.x; + dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2; + dstrect.w = 16 * UNIFONT_DRAW_SCALE; + dstrect.h = 16 * UNIFONT_DRAW_SCALE; + drawnTextRect.y = dstrect.y; + drawnTextRect.h = dstrect.h; + + while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) + { + Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE; + dstrect.x += advance; + drawnTextRect.w += advance; + utext += len; + } +#endif + } + + markedRect.x = textRect.x + drawnTextRect.w; + markedRect.w = textRect.w - drawnTextRect.w; if (markedRect.w < 0) { /* Stop text input because we cannot hold any more characters */ @@ -144,49 +520,88 @@ void _Redraw(SDL_Renderer * renderer) { SDL_StartTextInput(); } - cursorRect = markedRect; + cursorRect = drawnTextRect; + cursorRect.x += cursorRect.w; cursorRect.w = 2; - cursorRect.h = h; + cursorRect.h = drawnTextRect.h; - SDL_SetRenderDrawColor(renderer, 255,255,255,255); + drawnTextRect.x += drawnTextRect.w; + drawnTextRect.w = 0; + + SDL_SetRenderDrawColor(renderer, backColor.r, backColor.g, backColor.b, backColor.a); SDL_RenderFillRect(renderer,&markedRect); if (markedText[0]) { #ifdef HAVE_SDL_TTF + SDL_Surface *textSur; + SDL_Texture *texture; if (cursor) { char *p = utf8_advance(markedText, cursor); char c = 0; if (!p) - p = &markedText[strlen(markedText)]; + p = &markedText[SDL_strlen(markedText)]; c = *p; *p = 0; - TTF_SizeUTF8(font, markedText, &w, 0); - cursorRect.x += w; + TTF_SizeUTF8(font, markedText, &drawnTextRect.w, NULL); + cursorRect.x += drawnTextRect.w; *p = c; } - SDL_Surface *textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); - SDL_Rect dest = {markedRect.x, markedRect.y, textSur->w, textSur->h }; - TTF_SizeUTF8(font, markedText, &w, &h); - SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer,textSur); + textSur = TTF_RenderUTF8_Blended(font, markedText, textColor); + /* Vertically center text */ + drawnTextRect.y = textRect.y + (textRect.h - textSur->h) / 2; + drawnTextRect.w = textSur->w; + drawnTextRect.h = textSur->h; + + texture = SDL_CreateTextureFromSurface(renderer,textSur); SDL_FreeSurface(textSur); - SDL_RenderCopy(renderer,texture,NULL,&dest); + SDL_RenderCopy(renderer,texture,NULL,&drawnTextRect); SDL_DestroyTexture(texture); +#else + int i = 0; + char *utext = markedText; + Uint32 codepoint; + size_t len; + SDL_Rect dstrect; + + dstrect.x = drawnTextRect.x; + dstrect.y = textRect.y + (textRect.h - 16 * UNIFONT_DRAW_SCALE) / 2; + dstrect.w = 16 * UNIFONT_DRAW_SCALE; + dstrect.h = 16 * UNIFONT_DRAW_SCALE; + drawnTextRect.y = dstrect.y; + drawnTextRect.h = dstrect.h; + + while ((codepoint = utf8_decode(utext, len = utf8_length(*utext)))) + { + Sint32 advance = unifont_draw_glyph(codepoint, rendererID, &dstrect) * UNIFONT_DRAW_SCALE; + dstrect.x += advance; + drawnTextRect.w += advance; + if (i < cursor) + cursorRect.x += advance; + i++; + utext += len; + } #endif - underlineRect = markedRect; - underlineRect.y += (h - 2); - underlineRect.h = 2; - underlineRect.w = w; + if (cursor > 0) + { + cursorRect.y = drawnTextRect.y; + cursorRect.h = drawnTextRect.h; + } - SDL_SetRenderDrawColor(renderer, 0,0,0,0); - SDL_RenderFillRect(renderer,&markedRect); + underlineRect = markedRect; + underlineRect.y = drawnTextRect.y + drawnTextRect.h - 2; + underlineRect.h = 2; + underlineRect.w = drawnTextRect.w; + + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); + SDL_RenderFillRect(renderer, &underlineRect); } - SDL_SetRenderDrawColor(renderer, 0,0,0,0); + SDL_SetRenderDrawColor(renderer, lineColor.r, lineColor.g, lineColor.b, lineColor.a); SDL_RenderFillRect(renderer,&cursorRect); SDL_SetTextInputRect(&markedRect); @@ -201,7 +616,8 @@ void Redraw() { SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); SDL_RenderClear(renderer); - _Redraw(renderer); + /* Sending in the window id to let the font renderers know which one we're working with. */ + _Redraw(i); SDL_RenderPresent(renderer); } @@ -259,6 +675,8 @@ int main(int argc, char *argv[]) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); exit(-1); } +#else + unifont_init(fontname); #endif SDL_Log("Using font: %s\n", fontname); @@ -288,6 +706,8 @@ int main(int argc, char *argv[]) { Redraw(); break; case SDLK_BACKSPACE: + /* Only delete text if not in editing mode. */ + if (!markedText[0]) { size_t textlen = SDL_strlen(text); @@ -354,7 +774,7 @@ int main(int argc, char *argv[]) { SDL_Log("text editing \"%s\", selected range (%d, %d)\n", event.edit.text, event.edit.start, event.edit.length); - strcpy(markedText, event.edit.text); + SDL_strlcpy(markedText, event.edit.text, SDL_TEXTEDITINGEVENT_TEXT_SIZE); cursor = event.edit.start; Redraw(); break; diff --git a/Engine/lib/sdl/test/testlock.c b/Engine/lib/sdl/test/testlock.c index 1106ec3bf..113ba0d4c 100644 --- a/Engine/lib/sdl/test/testlock.c +++ b/Engine/lib/sdl/test/testlock.c @@ -23,7 +23,7 @@ static SDL_mutex *mutex = NULL; static SDL_threadID mainthread; static SDL_Thread *threads[6]; -static volatile int doterminate = 0; +static SDL_atomic_t doterminate; /* * SDL_Quit() shouldn't be used with atexit() directly because @@ -45,7 +45,7 @@ void terminate(int sig) { signal(SIGINT, terminate); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); } void @@ -54,7 +54,7 @@ closemutex(int sig) SDL_threadID id = SDL_ThreadID(); int i; SDL_Log("Process %lu: Cleaning up...\n", id == mainthread ? 0 : id); - doterminate = 1; + SDL_AtomicSet(&doterminate, 1); for (i = 0; i < 6; ++i) SDL_WaitThread(threads[i], NULL); SDL_DestroyMutex(mutex); @@ -66,7 +66,7 @@ Run(void *data) { if (SDL_ThreadID() == mainthread) signal(SIGTERM, closemutex); - while (!doterminate) { + while (!SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu ready to work\n", SDL_ThreadID()); if (SDL_LockMutex(mutex) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError()); @@ -82,7 +82,7 @@ Run(void *data) /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); } - if (SDL_ThreadID() == mainthread && doterminate) { + if (SDL_ThreadID() == mainthread && SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu: raising SIGTERM\n", SDL_ThreadID()); raise(SIGTERM); } @@ -105,6 +105,8 @@ main(int argc, char *argv[]) } atexit(SDL_Quit_Wrapper); + SDL_AtomicSet(&doterminate, 0); + if ((mutex = SDL_CreateMutex()) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); diff --git a/Engine/lib/sdl/test/testmultiaudio.c b/Engine/lib/sdl/test/testmultiaudio.c index 117ef2696..1b07ba9fc 100644 --- a/Engine/lib/sdl/test/testmultiaudio.c +++ b/Engine/lib/sdl/test/testmultiaudio.c @@ -25,7 +25,7 @@ typedef struct { SDL_AudioDeviceID dev; int soundpos; - volatile int done; + SDL_atomic_t done; } callback_data; callback_data cbd[64]; @@ -46,14 +46,14 @@ play_through_once(void *arg, Uint8 * stream, int len) if (len > 0) { stream += cpy; SDL_memset(stream, spec.silence, len); - cbd->done++; + SDL_AtomicSet(&cbd->done, 1); } } void loop() { - if(cbd[0].done) { + if (SDL_AtomicGet(&cbd[0].done)) { #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #endif @@ -100,8 +100,7 @@ test_multi_audio(int devcount) #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!cbd[0].done) - { + while (!SDL_AtomicGet(&cbd[0].done)) { #ifdef __ANDROID__ /* Empty queue, some application events would prevent pause. */ while (SDL_PollEvent(&event)){} @@ -136,7 +135,7 @@ test_multi_audio(int devcount) while (keep_going) { keep_going = 0; for (i = 0; i < devcount; i++) { - if ((cbd[i].dev) && (!cbd[i].done)) { + if ((cbd[i].dev) && (!SDL_AtomicGet(&cbd[i].done))) { keep_going = 1; } } diff --git a/Engine/lib/sdl/test/testqsort.c b/Engine/lib/sdl/test/testqsort.c new file mode 100644 index 000000000..48659f307 --- /dev/null +++ b/Engine/lib/sdl/test/testqsort.c @@ -0,0 +1,108 @@ +/* + Copyright (C) 1997-2016 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL_test.h" + +static int +num_compare(const void *_a, const void *_b) +{ + const int a = *((const int *) _a); + const int b = *((const int *) _b); + return (a < b) ? -1 : ((a > b) ? 1 : 0); +} + +static void +test_sort(const char *desc, int *nums, const int arraylen) +{ + int i; + int prev; + + SDL_Log("test: %s arraylen=%d", desc, arraylen); + + SDL_qsort(nums, arraylen, sizeof (nums[0]), num_compare); + + prev = nums[0]; + for (i = 1; i < arraylen; i++) { + const int val = nums[i]; + if (val < prev) { + SDL_Log("sort is broken!"); + return; + } + prev = val; + } +} + +int +main(int argc, char *argv[]) +{ + static int nums[1024 * 100]; + static const int itervals[] = { SDL_arraysize(nums), 12 }; + int iteration; + SDLTest_RandomContext rndctx; + + if (argc > 1) + { + int success; + Uint64 seed = 0; + if (argv[1][0] == '0' && argv[1][1] == 'x') + success = SDL_sscanf(argv[1] + 2, "%llx", &seed); + else + success = SDL_sscanf(argv[1], "%llu", &seed); + if (!success) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Invalid seed. Use a decimal or hexadecimal number.\n"); + return 1; + } + if (seed <= 0xffffffff) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Seed must be equal or greater than 0x100000000.\n"); + return 1; + } + SDLTest_RandomInit(&rndctx, (unsigned int)(seed >> 32), (unsigned int)(seed & 0xffffffff)); + } + else + { + SDLTest_RandomInitTime(&rndctx); + } + SDL_Log("Using random seed 0x%08x%08x\n", rndctx.x, rndctx.c); + + for (iteration = 0; iteration < SDL_arraysize(itervals); iteration++) { + const int arraylen = itervals[iteration]; + int i; + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + test_sort("already sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = i; + } + nums[arraylen-1] = -1; + test_sort("already sorted except last element", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = (arraylen-1) - i; + } + test_sort("reverse sorted", nums, arraylen); + + for (i = 0; i < arraylen; i++) { + nums[i] = SDLTest_RandomInt(&rndctx); + } + test_sort("random sorted", nums, arraylen); + } + + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/test/testrendercopyex.c b/Engine/lib/sdl/test/testrendercopyex.c index 856abf7d0..e34890245 100644 --- a/Engine/lib/sdl/test/testrendercopyex.c +++ b/Engine/lib/sdl/test/testrendercopyex.c @@ -45,7 +45,7 @@ quit(int rc) } SDL_Texture * -LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent) +LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) { SDL_Surface *temp; SDL_Texture *texture; @@ -126,7 +126,7 @@ Draw(DrawState *s) s->sprite_rect.x = (viewport.w - s->sprite_rect.w) / 2; s->sprite_rect.y = (viewport.h - s->sprite_rect.h) / 2; - SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, s->scale_direction); + SDL_RenderCopyEx(s->renderer, s->sprite, NULL, &s->sprite_rect, (double)s->sprite_rect.w, center, (SDL_RendererFlip)s->scale_direction); SDL_SetRenderTarget(s->renderer, NULL); SDL_RenderCopy(s->renderer, target, NULL, NULL); diff --git a/Engine/lib/sdl/test/testshape.c b/Engine/lib/sdl/test/testshape.c index 00750a970..476fac21e 100644 --- a/Engine/lib/sdl/test/testshape.c +++ b/Engine/lib/sdl/test/testshape.c @@ -71,6 +71,10 @@ int main(int argc,char** argv) num_pictures = argc - 1; pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture)*num_pictures); + if (!pictures) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory."); + exit(1); + } for(i=0;inum_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + } #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); @@ -122,7 +129,6 @@ main(int argc, char *argv[]) if (!state) { return 1; } - state->skip_renderer = SDL_TRUE; for (i = 1; i < argc;) { int consumed; @@ -140,6 +146,12 @@ main(int argc, char *argv[]) quit(2); } + for (i = 0; i < state->num_windows; ++i) { + SDL_Renderer *renderer = state->renderers[i]; + SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); + SDL_RenderClear(renderer); + } + /* Main render loop */ done = 0; #ifdef __EMSCRIPTEN__ diff --git a/Engine/lib/sdl/test/torturethread.c b/Engine/lib/sdl/test/torturethread.c index 5719a7195..6b98a0a9f 100644 --- a/Engine/lib/sdl/test/torturethread.c +++ b/Engine/lib/sdl/test/torturethread.c @@ -21,7 +21,7 @@ #define NUMTHREADS 10 -static char volatile time_for_threads_to_die[NUMTHREADS]; +static SDL_atomic_t time_for_threads_to_die[NUMTHREADS]; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -58,7 +58,7 @@ ThreadFunc(void *data) } SDL_Log("Thread '%d' waiting for signal\n", tid); - while (time_for_threads_to_die[tid] != 1) { + while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) { ; /* do nothing */ } @@ -92,7 +92,7 @@ main(int argc, char *argv[]) for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i); - time_for_threads_to_die[i] = 0; + SDL_AtomicSet(&time_for_threads_to_die[i], 0); threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i); if (threads[i] == NULL) { @@ -102,7 +102,7 @@ main(int argc, char *argv[]) } for (i = 0; i < NUMTHREADS; i++) { - time_for_threads_to_die[i] = 1; + SDL_AtomicSet(&time_for_threads_to_die[i], 1); } for (i = 0; i < NUMTHREADS; i++) { diff --git a/Engine/source/.gitattributes b/Engine/source/.gitattributes new file mode 100644 index 000000000..abf67ea1d --- /dev/null +++ b/Engine/source/.gitattributes @@ -0,0 +1,5 @@ +*.cpp filter=tabspace +*.h filter=tabspace +*.l filter=tabspace +*.y filter=tabspace +*.mm filter=tabspace diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index a8220a545..02378671b 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -640,6 +640,7 @@ if (APPLE) addFramework("CoreVideo") #grrr damn you sdl! addFramework("Carbon") + addFramework("AudioToolbox") addLib("iconv") #set a few arch defaults set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "OSX Architecture" FORCE) From f0996f8c84bfdbe61c10beb6b4836d6bca5863d1 Mon Sep 17 00:00:00 2001 From: "Thomas \"elfprince13\" Dickerson" Date: Fri, 10 Mar 2017 20:01:56 -0500 Subject: [PATCH 21/21] typo fix --- Engine/source/module/moduleDefinition.cpp | 4 ++-- Engine/source/module/moduleDefinition.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/module/moduleDefinition.cpp b/Engine/source/module/moduleDefinition.cpp index 093d90e59..523dffe02 100644 --- a/Engine/source/module/moduleDefinition.cpp +++ b/Engine/source/module/moduleDefinition.cpp @@ -51,7 +51,7 @@ mModuleId(StringTable->EmptyString()), mSynchronized( false ), mDeprecated( false ), mCriticalMerge( false ), - mOverrideExitingObjects(false), + mOverrideExistingObjects(false), mModuleDescription( StringTable->EmptyString() ), mAuthor(StringTable->EmptyString()), mModuleGroup(StringTable->EmptyString()), @@ -92,7 +92,7 @@ void ModuleDefinition::initPersistFields() addProtectedField( "Synchronized", TypeBool, Offset(mSynchronized, ModuleDefinition), &setSynchronized, &defaultProtectedGetFn, &writeSynchronized, "Whether the module should be synchronized or not. Optional: If not specified then the module is not synchronized." ); addProtectedField( "Deprecated", TypeBool, Offset(mDeprecated, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeDeprecated, "Whether the module is deprecated or not. Optional: If not specified then the module is not deprecated." ); addProtectedField( "CriticalMerge", TypeBool, Offset(mCriticalMerge, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeCriticalMerge, "Whether the merging of a module prior to a restart is critical or not. Optional: If not specified then the module is not merge critical." ); - addProtectedField( "OverrideExistingObjects", TypeBool, Offset(mOverrideExitingObjects, ModuleDefinition), &setOverrideExistingObjects, &defaultProtectedGetFn, &writeOverrideExistingObjects, "Controls if when this module is loaded and the create function is executed, it will replace existing objects that share names or not."); + addProtectedField( "OverrideExistingObjects", TypeBool, Offset(mOverrideExistingObjects, ModuleDefinition), &setOverrideExistingObjects, &defaultProtectedGetFn, &writeOverrideExistingObjects, "Controls if when this module is loaded and the create function is executed, it will replace existing objects that share names or not."); addProtectedField( "Description", TypeString, Offset(mModuleDescription, ModuleDefinition), &setModuleDescription, &defaultProtectedGetFn, &writeModuleDescription, "The description typically used for debugging purposes but can be used for anything." ); addProtectedField( "Author", TypeString, Offset(mAuthor, ModuleDefinition), &setAuthor, &defaultProtectedGetFn, &writeAuthor, "The author of the module." ); addProtectedField( "Group", TypeString, Offset(mModuleGroup, ModuleDefinition), &setModuleGroup, &defaultProtectedGetFn, "The module group used typically when loading modules as a group." ); diff --git a/Engine/source/module/moduleDefinition.h b/Engine/source/module/moduleDefinition.h index 30c089637..2ebb3f99a 100644 --- a/Engine/source/module/moduleDefinition.h +++ b/Engine/source/module/moduleDefinition.h @@ -89,7 +89,7 @@ private: bool mSynchronized; bool mDeprecated; bool mCriticalMerge; - bool mOverrideExitingObjects; + bool mOverrideExistingObjects; StringTableEntry mModuleDescription; StringTableEntry mAuthor;; StringTableEntry mModuleGroup; @@ -142,8 +142,8 @@ public: inline bool getDeprecated( void ) const { return mDeprecated; } inline void setCriticalMerge( const bool mergeCritical ) { if ( checkUnlocked() ) { mCriticalMerge = mergeCritical; } } inline bool getCriticalMerge( void ) const { return mCriticalMerge; } - inline void setOverrideExistingObjects(const bool overrideExistingObj) { if (checkUnlocked()) { mOverrideExitingObjects = overrideExistingObj; } } - inline bool getOverrideExistingObjects(void) const { return mOverrideExitingObjects; } + inline void setOverrideExistingObjects(const bool overrideExistingObj) { if (checkUnlocked()) { mOverrideExistingObjects = overrideExistingObj; } } + inline bool getOverrideExistingObjects(void) const { return mOverrideExistingObjects; } inline void setModuleDescription( const char* pModuleDescription ) { if ( checkUnlocked() ) { mModuleDescription = StringTable->insert(pModuleDescription); } } inline StringTableEntry getModuleDescription( void ) const { return mModuleDescription; } inline void setAuthor( const char* pAuthor ) { if ( checkUnlocked() ) { mAuthor = StringTable->insert(pAuthor); } }