Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "further cleanups"
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 16 Mar 2017 20:09:33 +0000 (21:09 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 16 Mar 2017 20:09:33 +0000 (21:09 +0100)
This reverts commit 40e6c8a3a8d6a2711fa48453e99df411a8afa874.

include/xbt/replay.hpp
src/xbt/xbt_replay.cpp

index 04197c2..be41b1c 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef XBT_REPLAY_HPP
 #define XBT_REPLAY_HPP
 
+#include "xbt/dict.h"
 #ifdef __cplusplus
 #include <fstream>
 #include <queue>
index dcb97ce..856d509 100644 (file)
@@ -4,11 +4,17 @@
 /* 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 "src/internal_config.h"
 #include "xbt/ex.hpp"
 #include "xbt/log.h"
 #include "xbt/replay.hpp"
+#include "xbt/str.h"
+#include "xbt/sysdep.h"
 
 #include <boost/algorithm/string.hpp>
+#include <ctype.h>
+#include <errno.h>
+#include <wchar.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(replay,xbt,"Replay trace reader");
 
@@ -30,12 +36,17 @@ class ReplayReader {
   std::string line;
 
 public:
+  char* filename_;
+  int linenum = 0;
+
   explicit ReplayReader(const char* filename)
   {
+    filename_ = xbt_strdup(filename);
     fs        = new std::ifstream(filename, std::ifstream::in);
   }
   ~ReplayReader()
   {
+    free(filename_);
     delete fs;
   }
   bool get(ReplayAction* action);
@@ -44,6 +55,7 @@ public:
 bool ReplayReader::get(ReplayAction* action)
 {
   read_and_trim_line(fs, &line);
+  linenum++;
 
   if (line.length() > 0 && line.find("#") == std::string::npos) {
     boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on);
@@ -162,7 +174,7 @@ int replay_runner(int argc, char* argv[])
       if (evt->at(0).compare(argv[0]) == 0) {
         simgrid::xbt::handle_action(evt);
       } else {
-        XBT_WARN("Ignore trace element ... not for me");
+        XBT_WARN("%s:%d: Ignore trace element not for me", reader->filename_, reader->linenum);
       }
       evt->clear();
     }