Commit b46dfa25 authored by LEGEARD Luc's avatar LEGEARD Luc
Browse files

fix compilation without XML and fix extraction mode

parent 9198f843
...@@ -60,8 +60,7 @@ Usage ...@@ -60,8 +60,7 @@ Usage
usage "MFMtest.exe --help" for help usage "MFMtest.exe --help" for help
In a tuto directory, you have a example usage of MFMlib for you own C++ code
......
...@@ -33,9 +33,9 @@ struct MFM_CoboTopo_frame{ ...@@ -33,9 +33,9 @@ struct MFM_CoboTopo_frame{
class MFMCoboTopoFrame : public MFMBlobFrame class MFMCoboTopoFrame : public MFMBlobFrame
{ {
#ifndef NO_MFMXML
TiXmlDocument * MyTinyDoc; TiXmlDocument * MyTinyDoc;
#endif
public : public :
MFMCoboTopoFrame(); MFMCoboTopoFrame();
......
...@@ -127,67 +127,66 @@ int main(int argc, char **argv) { ...@@ -127,67 +127,66 @@ int main(int argc, char **argv) {
bool mybool = false; bool mybool = false;
char filename[255]; char filename[255];
fDumpsize = 16; fDumpsize = 16;
fSubDumpsize = 16; fSubDumpsize = 16;
fCount_elseframe = 0; fCount_elseframe = 0;
fMaxdump = 128; fMaxdump = 128;
fFormat = -1; fFormat = -1;
fNbFrames = 20; fNbFrames = 20;
fNbFramesRead = -1; fNbFramesRead = -1;
fNbSubFrames = 5; fNbSubFrames = 5;
fNbFramesStart = 0; fNbFramesStart = 0;
fNbFramesDump = 0; fNbFramesDump = 0;
fVerbose = 5; fVerbose = 5;
fNbItems =-1; // if -1 , we leave frame to get its defined value fNbItems = -1; // if -1 , we leave frame to get its defined value
fExpSize =-1; fExpSize = -1;
fExpType=-1; fExpType = -1;
fExpEndian=-1; fExpEndian = -1;
fExpMaxSize =-1; fExpMaxSize = -1;
fExtractMode = false; fExtractMode = false;
fActionFile = false; fActionFile = false;
int fExtDumpSize =0; int fExtDumpSize =0;
strcpy(fExtFilename, ""); strcpy(fExtFilename, "");
strcpy(filename, fDeffilename); strcpy(filename, fDeffilename);
fDataPara = new DataParameters(); fDataPara = new DataParameters();
fDataScal = new DataScalers(); fDataScal = new DataScalers();
fFrame = new MFMCommonFrame(); fFrame = new MFMCommonFrame();
fCoboframe = new MFMCoboFrame(); fCoboframe = new MFMCoboFrame();
fCobotopoframe = new MFMCoboTopoFrame(); fCobotopoframe = new MFMCoboTopoFrame();
fExoframe = new MFMExogamFrame(); fExoframe = new MFMExogamFrame();
fDiamantframe = new MFMDiamantFrame(); fDiamantframe = new MFMDiamantFrame();
fEbyframe = new MFMEbyedatFrame(); fEbyframe = new MFMEbyedatFrame();
fInsideframe = new MFMCommonFrame(); fInsideframe = new MFMCommonFrame();
fMergeframe = new MFMMergeFrame(); fMergeframe = new MFMMergeFrame();
fOscilloframe = new MFMOscilloFrame(); fOscilloframe = new MFMOscilloFrame();
fScalerframe = new MFMScalerDataFrame(); fScalerframe = new MFMScalerDataFrame();
fRibfframe = new MFMRibfFrame(); fRibfframe = new MFMRibfFrame();
fMutframe = new MFMMutantFrame(); fMutframe = new MFMMutantFrame();
fHelloframe = new MFMHelloFrame(); fHelloframe = new MFMHelloFrame();
fDatadescriptionframe = new MFMXmlDataDescriptionFrame(); fDatadescriptionframe = new MFMXmlDataDescriptionFrame();
fHeaderframe = new MFMXmlFileHeaderFrame(); fHeaderframe = new MFMXmlFileHeaderFrame();
fChimeraframe = new MFMChimeraFrame(); fChimeraframe = new MFMChimeraFrame();
fBoxDiagframe = new MFMBoxDiagFrame(); fBoxDiagframe = new MFMBoxDiagFrame();
fVamosICframe = new MFMVamosICFrame(); fVamosICframe = new MFMVamosICFrame();
fVamosPDframe = new MFMVamosPDFrame(); fVamosPDframe = new MFMVamosPDFrame();
fVamosTACframe = new MFMVamosTACFrame(); fVamosTACframe = new MFMVamosTACFrame();
fNedaframe = new MFMNedaFrame(); fNedaframe = new MFMNedaFrame();
fNedaCompframe = new MFMNedaCompFrame(); fNedaCompframe = new MFMNedaCompFrame();
fS3BaF2frame = new MFMS3BaF2Frame(); fS3BaF2frame = new MFMS3BaF2Frame();
fS3Alphaframe = new MFMS3AlphaFrame(); fS3Alphaframe = new MFMS3AlphaFrame();
fS3Ruthframe = new MFMS3RuthFrame(); fS3Ruthframe = new MFMS3RuthFrame();
fS3eGUNframe = new MFMS3eGUNFrame(); fS3eGUNframe = new MFMS3eGUNFrame();
fS3Synchroframe = new MFMS3SynchroFrame(); fS3Synchroframe = new MFMS3SynchroFrame();
fReaGenericframe = new MFMReaGenericFrame(); fReaGenericframe = new MFMReaGenericFrame();
uint16_t tabcard[1]; // this is given in example uint16_t tabcard[1]; // this is given in example
tabcard[0]=112; // this is given in example tabcard[0]=112; // this is given in example
//fReaGenericframe -> InitTabValues(tabcard,1); // this is given in example //fReaGenericframe -> InitTabValues(tabcard,1); // this is given in example and test
fReaTraceframe = new MFMReaTraceFrame(); fReaTraceframe = new MFMReaTraceFrame();
fSiriusframe = new MFMSiriusFrame(); fSiriusframe = new MFMSiriusFrame();
fDeflectorframe = new MFMS3DeflectorFrame(); fDeflectorframe = new MFMS3DeflectorFrame();
fCoboframe->InitStat(); fCoboframe->InitStat();
...@@ -293,7 +292,9 @@ int main(int argc, char **argv) { ...@@ -293,7 +292,9 @@ int main(int argc, char **argv) {
fFileSize = filestatus.st_size; fFileSize = filestatus.st_size;
int minsizeheader = MFM_BLOB_HEADER_SIZE; // =8 int minsizeheader = MFM_BLOB_HEADER_SIZE; // =8
if ((fExtractMode==false)and (fPatternMode==false)) {
if ((fExtractMode==false)and (fPatternMode==false)) { // mode read standard
int fLun = 0; // Logical Unit Number int fLun = 0; // Logical Unit Number
fLun = open(filename, (O_RDONLY)); fLun = open(filename, (O_RDONLY));
if (fLun <= 0) { if (fLun <= 0) {
...@@ -311,7 +312,8 @@ int main(int argc, char **argv) { ...@@ -311,7 +312,8 @@ int main(int argc, char **argv) {
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Test xml a enlever des que c'est prêt // Test xml a enlever des que c'est prêt
// //
#ifndef NO_MFMXML
DataParameters datapar; DataParameters datapar;
datapar.FillFromActionXMLFile((const char*)filename); datapar.FillFromActionXMLFile((const char*)filename);
...@@ -330,6 +332,9 @@ int main(int argc, char **argv) { ...@@ -330,6 +332,9 @@ int main(int argc, char **argv) {
cout <<"-----------------4-----------------------------------\n"; cout <<"-----------------4-----------------------------------\n";
datascal.WriteXML("bidon.xml"); datascal.WriteXML("bidon.xml");
cout <<"-----------------5-----------------------------------\n"; cout <<"-----------------5-----------------------------------\n";
#else
cout <<" When compilation of XML is devalided , this action on ACTION FILE is not possible!\n";
#endif
return 0; return 0;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
...@@ -359,11 +364,11 @@ int main(int argc, char **argv) { ...@@ -359,11 +364,11 @@ int main(int argc, char **argv) {
} }
if ( fExtractMode==true) { if (( fExtractMode==true) and (fPatternMode==false)){// mode read avec exctraction sur critère de taille ....
cout << endl; cout << endl;
cout << "-------------------------------------------------------------" cout << "-------------------------------------------------------------"
<< endl; << endl;
cout << "| MFMtest " << " version : " << MFM_VERSION << endl; cout << "| MFMtest " << " version : " << MFM_VERSION << endl;
cout << "| TEST MFMFrame in extract mode from file " << filename << " to file "<< fExtFilename<< endl; cout << "| TEST MFMFrame in extract mode from file " << filename << " to file "<< fExtFilename<< endl;
cout << "-------------------------------------------------------------"<< endl; cout << "-------------------------------------------------------------"<< endl;
...@@ -441,9 +446,13 @@ int main(int argc, char **argv) { ...@@ -441,9 +446,13 @@ int main(int argc, char **argv) {
framesize = fFrame->GetFrameSize(); framesize = fFrame->GetFrameSize();
type = fFrame->GetFrameType(); type = fFrame->GetFrameType();
endianness = fFrame->GetFrameEndianness(); endianness = fFrame->GetFrameEndianness();
cout << "Framesize "<< framesize <<" ?=? " <<fExpSize<<endl;
cout << "Type "<< type <<" ?=? " <<fExpType<<endl;
cout << "endianness "<< endianness <<" ?=? " <<fExpEndian<<endl;
if (((framesize != fExpSize)and (fExpSize!=-1)) or ((type != fExpType)and (fExpType!=1))or ((endianness != fExpEndian)and (fExpEndian!=1))){ if (((framesize != fExpSize)and (fExpSize!=-1)) or ((type != fExpType)and (fExpType!=-1))or ((endianness != fExpEndian)and (fExpEndian!=-1))){
if (fExtDumpSize > 0) { if (fExtDumpSize > 0) {
cout << " ----------Dump Problem------" << fReadsize<< "------------\n"; cout << " ----------Dump Problem------" << fReadsize<< "------------\n";
...@@ -453,7 +462,7 @@ int main(int argc, char **argv) { ...@@ -453,7 +462,7 @@ int main(int argc, char **argv) {
fNonExpectedSizeCount++; fNonExpectedSizeCount++;
fseek(fLun, (-retour + 1), SEEK_CUR); fseek(fLun, (-retour + 1), SEEK_CUR);
} else { } else {cout << "Match\n";;
fFrame->FillStat(); fFrame->FillStat();
if (fLunOut) if (fLunOut)
fwrite(vector, 1, retour, fLunOut); fwrite(vector, 1, retour, fLunOut);
...@@ -478,7 +487,7 @@ int main(int argc, char **argv) { ...@@ -478,7 +487,7 @@ int main(int argc, char **argv) {
if (fLun != NULL) {fclose(fLun);} if (fLun != NULL) {fclose(fLun);}
}// end of if (fExtractMode==true) }// end of if (fExtractMode==true)
if (fPatternMode==true) { if (fPatternMode==true) {// mode read avec extraction sur critère de pattern ....
cout << endl; cout << endl;
cout << "-------------------------------------------------------------"<< endl; cout << "-------------------------------------------------------------"<< endl;
cout << "| MFMtest " << " version : " << MFM_VERSION << endl; cout << "| MFMtest " << " version : " << MFM_VERSION << endl;
...@@ -1450,7 +1459,7 @@ int ReadInBadFile(FILE * fLun, char** vector, int * vectorsize, ...@@ -1450,7 +1459,7 @@ int ReadInBadFile(FILE * fLun, char** vector, int * vectorsize,
if (countsize2 != sizetoread) { if (countsize2 != sizetoread) {
if (sizetoread < (filesize - (readsize + FirstSizeToRead))) { if (sizetoread < (filesize - (readsize + FirstSizeToRead))) {
char info[200]; char info[200];
sprintf(info, "Error in read file ,read /asked to read : %d / %d ", sprintf(info, "Error in read file ,read /asked to read : %d / %d (may be end of file?)",
countsize2, sizetoread); countsize2, sizetoread);
Error.TreatError(1, 0, info); Error.TreatError(1, 0, info);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment