Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
cond_comp.m
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 /* USMID:  "\n@(#)5.0_pl/macros/cond_comp.m     5.1     04/29/99 21:22:31\n" */
00037 
00038 
00039 /*****************\
00040 |* MISCELLANEOUS *|
00041 \*****************/
00042 
00043 # define CC_MAX_ID_LEN          133
00044 # ifdef _HOST64
00045 # define CC_NUM_ID_WDS           17
00046 # define CC_NUM_AT_WDS            2
00047 # else
00048 # define CC_NUM_ID_WDS           34
00049 # define CC_NUM_AT_WDS            4
00050 # endif
00051 
00052 
00053 /********************\
00054 |* SIZES AND LIMITS *|
00055 \********************/
00056 
00057 
00058 
00059 /******************************\
00060 |* OBJECT REPLACEMENT STRINGS *|
00061 \******************************/
00062 
00063 # define  CC_LA_CH_CLASS                cc_la_ch.ch_class
00064 # define  CC_LA_CH_COLUMN               cc_la_ch.column
00065 # define  CC_LA_CH_LINE                 cc_la_ch.line
00066 # define  CC_LA_CH_VALUE                cc_la_ch.value
00067 
00068 # define  CC_NEXT_LA_CH                 cc_get_next_char()
00069 
00070 /* LOCAL NAME TABLE */
00071 
00072 # define CC_LN_ATTR_IDX(IDX)               cc_ln_tbl[IDX].attr_idx
00073 # define CC_LN_NAME_IDX(IDX)               cc_ln_tbl[IDX].name_idx
00074 # define CC_LN_NAME_LEN(IDX)               cc_ln_tbl[IDX].name_len
00075 # define CC_LN_NAME_LONG(IDX)       &(str_pool[CC_LN_NAME_IDX(IDX)].name_long)
00076 
00077 
00078 # define CC_AT_NAME_LEN(IDX)            cc_attr_tbl[IDX].name_len
00079 # define CC_AT_NAME_IDX(IDX)            cc_attr_tbl[IDX].name_idx
00080 # define CC_AT_DEFINED(IDX)             cc_attr_tbl[IDX].defined
00081 # define CC_AT_DYNAMIC_PREDEF(IDX)      cc_attr_tbl[IDX].dynamic_predef
00082 # define CC_AT_STR_IDX(IDX)             cc_attr_tbl[IDX].str_idx
00083 # define CC_AT_STR_LEN(IDX)             cc_attr_tbl[IDX].str_len
00084 # define CC_AT_NUM_ARGS(IDX)            cc_attr_tbl[IDX].num_args
00085 # define CC_AT_START_LINE(IDX)          cc_attr_tbl[IDX].start_line
00086 # define CC_AT_START_COL(IDX)           cc_attr_tbl[IDX].start_col
00087 # define CC_AT_NAME_PTR(IDX)    &(str_pool[CC_AT_NAME_IDX(IDX)].name_char)
00088 # define CC_AT_STR_PTR(IDX)     &(str_pool[CC_AT_STR_IDX(IDX)].name_char)
00089 
00090 # define CC_CURR_BLK_TYPE       cc_blk_stk_tbl[cc_blk_stk_tbl_idx].blk_type
00091 # define CC_CURR_BLK_IS_ACTIVE  cc_blk_stk_tbl[cc_blk_stk_tbl_idx].is_active
00092 # define CC_CURR_BLK_IN_ERROR   cc_blk_stk_tbl[cc_blk_stk_tbl_idx].in_error
00093 # define CC_CURR_BLK_DONE       cc_blk_stk_tbl[cc_blk_stk_tbl_idx].already_done
00094 
00095 
00096 /***********************************\
00097 |* CONDITIONAL REPLACEMENT STRINGS *|
00098 \***********************************/
00099 
00100 # define VALID_CC_ID_CHAR(CHAR)   (ch_class[CHAR] == Ch_Class_Letter  ||   \
00101                                    ch_class[CHAR] == Ch_Class_Digit   ||   \
00102                                    CHAR == underscore || CHAR == dollar || \
00103                                    CHAR == at_sign)
00104 
00105 
00106 /***********************************************\
00107 |* STATEMENT/FUNCTION-LIKE REPLACEMENT STRINGS *|
00108 \***********************************************/
00109 
00110 # define ADD_TO_CC_TOKEN_STR(CH,LEN)                                           \
00111                 if ((LEN) < CC_MAX_ID_LEN) {                                   \
00112                    TOKEN_STR(cc_token)[(LEN)] = (CH);                          \
00113                 }                                                              \
00114                 (LEN)++
00115 
00116 # define NTR_CC_ATTR_TBL(ATTR_IDX)                                             \
00117          TBL_REALLOC_CK(cc_attr_tbl, 1);                                       \
00118          CLEAR_TBL_NTRY(cc_attr_tbl, cc_attr_tbl_idx);                         \
00119          ATTR_IDX = cc_attr_tbl_idx;
00120 
00121 # define NTR_CC_NAME_POOL(NAME, LEN, NP_IDX)                                   \
00122         {register long  *_name_id;                                             \
00123          register int    _np_idx;                                              \
00124          register int    _start_idx;                                           \
00125          register int    _wd_len;                                              \
00126          _name_id       = NAME;                                                \
00127          _wd_len        = WORD_LEN(LEN);                                       \
00128          _start_idx     = str_pool_idx + 1;                                    \
00129          NP_IDX         = _start_idx;                                          \
00130          TBL_REALLOC_CK(str_pool,_wd_len);                                     \
00131          for (_np_idx = 0; _np_idx < _wd_len; _np_idx++) {                     \
00132              str_pool[_start_idx+_np_idx].name_long = _name_id[_np_idx];       \
00133          }                                                                     \
00134         }
00135 
00136 
00137 # define POP_CC_BLK_STK                                                        \
00138                 cc_blk_stk_tbl_idx--;
00139 
00140 # define PUSH_CC_BLK_STK(NEW_BLK)                                              \
00141                 TBL_REALLOC_CK (cc_blk_stk_tbl, 1);                            \
00142                 CLEAR_TBL_NTRY(cc_blk_stk_tbl, cc_blk_stk_tbl_idx);            \
00143                 CC_CURR_BLK_TYPE = NEW_BLK;
00144 
00145 
00146 # define PUT_VALUE_IN_AT_STR(ATTR_IDX, VALUE)                                  \
00147         {int _len; sprintf(temp_id_str.string,"%d",VALUE);                     \
00148          _len = strlen(temp_id_str.string);                                    \
00149         CC_AT_STR_LEN(ATTR_IDX) = _len;                                        \
00150         NTR_CC_NAME_POOL(temp_id_str.words, _len, CC_AT_STR_IDX(ATTR_IDX));}
00151 
00152 # define CC_GET_ID_TOKEN                                                       \
00153          cc_token = cc_initial_token;                                          \
00154          TOKEN_LEN(cc_token) = 0;                                              \
00155          TOKEN_LINE(cc_token) = PP_LINE_NUM;                                   \
00156          TOKEN_COLUMN(cc_token) = nxt_line_col[cc_stmt_buf_idx];               \
00157          while (nxt_line[cc_stmt_buf_idx] > 0 &&                               \
00158                 VALID_CC_ID_CHAR(nxt_line[cc_stmt_buf_idx])) {                 \
00159             if (TOKEN_LEN(cc_token) < CC_MAX_ID_LEN) {                         \
00160                ADD_TO_CC_TOKEN_STR(nxt_line[cc_stmt_buf_idx],                  \
00161                                    TOKEN_LEN(cc_token));                       \
00162             }                                                                  \
00163             cc_advance_idx();                                                  \
00164          }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines