1 /* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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 */
38 #define FARRAY_SIZE 64
40 typedef struct fnode_array
42 struct fnode_array
*next
;
43 fnode array
[FARRAY_SIZE
];
47 typedef struct format_data
49 char *format_string
, *string
;
52 format_token saved_token
;
53 int value
, format_string_len
, reversion_ok
;
55 const fnode
*saved_format
;
61 static const fnode colon_node
= { FMT_COLON
, 0, NULL
, NULL
, {{ 0, 0, 0 }}, 0,
66 static const char posint_required
[] = "Positive width required in format",
67 period_required
[] = "Period required in format",
68 nonneg_required
[] = "Nonnegative width required in format",
69 unexpected_element
[] = "Unexpected element '%c' in format\n",
70 unexpected_end
[] = "Unexpected end of format string",
71 bad_string
[] = "Unterminated character constant in format",
72 bad_hollerith
[] = "Hollerith constant extends past the end of the format",
73 reversion_error
[] = "Exhausted data descriptors in format",
74 zero_width
[] = "Zero width in format descriptor";
76 /* The following routines support caching format data from parsed format strings
77 into a hash table. This avoids repeatedly parsing duplicate format strings
78 or format strings in I/O statements that are repeated in loops. */
81 /* Traverse the table and free all data. */
84 free_format_hash_table (gfc_unit
*u
)
88 /* free_format_data handles any NULL pointers. */
89 for (i
= 0; i
< FORMAT_HASH_SIZE
; i
++)
91 if (u
->format_hash_table
[i
].hashed_fmt
!= NULL
)
93 free_format_data (u
->format_hash_table
[i
].hashed_fmt
);
94 free (u
->format_hash_table
[i
].key
);
96 u
->format_hash_table
[i
].key
= NULL
;
97 u
->format_hash_table
[i
].key_len
= 0;
98 u
->format_hash_table
[i
].hashed_fmt
= NULL
;
102 /* Traverse the format_data structure and reset the fnode counters. */
105 reset_node (fnode
*fn
)
112 if (fn
->format
!= FMT_LPAREN
)
115 for (f
= fn
->u
.child
; f
; f
= f
->next
)
117 if (f
->format
== FMT_RPAREN
)
124 reset_fnode_counters (st_parameter_dt
*dtp
)
131 /* Clear this pointer at the head so things start at the right place. */
132 fmt
->array
.array
[0].current
= NULL
;
134 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
139 /* A simple hashing function to generate an index into the hash table. */
142 uint32_t format_hash (st_parameter_dt
*dtp
)
145 gfc_charlen_type key_len
;
149 /* Hash the format string. Super simple, but what the heck! */
151 key_len
= dtp
->format_len
;
152 for (i
= 0; i
< key_len
; i
++)
154 hash
&= (FORMAT_HASH_SIZE
- 1);
160 save_parsed_format (st_parameter_dt
*dtp
)
165 hash
= format_hash (dtp
);
166 u
= dtp
->u
.p
.current_unit
;
168 /* Index into the hash table. We are simply replacing whatever is there
169 relying on probability. */
170 if (u
->format_hash_table
[hash
].hashed_fmt
!= NULL
)
171 free_format_data (u
->format_hash_table
[hash
].hashed_fmt
);
172 u
->format_hash_table
[hash
].hashed_fmt
= NULL
;
174 if (u
->format_hash_table
[hash
].key
!= NULL
)
175 free (u
->format_hash_table
[hash
].key
);
176 u
->format_hash_table
[hash
].key
= get_mem (dtp
->format_len
);
177 memcpy (u
->format_hash_table
[hash
].key
, dtp
->format
, dtp
->format_len
);
179 u
->format_hash_table
[hash
].key_len
= dtp
->format_len
;
180 u
->format_hash_table
[hash
].hashed_fmt
= dtp
->u
.p
.fmt
;
185 find_parsed_format (st_parameter_dt
*dtp
)
190 hash
= format_hash (dtp
);
191 u
= dtp
->u
.p
.current_unit
;
193 if (u
->format_hash_table
[hash
].key
!= NULL
)
195 /* See if it matches. */
196 if (u
->format_hash_table
[hash
].key_len
== dtp
->format_len
)
198 /* So far so good. */
199 if (strncmp (u
->format_hash_table
[hash
].key
,
200 dtp
->format
, dtp
->format_len
) == 0)
201 return u
->format_hash_table
[hash
].hashed_fmt
;
208 /* next_char()-- Return the next character in the format string.
209 * Returns -1 when the string is done. If the literal flag is set,
210 * spaces are significant, otherwise they are not. */
213 next_char (format_data
*fmt
, int literal
)
219 if (fmt
->format_string_len
== 0)
222 fmt
->format_string_len
--;
223 c
= toupper (*fmt
->format_string
++);
224 fmt
->error_element
= c
;
226 while ((c
== ' ' || c
== '\t') && !literal
);
232 /* unget_char()-- Back up one character position. */
234 #define unget_char(fmt) \
235 { fmt->format_string--; fmt->format_string_len++; }
238 /* get_fnode()-- Allocate a new format node, inserting it into the
239 * current singly linked list. These are initially allocated from the
243 get_fnode (format_data
*fmt
, fnode
**head
, fnode
**tail
, format_token t
)
247 if (fmt
->avail
== &fmt
->last
->array
[FARRAY_SIZE
])
249 fmt
->last
->next
= get_mem (sizeof (fnode_array
));
250 fmt
->last
= fmt
->last
->next
;
251 fmt
->last
->next
= NULL
;
252 fmt
->avail
= &fmt
->last
->array
[0];
255 memset (f
, '\0', sizeof (fnode
));
267 f
->source
= fmt
->format_string
;
272 /* free_format_data()-- Free all allocated format data. */
275 free_format_data (format_data
*fmt
)
277 fnode_array
*fa
, *fa_next
;
283 for (fa
= fmt
->array
.next
; fa
; fa
= fa_next
)
294 /* format_lex()-- Simple lexical analyzer for getting the next token
295 * in a FORMAT string. We support a one-level token pushback in the
296 * fmt->saved_token variable. */
299 format_lex (format_data
*fmt
)
306 if (fmt
->saved_token
!= FMT_NONE
)
308 token
= fmt
->saved_token
;
309 fmt
->saved_token
= FMT_NONE
;
314 c
= next_char (fmt
, 0);
335 c
= next_char (fmt
, 0);
342 fmt
->value
= c
- '0';
346 c
= next_char (fmt
, 0);
350 fmt
->value
= 10 * fmt
->value
+ c
- '0';
356 fmt
->value
= -fmt
->value
;
357 token
= FMT_SIGNED_INT
;
370 fmt
->value
= c
- '0';
374 c
= next_char (fmt
, 0);
378 fmt
->value
= 10 * fmt
->value
+ c
- '0';
382 token
= (fmt
->value
== 0) ? FMT_ZERO
: FMT_POSINT
;
406 switch (next_char (fmt
, 0))
427 switch (next_char (fmt
, 0))
444 switch (next_char (fmt
, 0))
464 fmt
->string
= fmt
->format_string
;
465 fmt
->value
= 0; /* This is the length of the string */
469 c
= next_char (fmt
, 1);
472 token
= FMT_BADSTRING
;
473 fmt
->error
= bad_string
;
479 c
= next_char (fmt
, 1);
483 token
= FMT_BADSTRING
;
484 fmt
->error
= bad_string
;
522 switch (next_char (fmt
, 0))
554 switch (next_char (fmt
, 0))
570 switch (next_char (fmt
, 0))
610 /* parse_format_list()-- Parse a format list. Assumes that a left
611 * paren has already been seen. Returns a list representing the
612 * parenthesis node which contains the rest of the list. */
615 parse_format_list (st_parameter_dt
*dtp
, bool *save_ok
)
618 format_token t
, u
, t2
;
620 format_data
*fmt
= dtp
->u
.p
.fmt
;
626 /* Get the next format item */
628 t
= format_lex (fmt
);
633 t
= format_lex (fmt
);
636 fmt
->error
= "Left parenthesis required after '*'";
639 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
640 tail
->repeat
= -2; /* Signifies unlimited format. */
641 tail
->u
.child
= parse_format_list (dtp
, &saveit
);
642 if (fmt
->error
!= NULL
)
650 t
= format_lex (fmt
);
654 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
655 tail
->repeat
= repeat
;
656 tail
->u
.child
= parse_format_list (dtp
, &saveit
);
657 if (fmt
->error
!= NULL
)
663 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
664 tail
->repeat
= repeat
;
668 get_fnode (fmt
, &head
, &tail
, FMT_X
);
670 tail
->u
.k
= fmt
->value
;
681 get_fnode (fmt
, &head
, &tail
, FMT_LPAREN
);
683 tail
->u
.child
= parse_format_list (dtp
, &saveit
);
684 if (fmt
->error
!= NULL
)
689 case FMT_SIGNED_INT
: /* Signed integer can only precede a P format. */
690 case FMT_ZERO
: /* Same for zero. */
691 t
= format_lex (fmt
);
694 fmt
->error
= "Expected P edit descriptor in format";
699 get_fnode (fmt
, &head
, &tail
, FMT_P
);
700 tail
->u
.k
= fmt
->value
;
703 t
= format_lex (fmt
);
704 if (t
== FMT_F
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_D
705 || t
== FMT_G
|| t
== FMT_E
)
711 if (t
!= FMT_COMMA
&& t
!= FMT_RPAREN
&& t
!= FMT_SLASH
714 fmt
->error
= "Comma required after P descriptor";
718 fmt
->saved_token
= t
;
721 case FMT_P
: /* P and X require a prior number */
722 fmt
->error
= "P descriptor requires leading scale factor";
729 If we would be pedantic in the library, we would have to reject
730 an X descriptor without an integer prefix:
732 fmt->error = "X descriptor requires leading space count";
735 However, this is an extension supported by many Fortran compilers,
736 including Cray, HP, AIX, and IRIX. Therefore, we allow it in the
737 runtime library, and make the front end reject it if the compiler
738 is in pedantic mode. The interpretation of 'X' is '1X'.
740 get_fnode (fmt
, &head
, &tail
, FMT_X
);
746 /* TODO: Find out why it is necessary to turn off format caching. */
748 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
749 tail
->u
.string
.p
= fmt
->string
;
750 tail
->u
.string
.length
= fmt
->value
;
760 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: Round "
761 "descriptor not allowed");
762 get_fnode (fmt
, &head
, &tail
, t
);
768 notify_std (&dtp
->common
, GFC_STD_F2003
, "Fortran 2003: DC or DP "
769 "descriptor not allowed");
776 get_fnode (fmt
, &head
, &tail
, t
);
781 get_fnode (fmt
, &head
, &tail
, FMT_COLON
);
786 get_fnode (fmt
, &head
, &tail
, FMT_SLASH
);
792 get_fnode (fmt
, &head
, &tail
, FMT_DOLLAR
);
794 notify_std (&dtp
->common
, GFC_STD_GNU
, "Extension: $ descriptor");
800 t2
= format_lex (fmt
);
801 if (t2
!= FMT_POSINT
)
803 fmt
->error
= posint_required
;
806 get_fnode (fmt
, &head
, &tail
, t
);
807 tail
->u
.n
= fmt
->value
;
827 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
828 if (fmt
->format_string_len
< 1)
830 fmt
->error
= bad_hollerith
;
834 tail
->u
.string
.p
= fmt
->format_string
;
835 tail
->u
.string
.length
= 1;
838 fmt
->format_string
++;
839 fmt
->format_string_len
--;
844 fmt
->error
= unexpected_end
;
854 fmt
->error
= unexpected_element
;
858 /* In this state, t must currently be a data descriptor. Deal with
859 things that can/must follow the descriptor */
864 t
= format_lex (fmt
);
867 if (notification_std(GFC_STD_GNU
) == NOTIFICATION_ERROR
)
869 fmt
->error
= posint_required
;
874 fmt
->saved_token
= t
;
875 fmt
->value
= 1; /* Default width */
876 notify_std (&dtp
->common
, GFC_STD_GNU
, posint_required
);
880 get_fnode (fmt
, &head
, &tail
, FMT_L
);
881 tail
->u
.n
= fmt
->value
;
882 tail
->repeat
= repeat
;
886 t
= format_lex (fmt
);
889 fmt
->error
= zero_width
;
895 fmt
->saved_token
= t
;
896 fmt
->value
= -1; /* Width not present */
899 get_fnode (fmt
, &head
, &tail
, FMT_A
);
900 tail
->repeat
= repeat
;
901 tail
->u
.n
= fmt
->value
;
910 get_fnode (fmt
, &head
, &tail
, t
);
911 tail
->repeat
= repeat
;
913 u
= format_lex (fmt
);
914 if (t
== FMT_G
&& u
== FMT_ZERO
)
916 if (notification_std (GFC_STD_F2008
) == NOTIFICATION_ERROR
917 || dtp
->u
.p
.mode
== READING
)
919 fmt
->error
= zero_width
;
923 u
= format_lex (fmt
);
926 fmt
->saved_token
= u
;
930 u
= format_lex (fmt
);
933 fmt
->error
= posint_required
;
936 tail
->u
.real
.d
= fmt
->value
;
939 if (t
== FMT_F
&& dtp
->u
.p
.mode
== WRITING
)
941 if (u
!= FMT_POSINT
&& u
!= FMT_ZERO
)
943 fmt
->error
= nonneg_required
;
947 else if (u
!= FMT_POSINT
)
949 fmt
->error
= posint_required
;
953 tail
->u
.real
.w
= fmt
->value
;
955 t
= format_lex (fmt
);
958 /* We treat a missing decimal descriptor as 0. Note: This is only
959 allowed if -std=legacy, otherwise an error occurs. */
960 if (compile_options
.warn_std
!= 0)
962 fmt
->error
= period_required
;
965 fmt
->saved_token
= t
;
971 t
= format_lex (fmt
);
972 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
974 fmt
->error
= nonneg_required
;
978 tail
->u
.real
.d
= fmt
->value
;
981 if (t2
== FMT_D
|| t2
== FMT_F
)
985 /* Look for optional exponent */
986 t
= format_lex (fmt
);
988 fmt
->saved_token
= t
;
991 t
= format_lex (fmt
);
994 fmt
->error
= "Positive exponent width required in format";
998 tail
->u
.real
.e
= fmt
->value
;
1004 if (repeat
> fmt
->format_string_len
)
1006 fmt
->error
= bad_hollerith
;
1010 get_fnode (fmt
, &head
, &tail
, FMT_STRING
);
1011 tail
->u
.string
.p
= fmt
->format_string
;
1012 tail
->u
.string
.length
= repeat
;
1015 fmt
->format_string
+= fmt
->value
;
1016 fmt
->format_string_len
-= repeat
;
1024 get_fnode (fmt
, &head
, &tail
, t
);
1025 tail
->repeat
= repeat
;
1027 t
= format_lex (fmt
);
1029 if (dtp
->u
.p
.mode
== READING
)
1031 if (t
!= FMT_POSINT
)
1033 fmt
->error
= posint_required
;
1039 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1041 fmt
->error
= nonneg_required
;
1046 tail
->u
.integer
.w
= fmt
->value
;
1047 tail
->u
.integer
.m
= -1;
1049 t
= format_lex (fmt
);
1050 if (t
!= FMT_PERIOD
)
1052 fmt
->saved_token
= t
;
1056 t
= format_lex (fmt
);
1057 if (t
!= FMT_ZERO
&& t
!= FMT_POSINT
)
1059 fmt
->error
= nonneg_required
;
1063 tail
->u
.integer
.m
= fmt
->value
;
1066 if (tail
->u
.integer
.w
!= 0 && tail
->u
.integer
.m
> tail
->u
.integer
.w
)
1068 fmt
->error
= "Minimum digits exceeds field width";
1075 fmt
->error
= unexpected_element
;
1079 /* Between a descriptor and what comes next */
1081 t
= format_lex (fmt
);
1092 get_fnode (fmt
, &head
, &tail
, t
);
1094 goto optional_comma
;
1097 fmt
->error
= unexpected_end
;
1101 /* Assume a missing comma, this is a GNU extension */
1105 /* Optional comma is a weird between state where we've just finished
1106 reading a colon, slash or P descriptor. */
1108 t
= format_lex (fmt
);
1117 default: /* Assume that we have another format item */
1118 fmt
->saved_token
= t
;
1132 /* format_error()-- Generate an error message for a format statement.
1133 * If the node that gives the location of the error is NULL, the error
1134 * is assumed to happen at parse time, and the current location of the
1137 * We generate a message showing where the problem is. We take extra
1138 * care to print only the relevant part of the format if it is longer
1139 * than a standard 80 column display. */
1142 format_error (st_parameter_dt
*dtp
, const fnode
*f
, const char *message
)
1144 int width
, i
, j
, offset
;
1145 char *p
, buffer
[300];
1146 format_data
*fmt
= dtp
->u
.p
.fmt
;
1149 fmt
->format_string
= f
->source
;
1151 if (message
== unexpected_element
)
1152 sprintf (buffer
, message
, fmt
->error_element
);
1154 sprintf (buffer
, "%s\n", message
);
1156 j
= fmt
->format_string
- dtp
->format
;
1158 offset
= (j
> 60) ? j
- 40 : 0;
1161 width
= dtp
->format_len
- offset
;
1166 /* Show the format */
1168 p
= strchr (buffer
, '\0');
1170 memcpy (p
, dtp
->format
+ offset
, width
);
1175 /* Show where the problem is */
1177 for (i
= 1; i
< j
; i
++)
1183 generate_error (&dtp
->common
, LIBERROR_FORMAT
, buffer
);
1187 /* revert()-- Do reversion of the format. Control reverts to the left
1188 * parenthesis that matches the rightmost right parenthesis. From our
1189 * tree structure, we are looking for the rightmost parenthesis node
1190 * at the second level, the first level always being a single
1191 * parenthesis node. If this node doesn't exit, we use the top
1195 revert (st_parameter_dt
*dtp
)
1198 format_data
*fmt
= dtp
->u
.p
.fmt
;
1200 dtp
->u
.p
.reversion_flag
= 1;
1204 for (f
= fmt
->array
.array
[0].u
.child
; f
; f
= f
->next
)
1205 if (f
->format
== FMT_LPAREN
)
1208 /* If r is NULL because no node was found, the whole tree will be used */
1210 fmt
->array
.array
[0].current
= r
;
1211 fmt
->array
.array
[0].count
= 0;
1214 /* parse_format()-- Parse a format string. */
1217 parse_format (st_parameter_dt
*dtp
)
1220 bool format_cache_ok
;
1222 /* Don't cache for internal units and set an arbitrary limit on the size of
1223 format strings we will cache. (Avoids memory issues.) */
1224 format_cache_ok
= !is_internal_unit (dtp
);
1226 /* Lookup format string to see if it has already been parsed. */
1227 if (format_cache_ok
)
1229 dtp
->u
.p
.fmt
= find_parsed_format (dtp
);
1231 if (dtp
->u
.p
.fmt
!= NULL
)
1233 dtp
->u
.p
.fmt
->reversion_ok
= 0;
1234 dtp
->u
.p
.fmt
->saved_token
= FMT_NONE
;
1235 dtp
->u
.p
.fmt
->saved_format
= NULL
;
1236 reset_fnode_counters (dtp
);
1241 /* Not found so proceed as follows. */
1243 dtp
->u
.p
.fmt
= fmt
= get_mem (sizeof (format_data
));
1244 fmt
->format_string
= dtp
->format
;
1245 fmt
->format_string_len
= dtp
->format_len
;
1248 fmt
->saved_token
= FMT_NONE
;
1252 /* Initialize variables used during traversal of the tree. */
1254 fmt
->reversion_ok
= 0;
1255 fmt
->saved_format
= NULL
;
1257 /* Allocate the first format node as the root of the tree. */
1259 fmt
->last
= &fmt
->array
;
1260 fmt
->last
->next
= NULL
;
1261 fmt
->avail
= &fmt
->array
.array
[0];
1263 memset (fmt
->avail
, 0, sizeof (*fmt
->avail
));
1264 fmt
->avail
->format
= FMT_LPAREN
;
1265 fmt
->avail
->repeat
= 1;
1268 if (format_lex (fmt
) == FMT_LPAREN
)
1269 fmt
->array
.array
[0].u
.child
= parse_format_list (dtp
, &format_cache_ok
);
1271 fmt
->error
= "Missing initial left parenthesis in format";
1275 format_error (dtp
, NULL
, fmt
->error
);
1276 free_format_hash_table (dtp
->u
.p
.current_unit
);
1280 if (format_cache_ok
)
1281 save_parsed_format (dtp
);
1283 dtp
->u
.p
.format_not_saved
= 1;
1287 /* next_format0()-- Get the next format node without worrying about
1288 * reversion. Returns NULL when we hit the end of the list.
1289 * Parenthesis nodes are incremented after the list has been
1290 * exhausted, other nodes are incremented before they are returned. */
1292 static const fnode
*
1293 next_format0 (fnode
* f
)
1300 if (f
->format
!= FMT_LPAREN
)
1303 if (f
->count
<= f
->repeat
)
1310 /* Deal with a parenthesis node with unlimited format. */
1312 if (f
->repeat
== -2) /* -2 signifies unlimited. */
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
);
1326 /* Deal with a parenthesis node with specific repeat count. */
1327 for (; f
->count
< f
->repeat
; f
->count
++)
1329 if (f
->current
== NULL
)
1330 f
->current
= f
->u
.child
;
1332 for (; f
->current
!= NULL
; f
->current
= f
->current
->next
)
1334 r
= next_format0 (f
->current
);
1345 /* next_format()-- Return the next format node. If the format list
1346 * ends up being exhausted, we do reversion. Reversion is only
1347 * allowed if we've seen a data descriptor since the
1348 * initialization or the last reversion. We return NULL if there
1349 * are no more data descriptors to return (which is an error
1353 next_format (st_parameter_dt
*dtp
)
1357 format_data
*fmt
= dtp
->u
.p
.fmt
;
1359 if (fmt
->saved_format
!= NULL
)
1360 { /* Deal with a pushed-back format node */
1361 f
= fmt
->saved_format
;
1362 fmt
->saved_format
= NULL
;
1366 f
= next_format0 (&fmt
->array
.array
[0]);
1369 if (!fmt
->reversion_ok
)
1372 fmt
->reversion_ok
= 0;
1375 f
= next_format0 (&fmt
->array
.array
[0]);
1378 format_error (dtp
, NULL
, reversion_error
);
1382 /* Push the first reverted token and return a colon node in case
1383 * there are no more data items. */
1385 fmt
->saved_format
= f
;
1389 /* If this is a data edit descriptor, then reversion has become OK. */
1393 if (!fmt
->reversion_ok
&&
1394 (t
== FMT_I
|| t
== FMT_B
|| t
== FMT_O
|| t
== FMT_Z
|| t
== FMT_F
||
1395 t
== FMT_E
|| t
== FMT_EN
|| t
== FMT_ES
|| t
== FMT_G
|| t
== FMT_L
||
1396 t
== FMT_A
|| t
== FMT_D
))
1397 fmt
->reversion_ok
= 1;
1402 /* unget_format()-- Push the given format back so that it will be
1403 * returned on the next call to next_format() without affecting
1404 * counts. This is necessary when we've encountered a data
1405 * descriptor, but don't know what the data item is yet. The format
1406 * node is pushed back, and we return control to the main program,
1407 * which calls the library back with the data item (or not). */
1410 unget_format (st_parameter_dt
*dtp
, const fnode
*f
)
1412 dtp
->u
.p
.fmt
->saved_format
= f
;