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"
17 /********************************* MSG **************************************/
19 /** \ingroup msg_simulation
20 * \brief A platform constructor.
22 * Creates a new platform, including hosts, links and the
24 * \param file a filename of a xml description of a platform. This file
27 * \include simgrid.dtd
29 * Here is a small example of such a platform
31 * \include small_platform.xml
33 * Have a look in the directory examples/msg/ to have a big example.
35 void MSG_create_environment(const char *file)
37 SIMIX_create_environment(file);
40 void MSG_post_create_environment(void) {
41 xbt_lib_cursor_t cursor;
45 /* Initialize MSG hosts */
46 xbt_lib_foreach(host_lib, cursor, name, data) {
47 if(data[SIMIX_HOST_LEVEL])
48 __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL]);
54 * \brief A platform constructor bypassing the parser.
56 * load lua script file to set up new platform, including hosts,links
57 * and the routing table
60 void MSG_load_platform_script(const char *script_file)
63 lua_State *L = lua_open();
66 if (luaL_loadfile(L, script_file) || lua_pcall(L, 0, 0, 0)) {
67 printf("error: %s\n", lua_tostring(L, -1));
72 ("Lua is not available! It is mandatory to use MSG_load_platform_script however. Bailing out...");