fixed some string gluing problem

This commit is contained in:
nemu 2008-02-04 15:48:51 +00:00
parent 07f702167e
commit 185e7e904b

View File

@ -76,7 +76,7 @@ bool msr2msr_run(char *str)
run.ToUpper(); run.ToUpper();
// tokenize run // tokenize run
tokens = line.Tokenize(" "); tokens = line.Tokenize(" \t");
if (tokens->GetEntries() < 4) { if (tokens->GetEntries() < 4) {
cout << endl << "**ERROR**: Something is wrong with the RUN block header:"; cout << endl << "**ERROR**: Something is wrong with the RUN block header:";
cout << endl << " >> " << str; cout << endl << " >> " << str;
@ -132,7 +132,7 @@ void msr2msr_param(char *str, int &tag)
char sstr[256]; char sstr[256];
char spaces[256]; char spaces[256];
tokens = line.Tokenize(" "); tokens = line.Tokenize(" \t");
unsigned int noTokens = tokens->GetEntries(); unsigned int noTokens = tokens->GetEntries();
if (noTokens == 4) { if (noTokens == 4) {
strcat(str, " none"); strcat(str, " none");
@ -149,21 +149,33 @@ void msr2msr_param(char *str, int &tag)
strcat(sstr, spaces); strcat(sstr, spaces);
// value // value
strcat(sstr, ostr[2]->GetString().Data()); strcat(sstr, ostr[2]->GetString().Data());
if (strlen(ostr[2]->GetString().Data()) < 10) {
memset(spaces, 0, sizeof(spaces)); memset(spaces, 0, sizeof(spaces));
memset(spaces, ' ', 10-strlen(ostr[2]->GetString().Data())); memset(spaces, ' ', 10-strlen(ostr[2]->GetString().Data()));
strcat(sstr, spaces); strcat(sstr, spaces);
} else {
strcat(sstr, " ");
}
// step // step
strcat(sstr, ostr[3]->GetString().Data()); strcat(sstr, ostr[3]->GetString().Data());
if (strlen(ostr[3]->GetString().Data()) < 12) {
memset(spaces, 0, sizeof(spaces)); memset(spaces, 0, sizeof(spaces));
memset(spaces, ' ', 12-strlen(ostr[3]->GetString().Data())); memset(spaces, ' ', 12-strlen(ostr[3]->GetString().Data()));
strcat(sstr, spaces); strcat(sstr, spaces);
} else {
strcat(sstr, " ");
}
// pos. error // pos. error
strcat(sstr, "none "); strcat(sstr, "none ");
// lower boundary // lower boundary
strcat(sstr, ostr[4]->GetString().Data()); strcat(sstr, ostr[4]->GetString().Data());
if (strlen(ostr[4]->GetString().Data()) < 8) {
memset(spaces, 0, sizeof(spaces)); memset(spaces, 0, sizeof(spaces));
memset(spaces, ' ', 8-strlen(ostr[4]->GetString().Data())); memset(spaces, ' ', 8-strlen(ostr[4]->GetString().Data()));
strcat(sstr, spaces); strcat(sstr, spaces);
} else {
strcat(sstr, " ");
}
// upper boundary // upper boundary
strcat(sstr, ostr[5]->GetString().Data()); strcat(sstr, ostr[5]->GetString().Data());
strcpy(str, sstr); strcpy(str, sstr);