1 /* expr.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
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)
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
28 /* Allow multiple inclusion to work. */
33 /* Simple definitions and enumerations. */
38 FFEEXPR_contextASSIGN
,
39 FFEEXPR_contextIOLIST
,
40 FFEEXPR_contextPARAMETER
,
41 FFEEXPR_contextSUBROUTINEREF
,
44 FFEEXPR_contextARITHIF
,
46 FFEEXPR_contextDOWHILE
,
47 FFEEXPR_contextFORMAT
,
50 FFEEXPR_contextCHARACTERSIZE
,
51 FFEEXPR_contextEQUIVALENCE
,
53 FFEEXPR_contextRETURN
,
54 FFEEXPR_contextSFUNCDEF
,
55 FFEEXPR_contextINCLUDE
,
57 FFEEXPR_contextSELECTCASE
,
59 FFEEXPR_contextDIMLIST
,
60 FFEEXPR_contextDIMLISTCOMMON
, /* Dim list in COMMON stmt. */
61 FFEEXPR_contextFILEASSOC
, /* ASSOCIATEVARIABLE=. */
62 FFEEXPR_contextFILEINT
, /* IOSTAT=. */
63 FFEEXPR_contextFILEDFINT
, /* NEXTREC=. */
64 FFEEXPR_contextFILELOG
, /* NAMED=. */
65 FFEEXPR_contextFILENUM
, /* Numerical expression. */
66 FFEEXPR_contextFILECHAR
, /* Character expression. */
67 FFEEXPR_contextFILENUMCHAR
, /* READ KEYxyz=. */
68 FFEEXPR_contextFILEDFCHAR
, /* Default kind character expression. */
69 FFEEXPR_contextFILEKEY
, /* OPEN KEY=. */
70 FFEEXPR_contextFILEEXTFUNC
, /* USEROPEN=. */
71 FFEEXPR_contextFILEUNIT
, /* READ/WRITE UNIT=. */
72 FFEEXPR_contextFILEUNIT_DF
, /* DEFINE FILE unit (no "(" after it). */
73 FFEEXPR_contextFILEFORMATNML
, /* [FMT=] or [NML=]. */
74 FFEEXPR_contextFILEFORMAT
, /* FMT=. */
75 FFEEXPR_contextFILENAMELIST
,/* NML=. */
76 FFEEXPR_contextFILENUMAMBIG
,/* BACKSPACE, ENDFILE, REWIND, UNLOCK...
77 where at e.g. BACKSPACE(, if COMMA seen
78 before ), it is ok. */
79 FFEEXPR_contextFILEUNITAMBIG
, /* READ(, if COMMA seen before ), ok. */
80 FFEEXPR_contextFILEVXTCODE
, /* ENCODE/DECODE third arg (scalar/array). */
81 FFEEXPR_contextALLOCATE
, /* ALLOCATE objects (weird). */
82 FFEEXPR_contextDEALLOCATE
, /* DEALLOCATE objects (weird). */
83 FFEEXPR_contextHEAPSTAT
, /* ALLOCATE/DEALLOCATE STAT= variable. */
84 FFEEXPR_contextKINDTYPE
, /* KIND=. */
85 FFEEXPR_contextINITVAL
, /* R426 =initialization-expr. */
86 FFEEXPR_contextNULLIFY
, /* Pointer names only (F90) or pointers. */
87 FFEEXPR_contextIOLISTDF
, /* IOLIST w/internal file (V112 9-14 30,31). */
88 FFEEXPR_contextINDEX_
, /* Element dimension or substring value. */
89 FFEEXPR_contextEQVINDEX_
, /* EQUIVALENCE element dimension. */
90 FFEEXPR_contextDATAIMPDOINDEX_
, /* INDEX in DATAIMPDO context. */
91 FFEEXPR_contextIMPDOITEM_
,
92 FFEEXPR_contextIMPDOITEMDF_
,/* to ...ITEM_ as IOLISTDF is to IOLIST. */
93 FFEEXPR_contextIMPDOCTRL_
,
94 FFEEXPR_contextDATAIMPDOITEM_
,
95 FFEEXPR_contextDATAIMPDOCTRL_
,
97 FFEEXPR_contextACTUALARG_
, /* Actual arg to function or subroutine;
98 turns into ACTUALARGEXPR_ if tokens not
99 NAME (CLOSE_PAREN/COMMA) or PERCENT.... */
100 FFEEXPR_contextACTUALARGEXPR_
, /* Like LET but disallow CHAR*(*)
102 FFEEXPR_contextINDEXORACTUALARG_
, /* "CHARACTER FOO; PRINT *,FOO(?". */
103 FFEEXPR_contextINDEXORACTUALARGEXPR_
, /* ? not NAME
104 (CLOSE_PAREN/COMMA). */
105 FFEEXPR_contextSFUNCDEFINDEX_
, /* INDEX_ within stmt-func def. */
106 FFEEXPR_contextSFUNCDEFACTUALARG_
,
107 FFEEXPR_contextSFUNCDEFACTUALARGEXPR_
,
108 FFEEXPR_contextSFUNCDEFINDEXORACTUALARG_
,
109 FFEEXPR_contextSFUNCDEFINDEXORACTUALARGEXPR_
,
110 FFEEXPR_contextPAREN_
, /* Rhs paren except in LET context. */
111 FFEEXPR_contextPARENFILENUM_
, /* Either PAREN or FILENUM context. */
112 FFEEXPR_contextPARENFILEUNIT_
, /* Either PAREN or FILEUNIT context. */
119 /* Include files needed by this one. */
125 /* Structure definitions. */
127 typedef ffelexHandler (*ffeexprCallback
) (ffelexToken ft
, ffebld expr
,
130 /* Global objects accessed by users of this module. */
133 /* Declare functions with prototypes. */
135 ffebld
ffeexpr_collapse_convert (ffebld expr
, ffelexToken t
);
136 ffebld
ffeexpr_collapse_paren (ffebld expr
, ffelexToken t
);
137 ffebld
ffeexpr_collapse_uplus (ffebld expr
, ffelexToken t
);
138 ffebld
ffeexpr_collapse_uminus (ffebld expr
, ffelexToken t
);
139 ffebld
ffeexpr_collapse_not (ffebld expr
, ffelexToken t
);
140 ffebld
ffeexpr_collapse_add (ffebld expr
, ffelexToken t
);
141 ffebld
ffeexpr_collapse_subtract (ffebld expr
, ffelexToken t
);
142 ffebld
ffeexpr_collapse_multiply (ffebld expr
, ffelexToken t
);
143 ffebld
ffeexpr_collapse_divide (ffebld expr
, ffelexToken t
);
144 ffebld
ffeexpr_collapse_power (ffebld expr
, ffelexToken t
);
145 ffebld
ffeexpr_collapse_concatenate (ffebld expr
, ffelexToken t
);
146 ffebld
ffeexpr_collapse_lt (ffebld expr
, ffelexToken t
);
147 ffebld
ffeexpr_collapse_le (ffebld expr
, ffelexToken t
);
148 ffebld
ffeexpr_collapse_eq (ffebld expr
, ffelexToken t
);
149 ffebld
ffeexpr_collapse_ne (ffebld expr
, ffelexToken t
);
150 ffebld
ffeexpr_collapse_gt (ffebld expr
, ffelexToken t
);
151 ffebld
ffeexpr_collapse_ge (ffebld expr
, ffelexToken t
);
152 ffebld
ffeexpr_collapse_and (ffebld expr
, ffelexToken t
);
153 ffebld
ffeexpr_collapse_or (ffebld expr
, ffelexToken t
);
154 ffebld
ffeexpr_collapse_xor (ffebld expr
, ffelexToken t
);
155 ffebld
ffeexpr_collapse_eqv (ffebld expr
, ffelexToken t
);
156 ffebld
ffeexpr_collapse_neqv (ffebld expr
, ffelexToken t
);
157 ffebld
ffeexpr_collapse_symter (ffebld expr
, ffelexToken t
);
158 ffebld
ffeexpr_collapse_funcref (ffebld expr
, ffelexToken t
);
159 ffebld
ffeexpr_collapse_arrayref (ffebld expr
, ffelexToken t
);
160 ffebld
ffeexpr_collapse_substr (ffebld expr
, ffelexToken t
);
161 ffebld
ffeexpr_convert (ffebld source
, ffelexToken source_token
,
162 ffelexToken dest_token
, ffeinfoBasictype bt
, ffeinfoKindtype kt
,
163 ffeinfoRank rk
, ffetargetCharacterSize sz
,
164 ffeexprContext context
);
165 ffebld
ffeexpr_convert_expr (ffebld source
, ffelexToken source_token
,
166 ffebld dest
, ffelexToken dest_token
,
167 ffeexprContext context
);
168 ffebld
ffeexpr_convert_to_sym (ffebld source
, ffelexToken source_token
,
169 ffesymbol dest
, ffelexToken dest_token
);
170 void ffeexpr_init_2 (void);
171 ffelexHandler
ffeexpr_rhs (mallocPool pool
, ffeexprContext context
,
172 ffeexprCallback callback
);
173 ffelexHandler
ffeexpr_lhs (mallocPool pool
, ffeexprContext context
,
174 ffeexprCallback callback
);
175 void ffeexpr_terminate_2 (void);
176 void ffeexpr_type_combine (ffeinfoBasictype
*nbt
, ffeinfoKindtype
*nkt
,
177 ffeinfoBasictype lbt
, ffeinfoKindtype lkt
,
178 ffeinfoBasictype rbt
, ffeinfoKindtype rkt
,
183 #define ffeexpr_init_0()
184 #define ffeexpr_init_1()
185 #define ffeexpr_init_3()
186 #define ffeexpr_init_4()
187 #define ffeexpr_terminate_0()
188 #define ffeexpr_terminate_1()
189 #define ffeexpr_terminate_3()
190 #define ffeexpr_terminate_4()
192 /* End of #include file. */