Logo AND Algorithmique Numérique Distribuée

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