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 #ifdef _KEEP_RCS_ID 00037 static const char source_file[] = __FILE__; 00038 #endif 00039 00040 #include <stdio.h> 00041 #include <cmplrs/rcodes.h> 00042 #define USE_DST_INTERNALS 00043 #include "dwarf_DST.h" 00044 #include "dwarf_DST_dump.h" 00045 #include "errors.h" 00046 00047 #define DST_DUMP_LINELENGTH 1024 00048 #define DST_TMP_BUF_LENGTH 256 00049 00050 00051 /* This truth value takes into account that we need one character 00052 * at the end of as line for " ...\n". 00053 */ 00054 #define DST_CHARS_DO_FIT(n) (n <= (DST_DUMP_LINELENGTH - next_char - 5)) 00055 00056 static char line_buffer[DST_DUMP_LINELENGTH]; 00057 static char tmp_buffer[DST_TMP_BUF_LENGTH]; 00058 static UINT32 next_char; /* Index into line_buffer */ 00059 static FILE *dumpf = NULL; 00060 static char *dumpf_name = NULL; 00061 static BOOL end_of_line = FALSE; 00062 00063 00064 #define DST_ASSERT(truth, msg) Is_True(truth, (msg)) 00065 00066 00067 /*--------------------------------------- 00068 * Some general purpose writing routines 00069 *---------------------------------------*/ 00070 00071 00072 /* The current contents of the line buffer is written to file and the 00073 * next_char is again the first element in the buffer. 00074 */ 00075 static void 00076 DST_write_line(void) 00077 { 00078 size_t status; 00079 00080 line_buffer[next_char] = '\n'; 00081 status = fwrite(line_buffer, sizeof(char), next_char + 1, dumpf); 00082 DST_ASSERT(status >= next_char, "Write error while dumping DST"); 00083 next_char = 0; 00084 end_of_line = FALSE; 00085 } 00086 00087 00088 00089 static void 00090 DST_line_overflow(void) 00091 { 00092 line_buffer[next_char++] = ' '; 00093 line_buffer[next_char++] = '.'; 00094 line_buffer[next_char++] = '.'; 00095 line_buffer[next_char++] = '.'; 00096 end_of_line = TRUE; 00097 } 00098 00099 00100 00101 static void 00102 DST_nput_char(size_t n, const char c) 00103 { 00104 size_t c_idx; 00105 00106 if (!end_of_line) 00107 { 00108 if (DST_CHARS_DO_FIT(n)) 00109 { 00110 for (c_idx = 0; c_idx < n; c_idx += 1) 00111 { 00112 line_buffer[next_char + c_idx] = c; 00113 } 00114 next_char = next_char + n; 00115 } 00116 else 00117 DST_line_overflow(); 00118 } 00119 } 00120 00121 00122 00123 static void 00124 DST_put_string(const char *c) 00125 { 00126 size_t length, c_idx; 00127 00128 if (!end_of_line) 00129 { 00130 if (c != NULL) 00131 { 00132 length = strlen(c); 00133 if (DST_CHARS_DO_FIT(length)) 00134 { 00135 for (c_idx = 0; c_idx < length; c_idx += 1) 00136 { 00137 line_buffer[next_char + c_idx] = c[c_idx]; 00138 } 00139 next_char = next_char + length; 00140 } 00141 else 00142 DST_line_overflow(); 00143 } 00144 else 00145 { 00146 if (DST_CHARS_DO_FIT(2)) 00147 { 00148 line_buffer[next_char++] = '<'; 00149 line_buffer[next_char++] = '>'; 00150 } 00151 else 00152 DST_line_overflow(); 00153 } 00154 } 00155 } 00156 00157 00158 00159 static void 00160 DST_put_idx(DST_IDX i) 00161 { 00162 sprintf(&tmp_buffer[0], "[%d,%d]", i.block_idx, i.byte_idx); 00163 DST_put_string(&tmp_buffer[0]); 00164 } 00165 00166 static void 00167 DST_put_st_id (INT32 level, INT32 index) 00168 { 00169 sprintf(&tmp_buffer[0], "(%d,%d)", level, index); 00170 DST_put_string(&tmp_buffer[0]); 00171 } 00172 00173 static void 00174 DST_put_string_attribute(const char *at_name, DST_STR_IDX istr) 00175 { 00176 if (!DST_IS_NULL(istr)) 00177 { 00178 DST_put_string(at_name); 00179 DST_nput_char(1, '('); 00180 DST_put_string(DST_STR_IDX_TO_PTR(istr)); 00181 DST_nput_char(1, ')'); 00182 } 00183 } 00184 00185 00186 static void 00187 DST_put_idx_attribute(const char *at_name, DST_IDX i, BOOL is_type) 00188 { 00189 if (DST_IS_FOREIGN_OBJ(i)) { 00190 DST_put_string(at_name); 00191 DST_put_string("[foreign]"); 00192 } 00193 else if (!DST_IS_NULL(i)) 00194 { 00195 DST_put_string(at_name); 00196 DST_put_idx(i); 00197 } 00198 else if (is_type) 00199 { 00200 DST_put_string(at_name); 00201 DST_put_string("(void)"); 00202 } 00203 } 00204 00205 00206 00207 static void 00208 DST_put_hex64_attribute(const char *at_name, UINT64 num) 00209 { 00210 DST_put_string(at_name); 00211 sprintf(&tmp_buffer[0], "(0x%llx)", num); 00212 DST_put_string(&tmp_buffer[0]); 00213 } 00214 00215 00216 static void 00217 DST_put_INT32_attribute(const char *at_name, INT32 num) 00218 { 00219 DST_put_string(at_name); 00220 sprintf(&tmp_buffer[0], "(%d)", num); 00221 DST_put_string(&tmp_buffer[0]); 00222 } 00223 00224 static void 00225 DST_put_UINT32_attribute(const char *at_name, UINT32 num) 00226 { 00227 DST_put_string(at_name); 00228 sprintf(&tmp_buffer[0], "(%u)", num); 00229 DST_put_string(&tmp_buffer[0]); 00230 } 00231 00232 static void 00233 DST_put_INT64_attribute(const char *at_name, INT64 num) 00234 { 00235 DST_put_string(at_name); 00236 sprintf(&tmp_buffer[0], "(%lld)", num); 00237 DST_put_string(&tmp_buffer[0]); 00238 } 00239 00240 static void 00241 DST_put_UINT64_attribute(const char *at_name, UINT64 num) 00242 { 00243 DST_put_string(at_name); 00244 sprintf(&tmp_buffer[0], "(%llu)", num); 00245 DST_put_string(&tmp_buffer[0]); 00246 } 00247 00248 00249 00250 static void 00251 DST_put_inline_attribute(const char *at_name, DST_inline inlin) 00252 { 00253 DST_put_string(at_name); 00254 DST_nput_char(1, '('); 00255 switch (inlin) { 00256 case DW_INL_not_inlined: 00257 DST_put_string ("DW_INL_not_inlined"); 00258 break; 00259 case DW_INL_inlined: 00260 DST_put_string ("DW_INL_inlined"); 00261 break; 00262 case DW_INL_declared_not_inlined: 00263 DST_put_string ("DW_INL_declared_not_inlined"); 00264 break; 00265 case DW_INL_declared_inlined: 00266 DST_put_string ("DW_INL_declared_inlined"); 00267 break; 00268 } 00269 DST_nput_char(1, ')'); 00270 } 00271 00272 00273 static void 00274 DST_put_virtuality_attribute(const char *at_name, DST_virtuality virtuality) 00275 { 00276 DST_put_string(at_name); 00277 DST_nput_char(1, '('); 00278 switch (virtuality) { 00279 case DW_VIRTUALITY_none: 00280 DST_put_string ("DW_VIRTUALITY_none"); 00281 break; 00282 case DW_VIRTUALITY_virtual: 00283 DST_put_string("DW_VIRTUALITY_virtual"); 00284 break; 00285 case DW_VIRTUALITY_pure_virtual: 00286 DST_put_string ("DW_VIRTUALITY_pure_virtual"); 00287 break; 00288 } 00289 DST_nput_char(1, ')'); 00290 } 00291 00292 static void 00293 DST_put_language_attribute(const char *at_name, DST_language lang_code) 00294 { 00295 DST_put_string(at_name); 00296 DST_nput_char(1, '('); 00297 switch (lang_code) 00298 { 00299 case DW_LANG_C89: 00300 DST_put_string("C89"); 00301 break; 00302 case DW_LANG_Ada83: 00303 DST_put_string("Ada83"); 00304 break; 00305 case DW_LANG_C_plus_plus: 00306 DST_put_string("C_plus_plus"); 00307 break; 00308 case DW_LANG_Cobol74: 00309 DST_put_string("Cobol74"); 00310 break; 00311 case DW_LANG_Cobol85: 00312 DST_put_string("Cobol85"); 00313 break; 00314 case DW_LANG_Fortran77: 00315 DST_put_string("Fortran77"); 00316 break; 00317 case DW_LANG_Fortran90: 00318 DST_put_string("Fortran90"); 00319 break; 00320 case DW_LANG_Pascal83: 00321 DST_put_string("Pascal83"); 00322 break; 00323 case DW_LANG_Modula2: 00324 DST_put_string("Modula2"); 00325 break; 00326 } 00327 DST_nput_char(1, ')'); 00328 } 00329 00330 static void 00331 DST_put_id_case_attribute(const char *at_name, DST_identifier_case id_case) 00332 { 00333 DST_put_string(at_name); 00334 DST_nput_char(1, '('); 00335 switch (id_case) 00336 { 00337 case DW_ID_case_sensitive: 00338 DST_put_string("case_sensitive"); 00339 break; 00340 case DW_ID_up_case: 00341 DST_put_string("upper_case"); 00342 break; 00343 case DW_ID_down_case: 00344 DST_put_string("lower_case"); 00345 break; 00346 case DW_ID_case_insensitive: 00347 DST_put_string("case_insensitive"); 00348 break; 00349 } 00350 DST_nput_char(1, ')'); 00351 } 00352 00353 00354 static void 00355 DST_put_decl(USRCPOS decl) 00356 { 00357 DST_put_UINT32_attribute(" file", (UINT32)USRCPOS_filenum(decl)); 00358 DST_put_UINT32_attribute(" line", (UINT32)USRCPOS_linenum(decl)); 00359 DST_put_UINT32_attribute(" column", (UINT32)USRCPOS_column(decl)); 00360 } 00361 00362 00363 static void 00364 DST_put_assoc(const char *at_name, DST_flag flag, DST_ASSOC_INFO assoc) 00365 { 00366 DST_put_string(at_name); 00367 DST_nput_char(1, '('); 00368 if (DST_IS_assoc_fe(flag)) 00369 DST_put_hex64_attribute("FE", (UINT64)DST_ASSOC_INFO_fe_ptr(assoc)); 00370 else { 00371 DST_put_string("ST"); 00372 DST_put_st_id (DST_ASSOC_INFO_st_level(assoc), DST_ASSOC_INFO_st_index(assoc)); 00373 } 00374 DST_nput_char(1, ')'); 00375 } 00376 00377 00378 static void 00379 DST_put_const_attribute(const char *at_name, DST_CONST_VALUE cval) 00380 { 00381 switch(DST_CONST_VALUE_form(cval)) 00382 { 00383 case DST_FORM_STRING: 00384 DST_put_idx_attribute(at_name, DST_CONST_VALUE_form_string(cval), FALSE); 00385 break; 00386 00387 case DST_FORM_DATA1: 00388 DST_put_UINT32_attribute(at_name, 00389 (UINT32)DST_CONST_VALUE_form_data1(cval)); 00390 break; 00391 00392 case DST_FORM_DATA2: 00393 DST_put_UINT32_attribute(at_name, 00394 (UINT32)DST_CONST_VALUE_form_data2(cval)); 00395 break; 00396 00397 case DST_FORM_DATA4: 00398 DST_put_UINT32_attribute(at_name, 00399 (UINT32)DST_CONST_VALUE_form_data4(cval)); 00400 break; 00401 00402 case DST_FORM_DATA8: 00403 DST_put_UINT64_attribute(at_name, 00404 (UINT64)DST_CONST_VALUE_form_data8(cval)); 00405 break; 00406 } 00407 } 00408 00409 00410 00411 /*---------------------------------- 00412 * One put routine for each DW_TAG 00413 *----------------------------------*/ 00414 00415 00416 static void 00417 DST_put_compile_unit(DST_flag flag, DST_COMPILE_UNIT *attr) 00418 { 00419 DST_put_string(":compile_unit:"); 00420 DST_put_string_attribute(" name", DST_COMPILE_UNIT_name(attr)); 00421 DST_put_string_attribute(" comp_dir", DST_COMPILE_UNIT_comp_dir(attr)); 00422 DST_put_string_attribute(" producer", DST_COMPILE_UNIT_producer(attr)); 00423 DST_put_language_attribute(" language", DST_COMPILE_UNIT_language(attr)); 00424 DST_put_id_case_attribute(" case", DST_COMPILE_UNIT_identifier_case(attr)); 00425 } 00426 00427 00428 static void 00429 DST_put_subprogram(DST_flag flag, DST_SUBPROGRAM *attr) 00430 { 00431 DST_put_string(":subprogram:"); 00432 if (DST_IS_memdef(flag)) /* Not yet supported */ 00433 { 00434 DST_put_string(" a class member with AT_specification!"); 00435 } 00436 else if (DST_IS_declaration(flag)) 00437 { 00438 DST_put_decl(DST_SUBPROGRAM_decl_decl(attr)); 00439 DST_put_string_attribute(" name", DST_SUBPROGRAM_decl_name(attr)); 00440 DST_put_string_attribute(" linkage_name", 00441 DST_SUBPROGRAM_decl_linkage_name(attr)); 00442 DST_put_string(" declaration"); 00443 if (DST_IS_external(flag)) 00444 DST_put_string(" external"); 00445 if (DST_IS_prototyped(flag)) 00446 DST_put_string(" prototyped"); 00447 DST_put_idx_attribute(" type", DST_SUBPROGRAM_decl_type(attr), TRUE); 00448 DST_put_idx_attribute(" origin", DST_SUBPROGRAM_decl_origin(attr), FALSE); 00449 DST_put_inline_attribute (" inline", DST_SUBPROGRAM_decl_inline(attr)); 00450 DST_put_virtuality_attribute(" virtuality", 00451 DST_SUBPROGRAM_decl_virtuality(attr)); 00452 DST_put_INT32_attribute(" vtable_elem_location", 00453 DST_SUBPROGRAM_decl_vtable_elem_location(attr)); 00454 } 00455 else /* definition */ 00456 { 00457 DST_put_decl(DST_SUBPROGRAM_def_decl(attr)); 00458 DST_put_string_attribute(" name", DST_SUBPROGRAM_def_name(attr)); 00459 DST_put_string_attribute(" linkage_name", 00460 DST_SUBPROGRAM_def_linkage_name(attr)); 00461 DST_put_string_attribute(" pubname", DST_SUBPROGRAM_def_pubname(attr)); 00462 if (DST_IS_external(flag)) 00463 DST_put_string(" external"); 00464 if (DST_IS_prototyped(flag)) 00465 DST_put_string(" prototyped"); 00466 DST_put_idx_attribute(" type", DST_SUBPROGRAM_def_type(attr), TRUE); 00467 DST_put_idx_attribute(" specification", 00468 DST_SUBPROGRAM_def_specification(attr), TRUE); 00469 DST_put_idx_attribute(" clone_origin", 00470 DST_SUBPROGRAM_def_clone_origin(attr), 00471 FALSE); 00472 DST_put_inline_attribute (" inline", DST_SUBPROGRAM_def_inline(attr)); 00473 DST_put_virtuality_attribute(" virtuality", 00474 DST_SUBPROGRAM_def_virtuality(attr)); 00475 DST_put_INT32_attribute(" vtable_elem_location", 00476 DST_SUBPROGRAM_def_vtable_elem_location(attr)); 00477 00478 DST_put_assoc(" pc", flag, DST_SUBPROGRAM_def_st(attr)); 00479 } 00480 } 00481 00482 static void 00483 DST_put_inlined_subroutine(DST_flag flag, DST_INLINED_SUBROUTINE *attr) 00484 { 00485 DST_put_string(":inlined_subroutine:"); 00486 if (DST_IS_FOREIGN_OBJ(DST_INLINED_SUBROUTINE_abstract_origin(attr))) 00487 DST_put_decl(DST_INLINED_SUBROUTINE_decl(attr)); 00488 DST_put_assoc(" low_pc", flag, DST_INLINED_SUBROUTINE_low_pc(attr)); 00489 DST_put_assoc(" high_pc", flag, DST_INLINED_SUBROUTINE_high_pc(attr)); 00490 DST_put_idx_attribute(" abstract_origin", 00491 DST_INLINED_SUBROUTINE_abstract_origin(attr), 00492 FALSE); 00493 if (DST_IS_FOREIGN_OBJ(DST_INLINED_SUBROUTINE_abstract_origin(attr))) 00494 DST_put_string_attribute(" abstract_name", DST_INLINED_SUBROUTINE_abstract_name(attr)); 00495 } 00496 00497 static void 00498 DST_put_entry_point(DST_flag flag, DST_ENTRY_POINT *attr) 00499 { 00500 DST_put_string(":entry point:"); 00501 DST_put_decl(DST_ENTRY_POINT_decl(attr)); 00502 DST_put_string_attribute(" name", DST_ENTRY_POINT_name(attr)); 00503 DST_put_idx_attribute(" type", DST_ENTRY_POINT_type(attr), TRUE); 00504 DST_put_assoc(" pc", flag, DST_ENTRY_POINT_st(attr)); 00505 } 00506 00507 static void 00508 DST_put_common_block(DST_flag flag, DST_COMMON_BLOCK *attr) 00509 { 00510 DST_put_string(":common blk:"); 00511 DST_put_string_attribute(" name", DST_ENTRY_POINT_name(attr)); 00512 DST_put_assoc(" pc", flag, DST_ENTRY_POINT_st(attr)); 00513 } 00514 00515 static void 00516 DST_put_common_inclusion(DST_flag flag, DST_COMMON_INCL *attr) 00517 { 00518 DST_put_string(":common incl:"); 00519 DST_put_decl(DST_COMMON_INCL_decl(attr)); 00520 DST_put_idx_attribute(" type", DST_COMMON_INCL_com_blk(attr), TRUE); 00521 } 00522 00523 static void 00524 DST_put_lexical_block(DST_flag flag, DST_LEXICAL_BLOCK *attr) 00525 { 00526 DST_put_string(":lexical_block:"); 00527 DST_put_string_attribute(" name", DST_LEXICAL_BLOCK_name(attr)); 00528 DST_put_assoc(" low_pc", flag, DST_LEXICAL_BLOCK_low_pc(attr)); 00529 DST_put_assoc(" high_pc", flag, DST_LEXICAL_BLOCK_high_pc(attr)); 00530 } 00531 00532 00533 static void 00534 DST_put_label(DST_flag flag, DST_LABEL *attr) 00535 { 00536 DST_put_string(":label:"); 00537 DST_put_string_attribute(" name", DST_LABEL_name(attr)); 00538 DST_put_assoc(" low_pc", flag, DST_LABEL_low_pc(attr)); 00539 } 00540 00541 00542 static void 00543 DST_put_variable(DST_flag flag, DST_VARIABLE *attr) 00544 { 00545 DST_put_string(":variable:"); 00546 if (DST_IS_artificial(flag)) 00547 DST_put_string(" artificial"); 00548 if (DST_IS_const(flag)) /* Not yet supported */ 00549 { 00550 DST_put_string(" a constant variable!"); 00551 } 00552 else if (DST_IS_comm(flag)) 00553 { 00554 DST_put_string("var in common:"); 00555 if (DST_IS_deref(flag)) 00556 DST_put_string(" deref"); 00557 if (DST_IS_f90_pointer(flag)) 00558 DST_put_string(" f90_pointer"); 00559 if (DST_IS_allocatable(flag)) 00560 DST_put_string(" allocatable"); 00561 if (DST_IS_assumed_shape(flag)) 00562 DST_put_string(" assumed_shape"); 00563 if (DST_IS_assumed_size(flag)) 00564 DST_put_string(" assumed_size"); 00565 DST_put_decl(DST_VARIABLE_comm_decl(attr)); 00566 DST_put_string_attribute(" name", DST_VARIABLE_comm_name(attr)); 00567 DST_put_idx_attribute(" type", DST_VARIABLE_comm_type(attr), TRUE); 00568 DST_put_UINT64_attribute(" offset", DST_VARIABLE_comm_offs(attr)); 00569 DST_put_assoc(" location", flag, DST_VARIABLE_comm_st(attr)); 00570 DST_put_idx_attribute(" dopetype", DST_VARIABLE_comm_dopetype(attr),TRUE); 00571 } 00572 else if (DST_IS_memdef(flag)) /* Not yet supported */ 00573 { 00574 DST_put_string(" a class member with AT_specification!"); 00575 } 00576 else if (DST_IS_declaration(flag)) 00577 { 00578 DST_put_decl(DST_VARIABLE_decl_decl(attr)); 00579 DST_put_string_attribute(" name", DST_VARIABLE_decl_name(attr)); 00580 DST_put_string(" declaration"); 00581 if (DST_IS_external(flag)) 00582 DST_put_string(" external"); 00583 if (DST_IS_automatic(flag)) 00584 DST_put_string(" <auto>"); 00585 DST_put_idx_attribute(" type", DST_VARIABLE_decl_type(attr), TRUE); 00586 } 00587 else /* definition */ 00588 { 00589 DST_put_decl(DST_VARIABLE_def_decl(attr)); 00590 DST_put_string_attribute(" name", DST_VARIABLE_def_name(attr)); 00591 if (DST_IS_external(flag)) 00592 DST_put_string(" external"); 00593 if (DST_IS_automatic(flag)) 00594 DST_put_string(" <auto>"); 00595 if (DST_IS_deref(flag)) 00596 DST_put_string(" deref"); 00597 if (DST_IS_base_deref(flag)) 00598 DST_put_string(" base_deref"); 00599 if (DST_IS_f90_pointer(flag)) 00600 DST_put_string(" f90_pointer"); 00601 if (DST_IS_allocatable(flag)) 00602 DST_put_string(" allocatable"); 00603 if (DST_IS_assumed_shape(flag)) 00604 DST_put_string(" assumed shape"); 00605 if (DST_IS_assumed_size(flag)) 00606 DST_put_string(" assumed_size"); 00607 00608 DST_put_UINT64_attribute(" offset", DST_VARIABLE_def_offs(attr)); 00609 DST_put_idx_attribute(" type", DST_VARIABLE_def_type(attr), TRUE); 00610 DST_put_assoc(" location", flag, DST_VARIABLE_def_st(attr)); 00611 DST_put_idx_attribute(" abstract_origin", 00612 DST_VARIABLE_def_abstract_origin(attr), FALSE); 00613 DST_put_idx_attribute(" dopetype", DST_VARIABLE_def_dopetype(attr), TRUE); 00614 } 00615 } 00616 00617 00618 static void 00619 DST_put_formal_parameter(DST_flag flag, DST_FORMAL_PARAMETER *attr) 00620 { 00621 DST_put_string(":formal_parameter:"); 00622 if (DST_IS_artificial(flag)) 00623 DST_put_string(" artificial"); 00624 if (DST_IS_base_deref(flag)) 00625 DST_put_string(" base_deref"); 00626 if (DST_IS_deref(flag)) 00627 DST_put_string(" deref"); 00628 if (DST_IS_f90_pointer(flag)) 00629 DST_put_string(" f90_pointer"); 00630 if (DST_IS_allocatable(flag)) 00631 DST_put_string(" allocatable"); 00632 if (DST_IS_assumed_shape(flag)) 00633 DST_put_string(" assumed shape"); 00634 if (DST_IS_assumed_size(flag)) 00635 DST_put_string(" assumed_size"); 00636 DST_put_decl(DST_FORMAL_PARAMETER_decl(attr)); 00637 DST_put_string_attribute(" name", DST_FORMAL_PARAMETER_name(attr)); 00638 if (DST_IS_optional_parm(flag)) 00639 DST_put_string(" is_optional"); 00640 if (DST_IS_variable_parm(flag)) 00641 DST_put_string(" variable_parameter"); 00642 DST_put_idx_attribute(" type", DST_FORMAL_PARAMETER_type(attr), TRUE); 00643 DST_put_idx_attribute(" default_value", 00644 DST_FORMAL_PARAMETER_default_val(attr), FALSE); 00645 DST_put_idx_attribute(" abstract_origin", 00646 DST_FORMAL_PARAMETER_abstract_origin(attr), FALSE); 00647 DST_put_assoc(" location", flag, DST_FORMAL_PARAMETER_st(attr)); 00648 DST_put_idx_attribute(" dopetype", DST_FORMAL_PARAMETER_dopetype(attr),TRUE); 00649 } 00650 00651 00652 static void 00653 DST_put_unspecified_parameters(DST_flag flag, DST_UNSPECIFIED_PARAMETERS *attr) 00654 { 00655 DST_put_string(":unspecified_parameters:"); 00656 DST_put_decl(DST_FORMAL_PARAMETER_decl(attr)); 00657 } 00658 00659 00660 static void 00661 DST_put_basetype(DST_flag flag, DST_BASETYPE *attr) 00662 { 00663 DST_put_string(":basetype:"); 00664 DST_put_string_attribute(" name", DST_FORMAL_PARAMETER_name(attr)); 00665 DST_put_INT32_attribute(" encoding", DST_BASETYPE_encoding(attr)); 00666 DST_put_INT32_attribute(" byte_size", DST_BASETYPE_byte_size(attr)); 00667 } 00668 00669 00670 static void 00671 DST_put_const_type(DST_flag flag, DST_CONST_TYPE *attr) 00672 { 00673 DST_put_string(":const_type:"); 00674 DST_put_idx_attribute(" type", DST_CONST_TYPE_type(attr), TRUE); 00675 } 00676 00677 static void 00678 DST_put_constant(DST_flag flag, DST_CONSTANT *attr) 00679 { 00680 DST_put_string(":constant:"); 00681 DST_put_decl(DST_CONSTANT_def_decl(attr)); 00682 DST_put_string_attribute(" name", DST_CONSTANT_def_name(attr)); 00683 DST_put_idx_attribute(" type", DST_CONSTANT_def_type(attr), TRUE); 00684 DST_put_const_attribute(" value", DST_CONSTANT_def_cval(attr)); 00685 } 00686 00687 00688 static void 00689 DST_put_volatile_type(DST_flag flag, DST_VOLATILE_TYPE *attr) 00690 { 00691 DST_put_string(":volatile_type:"); 00692 DST_put_idx_attribute(" type", DST_VOLATILE_TYPE_type(attr), TRUE); 00693 } 00694 00695 00696 static void 00697 DST_put_pointer_type(DST_flag flag, DST_POINTER_TYPE *attr) 00698 { 00699 DST_put_string(":pointer_type:"); 00700 DST_put_idx_attribute(" type", DST_POINTER_TYPE_type(attr), TRUE); 00701 DST_put_INT32_attribute(" address_class", 00702 DST_POINTER_TYPE_address_class(attr)); 00703 DST_put_INT32_attribute(" byte_size", DST_POINTER_TYPE_byte_size(attr)); 00704 } 00705 00706 00707 static void 00708 DST_put_reference_type(DST_flag flag, DST_REFERENCE_TYPE *attr) 00709 { 00710 DST_put_string(":reference_type:"); 00711 DST_put_idx_attribute(" type", DST_REFERENCE_TYPE_type(attr), TRUE); 00712 DST_put_INT32_attribute(" address_class", 00713 DST_REFERENCE_TYPE_address_class(attr)); 00714 DST_put_INT32_attribute(" byte_size", DST_REFERENCE_TYPE_byte_size(attr)); 00715 } 00716 00717 00718 static void 00719 DST_put_typedef(DST_flag flag, DST_TYPEDEF *attr) 00720 { 00721 DST_put_string(":typedef:"); 00722 DST_put_decl(DST_TYPEDEF_decl(attr)); 00723 DST_put_string_attribute(" name", DST_TYPEDEF_name(attr)); 00724 DST_put_idx_attribute(" type", DST_TYPEDEF_type(attr), TRUE); 00725 DST_put_idx_attribute(" abstract_origin", 00726 DST_TYPEDEF_abstract_origin(attr), FALSE); 00727 } 00728 00729 00730 static void 00731 DST_put_array_type(DST_flag flag, DST_ARRAY_TYPE *attr) 00732 { 00733 DST_put_string(":array_type:"); 00734 DST_put_decl(DST_ARRAY_TYPE_decl(attr)); 00735 DST_put_string_attribute(" name", DST_ARRAY_TYPE_name(attr)); 00736 DST_put_idx_attribute(" type", DST_ARRAY_TYPE_type(attr), TRUE); 00737 DST_put_INT32_attribute(" byte_size", DST_ARRAY_TYPE_byte_size(attr)); 00738 DST_put_idx_attribute(" abstract_origin", 00739 DST_ARRAY_TYPE_abstract_origin(attr), FALSE); 00740 if (DST_IS_declaration(flag)) 00741 DST_put_string(" declaration"); 00742 } 00743 00744 00745 static void 00746 DST_put_subrange_type(DST_flag flag, DST_SUBRANGE_TYPE *attr) 00747 { 00748 char * p; 00749 DST_put_string(":subrange_type:"); 00750 if (DST_IS_lb_cval(flag)) 00751 DST_put_INT32_attribute(" lower", 00752 DST_SUBRANGE_TYPE_lower_cval(attr)); 00753 else 00754 DST_put_idx_attribute(" lower", 00755 DST_SUBRANGE_TYPE_lower_ref(attr), FALSE); 00756 00757 p = " upper"; 00758 if (DST_IS_count(flag)) 00759 p = " count"; 00760 00761 if (DST_IS_ub_cval(flag)) 00762 DST_put_INT32_attribute(p, 00763 DST_SUBRANGE_TYPE_upper_cval(attr)); 00764 else 00765 DST_put_idx_attribute(p, 00766 DST_SUBRANGE_TYPE_upper_ref(attr), FALSE); 00767 00768 00769 if (DST_IS_stride_1byte(flag)) 00770 p = " stride_1byte" ; 00771 00772 else if (DST_IS_stride_2byte(flag)) 00773 p = " stride_2byte" ; 00774 00775 else 00776 p = " stride" ; 00777 00778 DST_put_idx_attribute(p,DST_SUBRANGE_TYPE_stride_ref(attr), FALSE); 00779 } 00780 00781 static void 00782 DST_put_string_type(DST_flag flag, DST_STRING_TYPE *attr) 00783 { 00784 DST_put_string(":string_type:"); 00785 DST_put_decl(DST_STRING_TYPE_decl(attr)); 00786 DST_put_string_attribute(" name", DST_STRING_TYPE_name(attr)); 00787 if (DST_IS_cval(flag)) 00788 DST_put_INT32_attribute(" length", 00789 DST_STRING_TYPE_len_cval(attr)); 00790 else 00791 DST_put_idx_attribute(" length", 00792 DST_STRING_TYPE_len_ref(attr), FALSE); 00793 } 00794 00795 static void 00796 DST_put_structure_type(DST_flag flag, DST_STRUCTURE_TYPE *attr) 00797 { 00798 DST_put_string(":structure_type:"); 00799 DST_put_decl(DST_STRUCTURE_TYPE_decl(attr)); 00800 DST_put_string_attribute(" name", DST_STRUCTURE_TYPE_name(attr)); 00801 DST_put_INT32_attribute(" byte_size", DST_STRUCTURE_TYPE_byte_size(attr)); 00802 DST_put_idx_attribute(" abstract_origin", 00803 DST_STRUCTURE_TYPE_abstract_origin(attr), FALSE); 00804 if (DST_IS_declaration(flag)) 00805 DST_put_string(" declaration"); 00806 } 00807 00808 static void 00809 DST_put_class_type(DST_flag flag, DST_CLASS_TYPE *attr) 00810 { 00811 DST_put_string(":class_type:"); 00812 DST_put_decl(DST_CLASS_TYPE_decl(attr)); 00813 DST_put_string_attribute(" name", DST_CLASS_TYPE_name(attr)); 00814 DST_put_INT32_attribute(" byte_size", DST_CLASS_TYPE_byte_size(attr)); 00815 DST_put_idx_attribute(" abstract_origin", 00816 DST_CLASS_TYPE_abstract_origin(attr), FALSE); 00817 if (DST_IS_declaration(flag)) 00818 DST_put_string(" declaration"); 00819 } 00820 00821 00822 static void 00823 DST_put_union_type(DST_flag flag, DST_UNION_TYPE *attr) 00824 { 00825 DST_put_string(":union_type:"); 00826 DST_put_decl(DST_UNION_TYPE_decl(attr)); 00827 DST_put_string_attribute(" name", DST_UNION_TYPE_name(attr)); 00828 DST_put_INT32_attribute(" byte_size", DST_UNION_TYPE_byte_size(attr)); 00829 DST_put_idx_attribute(" abstract_origin", 00830 DST_UNION_TYPE_abstract_origin(attr), FALSE); 00831 if (DST_IS_declaration(flag)) 00832 DST_put_string(" declaration"); 00833 } 00834 00835 00836 static void 00837 DST_put_member(DST_flag flag, DST_MEMBER *attr) 00838 { 00839 DST_put_string(":member:"); 00840 DST_put_decl(DST_MEMBER_decl(attr)); 00841 DST_put_string_attribute(" name", DST_MEMBER_name(attr)); 00842 DST_put_idx_attribute(" type", DST_MEMBER_type(attr), TRUE); 00843 DST_put_INT32_attribute(" data_member_location", 00844 DST_MEMBER_memb_loc(attr)); 00845 DST_put_idx_attribute(" dopetype", DST_MEMBER_dopetype(attr),TRUE); 00846 00847 if (DST_IS_bitfield(flag)) 00848 { 00849 DST_put_INT32_attribute(" byte_size", DST_MEMBER_byte_size(attr)); 00850 DST_put_INT32_attribute(" bit_offset", DST_MEMBER_bit_offset(attr)); 00851 DST_put_INT32_attribute(" bit_size", DST_MEMBER_bit_size(attr)); 00852 } 00853 if (DST_IS_declaration(flag)) 00854 DST_put_string(" declaration"); 00855 if (DST_IS_f90_pointer(flag)) 00856 DST_put_string(" f90_pointer"); 00857 if (DST_IS_allocatable(flag)) 00858 DST_put_string(" allocatable"); 00859 if (DST_IS_assumed_shape(flag)) 00860 DST_put_string(" assumed shape"); 00861 } 00862 00863 static void 00864 DST_put_inheritance(DST_flag flag, DST_INHERITANCE *attr) 00865 { 00866 DST_put_string(":inheritance:"); 00867 DST_put_idx_attribute(" type", DST_INHERITANCE_type(attr), TRUE); 00868 DST_put_INT32_attribute(" data_member_location", 00869 DST_INHERITANCE_memb_loc(attr)); 00870 } 00871 00872 00873 static void 00874 DST_put_template_type_param(DST_flag flag, 00875 DST_TEMPLATE_TYPE_PARAMETER *attr) 00876 { 00877 DST_put_string(":template_type_param:"); 00878 DST_put_string_attribute(" name", DST_TEMPLATE_TYPE_PARAMETER_name(attr)); 00879 DST_put_idx_attribute(" type", DST_TEMPLATE_TYPE_PARAMETER_type(attr), 00880 TRUE); 00881 } 00882 00883 00884 static void 00885 DST_put_template_value_param(DST_flag flag, 00886 DST_TEMPLATE_VALUE_PARAMETER *attr) 00887 { 00888 DST_put_string(":template_value_param:"); 00889 DST_put_string_attribute(" name", DST_TEMPLATE_VALUE_PARAMETER_name(attr)); 00890 DST_put_const_attribute(" value", DST_TEMPLATE_VALUE_PARAMETER_cval(attr)); 00891 } 00892 00893 00894 static void 00895 DST_put_enumeration_type(DST_flag flag, DST_ENUMERATION_TYPE *attr) 00896 { 00897 DST_put_string(":enumeration_type:"); 00898 DST_put_decl(DST_ENUMERATION_TYPE_decl(attr)); 00899 DST_put_string_attribute(" name", DST_ENUMERATION_TYPE_name(attr)); 00900 DST_put_INT32_attribute(" byte_size", DST_ENUMERATION_TYPE_byte_size(attr)); 00901 DST_put_idx_attribute(" abstract_origin", 00902 DST_ENUMERATION_TYPE_abstract_origin(attr), FALSE); 00903 if (DST_IS_declaration(flag)) 00904 DST_put_string(" declaration"); 00905 } 00906 00907 00908 static void 00909 DST_put_enumerator(DST_flag flag, DST_ENUMERATOR *attr) 00910 { 00911 DST_put_string(":enumerator:"); 00912 DST_put_decl(DST_ENUMERATOR_decl(attr)); 00913 DST_put_string_attribute(" name", DST_ENUMERATOR_name(attr)); 00914 DST_put_const_attribute(" const_value", DST_ENUMERATOR_cval(attr)); 00915 } 00916 00917 00918 static void 00919 DST_put_subroutine_type(DST_flag flag, DST_SUBROUTINE_TYPE *attr) 00920 { 00921 DST_put_string(":subroutine_type:"); 00922 DST_put_decl(DST_SUBROUTINE_TYPE_decl(attr)); 00923 DST_put_string_attribute(" name", DST_SUBROUTINE_TYPE_name(attr)); 00924 DST_put_idx_attribute(" type", DST_SUBROUTINE_TYPE_type(attr), TRUE); 00925 DST_put_idx_attribute(" abstract_origin", 00926 DST_SUBROUTINE_TYPE_abstract_origin(attr), FALSE); 00927 if (DST_IS_prototyped(flag)) 00928 DST_put_string(" prototyped"); 00929 } 00930 00931 00932 00933 /*------------------------------------------------ 00934 * Dump routines for info, and include files/dirs 00935 *------------------------------------------------*/ 00936 00937 00938 static INT32 00939 DST_dump_info(INT32 indentation, 00940 DST_DW_tag tag, 00941 DST_flag flag, 00942 DST_ATTR_IDX iattr, 00943 DST_INFO_IDX iinfo) 00944 { 00945 DST_write_line(); 00946 00947 if (indentation > 80) { 00948 DST_put_string("infinite loop while dumping DST?"); 00949 DST_write_line(); 00950 exit(RC_INTERNAL_ERROR); 00951 } 00952 00953 /* Put the index for this info */ 00954 DST_nput_char(indentation, ' '); 00955 DST_put_idx(iinfo); 00956 00957 switch (tag) 00958 { 00959 case DW_TAG_compile_unit: 00960 DST_put_compile_unit(flag, 00961 DST_ATTR_IDX_TO_PTR(iattr, DST_COMPILE_UNIT)); 00962 break; 00963 case DW_TAG_subprogram: 00964 DST_put_subprogram(flag, 00965 DST_ATTR_IDX_TO_PTR(iattr, DST_SUBPROGRAM)); 00966 break; 00967 case DW_TAG_inlined_subroutine: 00968 DST_put_inlined_subroutine(flag, 00969 DST_ATTR_IDX_TO_PTR(iattr, 00970 DST_INLINED_SUBROUTINE)); 00971 break; 00972 case DW_TAG_entry_point: 00973 DST_put_entry_point(flag, 00974 DST_ATTR_IDX_TO_PTR(iattr, DST_ENTRY_POINT)); 00975 break; 00976 case DW_TAG_common_block: 00977 DST_put_common_block(flag, 00978 DST_ATTR_IDX_TO_PTR(iattr, DST_COMMON_BLOCK)); 00979 break; 00980 case DW_TAG_common_inclusion: 00981 DST_put_common_inclusion(flag, 00982 DST_ATTR_IDX_TO_PTR(iattr, DST_COMMON_INCL)); 00983 break; 00984 case DW_TAG_lexical_block: 00985 DST_put_lexical_block(flag, 00986 DST_ATTR_IDX_TO_PTR(iattr, DST_LEXICAL_BLOCK)); 00987 break; 00988 case DW_TAG_label: 00989 DST_put_label(flag, 00990 DST_ATTR_IDX_TO_PTR(iattr, DST_LABEL)); 00991 break; 00992 case DW_TAG_variable: 00993 DST_put_variable(flag, 00994 DST_ATTR_IDX_TO_PTR(iattr, DST_VARIABLE)); 00995 break; 00996 case DW_TAG_formal_parameter: 00997 DST_put_formal_parameter( 00998 flag, 00999 DST_ATTR_IDX_TO_PTR(iattr, DST_FORMAL_PARAMETER)); 01000 break; 01001 case DW_TAG_unspecified_parameters: 01002 DST_put_unspecified_parameters( 01003 flag, 01004 DST_ATTR_IDX_TO_PTR(iattr, DST_UNSPECIFIED_PARAMETERS)); 01005 break; 01006 case DW_TAG_base_type: 01007 DST_put_basetype(flag, 01008 DST_ATTR_IDX_TO_PTR(iattr, DST_BASETYPE)); 01009 break; 01010 case DW_TAG_const_type: 01011 DST_put_const_type(flag, 01012 DST_ATTR_IDX_TO_PTR(iattr, DST_CONST_TYPE)); 01013 break; 01014 case DW_TAG_constant: 01015 DST_put_constant(flag, 01016 DST_ATTR_IDX_TO_PTR(iattr, DST_CONSTANT)); 01017 break; 01018 case DW_TAG_volatile_type: 01019 DST_put_volatile_type(flag, 01020 DST_ATTR_IDX_TO_PTR(iattr, DST_VOLATILE_TYPE)); 01021 break; 01022 case DW_TAG_pointer_type: 01023 DST_put_pointer_type(flag, 01024 DST_ATTR_IDX_TO_PTR(iattr, DST_POINTER_TYPE)); 01025 break; 01026 case DW_TAG_reference_type: 01027 DST_put_reference_type(flag, 01028 DST_ATTR_IDX_TO_PTR(iattr, DST_REFERENCE_TYPE)); 01029 break; 01030 case DW_TAG_typedef: 01031 DST_put_typedef(flag, 01032 DST_ATTR_IDX_TO_PTR(iattr, DST_TYPEDEF)); 01033 break; 01034 case DW_TAG_array_type: 01035 DST_put_array_type(flag, 01036 DST_ATTR_IDX_TO_PTR(iattr, DST_ARRAY_TYPE)); 01037 break; 01038 case DW_TAG_subrange_type: 01039 DST_put_subrange_type(flag, 01040 DST_ATTR_IDX_TO_PTR(iattr, DST_SUBRANGE_TYPE)); 01041 break; 01042 case DW_TAG_string_type: 01043 DST_put_string_type(flag, 01044 DST_ATTR_IDX_TO_PTR(iattr, DST_STRING_TYPE)); 01045 break; 01046 case DW_TAG_structure_type: 01047 DST_put_structure_type(flag, 01048 DST_ATTR_IDX_TO_PTR(iattr, DST_STRUCTURE_TYPE)); 01049 break; 01050 case DW_TAG_class_type: 01051 DST_put_class_type(flag, 01052 DST_ATTR_IDX_TO_PTR(iattr, DST_CLASS_TYPE)); 01053 break; 01054 case DW_TAG_union_type: 01055 DST_put_union_type(flag, 01056 DST_ATTR_IDX_TO_PTR(iattr, DST_UNION_TYPE)); 01057 break; 01058 case DW_TAG_member: 01059 DST_put_member(flag, 01060 DST_ATTR_IDX_TO_PTR(iattr, DST_MEMBER)); 01061 break; 01062 case DW_TAG_inheritance: 01063 DST_put_inheritance(flag, 01064 DST_ATTR_IDX_TO_PTR(iattr, DST_INHERITANCE)); 01065 break; 01066 case DW_TAG_template_type_param: 01067 DST_put_template_type_param(flag, 01068 DST_ATTR_IDX_TO_PTR(iattr, 01069 DST_TEMPLATE_TYPE_PARAMETER)); 01070 break; 01071 case DW_TAG_template_value_param: 01072 DST_put_template_value_param(flag, 01073 DST_ATTR_IDX_TO_PTR(iattr, 01074 DST_TEMPLATE_VALUE_PARAMETER)); 01075 break; 01076 case DW_TAG_enumeration_type: 01077 DST_put_enumeration_type( 01078 flag, 01079 DST_ATTR_IDX_TO_PTR(iattr, DST_ENUMERATION_TYPE)); 01080 break; 01081 case DW_TAG_enumerator: 01082 DST_put_enumerator(flag, 01083 DST_ATTR_IDX_TO_PTR(iattr, DST_ENUMERATOR)); 01084 break; 01085 case DW_TAG_subroutine_type: 01086 DST_put_subroutine_type( 01087 flag, 01088 DST_ATTR_IDX_TO_PTR(iattr, DST_SUBROUTINE_TYPE)); 01089 break; 01090 default: 01091 DST_put_INT32_attribute(">>> Unprintable DW_TAG", tag); 01092 break; 01093 } 01094 DST_write_line(); 01095 return indentation + 2; 01096 } 01097 01098 01099 01100 static void 01101 DST_dump_include_dirs(DST_DIR_IDX dir_idx, INT32 indentation) 01102 { 01103 DST_DIR_IDX idx = dir_idx; 01104 mUINT16 num = 0; 01105 DST_INCLUDE_DIR *dir; 01106 01107 DST_write_line(); 01108 if (!DST_IS_NULL(idx)) 01109 dir = DST_DIR_IDX_TO_PTR(idx); 01110 else 01111 dir = NULL; 01112 01113 while(dir != NULL) 01114 { 01115 num += 1; 01116 DST_put_idx(idx); 01117 DST_put_UINT32_attribute(" ordinal", num); 01118 DST_put_string_attribute(" path", DST_INCLUDE_DIR_path(dir)); 01119 DST_write_line(); 01120 idx = DST_INCLUDE_DIR_next(dir); 01121 if (!DST_IS_NULL(idx)) 01122 dir = DST_DIR_IDX_TO_PTR(idx); 01123 else 01124 dir = NULL; 01125 } 01126 } 01127 01128 01129 01130 static void 01131 DST_dump_files(DST_FILE_IDX file_idx, INT32 indentation) 01132 { 01133 DST_FILE_IDX idx = file_idx; 01134 mUINT16 num = 0; 01135 DST_FILE_NAME *f; 01136 01137 DST_write_line(); 01138 if (!DST_IS_NULL(idx)) 01139 f = DST_FILE_IDX_TO_PTR(idx); 01140 else 01141 f = NULL; 01142 01143 while(f != NULL) 01144 { 01145 num += 1; 01146 DST_put_idx(idx); 01147 DST_put_UINT32_attribute(" ordinal", num); 01148 DST_put_string_attribute(" name", DST_FILE_NAME_name(f)); 01149 DST_put_UINT32_attribute(" path", DST_FILE_NAME_dir(f)); 01150 DST_put_UINT64_attribute(" size", DST_FILE_NAME_size(f)); 01151 DST_put_UINT64_attribute(" modt", DST_FILE_NAME_modt(f)); 01152 DST_write_line(); 01153 idx = DST_FILE_NAME_next(f); 01154 if (!DST_IS_NULL(idx)) 01155 f = DST_FILE_IDX_TO_PTR(idx); 01156 else 01157 f = NULL; 01158 } 01159 } 01160 01161 static void 01162 DST_dump_block_kind (DST_BLOCK_KIND k) 01163 { 01164 switch (k) { 01165 case DST_include_dirs_block: 01166 DST_put_string("include_dirs"); 01167 break; 01168 case DST_file_names_block: 01169 DST_put_string("file_names"); 01170 break; 01171 case DST_macro_info_block: 01172 DST_put_string("macro_info"); 01173 break; 01174 case DST_file_scope_block: 01175 DST_put_string("file_scope"); 01176 break; 01177 case DST_local_scope_block: 01178 DST_put_string("local_scope"); 01179 break; 01180 } 01181 } 01182 01183 01184 /* The main dumping routine! 01185 */ 01186 void 01187 DST_dump(DST_DIR_IDX incl_dirs, 01188 DST_FILE_IDX files, 01189 DST_INFO_IDX compile_unit) 01190 { 01191 DST_BLOCK_IDX i; 01192 01193 /* Initialization */ 01194 next_char = 0; 01195 if (dumpf_name != NULL) { 01196 dumpf = fopen(dumpf_name, "w"); 01197 } 01198 DST_ASSERT(dumpf, "Cannot open DST dump file"); 01199 01200 /* Write the stuff */ 01201 if (!DST_IS_NULL(incl_dirs)) 01202 { 01203 DST_write_line(); 01204 DST_put_string("------------ INCLUDE_DIRECTORIES ------------"); 01205 DST_write_line(); 01206 DST_dump_include_dirs(incl_dirs, 0); 01207 } 01208 if (!DST_IS_NULL(files)) 01209 { 01210 DST_write_line(); 01211 DST_put_string("------------<<<<<<< FILES >>>>>>>------------"); 01212 DST_write_line(); 01213 DST_dump_files(files, 0); 01214 } 01215 if (!DST_IS_NULL(compile_unit)) 01216 { 01217 DST_write_line(); 01218 DST_put_string("------------<<<<<< DST INFO >>>>>------------"); 01219 DST_write_line(); 01220 DST_preorder_visit(compile_unit, 0, &DST_dump_info); 01221 } 01222 DST_put_string("------------<<<< BLOCK INFO >>>------------"); 01223 DST_write_line(); 01224 FOREACH_DST_BLOCK(i) { 01225 sprintf(&tmp_buffer[0], "block %d: ", i); 01226 DST_put_string(&tmp_buffer[0]); 01227 DST_dump_block_kind (((DST_Type *)Current_DST)->dst_blocks[i].kind); 01228 sprintf(&tmp_buffer[0], ", size = %d", 01229 ((DST_Type *)Current_DST)->dst_blocks[i].size); 01230 DST_put_string(&tmp_buffer[0]); 01231 DST_write_line(); 01232 } 01233 /* (void)fclose(dumpf); */ 01234 } 01235 01236 /* alternate entry to dump routine, finds idx values implicitly. */ 01237 void 01238 Dump_DST (FILE *f) 01239 { 01240 DST_IDX inc, fn, cmp; 01241 if (f == NULL) dumpf = stdout; 01242 else dumpf = f; 01243 inc = DST_get_include_dirs(); 01244 fn = DST_get_file_names(); 01245 cmp = DST_get_compile_unit(); 01246 DST_dump (inc, fn, cmp); 01247 } 01248 01249 void 01250 DST_set_dump_filename(char *file_name) 01251 { 01252 dumpf_name = file_name; 01253 }