1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "msg_private.h"
8 #include "xbt/sysdep.h"
11 /** \ingroup msg_simulation
12 * \brief An application deployer.
14 * Creates the process described in \a file.
15 * \param file a filename of a xml description of the application. This file
18 * \include simgrid.dtd
20 * Here is a small example of such a platform
22 * \include msg/masterslave/deployment_masterslave.xml
24 * Have a look in the directory examples/msg/ to have a bigger example.
26 void MSG_launch_application(const char *file)
29 xbt_assert(msg_global,
30 "MSG_global_init_args has to be called before MSG_launch_application.");
32 SIMIX_launch_application(file);
37 /** \ingroup msg_simulation
38 * \brief Registers the main function of a process in a global table.
40 * Registers a code function in a global table.
41 * This table is then used by #MSG_launch_application.
42 * \param name the reference name of the function.
43 * \param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
45 void MSG_function_register(const char *name, xbt_main_func_t code)
47 SIMIX_function_register(name, code);
51 /** \ingroup msg_simulation
52 * \brief Registers a function as the default main function of processes.
54 * Registers a code function as being the default value. This function will get used by MSG_launch_application() when there is no registered function of the requested name in.
55 * \param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
57 void MSG_function_register_default(xbt_main_func_t code)
59 SIMIX_function_register_default(code);
62 /** \ingroup msg_simulation
63 * \brief Retrieves a registered main function
65 * Registers a code function in a global table.
66 * This table is then used by #MSG_launch_application.
67 * \param name the reference name of the function.
69 xbt_main_func_t MSG_get_registered_function(const char *name)
71 return SIMIX_get_registered_function(name);
75 * \brief register functions bypassing the parser
78 void MSG_set_function(const char *host_id, const char *function_name,
79 xbt_dynar_t arguments)
81 SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);