1 /* Copyright (C) 2002-2013 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 */
38 static const fnode colon_node
= { FMT_COLON
, 0, NULL
, NULL
, {{ 0, 0, 0 }}, 0,
43 static const char posint_required
[] = "Positive width required in format",
44 period_required
[] = "Period required in format",
45 nonneg_required
[] = "Nonnegative width required in format",
46 unexpected_element
[] = "Unexpected element '%c' in format\n",
47 unexpected_end
[] = "Unexpected end of format string",
48 bad_string
[] = "Unterminated character constant in format",
49 bad_hollerith
[] = "Hollerith constant extends past the end of the format",
50 reversion_error
[] = "Exhausted data descriptors in format",
51 zero_width
[] = "Zero width in format descriptor";
53 /* The following routines support caching format data from parsed format strings
54 into a hash table. This avoids repeatedly parsing duplicate format strings
55 or format strings in I/O statements that are repeated in loops. */
58 /* Traverse the table and free all data. */
61 free_format_hash_table (gfc_unit
*u
)
65 /* free_format_data handles any NULL pointers. */
66 for (i
= 0; i
< FORMAT_HASH_SIZE
; i
++)
68 if (u
->format_hash_table
[i
].hashed_fmt
!= NULL
)
70 free_format_data (u
->format_hash_table
[i
].hashed_fmt
);
71 free (u
->format_hash_table
[i
].key
);
73 u
->format_hash_table
[i
].key
= NULL
;
74 u
->format_hash_table
[i
].key_len
= 0;
75 u
->format_hash_table
[i
].hashed_fmt
= NULL
;
79 /* Traverse the format_data structure and reset the fnode counters. */
82 reset_node (fnode
*fn
)
89 if (fn
->format
!= FMT_LPAREN
)
92 for (f
= fn
->u
.child
; f
; f
= f
->next
)
94 if (f
->format
== FMT_RPAREN
)
101 reset_fnode_counters (st_parameter_dt
*dtp
)
108 /* Clear this pointer at the head so things start at the right place. */
109 fmt
->array
.array
[0].current
= NULL
;
111 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
116 /* A simple hashing function to generate an index into the hash table. */
119 format_hash (st_parameter_dt
*dtp
)
122 gfc_charlen_type key_len
;
126 /* Hash the format string. Super simple, but what the heck! */
128 key_len
= dtp
->format_len
;
129 for (i
= 0; i
< key_len
; i
++)
131 hash
&= (FORMAT_HASH_SIZE
- 1);
137 save_parsed_format (st_parameter_dt
*dtp
)
142 hash
= format_hash (dtp
);
143 u
= dtp
->u
.p
.current_unit
;
145 /* Index into the hash table. We are simply replacing whatever is there
146 relying on probability. */
147 if (u
->format_hash_table
[hash
].hashed_fmt
!= NULL
)
148 free_format_data (u
->format_hash_table
[hash
].hashed_fmt
);
149 u
->format_hash_table
[hash
].hashed_fmt
= NULL
;
151 free (u
->format_hash_table
[hash
].key
);
152 u
->format_hash_table
[hash
].key
= xmalloc (dtp
->format_len
);
153 memcpy (u
->format_hash_table
[hash
].key
, dtp
->format
, dtp
->format_len
);
155 u
->format_hash_table
[hash
].key_len
= dtp
->format_len
;
156 u
->format_hash_table
[hash
].hashed_fmt
= dtp
->u
.p
.fmt
;
161 find_parsed_format (st_parameter_dt
*dtp
)
166 hash
= format_hash (dtp
);
167 u
= dtp
->u
.p
.current_unit
;
169 if (u
->format_hash_table
[hash
].key
!= NULL
)
171 /* See if it matches. */
172 if (u
->format_hash_table
[hash
].key_len
== dtp
->format_len
)
174 /* So far so good. */
175 if (strncmp (u
->format_hash_table
[hash
].key
,
176 dtp
->format
, dtp
->format_len
) == 0)
177 return u
->format_hash_table
[hash
].hashed_fmt
;
184 /* next_char()-- Return the next character in the format string.
185 * Returns -1 when the string is done. If the literal flag is set,
186 * spaces are significant, otherwise they are not. */
189 next_char (format_data
*fmt
, int literal
)
195 if (fmt
->format_string_len
== 0)
198 fmt
->format_string_len
--;
199 c
= toupper (*fmt
->format_string
++);
200 fmt
->error_element
= c
;
202 while ((c
== ' ' || c
== '\t') && !literal
);
208 /* unget_char()-- Back up one character position. */
210 #define unget_char(fmt) \
211 { fmt->format_string--; fmt->format_string_len++; }
214 /* get_fnode()-- Allocate a new format node, inserting it into the
215 * current singly linked list. These are initially allocated from the
219 get_fnode (format_data
*fmt
, fnode
**head
, fnode
**tail
, format_token t
)
223 if (fmt
->avail
== &fmt
->last
->array
[FARRAY_SIZE
])
225 fmt
->last
->next
= xmalloc (sizeof (fnode_array
));
226 fmt
->last
= fmt
->last
->next
;
227 fmt
->last
->next
= NULL
;
228 fmt
->avail
= &fmt
->last
->array
[0];
231 memset (f
, '\0', sizeof (fnode
));
243 f
->source
= fmt
->format_string
;
248 /* free_format_data()-- Free all allocated format data. */
251 free_format_data (format_data
*fmt
)
253 fnode_array
*fa
, *fa_next
;
259 for (fa
= fmt
->array
.next
; fa
; fa
= fa_next
)
270 /* format_lex()-- Simple lexical analyzer for getting the next token
271 * in a FORMAT string. We support a one-level token pushback in the
272 * fmt->saved_token variable. */
275 format_lex (format_data
*fmt
)
282 if (fmt
->saved_token
!= FMT_NONE
)
284 token
= fmt
->saved_token
;
285 fmt
->saved_token
= FMT_NONE
;
290 c
= next_char (fmt
, 0);
311 c
= next_char (fmt
, 0);
318 fmt
->value
= c
- '0';
322 c
= next_char (fmt
, 0);
326 fmt
->value
= 10 * fmt
->value
+ c
- '0';
332 fmt
->value
= -fmt
->value
;
333 token
= FMT_SIGNED_INT
;
346 fmt
->value
= c
- '0';
350 c
= next_char (fmt
, 0);
354 fmt
->value
= 10 * fmt
->value
+ c
- '0';
358 token
= (fmt
->value
== 0) ? FMT_ZERO
: FMT_POSINT
;
382 switch (next_char (fmt
, 0))
403 switch (next_char (fmt
, 0))
420 switch (next_char (fmt
, 0))
440 fmt
->string
= fmt
->format_string
;
441 fmt
->value
= 0; /* This is the length of the string */
445 c
= next_char (fmt
, 1);
448 token
= FMT_BADSTRING
;
449 fmt
->error
= bad_string
;
455 c
= next_char (fmt
, 1);
459 token
= FMT_BADSTRING
;
460 fmt
->error
= bad_string
;
498 switch (next_char (fmt
, 0))
530 switch (next_char (fmt
, 0))
546 switch (next_char (fmt
, 0))
586 /* parse_format_list()-- Parse a format list. Assumes that a left
587 * paren has already been seen. Returns a list representing the
588 * parenthesis node which contains the rest of the list. */
591 parse_format_list (st_parameter_dt
*dtp
, bool *save_ok
, bool *seen_dd
)
594 format_token t
, u
, t2
;
596 format_data
*fmt
= dtp
->u
.p
.fmt
;
597 bool saveit
, seen_data_desc
= false;
602 /* Get the next format item */
604 t
= format_lex (fmt
);
609 t
= format_lex (fmt
);
612 fmt
->error
= "Left parenthesis required after '*'";
615 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
616 tail
->repeat
= -2; /* Signifies unlimited format. */
617 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
618 if (fmt
->error
!= NULL
)
622 fmt
->error
= "'*' requires at least one associated data descriptor";
630 t
= format_lex (fmt
);
634 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
635 tail
->repeat
= repeat
;
636 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
637 *seen_dd
= seen_data_desc
;
638 if (fmt
->error
!= NULL
)
644 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
645 tail
->repeat
= repeat
;
649 get_fnode (fmt
, &head
, &tail
, FMT_X
);
651 tail
->u
.k
= fmt
->value
;
662 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
664 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
665 *seen_dd
= seen_data_desc
;
666 if (fmt
->error
!= NULL
)
671 case FMT_SIGNED_INT
: /* Signed integer can only precede a P format. */
672 case FMT_ZERO
: /* Same for zero. */
673 t
= format_lex (fmt
);
676 fmt
->error
= "Expected P edit descriptor in format";
681 get_fnode (fmt
, &head
, &tail
, FMT_P
);
682 tail
->u
.k
= fmt
->value
;
685 t
= format_lex (fmt
);
686 if (t
== FMT_F
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_D
687 || t
== FMT_G
|| t
== FMT_E
)
693 if (t
!= FMT_COMMA
&& t
!= FMT_RPAREN
&& t
!= FMT_SLASH
696 fmt
->error
= "Comma required after P descriptor";
700 fmt
->saved_token
= t
;
703 case FMT_P
: /* P and X require a prior number */
704 fmt
->error
= "P descriptor requires leading scale factor";
711 If we would be pedantic in the library, we would have to reject
712 an X descriptor without an integer prefix:
714 fmt->error = "X descriptor requires leading space count";
717 However, this is an extension supported by many Fortran compilers,
718 including Cray, HP, AIX, and IRIX. Therefore, we allow it in the
719 runtime library, and make the front end reject it if the compiler
720 is in pedantic mode. The interpretation of 'X' is '1X'.
722 get_fnode (fmt
, &head
, &tail
, FMT_X
);
728 /* TODO: Find out why it is necessary to turn off format caching. */
730 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
731 tail
->u
.string
.p
= fmt
->string
;
732 tail
->u
.string
.length
= fmt
->value
;
742 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: Round "
743 "descriptor not allowed");
744 get_fnode (fmt
, &head
, &tail
, t
);
750 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: DC or DP "
751 "descriptor not allowed");
758 get_fnode (fmt
, &head
, &tail
, t
);
763 get_fnode (fmt
, &head
, &tail
, FMT_COLON
);
768 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
774 get_fnode (fmt
, &head
, &tail
, FMT_DOLLAR
);
776 notify_std (&dtp
->common
, GFC_STD_GNU
, "Extension: $ descriptor");
782 t2
= format_lex (fmt
);
783 if (t2
!= FMT_POSINT
)
785 fmt
->error
= posint_required
;
788 get_fnode (fmt
, &head
, &tail
, t
);
789 tail
->u
.n
= fmt
->value
;
810 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
811 if (fmt
->format_string_len
< 1)
813 fmt
->error
= bad_hollerith
;
817 tail
->u
.string
.p
= fmt
->format_string
;
818 tail
->u
.string
.length
= 1;
821 fmt
->format_string
++;
822 fmt
->format_string_len
--;
827 fmt
->error
= unexpected_end
;
837 fmt
->error
= unexpected_element
;
841 /* In this state, t must currently be a data descriptor. Deal with
842 things that can/must follow the descriptor */
847 t
= format_lex (fmt
);
850 if (notification_std(GFC_STD_GNU
) == NOTIFICATION_ERROR
)
852 fmt
->error
= posint_required
;
857 fmt
->saved_token
= t
;
858 fmt
->value
= 1; /* Default width */
859 notify_std (&dtp
->common
, GFC_STD_GNU
, posint_required
);
863 get_fnode (fmt
, &head
, &tail
, FMT_L
);
864 tail
->u
.n
= fmt
->value
;
865 tail
->repeat
= repeat
;
869 t
= format_lex (fmt
);
872 fmt
->error
= zero_width
;
878 fmt
->saved_token
= t
;
879 fmt
->value
= -1; /* Width not present */
882 get_fnode (fmt
, &head
, &tail
, FMT_A
);
883 tail
->repeat
= repeat
;
884 tail
->u
.n
= fmt
->value
;
893 get_fnode (fmt
, &head
, &tail
, t
);
894 tail
->repeat
= repeat
;
896 u
= format_lex (fmt
);
897 if (t
== FMT_G
&& u
== FMT_ZERO
)
899 if (notification_std (GFC_STD_F2008
) == NOTIFICATION_ERROR
900 || dtp
->u
.p
.mode
== READING
)
902 fmt
->error
= zero_width
;
906 u
= format_lex (fmt
);
909 fmt
->saved_token
= u
;
913 u
= format_lex (fmt
);
916 fmt
->error
= posint_required
;
919 tail
->u
.real
.d
= fmt
->value
;
922 if (t
== FMT_F
&& dtp
->u
.p
.mode
== WRITING
)
924 if (u
!= FMT_POSINT
&& u
!= FMT_ZERO
)
926 fmt
->error
= nonneg_required
;
930 else if (u
!= FMT_POSINT
)
932 fmt
->error
= posint_required
;
936 tail
->u
.real
.w
= fmt
->value
;
938 t
= format_lex (fmt
);
941 /* We treat a missing decimal descriptor as 0. Note: This is only
942 allowed if -std=legacy, otherwise an error occurs. */
943 if (compile_options
.warn_std
!= 0)
945 fmt
->error
= period_required
;
948 fmt
->saved_token
= t
;
954 t
= format_lex (fmt
);
955 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
957 fmt
->error
= nonneg_required
;
961 tail
->u
.real
.d
= fmt
->value
;
964 if (t2
== FMT_D
|| t2
== FMT_F
)
968 /* Look for optional exponent */
969 t
= format_lex (fmt
);
971 fmt
->saved_token
= t
;
974 t
= format_lex (fmt
);
977 fmt
->error
= "Positive exponent width required in format";
981 tail
->u
.real
.e
= fmt
->value
;
987 if (repeat
> fmt
->format_string_len
)
989 fmt
->error
= bad_hollerith
;
993 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
994 tail
->u
.string
.p
= fmt
->format_string
;
995 tail
->u
.string
.length
= repeat
;
998 fmt
->format_string
+= fmt
->value
;
999 fmt
->format_string_len
-= repeat
;
1007 get_fnode (fmt
, &head
, &tail
, t
);
1008 tail
->repeat
= repeat
;
1010 t
= format_lex (fmt
);
1012 if (dtp
->u
.p
.mode
== READING
)
1014 if (t
!= FMT_POSINT
)
1016 fmt
->error
= posint_required
;
1022 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1024 fmt
->error
= nonneg_required
;
1029 tail
->u
.integer
.w
= fmt
->value
;
1030 tail
->u
.integer
.m
= -1;
1032 t
= format_lex (fmt
);
1033 if (t
!= FMT_PERIOD
)
1035 fmt
->saved_token
= t
;
1039 t
= format_lex (fmt
);
1040 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1042 fmt
->error
= nonneg_required
;
1046 tail
->u
.integer
.m
= fmt
->value
;
1049 if (tail
->u
.integer
.w
!= 0 && tail
->u
.integer
.m
> tail
->u
.integer
.w
)
1051 fmt
->error
= "Minimum digits exceeds field width";
1058 fmt
->error
= unexpected_element
;
1062 /* Between a descriptor and what comes next */
1064 t
= format_lex (fmt
);
1075 get_fnode (fmt
, &head
, &tail
, t
);
1077 goto optional_comma
;
1080 fmt
->error
= unexpected_end
;
1084 /* Assume a missing comma, this is a GNU extension */
1088 /* Optional comma is a weird between state where we've just finished
1089 reading a colon, slash or P descriptor. */
1091 t
= format_lex (fmt
);
1100 default: /* Assume that we have another format item */
1101 fmt
->saved_token
= t
;
1115 /* format_error()-- Generate an error message for a format statement.
1116 * If the node that gives the location of the error is NULL, the error
1117 * is assumed to happen at parse time, and the current location of the
1120 * We generate a message showing where the problem is. We take extra
1121 * care to print only the relevant part of the format if it is longer
1122 * than a standard 80 column display. */
1125 format_error (st_parameter_dt
*dtp
, const fnode
*f
, const char *message
)
1127 int width
, i
, j
, offset
;
1129 char *p
, buffer
[BUFLEN
];
1130 format_data
*fmt
= dtp
->u
.p
.fmt
;
1133 fmt
->format_string
= f
->source
;
1135 if (message
== unexpected_element
)
1136 snprintf (buffer
, BUFLEN
, message
, fmt
->error_element
);
1138 snprintf (buffer
, BUFLEN
, "%s\n", message
);
1140 j
= fmt
->format_string
- dtp
->format
;
1142 offset
= (j
> 60) ? j
- 40 : 0;
1145 width
= dtp
->format_len
- offset
;
1150 /* Show the format */
1152 p
= strchr (buffer
, '\0');
1154 memcpy (p
, dtp
->format
+ offset
, width
);
1159 /* Show where the problem is */
1161 for (i
= 1; i
< j
; i
++)
1167 generate_error (&dtp
->common
, LIBERROR_FORMAT
, buffer
);
1171 /* revert()-- Do reversion of the format. Control reverts to the left
1172 * parenthesis that matches the rightmost right parenthesis. From our
1173 * tree structure, we are looking for the rightmost parenthesis node
1174 * at the second level, the first level always being a single
1175 * parenthesis node. If this node doesn't exit, we use the top
1179 revert (st_parameter_dt
*dtp
)
1182 format_data
*fmt
= dtp
->u
.p
.fmt
;
1184 dtp
->u
.p
.reversion_flag
= 1;
1188 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
1189 if (f
->format
== FMT_LPAREN
)
1192 /* If r is NULL because no node was found, the whole tree will be used */
1194 fmt
->array
.array
[0].current
= r
;
1195 fmt
->array
.array
[0].count
= 0;
1198 /* parse_format()-- Parse a format string. */
1201 parse_format (st_parameter_dt
*dtp
)
1204 bool format_cache_ok
, seen_data_desc
= false;
1206 /* Don't cache for internal units and set an arbitrary limit on the size of
1207 format strings we will cache. (Avoids memory issues.) */
1208 format_cache_ok
= !is_internal_unit (dtp
);
1210 /* Lookup format string to see if it has already been parsed. */
1211 if (format_cache_ok
)
1213 dtp
->u
.p
.fmt
= find_parsed_format (dtp
);
1215 if (dtp
->u
.p
.fmt
!= NULL
)
1217 dtp
->u
.p
.fmt
->reversion_ok
= 0;
1218 dtp
->u
.p
.fmt
->saved_token
= FMT_NONE
;
1219 dtp
->u
.p
.fmt
->saved_format
= NULL
;
1220 reset_fnode_counters (dtp
);
1225 /* Not found so proceed as follows. */
1227 dtp
->u
.p
.fmt
= fmt
= xmalloc (sizeof (format_data
));
1228 fmt
->format_string
= dtp
->format
;
1229 fmt
->format_string_len
= dtp
->format_len
;
1232 fmt
->saved_token
= FMT_NONE
;
1236 /* Initialize variables used during traversal of the tree. */
1238 fmt
->reversion_ok
= 0;
1239 fmt
->saved_format
= NULL
;
1241 /* Allocate the first format node as the root of the tree. */
1243 fmt
->last
= &fmt
->array
;
1244 fmt
->last
->next
= NULL
;
1245 fmt
->avail
= &fmt
->array
.array
[0];
1247 memset (fmt
->avail
, 0, sizeof (*fmt
->avail
));
1248 fmt
->avail
->format
= FMT_LPAREN
;
1249 fmt
->avail
->repeat
= 1;
1252 if (format_lex (fmt
) == FMT_LPAREN
)
1253 fmt
->array
.array
[0].u
.child
= parse_format_list (dtp
, &format_cache_ok
,
1256 fmt
->error
= "Missing initial left parenthesis in format";
1260 format_error (dtp
, NULL
, fmt
->error
);
1261 free_format_hash_table (dtp
->u
.p
.current_unit
);
1265 if (format_cache_ok
)
1266 save_parsed_format (dtp
);
1268 dtp
->u
.p
.format_not_saved
= 1;
1272 /* next_format0()-- Get the next format node without worrying about
1273 * reversion. Returns NULL when we hit the end of the list.
1274 * Parenthesis nodes are incremented after the list has been
1275 * exhausted, other nodes are incremented before they are returned. */
1277 static const fnode
*
1278 next_format0 (fnode
* f
)
1285 if (f
->format
!= FMT_LPAREN
)
1288 if (f
->count
<= f
->repeat
)
1295 /* Deal with a parenthesis node with unlimited format. */
1297 if (f
->repeat
== -2) /* -2 signifies unlimited. */
1300 if (f
->current
== NULL
)
1301 f
->current
= f
->u
.child
;
1303 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1305 r
= next_format0 (f
->current
);
1311 /* Deal with a parenthesis node with specific repeat count. */
1312 for (; f
->count
< f
->repeat
; f
->count
++)
1314 if (f
->current
== NULL
)
1315 f
->current
= f
->u
.child
;
1317 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1319 r
= next_format0 (f
->current
);
1330 /* next_format()-- Return the next format node. If the format list
1331 * ends up being exhausted, we do reversion. Reversion is only
1332 * allowed if we've seen a data descriptor since the
1333 * initialization or the last reversion. We return NULL if there
1334 * are no more data descriptors to return (which is an error
1338 next_format (st_parameter_dt
*dtp
)
1342 format_data
*fmt
= dtp
->u
.p
.fmt
;
1344 if (fmt
->saved_format
!= NULL
)
1345 { /* Deal with a pushed-back format node */
1346 f
= fmt
->saved_format
;
1347 fmt
->saved_format
= NULL
;
1351 f
= next_format0 (&fmt
->array
.array
[0]);
1354 if (!fmt
->reversion_ok
)
1357 fmt
->reversion_ok
= 0;
1360 f
= next_format0 (&fmt
->array
.array
[0]);
1363 format_error (dtp
, NULL
, reversion_error
);
1367 /* Push the first reverted token and return a colon node in case
1368 * there are no more data items. */
1370 fmt
->saved_format
= f
;
1374 /* If this is a data edit descriptor, then reversion has become OK. */
1378 if (!fmt
->reversion_ok
&&
1379 (t
== FMT_I
|| t
== FMT_B
|| t
== FMT_O
|| t
== FMT_Z
|| t
== FMT_F
||
1380 t
== FMT_E
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_G
|| t
== FMT_L
||
1381 t
== FMT_A
|| t
== FMT_D
))
1382 fmt
->reversion_ok
= 1;
1387 /* unget_format()-- Push the given format back so that it will be
1388 * returned on the next call to next_format() without affecting
1389 * counts. This is necessary when we've encountered a data
1390 * descriptor, but don't know what the data item is yet. The format
1391 * node is pushed back, and we return control to the main program,
1392 * which calls the library back with the data item (or not). */
1395 unget_format (st_parameter_dt
*dtp
, const fnode
*f
)
1397 dtp
->u
.p
.fmt
->saved_format
= f
;