## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# cssysdef.h File Reference

This file should be #included before any other Crystal Space header files. More...

`#include "csdef.h"`
`#include "csutil/csosdefs.h"`
`#include "csextern.h"`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <new>`

Go to the source code of this file.

## Namespaces

namespace | CS

## Classes

struct | CS::AllocPlatform

## Memory allocation override

By default, ptmalloc is used for memory allocations, for both C-style malloc/free as well as C++ new/delete. Use of ptmalloc can be disabled for the whole project by passing `--enable-ptmalloc=no` to configure or defining `CS_NO_PTMALLOC` in `include/csutil/win32/csconfig.h` for MSVC.

To disable malloc overriding for individual source files, define `CS_NO_MALLOC_OVERRIDE` before including `cssysdef.h`.

new overriding can be disabled with `CS_NO_NEW_OVERRIDE`, however, this is not recommended since it may result in mismatches between new and delete calls, where one may be overridden, while the other is not. If you need to call the platform's operator new, use operator new(size_t,const CS::AllocPlatform&).

#define | CS_NO_MALLOC_OVERRIDE
#define | CS_NO_NEW_OVERRIDE
| Until bug #146 (intrusive overriding of new and delete causing incompatibility with external projects) have been solved, this is disabled.

## Plugin namespace helpers

To avoid symbol conflicts when employing static linking, it is a good idea to put everything into a private namespace. The CS_PLUGIN_NAMESPACE_BEGIN and CS_PLUGIN_NAMESPACE_END macros help with that by putting the plugin namespace into a sub-namespace for plugins.

Use like:

     #include <...>

     CS_IMPLEMENT_PLUGIN

     CS_PLUGIN_NAMESPACE_BEGIN(MyPlugin)
     {
       ...
       MyClass::MyClass (...) { ... }
       ...
     }
     CS_PLUGIN_NAMESPACE_END(MyPlugin)

To refer to members of the namespace (e.g. for template specializations, use CS_PLUGIN_NAMESPACE_NAME.

#define | CS_PLUGIN_NAMESPACE_BEGIN(name) namespace CS_NAMESPACE_PACKAGE_NAME { namespace Plugin { namespace name
#define | CS_PLUGIN_NAMESPACE_END(name) } }
#define | CS_PLUGIN_NAMESPACE_NAME(name) CS_NAMESPACE_PACKAGE_NAME::Plugin::name

## Default Crystal Space memory allocation

Always the same memory allocation functions as internally used by Crystal Space.
void * | cs_calloc (size_t n, size_t s)
void | cs_free (void *p)
void * | cs_malloc (size_t n)
void * | cs_realloc (void *p, size_t n)

## Platform-specific memory allocation

If built with ptmalloc support, these functions can be used to explicitly call the platform's default malloc/free resp. operator new/operator delete implementations. Useful when interfacing with third party libraries.
void | operator delete (void *p, const CS::AllocPlatform &) throw ()
void | operator delete[] (void *p, const CS::AllocPlatform &) throw ()
void * | operator new (size_t s, const CS::AllocPlatform &) throw ()
| Platform-dependent operator new.
void * | operator new[] (size_t s, const CS::AllocPlatform &) throw ()
| Platform-dependent operator new.
void * | platform_calloc (size_t n, size_t s)
void | platform_free (void *p)
void * | platform_malloc (size_t n)
void * | platform_realloc (void *p, size_t n)

## ptmalloc memory allocation

Directly use the ptmalloc allocation functions. Usually, this is not needed - use cs_malloc() etc instead.
void * | ptcalloc (size_t n, size_t s)
void | ptfree (void *p)
void * | ptmalloc (size_t n)
void * | ptrealloc (void *p, size_t n)

## Defines

#define | __attribute__(x)
#define | _CS_IMPLICITPTRCAST_NAME __ImplicitPtrCast
#define | CS_ALIGNED_MEMBER(Member, Align) Member __attribute((aligned(Align)))
| Macro to align a class member (or local variable) to a specific byte boundary.
#define | CS_ALLOC_STACK_ARRAY(type, var, size) type var [size]
| Dynamic stack memory allocation.
#define | CS_ASSERT(x) (void)0
| Assertion.
#define | CS_ASSERT_MSG(m, x) (void)0
| Same as CS_ASSERT(expr), but additionally prints msg to `stderr`.
#define | CS_CONST_METHOD
| Use the CS_CONST_METHOD macro in front of method declarations to indicate that they are "constant", i.e., they only look at the values of their parameters and have no side effects.
#define | CS_DEBUG_BREAK
| Stops program execution and break into debugger, if present - otherwise, probably just throws an exception/signal (ie crashes).
#define | CS_DECLARE_DEFAULT_STATIC_VARIABLE_REGISTRATION
#define | CS_DECLARE_STATIC_CLASSVAR(var, getterFunc, Type)
| Declare a static variable inside a class.
#define | CS_DECLARE_STATIC_CLASSVAR_REF(var, getterFunc, Type)
#define | CS_DECLARE_STATIC_VARIABLE_REGISTRATION(func) void func (void (*p)())
#define | CS_DEFINE_STATIC_VARIABLE_REGISTRATION(func) csStaticVarCleanupFN csStaticVarCleanup = &func
#define | CS_DEFINE_STATICALLY_LINKED_FLAG bool scfStaticallyLinked = false;
| Define the scfStaticallyLinked variable.
#define | CS_DEPRECATED_METHOD
| Use the CS_DEPRECATED_METHOD macro in front of method declarations to indicate that they are deprecated.
#define | CS_DEPRECATED_METHOD_MSG(msg) CS_DEPRECATED_METHOD
| A variant of CS_DEPRECATED_METHOD that also emits the message msg on compilers that support it.
#define | CS_DEPRECATED_TYPE
| Use the CS_DEPRECATED_TYPE macro after type declarations to indicate that they are deprecated.
#define | CS_DEPRECATED_TYPE_MSG(msg) CS_DEPRECATED_TYPE
| A variant of CS_DEPRECATED_TYPE that also emits the message msg on compilers that support it.
#define | CS_EXPORT_SYM_DLL CS_VISIBILITY_DEFAULT
#define | CS_EXPORTED_FUNCTION extern "C" CS_EXPORT_SYM_DLL
#define | CS_EXPORTED_NAME(Prefix, Suffix) Prefix ## Suffix
#define | CS_FORCEINLINE_TEMPLATEMETHOD CS_FORCEINLINE
#define | CS_FUNCTION_NAME __PRETTY_FUNCTION__
| Macro that resolves to a compiler-specific variable or string that contains the name of the current function.
#define | CS_GNUC_PRINTF(format_idx, arg_idx)
#define | CS_GNUC_SCANF(format_idx, arg_idx)
#define | CS_GNUC_WPRINTF(format_idx, arg_idx)
#define | CS_GNUC_WSCANF(format_idx, arg_idx)
#define | CS_HEADER_GLOBAL(X, Y) CS_HEADER_GLOBAL_COMPOSE(X,Y)
| The CS_HEADER_GLOBAL() macro composes a pathname from two components and wraps the path in `<' and `>'.
#define | CS_HEADER_GLOBAL_COMPOSE(X, Y) <X/Y>
#define | CS_HEADER_LOCAL(X, Y) CS_HEADER_LOCAL_COMPOSE1(X,Y)
| The CS_HEADER_LOCAL() macro composes a pathname from two components and wraps the path in double-quotes.
#define | CS_HEADER_LOCAL_COMPOSE1(X, Y) CS_HEADER_LOCAL_COMPOSE2(X/Y)
#define | CS_HEADER_LOCAL_COMPOSE2(X) #X
#define | CS_IMPLEMENT_APPLICATION
| The CS_IMPLEMENT_APPLICATION macro should be placed at the global scope in exactly one compilation unit comprising an application.
#define | CS_IMPLEMENT_FOREIGN_DLL
| The CS_IMPLEMENT_FOREIGN_DLL macro should be placed at the global scope in exactly one compilation unit comprising a foreign (non-Crystal Space) module.
#define | CS_IMPLEMENT_IMPLICIT_PTR_CAST(classname)
| Implements a static member function for a class which can be used to perform implicit pointer casts.
#define | CS_IMPLEMENT_PLUGIN
| The CS_IMPLEMENT_PLUGIN macro should be placed at the global scope in exactly one compilation unit comprising a plugin module.
#define | CS_IMPLEMENT_STATIC_CLASSVAR(Class, var, getterFunc, Type, initParam) CS_IMPLEMENT_STATIC_CLASSVAR_EXT(Class,var,getterFunc,Type,initParam,_kill)
| Create the static class variable that has been declared with CS_DECLARE_STATIC_CLASSVAR.
#define | CS_IMPLEMENT_STATIC_CLASSVAR_ARRAY(Class, var, getterFunc, Type, initParam)
#define | CS_IMPLEMENT_STATIC_CLASSVAR_EXT(Class, var, getterFunc, Type, initParam, kill_how)
#define | CS_IMPLEMENT_STATIC_CLASSVAR_REF(Class, var, getterFunc, Type, initParam)
#define | CS_IMPLEMENT_STATIC_CLASSVAR_REF_ARRAY(Class, var, getterFunc, Type, initParam)
#define | CS_IMPLEMENT_STATIC_CLASSVAR_REF_EXT(Class, var, getterFunc, Type, initParam, kill_how)
#define | CS_IMPLEMENT_STATIC_VAR(getterFunc, Type, initParam) CS_IMPLEMENT_STATIC_VAR_EXT(getterFunc,Type,initParam,_kill)
| Implement a file-scoped static variable that is created on demand.
#define | CS_IMPLEMENT_STATIC_VAR_ARRAY(getterFunc, Type, initParam) CS_IMPLEMENT_STATIC_VAR_EXT(getterFunc,Type,initParam,_kill_array)
#define | CS_IMPLEMENT_STATIC_VAR_EXT(getterFunc, Type, initParam, kill_how)
#define | CS_IMPLEMENT_STATIC_VARIABLE_REGISTRATION(Name)
#define | CS_IMPLICIT_PTR_CAST(classname, ptr) (classname::_CS_IMPLICITPTRCAST_NAME(ptr))
| Perform a compiler implicit cast of a pointer to another pointer type using a static member function declared with the `CS_IMPLEMENT_IMPLICIT_PTR_CAST` macro.
#define | CS_IMPORT_SYM_DLL extern
#define | CS_INITIALIZE_PLATFORM_APPLICATION
| Perform platform-specific application initializations.
#define | CS_MAXPATHLEN 1024
| Maximum length of a filesystem pathname.
#define | CS_NAMESPACE_PACKAGE_NAME CS
#define | CS_NO_EXCEPTIONS
| This is defined when the project was compiled without support for exceptions.
#define | CS_PURE_METHOD
| Use the CS_PURE_METHOD macro in front of method declarations to indicate that they are "pure", i.e., they look at their arguments and at global memory but do not have any side effects.
#define | CS_REGISTER_STATIC_FOR_DESTRUCTION(getterFunc) csStaticVarCleanup (getterFunc);
| Register a method that will destruct one static variable.
#define | CS_STATIC_VARIABLE_CLEANUP csStaticVarCleanup (0);
| Invoke the function that will call all destruction functions.
#define | CS_STRING_TO_WIDE(x) CS_STRING_TO_WIDE_(x)
| Convert a string to a wide string.
#define | CS_STRING_TO_WIDE_(x) L ## x
#define | CS_TEMP_DIR ""
| Directory for temporary files.
#define | CS_TEMP_FILE "$cs$.tmp"
| Name for temporary files.
#define | CS_VA_COPY(dest, src) dest = src;
| Copies the state of a va_list value.
#define | CSDEF_FRIEND

## Typedefs

typedef void(*) | csStaticVarCleanupFN (void(*p)())

## Detailed Description

This file should be #included before any other Crystal Space header files.

It sets up a compilation environment which smooths over differences between platforms, allowing the same code to compile cleanly over a variety of operating systems and build tools. It also provides a number of utility macros useful to projects utilizing Crystal Space and to the Crystal Space code itself.

Definition in file cssysdef.h.

## Define Documentation

#define CS_ALIGNED_MEMBER | ( | Member,
|  | Align |  | ) | Member __attribute((aligned(Align)))

Macro to align a class member (or local variable) to a specific byte boundary.

Example:

     struct MyStruct
     {
       CS_ALIGNED_MEMBER(int x[4], 16);
     };

Definition at line 1048 of file cssysdef.h.

#define CS_ALLOC_STACK_ARRAY | ( | type,
|  | var,
|  | size |  | ) | type var [size]

Dynamic stack memory allocation.

Parameters:

  | type | Type of the array elements.
  | var | Name of the array to be allocated.
  | size | Number of elements to be allocated.

Definition at line 120 of file cssysdef.h.

Referenced by csRadixSorter::ReorderInplace(), and CS::Math::Ode45::Step().

#define CS_ASSERT | ( | x |  | ) | (void)0

Assertion.

If expr is false, a message containing the failing expression as well as a call stack is printed to `stderr` and a debug break is performed

Remarks:
  Breaking execution can be avoided at runtime by setting the environment variable `"CS_ASSERT_IGNORE"` to a value other than 0.

Referenced by csPartialOrder< csStringID >::AddOrder(), csFixedSizeAllocator< sizeof(T), Allocator >::Alloc(), csFixedSizeAllocator< sizeof(T), Allocator >::AllocBlock(), csFixedSizeAllocator< sizeof(T), Allocator >::AllocCommon(), csBitArrayTweakable< >::AreSomeBitsSet(), csBitArrayTweakable< >::ClearBit(), csPartialOrder< csStringID >::ClearMark(), csRenderBufferLock< unsigned char >::csRenderBufferLock(), csVertexListWalker< Tbase, Tcomplex >::csVertexListWalker(), csPartialOrder< csStringID >::CycleTest(), csDebugImageWriter::DebugImageWrite(), csPartialOrder< csStringID >::Delete(), csList< T >::Delete(), csBitArrayTweakable< >::Delete(), csPartialOrder< csStringID >::DeleteOrder(), csEventTree::DeleteRootNode(), csStringFast< LEN >::Detach(), csList< T >::Iterator::FetchCurrent(), csList< T >::Iterator::FetchNext(), csList< T >::Iterator::FetchPrevious(), csBitArrayTweakable< >::FlipBit(), csFixedSizeAllocator< sizeof(T), Allocator >::Free(), csPoly2DPool::Free(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Get(), csRenderBufferLock< unsigned char >::Get(), csFixedSizeAllocator< sizeof(T), Allocator >::GetAllocationMap(), csStringBase::GetAt(), csVariant::GetBool(), csOBBFrozen::GetCorner(), csVariant::GetFloat(), csEventNameRegistry::GetID(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::GetIndex(), csVariant::GetLong(), csVariant::GetString(), csFrustum::GetVertex(), csEventTree::SubscriberIterator::HasNext(), csList< T >::InsertAfter(), csList< T >::InsertBefore(), csBitArrayTweakable< >::IsBitSet(), csList< iEventHandler * >::IsEmpty(), csPartialOrder< csStringID >::IsEnabled(), csEventNameRegistry::IsKindOf(), csPartialOrder< csStringID >::IsMarked(), csPartialOrder< csStringID >::Mark(), csList< T >::MoveAfter(), csList< T >::MoveBefore(), csList< T >::Iterator::Next(), csEventTree::SubscriberIterator::Next(), csBitArrayTweakable< >::operator &=(), csList< T >::Iterator::operator *(), csVertexListWalker< Tbase, Tcomplex >::operator *(), csVertexListWalker< Tbase, Tcomplex >::operator Tbase const *(), csStringBase::operator[](), csBitArrayTweakable< >::operator[](), csPolyIndexed::operator[](), csPoly2D::operator[](), csBitArrayTweakable< >::operator^=(), csBitArrayTweakable< >::operator|=(), csStringArray::Pop(), csRefArray< iConfigFile >::Pop(), csPDelArray< csRenderMeshList::renderMeshListInfo >::Pop(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Pop(), csFIFO< T, ElementHandler, MemoryAllocator >::PopTop(), csList< T >::Iterator::Previous(), csRenderBuffer::Props::Props(), csArraySafeCopyElementHandler< T >::ResizeRegion(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Section(), csStringBase::SetAt(), csBitArrayTweakable< >::SetBit(), csStringFast< LEN >::SetCapacityInternal(), csRenderBufferHolder::SetRenderBuffer(), csBitArrayTweakable< >::Slice(), csStringBase::StartsWith(), csEventTree::SubscriberIterator::SubscriberIterator(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Top(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Truncate(), and csEventTree::SubscriberIterator::~SubscriberIterator().

#define CS_ASSERT_MSG | ( | m,
|  | x |  | ) | (void)0

Same as CS_ASSERT(expr), but additionally prints msg to `stderr`.

Referenced by CS::Memory::LocalBufferAllocator< T, N, ExcessAllocator >::Alloc(), csRef< iGraphics2D >::csRef(), scfImplementation< csBaseTextureFactory >::DecRef(), CS::Memory::LocalBufferAllocator< T, N, ExcessAllocator >::Free(), scfImplementation< csBaseTextureFactory >::IncRef(), scfImplementationPooled< scfImplementationExt0< csParasiticDataBufferPooled, csParasiticDataBufferBase > >::operator new(), csRef< iGraphics2D >::operator=(), CS::Memory::LocalBufferAllocator< T, N, ExcessAllocator >::Realloc(), csPartialOrder< csStringID >::SanityCheck(), scfImplementation< csBaseTextureFactory >::scfImplementation(), and scfImplementationPooled< Super >::Pool::~Pool().

#define CS_CONST_METHOD

Use the CS_CONST_METHOD macro in front of method declarations to indicate that they are "constant", i.e., they only look at the values of their parameters and have no side effects.

This allows the compiler to perform certain optimizations, e.g., eliminating repeated calls with the same arguments. This is a very strong assertion; if any argument is a pointer, you probably want to use CS_PURE_METHOD instead.

Todo:
  Is there an MSVC equivalent for gcc's __attribute__((const))?

Definition at line 942 of file cssysdef.h.

#define CS_DEBUG_BREAK

Stops program execution and break into debugger, if present - otherwise, probably just throws an exception/signal (ie crashes).

#define CS_DECLARE_STATIC_CLASSVAR | ( | var,
|  | getterFunc,
|  | Type |  | ) |

Value:

    static Type *var;                                             \
    static Type *getterFunc ();                                   \
    static void getterFunc ## _kill ();                           \
    static void getterFunc ## _kill_array ();

Declare a static variable inside a class.

This will also declare a Getter function. Example:

     CS_DECLARE_STATIC_CLASSVAR (pool, GetVertexPool, csVertexPool)

Definition at line 476 of file cssysdef.h.

#define CS_DEFINE_STATICALLY_LINKED_FLAG bool scfStaticallyLinked = false;

Define the scfStaticallyLinked variable.

Definition at line 309 of file cssysdef.h.

#define CS_DEPRECATED_METHOD

Use the CS_DEPRECATED_METHOD macro in front of method declarations to indicate that they are deprecated.

Example:

     struct iFoo : iBase {
       CS_DEPRECATED_METHOD virtual void Plankton() const = 0;
     }

Compilers which are capable of flagging deprecation will exhibit a warning when it encounters client code invoking methods so tagged.

Definition at line 884 of file cssysdef.h.

#define CS_DEPRECATED_METHOD_MSG | ( | msg |  | ) | CS_DEPRECATED_METHOD

A variant of CS_DEPRECATED_METHOD that also emits the message msg on compilers that support it.

Definition at line 896 of file cssysdef.h.

#define CS_DEPRECATED_TYPE

Use the CS_DEPRECATED_TYPE macro after type declarations to indicate that they are deprecated.

Example:

     typedef CS_DEPRECATED_TYPE csFoo csBar;
     class CS_DEPRECATED_TYPE csBaz { };

Compilers which are capable of flagging deprecation will exhibit a warning when it encounters client code using types so tagged.

Definition at line 914 of file cssysdef.h.

#define CS_DEPRECATED_TYPE_MSG | ( | msg |  | ) | CS_DEPRECATED_TYPE

A variant of CS_DEPRECATED_TYPE that also emits the message msg on compilers that support it.

Definition at line 926 of file cssysdef.h.

#define CS_FUNCTION_NAME __PRETTY_FUNCTION__

Macro that resolves to a compiler-specific variable or string that contains the name of the current function.

Definition at line 581 of file cssysdef.h.

#define CS_HEADER_GLOBAL | ( | X,
|  | Y |  | ) | CS_HEADER_GLOBAL_COMPOSE(X,Y)

The CS_HEADER_GLOBAL() macro composes a pathname from two components and wraps the path in `<' and `>'.

This macro is useful in cases where one does not have the option of augmenting the preprocessor's header search path, even though the include path for some header file may vary from platform to platform. For instance, on many platforms OpenGL headers are in a `GL' directory, whereas on other platforms they are in an `OpenGL' directory. As an example, in the first case, the platform might define the preprocessor macro GLPATH with the value `GL', and in the second case GLPATH would be given the value `OpenGL'. To actually include an OpenGL header, such as gl.h, the following code would be used:

     #include CS_HEADER_GLOBAL(GLPATH,gl.h)

Definition at line 176 of file cssysdef.h.

#define CS_HEADER_LOCAL | ( | X,
|  | Y |  | ) | CS_HEADER_LOCAL_COMPOSE1(X,Y)

The CS_HEADER_LOCAL() macro composes a pathname from two components and wraps the path in double-quotes.

This macro is useful in cases where one does not have the option of augmenting the preprocessor's header search path, even though the include path for some header file may vary from platform to platform. For example, assuming that the preprocessor macro UTILPATH is defined with some platform-specific value, to actually include a header, such as util.h, the following code would be used:

     #include CS_HEADER_LOCAL(UTILPATH,util.h)

Definition at line 191 of file cssysdef.h.

#define CS_IMPLEMENT_APPLICATION

Value:

    CS_DECLARE_DEFAULT_STATIC_VARIABLE_REGISTRATION                 \
      CS_DEFINE_STATICALLY_LINKED_FLAG                                      \
      CS_DEFINE_STATIC_VARIABLE_REGISTRATION (csStaticVarCleanup_csutil);   \
      CS_IMPLEMENT_PLATFORM_APPLICATION

The CS_IMPLEMENT_APPLICATION macro should be placed at the global scope in exactly one compilation unit comprising an application.

For maximum portability, each application should employ this macro. Platforms may override the definition of this macro in order to augment the implementation of an application with any special implementation details required by the platform.

Definition at line 392 of file cssysdef.h.

#define CS_IMPLEMENT_FOREIGN_DLL

Value:

    CS_DECLARE_DEFAULT_STATIC_VARIABLE_REGISTRATION                     \
           CS_DEFINE_STATICALLY_LINKED_FLAG                                     \
           CS_DEFINE_STATIC_VARIABLE_REGISTRATION (csStaticVarCleanup_csutil);

The CS_IMPLEMENT_FOREIGN_DLL macro should be placed at the global scope in exactly one compilation unit comprising a foreign (non-Crystal Space) module.

For maximum portability, each such module should employ this macro. This is useful for situations in which a dynamic load library (DLL) is being built for some other facility. Obvious examples are pure extension modules for Python, Perl, and Java. For Crystal Space plugins, instead use CS_IMPLEMENT_PLUGIN. Platforms may override the definition of this macro in order to augment the implementation of the foreign module with any special implementation details required by the platform. If the foreign module will be interacting with Crystal Space, then it also needs to initialize the global iSCF::SCF variable manually. This variable should be set to point at the single shared instance of iSCF which is created by the application's invocation of scfInitialize(), csInitializer::InitializeSCF(), or csInitializer::CreateEnvironment(). In real Crystal Space plugins (those using CS_IMPLEMENT_PLUGIN), iSCF::SCF is initialized automatically; but in foreign DLL's, it is the responsibility of the DLL's author to ensure that iSCF::SCF gets initialized.

Definition at line 339 of file cssysdef.h.

#define CS_IMPLEMENT_IMPLICIT_PTR_CAST | ( | classname |  | ) |

Value:

    inline static classname* _CS_IMPLICITPTRCAST_NAME (classname* ptr) \
      { \
        return ptr;\
      }

Implements a static member function for a class which can be used to perform implicit pointer casts.

Parameters:

  | classname | Name of the class that the macro is being used in.

Remarks:
  This macro is intended to support typecasting within macros, allowing the compiler to provide a more descriptive error message. Use CS_IMPLEMENT_IMPLICIT_PTR_CAST() in the declaration of the class and CS_IMPLICIT_PTR_CAST() in the macro declaration.

Example:

       struct iObjectRegistry : public iBase
       {
         // Allow implicit casts through static function.
         CS_IMPLEMENT_IMPLICIT_PTR_CAST(iObjectRegistry);
         ...
       }

       #define CS_QUERY_REGISTRY_TAG(Reg, Tag) \
        csPtr<iBase> (CS_IMPLICIT_PTR_CAST(iObjectRegistry, Reg)->Get (Tag))

Definition at line 1081 of file cssysdef.h.

#define CS_IMPLEMENT_PLUGIN

Value:

    CS_IMPLEMENT_PLATFORM_PLUGIN                                    \
              CS_DEFINE_STATICALLY_LINKED_FLAG                              \
              CS_DECLARE_DEFAULT_STATIC_VARIABLE_REGISTRATION               \
              CS_DEFINE_STATIC_VARIABLE_REGISTRATION (csStaticVarCleanup_csutil);

The CS_IMPLEMENT_PLUGIN macro should be placed at the global scope in exactly one compilation unit comprising a plugin module.

For maximum portability, each plugin module must employ this macro. Platforms may override the definition of this macro in order to augment the implementation of the plugin module with any special implementation details required by the platform.

Definition at line 364 of file cssysdef.h.

#define CS_IMPLEMENT_STATIC_CLASSVAR | ( | Class,
|  | var,
|  | getterFunc,
|  | Type,
|  | initParam |  | ) | CS_IMPLEMENT_STATIC_CLASSVAR_EXT(Class,var,getterFunc,Type,initParam,_kill)

Create the static class variable that has been declared with CS_DECLARE_STATIC_CLASSVAR.

This will also create the Getter function and the destruction function. The destruction function will be registered upon the first invocation of the Getter function. Example:

     CS_IMPLEMENT_STATIC_CLASSVAR (csPolygon2D, pool, GetVertexPool,
                                   csVertexPool,)

Definition at line 527 of file cssysdef.h.

#define CS_IMPLEMENT_STATIC_VAR | ( | getterFunc,
|  | Type,
|  | initParam |  | ) | CS_IMPLEMENT_STATIC_VAR_EXT(getterFunc,Type,initParam,_kill)

Implement a file-scoped static variable that is created on demand.

Defines a 'getter' function to access the variable and a 'destruction' function. The 'getter' function will register the 'destruction' function on first invocation. Example:

     CS_IMPLEMENT_STATIC_VAR (GetVertexPool, csVertexPool,)

This will give you a file-scoped static 'getter' function GetVertexPool() that returns a pointer to a static variable.

Definition at line 459 of file cssysdef.h.

#define CS_IMPLICIT_PTR_CAST | ( | classname,
|  | ptr |  | ) | (classname::_CS_IMPLICITPTRCAST_NAME(ptr))

Perform a compiler implicit cast of a pointer to another pointer type using a static member function declared with the `CS_IMPLEMENT_IMPLICIT_PTR_CAST` macro.

Parameters:

  | classname | Name of the class to convert to
  | ptr | Pointer to be convereted into

See also:
  CS_IMPLEMENT_IMPLICIT_PTR_CAST

Definition at line 1095 of file cssysdef.h.

#define CS_INITIALIZE_PLATFORM_APPLICATION

Perform platform-specific application initializations.

This macro should be invoked very near to the "beginning" of the application.

Remarks:
  NB: It is invoked in csInitializer::CreateEnvironment().

Definition at line 239 of file cssysdef.h.

#define CS_MAXPATHLEN 1024

Maximum length of a filesystem pathname.

Useful for declaring character buffers for calls to system functions which return a pathname in the buffer.

Definition at line 105 of file cssysdef.h.

#define CS_NO_EXCEPTIONS

This is defined when the project was compiled without support for exceptions.

Definition at line 97 of file cssysdef.h.

#define CS_NO_NEW_OVERRIDE

Until bug #146 (intrusive overriding of new and delete causing incompatibility with external projects) have been solved, this is disabled.

Definition at line 683 of file cssysdef.h.

#define CS_PURE_METHOD

Use the CS_PURE_METHOD macro in front of method declarations to indicate that they are "pure", i.e., they look at their arguments and at global memory but do not have any side effects.

Basically, if the function doesn't change the values of any non-local variables and doesn't perform any output or other tampering with the environment, it is "pure". This allows the compiler to perform certain optimizations, e.g., eliminating repeated calls with the same arguments.

Todo:
  Is there an MSVC equivalent for gcc's __attribute__((pure)) ?

Definition at line 958 of file cssysdef.h.

#define CS_REGISTER_STATIC_FOR_DESTRUCTION | ( | getterFunc |  | ) | csStaticVarCleanup (getterFunc);

Register a method that will destruct one static variable.

Definition at line 403 of file cssysdef.h.

#define CS_STATIC_VARIABLE_CLEANUP csStaticVarCleanup (0);

Invoke the function that will call all destruction functions.

Definition at line 411 of file cssysdef.h.

#define CS_STRING_TO_WIDE | ( | x |  | ) | CS_STRING_TO_WIDE_(x)

Convert a string to a wide string.

Also works in macros.

     void bar (const wchar_t* baz);
     #define FOO(x) bar (CS_STRING_TO_WIDE (#x));

Definition at line 1119 of file cssysdef.h.

#define CS_TEMP_DIR ""

Directory for temporary files.

Definition at line 138 of file cssysdef.h.

#define CS_TEMP_FILE "$cs$.tmp"

Name for temporary files.

Definition at line 149 of file cssysdef.h.

#define CS_VA_COPY | ( | dest,
|  | src |  | ) | dest = src;

Copies the state of a va_list value.

Definition at line 1107 of file cssysdef.h.

## Function Documentation

void* operator new | ( | size_t | s,
|  | const CS::AllocPlatform & |  |
| ) |  |  | throw ()

Platform-dependent operator new.

Remarks:
  Won't throw an exception if allocation fails.

void* operator new[] | ( | size_t | s,
|  | const CS::AllocPlatform & |  |
| ) |  |  | throw ()

Platform-dependent operator new.

Remarks:
  Won't throw an exception if allocation fails.