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 whirl2f_common_INCLUDED 00037 /* ==================================================================== 00038 * ==================================================================== 00039 * 00040 * 00041 * Revision history: 00042 * 17-Apr-95 - Original Version 00043 * 00044 * Description: 00045 * 00046 * This file is to be included in all major translating modules 00047 * belonging to whirl2f. It includes all files that these modules 00048 * will depend on and defines some utilities that are generally 00049 * useful. 00050 * 00051 * Output files 00052 * ------------ 00053 * 00054 * 1) The Whirl2f_File is the file to which we would write the 00055 * program units (subroutines/functions) in the high-level 00056 * output language. 00057 00058 * 2) The Whirl2f_Srcpos_Map_File is the file into which we 00059 * will write the mapping between source positions in the 00060 * original source and source positions in the whirl2f 00061 * generated source. 00062 * 00063 * Identifier Naming 00064 * ----------------- 00065 * We provide some utilities for creating identifier names. For 00066 * names that are generated or altered by whirl2f, these utilities 00067 * can be used to prepend a reserved whirl2f prefix (e.g. "w2f$"). 00068 * While this moves names outside of the user's name-space, it 00069 * does not prevent prefixed names from being overloaded. 00070 * 00071 * Note that this is all fine and dandy for local names, while 00072 * some extra work is required by the caller of these routines 00073 * for external names. An external name ending in '_' should 00074 * be converted into a name without the '_', while an external 00075 * name not ending in a '_' should be suffixed by a '$'. This 00076 * will be left to the users of the routines provided here, since 00077 * we do not know whether or not a name is external in this 00078 * module. 00079 * 00080 * WHIRL2F_number_as_name: Converts the given number into 00081 * a valid Fortran identifier (prefixed by WHIRL2F_prefix). 00082 * 00083 * WHIRL2F_ptr_as_name: Converts the given pointer value 00084 * into a valid Fortran identifier. Note that the number 00085 * may be a 32 or 64 bits value, depending on the pointer 00086 * representation and will be prefixed by WHIRL2F_prefix. 00087 * 00088 * WHIRL2F_make_valid_name: If the given name is already a 00089 * valid Fortran name, then it is simply returned. If the name 00090 * is NULL, then return NULL. Otherwise, construct a valid 00091 * Fortran identifier by removing invalid characters, thus 00092 * returning a non-NULL name. 00093 * 00094 * Comments and Parenthesis 00095 * ------------------------ 00096 * 00097 * WHIRL2F_Append_Comment: Adds prefix_lines+1+postfix_lines 00098 * number of comment-lines to the given token buffer, where 00099 * the given comment-string (if non-NULL) will be insterted 00100 * on a separate line between the prefix and postifix at 00101 * the current offset. The last comment line is NOT terminated 00102 * with a newline character! 00103 * 00104 * WHIRL2F_Parenthesize: Surround the current contents og the 00105 * given buffer by parenthesis. 00106 * 00107 * ==================================================================== 00108 * ==================================================================== 00109 */ 00110 00111 00112 /* Common include files */ 00113 /*----------------------*/ 00114 00115 #include "common_include.h" 00116 #include "w2f_driver.h" 00117 00118 /* Error checking during type accesses */ 00119 /*-------------------------------------*/ 00120 00121 #define W2F_TY_pointed(ty, msg) \ 00122 (ASSERT_DBG_FATAL(TY_Is_Pointer(ty), (DIAG_W2F_EXPECTED_PTR, (msg))), \ 00123 TY_pointed(ty)) 00124 00125 00126 /* Ensure that we do not override Fortran specific interfaces */ 00127 /*------------------------------------------------------------*/ 00128 00129 #define Prepend_Idented_Newline DO_NOT_USE_THIS_FUNCTION 00130 #define Append_Idented_Newline DO_NOT_USE_THIS_FUNCTION 00131 00132 00133 /* Identifier naming */ 00134 /*-------------------*/ 00135 00136 #define WHIRL2F_number_as_name(number) Number_as_String(number, "%llu") 00137 00138 #define WHIRL2F_ptr_as_name(ptr) Ptr_as_String(ptr) 00139 00140 extern const char * WHIRL2F_make_valid_name(const char *name, BOOL allow_dot); 00141 00142 00143 /* Fortran comments */ 00144 /*------------------*/ 00145 00146 extern void WHIRL2F_Append_Comment(TOKEN_BUFFER tokens, 00147 const char *cmt, 00148 UINT prefix_lines, 00149 UINT suffix_lines); 00150 00151 extern void WHIRL2F_Parenthesize(TOKEN_BUFFER tokens); 00152 00153 /* This variable is TRUE for Fortran 90 program units */ 00154 00155 extern BOOL WN2F_F90_pu; 00156 00157 #endif /* whirl2f_common_INCLUDED */