1 /* Copyright (C) 2002-2015 Free Software Foundation, Inc.
2 Contributed by Andy Vaught
3 F2003 I/O support contributed by Jerry DeLisle
5 This file is part of the GNU Fortran runtime library (libgfortran).
7 Libgfortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 Libgfortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
27 /* format.c-- parse a FORMAT string into a binary format suitable for
28 * interpretation during I/O statements */
37 static const fnode colon_node
= { FMT_COLON
, 0, NULL
, NULL
, {{ 0, 0, 0 }}, 0,
42 static const char posint_required
[] = "Positive width required in format",
43 period_required
[] = "Period required in format",
44 nonneg_required
[] = "Nonnegative width required in format",
45 unexpected_element
[] = "Unexpected element '%c' in format\n",
46 unexpected_end
[] = "Unexpected end of format string",
47 bad_string
[] = "Unterminated character constant in format",
48 bad_hollerith
[] = "Hollerith constant extends past the end of the format",
49 reversion_error
[] = "Exhausted data descriptors in format",
50 zero_width
[] = "Zero width in format descriptor";
52 /* The following routines support caching format data from parsed format strings
53 into a hash table. This avoids repeatedly parsing duplicate format strings
54 or format strings in I/O statements that are repeated in loops. */
57 /* Traverse the table and free all data. */
60 free_format_hash_table (gfc_unit
*u
)
64 /* free_format_data handles any NULL pointers. */
65 for (i
= 0; i
< FORMAT_HASH_SIZE
; i
++)
67 if (u
->format_hash_table
[i
].hashed_fmt
!= NULL
)
69 free_format_data (u
->format_hash_table
[i
].hashed_fmt
);
70 free (u
->format_hash_table
[i
].key
);
72 u
->format_hash_table
[i
].key
= NULL
;
73 u
->format_hash_table
[i
].key_len
= 0;
74 u
->format_hash_table
[i
].hashed_fmt
= NULL
;
78 /* Traverse the format_data structure and reset the fnode counters. */
81 reset_node (fnode
*fn
)
88 if (fn
->format
!= FMT_LPAREN
)
91 for (f
= fn
->u
.child
; f
; f
= f
->next
)
93 if (f
->format
== FMT_RPAREN
)
100 reset_fnode_counters (st_parameter_dt
*dtp
)
107 /* Clear this pointer at the head so things start at the right place. */
108 fmt
->array
.array
[0].current
= NULL
;
110 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
115 /* A simple hashing function to generate an index into the hash table. */
118 format_hash (st_parameter_dt
*dtp
)
121 gfc_charlen_type key_len
;
125 /* Hash the format string. Super simple, but what the heck! */
127 key_len
= dtp
->format_len
;
128 for (i
= 0; i
< key_len
; i
++)
130 hash
&= (FORMAT_HASH_SIZE
- 1);
136 save_parsed_format (st_parameter_dt
*dtp
)
141 hash
= format_hash (dtp
);
142 u
= dtp
->u
.p
.current_unit
;
144 /* Index into the hash table. We are simply replacing whatever is there
145 relying on probability. */
146 if (u
->format_hash_table
[hash
].hashed_fmt
!= NULL
)
147 free_format_data (u
->format_hash_table
[hash
].hashed_fmt
);
148 u
->format_hash_table
[hash
].hashed_fmt
= NULL
;
150 free (u
->format_hash_table
[hash
].key
);
151 u
->format_hash_table
[hash
].key
= dtp
->format
;
153 u
->format_hash_table
[hash
].key_len
= dtp
->format_len
;
154 u
->format_hash_table
[hash
].hashed_fmt
= dtp
->u
.p
.fmt
;
159 find_parsed_format (st_parameter_dt
*dtp
)
164 hash
= format_hash (dtp
);
165 u
= dtp
->u
.p
.current_unit
;
167 if (u
->format_hash_table
[hash
].key
!= NULL
)
169 /* See if it matches. */
170 if (u
->format_hash_table
[hash
].key_len
== dtp
->format_len
)
172 /* So far so good. */
173 if (strncmp (u
->format_hash_table
[hash
].key
,
174 dtp
->format
, dtp
->format_len
) == 0)
175 return u
->format_hash_table
[hash
].hashed_fmt
;
182 /* next_char()-- Return the next character in the format string.
183 * Returns -1 when the string is done. If the literal flag is set,
184 * spaces are significant, otherwise they are not. */
187 next_char (format_data
*fmt
, int literal
)
193 if (fmt
->format_string_len
== 0)
196 fmt
->format_string_len
--;
197 c
= toupper (*fmt
->format_string
++);
198 fmt
->error_element
= c
;
200 while ((c
== ' ' || c
== '\t') && !literal
);
206 /* unget_char()-- Back up one character position. */
208 #define unget_char(fmt) \
209 { fmt->format_string--; fmt->format_string_len++; }
212 /* get_fnode()-- Allocate a new format node, inserting it into the
213 * current singly linked list. These are initially allocated from the
217 get_fnode (format_data
*fmt
, fnode
**head
, fnode
**tail
, format_token t
)
221 if (fmt
->avail
== &fmt
->last
->array
[FARRAY_SIZE
])
223 fmt
->last
->next
= xmalloc (sizeof (fnode_array
));
224 fmt
->last
= fmt
->last
->next
;
225 fmt
->last
->next
= NULL
;
226 fmt
->avail
= &fmt
->last
->array
[0];
229 memset (f
, '\0', sizeof (fnode
));
241 f
->source
= fmt
->format_string
;
246 /* free_format_data()-- Free all allocated format data. */
249 free_format_data (format_data
*fmt
)
251 fnode_array
*fa
, *fa_next
;
257 for (fa
= fmt
->array
.next
; fa
; fa
= fa_next
)
268 /* format_lex()-- Simple lexical analyzer for getting the next token
269 * in a FORMAT string. We support a one-level token pushback in the
270 * fmt->saved_token variable. */
273 format_lex (format_data
*fmt
)
280 if (fmt
->saved_token
!= FMT_NONE
)
282 token
= fmt
->saved_token
;
283 fmt
->saved_token
= FMT_NONE
;
288 c
= next_char (fmt
, 0);
309 c
= next_char (fmt
, 0);
316 fmt
->value
= c
- '0';
320 c
= next_char (fmt
, 0);
324 fmt
->value
= 10 * fmt
->value
+ c
- '0';
330 fmt
->value
= -fmt
->value
;
331 token
= FMT_SIGNED_INT
;
344 fmt
->value
= c
- '0';
348 c
= next_char (fmt
, 0);
352 fmt
->value
= 10 * fmt
->value
+ c
- '0';
356 token
= (fmt
->value
== 0) ? FMT_ZERO
: FMT_POSINT
;
380 switch (next_char (fmt
, 0))
401 switch (next_char (fmt
, 0))
418 switch (next_char (fmt
, 0))
438 fmt
->string
= fmt
->format_string
;
439 fmt
->value
= 0; /* This is the length of the string */
443 c
= next_char (fmt
, 1);
446 token
= FMT_BADSTRING
;
447 fmt
->error
= bad_string
;
453 c
= next_char (fmt
, 1);
457 token
= FMT_BADSTRING
;
458 fmt
->error
= bad_string
;
496 switch (next_char (fmt
, 0))
528 switch (next_char (fmt
, 0))
544 switch (next_char (fmt
, 0))
584 /* parse_format_list()-- Parse a format list. Assumes that a left
585 * paren has already been seen. Returns a list representing the
586 * parenthesis node which contains the rest of the list. */
589 parse_format_list (st_parameter_dt
*dtp
, bool *seen_dd
)
592 format_token t
, u
, t2
;
594 format_data
*fmt
= dtp
->u
.p
.fmt
;
595 bool seen_data_desc
= false;
599 /* Get the next format item */
601 t
= format_lex (fmt
);
606 t
= format_lex (fmt
);
609 fmt
->error
= "Left parenthesis required after '*'";
612 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
613 tail
->repeat
= -2; /* Signifies unlimited format. */
614 tail
->u
.child
= parse_format_list (dtp
, &seen_data_desc
);
615 if (fmt
->error
!= NULL
)
619 fmt
->error
= "'*' requires at least one associated data descriptor";
627 t
= format_lex (fmt
);
631 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
632 tail
->repeat
= repeat
;
633 tail
->u
.child
= parse_format_list (dtp
, &seen_data_desc
);
634 *seen_dd
= seen_data_desc
;
635 if (fmt
->error
!= NULL
)
641 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
642 tail
->repeat
= repeat
;
646 get_fnode (fmt
, &head
, &tail
, FMT_X
);
648 tail
->u
.k
= fmt
->value
;
659 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
661 tail
->u
.child
= parse_format_list (dtp
, &seen_data_desc
);
662 *seen_dd
= seen_data_desc
;
663 if (fmt
->error
!= NULL
)
668 case FMT_SIGNED_INT
: /* Signed integer can only precede a P format. */
669 case FMT_ZERO
: /* Same for zero. */
670 t
= format_lex (fmt
);
673 fmt
->error
= "Expected P edit descriptor in format";
678 get_fnode (fmt
, &head
, &tail
, FMT_P
);
679 tail
->u
.k
= fmt
->value
;
682 t
= format_lex (fmt
);
683 if (t
== FMT_F
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_D
684 || t
== FMT_G
|| t
== FMT_E
)
690 if (t
!= FMT_COMMA
&& t
!= FMT_RPAREN
&& t
!= FMT_SLASH
693 fmt
->error
= "Comma required after P descriptor";
697 fmt
->saved_token
= t
;
700 case FMT_P
: /* P and X require a prior number */
701 fmt
->error
= "P descriptor requires leading scale factor";
708 If we would be pedantic in the library, we would have to reject
709 an X descriptor without an integer prefix:
711 fmt->error = "X descriptor requires leading space count";
714 However, this is an extension supported by many Fortran compilers,
715 including Cray, HP, AIX, and IRIX. Therefore, we allow it in the
716 runtime library, and make the front end reject it if the compiler
717 is in pedantic mode. The interpretation of 'X' is '1X'.
719 get_fnode (fmt
, &head
, &tail
, FMT_X
);
725 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
726 tail
->u
.string
.p
= fmt
->string
;
727 tail
->u
.string
.length
= fmt
->value
;
737 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: Round "
738 "descriptor not allowed");
739 get_fnode (fmt
, &head
, &tail
, t
);
745 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: DC or DP "
746 "descriptor not allowed");
753 get_fnode (fmt
, &head
, &tail
, t
);
758 get_fnode (fmt
, &head
, &tail
, FMT_COLON
);
763 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
769 get_fnode (fmt
, &head
, &tail
, FMT_DOLLAR
);
771 notify_std (&dtp
->common
, GFC_STD_GNU
, "Extension: $ descriptor");
777 t2
= format_lex (fmt
);
778 if (t2
!= FMT_POSINT
)
780 fmt
->error
= posint_required
;
783 get_fnode (fmt
, &head
, &tail
, t
);
784 tail
->u
.n
= fmt
->value
;
805 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
806 if (fmt
->format_string_len
< 1)
808 fmt
->error
= bad_hollerith
;
812 tail
->u
.string
.p
= fmt
->format_string
;
813 tail
->u
.string
.length
= 1;
816 fmt
->format_string
++;
817 fmt
->format_string_len
--;
822 fmt
->error
= unexpected_end
;
832 fmt
->error
= unexpected_element
;
836 /* In this state, t must currently be a data descriptor. Deal with
837 things that can/must follow the descriptor */
842 t
= format_lex (fmt
);
845 if (notification_std(GFC_STD_GNU
) == NOTIFICATION_ERROR
)
847 fmt
->error
= posint_required
;
852 fmt
->saved_token
= t
;
853 fmt
->value
= 1; /* Default width */
854 notify_std (&dtp
->common
, GFC_STD_GNU
, posint_required
);
858 get_fnode (fmt
, &head
, &tail
, FMT_L
);
859 tail
->u
.n
= fmt
->value
;
860 tail
->repeat
= repeat
;
864 t
= format_lex (fmt
);
867 fmt
->error
= zero_width
;
873 fmt
->saved_token
= t
;
874 fmt
->value
= -1; /* Width not present */
877 get_fnode (fmt
, &head
, &tail
, FMT_A
);
878 tail
->repeat
= repeat
;
879 tail
->u
.n
= fmt
->value
;
888 get_fnode (fmt
, &head
, &tail
, t
);
889 tail
->repeat
= repeat
;
891 u
= format_lex (fmt
);
892 if (t
== FMT_G
&& u
== FMT_ZERO
)
894 if (notification_std (GFC_STD_F2008
) == NOTIFICATION_ERROR
895 || dtp
->u
.p
.mode
== READING
)
897 fmt
->error
= zero_width
;
901 u
= format_lex (fmt
);
904 fmt
->saved_token
= u
;
908 u
= format_lex (fmt
);
911 fmt
->error
= posint_required
;
914 tail
->u
.real
.d
= fmt
->value
;
917 if (t
== FMT_F
&& dtp
->u
.p
.mode
== WRITING
)
919 if (u
!= FMT_POSINT
&& u
!= FMT_ZERO
)
921 fmt
->error
= nonneg_required
;
925 else if (u
!= FMT_POSINT
)
927 fmt
->error
= posint_required
;
931 tail
->u
.real
.w
= fmt
->value
;
933 t
= format_lex (fmt
);
936 /* We treat a missing decimal descriptor as 0. Note: This is only
937 allowed if -std=legacy, otherwise an error occurs. */
938 if (compile_options
.warn_std
!= 0)
940 fmt
->error
= period_required
;
943 fmt
->saved_token
= t
;
949 t
= format_lex (fmt
);
950 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
952 fmt
->error
= nonneg_required
;
956 tail
->u
.real
.d
= fmt
->value
;
959 if (t2
== FMT_D
|| t2
== FMT_F
)
963 /* Look for optional exponent */
964 t
= format_lex (fmt
);
966 fmt
->saved_token
= t
;
969 t
= format_lex (fmt
);
972 fmt
->error
= "Positive exponent width required in format";
976 tail
->u
.real
.e
= fmt
->value
;
982 if (repeat
> fmt
->format_string_len
)
984 fmt
->error
= bad_hollerith
;
988 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
989 tail
->u
.string
.p
= fmt
->format_string
;
990 tail
->u
.string
.length
= repeat
;
993 fmt
->format_string
+= fmt
->value
;
994 fmt
->format_string_len
-= repeat
;
1002 get_fnode (fmt
, &head
, &tail
, t
);
1003 tail
->repeat
= repeat
;
1005 t
= format_lex (fmt
);
1007 if (dtp
->u
.p
.mode
== READING
)
1009 if (t
!= FMT_POSINT
)
1011 fmt
->error
= posint_required
;
1017 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1019 fmt
->error
= nonneg_required
;
1024 tail
->u
.integer
.w
= fmt
->value
;
1025 tail
->u
.integer
.m
= -1;
1027 t
= format_lex (fmt
);
1028 if (t
!= FMT_PERIOD
)
1030 fmt
->saved_token
= t
;
1034 t
= format_lex (fmt
);
1035 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1037 fmt
->error
= nonneg_required
;
1041 tail
->u
.integer
.m
= fmt
->value
;
1044 if (tail
->u
.integer
.w
!= 0 && tail
->u
.integer
.m
> tail
->u
.integer
.w
)
1046 fmt
->error
= "Minimum digits exceeds field width";
1053 fmt
->error
= unexpected_element
;
1057 /* Between a descriptor and what comes next */
1059 t
= format_lex (fmt
);
1070 get_fnode (fmt
, &head
, &tail
, t
);
1072 goto optional_comma
;
1075 fmt
->error
= unexpected_end
;
1079 /* Assume a missing comma, this is a GNU extension */
1083 /* Optional comma is a weird between state where we've just finished
1084 reading a colon, slash or P descriptor. */
1086 t
= format_lex (fmt
);
1095 default: /* Assume that we have another format item */
1096 fmt
->saved_token
= t
;
1108 /* format_error()-- Generate an error message for a format statement.
1109 * If the node that gives the location of the error is NULL, the error
1110 * is assumed to happen at parse time, and the current location of the
1113 * We generate a message showing where the problem is. We take extra
1114 * care to print only the relevant part of the format if it is longer
1115 * than a standard 80 column display. */
1118 format_error (st_parameter_dt
*dtp
, const fnode
*f
, const char *message
)
1120 int width
, i
, offset
;
1122 char *p
, buffer
[BUFLEN
];
1123 format_data
*fmt
= dtp
->u
.p
.fmt
;
1127 else /* This should not happen. */
1130 if (message
== unexpected_element
)
1131 snprintf (buffer
, BUFLEN
, message
, fmt
->error_element
);
1133 snprintf (buffer
, BUFLEN
, "%s\n", message
);
1135 /* Get the offset into the format string where the error occurred. */
1136 offset
= dtp
->format_len
- (fmt
->reversion_ok
?
1137 (int) strlen(p
) : fmt
->format_string_len
);
1139 width
= dtp
->format_len
;
1144 /* Show the format */
1146 p
= strchr (buffer
, '\0');
1148 memcpy (p
, dtp
->format
, width
);
1153 /* Show where the problem is */
1155 for (i
= 1; i
< offset
; i
++)
1161 generate_error (&dtp
->common
, LIBERROR_FORMAT
, buffer
);
1165 /* revert()-- Do reversion of the format. Control reverts to the left
1166 * parenthesis that matches the rightmost right parenthesis. From our
1167 * tree structure, we are looking for the rightmost parenthesis node
1168 * at the second level, the first level always being a single
1169 * parenthesis node. If this node doesn't exit, we use the top
1173 revert (st_parameter_dt
*dtp
)
1176 format_data
*fmt
= dtp
->u
.p
.fmt
;
1178 dtp
->u
.p
.reversion_flag
= 1;
1182 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
1183 if (f
->format
== FMT_LPAREN
)
1186 /* If r is NULL because no node was found, the whole tree will be used */
1188 fmt
->array
.array
[0].current
= r
;
1189 fmt
->array
.array
[0].count
= 0;
1192 /* parse_format()-- Parse a format string. */
1195 parse_format (st_parameter_dt
*dtp
)
1198 bool format_cache_ok
, seen_data_desc
= false;
1200 /* Don't cache for internal units and set an arbitrary limit on the size of
1201 format strings we will cache. (Avoids memory issues.) */
1202 format_cache_ok
= !is_internal_unit (dtp
);
1204 /* Lookup format string to see if it has already been parsed. */
1205 if (format_cache_ok
)
1207 dtp
->u
.p
.fmt
= find_parsed_format (dtp
);
1209 if (dtp
->u
.p
.fmt
!= NULL
)
1211 dtp
->u
.p
.fmt
->reversion_ok
= 0;
1212 dtp
->u
.p
.fmt
->saved_token
= FMT_NONE
;
1213 dtp
->u
.p
.fmt
->saved_format
= NULL
;
1214 reset_fnode_counters (dtp
);
1219 /* Not found so proceed as follows. */
1221 if (format_cache_ok
)
1223 char *fmt_string
= xmalloc (dtp
->format_len
+ 1);
1224 memcpy (fmt_string
, dtp
->format
, dtp
->format_len
);
1225 dtp
->format
= fmt_string
;
1226 dtp
->format
[dtp
->format_len
] = '\0';
1229 dtp
->u
.p
.fmt
= fmt
= xmalloc (sizeof (format_data
));
1230 fmt
->format_string
= dtp
->format
;
1231 fmt
->format_string_len
= dtp
->format_len
;
1234 fmt
->saved_token
= FMT_NONE
;
1238 /* Initialize variables used during traversal of the tree. */
1240 fmt
->reversion_ok
= 0;
1241 fmt
->saved_format
= NULL
;
1243 /* Allocate the first format node as the root of the tree. */
1245 fmt
->last
= &fmt
->array
;
1246 fmt
->last
->next
= NULL
;
1247 fmt
->avail
= &fmt
->array
.array
[0];
1249 memset (fmt
->avail
, 0, sizeof (*fmt
->avail
));
1250 fmt
->avail
->format
= FMT_LPAREN
;
1251 fmt
->avail
->repeat
= 1;
1254 if (format_lex (fmt
) == FMT_LPAREN
)
1255 fmt
->array
.array
[0].u
.child
= parse_format_list (dtp
, &seen_data_desc
);
1257 fmt
->error
= "Missing initial left parenthesis in format";
1261 format_error (dtp
, NULL
, fmt
->error
);
1262 if (format_cache_ok
)
1264 free_format_hash_table (dtp
->u
.p
.current_unit
);
1268 if (format_cache_ok
)
1269 save_parsed_format (dtp
);
1271 dtp
->u
.p
.format_not_saved
= 1;
1275 /* next_format0()-- Get the next format node without worrying about
1276 * reversion. Returns NULL when we hit the end of the list.
1277 * Parenthesis nodes are incremented after the list has been
1278 * exhausted, other nodes are incremented before they are returned. */
1280 static const fnode
*
1281 next_format0 (fnode
* f
)
1288 if (f
->format
!= FMT_LPAREN
)
1291 if (f
->count
<= f
->repeat
)
1298 /* Deal with a parenthesis node with unlimited format. */
1300 if (f
->repeat
== -2) /* -2 signifies unlimited. */
1303 if (f
->current
== NULL
)
1304 f
->current
= f
->u
.child
;
1306 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1308 r
= next_format0 (f
->current
);
1314 /* Deal with a parenthesis node with specific repeat count. */
1315 for (; f
->count
< f
->repeat
; f
->count
++)
1317 if (f
->current
== NULL
)
1318 f
->current
= f
->u
.child
;
1320 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1322 r
= next_format0 (f
->current
);
1333 /* next_format()-- Return the next format node. If the format list
1334 * ends up being exhausted, we do reversion. Reversion is only
1335 * allowed if we've seen a data descriptor since the
1336 * initialization or the last reversion. We return NULL if there
1337 * are no more data descriptors to return (which is an error
1341 next_format (st_parameter_dt
*dtp
)
1345 format_data
*fmt
= dtp
->u
.p
.fmt
;
1347 if (fmt
->saved_format
!= NULL
)
1348 { /* Deal with a pushed-back format node */
1349 f
= fmt
->saved_format
;
1350 fmt
->saved_format
= NULL
;
1354 f
= next_format0 (&fmt
->array
.array
[0]);
1357 if (!fmt
->reversion_ok
)
1360 fmt
->reversion_ok
= 0;
1363 f
= next_format0 (&fmt
->array
.array
[0]);
1366 format_error (dtp
, NULL
, reversion_error
);
1370 /* Push the first reverted token and return a colon node in case
1371 * there are no more data items. */
1373 fmt
->saved_format
= f
;
1377 /* If this is a data edit descriptor, then reversion has become OK. */
1381 if (!fmt
->reversion_ok
&&
1382 (t
== FMT_I
|| t
== FMT_B
|| t
== FMT_O
|| t
== FMT_Z
|| t
== FMT_F
||
1383 t
== FMT_E
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_G
|| t
== FMT_L
||
1384 t
== FMT_A
|| t
== FMT_D
))
1385 fmt
->reversion_ok
= 1;
1390 /* unget_format()-- Push the given format back so that it will be
1391 * returned on the next call to next_format() without affecting
1392 * counts. This is necessary when we've encountered a data
1393 * descriptor, but don't know what the data item is yet. The format
1394 * node is pushed back, and we return control to the main program,
1395 * which calls the library back with the data item (or not). */
1398 unget_format (st_parameter_dt
*dtp
, const fnode
*f
)
1400 dtp
->u
.p
.fmt
->saved_format
= f
;