Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] merging instr_variables.c into instr_interface.c (code re-organization)
[simgrid.git] / src / msg / deployment.c
1 /* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "msg/private.h"
8 #include "xbt/sysdep.h"
9 #include "xbt/log.h"
10
11 /** \ingroup msg_easier_life
12  * \brief An application deployer.
13  *
14  * Creates the process described in \a file.
15  * \param file a filename of a xml description of the application. This file 
16  * follows this DTD :
17  *
18  *     \include simgrid.dtd
19  *
20  * Here is a small example of such a platform 
21  *
22  *     \include msg/masterslave/deployment_masterslave.xml
23  *
24  * Have a look in the directory examples/msg/ to have a bigger example.
25  */
26 void MSG_launch_application(const char *file)
27 {
28
29   xbt_assert0(msg_global,
30               "MSG_global_init_args has to be called before MSG_launch_application.");
31
32   SIMIX_launch_application(file);
33
34   return;
35 }
36
37 /** \ingroup msg_easier_life
38  * \brief Registers the main function of an agent in a global table.
39  *
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[]))
44  */
45 void MSG_function_register(const char *name, xbt_main_func_t code)
46 {
47   SIMIX_function_register(name, code);
48   return;
49 }
50
51 /** \ingroup msg_easier_life
52  * \brief Registers a function as the default main function of agents.
53  *
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[]))
56  */
57 void MSG_function_register_default(xbt_main_func_t code)
58 {
59   SIMIX_function_register_default(code);
60 }
61
62 /** \ingroup msg_easier_life
63  * \brief Retrieves a registered main function
64  *
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.
68  */
69 xbt_main_func_t MSG_get_registered_function(const char *name)
70 {
71   return SIMIX_get_registered_function(name);
72 }
73
74 /**
75  * \brief register functions bypassing the parser
76  */
77
78 void MSG_set_function(const char *host_id, const char *function_name,
79                       xbt_dynar_t arguments)
80 {
81   SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);
82 }