Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
format.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 /* USMID @(#) clibinc/cray/format.h     92.0    10/08/98 14:28:05 */
00036 #ifndef _CRAY_FORMAT_H
00037 #define _CRAY_FORMAT_H
00038 
00039 #ifndef NULL
00040 #   define      NULL    0
00041 #endif
00042 
00043 #ifndef FALSE
00044 #   define      FALSE   0
00045 #endif
00046 
00047 #ifndef TRUE
00048 #   define      TRUE    1
00049 #endif
00050 
00051 /*
00052  * The following symbol identifies the level of the current parser.  If
00053  * the library is passed a parsed format with a different level than it's
00054  * expecting, it will reparse the format.
00055  */
00056 
00057 #define PARSER_LEVEL    3       /* Identifying level of the parser */
00058 
00059 /* Edit descriptors and operators which appear in the parsed format */
00060 
00061 #define FIRST_DATA_ED   1
00062 #define A_ED            1
00063 #define B_ED            2
00064 #define D_ED            3
00065 #define E_ED            4
00066 #define EN_ED           5
00067 #define ES_ED           6
00068 #define F_ED            7
00069 #define G_ED            8
00070 #define I_ED            9
00071 #define L_ED            10
00072 #define O_ED            11
00073 #define R_ED            12      /* CRI extension */
00074 #define Z_ED            13
00075 #define Q_ED            14      /* MIPSpro extension */
00076 #define LAST_DATA_ED    14
00077 
00078 #define FIRST_CNTL_ED   20
00079 #define SLASH_ED        20
00080 #define P_ED            21
00081 #define STRING_ED       22
00082 #define BN_ED           23
00083 #define BZ_ED           24
00084 #define COLON_ED        25
00085 #define S_ED            26
00086 #define SP_ED           27
00087 #define SS_ED           28
00088 #define TL_ED           29
00089 #define TR_ED           30
00090 #define T_ED            31
00091 #define DOLLAR_ED       32      /* CRI extension */
00092 #define LAST_CNTL_ED    32
00093 
00094 #define FIRST_OP        40
00095 #define REPEAT_OP       40
00096 #define ENDREP_OP       41
00097 #define REVERT_OP       42
00098 #define LAST_OP         42      /* Last valid format operator */
00099 
00100 /* There are dependencies on this order */
00101 
00102 #ifdef  _OLD_ERROR_NUMBERS
00103 
00104 #define END_OF_MESSAGES                 0
00105 #define TRAILING_CHARS                  1
00106 #define FIELD_TOO_SMALL                 2       /* Deprecated */
00107 
00108 #define FIRST_NON_ANSI_MESSAGE          3
00109 #define ANSI_EMPTY_PAREN_MSG            3
00110 #define ANSI_COMMA_REQ                  4
00111 #define COMMA_NON_ANSI                  5
00112 #define REP_SLASH_NON_ANSI              6
00113 #define NON_ANSI_EDIT_DESCRIPTOR        7
00114 #define MINUS_X_NON_ANSI                8
00115 #define E_WITH_D_NON_ANSI               9
00116 #define H_IS_OBSOLETE_IN_F90            10
00117 #define LAST_NON_ANSI_MESSAGE           10
00118 
00119 #define FIRST_FATAL_MESSAGE             11
00120 #define EXPECTING_LEFT_PAREN            11
00121 #define EXPECTING_RIGHT_PAREN           12
00122 #define EXPECTING_INTEGER               13
00123 #define EXPECTING_PERIOD                14
00124 #define EXPECTING_P_OR_X                15
00125 #define INVALID_REP_COUNT               16
00126 #define ZERO_REP_COUNT                  17
00127 #define FIELD_WIDTH_ZERO                18
00128 #define FIELD_TOO_LARGE                 19
00129 #define ZERO_OR_NO_HOLLERITH_CNT        20
00130 #define UNKNOWN_EDIT_DESCRIPTOR         21
00131 #define NONTERMINATED_LITERAL           22
00132 #define UNABLE_TO_MALLOC_MEMORY         23
00133 
00134 #else   /* _OLD_ERROR_NUMBERS */
00135 
00136 #define END_OF_MESSAGES                 0
00137 #define FIRST_WARNING_MESSAGE           1
00138 #define TRAILING_CHARS                  1
00139 
00140 #define FIRST_NON_ANSI_MESSAGE          10
00141 #define ANSI_EMPTY_PAREN_MSG            10
00142 #define ANSI_COMMA_REQ                  11
00143 #define COMMA_NON_ANSI                  12
00144 #define REP_SLASH_NON_ANSI              13
00145 #define NON_ANSI_EDIT_DESCRIPTOR        14
00146 #define MINUS_X_NON_ANSI                15
00147 #define E_WITH_D_NON_ANSI               16
00148 #define H_IS_OBSOLETE_IN_F90            17
00149 #define NON_ANSI_NULL_DESCRIPTOR        18
00150 #define ZERO_WIDTH_NON_ANSI             19
00151 #define MISSING_WIDTH_NON_ANSI          20
00152 #define LAST_NON_ANSI_MESSAGE           20
00153 
00154 #define FIRST_FATAL_MESSAGE             30
00155 #define EXPECTING_LEFT_PAREN            30
00156 #define EXPECTING_RIGHT_PAREN           31
00157 #define EXPECTING_INTEGER               32
00158 #define EXPECTING_PERIOD                33
00159 #define EXPECTING_P_OR_X                34
00160 #define INVALID_REP_COUNT               35
00161 #define ZERO_REP_COUNT                  36
00162 #define FIELD_WIDTH_ZERO                37
00163 #define FIELD_TOO_LARGE                 38
00164 #define ZERO_OR_NO_HOLLERITH_CNT        39
00165 #define UNKNOWN_EDIT_DESCRIPTOR         40
00166 #define NONTERMINATED_LITERAL           41
00167 #define UNABLE_TO_MALLOC_MEMORY         42
00168 
00169 #endif  /* !_OLD_ERROR_NUMBERS */
00170 
00171 #define DW_IS_NON_ANSI                  E_WITH_D_NON_ANSI
00172 
00173 /* Compiler level masks */
00174 
00175 #define FALL                            ~00     /* All levels */
00176 #define F77                             001     /* Fortran 77 */
00177 #define F90                             002     /* Fortran 90 */
00178 #define F95                             004     /* Fortran 95 */
00179 
00180 /* Format parser call flags */
00181 
00182 #define LIB_CALL                        0
00183 #define COMPILER_CALL_ANSI              1       /* Obsolete */
00184 #define COMPILER_CALL_NO_ANSI           2
00185 #define COMPILER_CALL_ANSI_77           3
00186 #define COMPILER_CALL_ANSI_90           4
00187 #define COMPILER_CALL_ANSI_95           5
00188 #define MAX_CALL_FLAG                   5
00189 
00190 #define MAX_EXPONENT                    077
00191 #define MAX_FIELD_WIDTH                 077777777
00192 #define MAX_DECIMAL_FIELD               077777777
00193 #define MAX_REP_COUNT                   017777777777
00194 
00195 
00196 struct  msg_entry {
00197         unsigned int    msg_number      : 7;
00198         unsigned int    reserved        : 9;
00199         unsigned int    msg_column      : 24;
00200         unsigned int    desc_column     : 24;
00201 };
00202 
00203 typedef struct  msg_entry       msg_type;
00204 
00205 /*
00206  *      Note: If we ever have to change the structure of the
00207  *      fmt_entry, we should ensure that no fields span a
00208  *      32-bit boundary.  This will help ensure a more compact
00209  *      structure on _WORD32 systems.
00210  */
00211 
00212 struct  fmt_entry {
00213         unsigned int    op_code         : 7;
00214         unsigned int    default_digits  : 1;
00215         unsigned int    digits_field    : 24;   /* 1 32-bit word */
00216         unsigned int    exponent        : 6;
00217         unsigned int    reserved2       : 2;
00218         unsigned int    field_width     : 24;   /* 1 64-bit word */
00219 
00220         unsigned int    rgcdedf         : 1;
00221         unsigned int    reserved3       : 15;
00222         unsigned int    offset          : 16;   /* 3 32-bit words */
00223         signed  int     rep_count       : 32;   /* 2 64-bit words*/
00224 };
00225 
00226 typedef struct  fmt_entry       fmt_type;
00227 
00228 #define FMT_ENTRY_BYTE_SIZE     sizeof(fmt_type)
00229 
00230 /*
00231  * Caution: FMT_ENTRY_WORD_SIZE will vary on mips systems with the
00232  * sizeof(long).
00233  */
00234 
00235 #define FMT_ENTRY_WORD_SIZE     (sizeof(fmt_type)/sizeof(long))
00236 
00237 /* Function prototypes */
00238 
00239 typedef void    _Error_function(const int _Msg_num,
00240                 const int _Error_offset,
00241                 const int _Edit_desc_offset);
00242 
00243 extern fmt_type *
00244 _parsfmt(
00245         _Error_function **_Msg_rtn,
00246         char            *_Format_str,
00247         long int        _Routine_caller,
00248         long int        *_Fmt_str_len,
00249         msg_type        *_Lib_err_msg
00250 );
00251 
00252 extern fmt_type *
00253 _fmt_parse(
00254         _Error_function **_Msg_rtn,
00255         char            *_Format_str,
00256         long int        _Routine_caller,
00257         long int        *_Fmt_str_len,
00258         msg_type        *_Lib_err_msg
00259 );
00260 
00261 #endif /* !_CRAY_FORMAT_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines