![]() |
Public API Reference |
#include "csdef.h"
#include "cssys/csosdefs.h"
#include <unistd.h>
#include <malloc.h>
#include "cssys/getopt.h"
#include <sys/select.h>
Go to the source code of this file.
Defines | |
#define | TEMP_DIR "" |
Directory for temporary files. More... | |
#define | TEMP_FILE "$cs$.tmp" |
Name for temporary file. More... | |
#define | MKDIR(path) mkdir (path, 0755) |
How to make a directory (not entire path, only the last on the path). More... | |
#define | CS_ALLOC_STACK_ARRAY(type, var, size) type *var = (type *)alloca ((size) * sizeof (type)) |
Dynamic stack memory allocation. More... | |
#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 `>'. More... | |
#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. More... | |
#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. More... | |
#define | CS_IMPLEMENT_APPLICATION |
The CS_IMPLEMENT_APPLICATION macro should be placed at the global scope in exactly one compilation unit comprising an application. More... | |
#define | CS_REGISTER_STATIC_FOR_DESTRUCTION(getterFunc) CS_STATIC_VAR_DESTRUCTION_REGISTRAR_FUNCTION (getterFunc); |
Register a method that will destruct one static variable. More... | |
#define | CS_STATIC_VARIABLE_CLEANUP CS_STATIC_VAR_DESTRUCTION_REGISTRAR_FUNCTION (0); |
Invoke the function that will call all destruction functions. More... | |
#define | CS_IMPLEMENT_STATIC_VAR(getterFunc, Type, initParam) CS_IMPLEMENT_STATIC_VAR_EXT(getterFunc,Type,initParam,_kill) |
Create a global variable thats created on demand. More... | |
#define | CS_DECLARE_STATIC_CLASSVAR(var, getterFunc, Type) |
Declare a static variable inside a class. More... | |
#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. More... | |
#define | CS_IMPLEMENT_IMPLICIT_PTR_CAST(classname) |
Implements a static member function for a class which can be used to perform implicit pointer casts. More... | |
#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. More... | |
Variables | |
void(* | fatal_exit )(int errorcode, bool canreturn) |
Fatal exit routine (which can be replaced if neccessary). More... |
Just before include directive it can contain several define's that specify what the source file requires.
The following variables can be defined:
define CS_SYSDEF_PROVIDE_MKDIR Include definition for MKDIR()
define CS_SYSDEF_PROVIDE_GETCWD Include definition for getcwd()
define CS_SYSDEF_PROVIDE_TEMP Include definitions for TEMP_DIR and TEMP_FILE.
define CS_SYSDEF_PROVIDE_DIR Include definitions required for opendir(), readdir(), closedir() and isdir().
define CS_SYSDEF_PROVIDE_UNLINK Include definitions required for unlink()
define CS_SYSDEF_PROVIDE_ACCESS Include definitions required for access()
define CS_SYSDEF_PROVIDE_GETOPT For getopt() and GNU getopt_long()
define CS_SYSDEF_PROVIDE_SELECT Includes definitions required for select(), FD_* macros, and struct timeval.
The system-dependent include files can undefine some or all CS_SYSDEF_PROVIDE_xxx macros to avoid further definitions in this file. For example, if a system-dependent file defines everything needed for CS_SYSDEF_PROVIDE_GETOPT it should undefine CS_SYSDEF_PROVIDE_GETOPT to avoid including util/gnu/getopt.h at the bottom of this file.
Definition in file cssysdef.h.
|
Dynamic stack memory allocation.
Definition at line 188 of file cssysdef.h. |
|
Value: static Type *var; \ static Type *getterFunc (); This will also declare a Getter function. Example: CS_DECLARE_STATIC_CLASSVAR (pool, GetVertexPool, csVertexPool) Definition at line 459 of file cssysdef.h. |
|
Value: static Type *var; \ static Type &getterFunc (); Definition at line 465 of file cssysdef.h. |
|
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 240 of file cssysdef.h. |
|
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 255 of file cssysdef.h. |
|
Value: CS_IMPLEMENT_STATIC_VARIABLE_CLEANUP \ CS_IMPLEMENT_PLATFORM_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 382 of file cssysdef.h. |
|
Value: inline static classname* _CS_IMPLICITPTRCAST_NAME (classname* ptr) \ { \ return ptr;\ }
Definition at line 704 of file cssysdef.h. |
|
Value: CS_IMPLEMENT_STATIC_VARIABLE_CLEANUP \ CS_IMPLEMENT_PLATFORM_PLUGIN 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 366 of file cssysdef.h. |
|
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 509 of file cssysdef.h. |
|
Value: Type *Class::var = 0; \ extern "C" { \ static void Class ## _ ## getterFunc ## _kill (); \ static void Class ## _ ## getterFunc ## _kill_array (); \ void Class ## _ ## getterFunc ## _kill () \ { \ (void) Class ## _ ## getterFunc ## _kill_array; \ delete Class::getterFunc (); \ } \ void Class ## _ ## getterFunc ## _kill_array () \ { \ (void) Class ## _ ## getterFunc ## _kill; \ delete [] Class::getterFunc (); \ } \ } \ Type* Class::getterFunc () \ { \ if (!var) \ { \ var = new Type initParam; \ CS_DECLARE_STATIC_VARIABLE_REGISTRATION \ CS_REGISTER_STATIC_FOR_DESTRUCTION (Class ## _ ## getterFunc ## kill_how); \ } \ return var; \ } Definition at line 480 of file cssysdef.h. |
|
Value: Type *Class::var = 0; \ extern "C" { \ static void Class ## _ ## getterFunc ## _kill (); \ static void Class ## _ ## getterFunc ## _kill_array (); \ void Class ## _ ## getterFunc ## _kill () \ { \ (void) Class ## _ ## getterFunc ## _kill_array; \ delete &Class::getterFunc (); \ } \ void Class ## _ ## getterFunc ## _kill_array () \ { \ (void) Class ## _ ## getterFunc ## _kill; \ delete [] &Class::getterFunc (); \ } \ } \ Type &Class::getterFunc () \ { \ if (!var) \ { \ var = new Type initParam; \ CS_DECLARE_STATIC_VARIABLE_REGISTRATION \ CS_REGISTER_STATIC_FOR_DESTRUCTION (Class ## _ ## getterFunc ## kill_how); \ } \ return *var; \ } Definition at line 519 of file cssysdef.h. |
|
Create a global variable thats created on demand. Create 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 global function GetVertexPool that returns a pointer to a static variable. Definition at line 444 of file cssysdef.h. |
|
Value: CS_DECLARE_STATIC_VARIABLE_REGISTRATION \ extern "C" { \ static Type* getterFunc (); \ static void getterFunc ## _kill (); \ static void getterFunc ## _kill_array (); \ void getterFunc ## _kill () \ { \ (void)getterFunc ## _kill_array; \ delete getterFunc (); \ } \ void getterFunc ## _kill_array () \ { \ (void)getterFunc ## _kill; \ delete [] getterFunc (); \ } \ Type* getterFunc () \ { \ static Type *v=0; \ if (!v) \ { \ v = new Type initParam; \ CS_REGISTER_STATIC_FOR_DESTRUCTION (getterFunc ## kill_how); \ } \ return v; \ } \ } Definition at line 414 of file cssysdef.h. |
|
Value: void CS_STATIC_VAR_DESTRUCTION_REGISTRAR_FUNCTION (void (*p)()) \ { \ static void (**a)()=0; \ static int lastEntry=0; \ static int maxEntries=0; \ \ if (p) \ { \ if (lastEntry >= maxEntries) \ { \ maxEntries+=10; \ a = (void (**)())realloc (a, maxEntries*sizeof(void*)); \ } \ a[lastEntry++] = p; \ } \ else \ { \ int i; \ for (i=lastEntry-1; i >= 0; i--) \ a[i] (); \ free (a); \ } \ } Definition at line 317 of file cssysdef.h. |
|
Perform a compiler implicit cast of a pointer to another pointer type using a static member function declared with the
Definition at line 718 of file cssysdef.h. |
|
Register a method that will destruct one static variable.
Definition at line 391 of file cssysdef.h. |
|
Invoke the function that will call all destruction functions.
Definition at line 399 of file cssysdef.h. |
|
How to make a directory (not entire path, only the last on the path).
Definition at line 111 of file cssysdef.h. |
|
Directory for temporary files.
Definition at line 88 of file cssysdef.h. |
|
Name for temporary file.
Definition at line 98 of file cssysdef.h. |
|
Fatal exit routine (which can be replaced if neccessary).
Definition at line 722 of file cssysdef.h. |