31 {
33
34 if ( argc != 2 )
35 {
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 {
44 std::cerr << "File `" << argv[1] << "' does not exist?!" << std::endl;
45 std::exit( 1 );
46 }
47 size_t offset = 0;
48
51 paged_event[i] =
new uint32_t[
PAGE_SIZE /
sizeof( uint32_t )];
52
53 while ( in && in.good() && !in.eof() )
54 {
55
57 in.read( (
char*)
data, 8 );
58 if ( !in.good() || in.eof() ) break;
60 {
61
62 std::cout <<
"Word at offset " <<
HEX( offset ) <<
" is not "
64 std::exit( 1 );
65 }
66
67
68 in.seekg( offset );
69
70 size_t to_read =
data[1] << 2;
71 size_t page_counter = 0;
72 std::cout << "Loading page";
73 while ( to_read > 0 )
74 {
76 in.read( (char*)paged_event[page_counter], readnow );
77 to_read -= readnow;
78 ++page_counter;
79 std::cout << " " << page_counter;
80 }
81 std::cout << ": ";
83 for ( size_t i = 0; i < page_counter; ++i )
84 {
85 myvec[i].iov_base = paged_event[i];
87 }
88
89 myvec[page_counter - 1].iov_len =
data[1] << 2 - ( page_counter - 1 ) *
PAGE_SIZE;
90
92
93 try
94 {
96 fe.check_tree();
97
98 std::cout << "Event " << fe.lvl1_id() << " is Ok." << std::endl;
99
100
101 offset +=
data[1] << 2;
103 {
104 std::cerr << std::endl <<
"Uncaught eformat issue: " << ex.
what() << std::endl;
105 std::cout << "Trying to continue..." << std::endl;
106 continue;
108 {
109 std::cerr << std::endl <<
"Uncaught ERS issue: " << ex.
what() << std::endl;
111 std::exit( 1 );
112 } catch ( std::exception& ex )
113 {
114 std::cerr << std::endl << "Uncaught std exception: " << ex.what() << std::endl;
116 std::exit( 1 );
117 } catch ( ... )
118 {
119 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
121 std::exit( 1 );
122 }
123 }
124
126 return 0;
127}
const char * what() const
Human description message.