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 /* USMID: "\n@(#)5.0_pl/macros/src_input.m 5.2 07/19/99 12:03:43\n" */ 00037 00038 00039 /*****************\ 00040 |* MISCELLANEOUS *| 00041 \*****************/ 00042 00043 # define CONTINUE_COLUMN 6 /* fixed src continuation col */ 00044 00045 # if defined(_HOST_OS_UNICOS) || defined(_HOST_OS_MAX) 00046 # define SIGN_BIT 63 00047 # define NUM_MQ_WDS 3 00048 # else 00049 # define SIGN_BIT 31 00050 # ifdef _WHIRL_HOST64_TARGET64 00051 # define NUM_MQ_WDS 3 00052 # else 00053 # define NUM_MQ_WDS 5 00054 # endif 00055 # endif 00056 00057 # define MASK_CHAR_CONST_IDX 017777777400 00058 00059 # define NO_ARG 0 00060 # define STR_ARG 1 00061 # define ARG_ARG 2 00062 # define STR_ARG_ARG 3 00063 # define ARG_STR_ARG 4 00064 # define MULT_STR_ARG 5 00065 00066 /********************\ 00067 |* SIZES AND LIMITS *| 00068 \********************/ 00069 00070 # define MAX_ASCII_CHARS 256 /* max ascii characters */ 00071 00072 /* source input line sizes */ 00073 00074 # define FIXED_SRC_LINE_SIZE_72 72 /* std fixed src line size */ 00075 # define FIXED_SRC_LINE_SIZE_80 80 /* alt fixed src line size */ 00076 # define FIXED_SRC_LINE_SIZE_132 132 /* alt fixed src line size */ 00077 # define FREE_SRC_LINE_SIZE 132 /* std free src line size */ 00078 # define MAX_SRC_LINE_SIZE 135 /* maximum source line size */ 00079 /* it is 1 based, not 0 */ 00080 # define MAX_STMT_CHAR_SIZE 13500 /* maximum statement size */ 00081 00082 /* max number of source lines per statement */ 00083 00084 # define MAX_ANSI_FIXED_LINES 20 00085 # define MAX_ANSI_FREE_LINES 40 00086 # define MAX_FIXED_LINES 100 00087 # define MAX_FREE_LINES 100 00088 00089 00090 /******************************\ 00091 |* OBJECT REPLACEMENT STRINGS *| 00092 \******************************/ 00093 00094 # define SRC_STK_BASE_IDX 1 00095 00096 # define SRC_STK_CIF_FILE_ID(IDX) src_stk[IDX].cif_file_id 00097 # define SRC_STK_FILE_IDX(IDX) src_stk[IDX].file_idx 00098 # define SRC_STK_FILE_LINE(IDX) src_stk[IDX].file_line 00099 # define SRC_STK_FILE_NAME(IDX) &src_stk[IDX].path_name[src_stk[IDX].file_idx] 00100 # define SRC_STK_DO_NOT_FCLOSE(IDX) src_stk[IDX].do_not_fclose 00101 # define SRC_STK_FILE_PTR(IDX) src_stk[IDX].file_ptr 00102 # define SRC_STK_FILE_TYPE(IDX) src_stk[IDX].file_type 00103 # define SRC_STK_GLOBAL_LINE_IDX(IDX) src_stk[IDX].global_line_first_idx 00104 # define SRC_STK_PREV_SRC_FORM(IDX) src_stk[IDX].prev_src_form 00105 # define SRC_STK_PATH_NAME(IDX) src_stk[IDX].path_name 00106 00107 /***********************************\ 00108 |* CONDITIONAL REPLACEMENT STRINGS *| 00109 \***********************************/ 00110 00111 # define IS_1TO9(CH) ((CH) >= one && (CH) <= nine) 00112 00113 /***********************************************\ 00114 |* STATEMENT/FUNCTION-LIKE REPLACEMENT STRINGS *| 00115 \***********************************************/ 00116 00117 /* pop a source stack entry */ 00118 # define POP_SRC \ 00119 { if (! SRC_STK_DO_NOT_FCLOSE(src_stk_idx)) \ 00120 fclose(SRC_STK_FILE_PTR(src_stk_idx)); \ 00121 if (src_stk_idx == NULL_IDX) { /* src_stk_idx underflow */ \ 00122 PRINTMSG (curr_glb_line, 12, Internal, 0, "src_stk_idx"); \ 00123 } \ 00124 src_stk_idx--; \ 00125 } 00126 00127 # define OUTPUT_POUND_INCLUDE_EXIT_LINE(GLB_LINE) \ 00128 if (on_off_flags.output_pound_lines && \ 00129 (on_off_flags.preprocess_only || on_off_flags.save_dot_i)) { \ 00130 int _g_idx; int _file_line; \ 00131 GLOBAL_LINE_TO_FILE_LINE(GLB_LINE, _g_idx, _file_line); \ 00132 fprintf(dot_i_fptr,"# %d \"%s\" 2\n", _file_line, \ 00133 SRC_STK_FILE_NAME(src_stk_idx)); \ 00134 fprintf(dot_i_fptr,"# %d \"%s\"\n", _file_line, \ 00135 SRC_STK_FILE_NAME(src_stk_idx)); \ 00136 } 00137 00138 # define OUTPUT_POUND_LINE_NUM(GLB_LINE) \ 00139 if (on_off_flags.output_pound_lines && \ 00140 (on_off_flags.preprocess_only || on_off_flags.save_dot_i)) { \ 00141 int _g_idx; int _file_line; \ 00142 GLOBAL_LINE_TO_FILE_LINE(GLB_LINE, _g_idx, _file_line); \ 00143 fprintf(dot_i_fptr,"# %d\n", _file_line); \ 00144 } 00145 00146 /* Set sign bit of word holding a char in a char constant context */ 00147 # if 0 00148 # define MARK_CHAR_CONST(CH) ((CH) = ((1 << SIGN_BIT) | (CH))) 00149 # define MARK_CHAR_CONST(CH) ((CH) = (((int)0x80000000) | (CH))) 00150 # else 00151 # define MARK_CHAR_CONST(CH) ((CH) = (((unsigned)1 << SIGN_BIT) | (CH))) 00152 # endif 00153 00154 # ifdef _DEBUG 00155 # define PRINT_STMT_SRC() \ 00156 if (dump_flags.src_dmp) { \ 00157 print_src(); \ 00158 } 00159 /* Lines are now output by print_buffered_messages. */ 00160 /* else if (dump_flags.stmt_dmp) { \ 00161 print_stmt(); \ 00162 } */ 00163 # else 00164 # define PRINT_STMT_SRC() 00165 # endif 00166 00167 # define SAVE_GLOBAL_VARIABLES \ 00168 save_prev_char_delim = prev_char_delim; \ 00169 save_prev_char_delim_idx = prev_char_delim_idx; \ 00170 save_previous_char = previous_char; \ 00171 save_seen_lp_eq_slash = seen_lp_eq_slash; \ 00172 save_char_delim = char_delim; \ 00173 save_digit_start = digit_start; \ 00174 save_format_idx = format_idx; \ 00175 save_in_format = in_format; \ 00176 save_expected_line = expected_line; \ 00177 save_first_line = first_line; 00178 00179 # define RESTORE_GLOBAL_VARIABLES \ 00180 prev_char_delim = save_prev_char_delim; \ 00181 prev_char_delim_idx = save_prev_char_delim_idx; \ 00182 previous_char = save_previous_char; \ 00183 seen_lp_eq_slash = save_seen_lp_eq_slash; \ 00184 char_delim = save_char_delim; \ 00185 digit_start = save_digit_start; \ 00186 format_idx = save_format_idx; \ 00187 in_format = save_in_format; \ 00188 expected_line = save_expected_line; \ 00189 first_line = save_first_line; 00190 00191 # define NXT_COL(COL) (nxt_line_start_idx[pp_line_idx]+(COL)-1) 00192 # define PP_IDX_TO_COL(IDX) ((IDX - nxt_line_start_idx[pp_line_idx]) + 1) 00193 00194 # define PP_IDX pp_nxt_line_idx[pp_line_idx] 00195 # define PP_LINE_TYPE pp_nxt_line_type[pp_line_idx] 00196 # define PP_DIR_PREFIX pp_nxt_line_dir_prefix[pp_line_idx] 00197 # define PP_ACTUAL_DIR_PREFIX pp_nxt_line_actual_dir_prefix[pp_line_idx] 00198 # define PP_PREFIX_LEN pp_nxt_line_prefix_len[pp_line_idx] 00199 # define PP_LINE_NUM pp_nxt_line_num[pp_line_idx] 00200 # define PP_EOL pp_nxt_line_EOL[pp_line_idx] 00201 # define PP_LABEL pp_nxt_line_label[pp_line_idx] 00202 # define PP_MP_LINE pp_nxt_line_mp_line[pp_line_idx] 00203 # define PP_EXPECTED_LINE pp_expected_line[pp_line_idx] 00204 # define PP_ORIG_SIZE pp_orig_line_size[pp_line_idx] 00205 # define PP_CHANGE_SOURCE_FORM pp_change_source_form[pp_line_idx] 00206 00207 # define IS_DIR_CONTINUATION(DIR) \ 00208 ((nxt_line_num_lines > 1 && \ 00209 pp_nxt_line_type[1] == Dir_Line && \ 00210 pp_nxt_line_dir_prefix[1] == DIR) || \ 00211 (nxt_line_num_lines <= 1 && \ 00212 stmt_buf_type == Dir_Line && \ 00213 stmt_buf_dir_prefix == DIR))