Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
st2c.h
Go to the documentation of this file.
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 st2c_INCLUDED
00037 #define st2c_INCLUDED
00038 /* ====================================================================
00039  * ====================================================================
00040  *
00041  *
00042  * Revision history:
00043  *  07-Oct-94 - Original Version
00044  *
00045  * Description:
00046  *
00047  *    ST2C_initialize:
00048  *    ST2C_finalize:
00049  *       This will initialize and terminate usage of this module().
00050  *       This must be done after the call to TY2C_initialize.
00051  *
00052  *    ST2C_decl_translate:
00053  *       Declares a variable, function, or constant for the given ST 
00054  *       in C and appends the declaration to the tokens.  Any other 
00055  *       kinds of STs will result in an assertion failure.
00056  *
00057  *    ST2C_weakext_translate:
00058  *       Declares a variable or function, attributed as being weak,
00059  *       followed by a #pragma weak directive.  Note that the tokens
00060  *       added by this call should not be followed by a semicolon ';'.
00061  *
00062  *    ST2C_use_translate:
00063  *       Translates an ST into a variable, constant, sym_const, 
00064  *       or function reference and appends the tokens to the given
00065  *       TOKEN_BUFFER.  Note that pregs and labels must be handled
00066  *       independently in wn2c.c. The "name" may consist of more than
00067  *       an identifier for sym_consts.
00068  *
00069  *    ST2C_Use_Preg:
00070  *       Given an ST_type(), a preg offset, and a context, this function 
00071  *       appends the name of the preg to the given TOKEN_BUFFER.  The 
00072  *       preg will be declared as a side-effect of this call if it has 
00073  *       not yet been declared in the current context.  It is left to 
00074  *       the caller to cast the resultant value to ST_type(st) when:
00075  *       PUinfo_Preg_Type(ST_type(st)) != ST_type(st).
00076  *
00077  *    ST2C_func_header:
00078  *       Adds tokens for the function header (parameter declarations,
00079  *       function name, and return type) in a function definition. Note 
00080  *       that the resultant token buffer will not have appended a 
00081  *       newline after the function header.
00082  *
00083  *    ST2C_Declare_Tempvar:
00084  *       Declares a tempvar with the given index in the local scope.
00085  *
00086  *    ST2C_New_Common_Block:
00087  *       Denotes the given ST as a Fortran common block and marks it
00088  *       as having been declared to avoid a declaration in the current
00089  *       local PU scope.  This should be called for all common blocks
00090  *       in a local scope prior to translating the enclosing PU 
00091  *       (i.e. function/procedure) body ... it is essential to getting
00092  *       the variable references right.
00093  *
00094  *    ST2C_Define_Common_Blocks:
00095  *       Declares all common blocks in the compilation unit.  Usually
00096  *       done shortly before ST2C_finalize().
00097  *
00098  * ====================================================================
00099  * ====================================================================
00100  */
00101 
00102 extern void ST2C_initialize(CONTEXT context);
00103 extern void ST2C_finalize(void);
00104 
00105 extern void ST2C_decl_translate(TOKEN_BUFFER tokens,
00106                                 const ST    *st,
00107                                 CONTEXT      context);
00108 extern void ST2C_weakext_translate(TOKEN_BUFFER tokens, 
00109                                    const ST    *st, 
00110                                    CONTEXT      context);
00111 extern void ST2C_use_translate(TOKEN_BUFFER tokens,
00112                                const ST    *st,
00113                                CONTEXT      context);
00114 
00115 extern void ST2C_Use_Preg(TOKEN_BUFFER tokens, 
00116                           TY_IDX       preg_ty, 
00117                           PREG_IDX     preg_idx, 
00118                           CONTEXT      context);
00119 
00120 extern void ST2C_func_header(TOKEN_BUFFER  tokens, 
00121                              const ST     *st,     /* ST for function */
00122                              ST          **params, /*list of formal parms */
00123                              CONTEXT       context);
00124 
00125 extern void ST2C_Declare_Tempvar(TY_IDX ty, UINT idx);
00126 
00127 extern void ST2C_New_Common_Block(const ST *st);
00128 extern void ST2C_Define_Common_Blocks(TOKEN_BUFFER tokens, CONTEXT context);
00129 
00130 
00131 #endif /* st2c_INCLUDED */
00132 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines