00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 typedef struct type_trans {
00036 DST_size_t size;
00037 char *name;
00038 DST_ATE_encoding encoding;
00039 } type_trans;
00040
00041 static DST_INFO_IDX base_types[MTYPE_LAST+5] =
00042 {
00043 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00044 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00045 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00046 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00047 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00048 DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,DST_INVALID_INIT,
00049 DST_INVALID_INIT
00050 } ;
00051
00052 static type_trans ate_types[] = {
00053 4, "BAD", 0,
00054 4, "UNK", 0,
00055 1, "INTEGER_1", DW_ATE_signed,
00056 2, "INTEGER_2", DW_ATE_signed,
00057 4, "INTEGER_4", DW_ATE_signed,
00058 8, "INTEGER_8", DW_ATE_signed,
00059 1, "INTEGER*1", DW_ATE_unsigned,
00060 2, "INTEGER*2", DW_ATE_unsigned,
00061 4, "INTEGER*4", DW_ATE_unsigned,
00062 8, "INTEGER*8", DW_ATE_unsigned,
00063 4, "REAL_4", DW_ATE_float,
00064 8, "REAL_8", DW_ATE_float,
00065 10,"UNK", DW_ATE_float,
00066 16,"REAL_16", DW_ATE_float,
00067 1 ,"CHAR" , DW_ATE_signed_char,
00068 16,"REAL_16", DW_ATE_float,
00069 1, "UNK", DW_ATE_unsigned_char,
00070 8, "COMPLEX_4", DW_ATE_complex_float,
00071 16,"COMPLEX_8", DW_ATE_complex_float,
00072 32,"COMPLEX_16",DW_ATE_complex_float,
00073 1, "VOID", 0,
00074 1, "LOGICAL_1", DW_ATE_boolean,
00075 2, "LOGICAL_2", DW_ATE_boolean,
00076 4, "LOGICAL_4", DW_ATE_boolean,
00077 8, "LOGICAL_8", DW_ATE_boolean,
00078
00079 } ;
00080
00081
00082 static DST_INFO_IDX current_scope_idx = DST_INVALID_INIT;
00083 static DST_INFO_IDX comp_unit_idx = DST_INVALID_INIT;
00084
00085 static DST_FILE_IDX file_name_idx = DST_INVALID_INIT;
00086 static DST_DIR_IDX incl_dir_idx = DST_INVALID_INIT;
00087
00088
00089 static char *current_working_dir ;
00090 static char *current_host_dir ;
00091
00092
00093
00094
00095
00096 #define DST_NAME_TABLE_SIZE 64
00097 static char **dir_list;
00098 static mUINT16 next_dir_idx = 0;
00099 static mUINT16 dir_list_size = 0;
00100
00101
00102
00103
00104 static char **file_list;
00105 static mUINT16 next_file_idx = 0;
00106 static mUINT16 file_list_size = 0;
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 ST * Top_ST ;
00127 BOOL Top_ST_has_dope ;
00128 BOOL Making_FLD_DST ;
00129
00130
00131
00132
00133
00134 typedef struct ty_dst {
00135 TY_IDX ty ;
00136 DST_INFO_IDX idx ;
00137 } TYIDX ;
00138
00139 #define STRUCT_DST_SIZE_CHANGE 512
00140 static INT32 Struct_Current_Size = 0;
00141 static TYIDX * Struct_DSTs = NULL;
00142 static INT32 Struct_Top = -1 ;
00143
00144
00145
00146
00147
00148 static DST_INFO_IDX * Inner_DSTs;
00149
00150 #define INNER_DST_SIZE_CHANGE 128
00151 static INT32 Inner_Current_Size = 0;
00152 static INT32 Inner_Top = -1 ;
00153
00154 enum str_knd { s_NONE, s_WORD, s_BYTE, s_TWO_BYTE, s_CHAR } ;
00155
00156 static DST_FILE_IDX cwh_dst_enter_files(void) ;
00157 static DST_DIR_IDX DST_write_directories(void) ;
00158 static DST_FILE_IDX DST_write_files(void) ;
00159 static void DST_directory_of(char *file_path, char **dir_name, UINT32 *dir_length);
00160 static mUINT16 DST_get_ordinal_num(char *the_name,
00161 char ***the_list,
00162 mUINT16 *the_next,
00163 mUINT16 *the_size) ;
00164
00165
00166
00167
00168 #define GET_NEXT_ELEMENT_ST(c,s) cwh_auxst_next_element(c,s,l_COMLIST)
00169 #define GET_NEXT_ALTENTRY(c,s) cwh_auxst_next_element(c,s,l_ALTENTRY)
00170 #define GET_MODIFIED_NAME(s) cwh_auxst_stem_name(s)
00171 #define GET_NEXT_COMMON(p,c) cwh_auxst_next_element(p,c,l_DST_COMLIST)
00172 #define GET_NEXT_PARAMETER(p,c) cwh_auxst_next_element(p,c,l_DST_PARMLIST)
00173 #define IS_DOPE_TY(t) cwh_types_is_dope(t)
00174 #define GET_DOPE_BASE_TY(t) cwh_types_dope_basic_TY(t)
00175 #define IS_ALTENTRY(s) ST_auxst_is_altentry(s)
00176 #define GET_ST_LINENUM(s) cwh_auxst_srcpos_val(s)
00177 #define GET_DOPE_BOUNDS(t) cwh_types_dope_dims_FLD(t)
00178 #define GET_MAIN_ST() cwh_stab_main_ST()
00179
00180
00181
00182
00183 static DST_INFO_IDX cwh_dst_basetype(TY_IDX ty) ;
00184 static DST_INFO_IDX cwh_dst_mk_type(TY_IDX ty) ;
00185 static DST_INFO_IDX cwh_dst_mk_func(ST * st) ;
00186 static void cwh_dst_mk_var(ST * st,DST_INFO_IDX parent);
00187 static void cwh_dst_mk_const(ST * st,DST_INFO_IDX parent);
00188 static DST_INFO_IDX cwh_dst_mk_subroutine_type(TY_IDX ty);
00189 static char *cwh_dst_get_command_line_options(void);
00190 static INT32 DST_set_assoc_idx(INT32 dummy,
00191 DST_DW_tag tag,
00192 DST_flag flag,
00193 DST_ATTR_IDX iattr,
00194 DST_INFO_IDX inode) ;
00195 static DST_INFO_IDX cwh_dst_array_type(TY_IDX ty) ;
00196 static DST_INFO_IDX cwh_dst_subrange(ARB_HANDLE ar) ;
00197 static DST_INFO_IDX cwh_dst_member(FLD_HANDLE f,DST_INFO_IDX p) ;
00198 static DST_INFO_IDX cwh_dst_struct_type(TY_IDX ty) ;
00199 static DST_INFO_IDX cwh_dst_pointer_type(TY_IDX ty) ;
00200 static DST_INFO_IDX cwh_dst_mk_common(ST * st) ;
00201 static DST_INFO_IDX cwh_dst_mk_formal(ST * st) ;
00202 static DST_INFO_IDX cwh_dst_mk_variable(ST * st) ;
00203 static DST_INFO_IDX cwh_dst_mk_common_inclusion(ST * com, DST_IDX c) ;
00204 static BOOL cwh_dst_is_character_TY(TY_IDX ty) ;
00205 static DST_INFO_IDX cwh_dst_substring_type(TY_IDX ty) ;
00206 static DST_INFO_IDX cwh_dst_dope_type(TY_IDX ty, ST *st, mINT64 ofst, DST_INFO_IDX p, BOOL ptr, DST_INFO_IDX *dope_ty) ;
00207 static DST_INFO_IDX cwh_dst_mk_dope_bound(ST *dp, mINT64 offset, DST_INFO_IDX t, DST_INFO_IDX p, BOOL comp);
00208 static void cwh_dst_dope_bounds(TY_IDX td, ST * st, mINT64 offset, DST_INFO_IDX aa, DST_INFO_IDX p, BOOL comp) ;
00209 static DST_INFO_IDX cwh_dst_struct_has_DST(TY_IDX ty) ;
00210 static void cwh_dst_struct_set_DST(TY_IDX ty, DST_INFO_IDX i) ;
00211 static void cwh_dst_struct_clear_DSTs(void);
00212 static BOOL cwh_dst_has_dope(TY_IDX ty) ;
00213 static void cwh_dst_inner_add_DST(DST_INFO_IDX i) ;
00214 static void cwh_dst_inner_clear_DSTs(void);
00215 static void cwh_dst_inner_read_DSTs(DST_INFO_IDX parent);
00216 static enum str_knd cwh_dst_stride_kind(TY_IDX ty) ;
00217 static void cwh_dst_mk_MAIN(ST *mn,DST_INFO_IDX en_idx) ;
00218 static char Get_ST_Id (ST_IDX st, INT *level, INT *index);
00219