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
00036
00037 static char USMID[] = "\n@(#)5.0_pl/sources/fecif.c 5.9 10/14/99 12:53:57\n";
00038
00039 #include "defines.h"
00040
00041
00042 #define __NLS_INTERNALS 1
00043
00044
00045 #include <nl_types.h>
00046
00047
00048 #if defined(_HOST_OS_LINUX)
00049 # include <nlcatmsg.h>
00050 #endif
00051
00052
00053
00054 #include <time.h>
00055
00056
00057 #define CIF_VERSION 3
00058
00059 #include "cif.h"
00060
00061 #include "cifprocs.h"
00062
00063
00064 #include "host.m"
00065 #include "host.h"
00066 #include "target.m"
00067 #include "target.h"
00068
00069 #include "globals.m"
00070 #include "tokens.m"
00071 #include "sytb.m"
00072 #include "p_globals.m"
00073 #include "s_globals.m"
00074 #include "debug.m"
00075 #include "cif.m"
00076 #include "fecif.m"
00077
00078 #include "globals.h"
00079 #include "tokens.h"
00080 #include "sytb.h"
00081 #include "p_globals.h"
00082 #include "s_globals.h"
00083 #include "fecif.h"
00084
00085 #if (defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX))
00086 # include <sys/systeminfo.h>
00087 #else
00088 # include <unistd.h>
00089 #endif
00090
00091
00092
00093
00094
00095 static int cif_data_type(int);
00096 static void cif_flush_include_recs (void);
00097 static int get_line_and_file_id (int, int *);
00098 static void output_minimal_object_rec (int);
00099 static void process_attr_list (int, boolean);
00100 static boolean output_struct_ids(opnd_type *);
00101
00102 static char output_buf[2][64];
00103
00104 # define outbuf1 output_buf[0]
00105 # define outbuf2 output_buf[1]
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 void init_cif(char *comp_date_time, char *release_level)
00125 {
00126 char cif_date[9];
00127 char cif_time[9];
00128 char cpu_name[MAXHOSTNAMELEN + 1];
00129 char month[4];
00130 int save_cif_file_id;
00131 char *msg_cat_name;
00132
00133 # if defined(_GETPMC_AVAILABLE)
00134 extern int GETPMC(long *, char *);
00135
00136 union {long int_form;
00137 char char_form[9];
00138 } host_cpu_type;
00139
00140 union host_machine_entry {struct {long mcpmt;
00141 Ulong unused[127];
00142 } fld;
00143 long host_tbl[128];
00144 };
00145
00146 typedef union host_machine_entry host_machine_type;
00147
00148 host_machine_type host_machine_info;
00149
00150 # elif (defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX))
00151 char host_cpu_type[9];
00152 # endif
00153
00154
00155 TRACE (Func_Entry, "init_cif", NULL);
00156
00157 cif_end_unit_column = 0;
00158 cif_file_id = 2;
00159 cif_first_pgm_unit = TRUE;
00160 cif_need_unit_rec = TRUE;
00161 cif_pgm_unit_error_recovery = FALSE;
00162 cif_pgm_unit_start_line = 1;
00163
00164
00165
00166
00167
00168
00169
00170 if ((cif_C_opts & CMD_PROVIDED_CIF) || cif_flags != 0) {
00171
00172 if ((cif_actual_file = fopen(cif_name, "w")) == NULL) {
00173 PRINTMSG(0, 556, Log_Error, 0);
00174 perror("Reason");
00175
00176 # ifdef _DEBUG
00177
00178 fprintf(stderr, " Trying to open file %s\n", cif_name);
00179 system("df /tmp");
00180
00181 # endif
00182
00183 exit_compiler(RC_USER_ERROR);
00184 }
00185 }
00186 else {
00187
00188 if (! get_temp_file("w+", &cif_actual_file, cif_name)) {
00189 PRINTMSG(1, 556, Log_Error, 0);
00190 perror(" Reason");
00191
00192 # ifdef _DEBUG
00193
00194 fprintf(stderr, " Trying to open file %s\n", cif_name);
00195 system("df /tmp");
00196
00197 # endif
00198
00199 exit_compiler(RC_USER_ERROR);
00200 }
00201 }
00202
00203 c_i_f = cif_actual_file;
00204
00205
00206
00207
00208
00209
00210 if (! get_temp_file("w+", &cif_tmp_file, cif_tmp_file_name)) {
00211 PRINTMSG(0, 556, Log_Error, 0);
00212 perror("Reason");
00213
00214 # ifdef _DEBUG
00215
00216 fprintf(stderr, " Trying to open file %s\n", cif_name);
00217 system("df /tmp");
00218
00219 # endif
00220
00221 if (c_i_f == cif_actual_file) {
00222
00223 cif_actual_file = NULL;
00224 }
00225
00226 fclose(c_i_f);
00227
00228 if (! (cif_C_opts & CMD_PROVIDED_CIF)) {
00229 remove(cif_name);
00230 }
00231
00232 exit_compiler(RC_USER_ERROR);
00233 }
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 memcpy(month, comp_date_time+4, 3);
00244
00245 switch (month[0]) {
00246
00247 case 'A':
00248 strcpy(cif_date, (month[1] == 'p') ? "04/" : "08/");
00249 break;
00250
00251 case 'D':
00252 strcpy(cif_date, "12/");
00253 break;
00254
00255 case 'F':
00256 strcpy(cif_date, "02/");
00257 break;
00258
00259 case 'J':
00260 if (month[1] == 'a') {
00261 strcpy(cif_date, "01/");
00262 }
00263 else {
00264 strcpy(cif_date, (month[2] == 'n') ? "06/" : "07/");
00265 }
00266 break;
00267
00268 case 'M':
00269 strcpy(cif_date, (month[2] == 'r') ? "03/" : "05/");
00270 break;
00271
00272 case 'N':
00273 strcpy(cif_date, "11/");
00274 break;
00275
00276 case 'O':
00277 strcpy(cif_date, "10/");
00278 break;
00279
00280 case 'S':
00281 strcpy(cif_date, "09/");
00282 }
00283
00284 cif_date[3] = (comp_date_time[8] == ' ') ? '0' : comp_date_time[8];
00285 cif_date[4] = comp_date_time[9];
00286 cif_date[5] = '/';
00287 cif_date[6] = comp_date_time[14];
00288 cif_date[7] = comp_date_time[15];
00289 cif_date[8] = EOS;
00290
00291 memcpy(cif_time, comp_date_time+18, 8);
00292 cif_time[8] = NULL_CHAR;
00293
00294 # if defined(_HOST_OS_LINUX)
00295 msg_cat_name = "shouldnotgethere";
00296 # else
00297
00298
00299
00300
00301
00302
00303
00304
00305 msg_cat_name = CF90CATPATHNAME;
00306
00307 # endif
00308
00309
00310 # if (defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX))
00311
00312 if (sysinfo(SI_HOSTNAME, cpu_name, ((long int) MAXHOSTNAMELEN)) < 0L) {
00313 Cif_Error();
00314 }
00315
00316 # else
00317
00318
00319
00320
00321 if (gethostname(cpu_name, (MAXHOSTNAMELEN + 1)) < 0) {
00322 Cif_Error();
00323 }
00324
00325 # endif
00326
00327
00328 # if defined(_GETPMC_AVAILABLE)
00329 GETPMC (host_machine_info.host_tbl, "HOST");
00330 host_cpu_type.int_form = host_machine_info.fld.mcpmt;
00331 host_cpu_type.char_form[8] = NULL_CHAR;
00332 # elif defined(_HOST_OS_SOLARIS)
00333 strcpy(host_cpu_type, "SPARC");
00334 # elif defined(_HOST_OS_IRIX)
00335 strcpy(host_cpu_type, "SGI");
00336 # elif defined(_HOST_OS_LINUX)
00337 strcpy(host_cpu_type, "INTEL");
00338 # endif
00339
00340
00341 Cif_Cifhdr_Rec(c_i_f,
00342 CIF_LG_F90,
00343 release_level,
00344 cif_date,
00345 cif_time,
00346 group_code,
00347 1,
00348 cpu_name,
00349
00350 # if defined(_GETPMC_AVAILABLE)
00351 host_cpu_type.char_form);
00352 # elif (defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX))
00353 host_cpu_type);
00354 # endif
00355
00356 Cif_Src_Pos_Rec(c_i_f,
00357 CIF_SRC_KIND_MAIN,
00358 2,
00359 0,
00360 0,
00361 0,
00362 2,
00363 0,
00364 0,
00365 0);
00366
00367
00368 save_cif_file_id = cif_file_id;
00369 cif_file_id = 1;
00370
00371 cif_file_name_rec(msg_cat_name, (char *) NULL);
00372
00373 cif_file_id = save_cif_file_id;
00374
00375 if (cif_flags & COMPILER_RECS) {
00376 cif_enable_disable_rec();
00377 cif_misc_compiler_opts_rec();
00378 cif_optimization_opts_rec();
00379 cif_machine_characteristics_rec();
00380 }
00381
00382
00383
00384
00385
00386
00387
00388 if (orig_cmd_line != NULL) {
00389 Cif_Orig_Cmd(c_i_f, orig_cmd_line);
00390 MEM_FREE(orig_cmd_line);
00391 }
00392
00393
00394
00395
00396
00397
00398
00399 c_i_f = cif_tmp_file;
00400
00401 TRACE (Func_Exit, "init_cif", NULL);
00402
00403 return;
00404
00405 }
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424 void cif_prog_unit_init(void)
00425 {
00426
00427 TRACE (Func_Entry, "cif_prog_unit_init", NULL);
00428
00429 cif_derived_type_id = 101;
00430 cif_symbol_or_scope_id = 3;
00431
00432
00433 SCP_CIF_ID(curr_scp_idx) =
00434 (BLK_TYPE(blk_stk_idx) == Program_Blk) ? 1 : NEXT_SCOPE_ID;
00435
00436 cif_end_unit_column = 0;
00437 cif_need_unit_rec = TRUE;
00438 cif_pgm_unit_error_recovery = FALSE;
00439
00440 c_i_f = cif_tmp_file;
00441
00442 TRACE (Func_Exit, "cif_prog_unit_init", NULL);
00443
00444 return;
00445
00446 }
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476 void cif_send_sytb()
00477 {
00478 int al_idx;
00479 int attr_idx;
00480 long_type blk_len;
00481 int module_symbol_id;
00482 int name_idx;
00483 long_type result[MAX_WORDS_FOR_INTEGER];
00484 int sb_idx;
00485 int stor_class;
00486 int type_idx;
00487
00488
00489 TRACE (Func_Entry, "cif_send_sytb", NULL);
00490
00491 for (sb_idx = 1; sb_idx <= stor_blk_tbl_idx; sb_idx++) {
00492
00493 if (SB_SCP_IDX(sb_idx) != curr_scp_idx) {
00494 continue;
00495 }
00496
00497 if (SB_CIF_SYMBOL_ID(sb_idx) == 0) {
00498 SB_CIF_SYMBOL_ID(sb_idx) = NEXT_SYMBOL_ID;
00499 }
00500
00501 if (SB_BLK_TYPE(sb_idx) == Common) {
00502 stor_class = CIF_CB_REG;
00503 }
00504 else if (SB_BLK_TYPE(sb_idx) == Task_Common) {
00505 stor_class = CIF_CB_TASK;
00506 }
00507 else {
00508 continue;
00509 }
00510
00511 if (SB_USE_ASSOCIATED(sb_idx)) {
00512
00513 if (AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx)) == 0) {
00514 AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx)) = NEXT_SYMBOL_ID;
00515 }
00516
00517 module_symbol_id = AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx));
00518 }
00519 else {
00520
00521
00522
00523
00524
00525
00526
00527
00528 module_symbol_id = 0;
00529
00530 if (SB_ORIG_SCP_IDX(sb_idx) != NULL_IDX) {
00531 attr_idx = SCP_ATTR_IDX(SB_ORIG_SCP_IDX(sb_idx));
00532
00533 if (ATP_PGM_UNIT(attr_idx) == Module) {
00534 module_symbol_id = AT_CIF_SYMBOL_ID(attr_idx);
00535 }
00536 }
00537 }
00538
00539
00540
00541
00542 blk_len = 0;
00543
00544 if (SB_LEN_FLD(sb_idx) == CN_Tbl_Idx) {
00545 type_idx = CN_TYPE_IDX(SB_LEN_IDX(sb_idx));
00546
00547 if (folder_driver((char *) &CN_CONST(SB_LEN_IDX(sb_idx)),
00548 CN_TYPE_IDX(SB_LEN_IDX(sb_idx)),
00549 (char *) &CN_CONST(CN_INTEGER_THREE_IDX),
00550 CN_TYPE_IDX(CN_INTEGER_THREE_IDX),
00551 result,
00552 &type_idx,
00553 SB_DEF_LINE(sb_idx),
00554 SB_DEF_COLUMN(sb_idx),
00555 2,
00556 Shiftr_Opr)) {
00557 blk_len = (long) F_INT_TO_C(result, TYP_LINEAR(type_idx));
00558 }
00559 }
00560
00561
00562
00563
00564 Cif_F90_Comblk_Rec(c_i_f,
00565 SB_NAME_PTR(sb_idx),
00566 SB_CIF_SYMBOL_ID(sb_idx),
00567 SCP_CIF_ID(curr_scp_idx),
00568 stor_class,
00569 module_symbol_id,
00570 blk_len,
00571 0);
00572 }
00573
00574 if (cif_flags & INFO_RECS) {
00575
00576 for (name_idx = SCP_LN_FW_IDX(curr_scp_idx) + 1;
00577 name_idx < SCP_LN_LW_IDX(curr_scp_idx); name_idx++) {
00578
00579 attr_idx = LN_ATTR_IDX(name_idx);
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
00607 ATD_CLASS(attr_idx) == Variable &&
00608 ! ATD_SEEN_OUTSIDE_IMP_DO(attr_idx) &&
00609 ! ATD_SEEN_AS_IO_LCV(attr_idx)) {
00610 continue;
00611 }
00612
00613 cif_send_attr(attr_idx, NULL_IDX);
00614 }
00615
00616 process_attr_list(SCP_ATTR_LIST(curr_scp_idx), FALSE);
00617 process_attr_list(SCP_CIF_ERR_LIST(curr_scp_idx), TRUE);
00618 }
00619 else {
00620
00621
00622
00623 for (name_idx = SCP_LN_FW_IDX(curr_scp_idx) + 1;
00624 name_idx < SCP_LN_LW_IDX(curr_scp_idx); name_idx++) {
00625
00626 attr_idx = LN_ATTR_IDX(name_idx);
00627
00628
00629
00630 if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit &&
00631 AT_OBJ_CLASS(attr_idx) != Stmt_Func &&
00632 AT_OBJ_CLASS(attr_idx) != Interface) {
00633 continue;
00634 }
00635
00636 cif_send_attr(attr_idx, NULL_IDX);
00637 }
00638
00639
00640
00641
00642
00643
00644 al_idx = SCP_ATTR_LIST(curr_scp_idx);
00645
00646 while (al_idx != NULL_IDX) {
00647
00648 if ((AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
00649 AT_CIF_SYMBOL_ID(AL_ATTR_IDX(al_idx)) == 0) ||
00650 AT_OBJ_CLASS(attr_idx) == Interface) {
00651 cif_send_attr(AL_ATTR_IDX(al_idx), NULL_IDX);
00652 }
00653
00654 al_idx = AL_NEXT_IDX(al_idx);
00655 }
00656 }
00657
00658 TRACE (Func_Exit, "cif_send_sytb", NULL);
00659
00660 return;
00661
00662 }
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682 void cif_send_attr(int attr_idx,
00683 int dt_attr_idx)
00684
00685 {
00686 long attributes;
00687 int bd_idx;
00688 char buffer[160];
00689 char char_len[20];
00690 int darg_idx;
00691 linear_type_type data_type;
00692 int derived_type;
00693 int dt_idx;
00694 int i;
00695 int interface_idx;
00696 int interface_type;
00697 int namelist_idx;
00698 int num_dargs;
00699 int num_namelist;
00700 char *obj_name_ptr;
00701 long64 offset;
00702 char offset_buf[20];
00703 int pgm_unit_type;
00704 int pointer_id;
00705 int rslt_id;
00706 int rslt_idx;
00707 boolean save_cif_done;
00708 # if 0
00709 int save_symbol_id;
00710 # endif
00711 int scope_id;
00712 int sn_idx;
00713 int storage_class;
00714 int storage_id;
00715 char string[20];
00716 int symbol_class;
00717 int type_idx;
00718
00719
00720 TRACE (Func_Entry, "cif_send_attr", NULL);
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757 if (AT_CIF_DONE(attr_idx)) {
00758 goto EXIT;
00759 }
00760
00761 if (!AT_CIF_IN_USAGE_REC(attr_idx) &&
00762 ((AT_COMPILER_GEND(attr_idx) &&
00763 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
00764 ATD_CLASS(attr_idx) != Compiler_Tmp ||
00765 ! ATD_TMP_NEEDS_CIF(attr_idx))) ||
00766 (AT_ATTR_LINK(attr_idx) != NULL_IDX &&
00767 AT_OBJ_CLASS(attr_idx) != Pgm_Unit))) {
00768 goto EXIT;
00769 }
00770
00771
00772 AT_CIF_DONE(attr_idx) = TRUE;
00773
00774
00775 switch (AT_OBJ_CLASS(attr_idx)) {
00776
00777
00778
00779
00780
00781 case Data_Obj:
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800 if (AT_DCL_ERR(attr_idx)) {
00801 output_minimal_object_rec(attr_idx);
00802 goto EXIT;
00803 }
00804
00805 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
00806 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
00807 }
00808
00809 char_len[0] = NULL_CHAR;
00810 type_idx = ATD_TYPE_IDX(attr_idx);
00811
00812 if (TYP_TYPE(type_idx) == Structure) {
00813
00814 if (! AT_DCL_ERR(TYP_IDX(type_idx))) {
00815 dt_idx = (AT_ATTR_LINK(TYP_IDX(type_idx)) == NULL_IDX) ?
00816 TYP_IDX(type_idx) : AT_ATTR_LINK(TYP_IDX(type_idx));
00817 }
00818 else {
00819 output_minimal_object_rec(attr_idx);
00820 goto EXIT;
00821 }
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832 if (ATT_CIF_DT_ID(dt_idx) == 0) {
00833 cif_send_attr(dt_idx, NULL_IDX);
00834 }
00835
00836
00837 data_type = (linear_type_type) ATT_CIF_DT_ID(dt_idx);
00838 }
00839 else {
00840 data_type = TYP_LINEAR(type_idx);
00841
00842 if (TYP_TYPE(type_idx) == Character) {
00843
00844 if (TYP_FLD(type_idx) == CN_Tbl_Idx) {
00845 convert_to_string(&CN_CONST(TYP_IDX(type_idx)),
00846 CN_TYPE_IDX(TYP_IDX(type_idx)),
00847 char_len);
00848 }
00849 else {
00850 char_len[0] = (TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char) ?
00851 ASSUMED_SIZE_CHAR :
00852 VAR_LEN_CHAR;
00853 char_len[1] = NULL_CHAR;
00854 }
00855 }
00856 }
00857
00858
00859 obj_name_ptr = AT_OBJ_NAME_PTR(attr_idx);
00860
00861 switch (ATD_CLASS(attr_idx)) {
00862
00863 case Struct_Component:
00864 storage_class = CIF_F90_ST_NO_STORAGE;
00865 storage_id = 0;
00866 offset = (ATD_OFFSET_FLD(attr_idx) == CN_Tbl_Idx) ?
00867 CN_INT_TO_C(ATD_CPNT_OFFSET_IDX(attr_idx)) : -1;
00868 symbol_class = CIF_F90_SC_STRUCT;
00869 attributes = 0;
00870 derived_type = ATT_CIF_DT_ID(dt_attr_idx);
00871 break;
00872
00873 case Constant:
00874 storage_class = CIF_F90_ST_NO_STORAGE;
00875
00876 if (AT_USE_ASSOCIATED(attr_idx)) {
00877
00878 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
00879
00880
00881
00882
00883
00884
00885
00886
00887 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
00888 }
00889
00890 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
00891 }
00892 else if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
00893 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
00894 }
00895 else {
00896 storage_id = 0;
00897 }
00898
00899 offset = -1;
00900 symbol_class = CIF_F90_SC_NAMED_CONST;
00901 attributes = 0;
00902 derived_type = 0;
00903
00904
00905
00906
00907
00908 if (AT_USE_ASSOCIATED(attr_idx)) {
00909 cif_named_constant_rec(attr_idx, 0, 0);
00910 }
00911
00912 break;
00913
00914 case Function_Result:
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929 if (get_other_func_rslt_info) {
00930
00931 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure) {
00932 AT_CIF_DONE(dt_idx) = FALSE;
00933 AT_CIF_SYMBOL_ID(dt_idx) = 0;
00934 ATT_CIF_DT_ID(dt_idx) = 0;
00935 cif_send_attr(dt_idx, NULL_IDX);
00936 data_type = (linear_type_type) ATT_CIF_DT_ID(dt_idx);
00937 }
00938 }
00939
00940
00941 if (ATD_STOR_BLK_IDX(attr_idx) == NULL_IDX) {
00942 storage_class = CIF_F90_ST_NO_STORAGE;
00943 storage_id = 0;
00944 }
00945 else {
00946
00947
00948
00949 storage_class =
00950 (SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Formal) ?
00951 CIF_F90_ST_DUMMY : CIF_F90_ST_STACK;
00952
00953
00954
00955
00956 storage_id = (AT_USE_ASSOCIATED(attr_idx)) ?
00957 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) : 0;
00958 }
00959
00960 offset = -1;
00961 symbol_class = CIF_F90_SC_FUNC_RESULT;
00962 attributes = 0;
00963 derived_type = 0;
00964
00965 if (ATP_PROC(ATD_FUNC_IDX(attr_idx)) == Intrin_Proc &&
00966 AT_OBJ_NAME(attr_idx) == '_') {
00967 ++obj_name_ptr;
00968 }
00969
00970 break;
00971
00972 case Dummy_Argument:
00973 derived_type = 0;
00974 symbol_class = CIF_F90_SC_VARIABLE;
00975 attributes = (AT_CIF_USE_IN_BND(attr_idx)) ? CIF_DARG_IN_BND : 0;
00976 storage_id = 0;
00977
00978 if (ATD_SF_DARG(attr_idx)) {
00979 offset = -1;
00980 storage_class = CIF_F90_ST_NO_STORAGE;
00981 }
00982 else {
00983
00984
00985
00986
00987
00988
00989
00990
00991 storage_class = CIF_F90_ST_DUMMY;
00992 offset = 0;
00993 sn_idx = ATP_FIRST_IDX(SCP_ATTR_IDX(curr_scp_idx));
00994
00995 for (i = 1; i <= ATP_NUM_DARGS(SCP_ATTR_IDX(curr_scp_idx)); ++i) {
00996
00997 if (attr_idx == SN_ATTR_IDX(sn_idx)) {
00998 offset = (ATP_EXTRA_DARG(SCP_ATTR_IDX(curr_scp_idx))) ?
00999 (i - 1) : i;
01000 break;
01001 }
01002 else {
01003 ++sn_idx;
01004 }
01005 }
01006 }
01007
01008 break;
01009
01010 default:
01011 derived_type = 0;
01012 symbol_class = CIF_F90_SC_VARIABLE;
01013 attributes = 0;
01014 offset = (ATD_OFFSET_ASSIGNED(attr_idx) &&
01015 ATD_OFFSET_FLD(attr_idx) == CN_Tbl_Idx) ?
01016 CN_INT_TO_C(ATD_OFFSET_IDX(attr_idx)) : -1;
01017
01018 storage_id = SB_CIF_SYMBOL_ID(ATD_STOR_BLK_IDX(attr_idx));
01019
01020 switch (SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx))) {
01021
01022 case Static:
01023 case Static_Local:
01024 case Static_Named:
01025
01026 if (ATD_ALLOCATABLE(attr_idx) || ATD_POINTER(attr_idx)) {
01027 storage_class = CIF_F90_ST_BASED;
01028 }
01029 else {
01030 storage_class = CIF_F90_ST_STATIC;
01031 }
01032
01033 if (SB_MODULE(ATD_STOR_BLK_IDX(attr_idx))) {
01034 symbol_class = CIF_F90_SC_MODULE;
01035
01036 storage_id = (AT_USE_ASSOCIATED(attr_idx)) ?
01037 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) :
01038 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
01039 }
01040
01041 break;
01042
01043 case Stack:
01044 case Equivalenced:
01045 if (ATD_ALLOCATABLE(attr_idx) || ATD_POINTER(attr_idx)) {
01046 storage_class = CIF_F90_ST_BASED;
01047 }
01048 else {
01049 storage_class = (ATD_AUXILIARY(attr_idx) == 0) ?
01050 CIF_F90_ST_STACK : CIF_F90_ST_AUXILIARY;
01051 }
01052
01053 break;
01054
01055 case Common:
01056 case Task_Common:
01057 symbol_class = (ATD_EQUIV(attr_idx) && !ATD_IN_COMMON(attr_idx)) ?
01058 CIF_F90_SC_EQUIV :
01059 CIF_F90_SC_COMMON;
01060 storage_class = (ATD_AUXILIARY(attr_idx) == 0) ?
01061 CIF_F90_ST_COMMON : CIF_F90_ST_AUXILIARY;
01062 break;
01063
01064 case Formal:
01065 storage_class = CIF_F90_ST_DUMMY;
01066 break;
01067
01068 case Based:
01069 storage_class = (ATD_CLASS(attr_idx) == CRI__Pointee) ?
01070 CIF_F90_ST_POINTEE : CIF_F90_ST_BASED;
01071 break;
01072
01073 default:
01074 storage_class = CIF_F90_ST_ERROR;
01075 break;
01076 }
01077 break;
01078 }
01079
01080
01081
01082 switch (TYP_DESC(type_idx)) {
01083 case Default_Typed:
01084 attributes = attributes | CIF_DEFAULT_TYPED;
01085 break;
01086
01087 case Star_Typed:
01088 attributes = attributes | CIF_STAR_TYPED;
01089 break;
01090
01091 case Kind_Typed:
01092 attributes = attributes | CIF_KIND_TYPED;
01093 break;
01094 }
01095
01096 if (!AT_TYPED(attr_idx)) {
01097 attributes = attributes | CIF_IMPLICITLY_TYPED;
01098 }
01099
01100 if (ATD_SAVED(attr_idx)) {
01101 attributes = attributes | CIF_SAVED;
01102 }
01103
01104 if (ATD_DATA_INIT(attr_idx)) {
01105 attributes = attributes | CIF_DATA_INIT;
01106 attributes = attributes | CIF_SAVED;
01107 }
01108
01109 if (ATD_DCL_EQUIV(attr_idx)) {
01110 attributes = attributes | CIF_EQUIVALENCED;
01111 }
01112
01113 if (ATD_ALLOCATABLE(attr_idx)) {
01114 attributes = attributes | CIF_ALLOCATABLE;
01115 }
01116
01117 if (ATD_CLASS(attr_idx) == Dummy_Argument) {
01118
01119 switch (ATD_INTENT(attr_idx)) {
01120 case Intent_Unseen:
01121 break;
01122
01123 case Intent_In:
01124 attributes = attributes | CIF_INTENT_IN;
01125 break;
01126
01127 case Intent_Out:
01128 attributes = attributes | CIF_INTENT_OUT;
01129 break;
01130
01131 case Intent_Inout:
01132 attributes = attributes | CIF_INTENT_INOUT;
01133 break;
01134 }
01135
01136 if (AT_OPTIONAL(attr_idx)) {
01137 attributes = attributes | CIF_OPTIONAL;
01138 }
01139 }
01140
01141 pointer_id = 0;
01142
01143 if (ATD_POINTER(attr_idx)) {
01144 attributes = attributes | CIF_POINTER;
01145 }
01146 else if (ATD_CLASS(attr_idx) == CRI__Pointee) {
01147 attributes = attributes | CIF_CRI_POINTEE;
01148
01149 if (AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx)) == 0) {
01150 AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx)) = NEXT_SYMBOL_ID;
01151 }
01152
01153 pointer_id = AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx));
01154 }
01155
01156 if (AT_PRIVATE(attr_idx)) {
01157 attributes = attributes | CIF_PRIVATE;
01158 }
01159
01160 if (ATD_TARGET(attr_idx)) {
01161 attributes = attributes | CIF_TARGET;
01162 }
01163
01164 if (AT_USE_ASSOCIATED(attr_idx) &&
01165 AT_ORIG_NAME_IDX(attr_idx) != AT_NAME_IDX(attr_idx)) {
01166 attributes = attributes | CIF_RENAMED;
01167 }
01168
01169 scope_id = SCP_CIF_ID(curr_scp_idx);
01170
01171 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
01172 CONVERT_CVAL_TO_STR(&offset, Integer_8, offset_buf);
01173
01174 if (fprintf(c_i_f,
01175 "%d%c%s%c%d%c%d%c%d%c%d%c%d%c%d%c%s%c%lx%c%d%c%s%c%d%c%d%c%d%c%d%c%d%c",
01176 CIF_F90_OBJECT, EOI,
01177 obj_name_ptr, EOI,
01178 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01179 scope_id, EOI,
01180 cif_data_type(data_type), EOI,
01181 symbol_class, EOI,
01182 storage_class, EOI,
01183 storage_id, EOI,
01184 offset_buf, EOI,
01185 attributes, EOI,
01186 derived_type, EOI,
01187 char_len, EOI,
01188 0, EOI,
01189 0, EOI,
01190 0, EOI,
01191 0, EOI,
01192 pointer_id, EOR) < 0) {
01193 Cif_Error();
01194 }
01195 }
01196 else {
01197 bd_idx = ATD_ARRAY_IDX(attr_idx);
01198 buffer[0] = NULL_CHAR;
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221 {
01222
01223 for (i = 1; i <= BD_RANK(bd_idx); i++) {
01224
01225 if (BD_LB_FLD(bd_idx,i) == CN_Tbl_Idx) {
01226 sprintf(string, "%c%s",
01227 EOI,
01228 convert_to_string(&CN_CONST(BD_LB_IDX(bd_idx,i)),
01229 CN_TYPE_IDX(BD_LB_IDX(bd_idx,i)),
01230 outbuf1));
01231 }
01232 else if (BD_LB_FLD(bd_idx,i) != NO_Tbl_Idx) {
01233 string[0] = EOI;
01234 string[1] = VAR_LEN_CHAR;
01235 string[2] = NULL_CHAR;
01236 }
01237
01238 strcat(buffer, string);
01239
01240 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size &&
01241 BD_RANK(bd_idx) == i) {
01242 string[0] = EOI;
01243 string[1] = ASSUMED_SIZE_CHAR;
01244 string[2] = NULL_CHAR;
01245 }
01246 else if (BD_UB_FLD(bd_idx,i) == CN_Tbl_Idx) {
01247 sprintf(string, "%c%s",
01248 EOI,
01249 convert_to_string(&CN_CONST(BD_UB_IDX(bd_idx,i)),
01250 CN_TYPE_IDX(BD_UB_IDX(bd_idx,i)),
01251 outbuf1));
01252 }
01253 else {
01254 string[0] = EOI;
01255 string[1] = (BD_UB_FLD(bd_idx,i) != NO_Tbl_Idx) ?
01256 VAR_LEN_CHAR :
01257 ASSUMED_SIZE_CHAR;
01258 string[2] = NULL_CHAR;
01259 }
01260 strcat(buffer, string);
01261 }
01262 }
01263
01264 CONVERT_CVAL_TO_STR(&offset, Integer_8, offset_buf);
01265
01266 if (fprintf(c_i_f,
01267 "%d%c%s%c%d%c%d%c%d%c%d%c%d%c%d%c%s%c%lx%c%d%c%s%c%d%c%d%s%c%d%c%d%c%d%c",
01268 CIF_F90_OBJECT, EOI,
01269 AT_OBJ_NAME_PTR(attr_idx), EOI,
01270 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01271 SCP_CIF_ID(curr_scp_idx), EOI,
01272 cif_data_type(data_type), EOI,
01273 symbol_class, EOI,
01274 storage_class, EOI,
01275 storage_id, EOI,
01276 offset_buf, EOI,
01277 attributes, EOI,
01278 derived_type, EOI,
01279 char_len, EOI,
01280 BD_RANK(bd_idx), EOI,
01281 BD_ARRAY_CLASS(bd_idx),
01282 buffer, EOI,
01283 0, EOI,
01284 0, EOI,
01285 pointer_id, EOR) < 0) {
01286 Cif_Error();
01287 }
01288 }
01289
01290 break;
01291
01292
01293
01294
01295
01296
01297 case Pgm_Unit:
01298
01299 if (ATP_PROC(attr_idx) != Intrin_Proc &&
01300 ((name_pool[AT_NAME_IDX(attr_idx)].name_char == '$' &&
01301 attr_idx != glb_tbl_idx[Main_Attr_Idx]) ||
01302 name_pool[AT_NAME_IDX(attr_idx)].name_char == '_')) {
01303 break;
01304 }
01305
01306
01307
01308
01309
01310 if (AT_DCL_ERR(attr_idx)) {
01311
01312 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01313 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01314 }
01315
01316 Cif_F90_Entry_Rec(c_i_f,
01317 AT_OBJ_NAME_PTR(attr_idx),
01318 AT_CIF_SYMBOL_ID(attr_idx),
01319 SCP_CIF_ID(curr_scp_idx),
01320 0,
01321 0,
01322 0,
01323 0,
01324 0,
01325 0,
01326 NULL);
01327 goto EXIT;
01328 }
01329
01330 if (ATP_IN_INTERFACE_BLK(attr_idx)) {
01331
01332 if (ATP_SCP_ALIVE(attr_idx)) {
01333 attributes = CIF_PGM_IN_INTERFACE;
01334 }
01335 else if (AT_REFERENCED(attr_idx) != Not_Referenced) {
01336 attributes = CIF_PGM_REFERENCE;
01337 }
01338 else {
01339
01340
01341
01342
01343 AT_CIF_DONE(attr_idx) = FALSE;
01344 goto EXIT;
01345 }
01346 }
01347 else if (ATP_SCP_ALIVE(attr_idx)) {
01348 attributes = CIF_PGM_DEFINITION;
01349 }
01350 else if (AT_REFERENCED(attr_idx) != Not_Referenced &&
01351 ! AT_REF_IN_CHILD(attr_idx)) {
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366 AT_CIF_DONE(attr_idx) = FALSE;
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377 if (AT_IS_DARG(attr_idx)) {
01378
01379 if (ATP_CIF_DARG_PROC(attr_idx)) {
01380 ATP_CIF_DARG_PROC(attr_idx) = FALSE;
01381 }
01382 else {
01383 goto EXIT;
01384 }
01385 }
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395 if (ATP_PROC(attr_idx) == Module_Proc &&
01396 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
01397 goto EXIT;
01398 }
01399 else if (ATP_PGM_UNIT(attr_idx) == Module &&
01400 AT_USE_ASSOCIATED(attr_idx)) {
01401 attributes = CIF_PGM_USE_ASSOCIATED;
01402 }
01403 else {
01404 attributes = CIF_PGM_REFERENCE;
01405 }
01406 }
01407 else if (AT_IS_DARG(attr_idx)) {
01408
01409
01410
01411
01412
01413
01414 attributes = CIF_PGM_REFERENCE;
01415 }
01416 else if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
01417 (ATP_VFUNCTION(attr_idx) ||
01418 ATP_NOSIDE_EFFECTS(attr_idx) ||
01419 ATP_NAME_IN_STONE(attr_idx) ||
01420 ATP_DCL_EXTERNAL(attr_idx))) {
01421
01422
01423
01424
01425
01426
01427 attributes = CIF_PGM_REFERENCE;
01428 }
01429 else if (AT_USE_ASSOCIATED(attr_idx)) {
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439 }
01440 else {
01441
01442
01443
01444
01445
01446 AT_CIF_DONE(attr_idx) = FALSE;
01447 goto EXIT;
01448 }
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466 if (AT_ATTR_LINK(attr_idx) == NULL_IDX) {
01467 get_other_func_rslt_info = FALSE;
01468 }
01469 else if (AT_OBJ_CLASS(AT_ATTR_LINK(attr_idx)) != Interface) {
01470 get_other_func_rslt_info = TRUE;
01471 attr_idx = AT_ATTR_LINK(attr_idx);
01472 }
01473 else {
01474 goto EXIT;
01475 }
01476
01477 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01478 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01479 }
01480
01481 switch (ATP_PGM_UNIT(attr_idx)) {
01482
01483 case Pgm_Unknown:
01484 pgm_unit_type = CIF_F90_ET_UNKNOWN;
01485 num_dargs = ATP_NUM_DARGS(attr_idx);
01486 break;
01487
01488 case Function:
01489 pgm_unit_type =
01490 (ATP_ALT_ENTRY(attr_idx)) ? CIF_F90_ET_ALT_ENTRY :
01491 CIF_F90_ET_FUNCTION;
01492
01493
01494
01495
01496 if (ATP_EXPL_ITRFC(attr_idx) && ATP_EXTRA_DARG(attr_idx)) {
01497 num_dargs = ATP_NUM_DARGS(attr_idx) - 1;
01498 }
01499 else {
01500 num_dargs = ATP_NUM_DARGS(attr_idx);
01501 }
01502
01503 if (AT_USE_ASSOCIATED(attr_idx)) {
01504 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
01505 }
01506
01507 break;
01508
01509 case Subroutine:
01510 pgm_unit_type =
01511 (ATP_ALT_ENTRY(attr_idx)) ? CIF_F90_ET_ALT_ENTRY :
01512 CIF_F90_ET_SUBROUTINE;
01513
01514 num_dargs = ATP_NUM_DARGS(attr_idx);
01515
01516 if (AT_USE_ASSOCIATED(attr_idx)) {
01517 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
01518 }
01519
01520 break;
01521
01522 case Program:
01523 num_dargs = 0;
01524 pgm_unit_type= CIF_F90_ET_PROGRAM;
01525 break;
01526
01527 case Blockdata:
01528 num_dargs = 0;
01529 pgm_unit_type = CIF_F90_ET_BLOCKDATA;
01530 break;
01531
01532 case Module:
01533 num_dargs = 0;
01534 pgm_unit_type= CIF_F90_ET_MODULE;
01535 }
01536
01537 if ((attributes & CIF_PGM_REFERENCE) ||
01538 AT_USE_ASSOCIATED(attr_idx) ||
01539 get_other_func_rslt_info) {
01540 num_dargs = 0;
01541 }
01542
01543
01544 if (AT_OPTIONAL(attr_idx)) {
01545 attributes = attributes | CIF_PGM_OPTIONAL;
01546 }
01547
01548
01549
01550
01551
01552
01553
01554
01555 if (AT_PRIVATE(attr_idx) && ATP_PGM_UNIT(attr_idx) != Module) {
01556 attributes = attributes | CIF_PGM_PRIVATE;
01557 }
01558
01559 if (ATP_RECURSIVE(attr_idx)) {
01560 attributes = attributes | CIF_PGM_RECURSIVE;
01561 }
01562
01563 if (ATP_PGM_UNIT(attr_idx) == Function) {
01564 rslt_idx = ATP_RSLT_IDX(attr_idx);
01565
01566 if (ATP_SCP_ALIVE(attr_idx)) {
01567
01568 if (! AT_CIF_DONE(rslt_idx)) {
01569 cif_send_attr(rslt_idx, NULL_IDX);
01570 }
01571
01572 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01573 }
01574 else {
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591 AT_CIF_DONE(rslt_idx) = FALSE;
01592
01593 # if 0
01594 save_symbol_id = AT_CIF_SYMBOL_ID(rslt_idx);
01595 AT_CIF_SYMBOL_ID(rslt_idx) = 0;
01596 # endif
01597 cif_send_attr(rslt_idx, NULL_IDX);
01598 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01599 # if 0
01600 AT_CIF_SYMBOL_ID(rslt_idx) = save_symbol_id;
01601 # endif
01602 AT_CIF_DONE(rslt_idx) = FALSE;
01603 }
01604 }
01605 else {
01606 rslt_id = 0;
01607 }
01608
01609 if (ATP_PROC(attr_idx) == Module_Proc) {
01610
01611 if (AT_MODULE_IDX(attr_idx) == 0) {
01612 storage_id = (SCP_LEVEL(curr_scp_idx) == 0) ?
01613 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) :
01614 AT_CIF_SYMBOL_ID(
01615 SCP_ATTR_IDX(SCP_PARENT_IDX(curr_scp_idx)));
01616 }
01617 else {
01618
01619 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
01620
01621
01622
01623
01624
01625
01626
01627
01628 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01629 }
01630
01631 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
01632 }
01633 }
01634 else if (AT_USE_ASSOCIATED(attr_idx)) {
01635
01636 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
01637
01638
01639
01640
01641 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01642 }
01643
01644 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
01645 }
01646 else {
01647 storage_id = 0;
01648 }
01649
01650 if (num_dargs != 0) {
01651 sn_idx = ATP_FIRST_IDX(attr_idx);
01652
01653 if (ATP_EXTRA_DARG(attr_idx)) {
01654 ++sn_idx;
01655 }
01656
01657 for (i = 0; i < num_dargs; i++) {
01658 darg_idx = SN_ATTR_IDX(sn_idx++);
01659
01660 if (! AT_COMPILER_GEND(darg_idx)) {
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672 if (AT_OBJ_CLASS(darg_idx) == Pgm_Unit) {
01673 ATP_CIF_DARG_PROC(darg_idx) = TRUE;
01674 }
01675
01676 cif_send_attr(darg_idx, NULL_IDX);
01677 }
01678 }
01679 }
01680
01681 if (fprintf(c_i_f,
01682 "%d%c%s%c%d%c%d%c%d%c%d%c%lx%c%d%c%d%c%d",
01683 CIF_F90_ENTRY, EOI,
01684 AT_OBJ_NAME_PTR(attr_idx), EOI,
01685 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01686 SCP_CIF_ID(curr_scp_idx), EOI,
01687 pgm_unit_type, EOI,
01688 ATP_PROC(attr_idx), EOI,
01689 attributes, EOI,
01690 rslt_id, EOI,
01691 storage_id, EOI,
01692 num_dargs) < 0) {
01693 Cif_Error();
01694 }
01695
01696 if (num_dargs != 0) {
01697 sn_idx = ATP_FIRST_IDX(attr_idx);
01698
01699 if (ATP_EXTRA_DARG(attr_idx)) {
01700 ++sn_idx;
01701 }
01702
01703 for (i = 0; i < num_dargs; i++) {
01704 darg_idx = SN_ATTR_IDX(sn_idx++);
01705
01706 if (AT_COMPILER_GEND(darg_idx)) {
01707 darg_idx = 0;
01708 }
01709 else {
01710 darg_idx = AT_CIF_SYMBOL_ID(darg_idx);
01711 }
01712
01713 if (fprintf(c_i_f, "%c%d", EOI, darg_idx) < 0) {
01714 Cif_Error();
01715 }
01716 }
01717 }
01718
01719 if (fprintf(c_i_f, "\n") < 0) {
01720 Cif_Error();
01721 }
01722
01723 get_other_func_rslt_info = FALSE;
01724
01725 break;
01726
01727
01728
01729
01730
01731
01732 case Label:
01733 cif_label_rec(attr_idx);
01734 break;
01735
01736
01737
01738
01739
01740
01741 case Derived_Type:
01742
01743 # if 0
01744
01745
01746
01747
01748 if (AT_DCL_ERR(attr_idx)) {
01749
01750 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01751 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01752 }
01753
01754 Cif_F90_Derived_Type_Rec(c_i_f,
01755 AT_OBJ_NAME_PTR(attr_idx),
01756 AT_CIF_SYMBOL_ID(attr_idx),
01757 SCP_CIF_ID(curr_scp_idx),
01758 ATT_CIF_DT_ID(attr_idx),
01759 0,
01760 0,
01761 NULL,
01762 0);
01763 goto EXIT;
01764 }
01765 # endif
01766
01767 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01768 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01769 }
01770
01771 if (ATT_CIF_DT_ID(attr_idx) == 0) {
01772 ATT_CIF_DT_ID(attr_idx) = NEXT_DERIVED_TYPE_ID;
01773 }
01774
01775 attributes = (ATT_SEQUENCE_SET(attr_idx)) ? (CIF_DRT_SEQUENCE) : 0;
01776
01777 if (AT_PRIVATE(attr_idx)) {
01778 attributes = attributes | CIF_DRT_PRIVATE;
01779 }
01780
01781 if (ATT_PRIVATE_CPNT(attr_idx)) {
01782 attributes = attributes | CIF_DRT_COMP_PRIVATE;
01783 }
01784
01785 sn_idx = ATT_FIRST_CPNT_IDX(attr_idx);
01786
01787 while (sn_idx != NULL_IDX) {
01788
01789 if (get_other_func_rslt_info) {
01790 AT_CIF_DONE(SN_ATTR_IDX(sn_idx)) = FALSE;
01791 AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) = 0;
01792 }
01793
01794 cif_send_attr(SN_ATTR_IDX(sn_idx), attr_idx);
01795 sn_idx = SN_SIBLING_LINK(sn_idx);
01796 }
01797
01798 if (fprintf(c_i_f, "%d%c%s%c%d%c%d%c%d%c%lx%c%d",
01799 CIF_F90_DERIVED_TYPE, EOI,
01800 AT_OBJ_NAME_PTR(attr_idx), EOI,
01801 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01802 SCP_CIF_ID(curr_scp_idx), EOI,
01803 ATT_CIF_DT_ID(attr_idx), EOI,
01804 attributes, EOI,
01805 ATT_NUM_CPNTS(attr_idx)) < 0) {
01806 Cif_Error();
01807 }
01808
01809 sn_idx = ATT_FIRST_CPNT_IDX(attr_idx);
01810
01811 while (sn_idx != NULL_IDX) {
01812
01813 if (fprintf(c_i_f, "%c%d",
01814 EOI, AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx))) < 0) {
01815 Cif_Error();
01816 }
01817
01818 sn_idx = SN_SIBLING_LINK(sn_idx);
01819 }
01820
01821 if (fprintf(c_i_f, "\n") < 0) {
01822 Cif_Error();
01823 }
01824
01825 break;
01826
01827
01828
01829
01830
01831
01832 case Interface:
01833
01834
01835
01836
01837
01838 if (AT_DCL_ERR(attr_idx) && AT_CIF_SYMBOL_ID(attr_idx) != 0) {
01839 scope_id = (AT_USE_ASSOCIATED(attr_idx)) ?
01840 SCP_CIF_ID(curr_scp_idx) :
01841 ATI_CIF_SCOPE_ID(attr_idx);
01842
01843 switch (ATI_INTERFACE_CLASS(attr_idx)) {
01844
01845 case Defined_Assign_Interface:
01846 interface_type = CIF_IB_ASSIGNMENT;
01847 break;
01848
01849 case Generic_Unknown_Interface:
01850 case Generic_Function_Interface:
01851 case Generic_Subroutine_Interface:
01852 interface_type = CIF_IB_GENERIC;
01853 break;
01854
01855 default:
01856 interface_type = CIF_IB_OPERATOR;
01857 break;
01858 }
01859
01860 Cif_F90_Int_Block_Rec(c_i_f,
01861 AT_OBJ_NAME_PTR(attr_idx),
01862 AT_CIF_SYMBOL_ID(attr_idx),
01863 scope_id,
01864 interface_type,
01865 0,
01866 0,
01867 NULL,
01868 0);
01869
01870 goto EXIT;
01871 }
01872
01873
01874 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01875 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01876 }
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887 if (AT_USE_ASSOCIATED(attr_idx) &&
01888 AT_MODULE_IDX(attr_idx) != NULL_IDX &&
01889 ! AT_CIF_DONE(AT_MODULE_IDX(attr_idx))) {
01890
01891 if (AT_IS_INTRIN(attr_idx) &&
01892 ! ATI_USER_SPECIFIED(attr_idx) &&
01893 ATI_CIF_SEEN_IN_CALL(attr_idx)) {
01894
01895
01896
01897 }
01898 else {
01899 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01900 }
01901 }
01902
01903
01904 if (AT_IS_INTRIN(attr_idx) && ! ATI_USER_SPECIFIED(attr_idx)) {
01905
01906
01907
01908
01909
01910 if (ATI_CIF_SEEN_IN_CALL(attr_idx)) {
01911 goto EXIT;
01912 }
01913
01914
01915 rslt_id = 0;
01916
01917 if (ATI_INTERFACE_CLASS(attr_idx) == Generic_Function_Interface) {
01918 pgm_unit_type = CIF_F90_ET_FUNCTION;
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
01932
01933 for (i = 2; i <= ATI_NUM_SPECIFICS(attr_idx); ++i) {
01934 sn_idx = SN_SIBLING_LINK(sn_idx);
01935 }
01936
01937 rslt_idx = ATP_RSLT_IDX(SN_ATTR_IDX(sn_idx));
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951 save_cif_done = AT_CIF_DONE(rslt_idx);
01952 AT_CIF_DONE(rslt_idx) = FALSE;
01953 cif_send_attr(rslt_idx, NULL_IDX);
01954 AT_CIF_DONE(rslt_idx) = save_cif_done;
01955
01956 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01957 }
01958 else if (ATI_INTERFACE_CLASS(attr_idx) ==Generic_Subroutine_Interface){
01959 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
01960 }
01961 else {
01962 pgm_unit_type = CIF_F90_ET_UNKNOWN;
01963 }
01964
01965 attributes = CIF_PGM_REFERENCE;
01966
01967 if (AT_PRIVATE(attr_idx)) {
01968 attributes = attributes | CIF_PGM_PRIVATE;
01969 }
01970
01971 Cif_F90_Entry_Rec(c_i_f,
01972 AT_OBJ_NAME_PTR(attr_idx),
01973 AT_CIF_SYMBOL_ID(attr_idx),
01974 SCP_CIF_ID(curr_scp_idx),
01975 pgm_unit_type,
01976 CIF_F90_PT_INTRINSIC,
01977 attributes,
01978 rslt_id,
01979 0,
01980 0,
01981 NULL);
01982
01983 break;
01984 }
01985
01986 if (ATI_UNNAMED_INTERFACE(attr_idx)) {
01987
01988 if (fprintf(c_i_f,
01989 "%d%c%c%d%c%d%c%d%c%x%c%d",
01990 CIF_F90_INT_BLOCK, EOI,
01991 EOI,
01992 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01993 ATI_CIF_SCOPE_ID(attr_idx), EOI,
01994 CIF_IB_SPECIFIC, EOI,
01995 0, EOI,
01996 ATI_NUM_SPECIFICS(attr_idx)) < 0) {
01997 Cif_Error();
01998 }
01999 }
02000 else {
02001
02002 if (ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02003 cif_send_attr(ATI_PROC_IDX(attr_idx), NULL_IDX);
02004 }
02005
02006 attributes = (AT_PRIVATE(attr_idx)) ? 1 : 0;
02007
02008 switch (ATI_INTERFACE_CLASS(attr_idx)) {
02009 case Defined_Assign_Interface:
02010 interface_type = CIF_IB_ASSIGNMENT;
02011 break;
02012
02013 case Generic_Unknown_Interface:
02014 case Generic_Function_Interface:
02015 case Generic_Subroutine_Interface:
02016 interface_type = CIF_IB_GENERIC;
02017 break;
02018
02019 default:
02020 interface_type = CIF_IB_OPERATOR;
02021 break;
02022 }
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035 scope_id = (AT_USE_ASSOCIATED(attr_idx)) ?
02036 SCP_CIF_ID(curr_scp_idx) :
02037 ATI_CIF_SCOPE_ID(attr_idx);
02038
02039 if (fprintf(c_i_f,
02040 "%d%c%s%c%d%c%d%c%d%c%lx%c%d",
02041 CIF_F90_INT_BLOCK, EOI,
02042 AT_OBJ_NAME_PTR(attr_idx), EOI,
02043 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02044 scope_id, EOI,
02045 interface_type, EOI,
02046 attributes, EOI,
02047 ATI_NUM_SPECIFICS(attr_idx)) < 0) {
02048 Cif_Error();
02049 }
02050 }
02051
02052
02053
02054
02055
02056 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
02057
02058 while (sn_idx != NULL_IDX) {
02059 interface_idx = SN_ATTR_IDX(sn_idx);
02060 sn_idx = SN_SIBLING_LINK(sn_idx);
02061
02062 if (AT_CIF_SYMBOL_ID(interface_idx) == 0) {
02063 AT_CIF_SYMBOL_ID(interface_idx) = NEXT_SYMBOL_ID;
02064 }
02065
02066 if (fprintf(c_i_f, "%c%d",
02067 EOI,
02068 AT_CIF_SYMBOL_ID(interface_idx)) < 0) {
02069 Cif_Error();
02070 }
02071 }
02072
02073 if (fprintf(c_i_f, "%c", EOR) < 0) {
02074 Cif_Error();
02075 }
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
02088
02089 while (sn_idx != NULL_IDX) {
02090 interface_idx = SN_ATTR_IDX(sn_idx);
02091 sn_idx = SN_SIBLING_LINK(sn_idx);
02092
02093 if (ATP_PROC(interface_idx) == Module_Proc ||
02094 ATP_PROC(interface_idx) == Intrin_Proc ||
02095 (ATP_PROC(interface_idx) == Extern_Proc &&
02096 AT_USE_ASSOCIATED(interface_idx))) {
02097
02098 if (ATP_PGM_UNIT(interface_idx) == Function) {
02099 pgm_unit_type = CIF_F90_ET_FUNCTION;
02100 rslt_id = ATP_RSLT_IDX(interface_idx);
02101 cif_send_attr(rslt_id, NULL_IDX);
02102 rslt_id = AT_CIF_SYMBOL_ID(rslt_id);
02103 }
02104 else {
02105 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
02106 rslt_id = 0;
02107 }
02108
02109 if (AT_MODULE_IDX(interface_idx) == NULL_IDX) {
02110
02111 if (SCP_LEVEL(curr_scp_idx) == 0) {
02112 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
02113 }
02114 else {
02115 i = SCP_PARENT_IDX(curr_scp_idx);
02116
02117 while (SCP_LEVEL(i) != 0) {
02118 i = SCP_PARENT_IDX(i);
02119 }
02120
02121 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(i));
02122 }
02123 }
02124 else {
02125
02126 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(interface_idx)) == 0) {
02127 cif_send_attr(AT_MODULE_IDX(interface_idx), NULL_IDX);
02128 }
02129
02130 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(interface_idx));
02131 }
02132
02133
02134 attributes = CIF_PGM_REFERENCE;
02135
02136 if (AT_OPTIONAL(interface_idx)) {
02137 attributes = attributes | CIF_PGM_OPTIONAL;
02138 }
02139
02140 if (AT_PRIVATE(interface_idx)) {
02141 attributes = attributes | CIF_PGM_PRIVATE;
02142 }
02143
02144 if (AT_USE_ASSOCIATED(interface_idx)) {
02145 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
02146 }
02147
02148 if (ATP_RECURSIVE(interface_idx)) {
02149 attributes = attributes | CIF_PGM_RECURSIVE;
02150 }
02151
02152
02153 Cif_F90_Entry_Rec(c_i_f,
02154 AT_OBJ_NAME_PTR(interface_idx),
02155 AT_CIF_SYMBOL_ID(interface_idx),
02156 scope_id,
02157 pgm_unit_type,
02158 ATP_PROC(interface_idx),
02159 attributes,
02160 rslt_id,
02161 storage_id,
02162 0,
02163 NULL);
02164 }
02165 }
02166
02167 break;
02168
02169
02170
02171
02172
02173
02174 case Namelist_Grp:
02175
02176 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
02177 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
02178 }
02179
02180 if (AT_USE_ASSOCIATED(attr_idx)) {
02181
02182 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
02183 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
02184 }
02185
02186 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
02187 }
02188 else if (AT_HOST_ASSOCIATED(attr_idx)) {
02189
02190
02191
02192
02193
02194
02195 goto EXIT;
02196 }
02197 else {
02198
02199 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
02200 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
02201 }
02202 else {
02203 storage_id = 0;
02204 }
02205 }
02206
02207 num_namelist = AT_DCL_ERR(attr_idx) ? 0: ATN_NUM_NAMELIST(attr_idx);
02208
02209 if (fprintf(c_i_f,
02210 "%d%c%s%c%d%c%d%c%d%c%d",
02211 CIF_F90_NAMELIST, EOI,
02212 AT_OBJ_NAME_PTR(attr_idx), EOI,
02213 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02214 SCP_CIF_ID(curr_scp_idx), EOI,
02215 storage_id, EOI,
02216 num_namelist) < 0) {
02217 Cif_Error();
02218 }
02219
02220 if (num_namelist > 0) {
02221 sn_idx = ATN_FIRST_NAMELIST_IDX(attr_idx);
02222
02223 while (sn_idx != NULL_IDX) {
02224 namelist_idx = SN_ATTR_IDX(sn_idx);
02225 sn_idx = SN_SIBLING_LINK(sn_idx);
02226
02227 if (AT_CIF_SYMBOL_ID(namelist_idx) == 0) {
02228 AT_CIF_SYMBOL_ID(namelist_idx) = NEXT_SYMBOL_ID;
02229 }
02230
02231 if (fprintf(c_i_f,"%c%d",EOI,AT_CIF_SYMBOL_ID(namelist_idx)) < 0) {
02232 Cif_Error();
02233 }
02234 }
02235 }
02236
02237 if (fprintf(c_i_f, "%c", EOR) < 0) {
02238 Cif_Error();
02239 }
02240
02241 break;
02242
02243
02244
02245
02246
02247
02248 case Stmt_Func:
02249 attributes = 0;
02250
02251 # if 0
02252 if (AT_DCL_ERR(attr_idx)) {
02253 goto EXIT;
02254 }
02255 # endif
02256
02257 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
02258 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
02259 }
02260
02261 if (fprintf(c_i_f,
02262 "%d%c%s%c%d%c%d%c%d%c%d%c%lx%c%d%c%d%c%d",
02263 CIF_F90_ENTRY, EOI,
02264 AT_OBJ_NAME_PTR(attr_idx), EOI,
02265 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02266 SCP_CIF_ID(curr_scp_idx), EOI,
02267 CIF_F90_ET_STMT, EOI,
02268 Unknown_Proc, EOI,
02269 attributes, EOI,
02270 0, EOI,
02271 0, EOI,
02272 ATP_NUM_DARGS(attr_idx)) < 0) {
02273 Cif_Error();
02274 }
02275
02276 if (ATP_NUM_DARGS(attr_idx) != NULL_IDX) {
02277 sn_idx = ATP_FIRST_IDX(attr_idx);
02278
02279 for (i = 0; i < ATP_NUM_DARGS(attr_idx); i++) {
02280
02281 if (AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) == 0) {
02282 AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) = NEXT_SYMBOL_ID;
02283 }
02284
02285 darg_idx = AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx++));
02286
02287 if (fprintf(c_i_f, "%c%d", EOI, darg_idx) < 0) {
02288 Cif_Error();
02289 }
02290 }
02291
02292 if (fprintf(c_i_f, "%c", EOR) < 0) {
02293 Cif_Error();
02294 }
02295
02296 sn_idx = ATP_FIRST_IDX(attr_idx);
02297
02298 for (i = 0; i < ATP_NUM_DARGS(attr_idx); i++) {
02299 cif_send_attr(SN_ATTR_IDX(sn_idx++), NULL_IDX);
02300 }
02301 }
02302 else if (fprintf(c_i_f, "%c", EOR) < 0) {
02303 Cif_Error();
02304 }
02305
02306 break;
02307
02308 }
02309
02310
02311 EXIT:
02312
02313 TRACE (Func_Exit, "cif_send_attr", NULL);
02314
02315 return;
02316
02317 }
02318
02319
02320
02321
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338 void cif_directive_rec(cif_directive_code_type dir,
02339 int line,
02340 int col)
02341
02342 {
02343 int file_line_num;
02344 int local_file_id;
02345
02346 TRACE (Func_Entry, "cif_directive_rec", NULL);
02347
02348 file_line_num = get_line_and_file_id(line, &local_file_id);
02349
02350 Cif_Cdir_Rec(c_i_f, dir, local_file_id, file_line_num, col, 0, NULL);
02351
02352 TRACE (Func_Exit, "cif_directive_rec", NULL);
02353
02354 return;
02355
02356 }
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378 int cif_file_name_rec(char *file_name,
02379 char *user_specified_file_name)
02380 {
02381 int return_val;
02382
02383
02384 TRACE (Func_Entry, "cif_file_name_rec", NULL);
02385
02386 return_val = NEXT_FILE_ID;
02387
02388 Cif_File_Rec(c_i_f,
02389 file_name,
02390 return_val,
02391 user_specified_file_name);
02392
02393 TRACE (Func_Exit, "cif_file_name_rec", NULL);
02394
02395 return(return_val);
02396
02397 }
02398
02399
02400
02401
02402
02403
02404
02405
02406
02407
02408
02409
02410
02411
02412
02413
02414
02415
02416
02417
02418 void cif_include_rec(int line_num,
02419 int col_num,
02420 int include_file_id)
02421 {
02422 int file_line_num;
02423 int parent_file_id;
02424
02425
02426 TRACE (Func_Entry, "cif_include_rec", NULL);
02427
02428 file_line_num = get_line_and_file_id(line_num, &parent_file_id);
02429
02430 Cif_Include_Rec(c_i_f,
02431 parent_file_id,
02432 file_line_num,
02433 col_num,
02434 include_file_id);
02435
02436 Cif_Src_Pos_Rec(c_i_f,
02437 CIF_SRC_KIND_INCLUDE,
02438 include_file_id,
02439 parent_file_id,
02440 file_line_num,
02441 col_num,
02442 include_file_id,
02443 0,
02444 0,
02445 0);
02446
02447 TRACE (Func_Exit, "cif_include_rec", NULL);
02448
02449 return;
02450
02451 }
02452
02453
02454
02455
02456
02457
02458
02459
02460
02461
02462
02463
02464
02465
02466
02467
02468
02469
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484 void cif_message_rec(int msg_num,
02485 int glb_line_num,
02486 int col_num,
02487 msg_severities_type msg_severity,
02488 char *msg_text,
02489 long arg0,
02490 long arg1,
02491 long arg2,
02492 long arg3,
02493 char *scoping_unit_name,
02494 int relative_order)
02495
02496 {
02497 char *char_ptr;
02498 int file_line_num;
02499 char *format[4] = { "%c", "%d", "%f", "%s" };
02500 int format_idx;
02501 char insert[4][128];
02502 char *insert_ptr[4];
02503 int local_file_id;
02504 int num_inserts = 0;
02505
02506
02507 TRACE (Func_Entry, "cif_message_rec", NULL);
02508
02509 if (msg_severity == Log_Error || msg_severity == Log_Warning ||
02510 glb_line_num == 0) {
02511 goto EXIT;
02512 }
02513
02514 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
02515
02516 char_ptr = msg_text;
02517
02518 while ((char_ptr = strchr(char_ptr, '%')) != NULL) {
02519 ++char_ptr;
02520
02521 switch (*char_ptr++) {
02522
02523 case 'c':
02524 format_idx = 0;
02525 break;
02526
02527 case 'd':
02528 format_idx = 1;
02529 break;
02530
02531 case 'f':
02532 format_idx = 2;
02533 break;
02534
02535 case 's':
02536 format_idx = 3;
02537 break;
02538
02539 case '%':
02540 continue;
02541
02542 case EOS:
02543 goto LOOP_EXIT;
02544
02545 default:
02546 PRINTMSG(glb_line_num, 179, Internal, 0, "cif_message_rec");
02547 }
02548
02549 switch (num_inserts) {
02550
02551 case 0:
02552 sprintf(insert[0], format[format_idx], arg0);
02553 break;
02554
02555 case 1:
02556 sprintf(insert[1], format[format_idx], arg1);
02557 break;
02558
02559 case 2:
02560 sprintf(insert[2], format[format_idx], arg2);
02561 break;
02562
02563 case 3:
02564 sprintf(insert[3], format[format_idx], arg3);
02565 }
02566
02567 insert_ptr[num_inserts] = insert[num_inserts];
02568
02569 ++num_inserts;
02570 }
02571
02572 LOOP_EXIT:
02573
02574 Cif_Message_Rec(c_i_f,
02575 msg_severity,
02576 msg_num,
02577 local_file_id,
02578 glb_line_num,
02579 col_num,
02580 file_line_num,
02581 num_inserts,
02582 insert_ptr,
02583 scoping_unit_name,
02584 relative_order,
02585 0,
02586 local_file_id);
02587
02588 last_msg_file_rec = CIF_MESSAGE;
02589
02590 EXIT:
02591
02592 TRACE (Func_Exit, "cif_message_rec", NULL);
02593
02594 return;
02595
02596 }
02597
02598
02599
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614
02615
02616
02617 void cif_source_file_rec(int source_file_id,
02618 src_form_type source_form)
02619 {
02620
02621 TRACE (Func_Entry, "cif_source_file_rec", NULL);
02622
02623 Cif_Srcfile_Rec(c_i_f,
02624 source_file_id,
02625 (source_form == Fixed_Form) ? CIF_F90_FORM_FIXED :
02626 CIF_F90_FORM_FREE);
02627
02628 TRACE (Func_Exit, "cif_source_file_rec", NULL);
02629
02630 return;
02631
02632 }
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642
02643
02644
02645
02646
02647
02648
02649
02650
02651
02652
02653
02654
02655
02656
02657
02658
02659
02660
02661
02662
02663
02664
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694 void cif_summary_rec(char *release_level,
02695 char *gen_date,
02696 char *gen_time,
02697 float elapsed_time,
02698 long aux_elapsed_time,
02699 long max_field_len)
02700 {
02701 char comp_time[13];
02702 int hms;
02703 int hours;
02704 int milliseconds;
02705 int minutes;
02706 int seconds;
02707
02708
02709 TRACE (Func_Entry, "cif_summary_rec", NULL);
02710
02711 if (max_field_len == -1) {
02712 comp_time[0] = '0';
02713 comp_time[1] = NULL_CHAR;
02714 }
02715 else {
02716
02717 hms = elapsed_time;
02718
02719
02720 # if (defined(_HOST_OS_UNICOS) || defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX))
02721
02722 elapsed_time = elapsed_time - hms;
02723 milliseconds = (elapsed_time + .0005) * 1000;
02724
02725 # elif defined(_HOST_OS_MAX)
02726
02727 milliseconds = ((aux_elapsed_time % CLOCKS_PER_SEC) + 500L) / 1000L;
02728 hms = aux_elapsed_time / CLOCKS_PER_SEC;
02729
02730 # else
02731
02732 if (hms <= 2147) {
02733 milliseconds = ((aux_elapsed_time % CLOCKS_PER_SEC) + 500L) / 1000L;
02734 hms = aux_elapsed_time / CLOCKS_PER_SEC;
02735 }
02736 else {
02737 milliseconds = -1;
02738 }
02739
02740 # endif
02741
02742
02743 hours = hms / 3600;
02744 hms = hms % 3600;
02745 minutes = hms / 60;
02746 seconds = hms % 60;
02747
02748
02749 # ifndef _HOST_OS_SOLARIS
02750
02751 sprintf(comp_time, "%2.2d:%2.2d:%2.2d.%3.3d",
02752 hours, minutes, seconds, milliseconds);
02753
02754 # else
02755
02756 if (milliseconds >= 0) {
02757 sprintf(comp_time, "%2.2d:%2.2d:%2.2d.%3.3d",
02758 hours, minutes, seconds, milliseconds);
02759 }
02760 else {
02761 sprintf(comp_time, "%2.2d:%2.2d:%2.2d", hours, minutes, seconds);
02762 }
02763
02764 # endif
02765
02766 }
02767
02768 Cif_Summary_Rec(c_i_f,
02769 release_level,
02770 gen_date,
02771 gen_time,
02772 comp_time,
02773 max_field_len,
02774 --curr_glb_line,
02775 code_size,
02776 data_size);
02777
02778
02779
02780 ++curr_glb_line;
02781
02782
02783 TRACE (Func_Exit, "cif_summary_rec", NULL);
02784
02785 return;
02786
02787 }
02788
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806 void cif_unit_rec(void)
02807 {
02808 int cif_col_num;
02809 int file_line_num;
02810 int glb_line_num;
02811 int local_file_id;
02812
02813
02814 TRACE (Func_Entry, "cif_unit_rec", NULL);
02815
02816 if (cif_pgm_unit_start_line == stmt_start_line) {
02817
02818
02819
02820
02821
02822 if (blk_stk_idx > 0) {
02823 glb_line_num = CURR_BLK_DEF_LINE;
02824 cif_col_num = CURR_BLK_DEF_COLUMN;
02825 }
02826 else {
02827 glb_line_num = 1;
02828 cif_col_num = 1;
02829 }
02830 }
02831 else {
02832
02833
02834
02835
02836
02837 glb_line_num = (cif_pgm_unit_start_line < stmt_start_line) ?
02838 cif_pgm_unit_start_line : stmt_start_line;
02839 cif_col_num = 1;
02840 }
02841
02842 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
02843
02844
02845
02846
02847 c_i_f = cif_actual_file;
02848
02849
02850 Cif_Unit_Rec(c_i_f,
02851 (scp_tbl != NULL) ?
02852 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx)) :
02853 UNNAMED_PROGRAM_NAME,
02854 local_file_id,
02855 file_line_num,
02856 cif_col_num);
02857
02858 cif_need_unit_rec = FALSE;
02859 cif_first_pgm_unit = FALSE;
02860
02861 last_msg_file_rec = CIF_UNIT;
02862
02863 if (! cif_pgm_unit_error_recovery) {
02864 cif_copy_temp_to_actual_CIF();
02865 }
02866
02867 TRACE (Func_Exit, "cif_unit_rec", NULL);
02868
02869 return;
02870
02871 }
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
02886
02887
02888
02889
02890 void cif_copy_temp_to_actual_CIF(void)
02891 {
02892 char cif_rec[256];
02893
02894
02895 TRACE (Func_Entry, "cif_copy_temp_to_actual_CIF", NULL);
02896
02897
02898
02899
02900
02901 fprintf(cif_tmp_file, "%d\n", EOF);
02902 fflush(cif_tmp_file);
02903 rewind(cif_tmp_file);
02904
02905 while (fgets(cif_rec, 256, cif_tmp_file) != NULL && atoi(cif_rec) != EOF) {
02906 fputs(cif_rec, c_i_f);
02907 }
02908
02909 rewind(cif_tmp_file);
02910
02911 TRACE (Func_Exit, "cif_copy_temp_to_actual_CIF", NULL);
02912
02913 return;
02914
02915 }
02916
02917
02918
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934 void cif_end_unit_rec(char *name_ptr)
02935 {
02936 int file_line_num;
02937 int local_file_id;
02938
02939
02940 TRACE (Func_Entry, "cif_end_unit_rec", NULL);
02941
02942 file_line_num = get_line_and_file_id(cif_end_unit_line, &local_file_id);
02943
02944 cif_flush_include_recs();
02945
02946 Cif_Endunit_Rec(c_i_f,
02947 name_ptr,
02948 local_file_id,
02949 file_line_num,
02950 (cif_end_unit_column > 0) ?
02951 cif_end_unit_column : stmt_start_col);
02952
02953 last_msg_file_rec = CIF_ENDUNIT;
02954
02955 TRACE (Func_Exit, "cif_end_unit_rec", NULL);
02956
02957 return;
02958
02959 }
02960
02961
02962
02963
02964
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980
02981
02982
02983
02984 void cif_usage_rec(int obj_idx,
02985 fld_type obj_fld,
02986 int line_num,
02987 int col_num,
02988 int usage_code)
02989 {
02990 int attr_idx;
02991 int cif_symbol_id;
02992 int file_line_num;
02993 int local_file_id;
02994 opnd_type opnd;
02995
02996
02997 TRACE (Func_Entry, "cif_usage_rec", NULL);
02998
02999
03000
03001
03002
03003
03004 if (usage_code == CIF_No_Usage_Rec) {
03005 goto EXIT;
03006 }
03007
03008
03009 switch (obj_fld) {
03010
03011 case AT_Tbl_Idx:
03012 attr_idx = obj_idx;
03013 AT_CIF_IN_USAGE_REC(attr_idx) = TRUE;
03014
03015 if (AT_DCL_ERR(attr_idx) ||
03016 (AT_COMPILER_GEND(attr_idx) &&
03017 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
03018 ! (ATD_CLASS(attr_idx) == Compiler_Tmp &&
03019 ATD_TMP_NEEDS_CIF(attr_idx))))) {
03020 goto EXIT;
03021 }
03022
03023
03024
03025
03026
03027
03028
03029 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
03030 ATP_PROC(attr_idx) == Intrin_Proc &&
03031 ! ATP_IN_INTERFACE_BLK(attr_idx)) {
03032 attr_idx = ATP_INTERFACE_IDX(attr_idx);
03033 }
03034
03035
03036 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03037 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03038 }
03039
03040 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03041
03042 Cif_Usage_Rec(c_i_f,
03043 AT_CIF_SYMBOL_ID(attr_idx),
03044 local_file_id,
03045 file_line_num,
03046 col_num,
03047 usage_code,
03048 0,
03049 NULL);
03050
03051 break;
03052
03053 case NO_Tbl_Idx:
03054 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03055
03056 Cif_Usage_Rec(c_i_f,
03057 obj_idx,
03058 local_file_id,
03059 file_line_num,
03060 col_num,
03061 usage_code,
03062 0,
03063 NULL);
03064
03065 break;
03066
03067 default:
03068 skip_struct_base = TRUE;
03069 OPND_FLD(opnd) = obj_fld;
03070 OPND_IDX(opnd) = obj_idx;
03071
03072
03073
03074 attr_idx = find_base_attr(&opnd, &line_num, &col_num);
03075
03076
03077
03078
03079 attr_idx = find_left_attr(&opnd);
03080
03081 if (AT_DCL_ERR(attr_idx)) {
03082 goto EXIT;
03083 }
03084
03085 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03086 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03087 }
03088
03089 cif_symbol_id = AT_CIF_SYMBOL_ID(attr_idx);
03090 AT_CIF_IN_USAGE_REC(attr_idx) = TRUE;
03091
03092 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03093
03094 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d",
03095 CIF_USAGE, EOI,
03096 cif_symbol_id, EOI,
03097 local_file_id, EOI,
03098 file_line_num, EOI,
03099 col_num, EOI,
03100 usage_code) < 0) {
03101 Cif_Error();
03102 }
03103
03104 cif_number_of_struct_ids = 0;
03105
03106 output_struct_ids(&opnd);
03107
03108 if (fprintf(c_i_f, "%c%d", EOI, cif_number_of_struct_ids) < 0) {
03109 Cif_Error();
03110 }
03111
03112 cif_number_of_struct_ids = -1;
03113
03114 if (! output_struct_ids(&opnd)) {
03115 Cif_Error();
03116 }
03117
03118 if (fprintf(c_i_f, "%c", EOR) < 0) {
03119 Cif_Error();
03120 }
03121
03122 break;
03123 }
03124
03125 EXIT:
03126
03127 TRACE (Func_Exit, "cif_usage_rec", NULL);
03128
03129 return;
03130
03131 }
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154 void cif_sb_usage_rec(int sb_idx,
03155 int line_num,
03156 int col_num,
03157 cif_usage_code_type usage_code)
03158 {
03159 int file_line_num;
03160 int local_file_id;
03161
03162
03163 TRACE (Func_Entry, "cif_sb_usage_rec", NULL);
03164
03165 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03166
03167 if (SB_CIF_SYMBOL_ID(sb_idx) == 0) {
03168 SB_CIF_SYMBOL_ID(sb_idx) = NEXT_SYMBOL_ID;
03169 }
03170
03171 Cif_Usage_Rec(c_i_f,
03172 SB_CIF_SYMBOL_ID(sb_idx),
03173 local_file_id,
03174 file_line_num,
03175 col_num,
03176 usage_code,
03177 0,
03178 NULL);
03179
03180 TRACE (Func_Exit, "cif_sb_usage_rec", NULL);
03181
03182 return;
03183
03184 }
03185
03186
03187
03188
03189
03190
03191
03192
03193
03194
03195
03196
03197
03198
03199
03200
03201
03202
03203 void cif_enable_disable_rec(void)
03204 {
03205 long enable_disable_opts;
03206
03207
03208 TRACE (Func_Entry, "cif_enable_disable_rec", NULL);
03209
03210 enable_disable_opts = 0;
03211
03212 if (on_off_flags.abort_if_any_errors) {
03213 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTa;
03214 }
03215
03216
03217 # ifdef _ACCEPT_FLOW
03218
03219 if (on_off_flags.flowtrace_option) {
03220 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTf;
03221 }
03222
03223 # endif
03224
03225
03226 # ifdef _ACCEPT_CMD_ed_i
03227
03228 if (on_off_flags.indef_init) {
03229 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTi;
03230 }
03231
03232 # endif
03233
03234
03235 # ifdef _ACCEPT_CMD_ed_j
03236
03237 if (on_off_flags.exec_doloops_once) {
03238 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTj;
03239 }
03240
03241 # endif
03242
03243
03244 if (on_off_flags.issue_ansi_messages) {
03245 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTn;
03246 }
03247
03248 if (on_off_flags.enable_double_precision) {
03249 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTp;
03250 }
03251
03252 if (on_off_flags.abort_on_100_errors) {
03253 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTq;
03254 }
03255
03256
03257 # ifdef _ACCEPT_CMD_ed_r
03258
03259 if (on_off_flags.round_mult_operations) {
03260 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTr;
03261 }
03262
03263 # endif
03264
03265
03266 if (on_off_flags.alloc_autos_on_stack) {
03267 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTt;
03268 }
03269
03270 if (on_off_flags.eu) {
03271 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTu;
03272 }
03273
03274 if (on_off_flags.save_all_vars) {
03275 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTv;
03276 }
03277
03278
03279 # ifdef _ACCEPT_CMD_ed_A
03280
03281 if (on_off_flags.MPP_apprentice) {
03282 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTA;
03283 }
03284
03285 # endif
03286
03287
03288 if (cmd_line_flags.binary_output) {
03289 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTB;
03290 }
03291
03292 if (cmd_line_flags.assembly_output) {
03293 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTS;
03294 }
03295
03296
03297 # ifdef _ACCEPT_CMD_ed_X
03298
03299 if (on_off_flags.atexpert) {
03300 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTX;
03301 }
03302
03303 # endif
03304
03305
03306 Cif_EDopts_Rec(c_i_f, enable_disable_opts);
03307
03308 TRACE (Func_Exit, "cif_enable_disable_rec", NULL);
03309
03310 return;
03311
03312 }
03313
03314
03315
03316
03317
03318
03319
03320
03321
03322
03323
03324
03325
03326
03327
03328
03329
03330
03331 void cif_machine_characteristics_rec(void)
03332 {
03333
03334
03335 # if defined(_HOST_OS_UNICOS) || defined(_HOST_OS_MAX)
03336
03337 int characteristics;
03338
03339 union {long int_form;
03340 char char_form[9];
03341 } cpu_type;
03342
03343 # endif
03344
03345
03346 TRACE (Func_Entry, "cif_machine_characteristics_rec", NULL);
03347
03348
03349 # ifdef _TARGET_OS_UNICOS
03350
03351 # ifdef _GETPMC_AVAILABLE
03352
03353
03354
03355 cpu_type.int_form = target_machine.fld.mcpmt;
03356 cpu_type.char_form[8] = NULL_CHAR;
03357
03358
03359
03360
03361 characteristics = 0;
03362
03363 if (target_machine.fld.mcvpop) {
03364 characteristics = characteristics | CIF_MC_VPOP;
03365 }
03366
03367 if (target_machine.fld.mcema) {
03368 characteristics = characteristics | CIF_MC_EMA;
03369 }
03370
03371 if (target_machine.fld.mccigs) {
03372 characteristics = characteristics | CIF_MC_CIGS;
03373 }
03374
03375 if (target_machine.fld.mcpc) {
03376 characteristics = characteristics | CIF_MC_PCF;
03377 }
03378
03379 if (target_machine.fld.mcrdvl) {
03380 characteristics = characteristics | CIF_MC_READVL;
03381 }
03382
03383 if (target_machine.fld.mcvrcr) {
03384 characteristics = characteristics | CIF_MC_VRECUR;
03385 }
03386
03387 if (target_machine.fld.mcavl) {
03388 characteristics = characteristics | CIF_MC_AVL;
03389 }
03390
03391 if (target_machine.fld.mchpm) {
03392 characteristics = characteristics | CIF_MC_HPF;
03393 }
03394
03395 if (target_machine.fld.mcbdm) {
03396 characteristics = characteristics | CIF_MC_BDM;
03397 }
03398
03399 if (target_machine.fld.mcstr) {
03400 characteristics = characteristics | CIF_MC_SREG;
03401 }
03402
03403 if (target_machine.fld.mcstr) {
03404 characteristics = characteristics | CIF_MC_CLUSTER;
03405 }
03406
03407 if (target_machine.fld.mccori) {
03408 characteristics = characteristics | CIF_MC_COR;
03409 }
03410
03411 if (target_machine.fld.mcaddr32) {
03412 characteristics = characteristics | CIF_MC_ADDR32;
03413 }
03414
03415 if (target_machine.fld.mcbmm) {
03416 characteristics = characteristics | CIF_MC_BMM;
03417 }
03418
03419 if (target_machine.fld.mcxea) {
03420 characteristics = characteristics | CIF_MC_XEA;
03421 }
03422
03423 if (target_machine.fld.mcavpop) {
03424 characteristics = characteristics | CIF_MC_AVPOP;
03425 }
03426
03427 if (target_machine.fld.mcfullsect) {
03428 characteristics = characteristics | CIF_MC_FULLSECT;
03429 }
03430
03431 if (target_machine.fld.mcieee) {
03432 characteristics = characteristics | CIF_MC_IEEE;
03433 }
03434
03435 if (target_machine.fld.mccmrreq) {
03436 characteristics = characteristics | CIF_MC_CMRREQ;
03437 }
03438
03439 if (target_machine.fld.mccache) {
03440 characteristics = characteristics | CIF_MC_CACHE;
03441 }
03442
03443 Cif_Mach_Char_Rec(c_i_f,
03444 cpu_type.char_form,
03445 target_machine.fld.mcmspd,
03446 target_machine.fld.mcmsz,
03447 characteristics,
03448 target_machine.fld.mcbank,
03449 target_machine.fld.mcncpu,
03450 target_machine.fld.mcibsz,
03451 target_machine.fld.mcclk,
03452 target_machine.fld.mcncl,
03453 target_machine.fld.mcbbsy,
03454 TARGET_BITS_PER_WORD);
03455
03456
03457 # else
03458
03459
03460
03461
03462
03463
03464
03465
03466 Cif_Mach_Char_Rec(c_i_f,
03467 target_machine.fld.mcpmt,
03468 -1L,
03469 -1L,
03470 0,
03471 -1L,
03472 -1L,
03473 -1L,
03474 -1L,
03475 -1L,
03476 -1L,
03477 TARGET_BITS_PER_WORD);
03478
03479 # endif
03480
03481
03482 # endif
03483
03484
03485 # ifdef _TARGET_OS_MAX
03486
03487
03488 # if defined(_GETPMC_AVAILABLE)
03489
03490
03491
03492 cpu_type.int_form = target_machine.fld.mcpmt;
03493 cpu_type.char_form[8] = NULL_CHAR;
03494
03495
03496 Cif_Mach_Char_Rec(c_i_f,
03497 cpu_type.char_form,
03498 -1L,
03499 target_machine.fld.mcmsz,
03500 0,
03501 -1L,
03502 -1L,
03503 -1L,
03504 -1L,
03505 -1L,
03506 -1L,
03507 TARGET_BITS_PER_WORD);
03508
03509 # else
03510
03511
03512
03513
03514
03515
03516
03517
03518 Cif_Mach_Char_Rec(c_i_f,
03519 target_machine.fld.mcpmt,
03520 -1L,
03521 -1L,
03522 0,
03523 -1L,
03524 -1L,
03525 -1L,
03526 -1L,
03527 -1L,
03528 -1L,
03529 TARGET_BITS_PER_WORD);
03530
03531
03532 # endif
03533
03534
03535 # endif
03536
03537
03538 # if defined(GENERATE_WHIRL)
03539
03540
03541
03542
03543 Cif_Mach_Char_Rec(c_i_f,
03544 "IRIX",
03545 -1L,
03546 -1L,
03547 0,
03548 -1L,
03549 -1L,
03550 -1L,
03551 -1L,
03552 -1L,
03553 -1L,
03554 TARGET_BITS_PER_WORD);
03555
03556 # elif defined(_TARGET_OS_SOLARIS)
03557
03558
03559
03560 Cif_Mach_Char_Rec(c_i_f,
03561 "SPARC",
03562 -1L,
03563 -1L,
03564 0,
03565 -1L,
03566 -1L,
03567 -1L,
03568 -1L,
03569 -1L,
03570 -1L,
03571 TARGET_BITS_PER_WORD);
03572 # endif
03573
03574
03575 TRACE (Func_Exit, "cif_machine_characteristics_rec", NULL);
03576
03577 return;
03578
03579 }
03580
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597
03598
03599
03600 void cif_stmt_type_rec(boolean exact_stmt_type_known,
03601 cif_stmt_type exact_stmt_type,
03602 int stmt_number)
03603 {
03604 int file_line_num;
03605 int local_file_id;
03606 cif_stmt_type local_stmt_type;
03607
03608
03609 TRACE (Func_Entry, "cif_stmt_type_rec", NULL);
03610
03611 local_stmt_type = (exact_stmt_type_known) ?
03612 exact_stmt_type : mapped_stmt_type[stmt_type];
03613
03614 switch (local_stmt_type) {
03615
03616 case CIF_Not_Exact:
03617 if (comp_phase < Decl_Semantics && stmt_type == Assignment_Stmt) {
03618
03619
03620
03621
03622 gen_sh(Before, Statement_Num_Stmt, stmt_start_line, stmt_start_col,
03623 FALSE, FALSE, TRUE);
03624 SH_PARENT_BLK_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = stmt_number;
03625 }
03626
03627 break;
03628
03629 case CIF_Stmt_Type_Error:
03630 PRINTMSG(stmt_start_line, 776, Internal, stmt_start_col);
03631
03632 default:
03633 file_line_num = get_line_and_file_id(stmt_start_line, &local_file_id);
03634
03635 Cif_Stmt_Type_Rec(c_i_f,
03636 local_stmt_type,
03637 local_file_id,
03638 file_line_num,
03639 stmt_start_col,
03640 stmt_number);
03641 }
03642
03643 TRACE (Func_Exit, "cif_stmt_type_rec", NULL);
03644
03645 return;
03646
03647 }
03648
03649
03650
03651
03652
03653
03654
03655
03656
03657
03658
03659
03660
03661
03662
03663
03664
03665
03666
03667 void cif_cont_line_rec(int continuation_type,
03668 int line_number)
03669 {
03670 int file_line_num;
03671 int local_file_id;
03672
03673
03674 file_line_num = get_line_and_file_id(line_number, &local_file_id);
03675
03676 Cif_Continuation_Rec(c_i_f,
03677 continuation_type,
03678 local_file_id,
03679 line_number,
03680 1);
03681
03682 return;
03683
03684 }
03685
03686
03687
03688
03689
03690
03691
03692
03693
03694
03695
03696
03697
03698
03699
03700
03701
03702
03703
03704 void cif_call_site_rec(int ir_idx,
03705 int gen_idx)
03706
03707 {
03708 int array_type;
03709 long attributes;
03710 int attr_idx;
03711 int bd_idx;
03712 char buffer[160];
03713 char char_len[20];
03714 int column;
03715 int derived_type_id;
03716 int file_line_num;
03717 int i;
03718 int info_idx;
03719 int k;
03720 int list_idx;
03721 int local_file_id;
03722 int misc_attrs;
03723 int num_args;
03724 int num_dims;
03725 opnd_type opnd;
03726 int pgm_unit_type;
03727 int rslt_id;
03728 int save_reference;
03729 int spec_idx;
03730 int specific_symbol_id;
03731 char string[20];
03732 int symbol_id;
03733 int type;
03734 char var_len_bound[3];
03735
03736
03737 TRACE (Func_Entry, "cif_call_site_rec", NULL);
03738
03739
03740
03741
03742
03743
03744
03745
03746 skip_struct_base = FALSE;
03747 file_line_num = get_line_and_file_id(IR_LINE_NUM_L(ir_idx),
03748 &local_file_id);
03749 spec_idx = IR_IDX_L(ir_idx);
03750
03751
03752
03753
03754
03755
03756 if (spec_idx != gen_idx && AT_DCL_ERR(gen_idx)) {
03757 goto EXIT;
03758 }
03759
03760 num_args = IR_LIST_CNT_R(ir_idx);
03761 list_idx = IR_IDX_R(ir_idx);
03762
03763 for (i = 1; i <= num_args; i++) {
03764
03765 info_idx = IL_ARG_DESC_IDX(list_idx);
03766
03767 if (info_idx == 0) {
03768
03769 }
03770 else if (arg_info_list[info_idx].ed.component) {
03771 arg_info_list[info_idx].ed.cif_id = list_idx;
03772 }
03773 else if (arg_info_list[info_idx].ed.cif_id != 0) {
03774
03775 }
03776 else if (arg_info_list[info_idx].ed.reference ||
03777 (IL_FLD(list_idx) == AT_Tbl_Idx &&
03778 ! AT_COMPILER_GEND(IL_IDX(list_idx)))) {
03779
03780
03781
03782 COPY_OPND(opnd, IL_OPND(list_idx));
03783 attr_idx = find_left_attr(&opnd);
03784
03785 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
03786 ATP_PROC(attr_idx) == Intrin_Proc) {
03787 attr_idx = ATP_INTERFACE_IDX(attr_idx);
03788 }
03789
03790 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03791 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03792 }
03793
03794 arg_info_list[info_idx].ed.cif_id = AT_CIF_SYMBOL_ID(attr_idx);
03795 }
03796 else {
03797 symbol_id = NEXT_SYMBOL_ID;
03798 char_len[0] = NULL_CHAR;
03799
03800 COPY_OPND(opnd, IL_OPND(list_idx));
03801 attr_idx = find_left_attr(&opnd);
03802
03803 type = (arg_info_list[info_idx].ed.type == Structure) ?
03804 ATT_CIF_DT_ID(TYP_IDX(arg_info_list[info_idx].ed.type_idx)) :
03805 arg_info_list[info_idx].ed.linear_type;
03806
03807 if (arg_info_list[info_idx].ed.type == Character) {
03808
03809 if (arg_info_list[info_idx].ed.char_len.fld == CN_Tbl_Idx) {
03810 convert_to_string(
03811 &CN_CONST(arg_info_list[info_idx].ed.char_len.idx),
03812 CN_TYPE_IDX(arg_info_list[info_idx].ed.char_len.idx),
03813 char_len);
03814 }
03815 else {
03816 char_len[0] = VAR_LEN_CHAR;
03817 char_len[1] = NULL_CHAR;
03818 }
03819 }
03820
03821 misc_attrs = 0;
03822 derived_type_id = 0;
03823
03824 if (arg_info_list[info_idx].ed.constant) {
03825
03826 if (IL_FLD(list_idx) == CN_Tbl_Idx) {
03827 attr_idx = IL_IDX(list_idx);
03828 }
03829 }
03830
03831 num_dims = arg_info_list[info_idx].ed.rank;
03832
03833 array_type = (num_dims > 0) ? 1 : 0;
03834
03835 if (fprintf(c_i_f,
03836 "%d%c%s%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%s%c%d%c%d",
03837 CIF_F90_OBJECT, EOI,
03838 "", EOI,
03839 symbol_id, EOI,
03840 SCP_CIF_ID(curr_scp_idx), EOI,
03841 cif_data_type(type), EOI,
03842 2, EOI,
03843 7,EOI,
03844 0,EOI,
03845 -1, EOI,
03846 misc_attrs, EOI,
03847 derived_type_id, EOI,
03848 char_len, EOI,
03849 num_dims, EOI,
03850 array_type) < 0) {
03851 Cif_Error();
03852 goto EXIT;
03853 }
03854
03855 buffer[0] = NULL_CHAR;
03856
03857 var_len_bound[0] = EOI;
03858 var_len_bound[1] = VAR_LEN_CHAR;
03859 var_len_bound[2] = NULL_CHAR;
03860
03861 for (k = 0; k < num_dims; k++) {
03862
03863 if (arg_info_list[info_idx].ed.constant &&
03864 attr_idx != NULL_IDX) {
03865
03866 bd_idx = ATD_ARRAY_IDX(attr_idx);
03867
03868 if (BD_LB_FLD(bd_idx, k+1) == CN_Tbl_Idx) {
03869 sprintf(string, "%c%s",
03870 EOI,
03871 convert_to_string(&CN_CONST(BD_LB_IDX(bd_idx,k+1)),
03872 CN_TYPE_IDX(BD_LB_IDX(bd_idx,k+1)),
03873 outbuf1));
03874 strcat(buffer, string);
03875 }
03876 else {
03877 strcat(buffer, var_len_bound);
03878 }
03879
03880 if (BD_UB_FLD(bd_idx, k+1) == CN_Tbl_Idx) {
03881 sprintf(string, "%c%s",
03882 EOI,
03883 convert_to_string(&CN_CONST(BD_UB_IDX(bd_idx,k+1)),
03884 CN_TYPE_IDX(BD_UB_IDX(bd_idx,k+1)),
03885 outbuf1));
03886 strcat(buffer, string);
03887 }
03888 else {
03889 strcat(buffer, var_len_bound);
03890 }
03891 }
03892 else {
03893 buffer[0] = EOI;
03894 buffer[1] = '1';
03895 buffer[2] = NULL_CHAR;
03896
03897 if (OPND_FLD(arg_info_list[info_idx].ed.shape[k]) ==
03898 CN_Tbl_Idx) {
03899 sprintf(string, "%c%s",
03900 EOI,
03901 convert_to_string(
03902 &CN_CONST(OPND_IDX(
03903 arg_info_list[info_idx].ed.shape[k])),
03904 CN_TYPE_IDX(OPND_IDX(
03905 arg_info_list[info_idx].ed.shape[k])),
03906 outbuf1));
03907 strcat(buffer, string);
03908 }
03909 else {
03910 strcat(buffer, var_len_bound);
03911 }
03912 }
03913
03914 if (fprintf(c_i_f, "%s", buffer) < 0) {
03915 Cif_Error();
03916 goto EXIT;
03917 }
03918 }
03919
03920 if (fprintf(c_i_f, "%c%d%c%d%c%d%c",
03921 EOI,
03922 0, EOI,
03923 0, EOI,
03924 0, EOR) < 0) {
03925 Cif_Error();
03926 goto EXIT;
03927 }
03928
03929 arg_info_list[info_idx].ed.cif_id = symbol_id;
03930 }
03931
03932 list_idx = IL_NEXT_LIST_IDX(list_idx);
03933 }
03934
03935 if (ATP_PROC(spec_idx) == Intrin_Proc && !ATI_USER_SPECIFIED(gen_idx)) {
03936
03937
03938
03939
03940 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
03941 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
03942 }
03943
03944 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
03945
03946 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
03947 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
03948 }
03949
03950 specific_symbol_id = 0;
03951 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
03952
03953 column = (ATP_PGM_UNIT(spec_idx) == Function) ? IR_COL_NUM_L(ir_idx) :
03954 IR_COL_NUM(ir_idx);
03955 if (! ATI_CIF_SEEN_IN_CALL(gen_idx)) {
03956
03957
03958
03959
03960 rslt_id = 0;
03961
03962 if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Function_Interface) {
03963 pgm_unit_type = CIF_F90_ET_FUNCTION;
03964
03965
03966
03967
03968
03969
03970 if (AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx)) == 0) {
03971 AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx)) = NEXT_SYMBOL_ID;
03972 }
03973
03974 rslt_id = AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx));
03975 }
03976 else if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Subroutine_Interface){
03977 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
03978
03979
03980
03981
03982 save_reference = AT_REFERENCED(spec_idx);
03983 AT_REFERENCED(spec_idx) = Referenced;
03984 cif_send_attr(spec_idx, NULL_IDX);
03985 AT_REFERENCED(spec_idx) = save_reference;
03986
03987 }
03988 else {
03989 pgm_unit_type = CIF_F90_ET_UNKNOWN;
03990 cif_send_attr(spec_idx, NULL_IDX);
03991 }
03992
03993 attributes = CIF_PGM_REFERENCE;
03994
03995 if (AT_PRIVATE(gen_idx)) {
03996 attributes = attributes | CIF_PGM_PRIVATE;
03997 }
03998
03999 Cif_F90_Entry_Rec(c_i_f,
04000 AT_OBJ_NAME_PTR(gen_idx),
04001 AT_CIF_SYMBOL_ID(gen_idx),
04002 SCP_CIF_ID(curr_scp_idx),
04003 pgm_unit_type,
04004 CIF_F90_PT_INTRINSIC,
04005 attributes,
04006 rslt_id,
04007 0,
04008 0,
04009 NULL);
04010 }
04011 }
04012 else if (spec_idx == gen_idx) {
04013
04014 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04015 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04016 }
04017
04018 symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04019 specific_symbol_id = 0;
04020
04021 if (ATP_PGM_UNIT(spec_idx) == Function) {
04022 column = IR_COL_NUM_L(ir_idx);
04023 }
04024 else {
04025 column = IR_COL_NUM(ir_idx);
04026 }
04027 }
04028 else if (ATI_INTERFACE_CLASS(gen_idx) == Defined_Assign_Interface) {
04029
04030 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04031 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04032 }
04033
04034 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04035
04036 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
04037 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
04038 }
04039
04040 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
04041 column = IR_COL_NUM(ir_idx);
04042 }
04043 else {
04044
04045 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04046 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04047 }
04048
04049 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04050
04051 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
04052 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
04053 }
04054
04055 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
04056
04057 if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Function_Interface) {
04058 column = IR_COL_NUM_L(ir_idx);
04059 }
04060 else {
04061 column = IR_COL_NUM(ir_idx);
04062 }
04063 }
04064
04065 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d",
04066 CIF_F90_CALLSITE, EOI,
04067 symbol_id, EOI,
04068 SCP_CIF_ID(curr_scp_idx), EOI,
04069 local_file_id, EOI,
04070 file_line_num, EOI,
04071 column, EOI,
04072 specific_symbol_id, EOI,
04073 num_args) < 0) {
04074
04075 Cif_Error();
04076 goto EXIT;
04077 }
04078
04079
04080
04081
04082 list_idx = IR_IDX_R(ir_idx);
04083
04084 for (i = 1; i <= num_args; i++) {
04085
04086 info_idx = IL_ARG_DESC_IDX(list_idx);
04087
04088 if (info_idx == 0) {
04089
04090 if (fprintf(c_i_f, "%c%d", EOI, 0) < 0) {
04091 Cif_Error();
04092 goto EXIT;
04093 }
04094 }
04095 else if (arg_info_list[info_idx].ed.component) {
04096
04097 if (fprintf(c_i_f, "%c%c", EOI, '%') < 0) {
04098 Cif_Error();
04099 goto EXIT;
04100 }
04101
04102 COPY_OPND(opnd,
04103 IL_OPND(arg_info_list[info_idx].ed.cif_id));
04104
04105 cif_number_of_struct_ids = 0;
04106
04107 output_struct_ids(&opnd);
04108
04109 if (fprintf(c_i_f, "%c%d", EOI, cif_number_of_struct_ids) < 0) {
04110 Cif_Error();
04111 goto EXIT;
04112 }
04113
04114 cif_number_of_struct_ids = -1;
04115
04116 if (! output_struct_ids(&opnd)) {
04117 Cif_Error();
04118 goto EXIT;
04119 }
04120
04121 if (fprintf(c_i_f, "%c%c", EOI, '%') < 0) {
04122 Cif_Error();
04123 goto EXIT;
04124 }
04125 }
04126 else {
04127 if (fprintf(c_i_f, "%c%d",
04128 EOI,
04129 arg_info_list[info_idx].ed.cif_id) < 0) {
04130 Cif_Error();
04131 goto EXIT;
04132 }
04133 }
04134
04135 list_idx = IL_NEXT_LIST_IDX(list_idx);
04136 }
04137
04138
04139
04140
04141 list_idx = IR_IDX_R(ir_idx);
04142
04143 for (i = 1; i <= num_args; i++) {
04144
04145 info_idx = IL_ARG_DESC_IDX(list_idx);
04146
04147 if (info_idx == 0) {
04148
04149 if (fprintf(c_i_f, "%c%d", EOI, 0) < 0) {
04150 Cif_Error();
04151 goto EXIT;
04152 }
04153 }
04154 else {
04155
04156 if (fprintf(c_i_f, "%c%d",
04157 EOI,
04158 arg_info_list[info_idx].ed.rank) < 0) {
04159 Cif_Error();
04160 goto EXIT;
04161 }
04162 }
04163
04164 list_idx = IL_NEXT_LIST_IDX(list_idx);
04165 }
04166
04167 if (fprintf(c_i_f,"%c", EOR) < 0) {
04168 Cif_Error();
04169 goto EXIT;
04170 }
04171
04172 EXIT:
04173
04174 TRACE (Func_Exit, "cif_call_site_rec", NULL);
04175
04176 return;
04177
04178 }
04179
04180
04181
04182
04183
04184
04185
04186
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198
04199 void cif_named_constant_rec(int attr_idx,
04200 int start_line,
04201 int start_column)
04202 {
04203 int cn_idx;
04204 int const_idx;
04205 int end_col;
04206 int end_line;
04207 int file_id;
04208 long64 length;
04209 boolean ok;
04210 long_type result[MAX_WORDS_FOR_NUMERIC];
04211 char str[80];
04212 int type_idx;
04213
04214
04215 TRACE (Func_Entry, "cif_named_constant_rec", NULL);
04216
04217 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
04218 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
04219 }
04220
04221 if (TYP_LINEAR(ATD_TYPE_IDX(attr_idx)) != Structure_Type &&
04222 ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
04223 const_idx = ATD_CONST_IDX(attr_idx);
04224 }
04225 else {
04226 const_idx = NULL_IDX;
04227 }
04228
04229 get_line_and_file_id(start_line, &file_id);
04230
04231 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c",
04232 CIF_F90_CONST, EOI,
04233 AT_CIF_SYMBOL_ID(attr_idx), EOI,
04234 (c_i_f == cif_actual_file) ?
04235 SCP_CIF_ID(curr_scp_idx) : 1, EOI,
04236 (const_idx) ? 0 : 1, EOI) < 0) {
04237 Cif_Error();
04238 }
04239
04240 if (const_idx) {
04241
04242 switch (TYP_TYPE(ATD_TYPE_IDX(attr_idx))) {
04243
04244 case Logical:
04245 if (fprintf(c_i_f, "%s",
04246 (THIS_IS_TRUE(&(CN_CONST(const_idx)),
04247 CN_TYPE_IDX(const_idx)) ?
04248
04249 ".TRUE." : ".FALSE.")) < 0) {
04250 Cif_Error();
04251 }
04252
04253 break;
04254
04255 case Integer:
04256 case Real:
04257 case Complex:
04258
04259 if (fprintf(c_i_f, "%s", convert_to_string(&CN_CONST(const_idx),
04260 CN_TYPE_IDX(const_idx),
04261 str)) < 0) {
04262 Cif_Error();
04263 }
04264
04265 break;
04266
04267 case Typeless:
04268 if (TYP_LINEAR(CN_TYPE_IDX(const_idx)) == Typeless_4 ||
04269 TYP_LINEAR(CN_TYPE_IDX(const_idx)) == Typeless_8) {
04270
04271 if (fprintf(c_i_f, "%s",
04272 convert_to_string(&CN_CONST(const_idx),
04273 CN_TYPE_IDX(const_idx),
04274 str)) < 0) {
04275 Cif_Error();
04276 }
04277 }
04278 else if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04279 Cif_Error();
04280 }
04281
04282 break;
04283
04284 case Character:
04285
04286 C_TO_F_INT(result, TARGET_CHARS_PER_WORD, CG_INTEGER_DEFAULT_TYPE);
04287
04288 cn_idx = TYP_IDX(CN_TYPE_IDX(const_idx));
04289 type_idx = CG_INTEGER_DEFAULT_TYPE;
04290
04291 ok = folder_driver((char *) &CN_CONST(cn_idx),
04292 CN_TYPE_IDX(cn_idx),
04293 (char *) result,
04294 type_idx,
04295 result,
04296 &type_idx,
04297 stmt_start_line,
04298 stmt_start_col,
04299 2,
04300 Mod_Opr);
04301
04302 ok |= folder_driver((char *) result,
04303 type_idx,
04304 (char *) &CN_CONST(CN_INTEGER_ZERO_IDX),
04305 CN_TYPE_IDX(CN_INTEGER_ZERO_IDX),
04306 result,
04307 &type_idx,
04308 stmt_start_line,
04309 stmt_start_col,
04310 2,
04311 Eq_Opr);
04312
04313
04314 if (ok && THIS_IS_TRUE(result, type_idx)) {
04315
04316 if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04317 Cif_Error();
04318 }
04319 }
04320 else {
04321 length = CN_INT_TO_C(TYP_IDX(CN_TYPE_IDX(const_idx)));
04322 ((char *) &CN_CONST(const_idx)) [length] = NULL_CHAR;
04323
04324 if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04325 Cif_Error();
04326 }
04327
04328 ((char *) &CN_CONST(const_idx)) [length] = ' ';
04329 }
04330
04331 break;
04332
04333 }
04334 }
04335
04336
04337
04338
04339
04340 if (start_line != 0) {
04341 prev_char_line_and_col(&end_line, &end_col);
04342 }
04343 else {
04344 file_id = 0;
04345 end_line = 0;
04346 end_col = 0;
04347 }
04348
04349 if (fprintf(c_i_f, "%c%d%c%d%c%d%c%d%c%d%c",
04350 EOI,
04351 file_id, EOI,
04352 start_line, EOI,
04353 start_column, EOI,
04354 end_line, EOI,
04355 end_col, EOR) < 0) {
04356 Cif_Error();
04357 }
04358
04359 TRACE (Func_Exit, "cif_named_constant_rec", NULL);
04360
04361 return;
04362
04363 }
04364
04365
04366
04367
04368
04369
04370
04371
04372
04373
04374
04375
04376
04377
04378
04379
04380
04381
04382 void cif_loop_def_rec(void)
04383 {
04384 int construct_name_id;
04385 int do_sh_idx;
04386 int do_var_idx;
04387 int end_file_id;
04388 int end_line;
04389 int il_idx;
04390 int loop_info_il_idx;
04391 int loop_ir_idx;
04392 int loop_label_id;
04393 int loop_type;
04394 int lcv_symbol_id;
04395 int start_file_id;
04396 int start_line;
04397
04398
04399 TRACE (Func_Entry, "cif_loop_def_rec", NULL);
04400
04401 do_sh_idx = SH_PARENT_BLK_IDX(curr_stmt_sh_idx);
04402
04403 if (do_sh_idx == NULL_IDX || SH_COMPILER_GEN(do_sh_idx)) {
04404 TRACE (Func_Exit, "cif_loop_def_rec", NULL);
04405 return;
04406 }
04407
04408 loop_ir_idx = SH_IR_IDX(do_sh_idx);
04409 loop_info_il_idx = IR_IDX_R(loop_ir_idx);
04410
04411 if (SH_STMT_TYPE(do_sh_idx) == Do_Iterative_Stmt) {
04412 loop_type = CIF_LP_DO;
04413
04414
04415
04416
04417
04418 if (IL_FLD(loop_info_il_idx) == IL_Tbl_Idx) {
04419 il_idx = IL_IDX(loop_info_il_idx);
04420 }
04421 else {
04422 il_idx = loop_info_il_idx;
04423 }
04424
04425 if (IL_FLD(il_idx) == AT_Tbl_Idx) {
04426 do_var_idx = IL_IDX(il_idx);
04427 }
04428 else {
04429
04430
04431
04432 do_var_idx = IR_IDX_L(IL_IDX(il_idx));
04433 }
04434
04435 if (AT_CIF_SYMBOL_ID(do_var_idx) == 0) {
04436 AT_CIF_SYMBOL_ID(do_var_idx) = NEXT_SYMBOL_ID;
04437 }
04438
04439 lcv_symbol_id = AT_CIF_SYMBOL_ID(do_var_idx);
04440 }
04441 else {
04442 loop_type = (SH_STMT_TYPE(do_sh_idx) == Do_While_Stmt) ?
04443 CIF_LP_DOWHILE : CIF_LP_DO_INFINITE;
04444 lcv_symbol_id = 0;
04445 }
04446
04447
04448
04449
04450
04451
04452
04453 start_line = get_line_and_file_id(SH_GLB_LINE(do_sh_idx),
04454 &start_file_id);
04455
04456 end_line = get_line_and_file_id(stmt_end_line, &end_file_id);
04457
04458
04459 loop_info_il_idx = IL_NEXT_LIST_IDX(IL_NEXT_LIST_IDX(loop_info_il_idx));
04460 il_idx = IL_IDX(loop_info_il_idx);
04461
04462 if (IL_FLD(il_idx) == NO_Tbl_Idx) {
04463 loop_label_id = 0;
04464 }
04465 else {
04466
04467 if (AT_CIF_SYMBOL_ID(