Bitstream Interpretation Library (BIL)
0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
datagen
xdlrc_convert
xdlrc_convert.cpp
Go to the documentation of this file.
1
8
#include <cstdlib>
9
#include <cstring>
10
#include <fstream>
11
#include <iostream>
12
#include <
datagen/xdlrc_convert/xdlrc_convertArgs.hpp
>
13
#include <
datagen/xdlrc_convert/xdlrc_convertMsgs.hpp
>
14
#include <
exception/CommandLineException.hpp
>
15
#include <
xdlrc/model/Device.hpp
>
16
#include <
xdlrc/parser/XDLRCParser.hpp
>
17
18
19
int
main
(
int
argc,
char
** argv)
20
{
21
using namespace
bil;
22
23
try
24
{
25
// process given command line
26
std::cout <<
SPLASH_MSG
;
27
parseCommandLine
(argc, argv);
28
29
// open xdlrc file and prepare parser
30
std::ifstream inputStream(
xdlrcFileName
.c_str());
31
XDLRCParser
parser;
32
Device
device;
33
34
// do first parsing pass
35
std::cout <<
FIRST_PASS_MSG
;
36
parser.parseFirstPass(inputStream, device);
37
// reset file pointer to beginning
38
inputStream.clear();
39
inputStream.seekg(0);
40
// do second parsing pass
41
std::cout <<
SECOND_PASS_MSG
;
42
parser.parseSecondPass();
43
44
// write parsed data into file
45
std::ofstream outputStream(
outFileName
.c_str(), std::ios::binary);
46
writeBinary
(device, outputStream);
47
48
// finished
49
std::cout <<
FINISHED_MSG
;
50
}
51
catch
(
const
CommandLineException
& e)
52
{
53
std::cout <<
ERROR_MSG
<< e.what() <<
INFO_MSG
;
54
return
EXIT_FAILURE;
55
}
56
catch
(...)
57
{
58
std::cout <<
ERROR_UNKNOWN_MSG
;
59
return
EXIT_FAILURE;
60
}
61
return
EXIT_SUCCESS;
62
}
Generated on Wed Aug 8 2012 21:57:40 for Bitstream Interpretation Library (BIL) by
1.8.1.1