32{
34
35 if ( argc != 2 ) {
36 std::cerr << "usage: " << argv[0] << " <file>" << std::endl;
37 std::exit(1);
38 }
39
40
41 std::fstream in(argv[1], std::ios::in|std::ios::binary);
42 if (!in) {
43 std::cerr << "File `" << argv[1] << "' does not exist?!" << std::endl;
44 std::exit(1);
45 }
46 size_t offset = 0;
47
50 paged_event[i] =
new uint32_t[
PAGE_SIZE/
sizeof(uint32_t)];
51
52 while (in && in.good() && ! in.eof()) {
53
54 uint32_t data[2];
55 in.read((char*)data, 8);
56 if (!in.good() || in.eof()) break;
58
59 std::cout <<
"Word at offset " <<
HEX(offset) <<
" is not "
61 std::exit(1);
62 }
63
64
65 in.seekg(offset);
66
67 size_t to_read = data[1]<<2;
68 size_t page_counter = 0;
69 std::cout << "Loading page";
70 while (to_read > 0) {
72 in.read((char*)paged_event[page_counter], readnow);
73 to_read -= readnow;
74 ++page_counter;
75 std::cout << " " << page_counter;
76 }
77 std::cout << ": ";
79 for (size_t i=0; i<page_counter; ++i) {
80 myvec[i].iov_base = paged_event[i];
82 }
83
84 myvec[page_counter-1].iov_len = data[1]<<2 - (page_counter-1)*
PAGE_SIZE;
85
86
88
89 try {
91 fe(mymemory.begin());
92 fe.check_tree();
93
94 std::cout << "Event " << fe.lvl1_id() << " is Ok." << std::endl;
95
96
97 offset += data[1]<<2;
98 }
100 std::cerr << std::endl
101 <<
"Uncaught eformat issue: " << ex.
what() << std::endl;
102 std::cout << "Trying to continue..." << std::endl;
103 continue;
104 }
106 std::cerr << std::endl
107 <<
"Uncaught ERS issue: " << ex.
what() << std::endl;
109 std::exit(1);
110 }
111 catch (std::exception& ex) {
112 std::cerr << std::endl
113 << "Uncaught std exception: " << ex.what() << std::endl;
115 std::exit(1);
116 }
117 catch (...) {
118 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
120 std::exit(1);
121 }
122
123 }
124
126 return 0;
127}
const char * what() const
Human description message.