show found markers, hex::show: include last incomplete line
This commit is contained in:
parent
ebda13e738
commit
6b3aac87fe
@ -43,9 +43,13 @@ namespace hex
|
|||||||
unsigned char elcl = ( (int)el > 0x1f && (int)el < 0x7f) ? el : '.';
|
unsigned char elcl = ( (int)el > 0x1f && (int)el < 0x7f) ? el : '.';
|
||||||
sschr<<std::dec<<std::setfill(' ')<<elcl;
|
sschr<<std::dec<<std::setfill(' ')<<elcl;
|
||||||
|
|
||||||
// do actual printing
|
// do actual printing (including very last potentially incomplete line)
|
||||||
if ( (idx+1)%width == 0 )
|
if ( (idx+1)%width == 0 || i == breakidx-1 )
|
||||||
{
|
{
|
||||||
|
// fill up any hexadecimal string that is shorter than default width
|
||||||
|
while ( sshex.str().size() < 3*width+10 ) sshex<<" ";
|
||||||
|
|
||||||
|
// print hexadecimal and ascii representation
|
||||||
std::cout<<sshex.str()<<" "<<sschr.str();
|
std::cout<<sshex.str()<<" "<<sschr.str();
|
||||||
std::cout<<"\n";
|
std::cout<<"\n";
|
||||||
|
|
||||||
|
@ -106,6 +106,9 @@ public:
|
|||||||
// proceed only, if markers suggest data is valid *.raw format
|
// proceed only, if markers suggest data is valid *.raw format
|
||||||
if ( valid_ )
|
if ( valid_ )
|
||||||
{
|
{
|
||||||
|
// show detected markers
|
||||||
|
if ( showlog ) display_markers();
|
||||||
|
|
||||||
// split data corresponding to markers into segments
|
// split data corresponding to markers into segments
|
||||||
split_segments();
|
split_segments();
|
||||||
|
|
||||||
@ -221,6 +224,22 @@ public:
|
|||||||
if ( totalmarksize < 100 ) valid_ = false;
|
if ( totalmarksize < 100 ) valid_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display content of found markers
|
||||||
|
void display_markers()
|
||||||
|
{
|
||||||
|
for (std::pair<std::string,std::vector<unsigned char>> mrk : markers_ )
|
||||||
|
{
|
||||||
|
// extract data of marker
|
||||||
|
std::vector<unsigned char> mrkdat = this->datasec_[mrk.first];
|
||||||
|
|
||||||
|
// show name of marker and its data
|
||||||
|
std::cout<<mrk.first<<" : "<<mrkdat.size()
|
||||||
|
<<"\n------------------------------------\n";
|
||||||
|
hex::show(mrkdat,32,0,0);
|
||||||
|
}
|
||||||
|
std::cout<<"\n";
|
||||||
|
}
|
||||||
|
|
||||||
// get all predefined markers
|
// get all predefined markers
|
||||||
std::map<std::string,std::vector<unsigned char>> get_markers()
|
std::map<std::string,std::vector<unsigned char>> get_markers()
|
||||||
{
|
{
|
||||||
|
2
makefile
2
makefile
@ -11,7 +11,7 @@ CCC = g++ -std=c++11
|
|||||||
OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
OPT = -O3 -Wall -mavx -mno-tbm -mf16c -mno-f16c
|
||||||
|
|
||||||
# build executable
|
# build executable
|
||||||
$(EXE) : $(SRC)main.cpp $(LIB)raweat.hpp
|
$(EXE) : $(SRC)main.cpp $(LIB)raweat.hpp $(LIB)hexshow.hpp
|
||||||
$(CCC) $(OPT) $< -o $@
|
$(CCC) $(OPT) $< -o $@
|
||||||
|
|
||||||
eatdev : $(SRC)main_dev.cpp $(LIB)raweat.hpp
|
eatdev : $(SRC)main_dev.cpp $(LIB)raweat.hpp
|
||||||
|
@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
|||||||
std::string rawfile(argv[1]);
|
std::string rawfile(argv[1]);
|
||||||
|
|
||||||
// declare instance of "raw_eater"
|
// declare instance of "raw_eater"
|
||||||
raw_eater eatraw(rawfile);
|
raw_eater eatraw(rawfile,true);
|
||||||
|
|
||||||
//eatraw.show_markers();
|
//eatraw.show_markers();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user