mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
git-svn-id: svn://ultimatepp.org/upp/trunk@346 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
2383192b1a
commit
0c6e098d63
186 changed files with 44447 additions and 0 deletions
43
uppdev/CoreTopics/Global.h
Normal file
43
uppdev/CoreTopics/Global.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#define GLOBAL_VP(type, name, param) \
|
||||
name() \
|
||||
{ \
|
||||
static type x param; \
|
||||
return x; \
|
||||
}
|
||||
|
||||
#define GLOBAL_VARP(type, name, param) \
|
||||
type& GLOBAL_VP(type, name, param)
|
||||
|
||||
#define GLOBAL_V(type, name) GLOBAL_VP(type, name, init_)
|
||||
#define GLOBAL_VAR(type, name) type& GLOBAL_V(type, name)
|
||||
|
||||
#define GLOBAL_VP_INIT(type, name, param) \
|
||||
name() \
|
||||
{ \
|
||||
static type x param; \
|
||||
return x; \
|
||||
} \
|
||||
INITBLOCK { name(); }
|
||||
|
||||
#define GLOBAL_VARP_INIT(type, name, param) \
|
||||
type& GLOBAL_VP_INIT(type, name, param)
|
||||
|
||||
#define GLOBAL_V_INIT(type, name) GLOBAL_VP_INIT(type, name, init_)
|
||||
#define GLOBAL_VAR_INIT(type, name) type& GLOBAL_V_INIT(type, name)
|
||||
|
||||
|
||||
// DEPRECATED! (USE ONCELOCK_)
|
||||
#define INIT_LOCKV(init, code) \
|
||||
if(!init) { \
|
||||
static StaticCriticalSection cs; \
|
||||
CriticalSection::Lock __(cs); \
|
||||
if(!init) { \
|
||||
init = true; \
|
||||
code \
|
||||
} \
|
||||
}
|
||||
|
||||
// DEPRECATED! (USE ONCELOCK)
|
||||
#define INIT_LOCK(code) \
|
||||
static bool init; \
|
||||
INIT_LOCKV(init, code)
|
||||
Loading…
Add table
Add a link
Reference in a new issue