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
00038
00039
00040
00041 static char USMID[] = "\n@(#)5.0_pl/sources/fecif.c 5.9 10/14/99 12:53:57\n";
00042
00043 # include "defines.h"
00044
00045
00046 # define __NLS_INTERNALS 1
00047
00048
00049 # include <nl_types.h>
00050
00051
00052 # if defined(_HOST_OS_LINUX) || defined(_HOST_OS_DARWIN)
00053 # include <nlcatmsg.h>
00054 # endif
00055
00056
00057
00058 # include <time.h>
00059
00060
00061 # define CIF_VERSION 3
00062
00063 # include "cif.h"
00064
00065 # include "cifprocs.h"
00066
00067
00068 # include "host.m"
00069 # include "host.h"
00070 # include "target.m"
00071 # include "target.h"
00072
00073 # include "globals.m"
00074 # include "tokens.m"
00075 # include "sytb.m"
00076 # include "p_globals.m"
00077 # include "s_globals.m"
00078 # include "debug.m"
00079 # include "cif.m"
00080 # include "fecif.m"
00081
00082 # include "globals.h"
00083 # include "tokens.h"
00084 # include "sytb.h"
00085 # include "p_globals.h"
00086 # include "s_globals.h"
00087 # include "fecif.h"
00088
00089 # if defined(_HOST_OS_LINUX)
00090 # include <sys/sysinfo.h>
00091 # elif defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX)
00092 # include <sys/systeminfo.h>
00093 # elif defined(_HOST_OS_DARWIN)
00094 # include <sys/param.h>
00095 # endif
00096
00097
00098
00099
00100
00101
00102 static int cif_data_type(int);
00103 static void cif_flush_include_recs (void);
00104 static int get_line_and_file_id (int, int *);
00105 static void output_minimal_object_rec (int);
00106 static void process_attr_list (int, boolean);
00107 static boolean output_struct_ids(opnd_type *);
00108
00109 static char output_buf[2][64];
00110
00111 # define outbuf1 output_buf[0]
00112 # define outbuf2 output_buf[1]
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 void init_cif(char *comp_date_time, char *release_level)
00132 {
00133 char cif_date[9];
00134 char cif_time[9];
00135 char cpu_name[MAXHOSTNAMELEN + 1];
00136 char month[4];
00137 int save_cif_file_id;
00138 char *msg_cat_name;
00139
00140 # if defined(_GETPMC_AVAILABLE)
00141 extern int GETPMC(long *, char *);
00142
00143 union {long int_form;
00144 char char_form[9];
00145 } host_cpu_type;
00146
00147 union host_machine_entry {struct {long mcpmt;
00148 Ulong unused[127];
00149 } fld;
00150 long host_tbl[128];
00151 };
00152
00153 typedef union host_machine_entry host_machine_type;
00154
00155 host_machine_type host_machine_info;
00156
00157 # elif defined(_HOST_OS_SOLARIS) || (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX) || defined(_HOST_OS_DARWIN))
00158 char host_cpu_type[9];
00159 # endif
00160
00161
00162 TRACE (Func_Entry, "init_cif", NULL);
00163
00164 cif_end_unit_column = 0;
00165 cif_file_id = 2;
00166 cif_first_pgm_unit = TRUE;
00167 cif_need_unit_rec = TRUE;
00168 cif_pgm_unit_error_recovery = FALSE;
00169 cif_pgm_unit_start_line = 1;
00170
00171
00172
00173
00174
00175
00176
00177 if ((cif_C_opts & CMD_PROVIDED_CIF) || cif_flags != 0) {
00178
00179 if ((cif_actual_file = fopen(cif_name, "w")) == NULL) {
00180 PRINTMSG(0, 556, Log_Error, 0);
00181 perror("Reason");
00182
00183 # ifdef _DEBUG
00184
00185 fprintf(stderr, " Trying to open file %s\n", cif_name);
00186 system("df /tmp");
00187
00188 # endif
00189
00190 exit_compiler(RC_USER_ERROR);
00191 }
00192 }
00193 else {
00194
00195 if (! get_temp_file("w+", &cif_actual_file, cif_name)) {
00196 PRINTMSG(1, 556, Log_Error, 0);
00197 perror(" Reason");
00198
00199 # ifdef _DEBUG
00200
00201 fprintf(stderr, " Trying to open file %s\n", cif_name);
00202 system("df /tmp");
00203
00204 # endif
00205
00206 exit_compiler(RC_USER_ERROR);
00207 }
00208 }
00209
00210 c_i_f = cif_actual_file;
00211
00212
00213
00214
00215
00216
00217
00218 if (! get_temp_file("w+", &cif_tmp_file, cif_tmp_file_name)) {
00219 PRINTMSG(0, 556, Log_Error, 0);
00220 perror("Reason");
00221
00222 # ifdef _DEBUG
00223
00224 fprintf(stderr, " Trying to open file %s\n", cif_name);
00225 system("df /tmp");
00226
00227 # endif
00228
00229 if (c_i_f == cif_actual_file) {
00230
00231 cif_actual_file = NULL;
00232 }
00233
00234 fclose(c_i_f);
00235
00236 if (! (cif_C_opts & CMD_PROVIDED_CIF)) {
00237 remove(cif_name);
00238 }
00239
00240 exit_compiler(RC_USER_ERROR);
00241 }
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251 memcpy(month, comp_date_time+4, 3);
00252
00253 switch (month[0]) {
00254
00255 case 'A':
00256 strcpy(cif_date, (month[1] == 'p') ? "04/" : "08/");
00257 break;
00258
00259 case 'D':
00260 strcpy(cif_date, "12/");
00261 break;
00262
00263 case 'F':
00264 strcpy(cif_date, "02/");
00265 break;
00266
00267 case 'J':
00268 if (month[1] == 'a') {
00269 strcpy(cif_date, "01/");
00270 }
00271 else {
00272 strcpy(cif_date, (month[2] == 'n') ? "06/" : "07/");
00273 }
00274 break;
00275
00276 case 'M':
00277 strcpy(cif_date, (month[2] == 'r') ? "03/" : "05/");
00278 break;
00279
00280 case 'N':
00281 strcpy(cif_date, "11/");
00282 break;
00283
00284 case 'O':
00285 strcpy(cif_date, "10/");
00286 break;
00287
00288 case 'S':
00289 strcpy(cif_date, "09/");
00290 }
00291
00292 cif_date[3] = (comp_date_time[8] == ' ') ? '0' : comp_date_time[8];
00293 cif_date[4] = comp_date_time[9];
00294 cif_date[5] = '/';
00295 cif_date[6] = comp_date_time[14];
00296 cif_date[7] = comp_date_time[15];
00297 cif_date[8] = EOS;
00298
00299 memcpy(cif_time, comp_date_time+18, 8);
00300 cif_time[8] = NULL_CHAR;
00301
00302 # if defined(_HOST_OS_LINUX) || defined(_HOST_OS_DARWIN)
00303 msg_cat_name = "shouldnotgethere";
00304 # else
00305 msg_cat_name = (char *) __cat_path_name(msg_sys);
00306 # endif
00307 # if defined(_HOST_OS_LINUX)
00308 strcpy(cpu_name, "LINUX");
00309
00310
00311 # elif defined(_HOST_OS_DARWIN)
00312 strcpy(cpu_name, "DARWIN");
00313 # elif defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX)
00314
00315 if (sysinfo(SI_HOSTNAME, cpu_name, ((long int) MAXHOSTNAMELEN)) < 0L) {
00316 Cif_Error();
00317 }
00318
00319 # else
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) || defined(_HOST_OS_LINUX))
00335 strcpy(host_cpu_type, "SGI");
00336 # elif defined(_HOST_OS_DARWIN)
00337 strcpy(host_cpu_type, "MAC");
00338 # endif
00339
00340 Cif_Cifhdr_Rec(c_i_f,
00341 CIF_LG_F90,
00342 release_level,
00343 cif_date,
00344 cif_time,
00345 group_code,
00346 1,
00347 cpu_name,
00348
00349 # if defined(_GETPMC_AVAILABLE)
00350 host_cpu_type.char_form);
00351 # elif defined(_HOST_OS_SOLARIS) || defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX) || defined(_HOST_OS_DARWIN)
00352 host_cpu_type);
00353 # endif
00354
00355 Cif_Src_Pos_Rec(c_i_f,
00356 CIF_SRC_KIND_MAIN,
00357 2,
00358 0,
00359 0,
00360 0,
00361 2,
00362 0,
00363 0,
00364 0);
00365
00366
00367 save_cif_file_id = cif_file_id;
00368 cif_file_id = 1;
00369 cif_file_name_rec(msg_cat_name, (char *) NULL);
00370 cif_file_id = save_cif_file_id;
00371
00372 if (cif_flags & COMPILER_RECS) {
00373 cif_enable_disable_rec();
00374 cif_misc_compiler_opts_rec();
00375 cif_optimization_opts_rec();
00376 cif_machine_characteristics_rec();
00377 }
00378
00379
00380
00381
00382
00383
00384
00385 if (orig_cmd_line != NULL) {
00386 Cif_Orig_Cmd(c_i_f, orig_cmd_line);
00387 MEM_FREE(orig_cmd_line);
00388 }
00389
00390
00391
00392
00393
00394
00395
00396 c_i_f = cif_tmp_file;
00397
00398 TRACE (Func_Exit, "init_cif", NULL);
00399
00400 return;
00401
00402 }
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421 void cif_prog_unit_init(void)
00422 {
00423
00424 TRACE (Func_Entry, "cif_prog_unit_init", NULL);
00425
00426 cif_derived_type_id = 101;
00427 cif_symbol_or_scope_id = 3;
00428
00429
00430 SCP_CIF_ID(curr_scp_idx) =
00431 (BLK_TYPE(blk_stk_idx) == Program_Blk) ? 1 : NEXT_SCOPE_ID;
00432
00433 cif_end_unit_column = 0;
00434 cif_need_unit_rec = TRUE;
00435 cif_pgm_unit_error_recovery = FALSE;
00436
00437 c_i_f = cif_tmp_file;
00438
00439 TRACE (Func_Exit, "cif_prog_unit_init", NULL);
00440
00441 return;
00442
00443 }
00444
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 void cif_send_sytb()
00474 {
00475 int al_idx;
00476 #ifdef KEY
00477 int attr_idx = 0;
00478 #else
00479 int attr_idx;
00480 #endif
00481 long_type blk_len;
00482 int module_symbol_id;
00483 int name_idx;
00484 long_type result[MAX_WORDS_FOR_INTEGER];
00485 int sb_idx;
00486 int stor_class;
00487 int type_idx;
00488
00489
00490 TRACE (Func_Entry, "cif_send_sytb", NULL);
00491
00492 for (sb_idx = 1; sb_idx <= stor_blk_tbl_idx; sb_idx++) {
00493
00494 if (SB_SCP_IDX(sb_idx) != curr_scp_idx) {
00495 continue;
00496 }
00497
00498 if (SB_CIF_SYMBOL_ID(sb_idx) == 0) {
00499 SB_CIF_SYMBOL_ID(sb_idx) = NEXT_SYMBOL_ID;
00500 }
00501
00502 if (SB_BLK_TYPE(sb_idx) == Common) {
00503 stor_class = CIF_CB_REG;
00504 }
00505 else if (SB_BLK_TYPE(sb_idx) == Task_Common) {
00506 stor_class = CIF_CB_TASK;
00507 }
00508 else {
00509 continue;
00510 }
00511
00512 if (SB_USE_ASSOCIATED(sb_idx)) {
00513
00514 if (AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx)) == 0) {
00515 AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx)) = NEXT_SYMBOL_ID;
00516 }
00517
00518 module_symbol_id = AT_CIF_SYMBOL_ID(SB_MODULE_IDX(sb_idx));
00519 }
00520 else {
00521
00522
00523
00524
00525
00526
00527
00528
00529 module_symbol_id = 0;
00530
00531 if (SB_ORIG_SCP_IDX(sb_idx) != NULL_IDX) {
00532 attr_idx = SCP_ATTR_IDX(SB_ORIG_SCP_IDX(sb_idx));
00533
00534 if (ATP_PGM_UNIT(attr_idx) == Module) {
00535 module_symbol_id = AT_CIF_SYMBOL_ID(attr_idx);
00536 }
00537 }
00538 }
00539
00540
00541
00542
00543 blk_len = 0;
00544
00545 if (SB_LEN_FLD(sb_idx) == CN_Tbl_Idx) {
00546 type_idx = CN_TYPE_IDX(SB_LEN_IDX(sb_idx));
00547
00548 if (folder_driver((char *) &CN_CONST(SB_LEN_IDX(sb_idx)),
00549 CN_TYPE_IDX(SB_LEN_IDX(sb_idx)),
00550 (char *) &CN_CONST(CN_INTEGER_THREE_IDX),
00551 CN_TYPE_IDX(CN_INTEGER_THREE_IDX),
00552 result,
00553 &type_idx,
00554 SB_DEF_LINE(sb_idx),
00555 SB_DEF_COLUMN(sb_idx),
00556 2,
00557 Shiftr_Opr)) {
00558 blk_len = (long) F_INT_TO_C(result, TYP_LINEAR(type_idx));
00559 }
00560 }
00561
00562
00563
00564
00565 Cif_F90_Comblk_Rec(c_i_f,
00566 SB_NAME_PTR(sb_idx),
00567 SB_CIF_SYMBOL_ID(sb_idx),
00568 SCP_CIF_ID(curr_scp_idx),
00569 stor_class,
00570 module_symbol_id,
00571 blk_len,
00572 0);
00573 }
00574
00575 if (cif_flags & INFO_RECS) {
00576
00577 for (name_idx = SCP_LN_FW_IDX(curr_scp_idx) + 1;
00578 name_idx < SCP_LN_LW_IDX(curr_scp_idx); name_idx++) {
00579
00580 attr_idx = LN_ATTR_IDX(name_idx);
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
00607 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
00608 ATD_CLASS(attr_idx) == Variable &&
00609 ! ATD_SEEN_OUTSIDE_IMP_DO(attr_idx) &&
00610 ! ATD_SEEN_AS_IO_LCV(attr_idx)) {
00611 continue;
00612 }
00613
00614 cif_send_attr(attr_idx, NULL_IDX);
00615 }
00616
00617 process_attr_list(SCP_ATTR_LIST(curr_scp_idx), FALSE);
00618 process_attr_list(SCP_CIF_ERR_LIST(curr_scp_idx), TRUE);
00619 }
00620 else {
00621
00622
00623
00624 for (name_idx = SCP_LN_FW_IDX(curr_scp_idx) + 1;
00625 name_idx < SCP_LN_LW_IDX(curr_scp_idx); name_idx++) {
00626
00627 attr_idx = LN_ATTR_IDX(name_idx);
00628
00629
00630
00631 if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit &&
00632 AT_OBJ_CLASS(attr_idx) != Stmt_Func &&
00633 AT_OBJ_CLASS(attr_idx) != Interface) {
00634 continue;
00635 }
00636
00637 cif_send_attr(attr_idx, NULL_IDX);
00638 }
00639
00640
00641
00642
00643
00644
00645 al_idx = SCP_ATTR_LIST(curr_scp_idx);
00646
00647 while (al_idx != NULL_IDX) {
00648
00649 if ((AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
00650 AT_CIF_SYMBOL_ID(AL_ATTR_IDX(al_idx)) == 0) ||
00651 AT_OBJ_CLASS(attr_idx) == Interface) {
00652 cif_send_attr(AL_ATTR_IDX(al_idx), NULL_IDX);
00653 }
00654
00655 al_idx = AL_NEXT_IDX(al_idx);
00656 }
00657 }
00658
00659 TRACE (Func_Exit, "cif_send_sytb", NULL);
00660
00661 return;
00662
00663 }
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683 void cif_send_attr(int attr_idx,
00684 int dt_attr_idx)
00685
00686 {
00687 #ifdef KEY
00688 long attributes = 0;
00689 #else
00690 long attributes;
00691 #endif
00692 int bd_idx;
00693 char buffer[160];
00694 char char_len[20];
00695 int darg_idx;
00696 linear_type_type data_type;
00697 int derived_type;
00698 #ifdef KEY
00699 int dt_idx = 0;
00700 #else
00701 int dt_idx;
00702 #endif
00703 int i;
00704 int interface_idx;
00705 int interface_type;
00706 int namelist_idx;
00707 #ifdef KEY
00708 int num_dargs = 0;
00709 #else
00710 int num_dargs;
00711 #endif
00712 int num_namelist;
00713 char *obj_name_ptr;
00714 long64 offset;
00715 char offset_buf[20];
00716 #ifdef KEY
00717 int pgm_unit_type = 0;
00718 #else
00719 int pgm_unit_type;
00720 #endif
00721 int pointer_id;
00722 int rslt_id;
00723 int rslt_idx;
00724 boolean save_cif_done;
00725 # if 0
00726 int save_symbol_id;
00727 # endif
00728 #ifdef KEY
00729 int scope_id = 0;
00730 #else
00731 int scope_id;
00732 #endif
00733 int sn_idx;
00734 int storage_class;
00735 int storage_id;
00736 char string[20];
00737 int symbol_class;
00738 int type_idx;
00739
00740
00741 TRACE (Func_Entry, "cif_send_attr", NULL);
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778 if (AT_CIF_DONE(attr_idx)) {
00779 goto EXIT;
00780 }
00781
00782 if (!AT_CIF_IN_USAGE_REC(attr_idx) &&
00783 ((AT_COMPILER_GEND(attr_idx) &&
00784 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
00785 ATD_CLASS(attr_idx) != Compiler_Tmp ||
00786 ! ATD_TMP_NEEDS_CIF(attr_idx))) ||
00787 (AT_ATTR_LINK(attr_idx) != NULL_IDX &&
00788 AT_OBJ_CLASS(attr_idx) != Pgm_Unit))) {
00789 goto EXIT;
00790 }
00791
00792
00793 AT_CIF_DONE(attr_idx) = TRUE;
00794
00795
00796 switch (AT_OBJ_CLASS(attr_idx)) {
00797
00798
00799
00800
00801
00802 case Data_Obj:
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821 if (AT_DCL_ERR(attr_idx)) {
00822 output_minimal_object_rec(attr_idx);
00823 goto EXIT;
00824 }
00825
00826 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
00827 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
00828 }
00829
00830 char_len[0] = NULL_CHAR;
00831 type_idx = ATD_TYPE_IDX(attr_idx);
00832
00833 if (TYP_TYPE(type_idx) == Structure) {
00834
00835 if (! AT_DCL_ERR(TYP_IDX(type_idx))) {
00836 dt_idx = (AT_ATTR_LINK(TYP_IDX(type_idx)) == NULL_IDX) ?
00837 TYP_IDX(type_idx) : AT_ATTR_LINK(TYP_IDX(type_idx));
00838 }
00839 else {
00840 output_minimal_object_rec(attr_idx);
00841 goto EXIT;
00842 }
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853 if (ATT_CIF_DT_ID(dt_idx) == 0) {
00854 cif_send_attr(dt_idx, NULL_IDX);
00855 }
00856
00857
00858 data_type = (linear_type_type) ATT_CIF_DT_ID(dt_idx);
00859 }
00860 else {
00861 data_type = TYP_LINEAR(type_idx);
00862
00863 if (TYP_TYPE(type_idx) == Character) {
00864
00865 if (TYP_FLD(type_idx) == CN_Tbl_Idx) {
00866 convert_to_string(&CN_CONST(TYP_IDX(type_idx)),
00867 CN_TYPE_IDX(TYP_IDX(type_idx)),
00868 char_len);
00869 }
00870 else {
00871 char_len[0] = (TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char) ?
00872 ASSUMED_SIZE_CHAR :
00873 VAR_LEN_CHAR;
00874 char_len[1] = NULL_CHAR;
00875 }
00876 }
00877 }
00878
00879
00880 obj_name_ptr = AT_OBJ_NAME_PTR(attr_idx);
00881
00882 switch (ATD_CLASS(attr_idx)) {
00883
00884 case Struct_Component:
00885 storage_class = CIF_F90_ST_NO_STORAGE;
00886 storage_id = 0;
00887 offset = (ATD_OFFSET_FLD(attr_idx) == CN_Tbl_Idx) ?
00888 CN_INT_TO_C(ATD_CPNT_OFFSET_IDX(attr_idx)) : -1;
00889 symbol_class = CIF_F90_SC_STRUCT;
00890 attributes = 0;
00891 derived_type = ATT_CIF_DT_ID(dt_attr_idx);
00892 break;
00893
00894 case Constant:
00895 storage_class = CIF_F90_ST_NO_STORAGE;
00896
00897 if (AT_USE_ASSOCIATED(attr_idx)) {
00898
00899 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
00900
00901
00902
00903
00904
00905
00906
00907
00908 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
00909 }
00910
00911 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
00912 }
00913 else if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
00914 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
00915 }
00916 else {
00917 storage_id = 0;
00918 }
00919
00920 offset = -1;
00921 symbol_class = CIF_F90_SC_NAMED_CONST;
00922 attributes = 0;
00923 derived_type = 0;
00924
00925
00926
00927
00928
00929 if (AT_USE_ASSOCIATED(attr_idx)) {
00930 cif_named_constant_rec(attr_idx, 0, 0);
00931 }
00932
00933 break;
00934
00935 case Function_Result:
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950 if (get_other_func_rslt_info) {
00951
00952 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure) {
00953 AT_CIF_DONE(dt_idx) = FALSE;
00954 AT_CIF_SYMBOL_ID(dt_idx) = 0;
00955 ATT_CIF_DT_ID(dt_idx) = 0;
00956 cif_send_attr(dt_idx, NULL_IDX);
00957 data_type = (linear_type_type) ATT_CIF_DT_ID(dt_idx);
00958 }
00959 }
00960
00961
00962 if (ATD_STOR_BLK_IDX(attr_idx) == NULL_IDX) {
00963 storage_class = CIF_F90_ST_NO_STORAGE;
00964 storage_id = 0;
00965 }
00966 else {
00967
00968
00969
00970 storage_class =
00971 (SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Formal) ?
00972 CIF_F90_ST_DUMMY : CIF_F90_ST_STACK;
00973
00974
00975
00976
00977 storage_id = (AT_USE_ASSOCIATED(attr_idx)) ?
00978 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) : 0;
00979 }
00980
00981 offset = -1;
00982 symbol_class = CIF_F90_SC_FUNC_RESULT;
00983 attributes = 0;
00984 derived_type = 0;
00985
00986 if (ATP_PROC(ATD_FUNC_IDX(attr_idx)) == Intrin_Proc &&
00987 AT_OBJ_NAME(attr_idx) == '_') {
00988 ++obj_name_ptr;
00989 }
00990
00991 break;
00992
00993 case Dummy_Argument:
00994 derived_type = 0;
00995 symbol_class = CIF_F90_SC_VARIABLE;
00996 attributes = (AT_CIF_USE_IN_BND(attr_idx)) ? CIF_DARG_IN_BND : 0;
00997 storage_id = 0;
00998
00999 if (ATD_SF_DARG(attr_idx)) {
01000 offset = -1;
01001 storage_class = CIF_F90_ST_NO_STORAGE;
01002 }
01003 else {
01004
01005
01006
01007
01008
01009
01010
01011
01012 storage_class = CIF_F90_ST_DUMMY;
01013 offset = 0;
01014 sn_idx = ATP_FIRST_IDX(SCP_ATTR_IDX(curr_scp_idx));
01015
01016 for (i = 1; i <= ATP_NUM_DARGS(SCP_ATTR_IDX(curr_scp_idx)); ++i) {
01017
01018 if (attr_idx == SN_ATTR_IDX(sn_idx)) {
01019 offset = (ATP_EXTRA_DARG(SCP_ATTR_IDX(curr_scp_idx))) ?
01020 (i - 1) : i;
01021 break;
01022 }
01023 else {
01024 ++sn_idx;
01025 }
01026 }
01027 }
01028
01029 break;
01030
01031 default:
01032 derived_type = 0;
01033 symbol_class = CIF_F90_SC_VARIABLE;
01034 attributes = 0;
01035 offset = (ATD_OFFSET_ASSIGNED(attr_idx) &&
01036 ATD_OFFSET_FLD(attr_idx) == CN_Tbl_Idx) ?
01037 CN_INT_TO_C(ATD_OFFSET_IDX(attr_idx)) : -1;
01038
01039 storage_id = SB_CIF_SYMBOL_ID(ATD_STOR_BLK_IDX(attr_idx));
01040
01041 switch (SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx))) {
01042
01043 case Static:
01044 case Static_Local:
01045 case Static_Named:
01046
01047 if (ATD_ALLOCATABLE(attr_idx) || ATD_POINTER(attr_idx)) {
01048 storage_class = CIF_F90_ST_BASED;
01049 }
01050 else {
01051 storage_class = CIF_F90_ST_STATIC;
01052 }
01053
01054 if (SB_MODULE(ATD_STOR_BLK_IDX(attr_idx))) {
01055 symbol_class = CIF_F90_SC_MODULE;
01056
01057 storage_id = (AT_USE_ASSOCIATED(attr_idx)) ?
01058 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) :
01059 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
01060 }
01061
01062 break;
01063
01064 case Stack:
01065 case Equivalenced:
01066 if (ATD_ALLOCATABLE(attr_idx) || ATD_POINTER(attr_idx)) {
01067 storage_class = CIF_F90_ST_BASED;
01068 }
01069 else {
01070 storage_class = (ATD_AUXILIARY(attr_idx) == 0) ?
01071 CIF_F90_ST_STACK : CIF_F90_ST_AUXILIARY;
01072 }
01073
01074 break;
01075
01076 case Common:
01077 case Task_Common:
01078 symbol_class = (ATD_EQUIV(attr_idx) && !ATD_IN_COMMON(attr_idx)) ?
01079 CIF_F90_SC_EQUIV :
01080 CIF_F90_SC_COMMON;
01081 storage_class = (ATD_AUXILIARY(attr_idx) == 0) ?
01082 CIF_F90_ST_COMMON : CIF_F90_ST_AUXILIARY;
01083 break;
01084
01085 case Formal:
01086 storage_class = CIF_F90_ST_DUMMY;
01087 break;
01088
01089 case Based:
01090 storage_class = (ATD_CLASS(attr_idx) == CRI__Pointee) ?
01091 CIF_F90_ST_POINTEE : CIF_F90_ST_BASED;
01092 break;
01093
01094 default:
01095 storage_class = CIF_F90_ST_ERROR;
01096 break;
01097 }
01098 break;
01099 }
01100
01101
01102
01103 switch (TYP_DESC(type_idx)) {
01104 case Default_Typed:
01105 attributes = attributes | CIF_DEFAULT_TYPED;
01106 break;
01107
01108 case Star_Typed:
01109 attributes = attributes | CIF_STAR_TYPED;
01110 break;
01111
01112 case Kind_Typed:
01113 attributes = attributes | CIF_KIND_TYPED;
01114 break;
01115 }
01116
01117 if (!AT_TYPED(attr_idx)) {
01118 attributes = attributes | CIF_IMPLICITLY_TYPED;
01119 }
01120
01121 if (ATD_SAVED(attr_idx)) {
01122 attributes = attributes | CIF_SAVED;
01123 }
01124
01125 if (ATD_DATA_INIT(attr_idx)) {
01126 attributes = attributes | CIF_DATA_INIT;
01127 attributes = attributes | CIF_SAVED;
01128 }
01129
01130 if (ATD_DCL_EQUIV(attr_idx)) {
01131 attributes = attributes | CIF_EQUIVALENCED;
01132 }
01133
01134 if (ATD_ALLOCATABLE(attr_idx)) {
01135 attributes = attributes | CIF_ALLOCATABLE;
01136 }
01137
01138 if (ATD_CLASS(attr_idx) == Dummy_Argument) {
01139
01140 switch (ATD_INTENT(attr_idx)) {
01141 case Intent_Unseen:
01142 break;
01143
01144 case Intent_In:
01145 attributes = attributes | CIF_INTENT_IN;
01146 break;
01147
01148 case Intent_Out:
01149 attributes = attributes | CIF_INTENT_OUT;
01150 break;
01151
01152 case Intent_Inout:
01153 attributes = attributes | CIF_INTENT_INOUT;
01154 break;
01155 }
01156
01157 if (AT_OPTIONAL(attr_idx)) {
01158 attributes = attributes | CIF_OPTIONAL;
01159 }
01160 }
01161
01162 pointer_id = 0;
01163
01164 if (ATD_POINTER(attr_idx)) {
01165 attributes = attributes | CIF_POINTER;
01166 }
01167 else if (ATD_CLASS(attr_idx) == CRI__Pointee) {
01168 attributes = attributes | CIF_CRI_POINTEE;
01169
01170 if (AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx)) == 0) {
01171 AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx)) = NEXT_SYMBOL_ID;
01172 }
01173
01174 pointer_id = AT_CIF_SYMBOL_ID(ATD_PTR_IDX(attr_idx));
01175 }
01176
01177 if (AT_PRIVATE(attr_idx)) {
01178 attributes = attributes | CIF_PRIVATE;
01179 }
01180
01181 if (ATD_TARGET(attr_idx)) {
01182 attributes = attributes | CIF_TARGET;
01183 }
01184
01185 if (AT_USE_ASSOCIATED(attr_idx) &&
01186 AT_ORIG_NAME_IDX(attr_idx) != AT_NAME_IDX(attr_idx)) {
01187 attributes = attributes | CIF_RENAMED;
01188 }
01189
01190 scope_id = SCP_CIF_ID(curr_scp_idx);
01191
01192 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
01193 CONVERT_CVAL_TO_STR(&offset, Integer_8, offset_buf);
01194
01195 if (fprintf(c_i_f,
01196 "%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",
01197 CIF_F90_OBJECT, EOI,
01198 obj_name_ptr, EOI,
01199 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01200 scope_id, EOI,
01201 cif_data_type(data_type), EOI,
01202 symbol_class, EOI,
01203 storage_class, EOI,
01204 storage_id, EOI,
01205 offset_buf, EOI,
01206 attributes, EOI,
01207 derived_type, EOI,
01208 char_len, EOI,
01209 0, EOI,
01210 0, EOI,
01211 0, EOI,
01212 0, EOI,
01213 pointer_id, EOR) < 0) {
01214 Cif_Error();
01215 }
01216 }
01217 else {
01218 bd_idx = ATD_ARRAY_IDX(attr_idx);
01219 buffer[0] = NULL_CHAR;
01220
01221 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Shape) {
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 {
01233 string[0] = EOI;
01234 string[1] = VAR_LEN_CHAR;
01235 string[2] = NULL_CHAR;
01236 }
01237 strcat(buffer, string);
01238 }
01239 }
01240 else if (BD_ARRAY_CLASS(bd_idx) != Deferred_Shape) {
01241
01242 for (i = 1; i <= BD_RANK(bd_idx); i++) {
01243
01244 if (BD_LB_FLD(bd_idx,i) == CN_Tbl_Idx) {
01245 sprintf(string, "%c%s",
01246 EOI,
01247 convert_to_string(&CN_CONST(BD_LB_IDX(bd_idx,i)),
01248 CN_TYPE_IDX(BD_LB_IDX(bd_idx,i)),
01249 outbuf1));
01250 }
01251 else if (BD_LB_FLD(bd_idx,i) != NO_Tbl_Idx) {
01252 string[0] = EOI;
01253 string[1] = VAR_LEN_CHAR;
01254 string[2] = NULL_CHAR;
01255 }
01256
01257 strcat(buffer, string);
01258
01259 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size &&
01260 BD_RANK(bd_idx) == i) {
01261 string[0] = EOI;
01262 string[1] = ASSUMED_SIZE_CHAR;
01263 string[2] = NULL_CHAR;
01264 }
01265 else if (BD_UB_FLD(bd_idx,i) == CN_Tbl_Idx) {
01266 sprintf(string, "%c%s",
01267 EOI,
01268 convert_to_string(&CN_CONST(BD_UB_IDX(bd_idx,i)),
01269 CN_TYPE_IDX(BD_UB_IDX(bd_idx,i)),
01270 outbuf1));
01271 }
01272 else {
01273 string[0] = EOI;
01274 string[1] = (BD_UB_FLD(bd_idx,i) != NO_Tbl_Idx) ?
01275 VAR_LEN_CHAR :
01276 ASSUMED_SIZE_CHAR;
01277 string[2] = NULL_CHAR;
01278 }
01279 strcat(buffer, string);
01280 }
01281 }
01282
01283 CONVERT_CVAL_TO_STR(&offset, Integer_8, offset_buf);
01284
01285 if (fprintf(c_i_f,
01286 "%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",
01287 CIF_F90_OBJECT, EOI,
01288 AT_OBJ_NAME_PTR(attr_idx), EOI,
01289 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01290 SCP_CIF_ID(curr_scp_idx), EOI,
01291 cif_data_type(data_type), EOI,
01292 symbol_class, EOI,
01293 storage_class, EOI,
01294 storage_id, EOI,
01295 offset_buf, EOI,
01296 attributes, EOI,
01297 derived_type, EOI,
01298 char_len, EOI,
01299 BD_RANK(bd_idx), EOI,
01300 BD_ARRAY_CLASS(bd_idx),
01301 buffer, EOI,
01302 0, EOI,
01303 0, EOI,
01304 pointer_id, EOR) < 0) {
01305 Cif_Error();
01306 }
01307 }
01308
01309 break;
01310
01311
01312
01313
01314
01315
01316 case Pgm_Unit:
01317
01318 if (ATP_PROC(attr_idx) != Intrin_Proc &&
01319 ((name_pool[AT_NAME_IDX(attr_idx)].name_char == '$' &&
01320 attr_idx != glb_tbl_idx[Main_Attr_Idx]) ||
01321 name_pool[AT_NAME_IDX(attr_idx)].name_char == '_')) {
01322 break;
01323 }
01324
01325
01326
01327
01328
01329 if (AT_DCL_ERR(attr_idx)) {
01330
01331 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01332 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01333 }
01334
01335 Cif_F90_Entry_Rec(c_i_f,
01336 AT_OBJ_NAME_PTR(attr_idx),
01337 AT_CIF_SYMBOL_ID(attr_idx),
01338 SCP_CIF_ID(curr_scp_idx),
01339 0,
01340 0,
01341 0,
01342 0,
01343 0,
01344 0,
01345 NULL);
01346 goto EXIT;
01347 }
01348
01349 if (ATP_IN_INTERFACE_BLK(attr_idx)) {
01350
01351 if (ATP_SCP_ALIVE(attr_idx)) {
01352 attributes = CIF_PGM_IN_INTERFACE;
01353 }
01354 else if (AT_REFERENCED(attr_idx) != Not_Referenced) {
01355 attributes = CIF_PGM_REFERENCE;
01356 }
01357 else {
01358
01359
01360
01361
01362 AT_CIF_DONE(attr_idx) = FALSE;
01363 goto EXIT;
01364 }
01365 }
01366 else if (ATP_SCP_ALIVE(attr_idx)) {
01367 attributes = CIF_PGM_DEFINITION;
01368 }
01369 else if (AT_REFERENCED(attr_idx) != Not_Referenced &&
01370 ! AT_REF_IN_CHILD(attr_idx)) {
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385 AT_CIF_DONE(attr_idx) = FALSE;
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396 if (AT_IS_DARG(attr_idx)) {
01397
01398 if (ATP_CIF_DARG_PROC(attr_idx)) {
01399 ATP_CIF_DARG_PROC(attr_idx) = FALSE;
01400 }
01401 else {
01402 goto EXIT;
01403 }
01404 }
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414 if (ATP_PROC(attr_idx) == Module_Proc &&
01415 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
01416 goto EXIT;
01417 }
01418 else if (ATP_PGM_UNIT(attr_idx) == Module &&
01419 AT_USE_ASSOCIATED(attr_idx)) {
01420 attributes = CIF_PGM_USE_ASSOCIATED;
01421 }
01422 else {
01423 attributes = CIF_PGM_REFERENCE;
01424 }
01425 }
01426 else if (AT_IS_DARG(attr_idx)) {
01427
01428
01429
01430
01431
01432
01433 attributes = CIF_PGM_REFERENCE;
01434 }
01435 else if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
01436 (ATP_VFUNCTION(attr_idx) ||
01437 ATP_NOSIDE_EFFECTS(attr_idx) ||
01438 ATP_NAME_IN_STONE(attr_idx) ||
01439 ATP_DCL_EXTERNAL(attr_idx))) {
01440
01441
01442
01443
01444
01445
01446 attributes = CIF_PGM_REFERENCE;
01447 }
01448 else if (AT_USE_ASSOCIATED(attr_idx)) {
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458 }
01459 else {
01460
01461
01462
01463
01464
01465 AT_CIF_DONE(attr_idx) = FALSE;
01466 goto EXIT;
01467 }
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485 if (AT_ATTR_LINK(attr_idx) == NULL_IDX) {
01486 get_other_func_rslt_info = FALSE;
01487 }
01488 else if (AT_OBJ_CLASS(AT_ATTR_LINK(attr_idx)) != Interface) {
01489 get_other_func_rslt_info = TRUE;
01490 attr_idx = AT_ATTR_LINK(attr_idx);
01491 }
01492 else {
01493 goto EXIT;
01494 }
01495
01496 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01497 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01498 }
01499
01500 switch (ATP_PGM_UNIT(attr_idx)) {
01501
01502 case Pgm_Unknown:
01503 pgm_unit_type = CIF_F90_ET_UNKNOWN;
01504 num_dargs = ATP_NUM_DARGS(attr_idx);
01505 break;
01506
01507 case Function:
01508 pgm_unit_type =
01509 (ATP_ALT_ENTRY(attr_idx)) ? CIF_F90_ET_ALT_ENTRY :
01510 CIF_F90_ET_FUNCTION;
01511
01512
01513
01514
01515 if (ATP_EXPL_ITRFC(attr_idx) && ATP_EXTRA_DARG(attr_idx)) {
01516 num_dargs = ATP_NUM_DARGS(attr_idx) - 1;
01517 }
01518 else {
01519 num_dargs = ATP_NUM_DARGS(attr_idx);
01520 }
01521
01522 if (AT_USE_ASSOCIATED(attr_idx)) {
01523 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
01524 }
01525
01526 break;
01527
01528 case Subroutine:
01529 pgm_unit_type =
01530 (ATP_ALT_ENTRY(attr_idx)) ? CIF_F90_ET_ALT_ENTRY :
01531 CIF_F90_ET_SUBROUTINE;
01532
01533 num_dargs = ATP_NUM_DARGS(attr_idx);
01534
01535 if (AT_USE_ASSOCIATED(attr_idx)) {
01536 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
01537 }
01538
01539 break;
01540
01541 case Program:
01542 num_dargs = 0;
01543 pgm_unit_type= CIF_F90_ET_PROGRAM;
01544 break;
01545
01546 case Blockdata:
01547 num_dargs = 0;
01548 pgm_unit_type = CIF_F90_ET_BLOCKDATA;
01549 break;
01550
01551 case Module:
01552 num_dargs = 0;
01553 pgm_unit_type= CIF_F90_ET_MODULE;
01554 }
01555
01556 if ((attributes & CIF_PGM_REFERENCE) ||
01557 AT_USE_ASSOCIATED(attr_idx) ||
01558 get_other_func_rslt_info) {
01559 num_dargs = 0;
01560 }
01561
01562
01563 if (AT_OPTIONAL(attr_idx)) {
01564 attributes = attributes | CIF_PGM_OPTIONAL;
01565 }
01566
01567
01568
01569
01570
01571
01572
01573
01574 if (AT_PRIVATE(attr_idx) && ATP_PGM_UNIT(attr_idx) != Module) {
01575 attributes = attributes | CIF_PGM_PRIVATE;
01576 }
01577
01578 if (ATP_RECURSIVE(attr_idx)) {
01579 attributes = attributes | CIF_PGM_RECURSIVE;
01580 }
01581
01582 if (ATP_PGM_UNIT(attr_idx) == Function) {
01583 rslt_idx = ATP_RSLT_IDX(attr_idx);
01584
01585 if (ATP_SCP_ALIVE(attr_idx)) {
01586
01587 if (! AT_CIF_DONE(rslt_idx)) {
01588 cif_send_attr(rslt_idx, NULL_IDX);
01589 }
01590
01591 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01592 }
01593 else {
01594
01595
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610 AT_CIF_DONE(rslt_idx) = FALSE;
01611
01612 # if 0
01613 save_symbol_id = AT_CIF_SYMBOL_ID(rslt_idx);
01614 AT_CIF_SYMBOL_ID(rslt_idx) = 0;
01615 # endif
01616 cif_send_attr(rslt_idx, NULL_IDX);
01617 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01618 # if 0
01619 AT_CIF_SYMBOL_ID(rslt_idx) = save_symbol_id;
01620 # endif
01621 AT_CIF_DONE(rslt_idx) = FALSE;
01622 }
01623 }
01624 else {
01625 rslt_id = 0;
01626 }
01627
01628 if (ATP_PROC(attr_idx) == Module_Proc) {
01629
01630 if (AT_MODULE_IDX(attr_idx) == 0) {
01631 storage_id = (SCP_LEVEL(curr_scp_idx) == 0) ?
01632 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) :
01633 AT_CIF_SYMBOL_ID(
01634 SCP_ATTR_IDX(SCP_PARENT_IDX(curr_scp_idx)));
01635 }
01636 else {
01637
01638 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
01639
01640
01641
01642
01643
01644
01645
01646
01647 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01648 }
01649
01650 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
01651 }
01652 }
01653 else if (AT_USE_ASSOCIATED(attr_idx)) {
01654
01655 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
01656
01657
01658
01659
01660 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01661 }
01662
01663 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
01664 }
01665 else {
01666 storage_id = 0;
01667 }
01668
01669 if (num_dargs != 0) {
01670 sn_idx = ATP_FIRST_IDX(attr_idx);
01671
01672 if (ATP_EXTRA_DARG(attr_idx)) {
01673 ++sn_idx;
01674 }
01675
01676 for (i = 0; i < num_dargs; i++) {
01677 darg_idx = SN_ATTR_IDX(sn_idx++);
01678
01679 if (! AT_COMPILER_GEND(darg_idx)) {
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691 if (AT_OBJ_CLASS(darg_idx) == Pgm_Unit) {
01692 ATP_CIF_DARG_PROC(darg_idx) = TRUE;
01693 }
01694
01695 cif_send_attr(darg_idx, NULL_IDX);
01696 }
01697 }
01698 }
01699
01700 if (fprintf(c_i_f,
01701 "%d%c%s%c%d%c%d%c%d%c%d%c%lx%c%d%c%d%c%d",
01702 CIF_F90_ENTRY, EOI,
01703 AT_OBJ_NAME_PTR(attr_idx), EOI,
01704 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01705 SCP_CIF_ID(curr_scp_idx), EOI,
01706 pgm_unit_type, EOI,
01707 ATP_PROC(attr_idx), EOI,
01708 attributes, EOI,
01709 rslt_id, EOI,
01710 storage_id, EOI,
01711 num_dargs) < 0) {
01712 Cif_Error();
01713 }
01714
01715 if (num_dargs != 0) {
01716 sn_idx = ATP_FIRST_IDX(attr_idx);
01717
01718 if (ATP_EXTRA_DARG(attr_idx)) {
01719 ++sn_idx;
01720 }
01721
01722 for (i = 0; i < num_dargs; i++) {
01723 darg_idx = SN_ATTR_IDX(sn_idx++);
01724
01725 if (AT_COMPILER_GEND(darg_idx)) {
01726 darg_idx = 0;
01727 }
01728 else {
01729 darg_idx = AT_CIF_SYMBOL_ID(darg_idx);
01730 }
01731
01732 if (fprintf(c_i_f, "%c%d", EOI, darg_idx) < 0) {
01733 Cif_Error();
01734 }
01735 }
01736 }
01737
01738 if (fprintf(c_i_f, "\n") < 0) {
01739 Cif_Error();
01740 }
01741
01742 get_other_func_rslt_info = FALSE;
01743
01744 break;
01745
01746
01747
01748
01749
01750
01751 case Label:
01752 cif_label_rec(attr_idx);
01753 break;
01754
01755
01756
01757
01758
01759
01760 case Derived_Type:
01761
01762 # if 0
01763
01764
01765
01766
01767 if (AT_DCL_ERR(attr_idx)) {
01768
01769 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01770 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01771 }
01772
01773 Cif_F90_Derived_Type_Rec(c_i_f,
01774 AT_OBJ_NAME_PTR(attr_idx),
01775 AT_CIF_SYMBOL_ID(attr_idx),
01776 SCP_CIF_ID(curr_scp_idx),
01777 ATT_CIF_DT_ID(attr_idx),
01778 0,
01779 0,
01780 NULL,
01781 0);
01782 goto EXIT;
01783 }
01784 # endif
01785
01786 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01787 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01788 }
01789
01790 if (ATT_CIF_DT_ID(attr_idx) == 0) {
01791 ATT_CIF_DT_ID(attr_idx) = NEXT_DERIVED_TYPE_ID;
01792 }
01793
01794 attributes = (ATT_SEQUENCE_SET(attr_idx)) ? (CIF_DRT_SEQUENCE) : 0;
01795
01796 if (AT_PRIVATE(attr_idx)) {
01797 attributes = attributes | CIF_DRT_PRIVATE;
01798 }
01799
01800 if (ATT_PRIVATE_CPNT(attr_idx)) {
01801 attributes = attributes | CIF_DRT_COMP_PRIVATE;
01802 }
01803
01804 sn_idx = ATT_FIRST_CPNT_IDX(attr_idx);
01805
01806 while (sn_idx != NULL_IDX) {
01807
01808 if (get_other_func_rslt_info) {
01809 AT_CIF_DONE(SN_ATTR_IDX(sn_idx)) = FALSE;
01810 AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) = 0;
01811 }
01812
01813 cif_send_attr(SN_ATTR_IDX(sn_idx), attr_idx);
01814 sn_idx = SN_SIBLING_LINK(sn_idx);
01815 }
01816
01817 if (fprintf(c_i_f, "%d%c%s%c%d%c%d%c%d%c%lx%c%d",
01818 CIF_F90_DERIVED_TYPE, EOI,
01819 AT_OBJ_NAME_PTR(attr_idx), EOI,
01820 AT_CIF_SYMBOL_ID(attr_idx), EOI,
01821 SCP_CIF_ID(curr_scp_idx), EOI,
01822 ATT_CIF_DT_ID(attr_idx), EOI,
01823 attributes, EOI,
01824 ATT_NUM_CPNTS(attr_idx)) < 0) {
01825 Cif_Error();
01826 }
01827
01828 sn_idx = ATT_FIRST_CPNT_IDX(attr_idx);
01829
01830 while (sn_idx != NULL_IDX) {
01831
01832 if (fprintf(c_i_f, "%c%d",
01833 EOI, AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx))) < 0) {
01834 Cif_Error();
01835 }
01836
01837 sn_idx = SN_SIBLING_LINK(sn_idx);
01838 }
01839
01840 if (fprintf(c_i_f, "\n") < 0) {
01841 Cif_Error();
01842 }
01843
01844 break;
01845
01846
01847
01848
01849
01850
01851 case Interface:
01852
01853
01854
01855
01856
01857 if (AT_DCL_ERR(attr_idx) && AT_CIF_SYMBOL_ID(attr_idx) != 0) {
01858 scope_id = (AT_USE_ASSOCIATED(attr_idx)) ?
01859 SCP_CIF_ID(curr_scp_idx) :
01860 ATI_CIF_SCOPE_ID(attr_idx);
01861
01862 switch (ATI_INTERFACE_CLASS(attr_idx)) {
01863
01864 case Defined_Assign_Interface:
01865 interface_type = CIF_IB_ASSIGNMENT;
01866 break;
01867
01868 case Generic_Unknown_Interface:
01869 case Generic_Function_Interface:
01870 case Generic_Subroutine_Interface:
01871 interface_type = CIF_IB_GENERIC;
01872 break;
01873
01874 default:
01875 interface_type = CIF_IB_OPERATOR;
01876 break;
01877 }
01878
01879 Cif_F90_Int_Block_Rec(c_i_f,
01880 AT_OBJ_NAME_PTR(attr_idx),
01881 AT_CIF_SYMBOL_ID(attr_idx),
01882 scope_id,
01883 interface_type,
01884 0,
01885 0,
01886 NULL,
01887 0);
01888
01889 goto EXIT;
01890 }
01891
01892
01893 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
01894 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
01895 }
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906 if (AT_USE_ASSOCIATED(attr_idx) &&
01907 AT_MODULE_IDX(attr_idx) != NULL_IDX &&
01908 ! AT_CIF_DONE(AT_MODULE_IDX(attr_idx))) {
01909
01910 if (AT_IS_INTRIN(attr_idx) &&
01911 ! ATI_USER_SPECIFIED(attr_idx) &&
01912 ATI_CIF_SEEN_IN_CALL(attr_idx)) {
01913
01914
01915
01916 }
01917 else {
01918 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
01919 }
01920 }
01921
01922
01923 if (AT_IS_INTRIN(attr_idx) && ! ATI_USER_SPECIFIED(attr_idx)) {
01924
01925
01926
01927
01928
01929 if (ATI_CIF_SEEN_IN_CALL(attr_idx)) {
01930 goto EXIT;
01931 }
01932
01933
01934 rslt_id = 0;
01935
01936 if (ATI_INTERFACE_CLASS(attr_idx) == Generic_Function_Interface) {
01937 pgm_unit_type = CIF_F90_ET_FUNCTION;
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
01951
01952 for (i = 2; i <= ATI_NUM_SPECIFICS(attr_idx); ++i) {
01953 sn_idx = SN_SIBLING_LINK(sn_idx);
01954 }
01955
01956 rslt_idx = ATP_RSLT_IDX(SN_ATTR_IDX(sn_idx));
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970 save_cif_done = AT_CIF_DONE(rslt_idx);
01971 AT_CIF_DONE(rslt_idx) = FALSE;
01972 cif_send_attr(rslt_idx, NULL_IDX);
01973 AT_CIF_DONE(rslt_idx) = save_cif_done;
01974
01975 rslt_id = AT_CIF_SYMBOL_ID(rslt_idx);
01976 }
01977 else if (ATI_INTERFACE_CLASS(attr_idx) ==Generic_Subroutine_Interface){
01978 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
01979 }
01980 else {
01981 pgm_unit_type = CIF_F90_ET_UNKNOWN;
01982 }
01983
01984 attributes = CIF_PGM_REFERENCE;
01985
01986 if (AT_PRIVATE(attr_idx)) {
01987 attributes = attributes | CIF_PGM_PRIVATE;
01988 }
01989
01990 Cif_F90_Entry_Rec(c_i_f,
01991 AT_OBJ_NAME_PTR(attr_idx),
01992 AT_CIF_SYMBOL_ID(attr_idx),
01993 SCP_CIF_ID(curr_scp_idx),
01994 pgm_unit_type,
01995 CIF_F90_PT_INTRINSIC,
01996 attributes,
01997 rslt_id,
01998 0,
01999 0,
02000 NULL);
02001
02002 break;
02003 }
02004
02005 if (ATI_UNNAMED_INTERFACE(attr_idx)) {
02006
02007 if (fprintf(c_i_f,
02008 "%d%c%c%d%c%d%c%d%c%x%c%d",
02009 CIF_F90_INT_BLOCK, EOI,
02010 EOI,
02011 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02012 ATI_CIF_SCOPE_ID(attr_idx), EOI,
02013 CIF_IB_SPECIFIC, EOI,
02014 0, EOI,
02015 ATI_NUM_SPECIFICS(attr_idx)) < 0) {
02016 Cif_Error();
02017 }
02018 }
02019 else {
02020
02021 if (ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02022 cif_send_attr(ATI_PROC_IDX(attr_idx), NULL_IDX);
02023 }
02024
02025 attributes = (AT_PRIVATE(attr_idx)) ? 1 : 0;
02026
02027 switch (ATI_INTERFACE_CLASS(attr_idx)) {
02028 case Defined_Assign_Interface:
02029 interface_type = CIF_IB_ASSIGNMENT;
02030 break;
02031
02032 case Generic_Unknown_Interface:
02033 case Generic_Function_Interface:
02034 case Generic_Subroutine_Interface:
02035 interface_type = CIF_IB_GENERIC;
02036 break;
02037
02038 default:
02039 interface_type = CIF_IB_OPERATOR;
02040 break;
02041 }
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054 scope_id = (AT_USE_ASSOCIATED(attr_idx)) ?
02055 SCP_CIF_ID(curr_scp_idx) :
02056 ATI_CIF_SCOPE_ID(attr_idx);
02057
02058 if (fprintf(c_i_f,
02059 "%d%c%s%c%d%c%d%c%d%c%lx%c%d",
02060 CIF_F90_INT_BLOCK, EOI,
02061 AT_OBJ_NAME_PTR(attr_idx), EOI,
02062 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02063 scope_id, EOI,
02064 interface_type, EOI,
02065 attributes, EOI,
02066 ATI_NUM_SPECIFICS(attr_idx)) < 0) {
02067 Cif_Error();
02068 }
02069 }
02070
02071
02072
02073
02074
02075 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
02076
02077 while (sn_idx != NULL_IDX) {
02078 interface_idx = SN_ATTR_IDX(sn_idx);
02079 sn_idx = SN_SIBLING_LINK(sn_idx);
02080
02081 if (AT_CIF_SYMBOL_ID(interface_idx) == 0) {
02082 AT_CIF_SYMBOL_ID(interface_idx) = NEXT_SYMBOL_ID;
02083 }
02084
02085 if (fprintf(c_i_f, "%c%d",
02086 EOI,
02087 AT_CIF_SYMBOL_ID(interface_idx)) < 0) {
02088 Cif_Error();
02089 }
02090 }
02091
02092 if (fprintf(c_i_f, "%c", EOR) < 0) {
02093 Cif_Error();
02094 }
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
02107
02108 while (sn_idx != NULL_IDX) {
02109 interface_idx = SN_ATTR_IDX(sn_idx);
02110 sn_idx = SN_SIBLING_LINK(sn_idx);
02111
02112 if (ATP_PROC(interface_idx) == Module_Proc ||
02113 ATP_PROC(interface_idx) == Intrin_Proc ||
02114 (ATP_PROC(interface_idx) == Extern_Proc &&
02115 AT_USE_ASSOCIATED(interface_idx))) {
02116
02117 if (ATP_PGM_UNIT(interface_idx) == Function) {
02118 pgm_unit_type = CIF_F90_ET_FUNCTION;
02119 rslt_id = ATP_RSLT_IDX(interface_idx);
02120 cif_send_attr(rslt_id, NULL_IDX);
02121 rslt_id = AT_CIF_SYMBOL_ID(rslt_id);
02122 }
02123 else {
02124 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
02125 rslt_id = 0;
02126 }
02127
02128 if (AT_MODULE_IDX(interface_idx) == NULL_IDX) {
02129
02130 if (SCP_LEVEL(curr_scp_idx) == 0) {
02131 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
02132 }
02133 else {
02134 i = SCP_PARENT_IDX(curr_scp_idx);
02135
02136 while (SCP_LEVEL(i) != 0) {
02137 i = SCP_PARENT_IDX(i);
02138 }
02139
02140 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(i));
02141 }
02142 }
02143 else {
02144
02145 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(interface_idx)) == 0) {
02146 cif_send_attr(AT_MODULE_IDX(interface_idx), NULL_IDX);
02147 }
02148
02149 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(interface_idx));
02150 }
02151
02152
02153 attributes = CIF_PGM_REFERENCE;
02154
02155 if (AT_OPTIONAL(interface_idx)) {
02156 attributes = attributes | CIF_PGM_OPTIONAL;
02157 }
02158
02159 if (AT_PRIVATE(interface_idx)) {
02160 attributes = attributes | CIF_PGM_PRIVATE;
02161 }
02162
02163 if (AT_USE_ASSOCIATED(interface_idx)) {
02164 attributes = attributes | CIF_PGM_USE_ASSOCIATED;
02165 }
02166
02167 if (ATP_RECURSIVE(interface_idx)) {
02168 attributes = attributes | CIF_PGM_RECURSIVE;
02169 }
02170
02171
02172 Cif_F90_Entry_Rec(c_i_f,
02173 AT_OBJ_NAME_PTR(interface_idx),
02174 AT_CIF_SYMBOL_ID(interface_idx),
02175 scope_id,
02176 pgm_unit_type,
02177 ATP_PROC(interface_idx),
02178 attributes,
02179 rslt_id,
02180 storage_id,
02181 0,
02182 NULL);
02183 }
02184 }
02185
02186 break;
02187
02188
02189
02190
02191
02192
02193 case Namelist_Grp:
02194
02195 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
02196 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
02197 }
02198
02199 if (AT_USE_ASSOCIATED(attr_idx)) {
02200
02201 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
02202 cif_send_attr(AT_MODULE_IDX(attr_idx), NULL_IDX);
02203 }
02204
02205 storage_id = AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx));
02206 }
02207 else if (AT_HOST_ASSOCIATED(attr_idx)) {
02208
02209
02210
02211
02212
02213
02214 goto EXIT;
02215 }
02216 else {
02217
02218 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
02219 storage_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
02220 }
02221 else {
02222 storage_id = 0;
02223 }
02224 }
02225
02226 num_namelist = AT_DCL_ERR(attr_idx) ? 0: ATN_NUM_NAMELIST(attr_idx);
02227
02228 if (fprintf(c_i_f,
02229 "%d%c%s%c%d%c%d%c%d%c%d",
02230 CIF_F90_NAMELIST, EOI,
02231 AT_OBJ_NAME_PTR(attr_idx), EOI,
02232 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02233 SCP_CIF_ID(curr_scp_idx), EOI,
02234 storage_id, EOI,
02235 num_namelist) < 0) {
02236 Cif_Error();
02237 }
02238
02239 if (num_namelist > 0) {
02240 sn_idx = ATN_FIRST_NAMELIST_IDX(attr_idx);
02241
02242 while (sn_idx != NULL_IDX) {
02243 namelist_idx = SN_ATTR_IDX(sn_idx);
02244 sn_idx = SN_SIBLING_LINK(sn_idx);
02245
02246 if (AT_CIF_SYMBOL_ID(namelist_idx) == 0) {
02247 AT_CIF_SYMBOL_ID(namelist_idx) = NEXT_SYMBOL_ID;
02248 }
02249
02250 if (fprintf(c_i_f,"%c%d",EOI,AT_CIF_SYMBOL_ID(namelist_idx)) < 0) {
02251 Cif_Error();
02252 }
02253 }
02254 }
02255
02256 if (fprintf(c_i_f, "%c", EOR) < 0) {
02257 Cif_Error();
02258 }
02259
02260 break;
02261
02262
02263
02264
02265
02266
02267 case Stmt_Func:
02268
02269 # if 0
02270 if (AT_DCL_ERR(attr_idx)) {
02271 goto EXIT;
02272 }
02273 # endif
02274
02275 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
02276 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
02277 }
02278
02279 if (fprintf(c_i_f,
02280 "%d%c%s%c%d%c%d%c%d%c%d%c%lx%c%d%c%d%c%d",
02281 CIF_F90_ENTRY, EOI,
02282 AT_OBJ_NAME_PTR(attr_idx), EOI,
02283 AT_CIF_SYMBOL_ID(attr_idx), EOI,
02284 SCP_CIF_ID(curr_scp_idx), EOI,
02285 CIF_F90_ET_STMT, EOI,
02286 Unknown_Proc, EOI,
02287 attributes, EOI,
02288 0, EOI,
02289 0, EOI,
02290 ATP_NUM_DARGS(attr_idx)) < 0) {
02291 Cif_Error();
02292 }
02293
02294 if (ATP_NUM_DARGS(attr_idx) != NULL_IDX) {
02295 sn_idx = ATP_FIRST_IDX(attr_idx);
02296
02297 for (i = 0; i < ATP_NUM_DARGS(attr_idx); i++) {
02298
02299 if (AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) == 0) {
02300 AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx)) = NEXT_SYMBOL_ID;
02301 }
02302
02303 darg_idx = AT_CIF_SYMBOL_ID(SN_ATTR_IDX(sn_idx++));
02304
02305 if (fprintf(c_i_f, "%c%d", EOI, darg_idx) < 0) {
02306 Cif_Error();
02307 }
02308 }
02309
02310 if (fprintf(c_i_f, "%c", EOR) < 0) {
02311 Cif_Error();
02312 }
02313
02314 sn_idx = ATP_FIRST_IDX(attr_idx);
02315
02316 for (i = 0; i < ATP_NUM_DARGS(attr_idx); i++) {
02317 cif_send_attr(SN_ATTR_IDX(sn_idx++), NULL_IDX);
02318 }
02319 }
02320 else if (fprintf(c_i_f, "%c", EOR) < 0) {
02321 Cif_Error();
02322 }
02323
02324 break;
02325
02326 }
02327
02328
02329 EXIT:
02330
02331 TRACE (Func_Exit, "cif_send_attr", NULL);
02332
02333 return;
02334
02335 }
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345
02346
02347
02348
02349
02350
02351
02352
02353
02354
02355
02356 void cif_directive_rec(cif_directive_code_type dir,
02357 int line,
02358 int col)
02359
02360 {
02361 int file_line_num;
02362 int local_file_id;
02363
02364 TRACE (Func_Entry, "cif_directive_rec", NULL);
02365
02366 file_line_num = get_line_and_file_id(line, &local_file_id);
02367
02368 Cif_Cdir_Rec(c_i_f, dir, local_file_id, file_line_num, col, 0, NULL);
02369
02370 TRACE (Func_Exit, "cif_directive_rec", NULL);
02371
02372 return;
02373
02374 }
02375
02376
02377
02378
02379
02380
02381
02382
02383
02384
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396 int cif_file_name_rec(char *file_name,
02397 char *user_specified_file_name)
02398 {
02399 int return_val;
02400
02401
02402 TRACE (Func_Entry, "cif_file_name_rec", NULL);
02403
02404 return_val = NEXT_FILE_ID;
02405
02406 Cif_File_Rec(c_i_f,
02407 file_name,
02408 return_val,
02409 user_specified_file_name);
02410
02411 TRACE (Func_Exit, "cif_file_name_rec", NULL);
02412
02413 return(return_val);
02414
02415 }
02416
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436 void cif_include_rec(int line_num,
02437 int col_num,
02438 int include_file_id)
02439 {
02440 int file_line_num;
02441 int parent_file_id;
02442
02443
02444 TRACE (Func_Entry, "cif_include_rec", NULL);
02445
02446 file_line_num = get_line_and_file_id(line_num, &parent_file_id);
02447
02448 Cif_Include_Rec(c_i_f,
02449 parent_file_id,
02450 file_line_num,
02451 col_num,
02452 include_file_id);
02453
02454 Cif_Src_Pos_Rec(c_i_f,
02455 CIF_SRC_KIND_INCLUDE,
02456 include_file_id,
02457 parent_file_id,
02458 file_line_num,
02459 col_num,
02460 include_file_id,
02461 0,
02462 0,
02463 0);
02464
02465 TRACE (Func_Exit, "cif_include_rec", NULL);
02466
02467 return;
02468
02469 }
02470
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500
02501
02502 void cif_message_rec(int msg_num,
02503 int glb_line_num,
02504 int col_num,
02505 msg_severities_type msg_severity,
02506 char *msg_text,
02507 long arg0,
02508 long arg1,
02509 long arg2,
02510 long arg3,
02511 char *scoping_unit_name,
02512 int relative_order)
02513
02514 {
02515 char *char_ptr;
02516 int file_line_num;
02517 char *format[4] = { "%c", "%d", "%f", "%s" };
02518 #ifdef KEY
02519 int format_idx = 0;
02520 #else
02521 int format_idx;
02522 #endif
02523 char insert[4][128];
02524 char *insert_ptr[4];
02525 int local_file_id;
02526 int num_inserts = 0;
02527
02528
02529 TRACE (Func_Entry, "cif_message_rec", NULL);
02530
02531 if (msg_severity == Log_Error || msg_severity == Log_Warning ||
02532 glb_line_num == 0) {
02533 goto EXIT;
02534 }
02535
02536 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
02537
02538 char_ptr = msg_text;
02539
02540 while ((char_ptr = strchr(char_ptr, '%')) != NULL) {
02541 ++char_ptr;
02542
02543 switch (*char_ptr++) {
02544
02545 case 'c':
02546 format_idx = 0;
02547 break;
02548
02549 case 'd':
02550 format_idx = 1;
02551 break;
02552
02553 case 'f':
02554 format_idx = 2;
02555 break;
02556
02557 case 's':
02558 format_idx = 3;
02559 break;
02560
02561 case '%':
02562 continue;
02563
02564 case EOS:
02565 goto LOOP_EXIT;
02566
02567 default:
02568 PRINTMSG(glb_line_num, 179, Internal, 0, "cif_message_rec");
02569 }
02570
02571 switch (num_inserts) {
02572
02573 case 0:
02574 sprintf(insert[0], format[format_idx], arg0);
02575 break;
02576
02577 case 1:
02578 sprintf(insert[1], format[format_idx], arg1);
02579 break;
02580
02581 case 2:
02582 sprintf(insert[2], format[format_idx], arg2);
02583 break;
02584
02585 case 3:
02586 sprintf(insert[3], format[format_idx], arg3);
02587 }
02588
02589 insert_ptr[num_inserts] = insert[num_inserts];
02590
02591 ++num_inserts;
02592 }
02593
02594 LOOP_EXIT:
02595
02596 Cif_Message_Rec(c_i_f,
02597 msg_severity,
02598 msg_num,
02599 local_file_id,
02600 glb_line_num,
02601 col_num,
02602 file_line_num,
02603 num_inserts,
02604 insert_ptr,
02605 scoping_unit_name,
02606 relative_order,
02607 0,
02608 local_file_id);
02609
02610 last_msg_file_rec = CIF_MESSAGE;
02611
02612 EXIT:
02613
02614 TRACE (Func_Exit, "cif_message_rec", NULL);
02615
02616 return;
02617
02618 }
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639 void cif_source_file_rec(int source_file_id,
02640 src_form_type source_form)
02641 {
02642
02643 TRACE (Func_Entry, "cif_source_file_rec", NULL);
02644
02645 Cif_Srcfile_Rec(c_i_f,
02646 source_file_id,
02647 (source_form == Fixed_Form) ? CIF_F90_FORM_FIXED :
02648 CIF_F90_FORM_FREE);
02649
02650 TRACE (Func_Exit, "cif_source_file_rec", NULL);
02651
02652 return;
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
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716 void cif_summary_rec(char *release_level,
02717 char *gen_date,
02718 char *gen_time,
02719 float elapsed_time,
02720 long aux_elapsed_time,
02721 long max_field_len)
02722 {
02723 char comp_time[13];
02724 int hms;
02725 int hours;
02726 int milliseconds;
02727 int minutes;
02728 int seconds;
02729
02730
02731 TRACE (Func_Entry, "cif_summary_rec", NULL);
02732
02733 if (max_field_len == -1) {
02734 comp_time[0] = '0';
02735 comp_time[1] = NULL_CHAR;
02736 }
02737 else {
02738
02739 hms = elapsed_time;
02740
02741
02742 # if defined(_HOST_OS_UNICOS) || (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) || defined(_HOST_OS_DARWIN)
02743
02744 elapsed_time = elapsed_time - hms;
02745 milliseconds = (elapsed_time + .0005) * 1000;
02746
02747 # elif defined(_HOST_OS_MAX)
02748
02749 milliseconds = ((aux_elapsed_time % CLOCKS_PER_SEC) + 500L) / 1000L;
02750 hms = aux_elapsed_time / CLOCKS_PER_SEC;
02751
02752 # else
02753
02754 if (hms <= 2147) {
02755 milliseconds = ((aux_elapsed_time % CLOCKS_PER_SEC) + 500L) / 1000L;
02756 hms = aux_elapsed_time / CLOCKS_PER_SEC;
02757 }
02758 else {
02759 milliseconds = -1;
02760 }
02761
02762 # endif
02763
02764
02765 hours = hms / 3600;
02766 hms = hms % 3600;
02767 minutes = hms / 60;
02768 seconds = hms % 60;
02769
02770
02771 # ifndef _HOST_OS_SOLARIS
02772
02773 sprintf(comp_time, "%2.2d:%2.2d:%2.2d.%3.3d",
02774 hours, minutes, seconds, milliseconds);
02775
02776 # else
02777
02778 if (milliseconds >= 0) {
02779 sprintf(comp_time, "%2.2d:%2.2d:%2.2d.%3.3d",
02780 hours, minutes, seconds, milliseconds);
02781 }
02782 else {
02783 sprintf(comp_time, "%2.2d:%2.2d:%2.2d", hours, minutes, seconds);
02784 }
02785
02786 # endif
02787
02788 }
02789
02790 Cif_Summary_Rec(c_i_f,
02791 release_level,
02792 gen_date,
02793 gen_time,
02794 comp_time,
02795 max_field_len,
02796 --curr_glb_line,
02797 code_size,
02798 data_size);
02799
02800
02801
02802 ++curr_glb_line;
02803
02804
02805 TRACE (Func_Exit, "cif_summary_rec", NULL);
02806
02807 return;
02808
02809 }
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828 void cif_unit_rec(void)
02829 {
02830 int cif_col_num;
02831 int file_line_num;
02832 int glb_line_num;
02833 int local_file_id;
02834
02835
02836 TRACE (Func_Entry, "cif_unit_rec", NULL);
02837
02838 if (cif_pgm_unit_start_line == stmt_start_line) {
02839
02840
02841
02842
02843
02844 if (blk_stk_idx > 0) {
02845 glb_line_num = CURR_BLK_DEF_LINE;
02846 cif_col_num = CURR_BLK_DEF_COLUMN;
02847 }
02848 else {
02849 glb_line_num = 1;
02850 cif_col_num = 1;
02851 }
02852 }
02853 else {
02854
02855
02856
02857
02858
02859 glb_line_num = (cif_pgm_unit_start_line < stmt_start_line) ?
02860 cif_pgm_unit_start_line : stmt_start_line;
02861 cif_col_num = 1;
02862 }
02863
02864 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
02865
02866
02867
02868
02869 c_i_f = cif_actual_file;
02870
02871
02872 Cif_Unit_Rec(c_i_f,
02873 (scp_tbl != NULL) ?
02874 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx)) :
02875 UNNAMED_PROGRAM_NAME,
02876 local_file_id,
02877 file_line_num,
02878 cif_col_num);
02879
02880 cif_need_unit_rec = FALSE;
02881 cif_first_pgm_unit = FALSE;
02882
02883 last_msg_file_rec = CIF_UNIT;
02884
02885 if (! cif_pgm_unit_error_recovery) {
02886 cif_copy_temp_to_actual_CIF();
02887 }
02888
02889 TRACE (Func_Exit, "cif_unit_rec", NULL);
02890
02891 return;
02892
02893 }
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905
02906
02907
02908
02909
02910
02911
02912 void cif_copy_temp_to_actual_CIF(void)
02913 {
02914 char cif_rec[256];
02915
02916
02917 TRACE (Func_Entry, "cif_copy_temp_to_actual_CIF", NULL);
02918
02919
02920
02921
02922
02923 fprintf(cif_tmp_file, "%d\n", EOF);
02924 fflush(cif_tmp_file);
02925 rewind(cif_tmp_file);
02926
02927 while (fgets(cif_rec, 256, cif_tmp_file) != NULL && atoi(cif_rec) != EOF) {
02928 fputs(cif_rec, c_i_f);
02929 }
02930
02931 rewind(cif_tmp_file);
02932
02933 TRACE (Func_Exit, "cif_copy_temp_to_actual_CIF", NULL);
02934
02935 return;
02936
02937 }
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956 void cif_end_unit_rec(char *name_ptr)
02957 {
02958 int file_line_num;
02959 int local_file_id;
02960
02961
02962 TRACE (Func_Entry, "cif_end_unit_rec", NULL);
02963
02964 file_line_num = get_line_and_file_id(cif_end_unit_line, &local_file_id);
02965
02966 cif_flush_include_recs();
02967
02968 Cif_Endunit_Rec(c_i_f,
02969 name_ptr,
02970 local_file_id,
02971 file_line_num,
02972 (cif_end_unit_column > 0) ?
02973 cif_end_unit_column : stmt_start_col);
02974
02975 last_msg_file_rec = CIF_ENDUNIT;
02976
02977 TRACE (Func_Exit, "cif_end_unit_rec", NULL);
02978
02979 return;
02980
02981 }
02982
02983
02984
02985
02986
02987
02988
02989
02990
02991
02992
02993
02994
02995
02996
02997
02998
02999
03000
03001
03002
03003
03004
03005
03006 void cif_usage_rec(int obj_idx,
03007 fld_type obj_fld,
03008 int line_num,
03009 int col_num,
03010 int usage_code)
03011 {
03012 int attr_idx;
03013 int cif_symbol_id;
03014 int file_line_num;
03015 int local_file_id;
03016 opnd_type opnd;
03017
03018
03019 TRACE (Func_Entry, "cif_usage_rec", NULL);
03020
03021
03022
03023
03024
03025
03026 if (usage_code == CIF_No_Usage_Rec) {
03027 goto EXIT;
03028 }
03029
03030
03031 switch (obj_fld) {
03032
03033 case AT_Tbl_Idx:
03034 attr_idx = obj_idx;
03035 AT_CIF_IN_USAGE_REC(attr_idx) = TRUE;
03036
03037 if (AT_DCL_ERR(attr_idx) ||
03038 (AT_COMPILER_GEND(attr_idx) &&
03039 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
03040 ! (ATD_CLASS(attr_idx) == Compiler_Tmp &&
03041 ATD_TMP_NEEDS_CIF(attr_idx))))) {
03042 goto EXIT;
03043 }
03044
03045
03046
03047
03048
03049
03050
03051 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
03052 ATP_PROC(attr_idx) == Intrin_Proc &&
03053 ! ATP_IN_INTERFACE_BLK(attr_idx)) {
03054 attr_idx = ATP_INTERFACE_IDX(attr_idx);
03055 }
03056
03057
03058 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03059 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03060 }
03061
03062 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03063
03064 Cif_Usage_Rec(c_i_f,
03065 AT_CIF_SYMBOL_ID(attr_idx),
03066 local_file_id,
03067 file_line_num,
03068 col_num,
03069 usage_code,
03070 0,
03071 NULL);
03072
03073 break;
03074
03075 case NO_Tbl_Idx:
03076 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03077
03078 Cif_Usage_Rec(c_i_f,
03079 obj_idx,
03080 local_file_id,
03081 file_line_num,
03082 col_num,
03083 usage_code,
03084 0,
03085 NULL);
03086
03087 break;
03088
03089 default:
03090 skip_struct_base = TRUE;
03091 OPND_FLD(opnd) = obj_fld;
03092 OPND_IDX(opnd) = obj_idx;
03093
03094
03095
03096 attr_idx = find_base_attr(&opnd, &line_num, &col_num);
03097
03098
03099
03100
03101 attr_idx = find_left_attr(&opnd);
03102
03103 if (AT_DCL_ERR(attr_idx)) {
03104 goto EXIT;
03105 }
03106
03107 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03108 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03109 }
03110
03111 cif_symbol_id = AT_CIF_SYMBOL_ID(attr_idx);
03112 AT_CIF_IN_USAGE_REC(attr_idx) = TRUE;
03113
03114 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03115
03116 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d",
03117 CIF_USAGE, EOI,
03118 cif_symbol_id, EOI,
03119 local_file_id, EOI,
03120 file_line_num, EOI,
03121 col_num, EOI,
03122 usage_code) < 0) {
03123 Cif_Error();
03124 }
03125
03126 cif_number_of_struct_ids = 0;
03127
03128 output_struct_ids(&opnd);
03129
03130 if (fprintf(c_i_f, "%c%d", EOI, cif_number_of_struct_ids) < 0) {
03131 Cif_Error();
03132 }
03133
03134 cif_number_of_struct_ids = -1;
03135
03136 if (! output_struct_ids(&opnd)) {
03137 Cif_Error();
03138 }
03139
03140 if (fprintf(c_i_f, "%c", EOR) < 0) {
03141 Cif_Error();
03142 }
03143
03144 break;
03145 }
03146
03147 EXIT:
03148
03149 TRACE (Func_Exit, "cif_usage_rec", NULL);
03150
03151 return;
03152
03153 }
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176 void cif_sb_usage_rec(int sb_idx,
03177 int line_num,
03178 int col_num,
03179 cif_usage_code_type usage_code)
03180 {
03181 int file_line_num;
03182 int local_file_id;
03183
03184
03185 TRACE (Func_Entry, "cif_sb_usage_rec", NULL);
03186
03187 file_line_num = get_line_and_file_id(line_num, &local_file_id);
03188
03189 if (SB_CIF_SYMBOL_ID(sb_idx) == 0) {
03190 SB_CIF_SYMBOL_ID(sb_idx) = NEXT_SYMBOL_ID;
03191 }
03192
03193 Cif_Usage_Rec(c_i_f,
03194 SB_CIF_SYMBOL_ID(sb_idx),
03195 local_file_id,
03196 file_line_num,
03197 col_num,
03198 usage_code,
03199 0,
03200 NULL);
03201
03202 TRACE (Func_Exit, "cif_sb_usage_rec", NULL);
03203
03204 return;
03205
03206 }
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217
03218
03219
03220
03221
03222
03223
03224
03225 void cif_enable_disable_rec(void)
03226 {
03227 long enable_disable_opts;
03228
03229
03230 TRACE (Func_Entry, "cif_enable_disable_rec", NULL);
03231
03232 enable_disable_opts = 0;
03233
03234 if (on_off_flags.abort_if_any_errors) {
03235 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTa;
03236 }
03237
03238
03239 # ifdef _ACCEPT_FLOW
03240
03241 if (on_off_flags.flowtrace_option) {
03242 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTf;
03243 }
03244
03245 # endif
03246
03247
03248 # ifdef _ACCEPT_CMD_ed_i
03249
03250 if (on_off_flags.indef_init) {
03251 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTi;
03252 }
03253
03254 # endif
03255
03256
03257 # ifdef _ACCEPT_CMD_ed_j
03258
03259 if (on_off_flags.exec_doloops_once) {
03260 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTj;
03261 }
03262
03263 # endif
03264
03265
03266 if (on_off_flags.issue_ansi_messages) {
03267 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTn;
03268 }
03269
03270 if (on_off_flags.enable_double_precision) {
03271 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTp;
03272 }
03273
03274 if (on_off_flags.abort_on_100_errors) {
03275 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTq;
03276 }
03277
03278
03279 # ifdef _ACCEPT_CMD_ed_r
03280
03281 if (on_off_flags.round_mult_operations) {
03282 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTr;
03283 }
03284
03285 # endif
03286
03287
03288 if (on_off_flags.alloc_autos_on_stack) {
03289 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTt;
03290 }
03291
03292 if (on_off_flags.eu) {
03293 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTu;
03294 }
03295
03296 if (on_off_flags.save_all_vars) {
03297 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTv;
03298 }
03299
03300
03301 # ifdef _ACCEPT_CMD_ed_A
03302
03303 if (on_off_flags.MPP_apprentice) {
03304 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTA;
03305 }
03306
03307 # endif
03308
03309
03310 if (cmd_line_flags.binary_output) {
03311 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTB;
03312 }
03313
03314 if (cmd_line_flags.assembly_output) {
03315 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTS;
03316 }
03317
03318
03319 # ifdef _ACCEPT_CMD_ed_X
03320
03321 if (on_off_flags.atexpert) {
03322 enable_disable_opts = enable_disable_opts | CIF_F90_EDF_OPTX;
03323 }
03324
03325 # endif
03326
03327
03328 Cif_EDopts_Rec(c_i_f, enable_disable_opts);
03329
03330 TRACE (Func_Exit, "cif_enable_disable_rec", NULL);
03331
03332 return;
03333
03334 }
03335
03336
03337
03338
03339
03340
03341
03342
03343
03344
03345
03346
03347
03348
03349
03350
03351
03352
03353 void cif_machine_characteristics_rec(void)
03354 {
03355
03356
03357 # if defined(_HOST_OS_UNICOS) || defined(_HOST_OS_MAX)
03358
03359 int characteristics;
03360
03361 union {long int_form;
03362 char char_form[9];
03363 } cpu_type;
03364
03365 # endif
03366
03367
03368 TRACE (Func_Entry, "cif_machine_characteristics_rec", NULL);
03369
03370
03371 # ifdef _TARGET_OS_UNICOS
03372
03373 # ifdef _GETPMC_AVAILABLE
03374
03375
03376
03377 cpu_type.int_form = target_machine.fld.mcpmt;
03378 cpu_type.char_form[8] = NULL_CHAR;
03379
03380
03381
03382
03383 characteristics = 0;
03384
03385 if (target_machine.fld.mcvpop) {
03386 characteristics = characteristics | CIF_MC_VPOP;
03387 }
03388
03389 if (target_machine.fld.mcema) {
03390 characteristics = characteristics | CIF_MC_EMA;
03391 }
03392
03393 if (target_machine.fld.mccigs) {
03394 characteristics = characteristics | CIF_MC_CIGS;
03395 }
03396
03397 if (target_machine.fld.mcpc) {
03398 characteristics = characteristics | CIF_MC_PCF;
03399 }
03400
03401 if (target_machine.fld.mcrdvl) {
03402 characteristics = characteristics | CIF_MC_READVL;
03403 }
03404
03405 if (target_machine.fld.mcvrcr) {
03406 characteristics = characteristics | CIF_MC_VRECUR;
03407 }
03408
03409 if (target_machine.fld.mcavl) {
03410 characteristics = characteristics | CIF_MC_AVL;
03411 }
03412
03413 if (target_machine.fld.mchpm) {
03414 characteristics = characteristics | CIF_MC_HPF;
03415 }
03416
03417 if (target_machine.fld.mcbdm) {
03418 characteristics = characteristics | CIF_MC_BDM;
03419 }
03420
03421 if (target_machine.fld.mcstr) {
03422 characteristics = characteristics | CIF_MC_SREG;
03423 }
03424
03425 if (target_machine.fld.mcstr) {
03426 characteristics = characteristics | CIF_MC_CLUSTER;
03427 }
03428
03429 if (target_machine.fld.mccori) {
03430 characteristics = characteristics | CIF_MC_COR;
03431 }
03432
03433 if (target_machine.fld.mcaddr32) {
03434 characteristics = characteristics | CIF_MC_ADDR32;
03435 }
03436
03437 if (target_machine.fld.mcbmm) {
03438 characteristics = characteristics | CIF_MC_BMM;
03439 }
03440
03441 if (target_machine.fld.mcxea) {
03442 characteristics = characteristics | CIF_MC_XEA;
03443 }
03444
03445 if (target_machine.fld.mcavpop) {
03446 characteristics = characteristics | CIF_MC_AVPOP;
03447 }
03448
03449 if (target_machine.fld.mcfullsect) {
03450 characteristics = characteristics | CIF_MC_FULLSECT;
03451 }
03452
03453 if (target_machine.fld.mcieee) {
03454 characteristics = characteristics | CIF_MC_IEEE;
03455 }
03456
03457 if (target_machine.fld.mccmrreq) {
03458 characteristics = characteristics | CIF_MC_CMRREQ;
03459 }
03460
03461 if (target_machine.fld.mccache) {
03462 characteristics = characteristics | CIF_MC_CACHE;
03463 }
03464
03465 Cif_Mach_Char_Rec(c_i_f,
03466 cpu_type.char_form,
03467 target_machine.fld.mcmspd,
03468 target_machine.fld.mcmsz,
03469 characteristics,
03470 target_machine.fld.mcbank,
03471 target_machine.fld.mcncpu,
03472 target_machine.fld.mcibsz,
03473 target_machine.fld.mcclk,
03474 target_machine.fld.mcncl,
03475 target_machine.fld.mcbbsy,
03476 TARGET_BITS_PER_WORD);
03477
03478
03479 # else
03480
03481
03482
03483
03484
03485
03486
03487
03488 Cif_Mach_Char_Rec(c_i_f,
03489 target_machine.fld.mcpmt,
03490 -1L,
03491 -1L,
03492 0,
03493 -1L,
03494 -1L,
03495 -1L,
03496 -1L,
03497 -1L,
03498 -1L,
03499 TARGET_BITS_PER_WORD);
03500
03501 # endif
03502
03503
03504 # endif
03505
03506
03507 # ifdef _TARGET_OS_MAX
03508
03509
03510 # if defined(_GETPMC_AVAILABLE)
03511
03512
03513
03514 cpu_type.int_form = target_machine.fld.mcpmt;
03515 cpu_type.char_form[8] = NULL_CHAR;
03516
03517
03518 Cif_Mach_Char_Rec(c_i_f,
03519 cpu_type.char_form,
03520 -1L,
03521 target_machine.fld.mcmsz,
03522 0,
03523 -1L,
03524 -1L,
03525 -1L,
03526 -1L,
03527 -1L,
03528 -1L,
03529 TARGET_BITS_PER_WORD);
03530
03531 # else
03532
03533
03534
03535
03536
03537
03538
03539
03540 Cif_Mach_Char_Rec(c_i_f,
03541 target_machine.fld.mcpmt,
03542 -1L,
03543 -1L,
03544 0,
03545 -1L,
03546 -1L,
03547 -1L,
03548 -1L,
03549 -1L,
03550 -1L,
03551 TARGET_BITS_PER_WORD);
03552
03553
03554 # endif
03555
03556
03557 # endif
03558
03559
03560 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) || defined(_TARGET_OS_DARWIN)
03561
03562
03563
03564
03565 Cif_Mach_Char_Rec(c_i_f,
03566 "IRIX",
03567 -1L,
03568 -1L,
03569 0,
03570 -1L,
03571 -1L,
03572 -1L,
03573 -1L,
03574 -1L,
03575 -1L,
03576 TARGET_BITS_PER_WORD);
03577
03578 # elif defined(_TARGET_OS_SOLARIS)
03579
03580
03581
03582 Cif_Mach_Char_Rec(c_i_f,
03583 "SPARC",
03584 -1L,
03585 -1L,
03586 0,
03587 -1L,
03588 -1L,
03589 -1L,
03590 -1L,
03591 -1L,
03592 -1L,
03593 TARGET_BITS_PER_WORD);
03594 # endif
03595
03596
03597 TRACE (Func_Exit, "cif_machine_characteristics_rec", NULL);
03598
03599 return;
03600
03601 }
03602
03603
03604
03605
03606
03607
03608
03609
03610
03611
03612
03613
03614
03615
03616
03617
03618
03619
03620
03621
03622 void cif_stmt_type_rec(boolean exact_stmt_type_known,
03623 cif_stmt_type exact_stmt_type,
03624 int stmt_number)
03625 {
03626 int file_line_num;
03627 int local_file_id;
03628 cif_stmt_type local_stmt_type;
03629
03630
03631 TRACE (Func_Entry, "cif_stmt_type_rec", NULL);
03632
03633 local_stmt_type = (exact_stmt_type_known) ?
03634 exact_stmt_type : mapped_stmt_type[stmt_type];
03635
03636 switch (local_stmt_type) {
03637
03638 case CIF_Not_Exact:
03639 if (comp_phase < Decl_Semantics && stmt_type == Assignment_Stmt) {
03640
03641
03642
03643
03644 gen_sh(Before, Statement_Num_Stmt, stmt_start_line, stmt_start_col,
03645 FALSE, FALSE, TRUE);
03646 SH_PARENT_BLK_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = stmt_number;
03647 }
03648
03649 break;
03650
03651 case CIF_Stmt_Type_Error:
03652 PRINTMSG(stmt_start_line, 776, Internal, stmt_start_col);
03653
03654 default:
03655 file_line_num = get_line_and_file_id(stmt_start_line, &local_file_id);
03656
03657 Cif_Stmt_Type_Rec(c_i_f,
03658 local_stmt_type,
03659 local_file_id,
03660 file_line_num,
03661 stmt_start_col,
03662 stmt_number);
03663 }
03664
03665 TRACE (Func_Exit, "cif_stmt_type_rec", NULL);
03666
03667 return;
03668
03669 }
03670
03671
03672
03673
03674
03675
03676
03677
03678
03679
03680
03681
03682
03683
03684
03685
03686
03687
03688
03689 void cif_cont_line_rec(int continuation_type,
03690 int line_number)
03691 {
03692 int file_line_num;
03693 int local_file_id;
03694
03695
03696 file_line_num = get_line_and_file_id(line_number, &local_file_id);
03697
03698 Cif_Continuation_Rec(c_i_f,
03699 continuation_type,
03700 local_file_id,
03701 line_number,
03702 1);
03703
03704 return;
03705
03706 }
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726 void cif_call_site_rec(int ir_idx,
03727 int gen_idx)
03728
03729 {
03730 int array_type;
03731 long attributes;
03732 int attr_idx;
03733 int bd_idx;
03734 char buffer[160];
03735 char char_len[20];
03736 int column;
03737 int derived_type_id;
03738 int file_line_num;
03739 int i;
03740 int info_idx;
03741 int k;
03742 int list_idx;
03743 int local_file_id;
03744 int misc_attrs;
03745 int num_args;
03746 int num_dims;
03747 opnd_type opnd;
03748 int pgm_unit_type;
03749 int rslt_id;
03750 int save_reference;
03751 int spec_idx;
03752 int specific_symbol_id;
03753 char string[20];
03754 int symbol_id;
03755 int type;
03756 char var_len_bound[3];
03757
03758
03759 TRACE (Func_Entry, "cif_call_site_rec", NULL);
03760
03761
03762
03763
03764
03765
03766
03767
03768 skip_struct_base = FALSE;
03769 file_line_num = get_line_and_file_id(IR_LINE_NUM_L(ir_idx),
03770 &local_file_id);
03771 spec_idx = IR_IDX_L(ir_idx);
03772
03773
03774
03775
03776
03777
03778 if (spec_idx != gen_idx && AT_DCL_ERR(gen_idx)) {
03779 goto EXIT;
03780 }
03781
03782 num_args = IR_LIST_CNT_R(ir_idx);
03783 list_idx = IR_IDX_R(ir_idx);
03784
03785 for (i = 1; i <= num_args; i++) {
03786
03787 info_idx = IL_ARG_DESC_IDX(list_idx);
03788
03789 if (info_idx == 0) {
03790
03791 }
03792 else if (arg_info_list[info_idx].ed.component) {
03793 arg_info_list[info_idx].ed.cif_id = list_idx;
03794 }
03795 else if (arg_info_list[info_idx].ed.cif_id != 0) {
03796
03797 }
03798 else if (arg_info_list[info_idx].ed.reference ||
03799 (IL_FLD(list_idx) == AT_Tbl_Idx &&
03800 ! AT_COMPILER_GEND(IL_IDX(list_idx)))) {
03801
03802
03803
03804 COPY_OPND(opnd, IL_OPND(list_idx));
03805 attr_idx = find_left_attr(&opnd);
03806
03807 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
03808 ATP_PROC(attr_idx) == Intrin_Proc) {
03809 attr_idx = ATP_INTERFACE_IDX(attr_idx);
03810 }
03811
03812 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
03813 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
03814 }
03815
03816 arg_info_list[info_idx].ed.cif_id = AT_CIF_SYMBOL_ID(attr_idx);
03817 }
03818 else {
03819 symbol_id = NEXT_SYMBOL_ID;
03820 char_len[0] = NULL_CHAR;
03821
03822 COPY_OPND(opnd, IL_OPND(list_idx));
03823 attr_idx = find_left_attr(&opnd);
03824
03825 type = (arg_info_list[info_idx].ed.type == Structure) ?
03826 ATT_CIF_DT_ID(TYP_IDX(arg_info_list[info_idx].ed.type_idx)) :
03827 arg_info_list[info_idx].ed.linear_type;
03828
03829 if (arg_info_list[info_idx].ed.type == Character) {
03830
03831 if (arg_info_list[info_idx].ed.char_len.fld == CN_Tbl_Idx) {
03832 convert_to_string(
03833 &CN_CONST(arg_info_list[info_idx].ed.char_len.idx),
03834 CN_TYPE_IDX(arg_info_list[info_idx].ed.char_len.idx),
03835 char_len);
03836 }
03837 else {
03838 char_len[0] = VAR_LEN_CHAR;
03839 char_len[1] = NULL_CHAR;
03840 }
03841 }
03842
03843 misc_attrs = 0;
03844 derived_type_id = 0;
03845
03846 if (arg_info_list[info_idx].ed.constant) {
03847
03848 if (IL_FLD(list_idx) == CN_Tbl_Idx) {
03849 attr_idx = IL_IDX(list_idx);
03850 }
03851 }
03852
03853 num_dims = arg_info_list[info_idx].ed.rank;
03854
03855 array_type = (num_dims > 0) ? 1 : 0;
03856
03857 if (fprintf(c_i_f,
03858 "%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",
03859 CIF_F90_OBJECT, EOI,
03860 "", EOI,
03861 symbol_id, EOI,
03862 SCP_CIF_ID(curr_scp_idx), EOI,
03863 cif_data_type(type), EOI,
03864 2, EOI,
03865 7,EOI,
03866 0,EOI,
03867 -1, EOI,
03868 misc_attrs, EOI,
03869 derived_type_id, EOI,
03870 char_len, EOI,
03871 num_dims, EOI,
03872 array_type) < 0) {
03873 Cif_Error();
03874 goto EXIT;
03875 }
03876
03877 buffer[0] = NULL_CHAR;
03878
03879 var_len_bound[0] = EOI;
03880 var_len_bound[1] = VAR_LEN_CHAR;
03881 var_len_bound[2] = NULL_CHAR;
03882
03883 for (k = 0; k < num_dims; k++) {
03884
03885 if (arg_info_list[info_idx].ed.constant &&
03886 attr_idx != NULL_IDX) {
03887
03888 bd_idx = ATD_ARRAY_IDX(attr_idx);
03889
03890 if (BD_LB_FLD(bd_idx, k+1) == CN_Tbl_Idx) {
03891 sprintf(string, "%c%s",
03892 EOI,
03893 convert_to_string(&CN_CONST(BD_LB_IDX(bd_idx,k+1)),
03894 CN_TYPE_IDX(BD_LB_IDX(bd_idx,k+1)),
03895 outbuf1));
03896 strcat(buffer, string);
03897 }
03898 else {
03899 strcat(buffer, var_len_bound);
03900 }
03901
03902 if (BD_UB_FLD(bd_idx, k+1) == CN_Tbl_Idx) {
03903 sprintf(string, "%c%s",
03904 EOI,
03905 convert_to_string(&CN_CONST(BD_UB_IDX(bd_idx,k+1)),
03906 CN_TYPE_IDX(BD_UB_IDX(bd_idx,k+1)),
03907 outbuf1));
03908 strcat(buffer, string);
03909 }
03910 else {
03911 strcat(buffer, var_len_bound);
03912 }
03913 }
03914 else {
03915 buffer[0] = EOI;
03916 buffer[1] = '1';
03917 buffer[2] = NULL_CHAR;
03918
03919 if (OPND_FLD(arg_info_list[info_idx].ed.shape[k]) ==
03920 CN_Tbl_Idx) {
03921 sprintf(string, "%c%s",
03922 EOI,
03923 convert_to_string(
03924 &CN_CONST(OPND_IDX(
03925 arg_info_list[info_idx].ed.shape[k])),
03926 CN_TYPE_IDX(OPND_IDX(
03927 arg_info_list[info_idx].ed.shape[k])),
03928 outbuf1));
03929 strcat(buffer, string);
03930 }
03931 else {
03932 strcat(buffer, var_len_bound);
03933 }
03934 }
03935
03936 if (fprintf(c_i_f, "%s", buffer) < 0) {
03937 Cif_Error();
03938 goto EXIT;
03939 }
03940 }
03941
03942 if (fprintf(c_i_f, "%c%d%c%d%c%d%c",
03943 EOI,
03944 0, EOI,
03945 0, EOI,
03946 0, EOR) < 0) {
03947 Cif_Error();
03948 goto EXIT;
03949 }
03950
03951 arg_info_list[info_idx].ed.cif_id = symbol_id;
03952 }
03953
03954 list_idx = IL_NEXT_LIST_IDX(list_idx);
03955 }
03956
03957 if (ATP_PROC(spec_idx) == Intrin_Proc && !ATI_USER_SPECIFIED(gen_idx)) {
03958
03959
03960
03961
03962 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
03963 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
03964 }
03965
03966 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
03967
03968 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
03969 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
03970 }
03971
03972 specific_symbol_id = 0;
03973 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
03974
03975 column = (ATP_PGM_UNIT(spec_idx) == Function) ? IR_COL_NUM_L(ir_idx) :
03976 IR_COL_NUM(ir_idx);
03977 if (! ATI_CIF_SEEN_IN_CALL(gen_idx)) {
03978
03979
03980
03981
03982 rslt_id = 0;
03983
03984 if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Function_Interface) {
03985 pgm_unit_type = CIF_F90_ET_FUNCTION;
03986
03987
03988
03989
03990
03991
03992 if (AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx)) == 0) {
03993 AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx)) = NEXT_SYMBOL_ID;
03994 }
03995
03996 rslt_id = AT_CIF_SYMBOL_ID(ATP_RSLT_IDX(spec_idx));
03997 }
03998 else if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Subroutine_Interface){
03999 pgm_unit_type = CIF_F90_ET_SUBROUTINE;
04000
04001
04002
04003
04004 save_reference = AT_REFERENCED(spec_idx);
04005 AT_REFERENCED(spec_idx) = Referenced;
04006 cif_send_attr(spec_idx, NULL_IDX);
04007 AT_REFERENCED(spec_idx) = save_reference;
04008
04009 }
04010 else {
04011 pgm_unit_type = CIF_F90_ET_UNKNOWN;
04012 cif_send_attr(spec_idx, NULL_IDX);
04013 }
04014
04015 attributes = CIF_PGM_REFERENCE;
04016
04017 if (AT_PRIVATE(gen_idx)) {
04018 attributes = attributes | CIF_PGM_PRIVATE;
04019 }
04020
04021 Cif_F90_Entry_Rec(c_i_f,
04022 AT_OBJ_NAME_PTR(gen_idx),
04023 AT_CIF_SYMBOL_ID(gen_idx),
04024 SCP_CIF_ID(curr_scp_idx),
04025 pgm_unit_type,
04026 CIF_F90_PT_INTRINSIC,
04027 attributes,
04028 rslt_id,
04029 0,
04030 0,
04031 NULL);
04032 }
04033 }
04034 else if (spec_idx == gen_idx) {
04035
04036 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04037 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04038 }
04039
04040 symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04041 specific_symbol_id = 0;
04042
04043 if (ATP_PGM_UNIT(spec_idx) == Function) {
04044 column = IR_COL_NUM_L(ir_idx);
04045 }
04046 else {
04047 column = IR_COL_NUM(ir_idx);
04048 }
04049 }
04050 else if (ATI_INTERFACE_CLASS(gen_idx) == Defined_Assign_Interface) {
04051
04052 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04053 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04054 }
04055
04056 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04057
04058 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
04059 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
04060 }
04061
04062 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
04063 column = IR_COL_NUM(ir_idx);
04064 }
04065 else {
04066
04067 if (AT_CIF_SYMBOL_ID(spec_idx) == 0) {
04068 AT_CIF_SYMBOL_ID(spec_idx) = NEXT_SYMBOL_ID;
04069 }
04070
04071 specific_symbol_id = AT_CIF_SYMBOL_ID(spec_idx);
04072
04073 if (AT_CIF_SYMBOL_ID(gen_idx) == 0) {
04074 AT_CIF_SYMBOL_ID(gen_idx) = NEXT_SYMBOL_ID;
04075 }
04076
04077 symbol_id = AT_CIF_SYMBOL_ID(gen_idx);
04078
04079 if (ATI_INTERFACE_CLASS(gen_idx) == Generic_Function_Interface) {
04080 column = IR_COL_NUM_L(ir_idx);
04081 }
04082 else {
04083 column = IR_COL_NUM(ir_idx);
04084 }
04085 }
04086
04087 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d",
04088 CIF_F90_CALLSITE, EOI,
04089 symbol_id, EOI,
04090 SCP_CIF_ID(curr_scp_idx), EOI,
04091 local_file_id, EOI,
04092 file_line_num, EOI,
04093 column, EOI,
04094 specific_symbol_id, EOI,
04095 num_args) < 0) {
04096
04097 Cif_Error();
04098 goto EXIT;
04099 }
04100
04101
04102
04103
04104 list_idx = IR_IDX_R(ir_idx);
04105
04106 for (i = 1; i <= num_args; i++) {
04107
04108 info_idx = IL_ARG_DESC_IDX(list_idx);
04109
04110 if (info_idx == 0) {
04111
04112 if (fprintf(c_i_f, "%c%d", EOI, 0) < 0) {
04113 Cif_Error();
04114 goto EXIT;
04115 }
04116 }
04117 else if (arg_info_list[info_idx].ed.component) {
04118
04119 if (fprintf(c_i_f, "%c%c", EOI, '%') < 0) {
04120 Cif_Error();
04121 goto EXIT;
04122 }
04123
04124 COPY_OPND(opnd,
04125 IL_OPND(arg_info_list[info_idx].ed.cif_id));
04126
04127 cif_number_of_struct_ids = 0;
04128
04129 output_struct_ids(&opnd);
04130
04131 if (fprintf(c_i_f, "%c%d", EOI, cif_number_of_struct_ids) < 0) {
04132 Cif_Error();
04133 goto EXIT;
04134 }
04135
04136 cif_number_of_struct_ids = -1;
04137
04138 if (! output_struct_ids(&opnd)) {
04139 Cif_Error();
04140 goto EXIT;
04141 }
04142
04143 if (fprintf(c_i_f, "%c%c", EOI, '%') < 0) {
04144 Cif_Error();
04145 goto EXIT;
04146 }
04147 }
04148 else {
04149 if (fprintf(c_i_f, "%c%d",
04150 EOI,
04151 arg_info_list[info_idx].ed.cif_id) < 0) {
04152 Cif_Error();
04153 goto EXIT;
04154 }
04155 }
04156
04157 list_idx = IL_NEXT_LIST_IDX(list_idx);
04158 }
04159
04160
04161
04162
04163 list_idx = IR_IDX_R(ir_idx);
04164
04165 for (i = 1; i <= num_args; i++) {
04166
04167 info_idx = IL_ARG_DESC_IDX(list_idx);
04168
04169 if (info_idx == 0) {
04170
04171 if (fprintf(c_i_f, "%c%d", EOI, 0) < 0) {
04172 Cif_Error();
04173 goto EXIT;
04174 }
04175 }
04176 else {
04177
04178 if (fprintf(c_i_f, "%c%d",
04179 EOI,
04180 arg_info_list[info_idx].ed.rank) < 0) {
04181 Cif_Error();
04182 goto EXIT;
04183 }
04184 }
04185
04186 list_idx = IL_NEXT_LIST_IDX(list_idx);
04187 }
04188
04189 if (fprintf(c_i_f,"%c", EOR) < 0) {
04190 Cif_Error();
04191 goto EXIT;
04192 }
04193
04194 EXIT:
04195
04196 TRACE (Func_Exit, "cif_call_site_rec", NULL);
04197
04198 return;
04199
04200 }
04201
04202
04203
04204
04205
04206
04207
04208
04209
04210
04211
04212
04213
04214
04215
04216
04217
04218
04219
04220
04221 void cif_named_constant_rec(int attr_idx,
04222 int start_line,
04223 int start_column)
04224 {
04225 int cn_idx;
04226 int const_idx;
04227 int end_col;
04228 int end_line;
04229 int file_id;
04230 long64 length;
04231 boolean ok;
04232 long_type result[MAX_WORDS_FOR_NUMERIC];
04233 char str[80];
04234 int type_idx;
04235
04236
04237 TRACE (Func_Entry, "cif_named_constant_rec", NULL);
04238
04239 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
04240 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
04241 }
04242
04243 if (TYP_LINEAR(ATD_TYPE_IDX(attr_idx)) != Structure_Type &&
04244 ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
04245 const_idx = ATD_CONST_IDX(attr_idx);
04246 }
04247 else {
04248 const_idx = NULL_IDX;
04249 }
04250
04251 get_line_and_file_id(start_line, &file_id);
04252
04253 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c",
04254 CIF_F90_CONST, EOI,
04255 AT_CIF_SYMBOL_ID(attr_idx), EOI,
04256 (c_i_f == cif_actual_file) ?
04257 SCP_CIF_ID(curr_scp_idx) : 1, EOI,
04258 (const_idx) ? 0 : 1, EOI) < 0) {
04259 Cif_Error();
04260 }
04261
04262 if (const_idx) {
04263
04264 switch (TYP_TYPE(ATD_TYPE_IDX(attr_idx))) {
04265
04266 case Logical:
04267 if (fprintf(c_i_f, "%s",
04268 (THIS_IS_TRUE(&(CN_CONST(const_idx)),
04269 CN_TYPE_IDX(const_idx)) ?
04270
04271 ".TRUE." : ".FALSE.")) < 0) {
04272 Cif_Error();
04273 }
04274
04275 break;
04276
04277 case Integer:
04278 case Real:
04279 case Complex:
04280
04281 if (fprintf(c_i_f, "%s", convert_to_string(&CN_CONST(const_idx),
04282 CN_TYPE_IDX(const_idx),
04283 str)) < 0) {
04284 Cif_Error();
04285 }
04286
04287 break;
04288
04289 case Typeless:
04290 if (TYP_LINEAR(CN_TYPE_IDX(const_idx)) == Typeless_4 ||
04291 TYP_LINEAR(CN_TYPE_IDX(const_idx)) == Typeless_8) {
04292
04293 if (fprintf(c_i_f, "%s",
04294 convert_to_string(&CN_CONST(const_idx),
04295 CN_TYPE_IDX(const_idx),
04296 str)) < 0) {
04297 Cif_Error();
04298 }
04299 }
04300 else if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04301 Cif_Error();
04302 }
04303
04304 break;
04305
04306 case Character:
04307
04308 C_TO_F_INT(result, TARGET_CHARS_PER_WORD, CG_INTEGER_DEFAULT_TYPE);
04309
04310 cn_idx = TYP_IDX(CN_TYPE_IDX(const_idx));
04311 type_idx = CG_INTEGER_DEFAULT_TYPE;
04312
04313 ok = folder_driver((char *) &CN_CONST(cn_idx),
04314 CN_TYPE_IDX(cn_idx),
04315 (char *) result,
04316 type_idx,
04317 result,
04318 &type_idx,
04319 stmt_start_line,
04320 stmt_start_col,
04321 2,
04322 Mod_Opr);
04323
04324 ok |= folder_driver((char *) result,
04325 type_idx,
04326 (char *) &CN_CONST(CN_INTEGER_ZERO_IDX),
04327 CN_TYPE_IDX(CN_INTEGER_ZERO_IDX),
04328 result,
04329 &type_idx,
04330 stmt_start_line,
04331 stmt_start_col,
04332 2,
04333 Eq_Opr);
04334
04335
04336 if (ok && THIS_IS_TRUE(result, type_idx)) {
04337
04338 if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04339 Cif_Error();
04340 }
04341 }
04342 else {
04343 length = CN_INT_TO_C(TYP_IDX(CN_TYPE_IDX(const_idx)));
04344 ((char *) &CN_CONST(const_idx)) [length] = NULL_CHAR;
04345
04346 if (fprintf(c_i_f, "%s", (char *) &CN_CONST(const_idx)) < 0) {
04347 Cif_Error();
04348 }
04349
04350 ((char *) &CN_CONST(const_idx)) [length] = ' ';
04351 }
04352
04353 break;
04354
04355 }
04356 }
04357
04358
04359
04360
04361
04362 if (start_line != 0) {
04363 prev_char_line_and_col(&end_line, &end_col);
04364 }
04365 else {
04366 file_id = 0;
04367 end_line = 0;
04368 end_col = 0;
04369 }
04370
04371 if (fprintf(c_i_f, "%c%d%c%d%c%d%c%d%c%d%c",
04372 EOI,
04373 file_id, EOI,
04374 start_line, EOI,
04375 start_column, EOI,
04376 end_line, EOI,
04377 end_col, EOR) < 0) {
04378 Cif_Error();
04379 }
04380
04381 TRACE (Func_Exit, "cif_named_constant_rec", NULL);
04382
04383 return;
04384
04385 }
04386
04387
04388
04389
04390
04391
04392
04393
04394
04395
04396
04397
04398
04399
04400
04401
04402
04403
04404 void cif_loop_def_rec(void)
04405 {
04406 int construct_name_id;
04407 int do_sh_idx;
04408 int do_var_idx;
04409 int end_file_id;
04410 int end_line;
04411 int il_idx;
04412 int loop_info_il_idx;
04413 int loop_ir_idx;
04414 int loop_label_id;
04415 int loop_type;
04416 int lcv_symbol_id;
04417 int start_file_id;
04418 int start_line;
04419
04420
04421 TRACE (Func_Entry, "cif_loop_def_rec", NULL);
04422
04423 do_sh_idx = SH_PARENT_BLK_IDX(curr_stmt_sh_idx);
04424
04425 if (do_sh_idx == NULL_IDX || SH_COMPILER_GEN(do_sh_idx)) {
04426 TRACE (Func_Exit, "cif_loop_def_rec", NULL);
04427 return;
04428 }
04429
04430 loop_ir_idx = SH_IR_IDX(do_sh_idx);
04431 loop_info_il_idx = IR_IDX_R(loop_ir_idx);
04432
04433 if (SH_STMT_TYPE(do_sh_idx) == Do_Iterative_Stmt) {
04434 loop_type = CIF_LP_DO;
04435
04436
04437
04438
04439
04440 if (IL_FLD(loop_info_il_idx) == IL_Tbl_Idx) {
04441 il_idx = IL_IDX(loop_info_il_idx);
04442 }
04443 else {
04444 il_idx = loop_info_il_idx;
04445 }
04446
04447 if (IL_FLD(il_idx) == AT_Tbl_Idx) {
04448 do_var_idx = IL_IDX(il_idx);
04449 }
04450 else {
04451
04452
04453
04454 do_var_idx = IR_IDX_L(IL_IDX(il_idx));
04455 }
04456
04457 if (AT_CIF_SYMBOL_ID(do_var_idx) == 0) {
04458 AT_CIF_SYMBOL_ID(do_var_idx) = NEXT_SYMBOL_ID;
04459 }
04460
04461 lcv_symbol_id = AT_CIF_SYMBOL_ID(do_var_idx);
04462 }
04463 else {
04464 loop_type = (SH_STMT_TYPE(do_sh_idx) == Do_While_Stmt) ?
04465 CIF_LP_DOWHILE : CIF_LP_DO_INFINITE;
04466 lcv_symbol_id = 0;
04467 }
04468
04469
04470
04471
04472
04473
04474
04475 start_line = get_line_and_file_id(SH_GLB_LINE(do_sh_idx),
04476 &start_file_id);
04477
04478 end_line = get_line_and_file_id(stmt_end_line, &end_file_id);
04479
04480
04481 loop_info_il_idx = IL_NEXT_LIST_IDX(IL_NEXT_LIST_IDX(loop_info_il_idx));
04482 il_idx = IL_IDX(loop_info_il_idx);
04483
04484 if (IL_FLD(il_idx) == NO_Tbl_Idx) {
04485 loop_label_id = 0;
04486 }
04487 else {
04488
04489 if (AT_CIF_SYMBOL_ID(IL_IDX(il_idx)) == 0) {
04490 AT_CIF_SYMBOL_ID(IL_IDX(il_idx)) = NEXT_SYMBOL_ID;
04491 }
04492
04493 loop_label_id = AT_CIF_SYMBOL_ID(IL_IDX(il_idx));
04494 }
04495
04496 il_idx = IL_NEXT_LIST_IDX(il_idx);
04497
04498 if (IL_FLD(il_idx) == NO_Tbl_Idx) {
04499 construct_name_id = 0;
04500 }
04501 else {
04502
04503 if (AT_CIF_SYMBOL_ID(IL_IDX(il_idx)) == 0) {
04504 AT_CIF_SYMBOL_ID(IL_IDX(il_idx)) = NEXT_SYMBOL_ID;
04505 }
04506
04507 construct_name_id = AT_CIF_SYMBOL_ID(IL_IDX(il_idx));
04508 }
04509
04510 Cif_F90_Loop_Rec(c_i_f,
04511 SCP_CIF_ID(curr_scp_idx),
04512 loop_type,
04513 start_file_id,
04514 start_line,
04515 SH_COL_NUM(do_sh_idx),
04516 end_file_id,
04517 end_line,
04518 stmt_end_col,
04519 lcv_symbol_id,
04520 loop_label_id,
04521 construct_name_id,
04522 statement_number);
04523
04524 TRACE (Func_Exit, "cif_loop_def_rec", NULL);
04525
04526 return;
04527
04528 }
04529
04530
04531
04532
04533
04534
04535
04536
04537
04538
04539
04540
04541
04542
04543
04544
04545
04546
04547 void cif_label_rec(int attr_idx)
04548
04549 {
04550 int label_class;
04551
04552
04553 TRACE(Func_Entry, "cif_label_rec", NULL);
04554
04555 switch (ATL_CLASS(attr_idx)) {
04556
04557 case Lbl_Unknown:
04558 label_class = CIF_LB_UNKNOWN;
04559 break;
04560
04561 case Lbl_User:
04562 label_class = CIF_LB_STMT;
04563 break;
04564
04565 case Lbl_Format:
04566 label_class = CIF_LB_FORMAT;
04567 break;
04568
04569 case Lbl_Debug:
04570 case Lbl_Internal:
04571 goto EXIT;
04572
04573 default:
04574 label_class = CIF_LB_CONSTRUCT;
04575 }
04576
04577 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
04578 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
04579 }
04580
04581 Cif_F90_Label_Rec(c_i_f,
04582 AT_OBJ_NAME_PTR(attr_idx),
04583 AT_CIF_SYMBOL_ID(attr_idx),
04584 SCP_CIF_ID(curr_scp_idx),
04585 label_class);
04586
04587 EXIT:
04588
04589 TRACE(Func_Exit, "cif_label_rec", NULL);
04590
04591 return;
04592
04593 }
04594
04595
04596
04597
04598
04599
04600
04601
04602
04603
04604
04605
04606
04607
04608
04609
04610
04611
04612 void cif_misc_compiler_opts_rec(void)
04613 {
04614 char char_msg_num[5];
04615 int i;
04616 int int_len = 0;
04617 int j;
04618 #ifdef KEY
04619 int msg_level = 0;
04620 #else
04621 int msg_level;
04622 #endif
04623 char work_buf[512];
04624 char null_string[1] = "";
04625 int num_items;
04626 int num_paths;
04627 int path_idx;
04628
04629
04630 TRACE (Func_Entry, "cif_misc_compiler_opts_rec", NULL);
04631
04632
04633 if (cmd_line_flags.integer_32) {
04634 int_len = 2;
04635 }
04636
04637 switch (cmd_line_flags.msg_lvl_suppressed) {
04638
04639 case Comment_Lvl:
04640 msg_level = 0;
04641 break;
04642
04643 case Note_Lvl:
04644 msg_level = 1;
04645 break;
04646
04647 case Caution_Lvl:
04648 msg_level = 2;
04649 break;
04650
04651 case Warning_Lvl:
04652 msg_level = 3;
04653 break;
04654
04655 case Error_Lvl:
04656 msg_level = 4;
04657 }
04658
04659
04660
04661
04662 num_items = 0;
04663 work_buf[0] = NULL_CHAR;
04664
04665 for (i = 0; i < MAX_MSG_SIZE; ++i) {
04666
04667 if (message_suppress_tbl[i] != 0) {
04668
04669 for (j = i * HOST_BITS_PER_WORD;
04670 j < (i + 1) * HOST_BITS_PER_WORD;
04671 ++j) {
04672
04673 if (GET_MESSAGE_TBL(message_suppress_tbl, j)) {
04674 ++num_items;
04675 sprintf(char_msg_num, "%d%c", j, EOI);
04676 strcat(work_buf, char_msg_num);
04677 }
04678 }
04679 }
04680 }
04681
04682 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d%c%d%c",
04683 CIF_F90_MISC_OPTS, EOI,
04684 int_len, EOI,
04685 msg_level, EOI,
04686 (cmd_line_flags.verify_option) ? 1 : 0, EOI,
04687
04688 (on_off_flags.round_mult_operations) ? 0 : 1, EOI,
04689
04690 (!on_off_flags.round_mult_operations) ?
04691 cmd_line_flags.truncate_bits : 0, EOI,
04692 num_items, EOI) < 0) {
04693 Cif_Error();
04694 }
04695
04696 if (num_items > 0) {
04697
04698 if (fprintf(c_i_f, "%s", work_buf) < 0) {
04699 Cif_Error();
04700 }
04701 }
04702
04703
04704
04705
04706 num_items = 0;
04707 work_buf[0] = NULL_CHAR;
04708
04709 if (cmd_line_flags.disregard_all_directives) {
04710 ++num_items;
04711 strcat(work_buf, "all");
04712 strcat(work_buf, "\036");
04713 }
04714
04715 if (cmd_line_flags.disregard_all_dirs) {
04716 ++num_items;
04717 strcat(work_buf, "dir");
04718 strcat(work_buf, "\036");
04719 }
04720
04721 if (cmd_line_flags.disregard_all_mics) {
04722 ++num_items;
04723 strcat(work_buf, "mic");
04724 strcat(work_buf, "\036");
04725 }
04726
04727 if (cmd_line_flags.disregard_conditional_omp) {
04728 ++num_items;
04729 strcat(work_buf, "conditional_omp");
04730 strcat(work_buf, "\036");
04731 }
04732
04733 if (cmd_line_flags.disregard_all_mpp_cdirs) {
04734 ++num_items;
04735 strcat(work_buf, "mpp");
04736 strcat(work_buf, "\036");
04737 }
04738
04739 if (cmd_line_flags.disregard_all_mips) {
04740 ++num_items;
04741 strcat(work_buf, "mipspro");
04742 strcat(work_buf, "\036");
04743 }
04744
04745 if (cmd_line_flags.disregard_all_omps) {
04746 ++num_items;
04747 strcat(work_buf, "omp");
04748 strcat(work_buf, "\036");
04749 }
04750
04751 for (i = 0; i < (Tok_Dir_End - Tok_Dir_Start); i++) {
04752
04753 if (disregard_directive[i]) {
04754 ++num_items;
04755 strcat(work_buf, directive_str[i]);
04756 strcat(work_buf, "\036");
04757 }
04758 }
04759
04760 for (i = 0; i < (Tok_Mic_End - Tok_Mic_Start); i++) {
04761
04762 if (disregard_mics[i]) {
04763 ++num_items;
04764 strcat(work_buf, dir_mic_str[i]);
04765 strcat(work_buf, "\036");
04766 }
04767 }
04768
04769 if (fprintf(c_i_f, "%d%c", num_items, EOI) < 0) {
04770 Cif_Error();
04771 }
04772
04773 if (num_items > 0) {
04774
04775 if (fprintf(c_i_f, "%s", work_buf) < 0) {
04776 Cif_Error();
04777 }
04778 }
04779
04780
04781 if (fprintf(c_i_f, "%s%c%s%c%s%c%s%c%x%c%d%c",
04782 (cmd_line_flags.binary_output) ? bin_file : null_string,
04783 EOI,
04784 (cmd_line_flags.assembly_output) ? assembly_file :
04785 null_string, EOI,
04786 null_string, EOI,
04787 cif_name, EOI,
04788 cif_C_opts, EOI,
04789 (cmd_line_flags.line_size_80) ? 80 : 72, EOI) < 0) {
04790 Cif_Error();
04791 }
04792
04793
04794
04795
04796
04797
04798 if (include_path_idx == NULL_IDX) {
04799
04800 if (fprintf(c_i_f, "%d%c", 0, EOI) < 0) {
04801 Cif_Error();
04802 }
04803 }
04804 else {
04805
04806 path_idx = include_path_idx;
04807 num_paths = 0;
04808
04809 while (path_idx != NULL_IDX) {
04810 ++num_paths;
04811 path_idx = FP_NEXT_FILE_IDX(path_idx);
04812 }
04813
04814 if (fprintf(c_i_f, "%d%c", num_paths, EOI) < 0) {
04815 Cif_Error();
04816 }
04817
04818 path_idx = include_path_idx;
04819
04820 while (path_idx != NULL_IDX) {
04821
04822 if (fprintf(c_i_f, "%s%c",
04823 FP_NAME_PTR(path_idx), EOI) < 0) {
04824 Cif_Error();
04825 }
04826
04827 path_idx = FP_NEXT_FILE_IDX(path_idx);
04828 }
04829 }
04830
04831
04832
04833
04834
04835 if (module_path_idx == 0) {
04836
04837 if (fprintf(c_i_f, "%d%c", 0, EOI) < 0) {
04838 Cif_Error();
04839 }
04840 }
04841 else {
04842 path_idx = module_path_idx;
04843 num_paths = 0;
04844
04845 while (path_idx != NULL_IDX) {
04846 ++num_paths;
04847 path_idx = FP_NEXT_FILE_IDX(path_idx);
04848 }
04849
04850
04851
04852
04853 --num_paths;
04854
04855 if (fprintf(c_i_f, "%d%c", num_paths, EOI) < 0) {
04856 Cif_Error();
04857 }
04858
04859 path_idx = FP_NEXT_FILE_IDX(module_path_idx);
04860
04861 for (i = 1; i <= num_paths; ++i) {
04862
04863 if (fprintf(c_i_f, "%s%c", FP_NAME_PTR(path_idx), EOI) < 0) {
04864 Cif_Error();
04865 }
04866
04867 path_idx = FP_NEXT_FILE_IDX(path_idx);
04868 }
04869 }
04870
04871 if (fprintf(c_i_f, "%d%c",
04872 (cmd_line_flags.src_form == Fixed_Form) ? 0 : 1,
04873 EOR) < 0) {
04874 Cif_Error();
04875 }
04876
04877 TRACE (Func_Exit, "cif_misc_compiler_opts_rec", NULL);
04878
04879 return;
04880
04881 }
04882
04883
04884
04885
04886
04887
04888
04889
04890
04891
04892
04893
04894
04895
04896
04897
04898
04899
04900 void cif_optimization_opts_rec(void)
04901 {
04902 char buffer[32];
04903 int num_opts = 0;
04904 char opt_with_lvl[8];
04905 int optz_opts;
04906
04907
04908 TRACE (Func_Entry, "cif_optimization_opts_rec", NULL);
04909
04910 optz_opts = 0;
04911
04912 if (opt_flags.aggress) {
04913 optz_opts = optz_opts | CIF_OOF_AGGRESS;
04914 }
04915
04916 # ifdef _ACCEPT_BL
04917
04918 if (opt_flags.bottom_load) {
04919 optz_opts = optz_opts | CIF_OOF_BLOAD;
04920 }
04921
04922 # endif
04923
04924
04925 # ifdef _ACCEPT_CMD_O_LOOPALIGN
04926
04927 if (opt_flags.loopalign) {
04928 optz_opts = optz_opts | CIF_OOF_LOOPALIGN;
04929 }
04930
04931 # endif
04932
04933
04934 if (opt_flags.over_index) {
04935 optz_opts = optz_opts | CIF_OOF_OVERINDEX;
04936 }
04937
04938
04939 # ifdef _ACCEPT_PATTERN
04940
04941 if (opt_flags.pattern) {
04942 optz_opts = optz_opts | CIF_OOF_PATTERN;
04943 }
04944
04945 # endif
04946
04947
04948 if (opt_flags.recurrence) {
04949 optz_opts = optz_opts | CIF_OOF_RECURRENCE;
04950 }
04951
04952
04953 # ifdef _ACCEPT_VSEARCH
04954
04955 if (opt_flags.vsearch) {
04956 optz_opts = optz_opts | CIF_OOF_VSEARCH;
04957 }
04958
04959 # endif
04960
04961
04962 # ifdef _ACCEPT_CMD_O_ZEROINC
04963
04964 if (opt_flags.zeroinc) {
04965 optz_opts = optz_opts | CIF_OOF_ZEROINC;
04966 }
04967
04968 # endif
04969
04970
04971 if (fprintf(c_i_f, "%d%c%x%c",
04972 CIF_F90_OPT_OPTS, EOI,
04973 optz_opts, EOI) < 0) {
04974 Cif_Error();
04975 }
04976
04977 buffer[0] = NULL_CHAR;
04978
04979
04980 # ifdef _ACCEPT_INLINE
04981
04982 if (opt_flags.inline_lvl > Inline_Lvl_0) {
04983 ++num_opts;
04984 sprintf(opt_with_lvl, "%c%x%c%d",
04985 EOI,
04986 CIF_OOF_INLINE, EOI,
04987 opt_flags.inline_lvl);
04988 strcat(buffer, opt_with_lvl);
04989 }
04990
04991 # endif
04992
04993
04994 ++num_opts;
04995
04996 sprintf(opt_with_lvl, "%c%x%c%d",
04997 EOI,
04998 CIF_OOF_SCALAR, EOI,
04999 opt_flags.scalar_lvl);
05000 strcat(buffer, opt_with_lvl);
05001
05002
05003 # ifdef _ACCEPT_VECTOR
05004
05005 ++num_opts;
05006 sprintf(opt_with_lvl, "%c%x%c%d",
05007 EOI,
05008 CIF_OOF_VECTOR, EOI,
05009 opt_flags.vector_lvl);
05010 strcat(buffer, opt_with_lvl);
05011
05012 # endif
05013
05014
05015 # ifdef _ACCEPT_TASK
05016
05017 ++num_opts;
05018 sprintf(opt_with_lvl, "%c%x%c%d",
05019 EOI,
05020 CIF_OOF_TASK, EOI,
05021 opt_flags.task_lvl);
05022 strcat(buffer, opt_with_lvl);
05023
05024 # endif
05025
05026
05027 if (num_opts == 0) {
05028
05029 if (fprintf(c_i_f, "0%c", EOR) < 0) {
05030 Cif_Error();
05031 }
05032 }
05033 else {
05034
05035 if (fprintf(c_i_f, "%d%s%c", num_opts, buffer, EOR) < 0) {
05036 Cif_Error();
05037 }
05038 }
05039
05040 TRACE (Func_Exit, "cif_optimization_opts_rec", NULL);
05041
05042 return;
05043
05044 }
05045
05046
05047
05048
05049
05050
05051
05052
05053
05054
05055
05056
05057
05058
05059
05060
05061
05062
05063 void cif_begin_scope_rec(void)
05064 {
05065 int blk_idx;
05066 #ifdef KEY
05067 int cif_col_num = 0;
05068 int file_line_num;
05069 int glb_line_num = 0;
05070 int level = 0;
05071 #else
05072 int cif_col_num;
05073 int file_line_num;
05074 int glb_line_num;
05075 int level;
05076 #endif
05077 int local_blk_stk_idx;
05078 int local_file_id;
05079 #ifdef KEY
05080 int parent_scope_id = 0;
05081 int scope_type = 0;
05082 #else
05083 int parent_scope_id;
05084 int scope_type;
05085 #endif
05086 int symbol_id;
05087
05088
05089 TRACE (Func_Entry, "cif_begin_scope_rec", NULL);
05090
05091
05092
05093
05094 if (blk_stk_idx == 0 && BLK_TYPE(1) == Program_Blk) {
05095 local_blk_stk_idx = 1;
05096 }
05097 else {
05098 local_blk_stk_idx = blk_stk_idx;
05099 }
05100
05101 if (BLK_TYPE(local_blk_stk_idx) <= Interface_Body_Blk) {
05102
05103 if (SCP_CIF_ID(curr_scp_idx) == 0) {
05104 SCP_CIF_ID(curr_scp_idx) =
05105 (BLK_TYPE(local_blk_stk_idx) == Program_Blk) ? 1 : NEXT_SCOPE_ID;
05106 }
05107
05108 BLK_CIF_SCOPE_ID(local_blk_stk_idx) = SCP_CIF_ID(curr_scp_idx);
05109 level = SCP_LEVEL(curr_scp_idx);
05110 }
05111
05112 if (BLK_TYPE(local_blk_stk_idx) < Internal_Blk) {
05113
05114 if (cif_pgm_unit_start_line == stmt_start_line) {
05115 glb_line_num = CURR_BLK_DEF_LINE;
05116 cif_col_num = CURR_BLK_DEF_COLUMN;
05117 }
05118 else {
05119
05120
05121
05122
05123
05124 glb_line_num = (cif_pgm_unit_start_line < stmt_start_line) ?
05125 cif_pgm_unit_start_line : stmt_start_line;
05126
05127 cif_col_num = 1;
05128 }
05129 }
05130
05131 switch (BLK_TYPE(local_blk_stk_idx)) {
05132
05133 case Blockdata_Blk:
05134 scope_type = CIF_SCP_BLOCK;
05135 parent_scope_id = 0;
05136 break;
05137
05138 case Module_Blk:
05139 scope_type = CIF_SCP_MOD_SUB;
05140 parent_scope_id = 0;
05141 level = 0;
05142
05143 if (AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) == 0) {
05144 symbol_id = NEXT_SYMBOL_ID;
05145 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) = symbol_id;
05146 }
05147 else {
05148 symbol_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
05149 }
05150
05151 break;
05152
05153 case Program_Blk:
05154 scope_type = CIF_SCP_MAIN;
05155 parent_scope_id = 0;
05156 break;
05157
05158 case Function_Blk:
05159 case Subroutine_Blk:
05160 scope_type = CIF_SCP_EXTERNAL;
05161 parent_scope_id = 0;
05162 break;
05163
05164 case Internal_Blk:
05165 scope_type = CIF_SCP_INTERNAL;
05166 parent_scope_id = BLK_CIF_SCOPE_ID(blk_stk_idx - 1);
05167
05168 if (cif_internal_proc_start_line == stmt_start_line) {
05169 glb_line_num = CURR_BLK_DEF_LINE;
05170 cif_col_num = CURR_BLK_DEF_COLUMN;
05171 }
05172 else {
05173 glb_line_num = cif_internal_proc_start_line + 1;
05174 cif_col_num = 1;
05175 }
05176
05177 break;
05178
05179 case Module_Proc_Blk:
05180 scope_type = CIF_SCP_MODULE;
05181 parent_scope_id = SCP_CIF_ID(SCP_PARENT_IDX(curr_scp_idx));
05182
05183 if (cif_module_proc_start_line == stmt_start_line) {
05184 glb_line_num = CURR_BLK_DEF_LINE;
05185 cif_col_num = CURR_BLK_DEF_COLUMN;
05186 }
05187 else {
05188 glb_line_num = cif_module_proc_start_line + 1;
05189 cif_col_num = 1;
05190 }
05191
05192 break;
05193
05194 case Interface_Body_Blk:
05195 scope_type = CIF_SCP_INTERFACE;
05196 parent_scope_id = BLK_CIF_SCOPE_ID(blk_stk_idx - 1);
05197 glb_line_num = BLK_DEF_LINE(local_blk_stk_idx);
05198 cif_col_num = BLK_DEF_COLUMN(local_blk_stk_idx);
05199 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
05200
05201
05202
05203
05204 level = 1;
05205 blk_idx = blk_stk_idx - 1;
05206
05207 while (BLK_TYPE(blk_idx) > Module_Proc_Blk) {
05208 ++level;
05209 blk_idx--;
05210 }
05211
05212 break;
05213
05214 case Do_Blk:
05215 case If_Blk:
05216 case If_Then_Blk:
05217 case Select_Blk:
05218 case Where_Then_Blk:
05219 case Contains_Blk:
05220 case Derived_Type_Blk:
05221
05222
05223
05224
05225 if ((CURR_BLK == If_Then_Blk &&
05226 BLK_TYPE(blk_stk_idx - 2) == Program_Blk) ||
05227 (CURR_BLK != If_Then_Blk &&
05228 BLK_TYPE(blk_stk_idx - 1) == Program_Blk)) {
05229 scope_type = CIF_SCP_MAIN;
05230 SCP_CIF_ID(curr_scp_idx) = 1;
05231
05232 local_blk_stk_idx = (CURR_BLK == If_Then_Blk) ?
05233 blk_stk_idx - 2 : blk_stk_idx - 1;
05234
05235 BLK_CIF_SCOPE_ID(local_blk_stk_idx) = 1;
05236 parent_scope_id = 0;
05237 level = 0;
05238
05239 if (cif_pgm_unit_start_line == stmt_start_line) {
05240 glb_line_num = BLK_DEF_LINE(local_blk_stk_idx);
05241 cif_col_num = BLK_DEF_COLUMN(local_blk_stk_idx);
05242 }
05243 else {
05244 glb_line_num = cif_pgm_unit_start_line;
05245 cif_col_num = 1;
05246 }
05247 }
05248 # ifdef _DEBUG
05249 else {
05250 PRINTMSG(stmt_start_line, 260, Internal, 0);
05251 }
05252 # endif
05253 break;
05254
05255 # ifdef _DEBUG
05256 case If_Else_If_Blk:
05257 case Case_Blk:
05258 case Where_Else_Blk:
05259 case Where_Else_Mask_Blk:
05260 PRINTMSG(stmt_start_line, 260, Internal, 0);
05261 # endif
05262
05263 case Interface_Blk:
05264 if (BLK_TYPE(blk_stk_idx - 1) == Program_Blk &&
05265 BLK_CIF_SCOPE_ID(blk_stk_idx - 1) == 0) {
05266 scope_type = CIF_SCP_MAIN;
05267 SCP_CIF_ID(curr_scp_idx) = 1;
05268 BLK_CIF_SCOPE_ID(blk_stk_idx - 1) = 1;
05269 parent_scope_id = 0;
05270 level = 0;
05271
05272 if (cif_pgm_unit_start_line == stmt_start_line) {
05273 glb_line_num = BLK_DEF_LINE(blk_stk_idx - 1);
05274 cif_col_num = BLK_DEF_COLUMN(blk_stk_idx - 1);
05275 }
05276 else {
05277 glb_line_num = cif_pgm_unit_start_line;
05278 cif_col_num = 1;
05279 }
05280
05281 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
05282
05283
05284
05285 symbol_id = 2;
05286
05287 if (BLK_NAME(blk_stk_idx - 1) == NULL_IDX) {
05288
05289 if (AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) == 0) {
05290 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) = symbol_id;
05291 }
05292 }
05293 else if (AT_CIF_SYMBOL_ID(BLK_NAME(blk_stk_idx - 1)) == 0) {
05294 AT_CIF_SYMBOL_ID(BLK_NAME(blk_stk_idx - 1)) = symbol_id;
05295 }
05296
05297 if (fprintf(c_i_f, "%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c",
05298 CIF_F90_BEGIN_SCOPE, EOI,
05299 BLK_CIF_SCOPE_ID(blk_stk_idx - 1), EOI,
05300 symbol_id, EOI,
05301 local_file_id, EOI,
05302 file_line_num, EOI,
05303 cif_col_num, EOI,
05304 scope_type, EOI,
05305 level, EOI,
05306 parent_scope_id, EOR) < 0) {
05307 Cif_Error();
05308 }
05309
05310 }
05311
05312 scope_type = CIF_SCP_INT_BLOCK;
05313 local_blk_stk_idx = blk_stk_idx;
05314 BLK_CIF_SCOPE_ID(blk_stk_idx) = NEXT_SCOPE_ID;
05315 parent_scope_id = BLK_CIF_SCOPE_ID(blk_stk_idx - 1);
05316 level = SCP_LEVEL(curr_scp_idx) + 1;
05317 glb_line_num = BLK_DEF_LINE(local_blk_stk_idx);
05318 cif_col_num = BLK_DEF_COLUMN(local_blk_stk_idx);
05319 break;
05320
05321 default:
05322 PRINTMSG(stmt_start_line, 179, Internal, 0, "cif_begin_scope_rec");
05323 }
05324
05325 if (BLK_NAME(local_blk_stk_idx) == NULL_IDX) {
05326
05327 if (BLK_TYPE(local_blk_stk_idx) == Program_Blk ||
05328 BLK_TYPE(local_blk_stk_idx) == Blockdata_Blk) {
05329
05330 if (AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) == 0) {
05331 symbol_id = NEXT_SYMBOL_ID;
05332 AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx)) = symbol_id;
05333 }
05334 else {
05335 symbol_id = AT_CIF_SYMBOL_ID(SCP_ATTR_IDX(curr_scp_idx));
05336 }
05337 }
05338 else {
05339 symbol_id = 0;
05340 }
05341 }
05342 else {
05343 if (AT_CIF_SYMBOL_ID(BLK_NAME(local_blk_stk_idx)) == 0) {
05344 symbol_id = NEXT_SYMBOL_ID;
05345 AT_CIF_SYMBOL_ID(BLK_NAME(local_blk_stk_idx)) = symbol_id;
05346 }
05347 else {
05348 symbol_id = AT_CIF_SYMBOL_ID(BLK_NAME(local_blk_stk_idx));
05349 }
05350
05351 }
05352
05353 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
05354
05355 Cif_F90_Begin_Scope_Rec(c_i_f,
05356 BLK_CIF_SCOPE_ID(local_blk_stk_idx),
05357 symbol_id,
05358 local_file_id,
05359 file_line_num,
05360 cif_col_num,
05361 scope_type,
05362 level,
05363 parent_scope_id);
05364
05365 TRACE (Func_Exit, "cif_begin_scope_rec", NULL);
05366
05367 return;
05368
05369 }
05370
05371
05372
05373
05374
05375
05376
05377
05378
05379
05380
05381
05382
05383
05384
05385
05386
05387
05388 void cif_end_scope_rec(void)
05389 {
05390 int file_line_num;
05391 int local_file_id;
05392
05393
05394 TRACE (Func_Entry, "cif_end_scope_rec", NULL);
05395
05396
05397
05398
05399
05400 file_line_num = get_line_and_file_id(LA_CH_LINE, &local_file_id);
05401
05402 if (cif_pgm_unit_error_recovery) {
05403 BLK_CIF_SCOPE_ID(blk_stk_idx) = 1;
05404 }
05405 else {
05406
05407
05408
05409 if (CURR_BLK <= Interface_Body_Blk) {
05410
05411 if (SCP_CIF_ID(curr_scp_idx) == 0) {
05412 SCP_CIF_ID(curr_scp_idx) =
05413 (CURR_BLK == Program_Blk) ? 1 : NEXT_SCOPE_ID;
05414 }
05415
05416 BLK_CIF_SCOPE_ID(blk_stk_idx) = SCP_CIF_ID(curr_scp_idx);
05417 }
05418 }
05419
05420 Cif_F90_End_Scope_Rec(c_i_f,
05421 BLK_CIF_SCOPE_ID(blk_stk_idx),
05422 local_file_id,
05423 file_line_num,
05424 LA_CH_COLUMN - 1,
05425 CURR_BLK_ERR);
05426
05427 if (CURR_BLK == Internal_Blk) {
05428 cif_internal_proc_start_line = LA_CH_LINE;
05429 }
05430 else if (CURR_BLK == Module_Proc_Blk) {
05431 cif_module_proc_start_line = LA_CH_LINE;
05432 }
05433
05434 TRACE (Func_Exit, "cif_end_scope_rec", NULL);
05435
05436 return;
05437
05438 }
05439
05440
05441
05442
05443
05444
05445
05446
05447
05448
05449
05450
05451
05452
05453
05454
05455
05456
05457 void cif_scope_info_rec(void)
05458 {
05459 int al_idx;
05460 int attributes;
05461 char buffer[160];
05462 int str_len;
05463 char string[10];
05464
05465
05466 TRACE (Func_Entry, "cif_scope_info_rec", NULL);
05467
05468 attributes = (SCP_IMPL_NONE(curr_scp_idx)) ? CIF_SCP_IMPL_NONE : 0;
05469
05470 if (SCP_DOES_IO(curr_scp_idx)) {
05471 attributes = attributes | CIF_SCP_DOES_IO;
05472 }
05473
05474 if (SCP_HAS_CALLS(curr_scp_idx)) {
05475 attributes = attributes | CIF_SCP_HAS_CALLS;
05476 }
05477
05478 if (SCP_ALT_ENTRY_CNT(curr_scp_idx) == 0) {
05479 buffer[0] = EOR;
05480 buffer[1] = NULL_CHAR;
05481 }
05482 else {
05483 buffer[0] = NULL_CHAR;
05484 al_idx = SCP_ENTRY_IDX(curr_scp_idx);
05485
05486 do {
05487 sprintf(string, "%c%d",
05488 EOI, AT_CIF_SYMBOL_ID(AL_ATTR_IDX(al_idx)));
05489 strcat(buffer, string);
05490 al_idx = AL_NEXT_IDX(al_idx);
05491 }
05492 while (al_idx != NULL_IDX);
05493
05494 str_len = strlen(buffer);
05495 buffer[str_len] = EOR;
05496 buffer[str_len + 1] = NULL_CHAR;
05497 }
05498
05499 if (fprintf(c_i_f, "%d%c%d%c%x%c%d%s",
05500 CIF_F90_SCOPE_INFO, EOI,
05501 SCP_CIF_ID(curr_scp_idx), EOI,
05502 attributes, EOI,
05503 SCP_ALT_ENTRY_CNT(curr_scp_idx),
05504 buffer) < 0) {
05505 Cif_Error();
05506 }
05507
05508 TRACE (Func_Exit, "cif_scope_info_rec", NULL);
05509
05510 return;
05511
05512 }
05513
05514
05515
05516
05517
05518
05519
05520
05521
05522
05523
05524
05525
05526
05527
05528
05529
05530
05531 void cif_use_module_rec(int attr_idx,
05532 int mf_tbl_idx,
05533 boolean send_attr)
05534 {
05535 int cif_file_id;
05536 int flag;
05537
05538
05539 TRACE (Func_Entry, "cif_use_module_rec", NULL);
05540
05541 if (mf_tbl_idx == NULL_IDX) {
05542
05543
05544
05545
05546
05547
05548 if (send_attr) {
05549 cif_send_attr(attr_idx, NULL_IDX);
05550 }
05551 else if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
05552 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
05553 }
05554
05555 cif_file_id = cif_file_name_rec(ATP_MOD_PATH_NAME_PTR(attr_idx),
05556 (char *) NULL);
05557 flag = CIF_USE_MODULE_INDIRECT;
05558 }
05559 else {
05560
05561 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
05562 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
05563 }
05564
05565 if (FP_CIF_ID(mf_tbl_idx) == 0) {
05566 FP_CIF_ID(mf_tbl_idx) = cif_file_name_rec(FP_NAME_PTR(mf_tbl_idx),
05567 (char *) NULL);
05568 }
05569
05570 cif_file_id = FP_CIF_ID(mf_tbl_idx);
05571 flag = CIF_USE_MODULE_DIRECT;
05572 }
05573
05574 Cif_F90_Use_Module_Rec(c_i_f,
05575 AT_CIF_SYMBOL_ID(attr_idx),
05576 cif_file_id,
05577 flag);
05578
05579 TRACE (Func_Exit, "cif_use_module_rec", NULL);
05580
05581 return;
05582
05583 }
05584
05585
05586
05587
05588
05589
05590
05591
05592
05593
05594
05595
05596
05597
05598
05599
05600
05601
05602
05603
05604
05605
05606 int cif_rename_rec(int ro_idx,
05607 int cif_symbol_id,
05608 int attr_idx,
05609 int module_attr_idx)
05610 {
05611
05612 TRACE (Func_Entry, "cif_rename_rec", NULL);
05613
05614
05615
05616
05617
05618 if (cif_symbol_id == 0) {
05619 cif_symbol_id = NEXT_SYMBOL_ID;
05620 }
05621
05622 if (AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) == 0) {
05623 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)) = NEXT_SYMBOL_ID;
05624 }
05625
05626 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
05627 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
05628 }
05629
05630
05631
05632
05633
05634 Cif_F90_Rename_Rec(c_i_f,
05635 SCP_CIF_ID(curr_scp_idx),
05636 RO_NAME_PTR(ro_idx),
05637 cif_symbol_id,
05638 AT_CIF_SYMBOL_ID(module_attr_idx),
05639 AT_ORIG_NAME_PTR(attr_idx),
05640 AT_CIF_SYMBOL_ID(AT_MODULE_IDX(attr_idx)),
05641 (long) AT_CIF_SYMBOL_ID(attr_idx));
05642
05643 TRACE (Func_Exit, "cif_rename_rec", NULL);
05644
05645 return(cif_symbol_id);
05646
05647 }
05648
05649
05650
05651
05652
05653
05654
05655
05656
05657
05658
05659
05660
05661
05662
05663
05664
05665
05666
05667
05668
05669
05670
05671 void cif_fake_a_unit()
05672 {
05673 int file_line_num;
05674 int glb_line_num;
05675 int local_file_id;
05676 int scope_id;
05677 int symbol_id;
05678
05679
05680 TRACE (Func_Entry, "cif_fake_a_unit", NULL);
05681
05682 stmt_start_line = 1;
05683
05684 cif_unit_rec();
05685
05686 cif_symbol_or_scope_id = 3;
05687
05688 symbol_id = NEXT_SYMBOL_ID;
05689 scope_id = NEXT_SCOPE_ID;
05690
05691
05692
05693
05694
05695 glb_line_num = cif_pgm_unit_start_line;
05696 file_line_num = get_line_and_file_id(glb_line_num, &local_file_id);
05697
05698 if (cif_flags & BASIC_RECS) {
05699
05700 Cif_F90_Begin_Scope_Rec(c_i_f,
05701 scope_id,
05702 symbol_id,
05703 local_file_id,
05704 file_line_num,
05705 1,
05706 CIF_SCP_MAIN,
05707 0,
05708 0);
05709
05710
05711
05712 Cif_F90_Entry_Rec(c_i_f,
05713 UNNAMED_PROGRAM_NAME,
05714 symbol_id,
05715 scope_id,
05716 0,
05717 0,
05718 0,
05719 0,
05720 0,
05721 0,
05722 NULL);
05723
05724
05725
05726
05727
05728 file_line_num = get_line_and_file_id(curr_glb_line - 1, &local_file_id);
05729
05730 Cif_F90_End_Scope_Rec(c_i_f,
05731 scope_id,
05732 local_file_id,
05733 file_line_num,
05734 stmt_start_col,
05735 1);
05736 }
05737
05738
05739
05740 stmt_start_line = (curr_glb_line > 1) ? curr_glb_line - 1 : 1;
05741 stmt_start_col = 1;
05742 cif_end_unit_rec(UNNAMED_PROGRAM_NAME);
05743
05744 TRACE (Func_Exit, "cif_fake_a_unit", NULL);
05745
05746 return;
05747
05748 }
05749
05750
05751
05752
05753
05754
05755
05756
05757
05758
05759
05760
05761
05762
05763
05764
05765
05766
05767
05768 void Cif_Error()
05769 {
05770
05771 TRACE (Func_Entry, "Cif_Error", NULL);
05772
05773 PRINTMSG((curr_stmt_sh_idx > 0) ? SH_GLB_LINE(curr_stmt_sh_idx) : 1,
05774 383, Error, 0);
05775
05776 exit_compiler(RC_USER_ERROR);
05777
05778 TRACE (Func_Exit, "Cif_Error", NULL);
05779
05780 }
05781
05782
05783
05784
05785
05786
05787
05788
05789
05790
05791
05792
05793
05794
05795
05796
05797
05798
05799
05800
05801
05802
05803
05804
05805
05806 static int get_line_and_file_id (int search_line,
05807 int *file_id)
05808 {
05809 int idx;
05810 int actual_line;
05811
05812
05813 TRACE (Func_Entry, "get_line_and_file_id", NULL);
05814
05815 GLOBAL_LINE_TO_FILE_LINE(search_line, idx, actual_line);
05816
05817 *file_id = GL_CIF_FILE_ID(idx);
05818
05819 TRACE (Func_Exit, "get_line_and_file_id", NULL);
05820
05821 return(actual_line);
05822
05823 }
05824
05825
05826
05827
05828
05829
05830
05831
05832
05833
05834
05835
05836
05837
05838
05839
05840
05841
05842
05843
05844
05845
05846
05847 static boolean output_struct_ids(opnd_type *opnd)
05848
05849 {
05850 opnd_type loc_opnd;
05851 boolean ok = TRUE;
05852
05853 TRACE (Func_Entry, "output_struct_ids", NULL);
05854
05855 if (OPND_FLD((*opnd)) == IR_Tbl_Idx) {
05856
05857 if (IR_OPR(OPND_IDX((*opnd))) == Struct_Opr) {
05858 COPY_OPND(loc_opnd, IR_OPND_L(OPND_IDX((*opnd))));
05859 ok = output_struct_ids(&loc_opnd);
05860
05861 if (ok) {
05862 COPY_OPND(loc_opnd, IR_OPND_R(OPND_IDX((*opnd))));
05863 ok = output_struct_ids(&loc_opnd);
05864 }
05865 }
05866 else {
05867 COPY_OPND(loc_opnd, IR_OPND_L(OPND_IDX((*opnd))));
05868 ok = output_struct_ids(&loc_opnd);
05869 }
05870 }
05871 else if (OPND_FLD((*opnd)) == AT_Tbl_Idx) {
05872
05873 if (skip_struct_base &&
05874 ATD_CLASS(OPND_IDX((*opnd))) != Struct_Component) {
05875
05876
05877 }
05878 else if (cif_number_of_struct_ids >= 0) {
05879 cif_number_of_struct_ids++;
05880 }
05881 else {
05882 if (AT_CIF_SYMBOL_ID(OPND_IDX((*opnd))) == 0) {
05883 AT_CIF_SYMBOL_ID(OPND_IDX((*opnd))) = NEXT_SYMBOL_ID;
05884 }
05885
05886 ok = fprintf(c_i_f, "%c%d", EOI,
05887 AT_CIF_SYMBOL_ID(OPND_IDX((*opnd)))) >= 0;
05888 }
05889 }
05890
05891 TRACE (Func_Exit, "output_struct_ids", NULL);
05892
05893 return(ok);
05894
05895 }
05896
05897
05898
05899
05900
05901
05902
05903
05904
05905
05906
05907
05908
05909
05910
05911
05912
05913
05914
05915
05916
05917
05918 static void output_minimal_object_rec(int attr_idx)
05919
05920 {
05921 char char_len[1];
05922
05923
05924 TRACE (Func_Entry, "output_minimal_object_rec", NULL);
05925
05926 char_len[0] = NULL_CHAR;
05927
05928 if (AT_CIF_SYMBOL_ID(attr_idx) == 0) {
05929 AT_CIF_SYMBOL_ID(attr_idx) = NEXT_SYMBOL_ID;
05930 }
05931
05932 if (fprintf(c_i_f,
05933 "%d%c%s%c%d%c%d%c%d%c%d%c%d%c%d%c%d%c%x%c%d%c%s%c%d%c%d%c%d%c%d%c%d%c",
05934 CIF_F90_OBJECT, EOI,
05935 AT_OBJ_NAME_PTR(attr_idx), EOI,
05936 AT_CIF_SYMBOL_ID(attr_idx), EOI,
05937 SCP_CIF_ID(curr_scp_idx), EOI,
05938 0, EOI,
05939 0, EOI,
05940 0, EOI,
05941 0, EOI,
05942 -1, EOI,
05943 0, EOI,
05944 0, EOI,
05945 char_len, EOI,
05946 0, EOI,
05947 0, EOI,
05948 0, EOI,
05949 0, EOI,
05950 0, EOR) < 0) {
05951 Cif_Error();
05952 }
05953
05954 TRACE (Func_Exit, "output_minimal_object_rec", NULL);
05955
05956 return;
05957
05958 }
05959
05960
05961
05962
05963
05964
05965
05966
05967
05968
05969
05970
05971
05972
05973
05974
05975
05976
05977
05978
05979
05980
05981
05982
05983
05984
05985
05986
05987
05988
05989
05990
05991
05992
05993
05994
05995
05996
05997
05998
05999
06000
06001
06002
06003
06004
06005
06006
06007
06008
06009
06010
06011
06012
06013
06014
06015
06016
06017
06018
06019
06020
06021
06022
06023
06024
06025
06026
06027
06028
06029
06030
06031
06032
06033
06034
06035
06036
06037
06038
06039
06040
06041
06042
06043 static void cif_flush_include_recs(void)
06044
06045 {
06046
06047 # define FILE_ID_LIST_SIZE 1000
06048
06049 FILE *aux_file;
06050 char aux_file_name[MAX_FILE_NAME_SIZE];
06051 char buf[9];
06052 int end_stmt_line;
06053 int file_id;
06054 int file_id_list[FILE_ID_LIST_SIZE];
06055 int file_id_list_idx = 0;
06056 boolean first_record = TRUE;
06057 char generic_rec[512];
06058 int gr_idx;
06059 boolean have_file_name_rec = FALSE;
06060 boolean have_rec = FALSE;
06061 char holding_pen[512];
06062 int i;
06063 int line_num;
06064 int rec_type;
06065 char rec_type_str[3];
06066
06067
06068 TRACE (Func_Entry, "cif_flush_include_recs", NULL);
06069
06070 fprintf(cif_tmp_file, "%d\n", EOF);
06071 rewind(cif_tmp_file);
06072
06073 end_stmt_line = global_to_local_line_number(stmt_start_line);
06074 file_id_list[0] = GL_CIF_FILE_ID(1);
06075
06076 while (fgets(generic_rec, 512, cif_tmp_file) != NULL &&
06077 atoi(generic_rec) != EOF) {
06078
06079 # ifdef _DEBUG
06080 if (file_id_list_idx >= FILE_ID_LIST_SIZE - 1) {
06081 PRINTMSG(stmt_start_line, 1406, Internal, 1);
06082 }
06083 # endif
06084
06085 rec_type_str[0] = generic_rec[0];
06086
06087 if (generic_rec[1] == EOI) {
06088 rec_type_str[1] = NULL_CHAR;
06089 }
06090 else {
06091 rec_type_str[1] = generic_rec[1];
06092 rec_type_str[2] = NULL_CHAR;
06093 }
06094
06095 rec_type = atoi(rec_type_str);
06096
06097 switch (rec_type) {
06098
06099 case CIF_FILE:
06100 strcpy(holding_pen, generic_rec);
06101 have_file_name_rec = TRUE;
06102 break;
06103
06104
06105 case CIF_INCLUDE:
06106
06107
06108
06109
06110
06111
06112
06113 buf[0] = generic_rec[2];
06114 gr_idx = 3;
06115 i = 1;
06116
06117 while (generic_rec[gr_idx] != EOI) {
06118 buf[i++] = generic_rec[gr_idx++];
06119 }
06120
06121 buf[i] = NULL_CHAR;
06122 file_id = atoi(buf);
06123
06124 for (i = file_id_list_idx; i >= 0; i--) {
06125
06126 if (file_id == file_id_list[i]) {
06127 break;
06128 }
06129 }
06130
06131 if (i < 0) {
06132
06133
06134
06135
06136
06137
06138
06139
06140
06141
06142
06143 if (first_record) {
06144 file_id_list[++file_id_list_idx] = file_id;
06145 first_record = FALSE;
06146 }
06147 else {
06148 have_rec = TRUE;
06149 goto RECORDS_FOR_NEXT_UNIT;
06150 }
06151 }
06152 else if (i == 0) {
06153
06154
06155
06156
06157
06158
06159
06160
06161
06162
06163
06164 ++gr_idx;
06165 buf[0] = generic_rec[gr_idx++];
06166 i = 1;
06167
06168 while (generic_rec[gr_idx] != EOI) {
06169 buf[i++] = generic_rec[gr_idx++];
06170 }
06171
06172 buf[i] = NULL_CHAR;
06173 line_num = atoi(buf);
06174
06175 if (line_num > end_stmt_line) {
06176 have_rec = TRUE;
06177 goto RECORDS_FOR_NEXT_UNIT;
06178 }
06179 }
06180
06181 if (have_file_name_rec) {
06182 fputs(holding_pen, cif_actual_file);
06183 have_file_name_rec = FALSE;
06184 }
06185
06186 fputs(generic_rec, cif_actual_file);
06187
06188
06189
06190
06191
06192
06193 if (fgets(generic_rec, 512, cif_tmp_file) != NULL &&
06194 atoi(generic_rec) != EOF) {
06195 rec_type_str[0] = generic_rec[0];
06196
06197 if (generic_rec[1] != EOI) {
06198 rec_type_str[1] = generic_rec[1];
06199 rec_type_str[2] = NULL_CHAR;
06200 }
06201 else {
06202 PRINTMSG(end_stmt_line, 1148, Internal, 0);
06203 }
06204
06205 rec_type = atoi(rec_type_str);
06206
06207 if (rec_type == CIF_SRC_POS) {
06208 fputs(generic_rec, cif_actual_file);
06209 }
06210 else {
06211 PRINTMSG(end_stmt_line, 1148, Internal, 0);
06212 }
06213
06214
06215
06216
06217
06218
06219 gr_idx = 3;
06220
06221 while (generic_rec[gr_idx++] != EOI) {
06222 }
06223
06224 buf[0] = generic_rec[gr_idx++];
06225 i = 1;
06226
06227 while (generic_rec[gr_idx] != EOI) {
06228 buf[i++] = generic_rec[gr_idx++];
06229 }
06230
06231 buf[i] = NULL_CHAR;
06232 file_id = atoi(buf);
06233
06234 for (i = file_id_list_idx; i > 0; --i) {
06235
06236 if (file_id == file_id_list[i]) {
06237 break;
06238 }
06239 }
06240
06241 if (i > 0) {
06242 file_id_list_idx = i;
06243 }
06244 else {
06245 file_id_list[++file_id_list_idx] = file_id;
06246 }
06247 }
06248 else {
06249 PRINTMSG(end_stmt_line, 1148, Internal, 0);
06250 }
06251
06252 break;
06253
06254
06255 case CIF_MESSAGE:
06256
06257
06258
06259
06260
06261
06262
06263
06264
06265 gr_idx = 3;
06266
06267 while (generic_rec[gr_idx++] != EOI) {
06268 }
06269
06270 ++gr_idx;
06271
06272 while (generic_rec[gr_idx++] != EOI) {
06273 }
06274
06275 buf[0] = generic_rec[gr_idx++];
06276 i = 1;
06277
06278 while (generic_rec[gr_idx] != EOI) {
06279 buf[i++] = generic_rec[gr_idx++];
06280 }
06281
06282 buf[i] = NULL_CHAR;
06283 file_id = atoi(buf);
06284
06285 for (i = file_id_list_idx; i >= 0; i--) {
06286
06287 if (file_id == file_id_list[i]) {
06288 break;
06289 }
06290 }
06291
06292 if (i < 0) {
06293 have_rec = TRUE;
06294 goto RECORDS_FOR_NEXT_UNIT;
06295 }
06296 else if (i > 0) {
06297
06298
06299
06300
06301
06302 fputs(generic_rec, cif_actual_file);
06303 break;
06304 }
06305
06306
06307
06308
06309
06310
06311
06312
06313 ++gr_idx;
06314 buf[0] = generic_rec[gr_idx++];
06315 i = 1;
06316
06317 while (generic_rec[gr_idx] != EOI) {
06318 buf[i++] = generic_rec[gr_idx++];
06319 }
06320
06321 buf[i] = NULL_CHAR;
06322 line_num = atoi(buf);
06323
06324 if (line_num <= end_stmt_line) {
06325 fputs(generic_rec, cif_actual_file);
06326 }
06327 else {
06328 have_rec = TRUE;
06329 goto RECORDS_FOR_NEXT_UNIT;
06330 }
06331
06332 break;
06333
06334
06335 case CIF_STMT_TYPE:
06336
06337
06338
06339
06340
06341
06342
06343
06344 gr_idx = 3;
06345
06346 while (generic_rec[gr_idx++] != EOI) {
06347 }
06348
06349 buf[0] = generic_rec[gr_idx++];
06350 i = 1;
06351
06352 while (generic_rec[gr_idx] != EOI) {
06353 buf[i++] = generic_rec[gr_idx++];
06354 }
06355
06356 buf[i] = NULL_CHAR;
06357 file_id = atoi(buf);
06358
06359 for (i = file_id_list_idx; i >= 0; i--) {
06360
06361 if (file_id == file_id_list[i]) {
06362 break;
06363 }
06364 }
06365
06366 if (i < 0) {
06367
06368
06369
06370
06371
06372
06373
06374
06375
06376
06377
06378 if (first_record) {
06379 file_id_list[++file_id_list_idx] = file_id;
06380 first_record = FALSE;
06381 }
06382 else {
06383 have_rec = TRUE;
06384 goto RECORDS_FOR_NEXT_UNIT;
06385 }
06386 }
06387 else if (i > 0) {
06388
06389
06390
06391
06392
06393 fputs(generic_rec, cif_actual_file);
06394 break;
06395 }
06396
06397
06398
06399
06400
06401
06402
06403
06404 ++gr_idx;
06405 buf[0] = generic_rec[gr_idx++];
06406 i = 1;
06407
06408 while (generic_rec[gr_idx] != EOI) {
06409 buf[i++] = generic_rec[gr_idx++];
06410 }
06411
06412 buf[i] = NULL_CHAR;
06413 line_num = atoi(buf);
06414
06415 if (line_num < end_stmt_line) {
06416 fputs(generic_rec, cif_actual_file);
06417 }
06418 else {
06419 have_rec = TRUE;
06420 goto RECORDS_FOR_NEXT_UNIT;
06421 }
06422
06423 break;
06424
06425
06426 default:
06427 PRINTMSG(end_stmt_line, 179, Internal, 0, "cif_flush_include_recs");
06428 }
06429 }
06430
06431 RECORDS_FOR_NEXT_UNIT:
06432
06433 if (have_rec || have_file_name_rec) {
06434
06435 if (! get_temp_file("w+", &aux_file, aux_file_name)) {
06436 PRINTMSG(stmt_start_line, 382, Log_Error, 0, "<aux CIF>");
06437 perror("Reason");
06438 goto EXIT;
06439 }
06440
06441 if (have_file_name_rec) {
06442 fputs(holding_pen, aux_file);
06443 }
06444
06445 if (have_rec) {
06446 fputs(generic_rec, aux_file);
06447 }
06448
06449 while (fgets(generic_rec, 512, cif_tmp_file) != NULL &&
06450 atoi(generic_rec) != EOF) {
06451 fputs(generic_rec, aux_file);
06452 }
06453
06454 fprintf(aux_file, "%d\n", EOF);
06455 rewind(aux_file);
06456 rewind(cif_tmp_file);
06457
06458 while (fgets(generic_rec, 512, aux_file) != NULL &&
06459 atoi(generic_rec) != EOF) {
06460 fputs(generic_rec, cif_tmp_file);
06461 }
06462
06463 fclose(aux_file);
06464 remove(aux_file_name);
06465 }
06466 else {
06467
06468
06469
06470
06471 rewind(cif_tmp_file);
06472 }
06473
06474 EXIT:
06475
06476 TRACE (Func_Entry, "cif_flush_include_recs", NULL);
06477
06478 return;
06479
06480 }
06481
06482
06483
06484
06485
06486
06487
06488
06489
06490
06491
06492
06493
06494
06495
06496
06497
06498
06499
06500
06501
06502 void close_cif()
06503 {
06504
06505 TRACE (Func_Entry, "close_cif", NULL);
06506
06507 fflush(c_i_f);
06508 if (c_i_f == cif_actual_file) {
06509
06510 cif_actual_file = NULL;
06511 }
06512 fclose(c_i_f);
06513 fclose(cif_tmp_file);
06514 remove(cif_tmp_file_name);
06515
06516 TRACE (Func_Exit, "close_cif", NULL);
06517
06518 }
06519
06520
06521
06522
06523
06524
06525
06526
06527
06528
06529
06530
06531
06532
06533
06534
06535
06536
06537
06538
06539
06540
06541
06542
06543
06544
06545 static int cif_data_type(int data_type)
06546 {
06547 #ifdef KEY
06548 int cif_value = 0;
06549 #else
06550 int cif_value;
06551 #endif
06552
06553
06554 TRACE (Func_Entry, "cif_data_type", NULL);
06555
06556 if (data_type > 100) {
06557 TRACE (Func_Exit, "cif_data_type", NULL);
06558 return(data_type);
06559 }
06560
06561
06562 switch (data_type) {
06563
06564 case Err_Res:
06565 cif_value = CIF_F90_DT_UNKNOWN;
06566 break;
06567
06568 case Short_Char_Const:
06569 cif_value = CIF_F90_DT_CHARACTER_1;
06570 break;
06571
06572 case Short_Typeless_Const:
06573 case Typeless_4:
06574 case Typeless_8:
06575 case Long_Typeless:
06576
06577
06578
06579 cif_value = CIF_F90_DT_TYPELESS;
06580 break;
06581
06582 case Integer_1:
06583 cif_value = CIF_F90_DT_INTEGER_1;
06584 break;
06585
06586 case Integer_2:
06587 cif_value = CIF_F90_DT_INTEGER_2;
06588 break;
06589
06590 case Integer_4:
06591 cif_value = CIF_F90_DT_INTEGER_4;
06592 break;
06593
06594 case Integer_8:
06595 cif_value = CIF_F90_DT_INTEGER_8;
06596 break;
06597
06598 case Real_4:
06599 cif_value = CIF_F90_DT_REAL_4;
06600 break;
06601
06602 case Real_8:
06603 cif_value = CIF_F90_DT_REAL_8;
06604 break;
06605
06606 case Real_16:
06607 cif_value = CIF_F90_DT_REAL_16;
06608 break;
06609
06610 case Complex_4:
06611 cif_value = CIF_F90_DT_COMPLEX_4;
06612 break;
06613
06614 case Complex_8:
06615 cif_value = CIF_F90_DT_COMPLEX_8;
06616 break;
06617
06618 case Complex_16:
06619 cif_value = CIF_F90_DT_COMPLEX_16;
06620 break;
06621
06622 case CRI_Ptr_8:
06623 cif_value = CIF_F90_DT_FPTR;
06624 break;
06625
06626 case Logical_1:
06627 cif_value = CIF_F90_DT_LOGICAL_1;
06628 break;
06629
06630 case Logical_2:
06631 cif_value = CIF_F90_DT_LOGICAL_2;
06632 break;
06633
06634 case Logical_4:
06635 cif_value = CIF_F90_DT_LOGICAL_4;
06636 break;
06637
06638 case Logical_8:
06639 cif_value = CIF_F90_DT_LOGICAL_8;
06640 break;
06641
06642 case Character_1:
06643 cif_value = CIF_F90_DT_CHARACTER_1;
06644 break;
06645
06646 case Character_2:
06647 cif_value = CIF_F90_DT_CHARACTER_2;
06648 break;
06649
06650 case Character_4:
06651 cif_value = CIF_F90_DT_CHARACTER_4;
06652 break;
06653
06654 case CRI_Ch_Ptr_8:
06655 cif_value = CIF_F90_DT_FCPTR;
06656 break;
06657
06658 case Structure_Type:
06659
06660
06661
06662 PRINTMSG(stmt_start_line, 179, Internal, 0,
06663 "cif_data_type (Structure_Type)");
06664 break;
06665
06666 case CRI_Parcel_Ptr_8:
06667
06668
06669
06670
06671 PRINTMSG(stmt_start_line, 179, Internal, 0,
06672 "cif_data_type (parcel ptr)");
06673 }
06674
06675 TRACE (Func_Exit, "cif_data_type", NULL);
06676
06677 return(cif_value);
06678
06679 }
06680
06681
06682
06683
06684
06685
06686
06687
06688
06689
06690
06691
06692
06693
06694
06695
06696
06697
06698
06699
06700
06701 void cif_object_rec_for_func_result(int attr_idx)
06702
06703 {
06704 int rslt_idx;
06705 boolean save_cif_done;
06706 boolean save_cif_done1;
06707 int save_reference;
06708
06709
06710 TRACE (Func_Entry, "cif_object_rec_for_func_result", NULL);
06711
06712
06713
06714
06715
06716
06717
06718
06719
06720
06721
06722
06723
06724
06725
06726
06727
06728
06729
06730
06731
06732
06733 rslt_idx = ATP_RSLT_IDX(attr_idx);
06734 save_cif_done = AT_CIF_DONE(rslt_idx);
06735 save_cif_done1 = AT_CIF_DONE(attr_idx);
06736 save_reference = AT_REFERENCED(attr_idx);
06737 AT_REFERENCED(attr_idx) = Referenced;
06738 AT_CIF_DONE(rslt_idx) = FALSE;
06739 AT_CIF_DONE(attr_idx) = FALSE;
06740 cif_send_attr(attr_idx, NULL_IDX);
06741 cif_send_attr(rslt_idx, NULL_IDX);
06742 AT_CIF_DONE(rslt_idx) = save_cif_done;
06743 AT_CIF_DONE(attr_idx) = save_cif_done1;
06744 AT_REFERENCED(attr_idx) = save_reference;
06745
06746 TRACE (Func_Exit, "cif_object_rec_for_func_result", NULL);
06747
06748 return;
06749
06750 }
06751
06752
06753
06754
06755
06756
06757
06758
06759
06760
06761
06762
06763
06764
06765
06766
06767 static void process_attr_list(int al_idx,
06768 boolean error_list)
06769 {
06770 int attr_idx;
06771
06772
06773 TRACE (Func_Entry, "process_attr_list", NULL);
06774
06775
06776
06777
06778
06779
06780
06781
06782
06783
06784
06785
06786
06787
06788
06789
06790 while (al_idx != NULL_IDX) {
06791 attr_idx = AL_ATTR_IDX(al_idx);
06792
06793 if (!error_list &&
06794 AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
06795 AT_CIF_SYMBOL_ID(attr_idx) != 0) {
06796
06797
06798
06799 }
06800 else if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
06801 ATD_CLASS(attr_idx) == Compiler_Tmp &&
06802 ATD_TMP_NEEDS_CIF(attr_idx)) {
06803
06804
06805
06806
06807
06808 cif_send_attr(attr_idx, NULL_IDX);
06809 }
06810 else if (! AT_COMPILER_GEND(attr_idx)) {
06811 cif_send_attr(attr_idx, NULL_IDX);
06812 }
06813
06814 al_idx = AL_NEXT_IDX(al_idx);
06815 }
06816
06817 TRACE (Func_Exit, "process_attr_list", NULL);
06818
06819 return;
06820
06821 }