1/* GNU Fortran
2   Copyright (C) 1995 Free Software Foundation, Inc.
3   Contributed by James Craig Burley.
4
5This file is part of GNU Fortran.
6
7GNU Fortran is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Fortran is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Fortran; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA.	 */
21
22#include "proj.h"
23#include "top.h"
24#include "com.h"
25#include "where.h"
26#include "version.h"
27#if FFECOM_targetCURRENT == FFECOM_targetGCC
28#include "flags.j"
29#endif
30
31#define NAME_OF_STDIN "<stdin>"
32
33#if FFECOM_targetCURRENT == FFECOM_targetFFE
34void
35main (int argc, char *argv[])
36#elif FFECOM_targetCURRENT == FFECOM_targetGCC
37FILE *finput;
38
39int
40yyparse ()
41#else
42#error
43#endif
44{
45  ffewhereFile wf;
46
47  if (ffe_is_version ())
48    fprintf (stderr, "GNU Fortran Front End version %s\n", ffe_version_string);
49
50#if FFECOM_targetCURRENT == FFECOM_targetFFE
51  ffe_init_0 ();
52
53  {
54    int strings_processed;
55    for (--argc, ++argv; argc > 0; argc -= strings_processed, argv += strings_processed)
56      {
57	strings_processed = ffe_decode_option (argc, argv);
58	if (strings_processed == 0)
59	  {
60	    fprintf (stderr, "Unrecognized option: %s\n", argv[0]);
61	    strings_processed = 1;
62	  }
63      }
64  }
65#elif FFECOM_targetCURRENT == FFECOM_targetGCC
66  if (!ffe_is_pedantic ())
67    ffe_set_is_pedantic (pedantic);
68#else
69#error
70#endif
71
72#if FFECOM_targetCURRENT == FFECOM_targetFFE
73  wf = ffewhere_file_new (NAME_OF_STDIN, strlen (NAME_OF_STDIN));
74  ffecom_file (NAME_OF_STDIN);
75  ffe_file (wf, stdin);
76#elif FFECOM_targetCURRENT == FFECOM_targetGCC
77  wf = ffewhere_file_new (main_input_filename, strlen (main_input_filename));
78  ffecom_file (main_input_filename);
79  ffe_file (wf, finput);
80#else
81#error
82#endif
83
84#if FFECOM_targetCURRENT == FFECOM_targetGCC
85  ffecom_finish_compile ();
86
87  return 0;
88#elif FFECOM_targetCURRENT == FFECOM_targetFFE
89  ffe_terminate_0 ();
90
91  exit (0);
92#else
93#error
94#endif
95}
96