From d3b094e1b5ee902e66b612e149d9e1c59e472b35 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 18 Jun 2010 03:12:58 +0200 Subject: [PATCH] Removed spaces at end of lines in source files. No actual content was changed in this commit. --- src/FastDelegate.h | 310 +++++++++++++++++++++---------------------- src/cpu.cpp | 32 ++--- src/cpu.h | 4 +- src/gmenu2x.cpp | 14 +- src/inputmanager.cpp | 4 +- src/jz4740.h | 30 ++--- src/linkapp.cpp | 2 +- src/messagebox.cpp | 8 +- 8 files changed, 202 insertions(+), 202 deletions(-) diff --git a/src/FastDelegate.h b/src/FastDelegate.h index 271a070..a0a3150 100644 --- a/src/FastDelegate.h +++ b/src/FastDelegate.h @@ -1,11 +1,11 @@ -// FastDelegate.h +// FastDelegate.h // Efficient delegates in C++ that generate only two lines of asm code! // Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp // // - Don Clugston, Mar 2004. // Major contributions were made by Jody Hagins. // History: -// 24-Apr-04 1.0 * Submitted to CodeProject. +// 24-Apr-04 1.0 * Submitted to CodeProject. // 28-Apr-04 1.1 * Prevent most unsafe uses of evil static function hack. // * Improved syntax for horrible_cast (thanks Paul Bludov). // * Tested on Metrowerks MWCC and Intel ICL (IA32) @@ -13,7 +13,7 @@ // 27-Jun-04 1.2 * Now works on Borland C++ Builder 5.5 // * Now works on /clr "managed C++" code on VC7, VC7.1 // * Comeau C++ now compiles without warnings. -// * Prevent the virtual inheritance case from being used on +// * Prevent the virtual inheritance case from being used on // VC6 and earlier, which generate incorrect code. // * Improved warning and error messages. Non-standard hacks // now have compile-time checks to make them safer. @@ -37,7 +37,7 @@ // * Standardised all the compiler-specific workarounds. // * MFP conversion now works for CodePlay (but not yet supported in the full code). // * Now compiles without warnings on _any_ supported compiler, including BCC 5.5.1 -// * New syntax: FastDelegate< int (char *, double) >. +// * New syntax: FastDelegate< int (char *, double) >. // 14-Feb-05 1.4.1* Now treats =0 as equivalent to .clear(), ==0 as equivalent to .empty(). (Thanks elfric). // * Now tested on Intel ICL for AMD64, VS2005 Beta for AMD64 and Itanium. // 30-Mar-05 1.5 * Safebool idiom: "if (dg)" is now equivalent to "if (!dg.empty())" @@ -61,7 +61,7 @@ // Uncomment the following #define for optimally-sized delegates. // In this case, the generated asm code is almost identical to the code you'd get // if the compiler had native support for delegates. -// It will not work on systems where sizeof(dataptr) < sizeof(codeptr). +// It will not work on systems where sizeof(dataptr) < sizeof(codeptr). // Thus, it will not work for DOS compilers using the medium model. // It will also probably fail on some DSP systems. #define FASTDELEGATE_USESTATICFUNCTIONHACK @@ -89,7 +89,7 @@ // Does the compiler uses Microsoft's member function pointer structure? // If so, it needs special treatment. -// Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's +// Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's // identifier, _MSC_VER. We need to filter Metrowerks out. #if defined(_MSC_VER) && !defined(__MWERKS__) #define FASTDLGT_MICROSOFT_MFP @@ -115,7 +115,7 @@ #define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX #endif -#ifdef __GNUC__ // Workaround GCC bug #8271 +#ifdef __GNUC__ // Workaround GCC bug #8271 // At present, GCC doesn't recognize constness of MFPs in templates #define FASTDELEGATE_GCC_BUG_8271 #endif @@ -143,10 +143,10 @@ namespace fastdelegate { namespace detail { // we'll hide the implementation details in a nested namespace. // implicit_cast< > -// I believe this was originally going to be in the C++ standard but +// I believe this was originally going to be in the C++ standard but // was left out by accident. It's even milder than static_cast. // I use it instead of static_cast<> to emphasize that I'm not doing -// anything nasty. +// anything nasty. // Usage is identical to static_cast<> template inline OutputClass implicit_cast(InputClass input){ @@ -154,11 +154,11 @@ inline OutputClass implicit_cast(InputClass input){ } // horrible_cast< > -// This is truly evil. It completely subverts C++'s type system, allowing you -// to cast from any class to any other class. Technically, using a union +// This is truly evil. It completely subverts C++'s type system, allowing you +// to cast from any class to any other class. Technically, using a union // to perform the cast is undefined behaviour (even in C). But we can see if // it is OK by checking that the union is the same size as each of its members. -// horrible_cast<> should only be used for compiler-specific workarounds. +// horrible_cast<> should only be used for compiler-specific workarounds. // Usage is identical to reinterpret_cast<>. // This union is declared outside the horrible_cast because BCC 5.5.1 @@ -175,7 +175,7 @@ inline OutputClass horrible_cast(const InputClass input){ // Cause a compile-time error if in, out and u are not the same size. // If the compile fails here, it means the compiler has peculiar // unions which would prevent the cast from working. - typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u) + typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u) && sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1]; u.in = input; return u.out; @@ -206,9 +206,9 @@ inline OutputClass horrible_cast(const InputClass input){ // Workaround for (2): On VC6, the code for calling a void function is // identical to the code for calling a non-void function in which the // return value is never used, provided the return value is returned -// in the EAX register, rather than on the stack. +// in the EAX register, rather than on the stack. // This is true for most fundamental types such as int, enum, void *. -// Const void * is the safest option since it doesn't participate +// Const void * is the safest option since it doesn't participate // in any automatic conversions. But on a 16-bit compiler it might // cause extra code to be generated, so we disable it for all compilers // except for VC6 (and VC5). @@ -254,15 +254,15 @@ struct VoidToDefaultVoid { typedef DefaultVoid type; }; #ifdef FASTDLGT_MICROSOFT_MFP #ifdef FASTDLGT_HASINHERITANCE_KEYWORDS - // For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP - // (4 bytes), even when the /vmg option is used. Declaring an empty class + // For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP + // (4 bytes), even when the /vmg option is used. Declaring an empty class // would give 16 byte pointers in this case.... class __single_inheritance GenericClass; #endif // ...but for Codeplay, an empty class *always* gives 4 byte pointers. // If compiled with the /clr option ("managed C++"), the JIT compiler thinks // it needs to load GenericClass before it can call any of its functions, - // (compiles OK but crashes at runtime!), so we need to declare an + // (compiles OK but crashes at runtime!), so we need to declare an // empty class to make it happy. // Codeplay and VC4 can't cope with the unknown_inheritance case either. class GenericClass {}; @@ -275,41 +275,41 @@ const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)()); // SimplifyMemFunc< >::Convert() // -// A template function that converts an arbitrary member function pointer into the +// A template function that converts an arbitrary member function pointer into the // simplest possible form of member function pointer, using a supplied 'this' pointer. // According to the standard, this can be done legally with reinterpret_cast<>. -// For (non-standard) compilers which use member function pointers which vary in size -// depending on the class, we need to use knowledge of the internal structure of a +// For (non-standard) compilers which use member function pointers which vary in size +// depending on the class, we need to use knowledge of the internal structure of a // member function pointer, as used by the compiler. Template specialization is used -// to distinguish between the sizes. Because some compilers don't support partial +// to distinguish between the sizes. Because some compilers don't support partial // template specialisation, I use full specialisation of a wrapper struct. // general case -- don't know how to convert it. Force a compile failure template struct SimplifyMemFunc { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, - GenericMemFuncType &bound_func) { + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { // Unsupported member function type -- force a compile failure. // (it's illegal to have a array with negative size). typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N-100]; - return 0; + return 0; } }; // For compilers where all member func ptrs are the same size, everything goes here. // For non-standard compilers, only single_inheritance classes go here. template <> -struct SimplifyMemFunc { +struct SimplifyMemFunc { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func) { -#if defined __DMC__ - // Digital Mars doesn't allow you to cast between abitrary PMF's, +#if defined __DMC__ + // Digital Mars doesn't allow you to cast between abitrary PMF's, // even though the standard says you can. The 32-bit compiler lets you // static_cast through an int, but the DOS compiler doesn't. bound_func = horrible_cast(function_to_bind); -#else +#else bound_func = reinterpret_cast(function_to_bind); #endif return reinterpret_cast(pthis); @@ -337,13 +337,13 @@ struct SimplifyMemFunc { template<> struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, - GenericMemFuncType &bound_func) { + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + GenericMemFuncType &bound_func) { // We need to use a horrible_cast to do this conversion. // In MSVC, a multiple inheritance member pointer is internally defined as: union { XFuncType func; - struct { + struct { GenericMemFuncType funcaddress; // points to the actual member function int delta; // #BYTES to be added to the 'this' pointer }s; @@ -352,7 +352,7 @@ struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > { typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s)? 1 : -1]; u.func = function_to_bind; bound_func = u.s.funcaddress; - return reinterpret_cast(reinterpret_cast(pthis) + u.s.delta); + return reinterpret_cast(reinterpret_cast(pthis) + u.s.delta); } }; @@ -361,10 +361,10 @@ struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > { // enable conversion to a closure pointer. Earlier versions of this code didn't // work for all cases, and generated a compile-time error instead. // But a very clever hack invented by John M. Dlugosz solves this problem. -// My code is somewhat different to his: I have no asm code, and I make no +// My code is somewhat different to his: I have no asm code, and I make no // assumptions about the calling convention that is used. -// In VC++ and ICL, a virtual_inheritance member pointer +// In VC++ and ICL, a virtual_inheritance member pointer // is internally defined as: struct MicrosoftVirtualMFP { void (GenericClass::*codeptr)(); // points to the actual member function @@ -392,7 +392,7 @@ struct SimplifyMemFunc { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func) { union { XFuncType func; @@ -409,7 +409,7 @@ struct SimplifyMemFunc typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind)==sizeof(u.s) && sizeof(function_to_bind)==sizeof(u.ProbeFunc) && sizeof(u2.virtfunc)==sizeof(u2.s) ? 1 : -1]; - // Unfortunately, taking the address of a MF prevents it from being inlined, so + // Unfortunately, taking the address of a MF prevents it from being inlined, so // this next line can't be completely optimised away by the compiler. u2.virtfunc = &GenericVirtualClass::GetThis; u.s.codeptr = u2.s.codeptr; @@ -426,55 +426,55 @@ template <> struct SimplifyMemFunc { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func) { // There is an apalling but obscure compiler bug in MSVC6 and earlier: - // vtable_index and 'vtordisp' are always set to 0 in the + // vtable_index and 'vtordisp' are always set to 0 in the // unknown_inheritance case! // This means that an incorrect function could be called!!! // Compiling with the /vmg option leads to potentially incorrect code. // This is probably the reason that the IDE has a user interface for specifying - // the /vmg option, but it is disabled - you can only specify /vmg on + // the /vmg option, but it is disabled - you can only specify /vmg on // the command line. In VC1.5 and earlier, the compiler would ICE if it ever // encountered this situation. // It is OK to use the /vmg option if /vmm or /vms is specified. // Fortunately, the wrong function is only called in very obscure cases. - // It only occurs when a derived class overrides a virtual function declared - // in a virtual base class, and the member function + // It only occurs when a derived class overrides a virtual function declared + // in a virtual base class, and the member function // points to the *Derived* version of that function. The problem can be - // completely averted in 100% of cases by using the *Base class* for the + // completely averted in 100% of cases by using the *Base class* for the // member fpointer. Ie, if you use the base class as an interface, you'll // stay out of trouble. // Occasionally, you might want to point directly to a derived class function - // that isn't an override of a base class. In this case, both vtable_index + // that isn't an override of a base class. In this case, both vtable_index // and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated. // We can generate correct code in this case. To prevent an incorrect call from - // ever being made, on MSVC6 we generate a warning, and call a function to - // make the program crash instantly. + // ever being made, on MSVC6 we generate a warning, and call a function to + // make the program crash instantly. typedef char ERROR_VC6CompilerBug[-100]; - return 0; + return 0; } }; -#else +#else // Nasty hack for Microsoft and Intel (IA32 and Itanium) -// unknown_inheritance classes go here +// unknown_inheritance classes go here // This is probably the ugliest bit of code I've ever written. Look at the casts! // There is a compiler bug in MSVC6 which prevents it from using this code. template <> struct SimplifyMemFunc { template - inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, + inline static GenericClass *Convert(X *pthis, XFuncType function_to_bind, GenericMemFuncType &bound_func) { // The member function pointer is 16 bytes long. We can't use a normal cast, but // we can use a union to do the conversion. union { XFuncType func; - // In VC++ and ICL, an unknown_inheritance member pointer + // In VC++ and ICL, an unknown_inheritance member pointer // is internally defined as: struct { GenericMemFuncType m_funcaddress; // points to the actual member function @@ -489,13 +489,13 @@ struct SimplifyMemFunc bound_func = u.s.funcaddress; int virtual_delta = 0; if (u.s.vtable_index) { // Virtual inheritance is used - // First, get to the vtable. + // First, get to the vtable. // It is 'vtordisp' bytes from the start of the class. const int * vtable = *reinterpret_cast( reinterpret_cast(pthis) + u.s.vtordisp ); // 'vtable_index' tells us where in the table we should be looking. - virtual_delta = u.s.vtordisp + *reinterpret_cast( + virtual_delta = u.s.vtordisp + *reinterpret_cast( reinterpret_cast(vtable) + u.s.vtable_index); } // The int at 'virtual_delta' gives us the amount to add to 'this'. @@ -521,7 +521,7 @@ struct SimplifyMemFunc // It knows nothing about the calling convention or number of arguments used by // the function pointed to. // It supplies comparison operators so that it can be stored in STL collections. -// It cannot be set to anything other than null, nor invoked directly: +// It cannot be set to anything other than null, nor invoked directly: // it must be converted to a specific delegate. // Implementation: @@ -529,14 +529,14 @@ struct SimplifyMemFunc // DelegateMemento - Safe version // // This implementation is standard-compliant, but a bit tricky. -// A static function pointer is stored inside the class. +// A static function pointer is stored inside the class. // Here are the valid values: // +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+ // | 0 | 0 | 0 | Empty | // | !=0 |(dontcare)| Invoker | Static function| // | 0 | !=0 | !=0* | Method call | // +--------------------+----------+------------+----------------+ -// * For Metrowerks, this can be 0. (first virtual function in a +// * For Metrowerks, this can be 0. (first virtual function in a // single_inheritance class). // When stored stored inside a specific delegate, the 'dontcare' entries are replaced // with a reference to the delegate itself. This complicates the = and == operators @@ -544,20 +544,20 @@ struct SimplifyMemFunc // DelegateMemento - Evil version // -// For compilers where data pointers are at least as big as code pointers, it is -// possible to store the function pointer in the this pointer, using another +// For compilers where data pointers are at least as big as code pointers, it is +// possible to store the function pointer in the this pointer, using another // horrible_cast. In this case the DelegateMemento implementation is simple: // +--pThis --+-- pMemFunc-+-- Meaning---------------------+ // | 0 | 0 | Empty | // | !=0 | !=0* | Static function or method call| // +----------+------------+-------------------------------+ -// * For Metrowerks, this can be 0. (first virtual function in a +// * For Metrowerks, this can be 0. (first virtual function in a // single_inheritance class). -// Note that the Sun C++ and MSVC documentation explicitly state that they +// Note that the Sun C++ and MSVC documentation explicitly state that they // support static_cast between void * and function pointers. class DelegateMemento { -protected: +protected: // the data is protected, not private, because many // compilers have problems with template friends. typedef void (detail::GenericClass::*GenericMemFuncType)(); // arbitrary MFP. @@ -598,11 +598,11 @@ public: inline bool IsLess(const DelegateMemento &right) const { // deal with static function pointers first #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) - if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0) + if (m_pStaticFunction !=0 || right.m_pStaticFunction!=0) return m_pStaticFunction < right.m_pStaticFunction; #endif if (m_pthis !=right.m_pthis) return m_pthis < right.m_pthis; - // There are no ordering operators for member function pointers, + // There are no ordering operators for member function pointers, // but we can fake one by comparing each byte. The resulting ordering is // arbitrary (and compiler-dependent), but it permits storage in ordered STL containers. return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0; @@ -617,7 +617,7 @@ public: { return m_pthis==0 && m_pFunction==0; } public: DelegateMemento & operator = (const DelegateMemento &right) { - SetMementoFrom(right); + SetMementoFrom(right); return *this; } inline bool operator <(const DelegateMemento &right) { @@ -626,7 +626,7 @@ public: inline bool operator >(const DelegateMemento &right) { return right.IsLess(*this); } - DelegateMemento (const DelegateMemento &right) : + DelegateMemento (const DelegateMemento &right) : m_pFunction(right.m_pFunction), m_pthis(right.m_pthis) #if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK) , m_pStaticFunction (right.m_pStaticFunction) @@ -648,8 +648,8 @@ protected: // A private wrapper class that adds function signatures to DelegateMemento. // It's the class that does most of the actual work. // The signatures are specified by: -// GenericMemFunc: must be a type of GenericClass member function pointer. -// StaticFuncPtr: must be a type of function pointer with the same signature +// GenericMemFunc: must be a type of GenericClass member function pointer. +// StaticFuncPtr: must be a type of function pointer with the same signature // as GenericMemFunc. // UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6 // where it never returns void (returns DefaultVoid instead). @@ -665,8 +665,8 @@ class ClosurePtr : public DelegateMemento { public: // These functions are for setting the delegate to a member function. - // Here's the clever bit: we convert an arbitrary member function into a - // standard form. XMemFunc should be a member function of class X, but I can't + // Here's the clever bit: we convert an arbitrary member function into a + // standard form. XMemFunc should be a member function of class X, but I can't // enforce that here. It needs to be enforced by the wrapper class. template < class X, class XMemFunc > inline void bindmemfunc(X *pthis, XMemFunc function_to_bind ) { @@ -677,7 +677,7 @@ public: #endif } // For const member functions, we only need a const class pointer. - // Since we know that the member function is const, it's safe to + // Since we know that the member function is const, it's safe to // remove the const qualifier from the 'this' pointer with a const_cast. // VC6 has problems if we just overload 'bindmemfunc', so we give it a different name. template < class X, class XMemFunc> @@ -727,55 +727,55 @@ public: m_pthis=reinterpret_cast(pParent); } } - // For static functions, the 'static_function_invoker' class in the parent - // will be called. The parent then needs to call GetStaticFunction() to find out + // For static functions, the 'static_function_invoker' class in the parent + // will be called. The parent then needs to call GetStaticFunction() to find out // the actual function to invoke. template < class DerivedClass, class ParentInvokerSig > - inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, + inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, StaticFuncPtr function_to_bind ) { if (function_to_bind==0) { // cope with assignment to 0 m_pFunction=0; - } else { + } else { bindmemfunc(pParent, static_function_invoker); } m_pStaticFunction=reinterpret_cast(function_to_bind); } - inline UnvoidStaticFuncPtr GetStaticFunction() const { - return reinterpret_cast(m_pStaticFunction); + inline UnvoidStaticFuncPtr GetStaticFunction() const { + return reinterpret_cast(m_pStaticFunction); } #else // ClosurePtr<> - Evil version // -// For compilers where data pointers are at least as big as code pointers, it is -// possible to store the function pointer in the this pointer, using another +// For compilers where data pointers are at least as big as code pointers, it is +// possible to store the function pointer in the this pointer, using another // horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and // speeds up comparison and assignment. If C++ provided direct language support // for delegates, they would produce asm code that was almost identical to this. -// Note that the Sun C++ and MSVC documentation explicitly state that they +// Note that the Sun C++ and MSVC documentation explicitly state that they // support static_cast between void * and function pointers. template< class DerivedClass > inline void CopyFrom (DerivedClass *pParent, const DelegateMemento &right) { SetMementoFrom(right); } - // For static functions, the 'static_function_invoker' class in the parent - // will be called. The parent then needs to call GetStaticFunction() to find out + // For static functions, the 'static_function_invoker' class in the parent + // will be called. The parent then needs to call GetStaticFunction() to find out // the actual function to invoke. // ******** EVIL, EVIL CODE! ******* template < class DerivedClass, class ParentInvokerSig> - inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, + inline void bindstaticfunc(DerivedClass *pParent, ParentInvokerSig static_function_invoker, StaticFuncPtr function_to_bind) { if (function_to_bind==0) { // cope with assignment to 0 m_pFunction=0; - } else { + } else { // We'll be ignoring the 'this' pointer, but we need to make sure we pass // a valid value to bindmemfunc(). bindmemfunc(pParent, static_function_invoker); } // WARNING! Evil hack. We store the function in the 'this' pointer! - // Ensure that there's a compilation failure if function pointers + // Ensure that there's a compilation failure if function pointers // and data pointers have different sizes. // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass *)==sizeof(function_to_bind) ? 1 : -1]; @@ -790,7 +790,7 @@ public: // We're just returning the 'this' pointer, converted into // a function pointer! inline UnvoidStaticFuncPtr GetStaticFunction() const { - // Ensure that there's a compilation failure if function pointers + // Ensure that there's a compilation failure if function pointers // and data pointers have different sizes. // If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK. typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr)==sizeof(this) ? 1 : -1]; @@ -800,7 +800,7 @@ public: // Does the closure contain this static function? inline bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr){ - if (funcptr==0) return empty(); + if (funcptr==0) return empty(); // For the Evil method, if it doesn't actually contain a static function, this will return an arbitrary // value that is not equal to any valid function pointer. else return funcptr==reinterpret_cast(GetStaticFunction()); @@ -819,7 +819,7 @@ public: // Once we have the member function conversion templates, it's easy to make the -// wrapper classes. So that they will work with as many compilers as possible, +// wrapper classes. So that they will work with as many compilers as possible, // the classes are of the form // FastDelegate3 // They can cope with any combination of parameters. The max number of parameters @@ -830,7 +830,7 @@ public: // Because of the weird rule about the class of derived member function pointers, // you sometimes need to apply a downcast to the 'this' pointer. -// This is the reason for the use of "implicit_cast(pthis)" in the code below. +// This is the reason for the use of "implicit_cast(pthis)" in the code below. // If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction, // without this trick you'd need to write: // MyDelegate(static_cast(&d), &CDerivedClass::SimpleVirtualFunction); @@ -899,7 +899,7 @@ public: void operator = (DesiredRetType (*function_to_bind)() ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)()) { - m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() () const { @@ -918,7 +918,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -984,7 +984,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1)) { - m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1) const { @@ -1003,7 +1003,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1069,7 +1069,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2)) { - m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2) const { @@ -1088,7 +1088,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1154,7 +1154,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) { - m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3) const { @@ -1173,7 +1173,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1239,7 +1239,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { - m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const { @@ -1258,7 +1258,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1324,7 +1324,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { - m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const { @@ -1343,7 +1343,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1409,7 +1409,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { - m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const { @@ -1428,7 +1428,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1494,7 +1494,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { - m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const { @@ -1513,7 +1513,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1579,7 +1579,7 @@ public: void operator = (DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) ) { bind(function_to_bind); } inline void bind(DesiredRetType (*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { - m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction, + m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction, function_to_bind); } // Invoke the delegate RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const { @@ -1598,7 +1598,7 @@ public: // necessary to allow ==0 to work despite the safe_bool idiom inline bool operator==(StaticFunctionPtr funcptr) { return m_Closure.IsEqualToStaticFuncPtr(funcptr); } - inline bool operator!=(StaticFunctionPtr funcptr) { + inline bool operator!=(StaticFunctionPtr funcptr) { return !m_Closure.IsEqualToStaticFuncPtr(funcptr); } inline bool operator ! () const { // Is it bound to anything? return !m_Closure; } @@ -1617,7 +1617,7 @@ private: // Invoker for static functions //////////////////////////////////////////////////////////////////////////////// // Fast Delegates, part 4: -// +// // FastDelegate<> class (Original author: Jody Hagins) // Allows boost::function style syntax like: // FastDelegate< double (int, long) > @@ -1636,7 +1636,7 @@ class FastDelegate; //N=0 // Specialization to allow use of // FastDelegate< R ( ) > -// instead of +// instead of // FastDelegate0 < R > template class FastDelegate< R ( ) > @@ -1654,7 +1654,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( )) : BaseType(pthis, function_to_bind) { } @@ -1666,14 +1666,14 @@ public: FastDelegate(R (*function_to_bind)( )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=1 // Specialization to allow use of // FastDelegate< R ( Param1 ) > -// instead of +// instead of // FastDelegate1 < Param1, R > template class FastDelegate< R ( Param1 ) > @@ -1691,7 +1691,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1 )) : BaseType(pthis, function_to_bind) { } @@ -1703,14 +1703,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=2 // Specialization to allow use of // FastDelegate< R ( Param1, Param2 ) > -// instead of +// instead of // FastDelegate2 < Param1, Param2, R > template class FastDelegate< R ( Param1, Param2 ) > @@ -1728,7 +1728,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2 )) : BaseType(pthis, function_to_bind) { } @@ -1740,14 +1740,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=3 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3 ) > -// instead of +// instead of // FastDelegate3 < Param1, Param2, Param3, R > template class FastDelegate< R ( Param1, Param2, Param3 ) > @@ -1765,7 +1765,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )) : BaseType(pthis, function_to_bind) { } @@ -1777,14 +1777,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=4 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3, Param4 ) > -// instead of +// instead of // FastDelegate4 < Param1, Param2, Param3, Param4, R > template class FastDelegate< R ( Param1, Param2, Param3, Param4 ) > @@ -1802,7 +1802,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )) : BaseType(pthis, function_to_bind) { } @@ -1814,14 +1814,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=5 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) > -// instead of +// instead of // FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > template class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) > @@ -1839,7 +1839,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )) : BaseType(pthis, function_to_bind) { } @@ -1851,14 +1851,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=6 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) > -// instead of +// instead of // FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > template class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) > @@ -1876,7 +1876,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )) : BaseType(pthis, function_to_bind) { } @@ -1888,14 +1888,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=7 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) > -// instead of +// instead of // FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > template class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) > @@ -1913,7 +1913,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )) : BaseType(pthis, function_to_bind) { } @@ -1925,14 +1925,14 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; //N=8 // Specialization to allow use of // FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) > -// instead of +// instead of // FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > template class FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) > @@ -1950,7 +1950,7 @@ public: FastDelegate() : BaseType() { } template < class X, class Y > - FastDelegate(Y * pthis, + FastDelegate(Y * pthis, R (X::* function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )) : BaseType(pthis, function_to_bind) { } @@ -1962,7 +1962,7 @@ public: FastDelegate(R (*function_to_bind)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 )) : BaseType(function_to_bind) { } - void operator = (const BaseType &x) { + void operator = (const BaseType &x) { *static_cast(this) = x; } }; @@ -1980,7 +1980,7 @@ public: // //////////////////////////////////////////////////////////////////////////////// -// Also declare overloads of a MakeDelegate() global function to +// Also declare overloads of a MakeDelegate() global function to // reduce the need for typedefs. // We need seperate overloads for const and non-const member functions. // Also, because of the weird rule about the class of derived member function pointers, @@ -1995,106 +1995,106 @@ public: #ifdef FASTDLGT_VC6 #define FASTDLGT_RETTYPE detail::VoidToDefaultVoid::type -#else +#else #define FASTDLGT_RETTYPE RetType #endif //N=0 template -FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)()) { +FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)()) { return FastDelegate0(x, func); } template -FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)() const) { +FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)() const) { return FastDelegate0(x, func); } //N=1 template -FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) { +FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) { return FastDelegate1(x, func); } template -FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) { +FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1) const) { return FastDelegate1(x, func); } //N=2 template -FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) { +FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) { return FastDelegate2(x, func); } template -FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) { +FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2) const) { return FastDelegate2(x, func); } //N=3 template -FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) { +FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) { return FastDelegate3(x, func); } template -FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) { +FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3) const) { return FastDelegate3(x, func); } //N=4 template -FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { +FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { return FastDelegate4(x, func); } template -FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) { +FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) { return FastDelegate4(x, func); } //N=5 template -FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { +FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { return FastDelegate5(x, func); } template -FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) { +FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) { return FastDelegate5(x, func); } //N=6 template -FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { +FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { return FastDelegate6(x, func); } template -FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) { +FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) { return FastDelegate6(x, func); } //N=7 template -FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { +FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { return FastDelegate7(x, func); } template -FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) { +FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) { return FastDelegate7(x, func); } //N=8 template -FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { +FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { return FastDelegate8(x, func); } template -FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) { +FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) { return FastDelegate8(x, func); } diff --git a/src/cpu.cpp b/src/cpu.cpp index 873fb2c..5b30ae6 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -9,18 +9,18 @@ inline int sdram_convert(unsigned int pllin,unsigned int *sdram_freq) { register unsigned int ns, tmp; - + ns = 1000000000 / pllin; /* Set refresh registers */ tmp = SDRAM_TREF/ns; tmp = tmp/64 + 1; if (tmp > 0xff) tmp = 0xff; - *sdram_freq = tmp; + *sdram_freq = tmp; return 0; } - + void pll_init(unsigned int clock) { register unsigned int cfcr, plcr1; @@ -35,8 +35,8 @@ void pll_init(unsigned int clock) int nf, pllout2; cfcr = CPM_CPCCR_CLKOEN | - (n2FR[div[0]] << CPM_CPCCR_CDIV_BIT) | - (n2FR[div[1]] << CPM_CPCCR_HDIV_BIT) | + (n2FR[div[0]] << CPM_CPCCR_CDIV_BIT) | + (n2FR[div[1]] << CPM_CPCCR_HDIV_BIT) | (n2FR[div[2]] << CPM_CPCCR_PDIV_BIT) | (n2FR[div[3]] << CPM_CPCCR_MDIV_BIT) | (n2FR[div[4]] << CPM_CPCCR_LDIV_BIT); @@ -52,44 +52,44 @@ void pll_init(unsigned int clock) (0 << CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */ (0 << CPM_CPPCR_PLLOD_BIT) | /* OD=0, NO=1 */ (0x20 << CPM_CPPCR_PLLST_BIT) | /* PLL stable time */ - CPM_CPPCR_PLLEN; /* enable PLL */ + CPM_CPPCR_PLLEN; /* enable PLL */ /* init PLL */ // REG_CPM_CPCCR = cfcr; // REG_CPM_CPPCR = plcr1; jz_cpmregl[0] = cfcr; jz_cpmregl[0x10>>2] = plcr1; - + sdram_convert(clock,&sdramclock); if(sdramclock > 0) { // REG_EMC_RTCOR = sdramclock; -// REG_EMC_RTCNT = sdramclock; +// REG_EMC_RTCNT = sdramclock; jz_emcregs[0x8C>>1] = sdramclock; - jz_emcregs[0x88>>1] = sdramclock; + jz_emcregs[0x88>>1] = sdramclock; }else { printf("sdram init fail!\n"); while(1); - } - + } + } -void jz_cpuspeed(unsigned clockspeed) +void jz_cpuspeed(unsigned clockspeed) { if (clockspeed >= 200 && clockspeed <= 430) { - jz_dev = open("/dev/mem", O_RDWR); + jz_dev = open("/dev/mem", O_RDWR); if(jz_dev) { jz_cpmregl=(unsigned long *)mmap(0, 0x80, PROT_READ|PROT_WRITE, MAP_SHARED, jz_dev, 0x10000000); jz_emcregl=(unsigned long *)mmap(0, 0x90, PROT_READ|PROT_WRITE, MAP_SHARED, jz_dev, 0x13010000); jz_emcregs=(unsigned short *)jz_emcregl; pll_init(clockspeed*1000000); - munmap((void *)jz_cpmregl, 0x80); - munmap((void *)jz_emcregl, 0x90); + munmap((void *)jz_cpmregl, 0x80); + munmap((void *)jz_emcregl, 0x90); close(jz_dev); } else diff --git a/src/cpu.h b/src/cpu.h index bc2a893..19644e0 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -10,12 +10,12 @@ #define SDRAM_RCD 20 /* RAS# to CAS# Delay */ #define SDRAM_TPC 20 /* RAS# Precharge Time */ #define SDRAM_TRWL 7 /* Write Latency Time */ -#define SDRAM_TREF 15625 /* Refresh period: 4096 refresh cycles/64ms */ +#define SDRAM_TREF 15625 /* Refresh period: 4096 refresh cycles/64ms */ //#define SDRAM_TREF 7812 /* Refresh period: 8192 refresh cycles/64ms */ static unsigned long jz_dev; static volatile unsigned long *jz_cpmregl, *jz_emcregl; -volatile unsigned short *jz_emcregs; +volatile unsigned short *jz_emcregs; void jz_cpuspeed(unsigned clockspeed); void pll_init(unsigned int clock); diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index eef65e4..bb8e284 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -112,7 +112,7 @@ void GMenu2X::gp2x_deinit() { gp2x_memregs[0x290C>>1]=640; close(gp2x_mem); } - + if (f200) ts.deinit();*/ #endif if (batteryHandle) fclose(batteryHandle); @@ -743,7 +743,7 @@ void GMenu2X::setBacklight(int val) { stringstream valsstr; string valstr = ""; - if (val < 10) + if (val < 10) valsstr << "00"; else if (val < 100) valsstr << "0" ; @@ -789,7 +789,7 @@ int GMenu2X::main() { int drawn_frames = 0; string fps = ""; #endif - + IconButton btnContextMenu(this,"skin:imgs/menu.png"); btnContextMenu.setPosition(resX-38, bottomBarIconY); btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu)); @@ -880,7 +880,7 @@ int GMenu2X::main() { if(input[ACTION_A] ) helpDisplayed = ! helpDisplayed; - + if (helpDisplayed) { s->box(10,50,300,143, skinConfColors[COLOR_MESSAGE_BOX_BG]); s->rectangle( 12,52,296,helpBoxHeight, @@ -894,7 +894,7 @@ int GMenu2X::main() { s->write( font, tr["SELECT: Show contextual menu"], 20, 155 ); s->write( font, tr["START: Show options menu"], 20, 170 ); if (fwType=="open2x") s->write( font, tr["X: Toggle speaker mode"], 20, 185 ); - + } #ifdef DEBUG @@ -1841,7 +1841,7 @@ int GMenu2X::getVolume() { int basevolume = -1; mixer = open("/dev/mixer", O_RDONLY); if(mixer) - { + { if (ioctl(mixer, SOUND_MIXER_READ_VOLUME, &basevolume) == -1) { fprintf(stderr, "Failed opening mixer for read - VOLUME\n"); } @@ -1864,7 +1864,7 @@ void GMenu2X::setVolume(int vol) { } close(mixer); } - + } void GMenu2X::setVolumeScaler(int scale) { diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 16f14b8..3803682 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -130,14 +130,14 @@ void InputManager::setActionsCount(int count) { void InputManager::update() { SDL_JoystickUpdate(); - + events.clear(); SDL_Event event; while (SDL_PollEvent(&event)) { SDL_Event evcopy = event; events.push_back(evcopy); } - + Uint32 tick = SDL_GetTicks(); for (uint x=0; x> RTC_RGR_NC1HZ_BIT ) - + #define __rtc_set_nc1Hz_val(v) \ do{ \ while(!__rtc_write_ready()); \ diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 2e4fbe9..3f76ed5 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -237,7 +237,7 @@ bool LinkApp::save() { if (ivolume>0 ) f << "volume=" << ivolume << endl; //G if (igamma!=0 ) f << "gamma=" << igamma << endl; - if (ibacklight!=0 ) f << "backlight=" << ibacklight << endl; + if (ibacklight!=0 ) f << "backlight=" << ibacklight << endl; if (selectordir!="" ) f << "selectordir=" << selectordir << endl; if (selectorbrowser ) f << "selectorbrowser=true" << endl; if (selectorfilter!="" ) f << "selectorfilter=" << selectorfilter << endl; diff --git a/src/messagebox.cpp b/src/messagebox.cpp index 89c343a..fc20cb5 100644 --- a/src/messagebox.cpp +++ b/src/messagebox.cpp @@ -65,7 +65,7 @@ int MessageBox::exec() { Surface bg(gmenu2x->s); //Darken background bg.box(0, 0, gmenu2x->resX, gmenu2x->resY, 0,0,0,200); - + SDL_Rect box; box.h = gmenu2x->font->getHeight()*3 +4; box.w = gmenu2x->font->getTextWidth(text) + 24 + (gmenu2x->sc[icon] != NULL ? 37 : 0); @@ -87,9 +87,9 @@ int MessageBox::exec() { if (buttons[i] != "") { buttonPositions[i].y = box.y+box.h-4; buttonPositions[i].w = btnX; - + btnX = gmenu2x->drawButtonRight(&bg, buttonLabels[i], buttons[i], btnX, buttonPositions[i].y); - + buttonPositions[i].x = btnX; buttonPositions[i].w = buttonPositions[i].x-btnX-6; } @@ -113,7 +113,7 @@ int MessageBox::exec() { gmenu2x->input.update(); for (uint i=0; iinput[i]) result = i; - + usleep(LOOP_DELAY); }