@@ -528,6 +528,9 @@ bool IODEF(SetAdvance)(Cookie cookie, const char *keyword, std::size_t length) {
528528
529529bool IODEF (SetBlank)(Cookie cookie, const char *keyword, std::size_t length) {
530530 IoStatementState &io{*cookie};
531+ if (auto *open{io.get_if <OpenStatementState>()}) {
532+ open->set_mustBeFormatted ();
533+ }
531534 static const char *keywords[]{" NULL" , " ZERO" , nullptr };
532535 switch (IdentifyValue (keyword, length, keywords)) {
533536 case 0 :
@@ -545,6 +548,9 @@ bool IODEF(SetBlank)(Cookie cookie, const char *keyword, std::size_t length) {
545548
546549bool IODEF (SetDecimal)(Cookie cookie, const char *keyword, std::size_t length) {
547550 IoStatementState &io{*cookie};
551+ if (auto *open{io.get_if <OpenStatementState>()}) {
552+ open->set_mustBeFormatted ();
553+ }
548554 static const char *keywords[]{" COMMA" , " POINT" , nullptr };
549555 switch (IdentifyValue (keyword, length, keywords)) {
550556 case 0 :
@@ -562,6 +568,9 @@ bool IODEF(SetDecimal)(Cookie cookie, const char *keyword, std::size_t length) {
562568
563569bool IODEF (SetDelim)(Cookie cookie, const char *keyword, std::size_t length) {
564570 IoStatementState &io{*cookie};
571+ if (auto *open{io.get_if <OpenStatementState>()}) {
572+ open->set_mustBeFormatted ();
573+ }
565574 static const char *keywords[]{" APOSTROPHE" , " QUOTE" , " NONE" , nullptr };
566575 switch (IdentifyValue (keyword, length, keywords)) {
567576 case 0 :
@@ -583,6 +592,9 @@ bool IODEF(SetDelim)(Cookie cookie, const char *keyword, std::size_t length) {
583592bool IODEF (SetPad)(Cookie cookie, const char *keyword, std::size_t length) {
584593 IoStatementState &io{*cookie};
585594 IoErrorHandler &handler{io.GetIoErrorHandler ()};
595+ if (auto *open{io.get_if <OpenStatementState>()}) {
596+ open->set_mustBeFormatted ();
597+ }
586598 io.mutableModes ().pad = YesOrNo (keyword, length, " PAD" , handler);
587599 return !handler.InError ();
588600}
@@ -617,6 +629,9 @@ bool IODEF(SetRec)(Cookie cookie, std::int64_t rec) {
617629
618630bool IODEF (SetRound)(Cookie cookie, const char *keyword, std::size_t length) {
619631 IoStatementState &io{*cookie};
632+ if (auto *open{io.get_if <OpenStatementState>()}) {
633+ open->set_mustBeFormatted ();
634+ }
620635 static const char *keywords[]{" UP" , " DOWN" , " ZERO" , " NEAREST" , " COMPATIBLE" ,
621636 " PROCESSOR_DEFINED" , nullptr };
622637 switch (IdentifyValue (keyword, length, keywords)) {
@@ -647,6 +662,9 @@ bool IODEF(SetRound)(Cookie cookie, const char *keyword, std::size_t length) {
647662
648663bool IODEF (SetSign)(Cookie cookie, const char *keyword, std::size_t length) {
649664 IoStatementState &io{*cookie};
665+ if (auto *open{io.get_if <OpenStatementState>()}) {
666+ open->set_mustBeFormatted ();
667+ }
650668 static const char *keywords[]{
651669 " PLUS" , " SUPPRESS" , " PROCESSOR_DEFINED" , nullptr };
652670 switch (IdentifyValue (keyword, length, keywords)) {
@@ -784,6 +802,7 @@ bool IODEF(SetCarriagecontrol)(
784802 io.GetIoErrorHandler ().Crash (
785803 " SetCarriageControl() called after GetNewUnit() for an OPEN statement" );
786804 }
805+ open->set_mustBeFormatted ();
787806 static const char *keywords[]{" LIST" , " FORTRAN" , " NONE" , nullptr };
788807 switch (IdentifyValue (keyword, length, keywords)) {
789808 case 0 :
@@ -840,6 +859,7 @@ bool IODEF(SetEncoding)(
840859 io.GetIoErrorHandler ().Crash (
841860 " SetEncoding() called after GetNewUnit() for an OPEN statement" );
842861 }
862+ open->set_mustBeFormatted ();
843863 // Allow the encoding to be changed on an open unit -- it's
844864 // useful and safe.
845865 static const char *keywords[]{" UTF-8" , " DEFAULT" , nullptr };
@@ -872,10 +892,10 @@ bool IODEF(SetForm)(Cookie cookie, const char *keyword, std::size_t length) {
872892 }
873893 static const char *keywords[]{" FORMATTED" , " UNFORMATTED" , " BINARY" , nullptr };
874894 switch (IdentifyValue (keyword, length, keywords)) {
875- case 0 :
895+ case 0 : // FORM='FORMATTED'
876896 open->set_isUnformatted (false );
877897 break ;
878- case 1 :
898+ case 1 : // FORM='UNFORMATTED'
879899 open->set_isUnformatted (true );
880900 break ;
881901 case 2 : // legacy FORM='BINARY' means an unformatted stream
0 commit comments