Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old $Id$ command dating from CVS
[simgrid.git] / src / msg / deployment.c
1 /* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
2 /* Copyright (c) 2007 Bruno Donassolo.                                      */
3 /* All rights reserved.                                                     */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #include "msg/private.h"
9 #include "xbt/sysdep.h"
10 #include "xbt/log.h"
11
12
13 /** \ingroup msg_easier_life
14  * \brief An application deployer.
15  *
16  * Creates the process described in \a file.
17  * \param file a filename of a xml description of the application. This file 
18  * follows this DTD :
19  *
20  *     \include simgrid.dtd
21  *
22  * Here is a small example of such a platform 
23  *
24  *     \include msg/masterslave/deployment_masterslave.xml
25  *
26  * Have a look in the directory examples/msg/ to have a bigger example.
27  */
28 void MSG_launch_application(const char *file)
29 {
30
31   xbt_assert0(msg_global,
32               "MSG_global_init_args has to be called before MSG_launch_application.");
33
34   SIMIX_launch_application(file);
35
36   return;
37 }
38
39 /** \ingroup msg_easier_life
40  * \brief Registers the main function of an agent in a global table.
41  *
42  * Registers a code function in a global table. 
43  * This table is then used by #MSG_launch_application. 
44  * \param name the reference name of the function.
45  * \param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
46  */
47 void MSG_function_register(const char *name, xbt_main_func_t code)
48 {
49   SIMIX_function_register(name, code);
50   return;
51 }
52
53 /** \ingroup msg_easier_life
54  * \brief Registers a function as the default main function of agents.
55  *
56  * 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.
57  * \param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
58  */
59 void MSG_function_register_default(xbt_main_func_t code)
60 {
61   SIMIX_function_register_default(code);
62 }
63
64 /** \ingroup msg_easier_life
65  * \brief Retrieves a registered main function
66  *
67  * Registers a code function in a global table. 
68  * This table is then used by #MSG_launch_application. 
69  * \param name the reference name of the function.
70  */
71 xbt_main_func_t MSG_get_registered_function(const char *name)
72 {
73   return SIMIX_get_registered_function(name);
74 }