start to implement graphics dump
This commit is contained in:
@ -55,9 +55,17 @@ using namespace std;
|
|||||||
*/
|
*/
|
||||||
void musrview_syntax()
|
void musrview_syntax()
|
||||||
{
|
{
|
||||||
cout << endl << "usage: musrview <msr-file> | --version | --help";
|
cout << endl << "usage: musrview <msr-file> [--<graphic-format-extension>] | --version | --help";
|
||||||
cout << endl << " <msr-file>: msr/mlog input file";
|
cout << endl << " <msr-file>: msr/mlog input file";
|
||||||
cout << endl << " 'musrview <msr-file>' will execute musrview";
|
cout << endl << " 'musrview <msr-file>' will execute musrview";
|
||||||
|
cout << endl << ">> ----- NOT YET IMPLEMENTED ----- << ";
|
||||||
|
cout << endl << " --<graphic-format-extension>: ";
|
||||||
|
cout << endl << " will produce a graphics-output-file without starting a root session.";
|
||||||
|
cout << endl << " the name is based on the <msr-file>, e.g. 3310.msr -> 3310.png";
|
||||||
|
cout << endl << " supported graphic-format-extension:";
|
||||||
|
cout << endl << " eps, pdf, gif, jpg, png, svg, xpm, root";
|
||||||
|
cout << endl << " example: musrview 3310.msr --png, will produce a file 3310.png";
|
||||||
|
cout << endl << ">> ----- NOT YET IMPLEMENTED ----- << ";
|
||||||
cout << endl << " 'musrview' or 'musrview --help' will show this help";
|
cout << endl << " 'musrview' or 'musrview --help' will show this help";
|
||||||
cout << endl << " 'musrview --version' will print the musrview version";
|
cout << endl << " 'musrview --version' will print the musrview version";
|
||||||
cout << endl << endl;
|
cout << endl << endl;
|
||||||
@ -69,6 +77,9 @@ int main(int argc, char *argv[])
|
|||||||
bool show_syntax = false;
|
bool show_syntax = false;
|
||||||
int status;
|
int status;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
char fileName[128];
|
||||||
|
bool graphicsOutput = false;
|
||||||
|
char graphicsExtension[32];
|
||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -84,11 +95,42 @@ int main(int argc, char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
// check if filename has extension msr or mlog
|
// check if filename has extension msr or mlog
|
||||||
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
|
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
|
||||||
cout << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file!" << endl;
|
cout << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||||
show_syntax = true;
|
show_syntax = true;
|
||||||
|
} else {
|
||||||
|
strcpy(fileName, argv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!strcmp(argv[1], "--eps") || !strcmp(argv[1], "--pdf") || !strcmp(argv[1], "--gif") ||
|
||||||
|
!strcmp(argv[1], "--jpg") || !strcmp(argv[1], "--png") || !strcmp(argv[1], "--svg") ||
|
||||||
|
!strcmp(argv[1], "--xpm") || !strcmp(argv[1], "--root")) {
|
||||||
|
graphicsOutput = true;
|
||||||
|
strcpy(graphicsExtension, argv[1]+2);
|
||||||
|
// check if filename has extension msr or mlog
|
||||||
|
if (!strstr(argv[2], ".msr") && !strstr(argv[2], ".mlog")) {
|
||||||
|
cout << endl << "**ERROR** " << argv[2] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||||
|
show_syntax = true;
|
||||||
|
} else {
|
||||||
|
strcpy(fileName, argv[2]);
|
||||||
|
}
|
||||||
|
} else if (!strcmp(argv[2], "--eps") || !strcmp(argv[2], "--pdf") || !strcmp(argv[2], "--gif") ||
|
||||||
|
!strcmp(argv[2], "--jpg") || !strcmp(argv[2], "--png") || !strcmp(argv[2], "--svg") ||
|
||||||
|
!strcmp(argv[2], "--xpm") || !strcmp(argv[2], "--root")) {
|
||||||
|
graphicsOutput = true;
|
||||||
|
strcpy(graphicsExtension, argv[2]+2);
|
||||||
|
// check if filename has extension msr or mlog
|
||||||
|
if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) {
|
||||||
|
cout << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file, nor is it a supported graphics extension." << endl;
|
||||||
|
show_syntax = true;
|
||||||
|
} else {
|
||||||
|
strcpy(fileName, argv[1]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
show_syntax = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
show_syntax = true;
|
show_syntax = true;
|
||||||
}
|
}
|
||||||
@ -124,15 +166,15 @@ int main(int argc, char *argv[])
|
|||||||
startupHandler->CheckLists();
|
startupHandler->CheckLists();
|
||||||
|
|
||||||
// read msr-file
|
// read msr-file
|
||||||
PMsrHandler *msrHandler = new PMsrHandler(argv[1]);
|
PMsrHandler *msrHandler = new PMsrHandler(fileName);
|
||||||
status = msrHandler->ReadMsrFile();
|
status = msrHandler->ReadMsrFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case PMUSR_MSR_FILE_NOT_FOUND:
|
case PMUSR_MSR_FILE_NOT_FOUND:
|
||||||
cout << endl << "**ERROR** couldn't find '" << argv[1] << "'" << endl << endl;
|
cout << endl << "**ERROR** couldn't find '" << fileName << "'" << endl << endl;
|
||||||
break;
|
break;
|
||||||
case PMUSR_MSR_SYNTAX_ERROR:
|
case PMUSR_MSR_SYNTAX_ERROR:
|
||||||
cout << endl << "**SYNTAX ERROR** in file " << argv[1] << ", full stop here." << endl << endl;
|
cout << endl << "**SYNTAX ERROR** in file " << fileName << ", full stop here." << endl << endl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cout << endl << "**UNKNOWN ERROR** when trying to read the msr-file" << endl << endl;
|
cout << endl << "**UNKNOWN ERROR** when trying to read the msr-file" << endl << endl;
|
||||||
|
Reference in New Issue
Block a user