Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the coupling between main library and ruby bindings
[simgrid.git] / src / simix / smx_context_lua.c
index 2218c5b..33b3ecf 100644 (file)
@@ -1,6 +1,7 @@
 /* context_lua - implementation of context switching with lua coroutines */
 
-/* Copyright (c) 2010 the SimGrid team. All right reserved */
+/* Copyright (c) 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -15,7 +16,8 @@
  */
 
 lua_State *simgrid_lua_state;
-void SIMIX_ctx_lua_factory_init(smx_context_factory_t *factory) {
+void SIMIX_ctx_lua_factory_init(smx_context_factory_t * factory)
+{
 }
 
 #ifdef KILLME
@@ -25,11 +27,11 @@ void SIMIX_ctx_lua_factory_init(smx_context_factory_t *factory) {
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(lua);
 
 
-static smx_context_t 
-smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char** argv, 
-    void_f_pvoid_t cleanup_func, void* cleanup_arg);
+static smx_context_t
+smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char **argv,
+                           void_f_pvoid_t cleanup_func, void *cleanup_arg);
 
-static int smx_ctx_lua_factory_finalize(smx_context_factory_t *factory);
+static int smx_ctx_lua_factory_finalize(smx_context_factory_t * factory);
 
 static void smx_ctx_lua_free(smx_context_t context);
 static void smx_ctx_lua_stop(smx_context_t context);
@@ -37,12 +39,13 @@ static void smx_ctx_lua_suspend(smx_context_t context);
 static void smx_ctx_lua_resume(smx_context_t new_context);
 
 
-void SIMIX_ctx_lua_factory_init(smx_context_factory_t *factory) {
+void SIMIX_ctx_lua_factory_init(smx_context_factory_t * factory)
+{
 
   smx_ctx_base_factory_init(factory);
 
   (*factory)->create_context = smx_ctx_lua_create_context;
-  /* don't override (*factory)->finalize */;
+  /* don't override (*factory)->finalize */ ;
   (*factory)->free = smx_ctx_sysv_free;
   (*factory)->stop = smx_ctx_sysv_stop;
   (*factory)->suspend = smx_ctx_sysv_suspend;
@@ -52,41 +55,48 @@ void SIMIX_ctx_lua_factory_init(smx_context_factory_t *factory) {
   INFO0("Lua Factory created");
 }
 
-static smx_context_t 
-smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char** argv, 
-    void_f_pvoid_t cleanup_func, void* cleanup_arg) {
+static smx_context_t
+smx_ctx_lua_create_context(xbt_main_func_t code, int argc, char **argv,
+                           void_f_pvoid_t cleanup_func, void *cleanup_arg)
+{
 
   return smx_ctx_sysv_create_context_sized(sizeof(s_smx_ctx_sysv_t),
-      code,argc,argv,cleanup_func,cleanup_arg);
+                                           code, argc, argv, cleanup_func,
+                                           cleanup_arg);
 }
+
 #if KILLME
-static void smx_ctx_lua_free(smx_context_t context) {
+static void smx_ctx_lua_free(smx_context_t context)
+{
 
-  if (context){
-    DEBUG1("smx_ctx_lua_free_context(%p)",context);
+  if (context) {
+    DEBUG1("smx_ctx_lua_free_context(%p)", context);
 
   }
 
   smx_ctx_sysv_free(context);
 }
 
-static void smx_ctx_lua_stop(smx_context_t pcontext) {
-  DEBUG1("Stopping '%s' (nothing to do)",pcontext->argv[0]);
+static void smx_ctx_lua_stop(smx_context_t pcontext)
+{
+  DEBUG1("Stopping '%s' (nothing to do)", pcontext->argv[0]);
   smx_ctx_sysv_stop(pcontext);
 }
 
-static void smx_ctx_lua_suspend(smx_context_t pcontext) {
-  smx_ctx_lua_t context = (smx_ctx_lua_t)pcontext;
-  DEBUG1("Suspending '%s' (using sysv facilities)",context->super.super.argv[0]);
+static void smx_ctx_lua_suspend(smx_context_t pcontext)
+{
+  smx_ctx_lua_t context = (smx_ctx_lua_t) pcontext;
+  DEBUG1("Suspending '%s' (using sysv facilities)",
+         context->super.super.argv[0]);
   smx_ctx_sysv_suspend(pcontext);
 
   DEBUG0("Back from call yielding");
 }
 
-static void 
-smx_ctx_lua_resume(smx_context_t new_context) {
-  smx_ctx_lua_t context = (smx_ctx_lua_t)new_context;
-  DEBUG1("Resuming %s",context->super.super.argv[0]);
+static void smx_ctx_lua_resume(smx_context_t new_context)
+{
+  smx_ctx_lua_t context = (smx_ctx_lua_t) new_context;
+  DEBUG1("Resuming %s", context->super.super.argv[0]);
   smx_ctx_sysv_resume(new_context);
 }
 #endif