@@ -528,6 +528,9 @@ bool IODEF(SetAdvance)(Cookie cookie, const char *keyword, std::size_t length) {
528
528
529
529
bool IODEF (SetBlank)(Cookie cookie, const char *keyword, std::size_t length) {
530
530
IoStatementState &io{*cookie};
531
+ if (auto *open{io.get_if <OpenStatementState>()}) {
532
+ open->set_mustBeFormatted ();
533
+ }
531
534
static const char *keywords[]{" NULL" , " ZERO" , nullptr };
532
535
switch (IdentifyValue (keyword, length, keywords)) {
533
536
case 0 :
@@ -545,6 +548,9 @@ bool IODEF(SetBlank)(Cookie cookie, const char *keyword, std::size_t length) {
545
548
546
549
bool IODEF (SetDecimal)(Cookie cookie, const char *keyword, std::size_t length) {
547
550
IoStatementState &io{*cookie};
551
+ if (auto *open{io.get_if <OpenStatementState>()}) {
552
+ open->set_mustBeFormatted ();
553
+ }
548
554
static const char *keywords[]{" COMMA" , " POINT" , nullptr };
549
555
switch (IdentifyValue (keyword, length, keywords)) {
550
556
case 0 :
@@ -562,6 +568,9 @@ bool IODEF(SetDecimal)(Cookie cookie, const char *keyword, std::size_t length) {
562
568
563
569
bool IODEF (SetDelim)(Cookie cookie, const char *keyword, std::size_t length) {
564
570
IoStatementState &io{*cookie};
571
+ if (auto *open{io.get_if <OpenStatementState>()}) {
572
+ open->set_mustBeFormatted ();
573
+ }
565
574
static const char *keywords[]{" APOSTROPHE" , " QUOTE" , " NONE" , nullptr };
566
575
switch (IdentifyValue (keyword, length, keywords)) {
567
576
case 0 :
@@ -583,6 +592,9 @@ bool IODEF(SetDelim)(Cookie cookie, const char *keyword, std::size_t length) {
583
592
bool IODEF (SetPad)(Cookie cookie, const char *keyword, std::size_t length) {
584
593
IoStatementState &io{*cookie};
585
594
IoErrorHandler &handler{io.GetIoErrorHandler ()};
595
+ if (auto *open{io.get_if <OpenStatementState>()}) {
596
+ open->set_mustBeFormatted ();
597
+ }
586
598
io.mutableModes ().pad = YesOrNo (keyword, length, " PAD" , handler);
587
599
return !handler.InError ();
588
600
}
@@ -617,6 +629,9 @@ bool IODEF(SetRec)(Cookie cookie, std::int64_t rec) {
617
629
618
630
bool IODEF (SetRound)(Cookie cookie, const char *keyword, std::size_t length) {
619
631
IoStatementState &io{*cookie};
632
+ if (auto *open{io.get_if <OpenStatementState>()}) {
633
+ open->set_mustBeFormatted ();
634
+ }
620
635
static const char *keywords[]{" UP" , " DOWN" , " ZERO" , " NEAREST" , " COMPATIBLE" ,
621
636
" PROCESSOR_DEFINED" , nullptr };
622
637
switch (IdentifyValue (keyword, length, keywords)) {
@@ -647,6 +662,9 @@ bool IODEF(SetRound)(Cookie cookie, const char *keyword, std::size_t length) {
647
662
648
663
bool IODEF (SetSign)(Cookie cookie, const char *keyword, std::size_t length) {
649
664
IoStatementState &io{*cookie};
665
+ if (auto *open{io.get_if <OpenStatementState>()}) {
666
+ open->set_mustBeFormatted ();
667
+ }
650
668
static const char *keywords[]{
651
669
" PLUS" , " SUPPRESS" , " PROCESSOR_DEFINED" , nullptr };
652
670
switch (IdentifyValue (keyword, length, keywords)) {
@@ -784,6 +802,7 @@ bool IODEF(SetCarriagecontrol)(
784
802
io.GetIoErrorHandler ().Crash (
785
803
" SetCarriageControl() called after GetNewUnit() for an OPEN statement" );
786
804
}
805
+ open->set_mustBeFormatted ();
787
806
static const char *keywords[]{" LIST" , " FORTRAN" , " NONE" , nullptr };
788
807
switch (IdentifyValue (keyword, length, keywords)) {
789
808
case 0 :
@@ -840,6 +859,7 @@ bool IODEF(SetEncoding)(
840
859
io.GetIoErrorHandler ().Crash (
841
860
" SetEncoding() called after GetNewUnit() for an OPEN statement" );
842
861
}
862
+ open->set_mustBeFormatted ();
843
863
// Allow the encoding to be changed on an open unit -- it's
844
864
// useful and safe.
845
865
static const char *keywords[]{" UTF-8" , " DEFAULT" , nullptr };
@@ -872,10 +892,10 @@ bool IODEF(SetForm)(Cookie cookie, const char *keyword, std::size_t length) {
872
892
}
873
893
static const char *keywords[]{" FORMATTED" , " UNFORMATTED" , " BINARY" , nullptr };
874
894
switch (IdentifyValue (keyword, length, keywords)) {
875
- case 0 :
895
+ case 0 : // FORM='FORMATTED'
876
896
open->set_isUnformatted (false );
877
897
break ;
878
- case 1 :
898
+ case 1 : // FORM='UNFORMATTED'
879
899
open->set_isUnformatted (true );
880
900
break ;
881
901
case 2 : // legacy FORM='BINARY' means an unformatted stream
0 commit comments