#include "private.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
-#include "surf/surf_parse.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(deployment, msg,
- "Logging specific to MSG (environment)");
+#include "surf/surfxml_parse_private.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_deployment, msg,
+ "Logging specific to MSG (deployment)");
static int parse_argc = -1 ;
static char **parse_argv = NULL;
static void parse_process_init(void)
{
- parse_host = MSG_get_host_by_name(A_process_host);
- xbt_assert1(parse_host, "Unknown host %s",A_process_host);
- parse_code = MSG_get_registered_function(A_process_function);
- xbt_assert1(parse_code, "Unknown function %s",A_process_function);
+ parse_host = MSG_get_host_by_name(A_surfxml_process_host);
+ xbt_assert1(parse_host, "Unknown host %s",A_surfxml_process_host);
+ parse_code = MSG_get_registered_function(A_surfxml_process_function);
+ xbt_assert1(parse_code, "Unknown function %s",A_surfxml_process_function);
parse_argc = 0 ;
parse_argv = NULL;
parse_argc++;
parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
- parse_argv[(parse_argc) - 1] = xbt_strdup(A_process_function);
- surf_parse_get_double(&start_time,A_process_start_time);
- surf_parse_get_double(&kill_time,A_process_kill_time);
+ parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_process_function);
+ surf_parse_get_double(&start_time,A_surfxml_process_start_time);
+ surf_parse_get_double(&kill_time,A_surfxml_process_kill_time);
}
static void parse_argument(void)
{
parse_argc++;
parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
- parse_argv[(parse_argc) - 1] = xbt_strdup(A_argument_value);
+ parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_argument_value);
}
static void parse_process_finalize(void)
arg->argv = parse_argv;
arg-> kill_time = kill_time;
+ DEBUG3("Process %s(%s) will be started at time %f", arg->name,
+ arg->host->name,start_time);
surf_timer_resource->extension_public->set(start_time, (void*) &MSG_process_create_with_arguments,
arg);
}
if((start_time<0) || (start_time==MSG_get_clock())) {
+ DEBUG2("Starting Process %s(%s) right now", parse_argv[0],
+ parse_host->name);
process = MSG_process_create_with_arguments(parse_argv[0], parse_code,
NULL, parse_host,
parse_argc,parse_argv);
- if(kill_time > MSG_getClock()) {
+ if(kill_time > MSG_get_clock()) {
surf_timer_resource->extension_public->set(kill_time,
(void*) &MSG_process_kill,
(void*) process);
void MSG_launch_application(const char *file)
{
xbt_assert0(msg_global,"MSG_global_init_args has to be called before MSG_launch_application.");
- STag_process_fun = parse_process_init;
- ETag_argument_fun = parse_argument;
- ETag_process_fun = parse_process_finalize;
+ STag_surfxml_process_fun = parse_process_init;
+ ETag_surfxml_argument_fun = parse_argument;
+ ETag_surfxml_process_fun = parse_process_finalize;
surf_parse_open(file);
xbt_assert1((!surf_parse()),"Parse error in %s",file);
surf_parse_close();
*/
void MSG_function_register(const char *name,m_process_code_t code)
{
- xbt_assert0(msg_global,"MSG_global_init_args has to be called before MSG_function_register.");
+ xbt_assert0(msg_global,"MSG_global_init has to be called before MSG_function_register.");
xbt_dict_set(msg_global->registered_functions,name,code,NULL);
}
{
m_process_code_t code = NULL;
- xbt_assert0(msg_global,"MSG_global_init_args has to be called before MSG_get_registered_function.");
-
- code = xbt_dict_get(msg_global->registered_functions,name);
-
- return code;
-}
-
-/** \ingroup msg_easier_life
- * \brief Get the arguments of the current process.
- * \deprecated{Not useful since #m_process_code_t is int (*)(int argc, char *argv[])}
- *
- * This functions returns the values set for the current process
- * using #MSG_set_arguments or #MSG_launch_application.
- * \param argc the number of arguments
- * \param argv the arguments table
- */
-MSG_error_t MSG_get_arguments(int *argc, char ***argv)
-{
- m_process_t process = MSG_process_self();
- simdata_process_t simdata = NULL;
-
- xbt_assert0((argc) && (argv), "Invalid parameters");
- simdata = process->simdata;
- *argc = simdata->argc;
- *argv = simdata->argv;
-
- return MSG_OK;
-}
+ xbt_assert0(msg_global,"MSG_global_init has to be called before MSG_get_registered_function.");
-/* \ingroup msg_easier_life
- * \brief Set the arguments of a process.
- *
- * This functions sets the argument number and the arguments table for a
- * proces.
- * \param process is the process you want to modify
- * \param argc the number of arguments
- * \param argv the arguments table
- */
-MSG_error_t MSG_set_arguments(m_process_t process,int argc, char *argv[])
-{
- xbt_assert0(0,"Deprecated ! Do not use anymore. "
- "Use MSG_process_create_with_arguments instead.\n");
+ code = xbt_dict_get_or_null(msg_global->registered_functions,name);
- return MSG_OK;
+ return code;
}