Skip to content

Commit 793eda8

Browse files
jjhforresttkralphs
authored andcommitted
notice free format mps earlier
(cherry picked from commit 4bcac59) Signed-off-by: Ted Ralphs <[email protected]>
1 parent be0f260 commit 793eda8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

CoinUtils/src/CoinMpsIO.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,13 @@ CoinMpsCardReader::nextField()
504504
gotCard = false;
505505
} else {
506506
gotCard = true;
507+
//#define COIN_ALLOW_DOLLAR_AS_COMMENT
508+
#ifdef COIN_ALLOW_DOLLAR_AS_COMMENT
509+
if (*next == '$') {
510+
if (next[1] == ' ' || next[1] == '\t' || next[1] == '\0')
511+
gotCard = false; // comment
512+
}
513+
#endif
507514
}
508515
while (!gotCard) {
509516
// need new image
@@ -629,6 +636,8 @@ CoinMpsCardReader::nextField()
629636
}
630637
}
631638
strcpyAndCompress(columnName_, next);
639+
if (next-card_!=4)
640+
freeFormat_ = true; // free format
632641
if (nextBlank) {
633642
*nextBlank = save;
634643
// on to next
@@ -675,6 +684,7 @@ CoinMpsCardReader::nextField()
675684
nextBlank = NULL;
676685
}
677686
} else {
687+
freeFormat_ = true; // free format
678688
if (nextBlank) {
679689
save = *nextBlank;
680690
*nextBlank = '\0';
@@ -819,6 +829,12 @@ CoinMpsCardReader::nextField()
819829
// blank
820830
continue;
821831
}
832+
#ifdef COIN_ALLOW_DOLLAR_AS_COMMENT
833+
if (*next == '$') {
834+
if (next[1] == ' ' || next[1] == '\t' || next[1] == '\0')
835+
position_ = eol_; // comment
836+
}
837+
#endif
822838
return section_;
823839
} else if (card_[0] != '*') {
824840
// not a comment
@@ -857,6 +873,7 @@ CoinMpsCardReader::nextField()
857873
nextBlank = NULL;
858874
}
859875
} else {
876+
freeFormat_ = true; // free format
860877
if (nextBlank) {
861878
save = *nextBlank;
862879
*nextBlank = '\0';
@@ -907,6 +924,12 @@ CoinMpsCardReader::nextField()
907924
value_ = -1.0e100;
908925
}
909926
}
927+
#ifdef COIN_ALLOW_DOLLAR_AS_COMMENT
928+
if (*next == '$') {
929+
if (next[1] == ' ' || next[1] == '\t' || next[1] == '\0')
930+
position_ = eol_; // comment
931+
}
932+
#endif
910933
return section_;
911934
}
912935
static char *

0 commit comments

Comments
 (0)