Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cond_comp.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 
00037 /* USMID:  "\n@(#)5.0_pl/headers/cond_comp.h    5.2     04/30/99 09:41:17\n" */
00038 
00039 enum    cc_token_values {
00040                         Cc_Tok_Unknown,
00041 
00042                         Cc_Tok_Id,
00043                         Cc_Tok_Constant,
00044 
00045                         Cc_Tok_Kwd_Define,
00046                         Cc_Tok_Kwd_Defined,
00047                         Cc_Tok_Kwd_Elif,
00048                         Cc_Tok_Kwd_Else,
00049                         Cc_Tok_Kwd_Endif,
00050                         Cc_Tok_Kwd_Error,
00051                         Cc_Tok_Kwd_If,
00052                         Cc_Tok_Kwd_Ifdef,
00053                         Cc_Tok_Kwd_Ifndef,
00054                         Cc_Tok_Kwd_Include,
00055                         Cc_Tok_Kwd_Undef,
00056 
00057                         Cc_Tok_Op_Add,          /* + */
00058                         Cc_Tok_Op_Div,          /* / */
00059                         Cc_Tok_Op_Mult,         /* * */
00060                         Cc_Tok_Op_Sub,          /* - */
00061                         Cc_Tok_Op_Eq,           /* == */
00062                         Cc_Tok_Op_Ge,           /* >= */
00063                         Cc_Tok_Op_Gt,           /* > */
00064                         Cc_Tok_Op_Le,           /* <= */
00065                         Cc_Tok_Op_Lt,           /* < */
00066                         Cc_Tok_Op_Ne,           /* != */
00067                         Cc_Tok_Op_And,          /* && */
00068                         Cc_Tok_Op_Band,         /* &  */
00069                         Cc_Tok_Op_Neqv,         /* ^ */
00070                         Cc_Tok_Op_Not,          /* ! */
00071                         Cc_Tok_Op_Or,           /* || */
00072                         Cc_Tok_Op_Bor,          /* | */
00073                         Cc_Tok_Op_Mod,          /* % */
00074                         Cc_Tok_Op_Lshift,       /* << */
00075                         Cc_Tok_Op_Rshift,       /* >> */
00076                         Cc_Tok_Op_Bnot,         /* ~ */
00077 
00078                         Cc_Tok_EOS
00079                         };
00080 
00081 typedef enum    cc_token_values cc_token_values_type;
00082 
00083                         
00084 typedef union   cc_id_str_entry                    cc_id_str_type;
00085 
00086 union   cc_id_str_entry            {char           string[CC_MAX_ID_LEN+1];
00087                                     long           words[CC_NUM_ID_WDS];
00088                                 };
00089 
00090 cc_id_str_type  temp_id_str;
00091 
00092 typedef struct  cc_darg_entry   cc_darg_type;
00093 
00094 struct  cc_darg_entry   {
00095                         cc_id_str_type          name;
00096                         int                     name_len;
00097                         cc_darg_type            *next;
00098                         };
00099 
00100 typedef struct  cc_arg_entry   cc_arg_type;
00101 
00102 struct  cc_arg_entry   {
00103                         char                   *name;
00104                         int                     name_len;
00105                         cc_arg_type            *next;
00106                         };
00107 
00108 
00109 
00110 cc_stmt_buf_line_type           cc_stmt_buf_line[200];
00111 long                            cc_stmt_buf_num_lines;
00112 
00113 struct  cc_token_entry  {cc_id_str_type         token_str;
00114                          int                    token_len;
00115                          boolean                token_err;
00116                          cc_token_values_type   value;
00117                          char                   kind_str[MAX_ID_LEN+1];
00118                          int                    kind_len;
00119                          int                    line;
00120                          int                    column;
00121                         };
00122 
00123 typedef struct cc_token_entry cc_token_type;
00124 
00125 struct  cc_attr_entry  {Uint                    name_idx        : 24;
00126                         Uint                    name_len        :  7;
00127                         boolean                 defined         :  1;
00128                         Uint                    str_idx         : 24;
00129                         Uint                    num_args        :  8;
00130                         Uint                    str_len         : 24;
00131                         Uint                    unused          :  7;
00132                         boolean                 dynamic_predef  :  1;
00133                         Uint                    start_line      : 24;
00134                         Uint                    start_col       :  8;
00135                        };
00136 
00137 typedef struct  cc_attr_entry   cc_attr_tbl_type;
00138 
00139 cc_attr_tbl_type       *cc_attr_tbl;
00140 int                     cc_attr_tbl_idx                    = NULL_IDX;
00141 int                     cc_attr_tbl_inc                    = 100;
00142 int                     cc_attr_tbl_init_size              = 100;
00143 int                     cc_attr_tbl_limit                  = (1 << 20) - 1;
00144 int                     cc_attr_tbl_num_wds                = CC_NUM_AT_WDS;
00145 int                     cc_attr_tbl_size                   = 0;
00146 int                     cc_attr_tbl_largest_idx            = NULL_IDX;
00147 
00148 
00149 typedef struct  name_tbl_entry          cc_ln_tbl_type;
00150 
00151 cc_ln_tbl_type         *cc_ln_tbl;
00152 int                     cc_ln_tbl_idx                = NULL_IDX;
00153 int                     cc_ln_tbl_inc                = 100;
00154 int                     cc_ln_tbl_init_size          = 100;
00155 int                     cc_ln_tbl_limit              = (1 << 20) - 1;
00156 # ifdef _HOST32
00157 int                     cc_ln_tbl_num_wds            = 2;
00158 # else
00159 int                     cc_ln_tbl_num_wds            = 1;
00160 # endif
00161 int                     cc_ln_tbl_size               = 0;
00162 int                     cc_ln_tbl_largest_idx        = NULL_IDX;
00163 
00164 int                     cc_ln_fw_idx;
00165 int                     cc_ln_lw_idx;
00166 
00167 enum    cc_blk_values          {Cc_No_Blk,
00168                                 Cc_Elif_Blk,
00169                                 Cc_Else_Blk,
00170                                 Cc_If_Blk,
00171                                 Cc_Ifdef_Blk,
00172                                 Cc_Ifndef_Blk};
00173 
00174 typedef enum cc_blk_values      cc_blk_type;
00175                                 
00176 struct  cc_blk_stk_entry        {
00177 # ifdef _HOST64
00178                                 Uint            unused2         : 32;
00179 # endif
00180                                 Uint            unused          : 21;
00181                                 boolean         is_active       :  1;
00182                                 boolean         already_done    :  1;
00183                                 boolean         in_error        :  1;
00184                                 Uint            blk_type        :  8;
00185                                 };
00186 
00187 typedef struct  cc_blk_stk_entry        cc_blk_stk_tbl_type;
00188 
00189 cc_blk_stk_tbl_type    *cc_blk_stk_tbl;
00190 int                     cc_blk_stk_tbl_idx                = NULL_IDX;
00191 int                     cc_blk_stk_tbl_inc                = 10;
00192 int                     cc_blk_stk_tbl_init_size          = 10;
00193 int                     cc_blk_stk_tbl_limit              = (1 << 20) - 1;
00194 int                     cc_blk_stk_tbl_num_wds            = 1;
00195 int                     cc_blk_stk_tbl_size               = 0;
00196 int                     cc_blk_stk_tbl_largest_idx        = NULL_IDX;
00197 int                     cc_blk_stk_top                    = NULL_IDX;
00198 
00199 static  cc_token_type           cc_token;
00200 static  cc_token_type           cc_initial_token;
00201 static  la_type                 cc_la_ch;
00202 
00203 char                    cc_stmt_buf[MAX_STMT_CHAR_SIZE];
00204 int                     cc_stmt_buf_idx;
00205 int                     cc_stmt_buf_len;
00206 int                     prev_idx;
00207 
00208 # ifdef _FRONTEND_CONDITIONAL_COMP
00209 extern  int                     nxt_line[MAX_STMT_CHAR_SIZE];
00210 extern  int                     nxt_line_col[MAX_STMT_CHAR_SIZE];
00211 # else
00212 extern  int                     nxt_line[MAX_SRC_LINE_SIZE];
00213 extern  int                     nxt_line_col[MAX_SRC_LINE_SIZE];
00214 # endif
00215 
00216 extern  int                     nxt_line_start_idx[MAX_FIXED_LINES+1];
00217 extern  int                     nxt_line_end_idx[MAX_FIXED_LINES+1];
00218 extern  int                     pp_nxt_line_length[MAX_FIXED_LINES+1];
00219 extern  int                     pp_nxt_line_idx[MAX_FIXED_LINES+1];
00220 extern  int                     pp_nxt_line_num[MAX_FIXED_LINES+1];
00221 extern  line_type               pp_nxt_line_type[MAX_FIXED_LINES+1];
00222 extern  int                     pp_nxt_line_EOL[MAX_FIXED_LINES+1];
00223 extern  boolean                 pp_nxt_line_mp_line[MAX_FIXED_LINES+1];
00224 extern  int                     pp_orig_line_size[MAX_FIXED_LINES+1];
00225 extern  boolean                 pp_change_source_form[MAX_FIXED_LINES+1];
00226 extern  line_type               pp_expected_line[MAX_FIXED_LINES+1];
00227 
00228 extern  int                     nxt_line_num_lines;
00229 extern  int                     pp_line_idx;
00230 extern  int                     extra_nxt_line;
00231 
00232 extern  char                    include_file[MAX_FILE_NAME_SIZE];
00233 
00234 extern  boolean                 ignore_source_line;
00235 extern  int                     line_size;
00236 extern  int                     orig_line_size;
00237 
00238 extern  ch_class_type           ch_class[];
00239 
00240 
00241 /* chars predefined as ints */
00242 
00243 extern  int     lc_a;
00244 extern  int     uc_a;
00245 extern  int     lc_b;
00246 extern  int     uc_b;
00247 extern  int     lc_c;
00248 extern  int     uc_c;
00249 extern  int     lc_d;
00250 extern  int     uc_d;
00251 extern  int     lc_e;
00252 extern  int     uc_e;
00253 extern  int     lc_f;
00254 extern  int     uc_f;
00255 extern  int     lc_g;
00256 extern  int     uc_g;
00257 extern  int     lc_h;
00258 extern  int     uc_h;
00259 extern  int     lc_i;
00260 extern  int     uc_i;
00261 extern  int     lc_l;
00262 extern  int     uc_l;
00263 extern  int     lc_m;
00264 extern  int     uc_m;
00265 extern  int     lc_n;
00266 extern  int     uc_n;
00267 extern  int     lc_o;
00268 extern  int     uc_o;
00269 extern  int     lc_r;
00270 extern  int     uc_r;
00271 extern  int     lc_t;
00272 extern  int     uc_t;
00273 extern  int     dot;
00274 extern  int     star;
00275 extern  int     quote;
00276 extern  int     db_quote;
00277 extern  int     blank;
00278 extern  int     marked_blank;
00279 extern  int     tab;
00280 extern  int     newline;
00281 extern  int     bang;
00282 extern  int     lparen;
00283 extern  int     rparen;
00284 extern  int     equal;
00285 extern  int     slash;
00286 extern  int     underscore;
00287 extern  int     dollar;
00288 extern  int     amp;
00289 extern  int     percent;
00290 extern  int     at_sign;
00291 extern  int     semi_colon;
00292 extern  int     colon;
00293 extern  int     eos;
00294 extern  int     one;
00295 extern  int     nine;
00296 extern  int     zero;
00297 extern  int     comma;
00298 extern  int     pound;
00299 extern  int     greater;
00300 extern  int     less;
00301 
00302 extern  int     lbrkt;
00303 extern  int     rbrkt;
00304 
00305 extern void read_line (boolean);
00306 extern void ntr_next_msg_queue(int,int,msg_severities_type,
00307                                    int,char *, long,int);
00308 
00309 extern  void get_curr_file_name(char *);
00310 
00311 extern FILE     *dot_i_fptr;
00312 
00313 extern boolean  angle_brkt_include;
00314 
00315 static boolean  cc_line_continued;
00316 
00317 int     end_stmt_line_idx;
00318 
00319 int     cc_curr_glb_line;
00320 
00321 
00322 /****************************************\
00323 |* these are dynamic predefined macros. *|
00324 \****************************************/
00325 
00326 int     line_macro_idx;
00327 int     LINE_macro_idx;
00328 int     file_macro_idx;
00329 int     FILE_macro_idx;
00330 int     date_macro_idx;
00331 int     DATE_macro_idx;
00332 int     time_macro_idx;
00333 int     TIME_macro_idx;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines