OSDN Git Service

JCB: update email in header.
[pf3gnuchains/gcc-fork.git] / gcc / f / global.h
1 /* global.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995, 1997 Free Software Foundation, Inc.
3    Contributed by James Craig Burley (burley@gnu.org).
4
5 This file is part of GNU Fortran.
6
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.
11
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.
16
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.
21
22    Owning Modules:
23       global.c
24
25    Modifications:
26 */
27
28 /* Allow multiple inclusion to work. */
29
30 #ifndef _H_f_global
31 #define _H_f_global
32
33 /* Simple definitions and enumerations. */
34
35 typedef enum
36   {
37     FFEGLOBAL_typeNONE,
38     FFEGLOBAL_typeMAIN,
39     FFEGLOBAL_typeEXT,          /* EXTERNAL is all we know. */
40     FFEGLOBAL_typeSUBR,
41     FFEGLOBAL_typeFUNC,
42     FFEGLOBAL_typeBDATA,
43     FFEGLOBAL_typeCOMMON,
44     FFEGLOBAL_typeANY,          /* Confusion reigns, so just ignore. */
45     FFEGLOBAL_type
46   } ffeglobalType;
47
48 typedef enum
49   {
50     FFEGLOBAL_argsummaryNONE,   /* No arg present. */
51     FFEGLOBAL_argsummaryVAL,    /* Pass-by-value. */
52     FFEGLOBAL_argsummaryREF,    /* Pass-by-reference. */
53     FFEGLOBAL_argsummaryDESCR,  /* Pass-by-descriptor. */
54     FFEGLOBAL_argsummaryPROC,   /* Procedure (intrinsic, external). */
55     FFEGLOBAL_argsummarySUBR,   /* Subroutine (intrinsic, external). */
56     FFEGLOBAL_argsummaryFUNC,   /* Function (intrinsic, external). */
57     FFEGLOBAL_argsummaryALTRTN, /* Alternate-return (label). */
58     FFEGLOBAL_argsummaryPTR,    /* Pointer (%LOC, LOC()). */
59     FFEGLOBAL_argsummaryANY,
60     FFEGLOBAL_argsummary
61   } ffeglobalArgSummary;
62
63 /* Typedefs. */
64
65 typedef struct _ffeglobal_arginfo_ *ffeglobalArgInfo_;
66 typedef struct _ffeglobal_ *ffeglobal;
67
68 /* Include files needed by this one. */
69
70 #include "info.h"
71 #include "lex.h"
72 #include "name.h"
73 #include "symbol.h"
74 #include "target.h"
75 #include "top.h"
76
77 /* Structure definitions. */
78
79 struct _ffeglobal_arginfo_
80 {
81   ffelexToken t;        /* Different from master token when difference is important. */
82   char *name;           /* Name of dummy arg, or NULL if not yet known. */
83   ffeglobalArgSummary as;
84   ffeinfoBasictype bt;
85   ffeinfoKindtype kt;
86   bool array;
87 };
88
89 struct _ffeglobal_
90 {
91   ffelexToken t;
92   ffename n;
93 #ifdef FFECOM_globalHOOK
94   ffecomGlobal hook;
95 #endif
96   ffeCounter tick;              /* Recent transition in this progunit. */
97   ffeglobalType type;
98   bool intrinsic;               /* Known as intrinsic? */
99   bool explicit_intrinsic;      /* Explicit intrinsic? */
100   union {
101     struct {
102       ffelexToken initt;        /* First initial value. */
103       bool have_pad;            /* Padding info avail for COMMON? */
104       ffetargetAlign pad;       /* Initial padding for COMMON. */
105       ffewhereLine pad_where_line;
106       ffewhereColumn pad_where_col;
107       bool have_save;           /* Save info avail for COMMON? */
108       bool save;                /* Save info for COMMON. */
109       ffewhereLine save_where_line;
110       ffewhereColumn save_where_col;
111       bool have_size;           /* Size info avail for COMMON? */
112       long size;                /* Size info for COMMON. */
113       bool blank;               /* TRUE if blank COMMON. */
114     } common;
115     struct {
116       bool defined;             /* Seen actual code yet? */
117       ffeinfoBasictype bt;      /* NONE for non-function. */
118       ffeinfoKindtype kt;       /* NONE for non-function. */
119       ffetargetCharacterSize sz;
120       int n_args;               /* 0 for main/blockdata. */
121       ffelexToken other_t;      /* Location of reference. */
122       ffeglobalArgInfo_ arg_info;       /* Info on each argument. */
123     } proc;
124   } u;
125 };
126
127 /* Global objects accessed by users of this module. */
128
129
130 /* Declare functions with prototypes. */
131
132 void ffeglobal_drive (ffeglobal (*fn) ());
133 void ffeglobal_init_1 (void);
134 void ffeglobal_init_common (ffesymbol s, ffelexToken t);
135 void ffeglobal_new_progunit_ (ffesymbol s, ffelexToken t, ffeglobalType type);
136 void ffeglobal_new_common (ffesymbol s, ffelexToken t, bool blank);
137 void ffeglobal_pad_common (ffesymbol s, ffetargetAlign pad, ffewhereLine wl,
138                            ffewhereColumn wc);
139 void ffeglobal_proc_def_arg (ffesymbol s, int argno, char *name, ffeglobalArgSummary as,
140                              ffeinfoBasictype bt, ffeinfoKindtype kt,
141                              bool array);
142 void ffeglobal_proc_def_nargs (ffesymbol s, int n_args);
143 bool ffeglobal_proc_ref_arg (ffesymbol s, int argno, ffeglobalArgSummary as,
144                              ffeinfoBasictype bt, ffeinfoKindtype kt,
145                              bool array, ffelexToken t);
146 bool ffeglobal_proc_ref_nargs (ffesymbol s, int n_args, ffelexToken t);
147 ffeglobal ffeglobal_promoted (ffesymbol s);
148 void ffeglobal_ref_intrinsic (ffesymbol s, ffelexToken t, bool explicit);
149 bool ffeglobal_ref_progunit_ (ffesymbol s, ffelexToken t, ffeglobalType type);
150 void ffeglobal_save_common (ffesymbol s, bool save, ffewhereLine wl,
151                             ffewhereColumn wc);
152 bool ffeglobal_size_common (ffesymbol s, long size);
153 void ffeglobal_terminate_1 (void);
154
155 /* Define macros. */
156
157 #if FFECOM_targetCURRENT == FFECOM_targetFFE
158 #define FFEGLOBAL_ENABLED 0
159 #elif FFECOM_targetCURRENT == FFECOM_targetGCC
160 #define FFEGLOBAL_ENABLED 1
161 #else
162 #error
163 #endif
164
165 #define ffeglobal_common_init(g) ((g)->tick != 0)
166 #define ffeglobal_common_have_pad(g) ((g)->u.common.have_pad)
167 #define ffeglobal_common_have_size(g) ((g)->u.common.have_size)
168 #define ffeglobal_common_size(g) ((g)->u.common.size)
169 #define ffeglobal_hook(g) ((g)->hook)
170 #define ffeglobal_init_0()
171 #define ffeglobal_init_2()
172 #define ffeglobal_init_3()
173 #define ffeglobal_init_4()
174 #define ffeglobal_new_blockdata(s,t) \
175       ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeBDATA)
176 #define ffeglobal_new_function(s,t) \
177       ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeFUNC)
178 #define ffeglobal_new_program(s,t) \
179       ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeMAIN)
180 #define ffeglobal_new_subroutine(s,t) \
181       ffeglobal_new_progunit_(s,t,FFEGLOBAL_typeSUBR)
182 #define ffeglobal_pad(g) ((g)->pad)
183 #define ffeglobal_ref_blockdata(s,t) \
184       ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeBDATA)
185 #define ffeglobal_ref_external(s,t) \
186       ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeEXT)
187 #define ffeglobal_ref_function(s,t) \
188       ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeFUNC)
189 #define ffeglobal_ref_subroutine(s,t) \
190       ffeglobal_ref_progunit_(s,t,FFEGLOBAL_typeSUBR)
191 #define ffeglobal_set_hook(g,h) ((g)->hook = (h))
192 #define ffeglobal_terminate_0()
193 #define ffeglobal_terminate_2()
194 #define ffeglobal_terminate_3()
195 #define ffeglobal_terminate_4()
196 #define ffeglobal_text(g) ffename_text((g)->n)
197 #define ffeglobal_type(g) ((g)->type)
198
199 /* End of #include file. */
200
201 #endif