-added export attribute

This commit is contained in:
Mergul 2019-05-15 08:47:30 +00:00
parent 9220a28f7c
commit cb257a2360
4 changed files with 28 additions and 26 deletions

View file

@ -8,7 +8,8 @@
"license": "BSD", "license": "BSD",
"sourcePaths" : ["source\/"], "sourcePaths" : ["source\/"],
"dflags-posix-ldc": [ "dflags-posix-ldc": [
"-defaultlib=phobos2-ldc,druntime-ldc" "-defaultlib=phobos2-ldc,druntime-ldc",
"-fvisibility=hidden"
], ],
"dflagss": [ "dflagss": [
"-betterC" "-betterC"

View file

@ -76,7 +76,7 @@ struct EventManager
manager = m; manager = m;
} }
void sendEvent(Ev)(EntityID id, Ev event, uint thread_id = 0) nothrow @nogc export void sendEvent(Ev)(EntityID id, Ev event, uint thread_id = 0) nothrow @nogc
{ {
uint block_id = current_index+thread_id; uint block_id = current_index+thread_id;

View file

@ -23,15 +23,15 @@ import ecs.vector;
import ecs.events; import ecs.events;
import ecs.traits; import ecs.traits;
alias gEM = EntityManager.instance; export alias gEM = EntityManager.instance;
alias gEntityManager = EntityManager.instance; export alias gEntityManager = EntityManager.instance;
alias gEventManager = EntityManager.instance; export alias gEventManager = EntityManager.instance;
alias SerializeVector = ecs.vector.Vector!ubyte; alias SerializeVector = ecs.vector.Vector!ubyte;
/************************************************************************************************************************ /************************************************************************************************************************
*Entity manager is responsible for everything. *Entity manager is responsible for everything.
*/ */
class EntityManager export class EntityManager
{ {
export static void initialize(uint threads_count) export static void initialize(uint threads_count)
{ {
@ -62,7 +62,7 @@ class EntityManager
/************************************************************************************************************************ /************************************************************************************************************************
*Begin registering process. Every register function should be called between beginRegister() and endRegister(). *Begin registering process. Every register function should be called between beginRegister() and endRegister().
*/ */
void beginRegister() nothrow @nogc export void beginRegister() nothrow @nogc
{ {
assert(!register_state, "beginRegister() can't be called twice before endRegister();"); assert(!register_state, "beginRegister() can't be called twice before endRegister();");
register_state = true; register_state = true;
@ -80,7 +80,7 @@ class EntityManager
/************************************************************************************************************************ /************************************************************************************************************************
*End registering process. Every register function should be called between beginRegister() and endRegister(). *End registering process. Every register function should be called between beginRegister() and endRegister().
*/ */
void endRegister() export void endRegister()
{ {
assert(register_state, "beginRegister() should be called before endRegister();"); assert(register_state, "beginRegister() should be called before endRegister();");
register_state = false; register_state = false;
@ -699,7 +699,7 @@ class EntityManager
/************************************************************************************************************************ /************************************************************************************************************************
*Return system ECS api by id *Return system ECS api by id
*/ */
System* getSystem(ushort id) nothrow @nogc export System* getSystem(ushort id) nothrow @nogc
{ {
return &systems[id]; return &systems[id];
} }
@ -712,7 +712,7 @@ class EntityManager
return cast(Sys*) systems[Sys.system_id].m_system_pointer; return cast(Sys*) systems[Sys.system_id].m_system_pointer;
} }
ushort registerPass(const(char)[] name) export ushort registerPass(const(char)[] name)
{ {
UpdatePass* pass = Mallocator.instance.make!UpdatePass; UpdatePass* pass = Mallocator.instance.make!UpdatePass;
pass.name = Mallocator.instance.makeArray(name); pass.name = Mallocator.instance.makeArray(name);
@ -815,7 +815,7 @@ class EntityManager
/************************************************************************************************************************ /************************************************************************************************************************
*Same as "void update(int pass = 0)" but use pass name instead of id. *Same as "void update(int pass = 0)" but use pass name instead of id.
*/ */
void update(const(char)[] pass_name) nothrow @nogc export void update(const(char)[] pass_name) nothrow @nogc
{ {
ushort pass = passes_map.get(pass_name, ushort.max); ushort pass = passes_map.get(pass_name, ushort.max);
assert(pass != ushort.max); assert(pass != ushort.max);
@ -846,14 +846,14 @@ class EntityManager
/************************************************************************************************************************ /************************************************************************************************************************
*Same as "void updateMT(int pass = 0)" but use pass name instead of id. *Same as "void updateMT(int pass = 0)" but use pass name instead of id.
*/ */
void updateMT(const(char)[] pass_name) nothrow @nogc export void updateMT(const(char)[] pass_name) nothrow @nogc
{ {
ushort pass = passes_map.get(pass_name, ushort.max); ushort pass = passes_map.get(pass_name, ushort.max);
assert(pass != ushort.max); assert(pass != ushort.max);
updateMT(pass); updateMT(pass);
} }
void updateMT(ushort pass = 0) nothrow @nogc export void updateMT(ushort pass = 0) nothrow @nogc
{ {
assert(!register_state); assert(!register_state);
assert(pass < passes.length); assert(pass < passes.length);
@ -982,7 +982,7 @@ class EntityManager
} }
} }
void setJobDispachFunc(void delegate(JobGroup) func) nothrow @nogc export void setJobDispachFunc(void delegate(JobGroup) func) nothrow @nogc
{ {
m_dispatch_jobs = func; m_dispatch_jobs = func;
} }
@ -1123,7 +1123,7 @@ class EntityManager
return info; return info;
} }
void generateListeners(EntityInfo* info) private void generateListeners(EntityInfo* info)
{ {
if (info.add_listeners) if (info.add_listeners)
{ {
@ -2053,7 +2053,7 @@ class EntityManager
} }
} }
void updateEvents() nothrow @nogc private void updateEvents() nothrow @nogc
{ {
bool empty = true; bool empty = true;
while (1) while (1)
@ -2164,8 +2164,7 @@ class EntityManager
event_manager.sendEvent(id, event, thread_id); event_manager.sendEvent(id, event, thread_id);
} }
/*private */ private void generateDependencies() nothrow @nogc
void generateDependencies() nothrow @nogc
{ {
foreach (pass_id, pass; passes) foreach (pass_id, pass; passes)
{ {
@ -2398,7 +2397,7 @@ class EntityManager
struct EntitiesBlock struct EntitiesBlock
{ {
///return distance (in bytes) from begin of block to data ///return distance (in bytes) from begin of block to data
uint dataDelta() nothrow @nogc export uint dataDelta() nothrow @nogc
{ {
ushort dif = EntitiesBlock.sizeof; ushort dif = EntitiesBlock.sizeof;
alignNum(dif, type_info.alignment); alignNum(dif, type_info.alignment);
@ -2438,7 +2437,7 @@ class EntityManager
*/ */
struct CallData struct CallData
{ {
void update() nothrow @nogc export void update() nothrow @nogc
{ {
(cast(SytemFuncType) system.m_update)(this); (cast(SytemFuncType) system.m_update)(this);
} }
@ -2472,7 +2471,7 @@ class EntityManager
{ {
CallData[] callers; CallData[] callers;
void execute() nothrow @nogc export void execute() nothrow @nogc
{ {
EntityManager.instance.getThreadID(); EntityManager.instance.getThreadID();
foreach (ref caller; callers) foreach (ref caller; callers)
@ -2519,15 +2518,17 @@ class EntityManager
Vector!(EntitiesBlock*) blocks_to_update; Vector!(EntitiesBlock*) blocks_to_update;
} }
struct UpdatePass export struct UpdatePass
{ {
~this() nothrow @nogc export ~this() nothrow @nogc
{ {
assert(name); assert(name);
if (name) if (name)
Mallocator.instance.dispose(name); Mallocator.instance.dispose(name);
} }
export size_t __xtoHash();
char[] name; char[] name;
Vector!(SystemCaller*) system_callers; Vector!(SystemCaller*) system_callers;
} }
@ -2620,7 +2621,7 @@ class EntityManager
} }
} }
__gshared EntityManager instance = null; export __gshared EntityManager instance = null;
} }
/* /*

View file

@ -11,8 +11,8 @@ export @nogc @safe nothrow pure size_t nextPow2(size_t num) {
return 1 << bsr(num) + 1; return 1 << bsr(num) + 1;
} }
__gshared size_t gVectorsCreated = 0; export __gshared size_t gVectorsCreated = 0;
__gshared size_t gVectorsDestroyed = 0; export __gshared size_t gVectorsDestroyed = 0;
struct Vector(T) { struct Vector(T) {
T[] array; T[] array;