]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
a little cleanup
authorMichael Jerris <mike@jerris.com>
Thu, 25 Sep 2008 06:25:19 +0000 (06:25 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 25 Sep 2008 06:25:19 +0000 (06:25 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9644 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_managed/mod_managed.cpp

index d038b019b46accf3ae1546e09773c182f80f47fa..12d0595555137f42ee91fb17c2d5fa55778b243d 100644 (file)
  * The native code just handles getting the Mono runtime up and down\r
  * and passing pointers into managed code.\r
  */  \r
-#ifndef _MANAGED       \r
+\r
 #include <switch.h>\r
-       \r
+\r
 SWITCH_BEGIN_EXTERN_C \r
\r
 #include "freeswitch_managed.h" \r
+\r
+SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load);\r
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_managed_shutdown);\r
+SWITCH_MODULE_DEFINITION(mod_managed, mod_managed_load, mod_managed_shutdown, NULL);\r
+\r
+SWITCH_STANDARD_API(managedrun_api_function);  /* ExecuteBackground */\r
+SWITCH_STANDARD_API(managed_api_function);     /* Execute */\r
+SWITCH_STANDARD_APP(managed_app_function);     /* Run */\r
+\r
+SWITCH_END_EXTERN_C\r
+\r
+#define MOD_MANAGED_DLL "mod_managed_lib.dll"\r
+\r
+#ifndef _MANAGED       \r
+       \r
+SWITCH_BEGIN_EXTERN_C \r
+\r
 #include <glib.h>\r
 #include <mono/jit/jit.h>\r
 #include <mono/metadata/assembly.h>\r
@@ -53,8 +69,6 @@ SWITCH_BEGIN_EXTERN_C
 #define EXPORT \r
 #endif \r
 \r
-#define MOD_MONO_MANAGED_DLL "mod_managed_lib.dll"\r
-\r
 #define MOD_MONO_MANAGED_ASM_NAME "mod_managed_lib"\r
 #define MOD_MONO_MANAGED_ASM_V1 1\r
 #define MOD_MONO_MANAGED_ASM_V2 0\r
@@ -64,15 +78,6 @@ SWITCH_BEGIN_EXTERN_C
 mod_mono_globals globals = \r
 { 0 };\r
 \r
-SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load);\r
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_managed_shutdown);\r
-SWITCH_MODULE_DEFINITION(mod_managed, mod_managed_load, mod_managed_shutdown, NULL);\r
-\r
-SWITCH_STANDARD_API(monorun_api_function);     /* ExecuteBackground */\r
-SWITCH_STANDARD_API(mono_api_function);        /* Execute */\r
-SWITCH_STANDARD_APP(mono_app_function);        /* Run */\r
-\r
-\r
 // Sets up delegates (and anything else needed) on the ManagedSession object\r
 // Called via internalcall\r
 SWITCH_MOD_DECLARE(void) InitManagedSession(ManagedSession * session, MonoObject * dtmfDelegate, MonoObject * hangupDelegate) \r
@@ -158,8 +163,7 @@ switch_status_t setMonoDirs()
        mono_set_dirs(NULL, NULL);\r
        return SWITCH_STATUS_SUCCESS;\r
 \r
-#endif /* \r
-       */\r
+#endif \r
 }\r
 \r
 switch_status_t loadModMonoManaged() \r
@@ -167,7 +171,7 @@ switch_status_t loadModMonoManaged()
        /* Find and load mod_mono_managed.exe */ \r
        char filename[256];\r
 \r
-       switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);\r
+       switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MANAGED_DLL);\r
        globals.domain = mono_jit_init(filename);\r
 \r
        /* Already got a Mono domain? */\r
@@ -204,7 +208,6 @@ switch_status_t loadModMonoManaged()
        }\r
 \r
        return SWITCH_STATUS_SUCCESS;\r
-\r
 }\r
 \r
 MonoMethod * getMethod(const char *name, MonoClass * klass) \r
@@ -305,14 +308,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
        switch_api_interface_t *api_interface;\r
        switch_application_interface_t *app_interface;\r
 \r
-       SWITCH_ADD_API(api_interface, "managedrun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");\r
-       SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");\r
-       SWITCH_ADD_APP(app_interface, "managed", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);\r
+       SWITCH_ADD_API(api_interface, "managedrun", "Run a module (ExecuteBackground)", managedrun_api_function, "<module> [<args>]");\r
+       SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", managed_api_function, "<module> [<args>]");\r
+       SWITCH_ADD_APP(app_interface, "managed", "Run Mono IVR", "Run a Mono IVR on a channel", managed_app_function, "<modulename> [<args>]", SAF_NONE);\r
 \r
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_STANDARD_API(monorun_api_function) \r
+SWITCH_STANDARD_API(managedrun_api_function) \r
 {\r
        // TODO: Should we be detaching after all this?\r
        mono_thread_attach(globals.domain);\r
@@ -344,7 +347,7 @@ SWITCH_STANDARD_API(monorun_api_function)
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_STANDARD_API(mono_api_function) \r
+SWITCH_STANDARD_API(managed_api_function) \r
 {\r
        mono_thread_attach(globals.domain);\r
 \r
@@ -375,7 +378,7 @@ SWITCH_STANDARD_API(mono_api_function)
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_STANDARD_APP(mono_app_function) \r
+SWITCH_STANDARD_APP(managed_app_function) \r
 {\r
        mono_thread_attach(globals.domain);\r
 \r
@@ -430,7 +433,6 @@ SWITCH_END_EXTERN_C
 \r
 #ifdef _MANAGED\r
 \r
-#include <switch.h>\r
 #include <mscoree.h>\r
 \r
 using namespace System;\r
@@ -438,10 +440,6 @@ using namespace System::Runtime::InteropServices;
 \r
 SWITCH_BEGIN_EXTERN_C \r
 \r
-#include "freeswitch_managed.h"\r
-\r
-#define MOD_DOTNET_MANAGED_DLL "mod_managed_lib.dll"\r
-\r
 struct dotnet_conf_t {\r
     switch_memory_pool_t *pool;\r
     //ICLRRuntimeHost *pCorRuntime;\r
@@ -450,13 +448,6 @@ struct dotnet_conf_t {
     //char *cor_version;\r
 } globals;\r
 \r
-SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load);\r
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_managed_shutdown);\r
-SWITCH_MODULE_DEFINITION(mod_managed, mod_managed_load, mod_managed_shutdown, NULL);\r
-SWITCH_STANDARD_API(dotnetrun_api_function);   /* ExecuteBackground */\r
-SWITCH_STANDARD_API(dotnet_api_function);      /* Execute */\r
-SWITCH_STANDARD_APP(dotnet_app_function);      /* Run */\r
-\r
 // Sets up delegates (and anything else needed) on the ManagedSession object\r
 // Called from ManagedSession.Initialize Managed -> this is Unmanaged code so all pointers are marshalled and prevented from GC\r
 // Exported method.\r
@@ -476,7 +467,7 @@ switch_status_t loadModDotnetManaged()
 {\r
        /* Find and load mod_dotnet_managed.dll */ \r
        char filename[256];\r
-       switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_DOTNET_MANAGED_DLL);\r
+       switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MANAGED_DLL);\r
 \r
        //HRESULT hr;\r
        //wchar_t wCORVersion[256];\r
@@ -592,14 +583,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load)
        switch_api_interface_t *api_interface;\r
        switch_application_interface_t *app_interface;\r
 \r
-       SWITCH_ADD_API(api_interface, "managedrun", "Run a module (ExecuteBackground)", dotnetrun_api_function, "<module> [<args>]");\r
-       SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", dotnet_api_function, "<module> [<args>]");\r
-       SWITCH_ADD_APP(app_interface, "managed", "Run CLI App", "Run an App on a channel", dotnet_app_function, "<modulename> [<args>]", SAF_NONE);\r
+       SWITCH_ADD_API(api_interface, "managedrun", "Run a module (ExecuteBackground)", managedrun_api_function, "<module> [<args>]");\r
+       SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", managed_api_function, "<module> [<args>]");\r
+       SWITCH_ADD_APP(app_interface, "managed", "Run CLI App", "Run an App on a channel", managed_app_function, "<modulename> [<args>]", SAF_NONE);\r
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
 \r
-SWITCH_STANDARD_API(dotnetrun_api_function) \r
+SWITCH_STANDARD_API(managedrun_api_function) \r
 {\r
        if (switch_strlen_zero(cmd)) {\r
                stream->write_function(stream, "-ERR no args specified!\n");    \r
@@ -626,7 +617,7 @@ SWITCH_STANDARD_API(dotnetrun_api_function)
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_STANDARD_API(dotnet_api_function) \r
+SWITCH_STANDARD_API(managed_api_function) \r
 {\r
        if (switch_strlen_zero(cmd)) {\r
                stream->write_function(stream, "-ERR no args specified!\n");    \r
@@ -651,7 +642,7 @@ SWITCH_STANDARD_API(dotnet_api_function)
        return SWITCH_STATUS_SUCCESS;\r
 }\r
 \r
-SWITCH_STANDARD_APP(dotnet_app_function) \r
+SWITCH_STANDARD_APP(managed_app_function) \r
 {\r
        if (switch_strlen_zero(data)) {\r
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");\r