2 Copyright (C) 1987-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
22 #include "coretypes.h"
27 /* Associates PTR (which can be a string, etc.) with the file location
28 specified by FILENAME and LINENO. */
35 /* A singly-linked list of filenames. */
36 struct file_name_list
{
37 struct file_name_list
*next
;
41 /* Obstack used for allocating MD strings. */
42 struct obstack string_obstack
;
44 /* A table of ptr_locs, hashed on the PTR field. */
45 static htab_t ptr_locs
;
47 /* An obstack for the above. Plain xmalloc is a bit heavyweight for a
48 small structure like ptr_loc. */
49 static struct obstack ptr_loc_obstack
;
51 /* A hash table of triples (A, B, C), where each of A, B and C is a condition
52 and A is equivalent to "B && C". This is used to keep track of the source
53 of conditions that are made up of separate MD strings (such as the split
54 condition of a define_insn_and_split). */
55 static htab_t joined_conditions
;
57 /* An obstack for allocating joined_conditions entries. */
58 static struct obstack joined_conditions_obstack
;
60 /* The file we are reading. */
63 /* The filename of READ_MD_FILE. */
64 const char *read_md_filename
;
66 /* The current line number in READ_MD_FILE. */
69 /* The name of the toplevel file that indirectly included READ_MD_FILE. */
72 /* The directory part of IN_FNAME. NULL if IN_FNAME is a bare filename. */
73 static char *base_dir
;
75 /* The first directory to search. */
76 static struct file_name_list
*first_dir_md_include
;
78 /* A pointer to the null terminator of the md include chain. */
79 static struct file_name_list
**last_dir_md_include_ptr
= &first_dir_md_include
;
81 /* This callback will be invoked whenever an md include directive is
82 processed. To be used for creation of the dependency file. */
83 void (*include_callback
) (const char *);
85 /* The current maximum length of directory names in the search path
86 for include files. (Altered as we get more of them.) */
87 static size_t max_include_len
;
89 /* A table of md_constant structures, hashed by name. Null if no
90 constant expansion should occur. */
91 static htab_t md_constants
;
93 /* A table of enum_type structures, hashed by name. */
94 static htab_t enum_types
;
96 static void handle_file (directive_handler_t
);
98 /* Given an object that starts with a char * name field, return a hash
102 leading_string_hash (const void *def
)
104 return htab_hash_string (*(const char *const *) def
);
107 /* Given two objects that start with char * name fields, return true if
108 they have the same name. */
111 leading_string_eq_p (const void *def1
, const void *def2
)
113 return strcmp (*(const char *const *) def1
,
114 *(const char *const *) def2
) == 0;
117 /* Return a hash value for the pointer pointed to by DEF. */
120 leading_ptr_hash (const void *def
)
122 return htab_hash_pointer (*(const void *const *) def
);
125 /* Return true if DEF1 and DEF2 are pointers to the same pointer. */
128 leading_ptr_eq_p (const void *def1
, const void *def2
)
130 return *(const void *const *) def1
== *(const void *const *) def2
;
133 /* Associate PTR with the file position given by FILENAME and LINENO. */
136 set_md_ptr_loc (const void *ptr
, const char *filename
, int lineno
)
140 loc
= (struct ptr_loc
*) obstack_alloc (&ptr_loc_obstack
,
141 sizeof (struct ptr_loc
));
143 loc
->filename
= filename
;
144 loc
->lineno
= lineno
;
145 *htab_find_slot (ptr_locs
, loc
, INSERT
) = loc
;
148 /* Return the position associated with pointer PTR. Return null if no
151 static const struct ptr_loc
*
152 get_md_ptr_loc (const void *ptr
)
154 return (const struct ptr_loc
*) htab_find (ptr_locs
, &ptr
);
157 /* Associate NEW_PTR with the same file position as OLD_PTR. */
160 copy_md_ptr_loc (const void *new_ptr
, const void *old_ptr
)
162 const struct ptr_loc
*loc
= get_md_ptr_loc (old_ptr
);
164 set_md_ptr_loc (new_ptr
, loc
->filename
, loc
->lineno
);
167 /* If PTR is associated with a known file position, print a #line
168 directive for it to OUTF. */
171 fprint_md_ptr_loc (FILE *outf
, const void *ptr
)
173 const struct ptr_loc
*loc
= get_md_ptr_loc (ptr
);
175 fprintf (outf
, "#line %d \"%s\"\n", loc
->lineno
, loc
->filename
);
178 /* Special fprint_md_ptr_loc for writing to STDOUT. */
180 print_md_ptr_loc (const void *ptr
)
182 fprint_md_ptr_loc (stdout
, ptr
);
185 /* Return a condition that satisfies both COND1 and COND2. Either string
186 may be null or empty. */
189 join_c_conditions (const char *cond1
, const char *cond2
)
194 if (cond1
== 0 || cond1
[0] == 0)
197 if (cond2
== 0 || cond2
[0] == 0)
200 if (strcmp (cond1
, cond2
) == 0)
203 result
= concat ("(", cond1
, ") && (", cond2
, ")", NULL
);
204 obstack_ptr_grow (&joined_conditions_obstack
, result
);
205 obstack_ptr_grow (&joined_conditions_obstack
, cond1
);
206 obstack_ptr_grow (&joined_conditions_obstack
, cond2
);
207 entry
= XOBFINISH (&joined_conditions_obstack
, const void **);
208 *htab_find_slot (joined_conditions
, entry
, INSERT
) = entry
;
212 /* Print condition COND to OUTF, wrapped in brackets. If COND was created
213 by join_c_conditions, recursively invoke this function for the original
214 conditions and join the result with "&&". Otherwise print a #line
215 directive for COND if its original file position is known. */
218 fprint_c_condition (FILE *outf
, const char *cond
)
220 const char **halves
= (const char **) htab_find (joined_conditions
, &cond
);
224 fprint_c_condition (outf
, halves
[1]);
225 fprintf (outf
, " && ");
226 fprint_c_condition (outf
, halves
[2]);
232 fprint_md_ptr_loc (outf
, cond
);
233 fprintf (outf
, "(%s)", cond
);
237 /* Special fprint_c_condition for writing to STDOUT. */
240 print_c_condition (const char *cond
)
242 fprint_c_condition (stdout
, cond
);
245 /* A vfprintf-like function for reporting an error against line LINENO
246 of the current MD file. */
248 static void ATTRIBUTE_PRINTF(2,0)
249 message_with_line_1 (int lineno
, const char *msg
, va_list ap
)
251 fprintf (stderr
, "%s:%d: ", read_md_filename
, lineno
);
252 vfprintf (stderr
, msg
, ap
);
253 fputc ('\n', stderr
);
256 /* A printf-like function for reporting an error against line LINENO
257 in the current MD file. */
260 message_with_line (int lineno
, const char *msg
, ...)
265 message_with_line_1 (lineno
, msg
, ap
);
269 /* Like message_with_line, but treat the condition as an error. */
272 error_with_line (int lineno
, const char *msg
, ...)
277 message_with_line_1 (lineno
, msg
, ap
);
282 /* A printf-like function for reporting an error against the current
283 position in the MD file. */
286 fatal_with_file_and_line (const char *msg
, ...)
295 fprintf (stderr
, "%s:%d: ", read_md_filename
, read_md_lineno
);
296 vfprintf (stderr
, msg
, ap
);
299 /* Gather some following context. */
300 for (i
= 0; i
< sizeof (context
)-1; ++i
)
305 if (c
== '\r' || c
== '\n')
314 fprintf (stderr
, "%s:%d: following context is `%s'\n",
315 read_md_filename
, read_md_lineno
, context
);
321 /* Report that we found character ACTUAL when we expected to find
322 character EXPECTED. */
325 fatal_expected_char (int expected
, int actual
)
328 fatal_with_file_and_line ("expected character `%c', found EOF",
331 fatal_with_file_and_line ("expected character `%c', found `%c'",
335 /* Read chars from the MD file until a non-whitespace char and return that.
336 Comments, both Lisp style and C style, are treated as whitespace. */
339 read_skip_spaces (void)
348 case ' ': case '\t': case '\f': case '\r': case '\n':
354 while (c
!= '\n' && c
!= EOF
);
364 fatal_with_file_and_line ("stray '/' in file");
368 while ((c
= read_char ()) && c
!= EOF
)
370 if (prevc
== '*' && c
== '/')
383 /* Read an rtx code name into NAME. It is terminated by any of the
384 punctuation chars of rtx printed syntax. */
387 read_name (struct md_name
*name
)
392 c
= read_skip_spaces ();
397 if (c
== ' ' || c
== '\n' || c
== '\t' || c
== '\f' || c
== '\r'
400 if (c
== ':' || c
== ')' || c
== ']' || c
== '"' || c
== '/'
401 || c
== '(' || c
== '[')
407 if (i
== sizeof (name
->buffer
) - 1)
408 fatal_with_file_and_line ("name too long");
409 name
->buffer
[i
++] = c
;
415 fatal_with_file_and_line ("missing name or number");
418 name
->string
= name
->buffer
;
422 /* Do constant expansion. */
423 struct md_constant
*def
;
427 struct md_constant tmp_def
;
429 tmp_def
.name
= name
->string
;
430 def
= (struct md_constant
*) htab_find (md_constants
, &tmp_def
);
432 name
->string
= def
->value
;
438 /* Subroutine of the string readers. Handles backslash escapes.
439 Caller has read the backslash, but not placed it into the obstack. */
444 int c
= read_char ();
448 /* Backslash-newline is replaced by nothing, as in C. */
452 /* \" \' \\ are replaced by the second character. */
458 /* Standard C string escapes:
461 all are passed through to the output string unmolested.
462 In normal use these wind up in a string constant processed
463 by the C compiler, which will translate them appropriately.
464 We do not bother checking that \[0-7] are followed by up to
465 two octal digits, or that \x is followed by N hex digits.
466 \? \u \U are left out because they are not in traditional C. */
467 case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v':
468 case '0': case '1': case '2': case '3': case '4': case '5': case '6':
470 obstack_1grow (&string_obstack
, '\\');
473 /* \; makes stuff for a C string constant containing
476 obstack_grow (&string_obstack
, "\\n\\t", 4);
479 /* pass anything else through, but issue a warning. */
481 fprintf (stderr
, "%s:%d: warning: unrecognized escape \\%c\n",
482 read_md_filename
, read_md_lineno
, c
);
483 obstack_1grow (&string_obstack
, '\\');
487 obstack_1grow (&string_obstack
, c
);
490 /* Read a double-quoted string onto the obstack. Caller has scanned
491 the leading quote. */
494 read_quoted_string (void)
500 c
= read_char (); /* Read the string */
506 else if (c
== '"' || c
== EOF
)
509 obstack_1grow (&string_obstack
, c
);
512 obstack_1grow (&string_obstack
, 0);
513 return XOBFINISH (&string_obstack
, char *);
516 /* Read a braced string (a la Tcl) onto the string obstack. Caller
517 has scanned the leading brace. Note that unlike quoted strings,
518 the outermost braces _are_ included in the string constant. */
521 read_braced_string (void)
524 int brace_depth
= 1; /* caller-processed */
525 unsigned long starting_read_md_lineno
= read_md_lineno
;
527 obstack_1grow (&string_obstack
, '{');
530 c
= read_char (); /* Read the string */
542 fatal_with_file_and_line
543 ("missing closing } for opening brace on line %lu",
544 starting_read_md_lineno
);
546 obstack_1grow (&string_obstack
, c
);
549 obstack_1grow (&string_obstack
, 0);
550 return XOBFINISH (&string_obstack
, char *);
553 /* Read some kind of string constant. This is the high-level routine
554 used by read_rtx. It handles surrounding parentheses, leading star,
555 and dispatch to the appropriate string constant reader. */
558 read_string (int star_if_braced
)
564 c
= read_skip_spaces ();
568 c
= read_skip_spaces ();
571 old_lineno
= read_md_lineno
;
573 stringbuf
= read_quoted_string ();
577 obstack_1grow (&string_obstack
, '*');
578 stringbuf
= read_braced_string ();
581 fatal_with_file_and_line ("expected `\"' or `{', found `%c'", c
);
585 c
= read_skip_spaces ();
587 fatal_expected_char (')', c
);
590 set_md_ptr_loc (stringbuf
, read_md_filename
, old_lineno
);
594 /* Skip the rest of a construct that started at line LINENO and that
595 is currently nested by DEPTH levels of parentheses. */
598 read_skip_construct (int depth
, int lineno
)
605 c
= read_skip_spaces ();
608 error_with_line (lineno
, "unterminated construct");
643 /* Given a string, return the number of comma-separated elements in it.
644 Return 0 for the null string. */
647 n_comma_elts (const char *s
)
661 /* Given a pointer to a (char *), return a pointer to the beginning of the
662 next comma-separated element in the string. Advance the pointer given
663 to the end of that element. Return NULL if at end of string. Caller
664 is responsible for copying the string if necessary. White space between
665 a comma and an element is ignored. */
668 scan_comma_elt (const char **pstr
)
671 const char *p
= *pstr
;
683 while (*p
!= ',' && *p
!= '\0')
690 /* Convert STRING to uppercase. */
693 upcase_string (char *string
)
697 for (i
= 0; string
[i
]; i
++)
698 string
[i
] = TOUPPER (string
[i
]);
701 /* Add a NAME = VALUE definition to md_constants-style hash table DEFS,
702 where both NAME and VALUE are malloc()ed strings. PARENT_ENUM is the
703 enum to which NAME belongs, or null if NAME is a stand-alone constant. */
705 static struct md_constant
*
706 add_constant (htab_t defs
, char *name
, char *value
,
707 struct enum_type
*parent_enum
)
709 struct md_constant
*def
, tmp_def
;
713 entry_ptr
= htab_find_slot (defs
, &tmp_def
, INSERT
);
716 def
= (struct md_constant
*) *entry_ptr
;
717 if (strcmp (def
->value
, value
) != 0)
718 fatal_with_file_and_line ("redefinition of `%s', was `%s', now `%s'",
719 def
->name
, def
->value
, value
);
720 else if (parent_enum
|| def
->parent_enum
)
721 fatal_with_file_and_line ("redefinition of `%s'", def
->name
);
727 def
= XNEW (struct md_constant
);
730 def
->parent_enum
= parent_enum
;
736 /* Process a define_constants directive, starting with the optional space
737 after the "define_constants". */
740 handle_constants (void)
745 c
= read_skip_spaces ();
747 fatal_expected_char ('[', c
);
749 /* Disable constant expansion during definition processing. */
752 while ( (c
= read_skip_spaces ()) != ']')
754 struct md_name name
, value
;
757 fatal_expected_char ('(', c
);
761 add_constant (defs
, xstrdup (name
.string
), xstrdup (value
.string
), 0);
763 c
= read_skip_spaces ();
765 fatal_expected_char (')', c
);
770 /* For every constant definition, call CALLBACK with two arguments:
771 a pointer a pointer to the constant definition and INFO.
772 Stop when CALLBACK returns zero. */
775 traverse_md_constants (htab_trav callback
, void *info
)
777 htab_traverse (md_constants
, callback
, info
);
780 /* Return a malloc()ed decimal string that represents number NUMBER. */
783 decimal_string (int number
)
785 /* A safe overestimate. +1 for sign, +1 for null terminator. */
786 char buffer
[sizeof (int) * CHAR_BIT
+ 1 + 1];
788 sprintf (buffer
, "%d", number
);
789 return xstrdup (buffer
);
792 /* Process a define_enum or define_c_enum directive, starting with
793 the optional space after the "define_enum". LINENO is the line
794 number on which the directive started and MD_P is true if the
795 directive is a define_enum rather than a define_c_enum. */
798 handle_enum (int lineno
, bool md_p
)
800 char *enum_name
, *value_name
;
802 struct enum_type
*def
;
803 struct enum_value
*ev
;
807 enum_name
= read_string (false);
808 slot
= htab_find_slot (enum_types
, &enum_name
, INSERT
);
811 def
= (struct enum_type
*) *slot
;
812 if (def
->md_p
!= md_p
)
813 error_with_line (lineno
, "redefining `%s' as a different type of enum",
818 def
= XNEW (struct enum_type
);
819 def
->name
= enum_name
;
822 def
->tail_ptr
= &def
->values
;
827 c
= read_skip_spaces ();
829 fatal_expected_char ('[', c
);
831 while ((c
= read_skip_spaces ()) != ']')
835 error_with_line (lineno
, "unterminated construct");
841 ev
= XNEW (struct enum_value
);
845 value_name
= concat (def
->name
, "_", name
.string
, NULL
);
846 upcase_string (value_name
);
847 ev
->name
= xstrdup (name
.string
);
851 value_name
= xstrdup (name
.string
);
852 ev
->name
= value_name
;
854 ev
->def
= add_constant (md_constants
, value_name
,
855 decimal_string (def
->num_values
), def
);
858 def
->tail_ptr
= &ev
->next
;
863 /* Try to find the definition of the given enum. Return null on failure. */
866 lookup_enum_type (const char *name
)
868 return (struct enum_type
*) htab_find (enum_types
, &name
);
871 /* For every enum definition, call CALLBACK with two arguments:
872 a pointer to the constant definition and INFO. Stop when CALLBACK
876 traverse_enum_types (htab_trav callback
, void *info
)
878 htab_traverse (enum_types
, callback
, info
);
881 /* Process an "include" directive, starting with the optional space
882 after the "include". Read in the file and use HANDLE_DIRECTIVE
883 to process each unknown directive. LINENO is the line number on
884 which the "include" occurred. */
887 handle_include (int lineno
, directive_handler_t handle_directive
)
889 const char *filename
;
890 const char *old_filename
;
893 FILE *input_file
, *old_file
;
895 filename
= read_string (false);
898 /* If the specified file name is absolute, skip the include stack. */
899 if (!IS_ABSOLUTE_PATH (filename
))
901 struct file_name_list
*stackp
;
903 /* Search the directory path, trying to open the file. */
904 for (stackp
= first_dir_md_include
; stackp
; stackp
= stackp
->next
)
906 static const char sep
[2] = { DIR_SEPARATOR
, '\0' };
908 pathname
= concat (stackp
->fname
, sep
, filename
, NULL
);
909 input_file
= fopen (pathname
, "r");
910 if (input_file
!= NULL
)
916 /* If we haven't managed to open the file yet, try combining the
917 filename with BASE_DIR. */
918 if (input_file
== NULL
)
921 pathname
= concat (base_dir
, filename
, NULL
);
923 pathname
= xstrdup (filename
);
924 input_file
= fopen (pathname
, "r");
927 if (input_file
== NULL
)
930 error_with_line (lineno
, "include file `%s' not found", filename
);
934 /* Save the old cursor. Note that the LINENO argument to this
935 function is the beginning of the include statement, while
936 read_md_lineno has already been advanced. */
937 old_file
= read_md_file
;
938 old_filename
= read_md_filename
;
939 old_lineno
= read_md_lineno
;
941 if (include_callback
)
942 include_callback (pathname
);
944 read_md_file
= input_file
;
945 read_md_filename
= pathname
;
946 handle_file (handle_directive
);
948 /* Restore the old cursor. */
949 read_md_file
= old_file
;
950 read_md_filename
= old_filename
;
951 read_md_lineno
= old_lineno
;
953 /* Do not free the pathname. It is attached to the various rtx
957 /* Process the current file, assuming that read_md_file and
958 read_md_filename are valid. Use HANDLE_DIRECTIVE to handle
959 unknown directives. */
962 handle_file (directive_handler_t handle_directive
)
964 struct md_name directive
;
968 while ((c
= read_skip_spaces ()) != EOF
)
970 lineno
= read_md_lineno
;
972 fatal_expected_char ('(', c
);
974 read_name (&directive
);
975 if (strcmp (directive
.string
, "define_constants") == 0)
977 else if (strcmp (directive
.string
, "define_enum") == 0)
978 handle_enum (lineno
, true);
979 else if (strcmp (directive
.string
, "define_c_enum") == 0)
980 handle_enum (lineno
, false);
981 else if (strcmp (directive
.string
, "include") == 0)
982 handle_include (lineno
, handle_directive
);
983 else if (handle_directive
)
984 handle_directive (lineno
, directive
.string
);
986 read_skip_construct (1, lineno
);
988 c
= read_skip_spaces ();
990 fatal_expected_char (')', c
);
992 fclose (read_md_file
);
995 /* Like handle_file, but for top-level files. Set up in_fname and
996 base_dir accordingly. */
999 handle_toplevel_file (directive_handler_t handle_directive
)
1003 in_fname
= read_md_filename
;
1004 base
= lbasename (in_fname
);
1005 if (base
== in_fname
)
1008 base_dir
= xstrndup (in_fname
, base
- in_fname
);
1010 handle_file (handle_directive
);
1013 /* Parse a -I option with argument ARG. */
1016 parse_include (const char *arg
)
1018 struct file_name_list
*dirtmp
;
1020 dirtmp
= XNEW (struct file_name_list
);
1022 dirtmp
->fname
= arg
;
1023 *last_dir_md_include_ptr
= dirtmp
;
1024 last_dir_md_include_ptr
= &dirtmp
->next
;
1025 if (strlen (dirtmp
->fname
) > max_include_len
)
1026 max_include_len
= strlen (dirtmp
->fname
);
1029 /* The main routine for reading .md files. Try to process all the .md
1030 files specified on the command line and return true if no error occurred.
1032 ARGC and ARGV are the arguments to main.
1034 PARSE_OPT, if nonnull, is passed all unknown command-line arguments.
1035 It should return true if it recognizes the argument or false if a
1036 generic error should be reported.
1038 If HANDLE_DIRECTIVE is nonnull, the parser calls it for each
1039 unknown directive, otherwise it just skips such directives.
1040 See the comment above the directive_handler_t definition for
1041 details about the callback's interface. */
1044 read_md_files (int argc
, char **argv
, bool (*parse_opt
) (const char *),
1045 directive_handler_t handle_directive
)
1048 bool no_more_options
;
1049 bool already_read_stdin
;
1052 /* Initialize global data. */
1053 obstack_init (&string_obstack
);
1054 ptr_locs
= htab_create (161, leading_ptr_hash
, leading_ptr_eq_p
, 0);
1055 obstack_init (&ptr_loc_obstack
);
1056 joined_conditions
= htab_create (161, leading_ptr_hash
, leading_ptr_eq_p
, 0);
1057 obstack_init (&joined_conditions_obstack
);
1058 md_constants
= htab_create (31, leading_string_hash
,
1059 leading_string_eq_p
, (htab_del
) 0);
1060 enum_types
= htab_create (31, leading_string_hash
,
1061 leading_string_eq_p
, (htab_del
) 0);
1063 /* Unlock the stdio streams. */
1064 unlock_std_streams ();
1066 /* First we loop over all the options. */
1067 for (i
= 1; i
< argc
; i
++)
1068 if (argv
[i
][0] == '-')
1070 /* An argument consisting of exactly one dash is a request to
1071 read stdin. This will be handled in the second loop. */
1072 if (argv
[i
][1] == '\0')
1075 /* An argument consisting of just two dashes causes option
1076 parsing to cease. */
1077 if (argv
[i
][1] == '-' && argv
[i
][2] == '\0')
1080 if (argv
[i
][1] == 'I')
1082 if (argv
[i
][2] != '\0')
1083 parse_include (argv
[i
] + 2);
1084 else if (++i
< argc
)
1085 parse_include (argv
[i
]);
1087 fatal ("directory name missing after -I option");
1091 /* The program may have provided a callback so it can
1092 accept its own options. */
1093 if (parse_opt
&& parse_opt (argv
[i
]))
1096 fatal ("invalid option `%s'", argv
[i
]);
1099 /* Now loop over all input files. */
1101 no_more_options
= false;
1102 already_read_stdin
= false;
1103 for (i
= 1; i
< argc
; i
++)
1105 if (argv
[i
][0] == '-')
1107 if (argv
[i
][1] == '\0')
1110 if (already_read_stdin
)
1111 fatal ("cannot read standard input twice");
1113 read_md_file
= stdin
;
1114 read_md_filename
= "<stdin>";
1115 handle_toplevel_file (handle_directive
);
1116 already_read_stdin
= true;
1119 else if (argv
[i
][1] == '-' && argv
[i
][2] == '\0')
1121 /* No further arguments are to be treated as options. */
1122 no_more_options
= true;
1125 else if (!no_more_options
)
1129 /* If we get here we are looking at a non-option argument, i.e.
1130 a file to be processed. */
1131 read_md_filename
= argv
[i
];
1132 read_md_file
= fopen (read_md_filename
, "r");
1133 if (read_md_file
== 0)
1135 perror (read_md_filename
);
1138 handle_toplevel_file (handle_directive
);
1142 /* If we get to this point without having seen any files to process,
1143 read the standard input now. */
1144 if (num_files
== 0 && !already_read_stdin
)
1146 read_md_file
= stdin
;
1147 read_md_filename
= "<stdin>";
1148 handle_toplevel_file (handle_directive
);