* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "internal_config.h"
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "internal_config.h"
{
xbt_replay_reader_t res = xbt_new0(s_xbt_replay_reader_t,1);
res->fp = fopen(filename, "r");
{
xbt_replay_reader_t res = xbt_new0(s_xbt_replay_reader_t,1);
res->fp = fopen(filename, "r");
- xbt_assert(res->fp != NULL, "Cannot open %s: %s", filename,
- strerror(errno));
+ if (res->fp == NULL)
+ xbt_die("Cannot open %s: %s", filename, strerror(errno));
void xbt_replay_action_register(const char *action_name, action_fun function)
{
char* lowername = str_tolower (action_name);
void xbt_replay_action_register(const char *action_name, action_fun function)
{
char* lowername = str_tolower (action_name);
- xbt_dict_set(action_funs, lowername, function, NULL);
+ xbt_dict_set(xbt_action_funs, lowername, function, NULL);
void xbt_replay_action_unregister(const char *action_name)
{
char* lowername = str_tolower (action_name);
void xbt_replay_action_unregister(const char *action_name)
{
char* lowername = str_tolower (action_name);
-void _xbt_replay_action_init(void)
+/** @brief Initializes the replay mechanism, and returns true if (and only if) it was necessary
+ *
+ * It returns false if it was already done by another process.
+ */
+int _xbt_replay_action_init(void)
- action_funs = xbt_dict_new_homogeneous(NULL);
- action_queues = xbt_dict_new_homogeneous(NULL);
+ xbt_action_funs = xbt_dict_new_homogeneous(NULL);
+ xbt_action_queues = xbt_dict_new_homogeneous(NULL);
+ return 1;
while ((evt=xbt_replay_reader_get(reader))) {
if (!strcmp(argv[0],evt[0])) {
char* lowername = str_tolower (evt[1]);
while ((evt=xbt_replay_reader_get(reader))) {
if (!strcmp(argv[0],evt[0])) {
char* lowername = str_tolower (evt[1]);
} else {
XBT_WARN("%s: Ignore trace element not for me",
xbt_replay_reader_position(reader));
} else {
XBT_WARN("%s: Ignore trace element not for me",
xbt_replay_reader_position(reader));
// cleanup and split the string I just read
char *comment = strchr(action_line, '#');
if (comment != NULL)
// cleanup and split the string I just read
char *comment = strchr(action_line, '#');
if (comment != NULL)
if (otherqueue == NULL) { // Damn. Create the queue of that guy
otherqueue =
xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
if (otherqueue == NULL) { // Damn. Create the queue of that guy
otherqueue =
xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
- xbt_dict_set(action_queues, evtname, otherqueue, NULL);
+ xbt_dict_set(xbt_action_queues, evtname, otherqueue, NULL);