From 54db14505bd22fcb452ced68a1243f97ac58d79e Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 25 Dec 2007 15:06:12 +0000 Subject: Introducing some bits of task status. --- lib/LuaTask.cc | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc index f7497be..754b136 100644 --- a/lib/LuaTask.cc +++ b/lib/LuaTask.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.cc,v 1.18 2007-10-15 13:47:12 pixel Exp $ */ +/* $Id: LuaTask.cc,v 1.19 2007-12-25 15:06:12 pixel Exp $ */ #include #include @@ -278,3 +278,42 @@ int LuaTask::Do() throw (GeneralException) { return TASK_ON_HOLD; } + +enum TaskMan_functions_t { + TASKMAN_NB_TASKS = 0, + TASKMAN_NB_ZOMBIES, +}; + +struct lua_functypes_t TaskMan_functions[] = { + { TASKMAN_NB_TASKS, "NB_Tasks", 0, 0, { } }, + { TASKMAN_NB_ZOMBIES, "NB_Zombies", 0, 0, { } }, + { -1, 0, 0, 0, 0 } +}; + +class sLua_TaskMan : public Base { + public: + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); + private: + static int TaskMan_proceed_statics(Lua * L, int n, int caller); +}; + +void LuaTaskMan::pushstatics(Lua * L) throw (GeneralException) { + CHECK_FUNCTIONS(TaskMan); + + PUSH_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + PUSH_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); +} + +int sLua_TaskMan::TaskMan_proceed_statics(Lua * L, int n, int caller) { + switch (caller) { + case TASKMAN_NB_TASKS: + return TaskMan::nb_tasks(); + break; + case TASKMAN_NB_ZOMBIES: + return TaskMan::nb_zombies(); + break; + } + + return 1; +} -- cgit v1.2.3