Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 00036 #ifndef ty2f_INCLUDED 00037 #define ty2f_INCLUDED 00038 /* ==================================================================== 00039 * ==================================================================== 00040 * 00041 * 00042 * Revision history: 00043 * 13-Apr-95 - Original Version 00044 * 00045 * Description: 00046 * 00047 * TY2F_translate: 00048 * Add a Fortran language type corresponding to the given TY node 00049 * into the token_buffer, assuming the TOKEN_BUFFER already 00050 * holds a construct to be declared of this type. The type 00051 * may surround the current contents of the given TOKEN_BUFFER 00052 * as though these contents where declared to be of the given 00053 * type; i.e. for an array or function type. The qualifiers 00054 * are not written out for the top-level ty, but will be written 00055 * for component tys. After this call, TY2F_Prepend_Structures() 00056 * should be called in an appropriate context (such as 00057 * ST2F_translate()). 00058 * 00059 * TY2F_translate_purple_array: 00060 * Inserts a place-holder for assumed sized or adjustable array bounds, 00061 * while the action is simply dispatched to TY2F_translate() for other 00062 * types. 00063 * 00064 * TY2F_Translate_ArrayElt: 00065 * Translates an array offset into a (multi-dimensional) array 00066 * indexing operation, based on a given array-type. 00067 * 00068 * TY2F_Translate_Common: 00069 * Translates a common-block into Fortran. After this call, 00070 * TY2F_Prepend_Structures() should be called in an appropriate 00071 * context (such as ST2F_translate()). 00072 * 00073 * TY2F_Translate_Equivalence: 00074 * Translates an equivalence spec into Fortran. After this call, 00075 * TY2F_Prepend_Structures() should be called in an appropriate 00076 * context (such as ST2F_translate()). If alt_return==TRUE, this 00077 * equivalence represents the return-variables for alternate return 00078 * points in a function, and they will be treated as such. 00079 * 00080 * TY2F_Prepend_Structures: 00081 * When TY2F_translate(), TY2F_Translate_Common(), or 00082 * TY2F_Translate_Equivalence() are invoked, a number of 00083 * records may be translated in the process. These will be 00084 * declared in a buffer internal to ty2f, and this routine 00085 * must be called to prepend the contents of this internal 00086 * buffer to a given buffer. We cannot prepend these 00087 * structures to the buffer passed to the "TY2F_translate()" 00088 * routine, since we do not know in what context that translation 00089 * occurs (e.g. it may called for a fld declaration). 00090 * 00091 * TY2F_Fld_Separator: adds the appropriate field separator for 00092 * structure components 00093 * 00094 * KIND_STRUCT field information 00095 * ------------------------------ 00096 * 00097 * TY2F_Free_Fld_Path: Having called Stab_Get_Fld_Path(), we can 00098 * reuse the path-elements by invoking TY2F_Free_Fld_Path() 00099 * before the next call to TY2F_Get_Fld_Path(). 00100 * 00101 * TY2F_Get_Fld_Path: Returns a path through the substructure of 00102 * the given KIND_STRUCT to a field element that was found to 00103 * best match the given type and offset. While a matching type 00104 * need not be of the same btype, it must always have the same 00105 * offset, type-size, and type-alignment. NULL is returned when 00106 * no matching field is found. 00107 * 00108 * TY2F_Translate_Fld_Path: Given a path to a field, append a field 00109 * selection string as dictated by Fortran syntax to access this 00110 * field. It is assumed that the token_buffer already contains 00111 * the tokens for the base-record expression. Note that we use 00112 * the pointee name to dereference a pointer record elements 00113 * (after emitting a warning since we do not expect record elements 00114 * to be pointers). 00115 * 00116 * TY2F_Dump_Fld_Path: dump to stdout... 00117 * 00118 * TY2F_Point_At_Path: look within a path for a FLD with the given offset. 00119 * 00120 * ==================================================================== 00121 * ==================================================================== 00122 */ 00123 00124 00125 extern void TY2F_translate(TOKEN_BUFFER tokens, TY_IDX ty); 00126 extern void TY2F_translate(TOKEN_BUFFER tokens, TY_IDX ty,BOOL notyappend); 00127 00128 extern void TY2F_Translate_Purple_Array(TOKEN_BUFFER tokens, ST *st, TY_IDX ty); 00129 extern void TY2F_Translate_ArrayElt(TOKEN_BUFFER tokens, 00130 TY_IDX arr_ty, 00131 STAB_OFFSET arr_ofst); 00132 extern void TY2F_Translate_Common(TOKEN_BUFFER tokens, 00133 const char *name, 00134 TY_IDX ty); 00135 extern void TY2F_Translate_Equivalence(TOKEN_BUFFER tokens, 00136 TY_IDX ty, 00137 BOOL alt_return); 00138 00139 extern void TY2F_Prepend_Structures(TOKEN_BUFFER tokens); 00140 00141 extern const char *TY2F_Fld_Name(FLD_HANDLE,BOOL,BOOL); 00142 00143 00144 static BOOL GetTmpVarTransInfo(TOKEN_BUFFER decl_tokens, 00145 ST_IDX arbnd, 00146 WN* wn); 00147 00148 00149 static BOOL Array_Bnd_Temp_Var=FALSE; 00150 00151 /*------- Facilities to get information about FLDs -------*/ 00152 /*--------------------------------------------------------*/ 00153 00154 typedef struct Fld_Path_Info FLD_PATH_INFO; 00155 struct Fld_Path_Info 00156 { 00157 FLD_HANDLE fld; /* Field on the path */ 00158 BOOL arr_elt; /* An element in an array field? */ 00159 STAB_OFFSET arr_ofst; /* Offset of element within an array field */ 00160 WN * arr_wn; /* if arr_elt, optional OPC_ARRAY with subscripts */ 00161 FLD_PATH_INFO *next; /* Next field on the path */ 00162 }; 00163 00164 extern FLD_PATH_INFO * TY2F_Free_Fld_Path(FLD_PATH_INFO *fld_path); 00165 00166 00167 extern FLD_PATH_INFO * TY2F_Get_Fld_Path(const TY_IDX struct_ty, 00168 const TY_IDX object_ty, 00169 STAB_OFFSET offset); 00170 00171 00172 extern void TY2F_Translate_Fld_Path(TOKEN_BUFFER tokens, 00173 FLD_PATH_INFO *fld_path, 00174 BOOL deref, 00175 BOOL member_of_common, 00176 BOOL name_as_is, 00177 WN2F_CONTEXT context); 00178 00179 00180 extern void TY2F_Fld_Separator(TOKEN_BUFFER tokens); 00181 extern FLD_HANDLE TY2F_Last_Fld(FLD_PATH_INFO *fld_path); 00182 00183 extern void TY2F_Dump_Fld_Path(FLD_PATH_INFO *fld_path) ; 00184 extern FLD_PATH_INFO * TY2F_Point_At_Path(FLD_PATH_INFO * path, STAB_OFFSET off); 00185 00186 #endif /* ty2f_INCLUDED */ 00187