Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b39a7f695 | |||
fd106bccdc | |||
8e54450ca4 | |||
a1b692e60b | |||
![]() |
0c31724556 | ||
![]() |
db5ef5d6fa | ||
265e2769e0 |
8
Makefile
8
Makefile
@ -91,8 +91,12 @@ package: all
|
||||
# copy licence and information :
|
||||
@cp README package/$(PROG_NAME)/usr/share/doc/README
|
||||
@cp licence.txt package/$(PROG_NAME)/usr/share/doc/copyright
|
||||
@echo "First generation in progress" >> package/$(PROG_NAME)/usr/share/doc/changelog
|
||||
@#cp -vf $(PROG_NAME) package/$(PROG_NAME)/usr/bin/
|
||||
@echo "First generation in progress" > package/$(PROG_NAME)/usr/share/doc/changelog
|
||||
@cp -vf $(PROG_NAME) package/$(PROG_NAME)/usr/bin/
|
||||
@#cp -vf data/*.xml package/$(PROG_NAME)/usr/share/edn/
|
||||
@cd package; dpkg-deb --build $(PROG_NAME)
|
||||
|
||||
install:
|
||||
sudo cp -fv hexViewer /usr/bin/hexViewer
|
||||
|
||||
|
||||
|
2
README
2
README
@ -4,4 +4,4 @@ This software is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
|
||||
Copyright: 2010 Edouard DUPIN, all right reserved
|
||||
|
||||
License: GNU Lesser General Public License (LGPL) v3.0
|
||||
License: GNU General Public License (GPL) v3.0
|
||||
|
220
display.c
220
display.c
@ -19,11 +19,10 @@
|
||||
*/
|
||||
#include "display.h"
|
||||
|
||||
extern FILE *filePointer[2];
|
||||
extern char fileName[2][2096];
|
||||
extern fileProperties_ts fileProp[2];
|
||||
|
||||
|
||||
void drawLine(void)
|
||||
void drawLine(bool returnLine)
|
||||
{
|
||||
showTypeSize_te mySize = getTypeSize();
|
||||
showType_te myType = getType();
|
||||
@ -34,16 +33,16 @@ void drawLine(void)
|
||||
switch(mySize)
|
||||
{
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
printf("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
printf("-------------------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("-------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -54,25 +53,71 @@ void drawLine(void)
|
||||
switch(mySize)
|
||||
{
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("---------------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------\n"COLOR_NORMAL);
|
||||
printf("-----------------------------------------------------------------------------------------------------------------------");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (returnLine==true) {
|
||||
printf("\n"COLOR_NORMAL);
|
||||
} else {
|
||||
printf("\r"COLOR_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char* getTypeChar(showType_te myType)
|
||||
{
|
||||
switch(myType)
|
||||
{
|
||||
case SHOW_TYPE_HEX:
|
||||
return "Hexadecimal ";
|
||||
break;
|
||||
case SHOW_TYPE_DECIMAL_SIGNED:
|
||||
return "Dec Signed ";
|
||||
break;
|
||||
case SHOW_TYPE_DECIMAL_UNSIGNED:
|
||||
return "Dec Unsigned";
|
||||
break;
|
||||
default :
|
||||
return "? ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
const char* getTypeSizeChar(showTypeSize_te mySize)
|
||||
{
|
||||
switch(mySize)
|
||||
{
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
return " 8 bits ";
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
return " 16 bits ";
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
return " 32 bits ";
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
return " 64 bits ";
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_128:
|
||||
return "128 bits ";
|
||||
break;
|
||||
default :
|
||||
return " ? bits ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void showConfiguration(void)
|
||||
{
|
||||
@ -84,54 +129,32 @@ void showConfiguration(void)
|
||||
printf(GO_TOP);
|
||||
|
||||
printf(COLOR_BOLD_GREEN);
|
||||
drawLine();
|
||||
drawLine(true);
|
||||
printf(COLOR_GREEN);
|
||||
printf("| hexViewer | offset : %7d octets | ", (int)getOfsetFile());
|
||||
printf(" Type (t) : ");
|
||||
switch(myType)
|
||||
{
|
||||
case SHOW_TYPE_HEX:
|
||||
printf("Hexadecimal ");
|
||||
break;
|
||||
case SHOW_TYPE_DECIMAL_SIGNED:
|
||||
printf("Decimal Signed ");
|
||||
break;
|
||||
case SHOW_TYPE_DECIMAL_UNSIGNED:
|
||||
printf("Decimal Unsigned");
|
||||
break;
|
||||
default :
|
||||
printf("? ");
|
||||
break;
|
||||
}
|
||||
printf("| hexViewer | offset : %7d octets ", (int)getOfsetFile());
|
||||
printf(" | Type (t) : %s", getTypeChar(myType));
|
||||
printf(" | ");
|
||||
printf(" Size (s) : ");
|
||||
switch(mySize)
|
||||
{
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
printf(" 8 bits ");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
printf(" 16 bits ");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
printf(" 32 bits ");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
printf(" 64 bits ");
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_128:
|
||||
printf("128 bits ");
|
||||
break;
|
||||
default :
|
||||
printf(" ? bits ");
|
||||
break;
|
||||
}
|
||||
printf(" | Size (s) : %s", getTypeSizeChar(mySize));
|
||||
printf(" | Slot (u+/i-/j/k) : %d (%s)", getSlotSize(), (getSlotDisplayMode()?"enable ":"disable"));
|
||||
printf(" | Padding (o+/p-/m) : %d ", getPaddingOffsetFile());
|
||||
printf(" | ");
|
||||
|
||||
printf(COLOR_NORMAL"\n");
|
||||
printf(COLOR_GREEN"| File Left << | " COLOR_BOLD_GREEN "%s\n" COLOR_NORMAL, fileName[0]);
|
||||
printf(COLOR_GREEN"| File Right >> | " COLOR_BOLD_GREEN "%s\n"COLOR_NORMAL, fileName[1]);
|
||||
printf(COLOR_GREEN"| File Left << | [%s%s slot=%4d delta=%4d] " COLOR_BOLD_GREEN "%s\n" COLOR_NORMAL,
|
||||
getTypeChar(fileProp[0].type),
|
||||
getTypeSizeChar(fileProp[0].typeSize),
|
||||
fileProp[0].slotSize,
|
||||
fileProp[0].delta,
|
||||
fileProp[0].name);
|
||||
printf(COLOR_GREEN"| File Right >> | [%s%s slot=%4d delta=%4d] " COLOR_BOLD_GREEN "%s\n"COLOR_NORMAL,
|
||||
getTypeChar(fileProp[1].type),
|
||||
getTypeSizeChar(fileProp[1].typeSize),
|
||||
fileProp[1].slotSize,
|
||||
fileProp[1].delta,
|
||||
fileProp[1].name);
|
||||
|
||||
printf(COLOR_BOLD_GREEN);
|
||||
drawLine();
|
||||
drawLine(true);
|
||||
}
|
||||
|
||||
void printNoElement(showType_te localType, showTypeSize_te localSize)
|
||||
@ -265,10 +288,13 @@ typedef union {
|
||||
|
||||
void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosition, int32_t currentPadding)
|
||||
{
|
||||
if (filePointer1==NULL && filePointer2==NULL) {
|
||||
return;
|
||||
}
|
||||
inputData_tu data1;
|
||||
inputData_tu data2;
|
||||
uint32_t i;
|
||||
uint32_t j;
|
||||
uint32_t jjj;
|
||||
|
||||
showConfiguration();
|
||||
|
||||
@ -330,8 +356,34 @@ void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosit
|
||||
|
||||
// Display the main show
|
||||
printf(COLOR_BOLD_YELLOW);
|
||||
drawLine();
|
||||
for (j=0; j < (uint32_t)(GetNumberOfRaw()-NB_HEARDER_RAW); j++) {
|
||||
drawLine(true);
|
||||
int32_t counterLineID;
|
||||
int32_t offsetDisplaySlot=0;
|
||||
int32_t sizeSlotByte;
|
||||
switch(getTypeSize())
|
||||
{
|
||||
default:
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
sizeSlotByte = 1*getSlotSize();
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
sizeSlotByte = 2*getSlotSize();
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_FLOAT:
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
sizeSlotByte = 4*getSlotSize();
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_DOUBLE:
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
sizeSlotByte = 8*getSlotSize();
|
||||
break;
|
||||
}
|
||||
if (true == getSlotDisplayMode() && 0<getSlotSize()) {
|
||||
int32_t nbElementToRead = NB_DATA_PER_LINE*4;
|
||||
int32_t positionInSlot = curentFilePosition%sizeSlotByte;
|
||||
offsetDisplaySlot = positionInSlot%nbElementToRead;
|
||||
}
|
||||
for (jjj=0, counterLineID=0; jjj < (uint32_t)(GetNumberOfRaw()-NB_HEARDER_RAW); jjj++, counterLineID++) {
|
||||
uint32_t readFile1 = 0;
|
||||
uint32_t readFile2 = 0;
|
||||
int32_t lineNumber = 0;
|
||||
@ -339,23 +391,51 @@ void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosit
|
||||
// read data in files :
|
||||
memset(data1.data_8, 0, 16 * sizeof(uint8_t));
|
||||
memset(data2.data_8, 0, 16 * sizeof(uint8_t));
|
||||
|
||||
// Generate the ofset in the file
|
||||
int32_t positionStartDisplayFile1 = curentFilePosition + j*NB_DATA_PER_LINE*4;
|
||||
int32_t positionStartDisplayFile2 = curentFilePosition + j*NB_DATA_PER_LINE*4;
|
||||
int32_t positionStartDisplayFile1 = curentFilePosition + offsetDisplaySlot;
|
||||
int32_t positionStartDisplayFile2 = curentFilePosition + offsetDisplaySlot;
|
||||
if (currentPadding < 0) {
|
||||
positionStartDisplayFile1 += currentPadding;
|
||||
} else {
|
||||
positionStartDisplayFile2 -= currentPadding;
|
||||
}
|
||||
if (true == getSlotDisplayMode() && 0<getSlotSize()) {
|
||||
if (positionStartDisplayFile1%sizeSlotByte==0) {
|
||||
drawLine(false);
|
||||
printf(" Frame | %9d |\n", positionStartDisplayFile1/sizeSlotByte);
|
||||
jjj++;
|
||||
}
|
||||
if (jjj >= (uint32_t)(GetNumberOfRaw()-NB_HEARDER_RAW)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t nbElementToRead = NB_DATA_PER_LINE*4;
|
||||
if (true == getSlotDisplayMode() && 0<getSlotSize()) {
|
||||
int32_t posituionInSlot = positionStartDisplayFile1%sizeSlotByte;
|
||||
if (posituionInSlot+nbElementToRead>sizeSlotByte) {
|
||||
nbElementToRead = sizeSlotByte - posituionInSlot;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (nbElementToRead != NB_DATA_PER_LINE*4) {
|
||||
printf(" \r");
|
||||
printf("nbElementToRead=%d\n",nbElementToRead);
|
||||
jjj++;
|
||||
}
|
||||
*/
|
||||
readFile1 = 0;
|
||||
int32_t readStartFile1 = 16;
|
||||
if (filePointer1 != NULL) {
|
||||
if (positionStartDisplayFile1 >= 0) {
|
||||
fseek(filePointer1 , positionStartDisplayFile1 , SEEK_SET );
|
||||
readFile1 = fread(data1.data_8, sizeof(uint8_t), 16, filePointer1);
|
||||
fseek(filePointer1 , positionStartDisplayFile1+fileProp[0].fileBasicOffset , SEEK_SET );
|
||||
readFile1 = fread(data1.data_8, sizeof(uint8_t), nbElementToRead, filePointer1);
|
||||
readStartFile1 = 0;
|
||||
} else if (positionStartDisplayFile1 > -NB_DATA_PER_LINE*4) {
|
||||
fseek(filePointer1 , 0 , SEEK_SET );
|
||||
fseek(filePointer1 , fileProp[0].fileBasicOffset , SEEK_SET );
|
||||
// Special case of the partial display ...
|
||||
readFile1 = fread(data1.data_8 - positionStartDisplayFile1, sizeof(uint8_t), NB_DATA_PER_LINE*4 + positionStartDisplayFile1, filePointer1);
|
||||
readStartFile1 = NB_DATA_PER_LINE*4 - readFile1;
|
||||
@ -366,11 +446,11 @@ void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosit
|
||||
int32_t readStartFile2 = 16;
|
||||
if (filePointer2 != NULL) {
|
||||
if (positionStartDisplayFile2 >= 0) {
|
||||
fseek(filePointer2 , positionStartDisplayFile2 , SEEK_SET );
|
||||
readFile2 = fread(data2.data_8, sizeof(uint8_t), 16, filePointer2);
|
||||
fseek(filePointer2 , positionStartDisplayFile2+fileProp[1].fileBasicOffset , SEEK_SET );
|
||||
readFile2 = fread(data2.data_8, sizeof(uint8_t), nbElementToRead, filePointer2);
|
||||
readStartFile2 = 0;
|
||||
} else if (positionStartDisplayFile2 > -NB_DATA_PER_LINE*4) {
|
||||
fseek(filePointer2 , 0 , SEEK_SET );
|
||||
fseek(filePointer2 , fileProp[1].fileBasicOffset , SEEK_SET );
|
||||
// Special case of the partial display ...
|
||||
readFile2 = fread(data2.data_8 - positionStartDisplayFile2, sizeof(uint8_t), NB_DATA_PER_LINE*4 + positionStartDisplayFile2, filePointer2);
|
||||
readStartFile2 = NB_DATA_PER_LINE*4 - readFile2;
|
||||
@ -599,6 +679,8 @@ void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosit
|
||||
} else {
|
||||
printf(COLOR_BOLD_MAGENTA" | "COLOR_BOLD_YELLOW"| "COLOR_NORMAL " |\n");
|
||||
}
|
||||
// update file positions :
|
||||
offsetDisplaySlot += nbElementToRead;
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,7 +699,11 @@ void * threadDisplay (void * p_data)
|
||||
if (getParamModification()) {
|
||||
uint32_t curentFilePosition = getOfsetFile();
|
||||
uint32_t curentFilePadding = getPaddingOffsetFile();
|
||||
compareFile(filePointer[0],filePointer[1], curentFilePosition, curentFilePadding);
|
||||
compareFile(fileProp[0].pointer,fileProp[1].pointer, curentFilePosition, curentFilePadding);
|
||||
if (true==getHelpDisplay()) {
|
||||
showConfiguration();
|
||||
usage();
|
||||
}
|
||||
} else {
|
||||
usleep(10000);
|
||||
}
|
||||
|
78
dump_test.sh
Executable file
78
dump_test.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#! /bin/bash
|
||||
|
||||
DUMP_DIR_EXP=.
|
||||
DUMP_DIR_MATLAB=..
|
||||
|
||||
MATLAB_PREFIX=m__
|
||||
TANGO_PREFIX=exp
|
||||
|
||||
DUMP_FILES=(
|
||||
'WTX_')
|
||||
|
||||
#echo "Dump directory: $DUMP_DIR"
|
||||
#echo "Dump files: ${DUMP_FILES[@]}"
|
||||
|
||||
COLOR_RESET=$(tput sgr0)
|
||||
COLOR_FILENAME=$(tput bold)$(tput setaf 3)
|
||||
COLOR_BIT_EXACT=$(tput bold)$(tput setaf 4)
|
||||
COLOR_DIFFERENT=$(tput bold)$(tput setaf 1)
|
||||
COLOR_ERROR=$(tput bold)$(tput setaf 5)
|
||||
|
||||
for i in "${DUMP_FILES[@]}" ; do
|
||||
for (( FileID=0; FileID<=1000; FileID++ )) ; do
|
||||
VALUE="010"
|
||||
if [ $FileID -lt 10 ] ; then
|
||||
VALUE="00$FileID"
|
||||
elif [ $FileID -lt 100 ] ; then
|
||||
VALUE="0$FileID"
|
||||
else
|
||||
VALUE="$FileID"
|
||||
fi
|
||||
|
||||
MATLAB_DUMP="$DUMP_DIR_MATLAB/$MATLAB_PREFIX$i$VALUE""_*"
|
||||
TANGO_DUMP="$DUMP_DIR_EXP/$TANGO_PREFIX$i$VALUE""_*"
|
||||
|
||||
# TODO : afficher quend un des deux fichier existe
|
||||
|
||||
if [ ! -e "$MATLAB_DUMP" ] ; then
|
||||
finanameLS=`ls $MATLAB_DUMP 2> /dev/null`
|
||||
if [ ! -e "$finanameLS" ] ; then
|
||||
#echo -e -n "$COLOR_ERROR [ ??? ]
"
|
||||
#echo -e -n "\t\t\t\t\t$MATLAB_DUMP$COLOR_RESET\n"
|
||||
#echo -e -n "\t\t\t\t\t\t\t\t\t\t\t$COLOR_FILENAME$TANGO_DUMP$COLOR_RESET\n"
|
||||
continue
|
||||
else
|
||||
MATLAB_DUMP=$finanameLS
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -e "$TANGO_DUMP" ] ; then
|
||||
finanameLS=`ls $TANGO_DUMP 2> /dev/null`
|
||||
if [ ! -e "$finanameLS" ] ; then
|
||||
#echo -e -n "$COLOR_ERROR [ ??? ]
"
|
||||
#echo -e -n "\t\t\t\t\t$COLOR_FILENAME$MATLAB_DUMP$COLOR_RESET
"
|
||||
#echo -e -n "\t\t\t\t\t\t\t\t\t\t\t$COLOR_ERROR$TANGO_DUMP$COLOR_RESET\n"
|
||||
continue
|
||||
else
|
||||
TANGO_DUMP=$finanameLS
|
||||
fi
|
||||
fi
|
||||
|
||||
hexViewer -d $MATLAB_DUMP $TANGO_DUMP > .tmpResultHexViewer.txt
|
||||
VALUE_ERROR=$?
|
||||
RESULT=`cat .tmpResultHexViewer.txt`
|
||||
if [ $VALUE_ERROR -eq '0' ] ; then
|
||||
echo -e -n "$COLOR_ERROR [ OK ] $COLOR_RESET
"
|
||||
echo -e -n "\t\t\t\t\t$COLOR_FILENAME$MATLAB_DUMP$COLOR_RESET
"
|
||||
echo -e -n "\t\t\t\t\t\t\t\t\t\t\t$COLOR_FILENAME$TANGO_DUMP$COLOR_RESET
"
|
||||
echo -e -n "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$RESULT\n"
|
||||
else
|
||||
echo -e -n "$COLOR_DIFFERENT [ERROR] $COLOR_RESET
"
|
||||
echo -e -n "\t\toctet=$VALUE_ERROR
"
|
||||
echo -e -n "\t\t\t\t\t$COLOR_FILENAME$MATLAB_DUMP$COLOR_RESET
"
|
||||
echo -e -n "\t\t\t\t\t\t\t\t\t\t\t$COLOR_FILENAME$TANGO_DUMP$COLOR_RESET
"
|
||||
echo -e -n "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$RESULT\n"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
@ -34,7 +34,7 @@ typedef signed short int int16_t;
|
||||
typedef unsigned long int uint32_t;
|
||||
//typedef signed long int int32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
typedef signed long long int int64_t;
|
||||
//typedef signed long long int int64_t;
|
||||
//typedef unsigned long long long int uint128_t;
|
||||
//typedef signed long long long int int128_t;
|
||||
|
||||
@ -85,6 +85,7 @@ typedef signed long long int int64_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
SHOW_TYPE_UNKNOW,
|
||||
SHOW_TYPE_HEX,
|
||||
SHOW_TYPE_DECIMAL_SIGNED,
|
||||
SHOW_TYPE_DECIMAL_UNSIGNED
|
||||
@ -92,12 +93,26 @@ typedef enum {
|
||||
|
||||
|
||||
typedef enum {
|
||||
SHOW_TYPE_SIZE_UNKNOW,
|
||||
SHOW_TYPE_SIZE_8,
|
||||
SHOW_TYPE_SIZE_16,
|
||||
SHOW_TYPE_SIZE_32,
|
||||
SHOW_TYPE_SIZE_64,
|
||||
SHOW_TYPE_SIZE_128
|
||||
SHOW_TYPE_SIZE_128,
|
||||
SHOW_TYPE_SIZE_FLOAT,
|
||||
SHOW_TYPE_SIZE_DOUBLE
|
||||
} showTypeSize_te;
|
||||
|
||||
typedef struct {
|
||||
bool availlable;
|
||||
FILE *pointer;
|
||||
uint32_t size;
|
||||
char name[2096];
|
||||
int32_t fileBasicOffset;
|
||||
showType_te type;
|
||||
showTypeSize_te typeSize;
|
||||
int32_t slotSize;
|
||||
int32_t delta;
|
||||
} fileProperties_ts;
|
||||
|
||||
#endif
|
||||
|
419
main.c
419
main.c
@ -22,60 +22,34 @@
|
||||
#include "display.h"
|
||||
|
||||
|
||||
|
||||
|
||||
bool filePresent[2] = {false, false};
|
||||
FILE *filePointer[2] = {NULL, NULL};
|
||||
uint32_t filesize[2] = {0, 0};
|
||||
char fileName[2][2096] = {"",""};
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
printf("usage : hexViwer [file_1] [file_2]\n");
|
||||
printf("\t[file_1] : Show the first file only\n");
|
||||
printf("\t[file_2] : if it was precise : Show the comparaison with the first file\n");
|
||||
printf("\t\n");
|
||||
printf("\tInside Usage : \n");
|
||||
printf("\t\t[a] Go to the start of the files\n");
|
||||
printf("\t\t[z] Go to the end of the files (the first push is the File 1, the second push is the file 2) \n");
|
||||
printf("\t\t[q] Quit the curent program\n");
|
||||
printf("\t\t[s] Change the view of the propram of the size of interpretation (8/16/32/64 bits)\n");
|
||||
printf("\t\t[t] Change the interpretation of Data (hexedecimal, Signed Decimal, Unigned Decimal)\n");
|
||||
printf("\t\t[f] Find the first Error when comparing the two files\n");
|
||||
printf("\t\t[UP] Go up (5 lines)\n");
|
||||
printf("\t\t[DOWN] Go down (5 lines)\n");
|
||||
printf("\t\t[LEFT] Go up (one screen)\n");
|
||||
printf("\t\t[RIGHT] Go down (one screen)\n");
|
||||
printf("\t\tAdd padding : \n");
|
||||
printf("\t\t\t[o] Add 1 Byte padding at the left file\n");
|
||||
printf("\t\t\t[O] Add 16 Bytes padding at the left file\n");
|
||||
printf("\t\t\t[p] Add 1 Byte padding at the right file\n");
|
||||
printf("\t\t\t[P] Add 16 Bytes padding at the right file\n");
|
||||
printf("\t\t\t[m] reset padding\n");
|
||||
printf("\t\n");
|
||||
printf("\tCopyright: 2010 Edouard DUPIN, all right reserved\n");
|
||||
printf("\tLicense: GNU Lesser General Public License (LGPL) v3.0\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
fileProperties_ts fileProp[2];
|
||||
|
||||
int32_t findFirstDiff(void)
|
||||
{
|
||||
uint8_t data1, data2;
|
||||
int32_t offset = 0;
|
||||
if( NULL == filePointer[0]
|
||||
|| NULL == filePointer[1] ) {
|
||||
if( NULL == fileProp[0].pointer
|
||||
|| NULL == fileProp[1].pointer ) {
|
||||
return 0;
|
||||
}
|
||||
if(NULL != filePointer[0]) {
|
||||
fseek ( filePointer[0] , 0 , SEEK_SET );
|
||||
int32_t paddingFile = getPaddingOffsetFile();
|
||||
int32_t pad1 = 0;
|
||||
int32_t pad2 = 0;
|
||||
if (paddingFile>0) {
|
||||
pad1 = paddingFile;
|
||||
pad2 = 0;
|
||||
} else {
|
||||
pad1 = 0;
|
||||
pad2 = -1*paddingFile;
|
||||
}
|
||||
if(NULL != filePointer[1]) {
|
||||
fseek ( filePointer[1] , 0 , SEEK_SET );
|
||||
if(NULL != fileProp[0].pointer) {
|
||||
fseek ( fileProp[0].pointer , pad1+fileProp[0].fileBasicOffset , SEEK_SET );
|
||||
}
|
||||
while ( fread(&data1, sizeof(uint8_t), 1, filePointer[0]) == 1
|
||||
&& fread(&data2, sizeof(uint8_t), 1, filePointer[1]) == 1)
|
||||
if(NULL != fileProp[1].pointer) {
|
||||
fseek ( fileProp[1].pointer , pad2+fileProp[1].fileBasicOffset , SEEK_SET );
|
||||
}
|
||||
while ( fread(&data1, sizeof(uint8_t), 1, fileProp[0].pointer) == 1
|
||||
&& fread(&data2, sizeof(uint8_t), 1, fileProp[1].pointer) == 1)
|
||||
{
|
||||
offset ++;
|
||||
if (data1 != data2) {
|
||||
@ -85,52 +59,229 @@ int32_t findFirstDiff(void)
|
||||
return offset;
|
||||
}
|
||||
|
||||
void AutoSetPadding(void)
|
||||
{
|
||||
displayPaddingOffset(0);
|
||||
if( NULL == fileProp[0].pointer
|
||||
|| NULL == fileProp[1].pointer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(NULL != fileProp[0].pointer) {
|
||||
fseek ( fileProp[0].pointer , fileProp[0].fileBasicOffset , SEEK_SET );
|
||||
}
|
||||
int32_t offset1 = 0;
|
||||
char data;
|
||||
while(fread(&data, sizeof(uint8_t), 1, fileProp[0].pointer) == 1) {
|
||||
if (data != 0) {
|
||||
break;
|
||||
}
|
||||
offset1 ++;
|
||||
}
|
||||
if(NULL != fileProp[1].pointer) {
|
||||
fseek ( fileProp[1].pointer , fileProp[1].fileBasicOffset , SEEK_SET );
|
||||
}
|
||||
int32_t offset2 = 0;
|
||||
while(fread(&data, sizeof(uint8_t), 1, fileProp[1].pointer) == 1)
|
||||
{
|
||||
if (data != 0) {
|
||||
break;
|
||||
}
|
||||
offset2 ++;
|
||||
}
|
||||
if (offset1 == offset2) {
|
||||
return;
|
||||
}
|
||||
if (0 == offset1) {
|
||||
return;
|
||||
}
|
||||
if (0 == offset2) {
|
||||
return;
|
||||
}
|
||||
|
||||
displayPaddingOffset(offset1 - offset2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UpdateFilesSize(void)
|
||||
{
|
||||
// get size file 1
|
||||
if ( NULL != filePointer[0]) {
|
||||
fseek ( filePointer[0] , 0 , SEEK_END );
|
||||
filesize[0] = ftell (filePointer[0]);
|
||||
fseek ( filePointer[0] , 0 , SEEK_SET );
|
||||
}
|
||||
// get size file 2
|
||||
if ( NULL != filePointer[1]) {
|
||||
fseek ( filePointer[1] , 0 , SEEK_END );
|
||||
filesize[1] = ftell (filePointer[1]);
|
||||
fseek ( filePointer[1] , 0 , SEEK_SET );
|
||||
// get size for 2 files
|
||||
int32_t iii=0;
|
||||
for (iii=0; iii<2; iii++) {
|
||||
if ( NULL != fileProp[iii].pointer) {
|
||||
fseek ( fileProp[iii].pointer , 0 , SEEK_END );
|
||||
fileProp[iii].size = ftell (fileProp[iii].pointer) - fileProp[iii].fileBasicOffset;
|
||||
fseek ( fileProp[iii].pointer , 0 , SEEK_SET );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OpenFiles(void) {
|
||||
filePointer[0] = NULL;
|
||||
filePointer[1] = NULL;
|
||||
filesize[0] = 0;
|
||||
filesize[1] = 0;
|
||||
if (true == filePresent[0]) {
|
||||
// Open file 1
|
||||
filePointer[0] = fopen(fileName[0], "rb");
|
||||
if ( NULL == filePointer[0]) {
|
||||
//printf("Can not Open [File_1] = %s\n", fileName[0]);
|
||||
|
||||
void ResetProperties(void)
|
||||
{
|
||||
int32_t iii=0;
|
||||
for (iii=0; iii<2; iii++) {
|
||||
fileProp[iii].availlable = false;
|
||||
fileProp[iii].pointer = NULL;
|
||||
fileProp[iii].size = 0;
|
||||
strcpy(fileProp[iii].name, "No-File");
|
||||
fileProp[iii].fileBasicOffset = 0;
|
||||
fileProp[iii].type = SHOW_TYPE_UNKNOW;
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_UNKNOW;
|
||||
fileProp[iii].slotSize = 0;
|
||||
fileProp[iii].delta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpenFiles(void)
|
||||
{
|
||||
int32_t iii=0;
|
||||
for (iii=0; iii<2; iii++) {
|
||||
if (true == fileProp[iii].availlable) {
|
||||
// Open file 1
|
||||
fileProp[iii].pointer = fopen(fileProp[iii].name, "rb");
|
||||
if ( NULL == fileProp[iii].pointer) {
|
||||
//printf("Can not Open [File_1] = %s\n", fileName[0]);
|
||||
}
|
||||
}
|
||||
if (fileProp[iii].pointer==NULL) {
|
||||
continue;
|
||||
}
|
||||
// check if file has specifi header :
|
||||
char dataheader[128];
|
||||
if(16 == fread(&dataheader, sizeof(uint8_t), 16, fileProp[iii].pointer)) {
|
||||
// parse header
|
||||
if( dataheader[0]=='#'
|
||||
&& dataheader[1]=='M'
|
||||
&& dataheader[2]=='E'
|
||||
&& dataheader[3]=='T') {
|
||||
|
||||
// ==> "#MET %c %s %04d "
|
||||
// type unused ...
|
||||
if( dataheader[5] == 'I'
|
||||
|| dataheader[5] == 'F'
|
||||
|| dataheader[5] == 'D') {
|
||||
fileProp[iii].type = SHOW_TYPE_DECIMAL_SIGNED;
|
||||
} else if (dataheader[5] == 'U') {
|
||||
fileProp[iii].type = SHOW_TYPE_DECIMAL_UNSIGNED;
|
||||
} else if (dataheader[5] == 'U') {
|
||||
fileProp[iii].type = SHOW_TYPE_HEX;
|
||||
} else {
|
||||
printf("Error while parsing the header ... \n");
|
||||
fileProp[iii].type = SHOW_TYPE_UNKNOW;
|
||||
}
|
||||
if (strncmp(&dataheader[6], "08", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_8;
|
||||
} else if (strncmp(&dataheader[6], "16", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_16;
|
||||
} else if (strncmp(&dataheader[6], "32", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_32;
|
||||
} else if (strncmp(&dataheader[6], "64", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_64;
|
||||
} else if (strncmp(&dataheader[6], "28", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_128;
|
||||
} else if (strncmp(&dataheader[6], "LO", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_FLOAT;
|
||||
} else if (strncmp(&dataheader[6], "OU", 2)==0) {
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_DOUBLE;
|
||||
} else {
|
||||
printf("Error while parsing the header ... \n");
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_UNKNOW;
|
||||
}
|
||||
char tmpVal[5];
|
||||
tmpVal[0] = dataheader[8];
|
||||
tmpVal[1] = dataheader[9];
|
||||
tmpVal[2] = dataheader[10];
|
||||
tmpVal[3] = dataheader[11];
|
||||
tmpVal[4] = '\0';
|
||||
sscanf(tmpVal, "%04d", &fileProp[iii].slotSize);
|
||||
|
||||
sscanf(&dataheader[12], "%04d", &fileProp[iii].delta);
|
||||
//printf("slot size [%d]=%d\n", iii, fileProp[iii].slotSize);
|
||||
// ofset of the header :
|
||||
fileProp[iii].fileBasicOffset = 16;
|
||||
}
|
||||
} // else : no header present ==> raw file
|
||||
fseek ( fileProp[iii].pointer , fileProp[iii].fileBasicOffset , SEEK_SET );
|
||||
}
|
||||
// check internal properties :
|
||||
if (fileProp[0].fileBasicOffset!=0 && fileProp[1].fileBasicOffset!=0) {
|
||||
if (fileProp[0].typeSize == fileProp[1].typeSize) {
|
||||
setTypeSize(fileProp[0].typeSize);
|
||||
} else {
|
||||
printf("Error The 2 files has not the same header typeSize properties header ... \n");
|
||||
}
|
||||
if (fileProp[0].type == fileProp[1].type) {
|
||||
setType(fileProp[0].type);
|
||||
} else {
|
||||
printf("Error The 2 files has not the same header type properties header ... \n");
|
||||
}
|
||||
if (fileProp[0].slotSize == fileProp[1].slotSize) {
|
||||
setSlotSize(fileProp[0].slotSize);
|
||||
if (fileProp[0].slotSize>0) {
|
||||
setSlotDisplayMode(true);
|
||||
}
|
||||
} else {
|
||||
printf("Error The 2 files has not the same header slotSize properties header ... \n");
|
||||
}
|
||||
} else if (fileProp[0].fileBasicOffset!=0) {
|
||||
setTypeSize(fileProp[0].typeSize);
|
||||
setType(fileProp[0].type);
|
||||
setSlotSize(fileProp[0].slotSize);
|
||||
if (fileProp[0].slotSize>0) {
|
||||
setSlotDisplayMode(true);
|
||||
}
|
||||
} else if (fileProp[1].fileBasicOffset!=0) {
|
||||
setTypeSize(fileProp[1].typeSize);
|
||||
setType(fileProp[1].type);
|
||||
setSlotSize(fileProp[1].slotSize);
|
||||
if (fileProp[1].slotSize>0) {
|
||||
setSlotDisplayMode(true);
|
||||
}
|
||||
}
|
||||
if (true == filePresent[1]) {
|
||||
// open File 2
|
||||
filePointer[1] = fopen(fileName[1], "rb");
|
||||
if ( NULL == filePointer[1]) {
|
||||
//printf("Can not Open [File_2] = %s\n", fileName[1]);
|
||||
}
|
||||
int32_t sizeElement=1;
|
||||
showTypeSize_te tmpType = getTypeSize();
|
||||
switch(tmpType)
|
||||
{
|
||||
default:
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
sizeElement = 1;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
sizeElement = 2;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_FLOAT:
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
sizeElement = 4;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_DOUBLE:
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
sizeElement = 8;
|
||||
break;
|
||||
}
|
||||
int32_t tmpDela = (fileProp[1].delta - fileProp[0].delta) * sizeElement;
|
||||
displayPaddingOffset(tmpDela);
|
||||
|
||||
|
||||
UpdateFilesSize();
|
||||
}
|
||||
|
||||
|
||||
void CloseFiles(void) {
|
||||
if (NULL != filePointer[0]) {
|
||||
fclose(filePointer[0]);
|
||||
filePointer[0] = NULL;
|
||||
} if (NULL != filePointer[1]) {
|
||||
fclose(filePointer[1]);
|
||||
filePointer[1] = NULL;
|
||||
void CloseFiles(void)
|
||||
{
|
||||
int32_t iii=0;
|
||||
for (iii=0; iii<2; iii++) {
|
||||
if (NULL != fileProp[iii].pointer) {
|
||||
fclose(fileProp[iii].pointer);
|
||||
}
|
||||
fileProp[iii].pointer = NULL;
|
||||
fileProp[iii].fileBasicOffset = 0;
|
||||
fileProp[iii].type = SHOW_TYPE_UNKNOW;
|
||||
fileProp[iii].typeSize = SHOW_TYPE_SIZE_UNKNOW;
|
||||
fileProp[iii].slotSize = 0;
|
||||
fileProp[iii].delta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,32 +289,79 @@ void CloseFiles(void) {
|
||||
int main (int argc, char**argv)
|
||||
{
|
||||
int32_t first_Error = 0;
|
||||
filePointer[0] = NULL;
|
||||
filePointer[1] = NULL;
|
||||
strcpy(fileName[0], "No-File");
|
||||
strcpy(fileName[1], "No-File");
|
||||
|
||||
ResetProperties();
|
||||
UpdateNumberOfRawAndColomn();
|
||||
|
||||
// check error
|
||||
if (3 < argc || argc < 2) {
|
||||
if (argc < 2) {
|
||||
printf("You set more than 3 argument at the commande line\n");
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
bool directCheckFiles = false;
|
||||
int basicIDParsing = 1;
|
||||
if (0==strcmp("-d",argv[1])) {
|
||||
basicIDParsing++;
|
||||
directCheckFiles = true;
|
||||
}
|
||||
// one file
|
||||
if (2 <= argc) {
|
||||
strcpy(fileName[0], argv[1]);
|
||||
filePresent[0] = true;
|
||||
if (basicIDParsing+1 <= argc) {
|
||||
strcpy(fileProp[0].name, argv[basicIDParsing]);
|
||||
fileProp[0].availlable = true;
|
||||
}
|
||||
// a second file
|
||||
if (3 <= argc) {
|
||||
strcpy(fileName[1], argv[2]);
|
||||
filePresent[1] = true;
|
||||
if (basicIDParsing+2 <= argc) {
|
||||
strcpy(fileProp[1].name, argv[basicIDParsing+1]);
|
||||
fileProp[1].availlable = true;
|
||||
}
|
||||
// open the files
|
||||
OpenFiles();
|
||||
|
||||
// user requested to have the direct error ID of the file...
|
||||
if (directCheckFiles==true) {
|
||||
|
||||
float dividor = 1;
|
||||
int32_t maxSlot = (fileProp[0].slotSize>fileProp[1].slotSize)?fileProp[0].slotSize:fileProp[1].slotSize;
|
||||
if (0!=maxSlot) {
|
||||
dividor = maxSlot;
|
||||
}
|
||||
|
||||
int32_t idError = findFirstDiff();
|
||||
int minSizeFile = ((fileProp[0].size<fileProp[1].size)?fileProp[0].size:fileProp[1].size) - abs(getPaddingOffsetFile());
|
||||
if (minSizeFile<=idError) {
|
||||
printf(" --- slot=%3d nb frame=%d", (int32_t)dividor, (int32_t)(idError/dividor));
|
||||
CloseFiles();
|
||||
// 0 : no error
|
||||
return 0;
|
||||
} else {
|
||||
int32_t sizeElement = 1;
|
||||
showTypeSize_te tmpType = getTypeSize();
|
||||
switch(tmpType)
|
||||
{
|
||||
default:
|
||||
case SHOW_TYPE_SIZE_8:
|
||||
sizeElement = 1;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_16:
|
||||
sizeElement = 2;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_FLOAT:
|
||||
case SHOW_TYPE_SIZE_32:
|
||||
sizeElement = 4;
|
||||
break;
|
||||
case SHOW_TYPE_SIZE_DOUBLE:
|
||||
case SHOW_TYPE_SIZE_64:
|
||||
sizeElement = 8;
|
||||
break;
|
||||
}
|
||||
int32_t elementIDError = idError/sizeElement;
|
||||
float frameRatio = (float)elementIDError/dividor;
|
||||
int32_t idFrame = frameRatio;
|
||||
int32_t idFrameElement = (frameRatio-idFrame)*dividor;
|
||||
printf("%9d / frame=%9.2f ==> frame=%5d element=%5d slot=%3d", elementIDError, frameRatio, idFrame, idFrameElement, (int32_t)dividor);
|
||||
CloseFiles();
|
||||
return idError;
|
||||
}
|
||||
}
|
||||
// rendre la lecture des données non canonique
|
||||
system("stty -icanon");
|
||||
// supression de l'écho des caractères
|
||||
@ -283,10 +481,10 @@ int main (int argc, char**argv)
|
||||
static bool whichElement = false;
|
||||
if (whichElement == false) {
|
||||
whichElement = true;
|
||||
setOfsetFile((filesize[0]/16)*16 - 256);
|
||||
setOfsetFile((fileProp[0].size/16)*16 - 256);
|
||||
} else {
|
||||
whichElement = false;
|
||||
setOfsetFile((filesize[1]/16)*16 - 256);
|
||||
setOfsetFile((fileProp[1].size/16)*16 - 256);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -299,6 +497,30 @@ int main (int argc, char**argv)
|
||||
OpenFiles();
|
||||
needRedraw();
|
||||
break;
|
||||
// Display Slot mode :
|
||||
case 'j':
|
||||
case 'J':
|
||||
setSlotDisplayMode((getSlotDisplayMode()==true)?false:true);
|
||||
needRedraw();
|
||||
break;
|
||||
case 'U':
|
||||
setSlotSize(getSlotSize()-9);
|
||||
case 'u':
|
||||
setSlotSize(getSlotSize()-1);
|
||||
needRedraw();
|
||||
break;
|
||||
case 'I':
|
||||
setSlotSize(getSlotSize()+9);
|
||||
case 'i':
|
||||
setSlotSize(getSlotSize()+1);
|
||||
needRedraw();
|
||||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
setSlotSize(0);
|
||||
setSlotDisplayMode(false);
|
||||
needRedraw();
|
||||
break;
|
||||
// Add padding offset between left an right file
|
||||
case 'o':
|
||||
displayPaddingOffset(-1);
|
||||
@ -317,6 +539,15 @@ int main (int argc, char**argv)
|
||||
case 'M':
|
||||
displayPaddingOffsetClear();
|
||||
break;
|
||||
case 'c':
|
||||
case 'C':
|
||||
AutoSetPadding();
|
||||
break;
|
||||
case 'h':
|
||||
case 'H':
|
||||
setHelpDisplay((getHelpDisplay()==true)?false:true);
|
||||
needRedraw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
103
parameter.c
103
parameter.c
@ -32,7 +32,7 @@ static showType_te curentType = SHOW_TYPE_HEX;
|
||||
static showTypeSize_te curentTypeSize = SHOW_TYPE_SIZE_8;
|
||||
|
||||
|
||||
extern uint32_t filesize[2];
|
||||
extern fileProperties_ts fileProp[2];
|
||||
|
||||
void CleanDisplay(void)
|
||||
{
|
||||
@ -58,8 +58,8 @@ void setOfsetFile(int32_t offset)
|
||||
if (0 > offset) {
|
||||
offset = 0;
|
||||
}
|
||||
if( offset > (int32_t)filesize[0]
|
||||
&& offset > (int32_t)filesize[1]) {
|
||||
if( offset > (int32_t)fileProp[0].size
|
||||
&& offset > (int32_t)fileProp[1].size) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
@ -143,6 +143,12 @@ showType_te getType(void)
|
||||
return curentType;
|
||||
}
|
||||
|
||||
void setType(showType_te newType)
|
||||
{
|
||||
curentType = newType;
|
||||
parmamModifier = true;
|
||||
}
|
||||
|
||||
void nextTypeSize(void)
|
||||
{
|
||||
switch(curentTypeSize)
|
||||
@ -174,6 +180,11 @@ showTypeSize_te getTypeSize(void)
|
||||
{
|
||||
return curentTypeSize;
|
||||
}
|
||||
void setTypeSize(showTypeSize_te newType)
|
||||
{
|
||||
curentTypeSize = newType;
|
||||
parmamModifier = true;
|
||||
}
|
||||
|
||||
|
||||
int32_t nbRaw = 20;
|
||||
@ -198,3 +209,89 @@ int32_t GetNumberOfColomn(void)
|
||||
return nbColomn;
|
||||
}
|
||||
|
||||
|
||||
int32_t slotSize = -1;
|
||||
bool slotEnable = false;
|
||||
int32_t getSlotSize(void)
|
||||
{
|
||||
if (true == slotEnable) {
|
||||
return slotSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void setSlotSize(int32_t newSize)
|
||||
{
|
||||
if (newSize<0) {
|
||||
newSize = 0;
|
||||
}
|
||||
slotSize = newSize;
|
||||
}
|
||||
|
||||
void setSlotDisplayMode(bool enable)
|
||||
{
|
||||
slotEnable = enable;
|
||||
}
|
||||
bool getSlotDisplayMode(void)
|
||||
{
|
||||
return slotEnable;
|
||||
}
|
||||
|
||||
bool displayHelp = false;
|
||||
void setHelpDisplay(bool enable)
|
||||
{
|
||||
displayHelp = enable;
|
||||
}
|
||||
bool getHelpDisplay(void)
|
||||
{
|
||||
return displayHelp;
|
||||
}
|
||||
|
||||
void cleanLine(void)
|
||||
{
|
||||
printf(" | | \r");
|
||||
}
|
||||
void endLine(void)
|
||||
{
|
||||
printf(" |-----------------------------------------------------------------------------------------------------------------------------------| \n");
|
||||
}
|
||||
void usage(void)
|
||||
{
|
||||
cleanLine(); printf(" | usage : hexViwer [option] [file_1] [file_2]\n");
|
||||
cleanLine(); printf("\t[option] : options:\n");
|
||||
cleanLine(); printf("\t\t[-d] : direct check of the error ...\n");
|
||||
cleanLine(); printf("\t[file_1] : Show the first file only\n");
|
||||
cleanLine(); printf("\t[file_2] : if it was precise : Show the comparaison with the first file\n");
|
||||
cleanLine(); printf("\t\n");
|
||||
cleanLine(); printf("\tInside Usage : \n");
|
||||
cleanLine(); printf("\t\t[h] diplay/Hide Help\n");
|
||||
cleanLine(); printf("\t\t[a] Go to the start of the files\n");
|
||||
cleanLine(); printf("\t\t[z] Go to the end of the files (the first push is the File 1, the second push is the file 2) \n");
|
||||
cleanLine(); printf("\t\t[q] Quit the curent program\n");
|
||||
cleanLine(); printf("\t\t[s] Change the view of the propram of the size of interpretation (8/16/32/64 bits)\n");
|
||||
cleanLine(); printf("\t\t[t] Change the interpretation of Data (hexedecimal, Signed Decimal, Unigned Decimal)\n");
|
||||
cleanLine(); printf("\t\t[f] Find the first Error when comparing the two files\n");
|
||||
cleanLine(); printf("\t\t[c] Calibrate the delta between the 2 file (fist element !=0)\n");
|
||||
cleanLine(); printf("\t\t[UP] Go up (5 lines)\n");
|
||||
cleanLine(); printf("\t\t[DOWN] Go down (5 lines)\n");
|
||||
cleanLine(); printf("\t\t[LEFT] Go up (one screen)\n");
|
||||
cleanLine(); printf("\t\t[RIGHT] Go down (one screen)\n");
|
||||
cleanLine(); printf("\t\tAdd padding : \n");
|
||||
cleanLine(); printf("\t\t\t[o] Add 1 Byte padding at the left file\n");
|
||||
cleanLine(); printf("\t\t\t[O] Add 16 Bytes padding at the left file\n");
|
||||
cleanLine(); printf("\t\t\t[p] Add 1 Byte padding at the right file\n");
|
||||
cleanLine(); printf("\t\t\t[P] Add 16 Bytes padding at the right file\n");
|
||||
cleanLine(); printf("\t\t\t[m] reset padding\n");
|
||||
cleanLine(); printf("\t\tdiplay slot element\n");
|
||||
cleanLine(); printf("\t\t\t[j] enable/disabe slot display\n");
|
||||
cleanLine(); printf("\t\t\t[u] Decrement slot size -1 \n");
|
||||
cleanLine(); printf("\t\t\t[U] Decrement slot size -10 \n");
|
||||
cleanLine(); printf("\t\t\t[i] Increment slot size +1 \n");
|
||||
cleanLine(); printf("\t\t\t[I] Increment slot size +10\n");
|
||||
cleanLine(); printf("\t\t\t[k] Reset slot display\n");
|
||||
cleanLine(); printf("\t\n");
|
||||
cleanLine(); printf("\tCopyright: 2010 Edouard DUPIN, all right reserved\n");
|
||||
cleanLine(); printf("\tLicense: GNU Lesser General Public License (LGPL) v3.0\n");
|
||||
endLine();
|
||||
}
|
||||
|
||||
|
||||
|
15
parameter.h
15
parameter.h
@ -31,9 +31,11 @@ bool getParamModification();
|
||||
void needRedraw(void);
|
||||
void nextType(void);
|
||||
showType_te getType(void);
|
||||
void setType(showType_te newType);
|
||||
|
||||
void nextTypeSize(void);
|
||||
showTypeSize_te getTypeSize(void);
|
||||
void setTypeSize(showTypeSize_te newType);
|
||||
|
||||
void displayPaddingOffset(int32_t size);
|
||||
void displayPaddingOffsetClear(void);
|
||||
@ -48,5 +50,18 @@ int32_t GetNumberOfColomn(void);
|
||||
|
||||
void CleanDisplay(void);
|
||||
|
||||
// if 0 ==> disable ...
|
||||
int32_t getSlotSize(void);
|
||||
void setSlotSize(int32_t newSize);
|
||||
void setSlotDisplayMode(bool enable);
|
||||
bool getSlotDisplayMode(void);
|
||||
|
||||
|
||||
|
||||
void setHelpDisplay(bool enable);
|
||||
bool getHelpDisplay(void);
|
||||
|
||||
void usage(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user