Initial revision
[official-gcc.git] / gcc / f / parse.c
blob62b98f31930d78f151aa062d33a5a070192daa0d
1 /* GNU Fortran
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Contributed by James Craig Burley (burley@gnu.ai.mit.edu).
5 This file is part of GNU Fortran.
7 GNU Fortran 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 2, or (at your option)
10 any later version.
12 GNU Fortran 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 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #include "proj.h"
23 #include <ctype.h>
24 #include <signal.h>
25 #include "top.h"
26 #include "com.h"
27 #include "where.h"
28 #include "version.h"
29 #if FFECOM_targetCURRENT == FFECOM_targetGCC
30 #include "flags.j"
31 #endif
33 #define NAME_OF_STDIN "<stdin>"
35 #if FFECOM_targetCURRENT == FFECOM_targetFFE
36 void
37 main (int argc, char *argv[])
38 #elif FFECOM_targetCURRENT == FFECOM_targetGCC
39 FILE *finput;
41 int
42 yyparse ()
43 #else
44 #error
45 #endif
47 ffewhereFile wf;
49 if (ffe_is_version ())
50 fprintf (stderr, "GNU Fortran Front End version %s\n", ffe_version_string);
52 #if FFECOM_targetCURRENT == FFECOM_targetFFE
53 ffe_init_0 ();
55 for (--argc, ++argv; argc > 0; --argc, ++argv)
57 if (!ffe_decode_option (argv[0]))
58 fprintf (stderr, "Unrecognized option: %s\n", argv[0]);
60 #elif FFECOM_targetCURRENT == FFECOM_targetGCC
61 if (!ffe_is_pedantic ())
62 ffe_set_is_pedantic (pedantic);
63 #else
64 #error
65 #endif
67 #if FFECOM_targetCURRENT == FFECOM_targetFFE
68 wf = ffewhere_file_new (NAME_OF_STDIN, strlen (NAME_OF_STDIN));
69 ffecom_file (NAME_OF_STDIN);
70 ffe_file (wf, stdin);
71 #elif FFECOM_targetCURRENT == FFECOM_targetGCC
72 wf = ffewhere_file_new (main_input_filename, strlen (main_input_filename));
73 ffecom_file (main_input_filename);
74 ffe_file (wf, finput);
75 #else
76 #error
77 #endif
79 #if FFECOM_targetCURRENT == FFECOM_targetGCC
80 ffecom_finish_compile ();
82 return 0;
83 #elif FFECOM_targetCURRENT == FFECOM_targetFFE
84 ffe_terminate_0 ();
86 exit (0);
87 #else
88 #error
89 #endif