1 /* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
2 Free Software Foundation, Inc.
3 Contributed by Andy Vaught
4 F2003 I/O support contributed by Jerry DeLisle
6 This file is part of the GNU Fortran runtime library (libgfortran).
8 Libgfortran is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 Libgfortran is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
28 /* format.c-- parse a FORMAT string into a binary format suitable for
29 * interpretation during I/O statements */
39 static const fnode colon_node
= { FMT_COLON
, 0, NULL
, NULL
, {{ 0, 0, 0 }}, 0,
44 static const char posint_required
[] = "Positive width required in format",
45 period_required
[] = "Period required in format",
46 nonneg_required
[] = "Nonnegative width required in format",
47 unexpected_element
[] = "Unexpected element '%c' in format\n",
48 unexpected_end
[] = "Unexpected end of format string",
49 bad_string
[] = "Unterminated character constant in format",
50 bad_hollerith
[] = "Hollerith constant extends past the end of the format",
51 reversion_error
[] = "Exhausted data descriptors in format",
52 zero_width
[] = "Zero width in format descriptor";
54 /* The following routines support caching format data from parsed format strings
55 into a hash table. This avoids repeatedly parsing duplicate format strings
56 or format strings in I/O statements that are repeated in loops. */
59 /* Traverse the table and free all data. */
62 free_format_hash_table (gfc_unit
*u
)
66 /* free_format_data handles any NULL pointers. */
67 for (i
= 0; i
< FORMAT_HASH_SIZE
; i
++)
69 if (u
->format_hash_table
[i
].hashed_fmt
!= NULL
)
71 free_format_data (u
->format_hash_table
[i
].hashed_fmt
);
72 free (u
->format_hash_table
[i
].key
);
74 u
->format_hash_table
[i
].key
= NULL
;
75 u
->format_hash_table
[i
].key_len
= 0;
76 u
->format_hash_table
[i
].hashed_fmt
= NULL
;
80 /* Traverse the format_data structure and reset the fnode counters. */
83 reset_node (fnode
*fn
)
90 if (fn
->format
!= FMT_LPAREN
)
93 for (f
= fn
->u
.child
; f
; f
= f
->next
)
95 if (f
->format
== FMT_RPAREN
)
102 reset_fnode_counters (st_parameter_dt
*dtp
)
109 /* Clear this pointer at the head so things start at the right place. */
110 fmt
->array
.array
[0].current
= NULL
;
112 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
117 /* A simple hashing function to generate an index into the hash table. */
120 format_hash (st_parameter_dt
*dtp
)
123 gfc_charlen_type key_len
;
127 /* Hash the format string. Super simple, but what the heck! */
129 key_len
= dtp
->format_len
;
130 for (i
= 0; i
< key_len
; i
++)
132 hash
&= (FORMAT_HASH_SIZE
- 1);
138 save_parsed_format (st_parameter_dt
*dtp
)
143 hash
= format_hash (dtp
);
144 u
= dtp
->u
.p
.current_unit
;
146 /* Index into the hash table. We are simply replacing whatever is there
147 relying on probability. */
148 if (u
->format_hash_table
[hash
].hashed_fmt
!= NULL
)
149 free_format_data (u
->format_hash_table
[hash
].hashed_fmt
);
150 u
->format_hash_table
[hash
].hashed_fmt
= NULL
;
152 free (u
->format_hash_table
[hash
].key
);
153 u
->format_hash_table
[hash
].key
= get_mem (dtp
->format_len
);
154 memcpy (u
->format_hash_table
[hash
].key
, dtp
->format
, dtp
->format_len
);
156 u
->format_hash_table
[hash
].key_len
= dtp
->format_len
;
157 u
->format_hash_table
[hash
].hashed_fmt
= dtp
->u
.p
.fmt
;
162 find_parsed_format (st_parameter_dt
*dtp
)
167 hash
= format_hash (dtp
);
168 u
= dtp
->u
.p
.current_unit
;
170 if (u
->format_hash_table
[hash
].key
!= NULL
)
172 /* See if it matches. */
173 if (u
->format_hash_table
[hash
].key_len
== dtp
->format_len
)
175 /* So far so good. */
176 if (strncmp (u
->format_hash_table
[hash
].key
,
177 dtp
->format
, dtp
->format_len
) == 0)
178 return u
->format_hash_table
[hash
].hashed_fmt
;
185 /* next_char()-- Return the next character in the format string.
186 * Returns -1 when the string is done. If the literal flag is set,
187 * spaces are significant, otherwise they are not. */
190 next_char (format_data
*fmt
, int literal
)
196 if (fmt
->format_string_len
== 0)
199 fmt
->format_string_len
--;
200 c
= toupper (*fmt
->format_string
++);
201 fmt
->error_element
= c
;
203 while ((c
== ' ' || c
== '\t') && !literal
);
209 /* unget_char()-- Back up one character position. */
211 #define unget_char(fmt) \
212 { fmt->format_string--; fmt->format_string_len++; }
215 /* get_fnode()-- Allocate a new format node, inserting it into the
216 * current singly linked list. These are initially allocated from the
220 get_fnode (format_data
*fmt
, fnode
**head
, fnode
**tail
, format_token t
)
224 if (fmt
->avail
== &fmt
->last
->array
[FARRAY_SIZE
])
226 fmt
->last
->next
= get_mem (sizeof (fnode_array
));
227 fmt
->last
= fmt
->last
->next
;
228 fmt
->last
->next
= NULL
;
229 fmt
->avail
= &fmt
->last
->array
[0];
232 memset (f
, '\0', sizeof (fnode
));
244 f
->source
= fmt
->format_string
;
249 /* free_format_data()-- Free all allocated format data. */
252 free_format_data (format_data
*fmt
)
254 fnode_array
*fa
, *fa_next
;
260 for (fa
= fmt
->array
.next
; fa
; fa
= fa_next
)
271 /* format_lex()-- Simple lexical analyzer for getting the next token
272 * in a FORMAT string. We support a one-level token pushback in the
273 * fmt->saved_token variable. */
276 format_lex (format_data
*fmt
)
283 if (fmt
->saved_token
!= FMT_NONE
)
285 token
= fmt
->saved_token
;
286 fmt
->saved_token
= FMT_NONE
;
291 c
= next_char (fmt
, 0);
312 c
= next_char (fmt
, 0);
319 fmt
->value
= c
- '0';
323 c
= next_char (fmt
, 0);
327 fmt
->value
= 10 * fmt
->value
+ c
- '0';
333 fmt
->value
= -fmt
->value
;
334 token
= FMT_SIGNED_INT
;
347 fmt
->value
= c
- '0';
351 c
= next_char (fmt
, 0);
355 fmt
->value
= 10 * fmt
->value
+ c
- '0';
359 token
= (fmt
->value
== 0) ? FMT_ZERO
: FMT_POSINT
;
383 switch (next_char (fmt
, 0))
404 switch (next_char (fmt
, 0))
421 switch (next_char (fmt
, 0))
441 fmt
->string
= fmt
->format_string
;
442 fmt
->value
= 0; /* This is the length of the string */
446 c
= next_char (fmt
, 1);
449 token
= FMT_BADSTRING
;
450 fmt
->error
= bad_string
;
456 c
= next_char (fmt
, 1);
460 token
= FMT_BADSTRING
;
461 fmt
->error
= bad_string
;
499 switch (next_char (fmt
, 0))
531 switch (next_char (fmt
, 0))
547 switch (next_char (fmt
, 0))
587 /* parse_format_list()-- Parse a format list. Assumes that a left
588 * paren has already been seen. Returns a list representing the
589 * parenthesis node which contains the rest of the list. */
592 parse_format_list (st_parameter_dt
*dtp
, bool *save_ok
, bool *seen_dd
)
595 format_token t
, u
, t2
;
597 format_data
*fmt
= dtp
->u
.p
.fmt
;
598 bool saveit
, seen_data_desc
= false;
603 /* Get the next format item */
605 t
= format_lex (fmt
);
610 t
= format_lex (fmt
);
613 fmt
->error
= "Left parenthesis required after '*'";
616 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
617 tail
->repeat
= -2; /* Signifies unlimited format. */
618 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
619 if (fmt
->error
!= NULL
)
623 fmt
->error
= "'*' requires at least one associated data descriptor";
631 t
= format_lex (fmt
);
635 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
636 tail
->repeat
= repeat
;
637 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
638 *seen_dd
= seen_data_desc
;
639 if (fmt
->error
!= NULL
)
645 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
646 tail
->repeat
= repeat
;
650 get_fnode (fmt
, &head
, &tail
, FMT_X
);
652 tail
->u
.k
= fmt
->value
;
663 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
665 tail
->u
.child
= parse_format_list (dtp
, &saveit
, &seen_data_desc
);
666 *seen_dd
= seen_data_desc
;
667 if (fmt
->error
!= NULL
)
672 case FMT_SIGNED_INT
: /* Signed integer can only precede a P format. */
673 case FMT_ZERO
: /* Same for zero. */
674 t
= format_lex (fmt
);
677 fmt
->error
= "Expected P edit descriptor in format";
682 get_fnode (fmt
, &head
, &tail
, FMT_P
);
683 tail
->u
.k
= fmt
->value
;
686 t
= format_lex (fmt
);
687 if (t
== FMT_F
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_D
688 || t
== FMT_G
|| t
== FMT_E
)
694 if (t
!= FMT_COMMA
&& t
!= FMT_RPAREN
&& t
!= FMT_SLASH
697 fmt
->error
= "Comma required after P descriptor";
701 fmt
->saved_token
= t
;
704 case FMT_P
: /* P and X require a prior number */
705 fmt
->error
= "P descriptor requires leading scale factor";
712 If we would be pedantic in the library, we would have to reject
713 an X descriptor without an integer prefix:
715 fmt->error = "X descriptor requires leading space count";
718 However, this is an extension supported by many Fortran compilers,
719 including Cray, HP, AIX, and IRIX. Therefore, we allow it in the
720 runtime library, and make the front end reject it if the compiler
721 is in pedantic mode. The interpretation of 'X' is '1X'.
723 get_fnode (fmt
, &head
, &tail
, FMT_X
);
729 /* TODO: Find out why it is necessary to turn off format caching. */
731 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
732 tail
->u
.string
.p
= fmt
->string
;
733 tail
->u
.string
.length
= fmt
->value
;
743 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: Round "
744 "descriptor not allowed");
745 get_fnode (fmt
, &head
, &tail
, t
);
751 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: DC or DP "
752 "descriptor not allowed");
759 get_fnode (fmt
, &head
, &tail
, t
);
764 get_fnode (fmt
, &head
, &tail
, FMT_COLON
);
769 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
775 get_fnode (fmt
, &head
, &tail
, FMT_DOLLAR
);
777 notify_std (&dtp
->common
, GFC_STD_GNU
, "Extension: $ descriptor");
783 t2
= format_lex (fmt
);
784 if (t2
!= FMT_POSINT
)
786 fmt
->error
= posint_required
;
789 get_fnode (fmt
, &head
, &tail
, t
);
790 tail
->u
.n
= fmt
->value
;
811 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
812 if (fmt
->format_string_len
< 1)
814 fmt
->error
= bad_hollerith
;
818 tail
->u
.string
.p
= fmt
->format_string
;
819 tail
->u
.string
.length
= 1;
822 fmt
->format_string
++;
823 fmt
->format_string_len
--;
828 fmt
->error
= unexpected_end
;
838 fmt
->error
= unexpected_element
;
842 /* In this state, t must currently be a data descriptor. Deal with
843 things that can/must follow the descriptor */
848 t
= format_lex (fmt
);
851 if (notification_std(GFC_STD_GNU
) == NOTIFICATION_ERROR
)
853 fmt
->error
= posint_required
;
858 fmt
->saved_token
= t
;
859 fmt
->value
= 1; /* Default width */
860 notify_std (&dtp
->common
, GFC_STD_GNU
, posint_required
);
864 get_fnode (fmt
, &head
, &tail
, FMT_L
);
865 tail
->u
.n
= fmt
->value
;
866 tail
->repeat
= repeat
;
870 t
= format_lex (fmt
);
873 fmt
->error
= zero_width
;
879 fmt
->saved_token
= t
;
880 fmt
->value
= -1; /* Width not present */
883 get_fnode (fmt
, &head
, &tail
, FMT_A
);
884 tail
->repeat
= repeat
;
885 tail
->u
.n
= fmt
->value
;
894 get_fnode (fmt
, &head
, &tail
, t
);
895 tail
->repeat
= repeat
;
897 u
= format_lex (fmt
);
898 if (t
== FMT_G
&& u
== FMT_ZERO
)
900 if (notification_std (GFC_STD_F2008
) == NOTIFICATION_ERROR
901 || dtp
->u
.p
.mode
== READING
)
903 fmt
->error
= zero_width
;
907 u
= format_lex (fmt
);
910 fmt
->saved_token
= u
;
914 u
= format_lex (fmt
);
917 fmt
->error
= posint_required
;
920 tail
->u
.real
.d
= fmt
->value
;
923 if (t
== FMT_F
&& dtp
->u
.p
.mode
== WRITING
)
925 if (u
!= FMT_POSINT
&& u
!= FMT_ZERO
)
927 fmt
->error
= nonneg_required
;
931 else if (u
!= FMT_POSINT
)
933 fmt
->error
= posint_required
;
937 tail
->u
.real
.w
= fmt
->value
;
939 t
= format_lex (fmt
);
942 /* We treat a missing decimal descriptor as 0. Note: This is only
943 allowed if -std=legacy, otherwise an error occurs. */
944 if (compile_options
.warn_std
!= 0)
946 fmt
->error
= period_required
;
949 fmt
->saved_token
= t
;
955 t
= format_lex (fmt
);
956 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
958 fmt
->error
= nonneg_required
;
962 tail
->u
.real
.d
= fmt
->value
;
965 if (t2
== FMT_D
|| t2
== FMT_F
)
969 /* Look for optional exponent */
970 t
= format_lex (fmt
);
972 fmt
->saved_token
= t
;
975 t
= format_lex (fmt
);
978 fmt
->error
= "Positive exponent width required in format";
982 tail
->u
.real
.e
= fmt
->value
;
988 if (repeat
> fmt
->format_string_len
)
990 fmt
->error
= bad_hollerith
;
994 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
995 tail
->u
.string
.p
= fmt
->format_string
;
996 tail
->u
.string
.length
= repeat
;
999 fmt
->format_string
+= fmt
->value
;
1000 fmt
->format_string_len
-= repeat
;
1008 get_fnode (fmt
, &head
, &tail
, t
);
1009 tail
->repeat
= repeat
;
1011 t
= format_lex (fmt
);
1013 if (dtp
->u
.p
.mode
== READING
)
1015 if (t
!= FMT_POSINT
)
1017 fmt
->error
= posint_required
;
1023 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1025 fmt
->error
= nonneg_required
;
1030 tail
->u
.integer
.w
= fmt
->value
;
1031 tail
->u
.integer
.m
= -1;
1033 t
= format_lex (fmt
);
1034 if (t
!= FMT_PERIOD
)
1036 fmt
->saved_token
= t
;
1040 t
= format_lex (fmt
);
1041 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1043 fmt
->error
= nonneg_required
;
1047 tail
->u
.integer
.m
= fmt
->value
;
1050 if (tail
->u
.integer
.w
!= 0 && tail
->u
.integer
.m
> tail
->u
.integer
.w
)
1052 fmt
->error
= "Minimum digits exceeds field width";
1059 fmt
->error
= unexpected_element
;
1063 /* Between a descriptor and what comes next */
1065 t
= format_lex (fmt
);
1076 get_fnode (fmt
, &head
, &tail
, t
);
1078 goto optional_comma
;
1081 fmt
->error
= unexpected_end
;
1085 /* Assume a missing comma, this is a GNU extension */
1089 /* Optional comma is a weird between state where we've just finished
1090 reading a colon, slash or P descriptor. */
1092 t
= format_lex (fmt
);
1101 default: /* Assume that we have another format item */
1102 fmt
->saved_token
= t
;
1116 /* format_error()-- Generate an error message for a format statement.
1117 * If the node that gives the location of the error is NULL, the error
1118 * is assumed to happen at parse time, and the current location of the
1121 * We generate a message showing where the problem is. We take extra
1122 * care to print only the relevant part of the format if it is longer
1123 * than a standard 80 column display. */
1126 format_error (st_parameter_dt
*dtp
, const fnode
*f
, const char *message
)
1128 int width
, i
, j
, offset
;
1130 char *p
, buffer
[BUFLEN
];
1131 format_data
*fmt
= dtp
->u
.p
.fmt
;
1134 fmt
->format_string
= f
->source
;
1136 if (message
== unexpected_element
)
1137 snprintf (buffer
, BUFLEN
, message
, fmt
->error_element
);
1139 snprintf (buffer
, BUFLEN
, "%s\n", message
);
1141 j
= fmt
->format_string
- dtp
->format
;
1143 offset
= (j
> 60) ? j
- 40 : 0;
1146 width
= dtp
->format_len
- offset
;
1151 /* Show the format */
1153 p
= strchr (buffer
, '\0');
1155 memcpy (p
, dtp
->format
+ offset
, width
);
1160 /* Show where the problem is */
1162 for (i
= 1; i
< j
; i
++)
1168 generate_error (&dtp
->common
, LIBERROR_FORMAT
, buffer
);
1172 /* revert()-- Do reversion of the format. Control reverts to the left
1173 * parenthesis that matches the rightmost right parenthesis. From our
1174 * tree structure, we are looking for the rightmost parenthesis node
1175 * at the second level, the first level always being a single
1176 * parenthesis node. If this node doesn't exit, we use the top
1180 revert (st_parameter_dt
*dtp
)
1183 format_data
*fmt
= dtp
->u
.p
.fmt
;
1185 dtp
->u
.p
.reversion_flag
= 1;
1189 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
1190 if (f
->format
== FMT_LPAREN
)
1193 /* If r is NULL because no node was found, the whole tree will be used */
1195 fmt
->array
.array
[0].current
= r
;
1196 fmt
->array
.array
[0].count
= 0;
1199 /* parse_format()-- Parse a format string. */
1202 parse_format (st_parameter_dt
*dtp
)
1205 bool format_cache_ok
, seen_data_desc
= false;
1207 /* Don't cache for internal units and set an arbitrary limit on the size of
1208 format strings we will cache. (Avoids memory issues.) */
1209 format_cache_ok
= !is_internal_unit (dtp
);
1211 /* Lookup format string to see if it has already been parsed. */
1212 if (format_cache_ok
)
1214 dtp
->u
.p
.fmt
= find_parsed_format (dtp
);
1216 if (dtp
->u
.p
.fmt
!= NULL
)
1218 dtp
->u
.p
.fmt
->reversion_ok
= 0;
1219 dtp
->u
.p
.fmt
->saved_token
= FMT_NONE
;
1220 dtp
->u
.p
.fmt
->saved_format
= NULL
;
1221 reset_fnode_counters (dtp
);
1226 /* Not found so proceed as follows. */
1228 dtp
->u
.p
.fmt
= fmt
= get_mem (sizeof (format_data
));
1229 fmt
->format_string
= dtp
->format
;
1230 fmt
->format_string_len
= dtp
->format_len
;
1233 fmt
->saved_token
= FMT_NONE
;
1237 /* Initialize variables used during traversal of the tree. */
1239 fmt
->reversion_ok
= 0;
1240 fmt
->saved_format
= NULL
;
1242 /* Allocate the first format node as the root of the tree. */
1244 fmt
->last
= &fmt
->array
;
1245 fmt
->last
->next
= NULL
;
1246 fmt
->avail
= &fmt
->array
.array
[0];
1248 memset (fmt
->avail
, 0, sizeof (*fmt
->avail
));
1249 fmt
->avail
->format
= FMT_LPAREN
;
1250 fmt
->avail
->repeat
= 1;
1253 if (format_lex (fmt
) == FMT_LPAREN
)
1254 fmt
->array
.array
[0].u
.child
= parse_format_list (dtp
, &format_cache_ok
,
1257 fmt
->error
= "Missing initial left parenthesis in format";
1261 format_error (dtp
, NULL
, fmt
->error
);
1262 free_format_hash_table (dtp
->u
.p
.current_unit
);
1266 if (format_cache_ok
)
1267 save_parsed_format (dtp
);
1269 dtp
->u
.p
.format_not_saved
= 1;
1273 /* next_format0()-- Get the next format node without worrying about
1274 * reversion. Returns NULL when we hit the end of the list.
1275 * Parenthesis nodes are incremented after the list has been
1276 * exhausted, other nodes are incremented before they are returned. */
1278 static const fnode
*
1279 next_format0 (fnode
* f
)
1286 if (f
->format
!= FMT_LPAREN
)
1289 if (f
->count
<= f
->repeat
)
1296 /* Deal with a parenthesis node with unlimited format. */
1298 if (f
->repeat
== -2) /* -2 signifies unlimited. */
1301 if (f
->current
== NULL
)
1302 f
->current
= f
->u
.child
;
1304 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1306 r
= next_format0 (f
->current
);
1312 /* Deal with a parenthesis node with specific repeat count. */
1313 for (; f
->count
< f
->repeat
; f
->count
++)
1315 if (f
->current
== NULL
)
1316 f
->current
= f
->u
.child
;
1318 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1320 r
= next_format0 (f
->current
);
1331 /* next_format()-- Return the next format node. If the format list
1332 * ends up being exhausted, we do reversion. Reversion is only
1333 * allowed if we've seen a data descriptor since the
1334 * initialization or the last reversion. We return NULL if there
1335 * are no more data descriptors to return (which is an error
1339 next_format (st_parameter_dt
*dtp
)
1343 format_data
*fmt
= dtp
->u
.p
.fmt
;
1345 if (fmt
->saved_format
!= NULL
)
1346 { /* Deal with a pushed-back format node */
1347 f
= fmt
->saved_format
;
1348 fmt
->saved_format
= NULL
;
1352 f
= next_format0 (&fmt
->array
.array
[0]);
1355 if (!fmt
->reversion_ok
)
1358 fmt
->reversion_ok
= 0;
1361 f
= next_format0 (&fmt
->array
.array
[0]);
1364 format_error (dtp
, NULL
, reversion_error
);
1368 /* Push the first reverted token and return a colon node in case
1369 * there are no more data items. */
1371 fmt
->saved_format
= f
;
1375 /* If this is a data edit descriptor, then reversion has become OK. */
1379 if (!fmt
->reversion_ok
&&
1380 (t
== FMT_I
|| t
== FMT_B
|| t
== FMT_O
|| t
== FMT_Z
|| t
== FMT_F
||
1381 t
== FMT_E
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_G
|| t
== FMT_L
||
1382 t
== FMT_A
|| t
== FMT_D
))
1383 fmt
->reversion_ok
= 1;
1388 /* unget_format()-- Push the given format back so that it will be
1389 * returned on the next call to next_format() without affecting
1390 * counts. This is necessary when we've encountered a data
1391 * descriptor, but don't know what the data item is yet. The format
1392 * node is pushed back, and we return control to the main program,
1393 * which calls the library back with the data item (or not). */
1396 unget_format (st_parameter_dt
*dtp
, const fnode
*f
)
1398 dtp
->u
.p
.fmt
->saved_format
= f
;