From 0c31724556d14daea37277a5e7e3bd6e395aece6 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Mon, 11 Feb 2013 17:47:29 +0100 Subject: [PATCH] [DEV] multiple file comparing add with external simple script --- display.c | 112 +++++++++++-------- dump_test.sh | 80 ++++++++++++++ generalDefine.h | 17 ++- main.c | 282 +++++++++++++++++++++++++++++++++++------------- parameter.c | 17 ++- parameter.h | 2 + 6 files changed, 387 insertions(+), 123 deletions(-) create mode 100755 dump_test.sh diff --git a/display.c b/display.c index db37255..7f27963 100755 --- a/display.c +++ b/display.c @@ -19,8 +19,7 @@ */ #include "display.h" -extern FILE *filePointer[2]; -extern char fileName[2][2096]; +extern fileProperties_ts fileProp[2]; void drawLine(void) @@ -72,7 +71,48 @@ void drawLine(void) } } - +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) { @@ -88,47 +128,24 @@ void showConfiguration(void) 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("%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("%s", getTypeSizeChar(mySize)); + 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(); @@ -265,6 +282,9 @@ 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; @@ -351,11 +371,11 @@ void compareFile(FILE *filePointer1, FILE *filePointer2 ,int32_t curentFilePosit int32_t readStartFile1 = 16; if (filePointer1 != NULL) { if (positionStartDisplayFile1 >= 0) { - fseek(filePointer1 , positionStartDisplayFile1 , SEEK_SET ); + fseek(filePointer1 , positionStartDisplayFile1+fileProp[0].fileBasicOffset , SEEK_SET ); readFile1 = fread(data1.data_8, sizeof(uint8_t), 16, 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 +386,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 ); + fseek(filePointer2 , positionStartDisplayFile2+fileProp[1].fileBasicOffset , SEEK_SET ); readFile2 = fread(data2.data_8, sizeof(uint8_t), 16, 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; @@ -617,7 +637,7 @@ 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); } else { usleep(10000); } diff --git a/dump_test.sh b/dump_test.sh new file mode 100755 index 0000000..c3f1837 --- /dev/null +++ b/dump_test.sh @@ -0,0 +1,80 @@ +#! /bin/bash + +DUMP_DIR_EXP=. +DUMP_DIR_MATLAB=.. + +MATLAB_PREFIX=m__ +MATLAB_SUFFIX=.raw +TANGO_PREFIX=exp +TANGO_SUFFIX=.raw + +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*$MATLAB_SUFFIX" + TANGO_DUMP="$DUMP_DIR_EXP/$TANGO_PREFIX$i$VALUE*$TANGO_SUFFIX" + + # 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 + diff --git a/generalDefine.h b/generalDefine.h index 9cc00af..34c91e2 100755 --- a/generalDefine.h +++ b/generalDefine.h @@ -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 diff --git a/main.c b/main.c index f168835..0073f66 100755 --- a/main.c +++ b/main.c @@ -22,12 +22,7 @@ #include "display.h" - - -bool filePresent[2] = {false, false}; -FILE *filePointer[2] = {NULL, NULL}; -uint32_t filesize[2] = {0, 0}; -char fileName[2][2096] = {"",""}; +fileProperties_ts fileProp[2]; void usage(void) { @@ -67,8 +62,8 @@ 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; } int32_t paddingFile = getPaddingOffsetFile(); @@ -81,14 +76,14 @@ int32_t findFirstDiff(void) pad1 = 0; pad2 = -1*paddingFile; } - if(NULL != filePointer[0]) { - fseek ( filePointer[0] , pad1 , SEEK_SET ); + if(NULL != fileProp[0].pointer) { + fseek ( fileProp[0].pointer , pad1+fileProp[0].fileBasicOffset , SEEK_SET ); } - if(NULL != filePointer[1]) { - fseek ( filePointer[1] , pad2 , SEEK_SET ); + if(NULL != fileProp[1].pointer) { + fseek ( fileProp[1].pointer , pad2+fileProp[1].fileBasicOffset , SEEK_SET ); } - while ( fread(&data1, sizeof(uint8_t), 1, filePointer[0]) == 1 - && fread(&data2, sizeof(uint8_t), 1, filePointer[1]) == 1) + 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) { @@ -101,28 +96,27 @@ int32_t findFirstDiff(void) void AutoSetPadding(void) { displayPaddingOffset(0); - if( NULL == filePointer[0] - || NULL == filePointer[1] ) { + if( NULL == fileProp[0].pointer + || NULL == fileProp[1].pointer ) { return; } - if(NULL != filePointer[0]) { - fseek ( filePointer[0] , 0 , SEEK_SET ); + 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, filePointer[0]) == 1) - { + while(fread(&data, sizeof(uint8_t), 1, fileProp[0].pointer) == 1) { if (data != 0) { break; } offset1 ++; } - if(NULL != filePointer[1]) { - fseek ( filePointer[1] , 0 , SEEK_SET ); + 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, filePointer[1]) == 1) + while(fread(&data, sizeof(uint8_t), 1, fileProp[1].pointer) == 1) { if (data != 0) { break; @@ -132,12 +126,13 @@ void AutoSetPadding(void) if (offset1 == offset2) { return; } - if (offset1 == 0) { + if (0 == offset1) { return; } if (0 == offset2) { return; } + displayPaddingOffset(offset1 - offset2); } @@ -145,50 +140,166 @@ void AutoSetPadding(void) 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; } - 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]); +} + + +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 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 properties header ... \n"); + } + } else if (fileProp[0].fileBasicOffset!=0) { + setTypeSize(fileProp[0].typeSize); + setType(fileProp[0].type); + } else if (fileProp[1].fileBasicOffset!=0) { + setTypeSize(fileProp[1].typeSize); + setType(fileProp[1].type); + } + 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; } } @@ -196,13 +307,8 @@ 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 (argc < 2) { printf("You set more than 3 argument at the commande line\n"); @@ -217,13 +323,13 @@ int main (int argc, char**argv) } // one file if (basicIDParsing+1 <= argc) { - strcpy(fileName[0], argv[basicIDParsing]); - filePresent[0] = true; + strcpy(fileProp[0].name, argv[basicIDParsing]); + fileProp[0].availlable = true; } // a second file if (basicIDParsing+2 <= argc) { - strcpy(fileName[1], argv[basicIDParsing+1]); - filePresent[1] = true; + strcpy(fileProp[1].name, argv[basicIDParsing+1]); + fileProp[1].availlable = true; } // open the files OpenFiles(); @@ -231,15 +337,45 @@ int main (int argc, char**argv) // 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 = (filesize[0] frame=%5d element=%5d slot=%3d", elementIDError, frameRatio, idFrame, idFrameElement, (int32_t)dividor); CloseFiles(); return idError; } @@ -363,10 +499,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; diff --git a/parameter.c b/parameter.c index a061e71..cef324b 100755 --- a/parameter.c +++ b/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; diff --git a/parameter.h b/parameter.h index 49ea120..88595aa 100755 --- a/parameter.h +++ b/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);