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
00042
00043
00044
00045 static char USMID[] = "\n@(#)5.0_pl/sources/p_dcl_util.c 5.7 10/28/99 10:03:56\n";
00046
00047 # include "defines.h"
00048
00049 # include "host.m"
00050 # include "host.h"
00051 # include "target.m"
00052 # include "target.h"
00053
00054 # include "globals.m"
00055 # include "tokens.m"
00056 # include "sytb.m"
00057 # include "p_globals.m"
00058 # include "debug.m"
00059
00060 # include "globals.h"
00061 # include "tokens.h"
00062 # include "sytb.h"
00063 # include "p_globals.h"
00064
00065
00066
00067
00068
00069 static int ntr_bnds_tmp_list(opnd_type *);
00070 #ifndef KEY
00071 static boolean parse_int_spec_expr(long *, fld_type *, boolean, boolean);
00072 #endif
00073 static void parse_kind_selector(void);
00074 static boolean is_attr_referenced_in_bound(int, int);
00075
00076
00077 static boolean kind0seen;
00078 static boolean kind0E0seen;
00079 static boolean kind0D0seen;
00080 static boolean kindconstseen;
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 int parse_array_spec(int attr_idx)
00106
00107 {
00108 int bd_idx;
00109 int column;
00110 boolean fold_it;
00111 boolean found_end = FALSE;
00112 boolean found_error = FALSE;
00113 fld_type lb_fld;
00114 long lb_len_idx;
00115 int line;
00116 boolean lower_bound_found;
00117 boolean non_constant_size = FALSE;
00118 boolean possible_assumed_shape = FALSE;
00119 int rank = 1;
00120 reference_type referenced;
00121 fld_type ub_fld;
00122 long ub_len_idx;
00123
00124
00125 TRACE (Func_Entry, "parse_array_spec", NULL);
00126
00127 # ifdef _DEBUG
00128 if (LA_CH_VALUE != LPAREN) {
00129 PRINTMSG(LA_CH_LINE, 295, Internal, LA_CH_COLUMN,
00130 "parse_array_spec", "LPAREN");
00131 }
00132 # endif
00133
00134 NEXT_LA_CH;
00135 bd_idx = reserve_array_ntry(7);
00136 referenced = (reference_type) AT_REFERENCED(attr_idx);
00137 AT_REFERENCED(attr_idx) = Not_Referenced;
00138 BD_LINE_NUM(bd_idx) = LA_CH_LINE;
00139 BD_COLUMN_NUM(bd_idx) = LA_CH_COLUMN;
00140
00141
00142
00143
00144 if (LA_CH_VALUE == RPAREN) {
00145 parse_err_flush(Find_None, "dimension-spec");
00146 BD_ARRAY_CLASS(bd_idx) = Explicit_Shape;
00147 BD_ARRAY_SIZE(bd_idx) = Constant_Size;
00148 BD_DCL_ERR(bd_idx) = TRUE;
00149 BD_RANK(bd_idx) = 1;
00150 BD_LB_FLD(bd_idx, 1) = CN_Tbl_Idx;
00151 BD_LB_IDX(bd_idx, 1) = CN_INTEGER_ONE_IDX;
00152 BD_UB_FLD(bd_idx, 1) = CN_Tbl_Idx;
00153 BD_UB_IDX(bd_idx, 1) = CN_INTEGER_ONE_IDX;
00154 NEXT_LA_CH;
00155 goto EXIT;
00156 }
00157
00158
00159
00160
00161 fold_it = (CURR_BLK == Derived_Type_Blk);
00162
00163 do {
00164 lower_bound_found = FALSE;
00165 lb_len_idx = CN_INTEGER_ONE_IDX;
00166 lb_fld = CN_Tbl_Idx;
00167 ub_len_idx = NULL_IDX;
00168 ub_fld = NO_Tbl_Idx;
00169
00170 if (LA_CH_VALUE != COLON && LA_CH_VALUE != STAR) {
00171 line = LA_CH_LINE;
00172 column = LA_CH_COLUMN;
00173
00174
00175
00176
00177
00178 if (!parse_int_spec_expr(&ub_len_idx, &ub_fld, fold_it, FALSE)) {
00179 ub_len_idx = CN_INTEGER_ONE_IDX;
00180 ub_fld = CN_Tbl_Idx;
00181 BD_DCL_ERR(bd_idx) = TRUE;
00182 }
00183
00184 if (ub_fld != CN_Tbl_Idx) {
00185 non_constant_size = TRUE;
00186 }
00187
00188 if (LA_CH_VALUE == COLON) {
00189 lower_bound_found = TRUE;
00190 possible_assumed_shape = TRUE;
00191 lb_len_idx = ub_len_idx;
00192 lb_fld = ub_fld;
00193 ub_len_idx = NULL_IDX;
00194 ub_fld = NO_Tbl_Idx;
00195 }
00196
00197
00198
00199
00200
00201
00202 else if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
00203
00204
00205
00206 ub_len_idx = NULL_IDX;
00207 ub_fld = NO_Tbl_Idx;
00208 BD_DCL_ERR(bd_idx) = TRUE;
00209 PRINTMSG(line, 114, Error, column);
00210 }
00211 else {
00212 BD_ARRAY_CLASS(bd_idx) = Explicit_Shape;
00213 }
00214 }
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 if (LA_CH_VALUE == COLON) {
00226 line = LA_CH_LINE;
00227 column = LA_CH_COLUMN;
00228 NEXT_LA_CH;
00229
00230 if (LA_CH_VALUE == COMMA || LA_CH_VALUE == RPAREN) {
00231
00232
00233
00234
00235
00236
00237 if (BD_ARRAY_CLASS(bd_idx) == Explicit_Shape) {
00238 PRINTMSG(line, 115, Error, column);
00239 BD_DCL_ERR(bd_idx) = TRUE;
00240 }
00241 else {
00242 BD_ARRAY_CLASS(bd_idx) = Deferred_Shape;
00243 }
00244 }
00245 else {
00246
00247
00248
00249
00250
00251
00252 if (!lower_bound_found) {
00253 PRINTMSG(LA_CH_LINE, 119, Error, LA_CH_COLUMN, &LA_CH_VALUE);
00254 BD_DCL_ERR(bd_idx) = TRUE;
00255 }
00256
00257 if (LA_CH_VALUE != STAR) {
00258 line = LA_CH_LINE;
00259 column = LA_CH_COLUMN;
00260
00261 if (!parse_int_spec_expr(&ub_len_idx, &ub_fld, fold_it, FALSE)) {
00262
00263
00264
00265 BD_DCL_ERR(bd_idx) = TRUE;
00266 ub_len_idx = CN_INTEGER_ONE_IDX;
00267 ub_fld = CN_Tbl_Idx;
00268 }
00269
00270 if (ub_fld != CN_Tbl_Idx) {
00271 non_constant_size = TRUE;
00272 }
00273
00274 if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
00275 PRINTMSG(line, 114, Error, column);
00276 BD_DCL_ERR(bd_idx) = TRUE;
00277 ub_len_idx = NULL_IDX;
00278 ub_fld = NO_Tbl_Idx;
00279 }
00280 else {
00281 BD_ARRAY_CLASS(bd_idx)= Explicit_Shape;
00282 }
00283 }
00284 }
00285 }
00286
00287
00288
00289
00290
00291
00292
00293 if (LA_CH_VALUE == STAR) {
00294 line = LA_CH_LINE;
00295 column = LA_CH_COLUMN;
00296 NEXT_LA_CH;
00297
00298 if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
00299
00300
00301
00302 PRINTMSG(line, 114, Error, column);
00303 parse_err_flush(Find_Rparen, NULL);
00304 BD_DCL_ERR(bd_idx) = TRUE;
00305 }
00306 else {
00307 BD_ARRAY_CLASS(bd_idx) = Assumed_Size;
00308 ub_len_idx = lb_len_idx;
00309 ub_fld = lb_fld;
00310
00311 if (LA_CH_VALUE != RPAREN) {
00312
00313
00314
00315 BD_DCL_ERR(bd_idx) = TRUE;
00316 PRINTMSG(line, 116, Error, column);
00317 parse_err_flush(Find_Rparen, NULL);
00318 }
00319 }
00320 }
00321
00322 BD_LB_IDX(bd_idx, rank) = lb_len_idx;
00323 BD_LB_FLD(bd_idx, rank) = lb_fld;
00324 BD_UB_IDX(bd_idx, rank) = ub_len_idx;
00325 BD_UB_FLD(bd_idx, rank) = ub_fld;
00326
00327 if (LA_CH_VALUE == COMMA) {
00328
00329 if (rank++ == 7) {
00330 found_end = TRUE;
00331 BD_DCL_ERR(bd_idx) = TRUE;
00332 PRINTMSG(LA_CH_LINE, 117, Error, LA_CH_COLUMN);
00333 parse_err_flush(Find_Rparen, NULL);
00334 }
00335 else {
00336 NEXT_LA_CH;
00337 }
00338 }
00339 else {
00340 found_end = TRUE;
00341 }
00342
00343 found_error = BD_DCL_ERR(bd_idx) | found_error;
00344 }
00345 while (!found_end);
00346
00347 if (LA_CH_VALUE == RPAREN ||
00348 parse_err_flush(Find_Rparen, (found_error) ? NULL : ", or )")) {
00349
00350 NEXT_LA_CH;
00351 }
00352
00353 if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
00354
00355 if (possible_assumed_shape) {
00356 BD_ARRAY_CLASS(bd_idx) = Assumed_Shape;
00357 }
00358 }
00359 else if (!non_constant_size) {
00360 BD_ARRAY_SIZE(bd_idx) = Constant_Size;
00361 }
00362
00363 BD_RANK(bd_idx) = rank;
00364
00365 # ifdef _DEBUG
00366 if (BD_ARRAY_CLASS(bd_idx) == Unknown_Array) {
00367
00368
00369
00370 PRINTMSG(LA_CH_LINE, 178, Internal, LA_CH_COLUMN);
00371 }
00372 # endif
00373
00374 EXIT:
00375
00376 if (AT_REFERENCED(attr_idx) > Not_Referenced) {
00377 is_attr_referenced_in_bound(bd_idx, attr_idx);
00378 }
00379
00380 if (AT_REFERENCED(attr_idx) < referenced) {
00381 AT_REFERENCED(attr_idx) = referenced;
00382 }
00383
00384 bd_idx = ntr_array_in_bd_tbl(bd_idx);
00385
00386 TRACE (Func_Exit, "parse_array_spec", NULL);
00387
00388 return(bd_idx);
00389
00390 }
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414 boolean parse_generic_spec(void)
00415
00416 {
00417 boolean parse_ok;
00418
00419
00420 TRACE (Func_Entry, "parse_generic_spec", NULL);
00421
00422 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
00423 parse_ok = TRUE;
00424
00425 if (TOKEN_VALUE(token) == Tok_Id) {
00426
00427 }
00428 else if (TOKEN_VALUE(token) == Tok_Kwd_Assignment &&
00429 LA_CH_VALUE == LPAREN) {
00430 NEXT_LA_CH;
00431
00432 if (LA_CH_VALUE == EQUAL) {
00433
00434 MATCHED_TOKEN_CLASS(Tok_Class_Op);
00435
00436 if (TOKEN_VALUE(token) == Tok_Op_Assign) {
00437
00438 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
00439 NEXT_LA_CH;
00440 }
00441 }
00442 else {
00443 PRINTMSG(TOKEN_LINE(token), 197, Error, TOKEN_COLUMN(token),
00444 "=", TOKEN_STR(token));
00445 parse_ok = FALSE;
00446
00447 if (parse_err_flush(Find_Rparen, NULL)) {
00448 NEXT_LA_CH;
00449 }
00450 }
00451 }
00452 else if (parse_err_flush(Find_Rparen, "=")) {
00453 parse_ok = FALSE;
00454 NEXT_LA_CH;
00455 }
00456 }
00457 else if (TOKEN_VALUE(token) == Tok_Kwd_Operator &&
00458 LA_CH_VALUE == LPAREN) {
00459 NEXT_LA_CH;
00460
00461 if (MATCHED_TOKEN_CLASS(Tok_Class_Op)) {
00462
00463 switch (TOKEN_VALUE(token)) {
00464 case Tok_Const_True:
00465 case Tok_Const_False:
00466 parse_ok = FALSE;
00467 PRINTMSG(TOKEN_LINE(token), 499, Error, TOKEN_COLUMN(token));
00468 break;
00469
00470 case Tok_Op_Deref:
00471 case Tok_Op_Ptr_Assign:
00472 case Tok_Op_Assign:
00473 parse_ok = FALSE;
00474 PRINTMSG(TOKEN_LINE(token), 300, Error, TOKEN_COLUMN(token));
00475 break;
00476
00477 case Tok_Op_Eq :
00478 TOKEN_STR(token)[0] = 'e';
00479 TOKEN_STR(token)[1] = 'q';
00480 break;
00481
00482 case Tok_Op_Ge :
00483 TOKEN_STR(token)[0] = 'g';
00484 TOKEN_STR(token)[1] = 'e';
00485 break;
00486
00487 case Tok_Op_Gt :
00488 TOKEN_STR(token)[0] = 'g';
00489 TOKEN_STR(token)[1] = 't';
00490 break;
00491
00492 case Tok_Op_Le :
00493 TOKEN_STR(token)[0] = 'l';
00494 TOKEN_STR(token)[1] = 'e';
00495 break;
00496
00497 case Tok_Op_Lt :
00498 TOKEN_STR(token)[0] = 'l';
00499 TOKEN_STR(token)[1] = 't';
00500 break;
00501
00502 case Tok_Op_Ne :
00503 TOKEN_STR(token)[0] = 'n';
00504 TOKEN_STR(token)[1] = 'e';
00505 break;
00506
00507 case Tok_Op_Lg :
00508 TOKEN_STR(token)[0] = 'l';
00509 TOKEN_STR(token)[1] = 'g';
00510 break;
00511
00512 default:
00513 break;
00514 }
00515
00516 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
00517 NEXT_LA_CH;
00518 }
00519 }
00520 else if (LA_CH_VALUE == SLASH) {
00521
00522
00523
00524
00525 TOKEN_STR(token)[0] = LA_CH_VALUE;
00526 TOKEN_VALUE(token) = Tok_Op_Div;
00527 TOKEN_LEN(token) = 1;
00528 NEXT_LA_CH;
00529
00530 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
00531 NEXT_LA_CH;
00532 }
00533 }
00534 else if (parse_err_flush(Find_Rparen, "defined-operator")) {
00535 parse_ok = FALSE;
00536 NEXT_LA_CH;
00537 }
00538 }
00539 else {
00540 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
00541 MATCHED_TOKEN_CLASS(Tok_Class_Id);
00542 }
00543 }
00544 else {
00545 parse_err_flush(Find_Comma, "OPERATOR or ASSIGNMENT or generic-name");
00546 parse_ok = FALSE;
00547 }
00548
00549 TRACE (Func_Exit, "parse_generic_spec", NULL);
00550 return(parse_ok);
00551
00552 }
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572 intent_type parse_intent_spec()
00573
00574 {
00575 char *err_str = NULL;
00576 intent_type intent = Intent_Inout;
00577
00578
00579 TRACE (Func_Entry, "parse_intent_spec", NULL);
00580
00581 if (LA_CH_VALUE != LPAREN) {
00582 err_str = "(";
00583 }
00584 else {
00585 NEXT_LA_CH;
00586
00587 if (matched_specific_token(Tok_Kwd_In, Tok_Class_Keyword)) {
00588
00589 if (!matched_specific_token(Tok_Kwd_Out, Tok_Class_Keyword)) {
00590 intent = Intent_In;
00591 }
00592 }
00593 else if (matched_specific_token(Tok_Kwd_Out, Tok_Class_Keyword)) {
00594 intent = Intent_Out;
00595 }
00596 else {
00597 parse_err_flush(Find_Rparen, "IN or OUT or INOUT");
00598 intent = Intent_Unseen;
00599 }
00600
00601 if (LA_CH_VALUE == RPAREN) {
00602 NEXT_LA_CH;
00603 }
00604 else {
00605 err_str = ")";
00606 }
00607 }
00608
00609 if (err_str != NULL) {
00610 parse_err_flush(Find_Rparen, err_str);
00611 matched_specific_token(Tok_Punct_Rparen, Tok_Class_Punct);
00612 intent = Intent_Unseen;
00613 }
00614
00615 TRACE (Func_Exit, "parse_intent_spec", NULL);
00616
00617 return(intent);
00618
00619 }
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644 static void parse_kind_selector(void)
00645
00646 {
00647 int al_idx;
00648 fld_type field_type;
00649 long kind_idx;
00650 opnd_type opnd;
00651
00652
00653 TRACE (Func_Entry, "parse_kind_selector", NULL);
00654
00655 if (matched_specific_token(Tok_Kwd_Kind, Tok_Class_Keyword) &&
00656 !matched_specific_token(Tok_Punct_Eq, Tok_Class_Punct)) {
00657 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
00658 }
00659
00660 OPND_LINE_NUM(opnd) = LA_CH_LINE;
00661 OPND_COL_NUM(opnd) = LA_CH_COLUMN;
00662
00663
00664
00665 parsing_kind_selector = TRUE;
00666 kind0seen = FALSE;
00667 kind0E0seen = FALSE;
00668 kind0D0seen = FALSE;
00669 kindconstseen = FALSE;
00670
00671 if (parse_int_spec_expr(&kind_idx, &field_type, TRUE, FALSE)) {
00672 OPND_FLD(opnd) = field_type;
00673 OPND_IDX(opnd) = kind_idx;
00674
00675 if (!kind_to_linear_type(&opnd,
00676 AT_WORK_IDX,
00677 kind0seen,
00678 kind0E0seen,
00679 kind0D0seen,
00680 kindconstseen)) {
00681 AT_DCL_ERR(AT_WORK_IDX) = TRUE;
00682 }
00683
00684 # if !defined(_TARGET_OS_MAX)
00685
00686 if (!on_off_flags.enable_double_precision &&
00687 (TYP_TYPE(ATD_TYPE_IDX(AT_WORK_IDX)) == Complex ||
00688 TYP_TYPE(ATD_TYPE_IDX(AT_WORK_IDX)) == Real) &&
00689 TYP_DCL_VALUE(ATD_TYPE_IDX(AT_WORK_IDX)) == 16) {
00690 PRINTMSG(OPND_LINE_NUM(opnd), 586, Warning, OPND_COL_NUM(opnd));
00691 }
00692 # endif
00693
00694 # if defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN)
00695 if ((TYP_TYPE(ATD_TYPE_IDX(AT_WORK_IDX)) == Complex ||
00696 TYP_TYPE(ATD_TYPE_IDX(AT_WORK_IDX)) == Real) &&
00697 TYP_DCL_VALUE(ATD_TYPE_IDX(AT_WORK_IDX)) == 16) {
00698 PRINTMSG(OPND_LINE_NUM(opnd), 541, Error, OPND_COL_NUM(opnd));
00699 }
00700 # endif
00701
00702 if (field_type == AT_Tbl_Idx) {
00703
00704
00705
00706
00707 AT_REFERENCED(kind_idx) = Not_Referenced;
00708 al_idx = SCP_TMP_FW_IDX(curr_scp_idx);
00709 SCP_TMP_FW_IDX(curr_scp_idx) = AL_NEXT_IDX(al_idx);
00710 }
00711 }
00712
00713 parsing_kind_selector = FALSE;
00714
00715 TRACE (Func_Exit, "parse_kind_selector", NULL);
00716
00717 return;
00718
00719 }
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750 void parse_length_selector(int attr_idx,
00751 boolean i_can_have_len_equal,
00752 boolean parsing_length_selector)
00753
00754 {
00755 type_char_type char_class = Unknown_Char;
00756 int column;
00757 fld_type field_type;
00758 boolean fold_it;
00759 long len_idx;
00760 int line;
00761 opnd_type opnd;
00762 reference_type referenced;
00763
00764
00765 TRACE (Func_Entry, "parse_length_selector", NULL);
00766
00767
00768
00769
00770 fold_it = (CURR_BLK == Derived_Type_Blk);
00771 referenced = (reference_type) AT_REFERENCED(attr_idx);
00772 AT_REFERENCED(attr_idx) = Not_Referenced;
00773
00774 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
00775
00776 if (i_can_have_len_equal) {
00777
00778 if (matched_specific_token(Tok_Kwd_Len, Tok_Class_Keyword) &&
00779 !matched_specific_token(Tok_Punct_Eq, Tok_Class_Punct)) {
00780 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
00781 }
00782 line = LA_CH_LINE;
00783 column = LA_CH_COLUMN;
00784
00785 if (LA_CH_VALUE == STAR) {
00786 NEXT_LA_CH;
00787 len_idx = 0;
00788 field_type = NO_Tbl_Idx;
00789 char_class = Assumed_Size_Char;
00790 }
00791 else {
00792
00793 if (!parse_int_spec_expr(&len_idx, &field_type, fold_it, TRUE)) {
00794 len_idx = CN_INTEGER_ONE_IDX;
00795 field_type = CN_Tbl_Idx;
00796 }
00797
00798 if (field_type != AT_Tbl_Idx) {
00799 char_class = Const_Len_Char;
00800 }
00801 }
00802 }
00803 else {
00804 #ifdef KEY
00805 line = TOKEN_LINE(token);
00806 column = TOKEN_COLUMN(token);
00807 PRINTMSG(line, 1563, Ansi, Comment, column);
00808 #endif
00809 NEXT_LA_CH;
00810
00811 if (LA_CH_VALUE == LPAREN) {
00812 NEXT_LA_CH;
00813 line = LA_CH_LINE;
00814 column = LA_CH_COLUMN;
00815
00816 if (LA_CH_VALUE == STAR) {
00817 NEXT_LA_CH;
00818 len_idx = 0;
00819 field_type = NO_Tbl_Idx;
00820 char_class = Assumed_Size_Char;
00821 }
00822 else {
00823
00824 if (!parse_int_spec_expr(&len_idx, &field_type, fold_it, TRUE)) {
00825 len_idx = CN_INTEGER_ONE_IDX;
00826 field_type = CN_Tbl_Idx;
00827 }
00828
00829 if (field_type != AT_Tbl_Idx) {
00830 char_class = Const_Len_Char;
00831 }
00832 }
00833
00834 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
00835 NEXT_LA_CH;
00836 }
00837 }
00838 else if (MATCHED_TOKEN_CLASS(Tok_Class_Int_Spec)) {
00839 len_idx = TOKEN_CONST_TBL_IDX(token);
00840 field_type = CN_Tbl_Idx;
00841 char_class = Const_Len_Char;
00842 line = TOKEN_LINE(token);
00843 column = TOKEN_COLUMN(token);
00844
00845 #ifndef KEY
00846 if (parsing_length_selector) {
00847 PRINTMSG(line, 1563, Comment, column);
00848 }
00849 #endif
00850 }
00851 else {
00852 line = LA_CH_LINE;
00853 column = LA_CH_COLUMN;
00854 len_idx = CN_INTEGER_ONE_IDX;
00855 field_type = CN_Tbl_Idx;
00856 char_class = Const_Len_Char;
00857 parse_err_flush(Find_None, "scalar-int-literal-constant or (");
00858 }
00859 }
00860
00861 if (char_class == Assumed_Size_Char && CURR_BLK == Derived_Type_Blk) {
00862
00863
00864
00865 PRINTMSG(line, 191, Error, column);
00866 char_class = Const_Len_Char;
00867 len_idx = CN_INTEGER_ONE_IDX;
00868 field_type = CN_Tbl_Idx;
00869 }
00870
00871 if (AT_REFERENCED(attr_idx) > Not_Referenced) {
00872
00873
00874
00875
00876
00877 AT_DCL_ERR(attr_idx) = TRUE;
00878
00879 if (field_type == AT_Tbl_Idx &&
00880 ATD_FLD(len_idx) == IR_Tbl_Idx &&
00881 find_attr_in_ir(attr_idx, ATD_TMP_IDX(len_idx), &opnd)) {
00882 PRINTMSG(OPND_LINE_NUM(opnd), 1035, Error,
00883 OPND_COL_NUM(opnd),
00884 AT_OBJ_NAME_PTR(attr_idx));
00885 len_idx = CN_INTEGER_ONE_IDX;
00886 field_type = CN_Tbl_Idx;
00887 }
00888 }
00889
00890 if (AT_REFERENCED(attr_idx) < referenced) {
00891 AT_REFERENCED(attr_idx) = referenced;
00892 }
00893
00894 TYP_TYPE(TYP_WORK_IDX) = Character;
00895 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
00896 TYP_CHAR_CLASS(TYP_WORK_IDX) = char_class;
00897 TYP_FLD(TYP_WORK_IDX) = field_type;
00898 TYP_IDX(TYP_WORK_IDX) = len_idx;
00899
00900 TRACE (Func_Exit, "parse_length_selector", NULL);
00901
00902 return;
00903
00904 }
00905 #ifdef KEY
00906
00907
00908
00909
00910
00911
00912
00913
00914 int
00915 parse_non_char_kind_selector(boolean double_precision) {
00916 if (MATCHED_TOKEN_CLASS(Tok_Class_Int_Spec)) {
00917 long num = (long) CN_INT_TO_C(TOKEN_CONST_TBL_IDX(token));
00918 linear_type_type linear_type = Err_Res;
00919 int type_idx = ATD_TYPE_IDX(AT_WORK_IDX);
00920 char *type_str = basic_type_str[TYP_TYPE(type_idx)];
00921
00922 switch (TYP_TYPE(type_idx)) {
00923
00924 case Integer:
00925
00926 switch (num) {
00927
00928 case 1:
00929 linear_type = (cmd_line_flags.s_cf77types) ?
00930 INTEGER_DEFAULT_TYPE : Integer_1;
00931 break;
00932
00933 case 2:
00934 linear_type = (cmd_line_flags.s_cf77types) ?
00935 INTEGER_DEFAULT_TYPE : Integer_2;
00936 break;
00937
00938 case 4:
00939 linear_type = (cmd_line_flags.s_cf77types) ?
00940 INTEGER_DEFAULT_TYPE : Integer_4;
00941 break;
00942
00943 case 8:
00944 linear_type = (cmd_line_flags.s_cf77types) ?
00945 INTEGER_DEFAULT_TYPE : Integer_8;
00946 break;
00947
00948 };
00949
00950 break;
00951
00952
00953 case Real:
00954
00955 if (double_precision) {
00956 type_str = "DOUBLE PRECISION";
00957
00958 if (num == 16) {
00959
00960 # ifdef _TARGET_OS_MAX
00961 linear_type = Real_8;
00962 # elif defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN)
00963 PRINTMSG(TOKEN_LINE(token), 541, Error,
00964 TOKEN_COLUMN(token));
00965 # else
00966 linear_type = Real_16;
00967
00968 if (!on_off_flags.enable_double_precision) {
00969 PRINTMSG(TOKEN_LINE(token), 710, Warning,
00970 TOKEN_COLUMN(token),
00971 type_str,
00972 num);
00973 }
00974 # endif
00975 }
00976 }
00977 else {
00978 switch (num) {
00979
00980 case 4:
00981 linear_type = (cmd_line_flags.s_cf77types) ?
00982 REAL_DEFAULT_TYPE : Real_4;
00983 break;
00984
00985 case 8:
00986 linear_type = (cmd_line_flags.s_cf77types) ?
00987 REAL_DEFAULT_TYPE : Real_8;
00988 break;
00989
00990 case 16:
00991
00992 # ifdef _TARGET_OS_MAX
00993 PRINTMSG(TOKEN_LINE(token), 391, Warning,
00994 TOKEN_COLUMN(token),
00995 type_str, num, type_str, 8);
00996 linear_type = Real_8;
00997 # elif defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN)
00998 PRINTMSG(TOKEN_LINE(token), 541, Error,
00999 TOKEN_COLUMN(token));
01000 # else
01001 linear_type = Real_16;
01002
01003 if (!on_off_flags.enable_double_precision) {
01004 PRINTMSG(TOKEN_LINE(token), 710, Warning,
01005 TOKEN_COLUMN(token),
01006 type_str,
01007 num);
01008 }
01009 # endif
01010 break;
01011 };
01012 }
01013
01014 break;
01015
01016
01017 case Complex:
01018
01019 switch (num) {
01020
01021 case 8:
01022 linear_type = (cmd_line_flags.s_cf77types) ?
01023 COMPLEX_DEFAULT_TYPE : Complex_4;
01024 break;
01025
01026 case 16:
01027 linear_type = Complex_8;
01028 break;
01029
01030 case 32:
01031
01032 # ifdef _TARGET_OS_MAX
01033 PRINTMSG(TOKEN_LINE(token), 391, Warning,
01034 TOKEN_COLUMN(token),
01035 type_str, num, type_str, 16);
01036 linear_type = Complex_8;
01037 # elif defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN)
01038 PRINTMSG(TOKEN_LINE(token), 541, Error,
01039 TOKEN_COLUMN(token));
01040 # else
01041 linear_type = Complex_16;
01042
01043 if (!on_off_flags.enable_double_precision) {
01044 PRINTMSG(TOKEN_LINE(token), 710, Warning,
01045 TOKEN_COLUMN(token),
01046 type_str,
01047 num);
01048 }
01049 # endif
01050 break;
01051 };
01052
01053 break;
01054
01055
01056 case Logical:
01057
01058 switch (num) {
01059
01060 case 1:
01061 linear_type = (cmd_line_flags.s_cf77types) ?
01062 LOGICAL_DEFAULT_TYPE : Logical_1;
01063 break;
01064
01065 case 2:
01066 linear_type = (cmd_line_flags.s_cf77types) ?
01067 LOGICAL_DEFAULT_TYPE : Logical_2;
01068 break;
01069
01070 case 4:
01071 linear_type = (cmd_line_flags.s_cf77types) ?
01072 LOGICAL_DEFAULT_TYPE : Logical_4;
01073 break;
01074
01075 case 8:
01076 linear_type = (cmd_line_flags.s_cf77types) ?
01077 LOGICAL_DEFAULT_TYPE : Logical_8;
01078 break;
01079
01080 };
01081
01082 break;
01083
01084 }
01085
01086
01087 if (linear_type == Err_Res) {
01088 PRINTMSG(TOKEN_LINE(token), 125, Error,
01089 TOKEN_COLUMN(token),
01090 num,
01091 type_str);
01092 }
01093 else {
01094 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
01095 TYP_TYPE(TYP_WORK_IDX) = TYP_TYPE(type_idx);
01096 TYP_LINEAR(TYP_WORK_IDX) = linear_type;
01097 TYP_DCL_VALUE(TYP_WORK_IDX) = num;
01098 TYP_DESC(TYP_WORK_IDX) = Star_Typed;
01099 int result = ntr_type_tbl();
01100
01101 PRINTMSG(TOKEN_LINE(token), 124, Ansi,
01102 TOKEN_COLUMN(token),
01103 type_str,
01104 num);
01105 return result;
01106
01107 }
01108 }
01109 else {
01110 parse_err_flush(Find_None, "scalar-int-literal-constant");
01111 }
01112
01113
01114 return NULL_IDX;
01115 }
01116 #endif
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155 boolean parse_type_spec(boolean chk_kind)
01156
01157 {
01158 int al_idx;
01159 int attr_idx;
01160 int column;
01161 boolean do_kind_first;
01162 boolean double_precision = FALSE;
01163 int host_attr_idx;
01164 int host_name_idx;
01165 int line;
01166 int name_idx;
01167 boolean parse_err = FALSE;
01168 boolean save_err = FALSE;
01169 boolean type_done = FALSE;
01170 #ifndef KEY
01171 long num;
01172 linear_type_type linear_type;
01173 int type_idx;
01174 char *type_str;
01175 #endif
01176
01177
01178 TRACE (Func_Entry, "parse_type_spec", NULL);
01179
01180 if (SH_ERR_FLG(curr_stmt_sh_idx)) {
01181 SH_ERR_FLG(curr_stmt_sh_idx) = FALSE;
01182 save_err = TRUE;
01183 }
01184
01185 CLEAR_ATTR_NTRY(AT_WORK_IDX);
01186
01187 switch (TOKEN_VALUE(token)) {
01188 case Tok_Kwd_Byte:
01189 PRINTMSG(TOKEN_LINE(token), 1253, Ansi, TOKEN_COLUMN(token), "BYTE");
01190 ATD_TYPE_IDX(AT_WORK_IDX) = Integer_1;
01191 break;
01192
01193 case Tok_Kwd_Integer:
01194 ATD_TYPE_IDX(AT_WORK_IDX) = INTEGER_DEFAULT_TYPE;
01195 break;
01196
01197 case Tok_Kwd_Real:
01198 ATD_TYPE_IDX(AT_WORK_IDX) = REAL_DEFAULT_TYPE;
01199 break;
01200
01201 case Tok_Kwd_Complex:
01202 ATD_TYPE_IDX(AT_WORK_IDX) = COMPLEX_DEFAULT_TYPE;
01203 break;
01204
01205 case Tok_Kwd_Logical:
01206 ATD_TYPE_IDX(AT_WORK_IDX) = LOGICAL_DEFAULT_TYPE;
01207 break;
01208
01209 case Tok_Kwd_Character:
01210 line = TOKEN_LINE(token);
01211 column = TOKEN_COLUMN(token);
01212 ATD_TYPE_IDX(AT_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
01213
01214 if (LA_CH_VALUE == LPAREN) {
01215
01216 if (chk_kind) {
01217 NEXT_LA_CH;
01218 do_kind_first = FALSE;
01219
01220 if (LA_CH_VALUE == 'K' &&
01221 matched_specific_token(Tok_Kwd_Kind, Tok_Class_Keyword)) {
01222
01223 if (LA_CH_VALUE == EQUAL) {
01224 do_kind_first = TRUE;
01225 }
01226 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
01227 }
01228
01229 if (do_kind_first) {
01230 parse_kind_selector();
01231
01232 if (LA_CH_VALUE == COMMA) {
01233 NEXT_LA_CH;
01234
01235
01236
01237
01238 parse_length_selector(AT_WORK_IDX, TRUE, TRUE);
01239 TYP_DCL_VALUE(TYP_WORK_IDX) = TYP_DCL_VALUE(ATD_TYPE_IDX(
01240 AT_WORK_IDX));
01241 TYP_DESC(TYP_WORK_IDX) = TYP_DESC(ATD_TYPE_IDX(AT_WORK_IDX));
01242 ATD_TYPE_IDX(AT_WORK_IDX) = ntr_type_tbl();
01243 }
01244 }
01245 else {
01246
01247
01248
01249
01250 parse_length_selector(AT_WORK_IDX, TRUE, TRUE);
01251 ATD_TYPE_IDX(AT_WORK_IDX) = ntr_type_tbl();
01252
01253 if (LA_CH_VALUE == COMMA) {
01254 NEXT_LA_CH;
01255 parse_kind_selector();
01256 }
01257 }
01258
01259 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
01260 NEXT_LA_CH;
01261 }
01262 }
01263 }
01264 else if (LA_CH_VALUE == STAR) {
01265
01266
01267
01268
01269 parse_length_selector(AT_WORK_IDX, FALSE, TRUE);
01270 ATD_TYPE_IDX(AT_WORK_IDX) = ntr_type_tbl();
01271 }
01272
01273 type_done = TRUE;
01274 break;
01275
01276
01277 case Tok_Kwd_Double:
01278 line = TOKEN_LINE(token);
01279 column = TOKEN_COLUMN(token);
01280
01281 if (LA_CH_VALUE == 'C' &&
01282 matched_specific_token(Tok_Kwd_Complex, Tok_Class_Keyword)) {
01283
01284 # if defined(_TARGET_OS_MAX)
01285
01286 if (!on_off_flags.enable_double_precision) {
01287 PRINTMSG(line, 20, Ansi, column);
01288 }
01289 else if (cmd_line_flags.s_default32) {
01290
01291
01292
01293 PRINTMSG(line, 20, Ansi, column);
01294 }
01295 else {
01296 PRINTMSG(line, 702, Error, column);
01297 }
01298 # else
01299 PRINTMSG(line, 20, Ansi, column);
01300 # endif
01301
01302 ATD_TYPE_IDX(AT_WORK_IDX) = DOUBLE_COMPLEX_TYPE_IDX;
01303 type_done = TRUE;
01304 }
01305 else if (LA_CH_VALUE == 'P' &&
01306 matched_specific_token(Tok_Kwd_Precision, Tok_Class_Keyword)) {
01307
01308 ATD_TYPE_IDX(AT_WORK_IDX) = DOUBLE_PRECISION_TYPE_IDX;
01309
01310 # ifdef _TARGET_OS_MAX
01311
01312 if (! cmd_line_flags.s_default32 &&
01313 on_off_flags.enable_double_precision) {
01314 PRINTMSG(line, 1110, Warning, column);
01315 ATD_TYPE_IDX(AT_WORK_IDX) = REAL_DEFAULT_TYPE;
01316 }
01317 # endif
01318
01319 double_precision = TRUE;
01320
01321 if (LA_CH_VALUE != STAR) {
01322 type_done = TRUE;
01323 }
01324 }
01325 else {
01326 type_done = TRUE;
01327 ATD_TYPE_IDX(AT_WORK_IDX) = DOUBLE_PRECISION_TYPE_IDX;
01328 parse_err_flush(Find_None, "COMPLEX or PRECISION");
01329 }
01330 break;
01331
01332
01333 case Tok_Kwd_Type:
01334
01335 if (LA_CH_VALUE != LPAREN) {
01336 parse_err_flush(Find_None, "(");
01337 ATD_TYPE_IDX(AT_WORK_IDX) = TYPELESS_DEFAULT_TYPE;
01338 }
01339 else {
01340 NEXT_LA_CH;
01341
01342 if (!MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
01343 parse_err_flush(Find_Rparen, "type-name");
01344 }
01345 else if (LA_CH_VALUE == RPAREN) {
01346 attr_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token),
01347 &name_idx);
01348
01349 if (attr_idx == NULL_IDX) {
01350 host_attr_idx = srch_host_sym_tbl(TOKEN_STR(token),
01351 TOKEN_LEN(token),
01352 &host_name_idx,
01353 FALSE);
01354
01355 if (host_attr_idx == NULL_IDX) {
01356 attr_idx = ntr_sym_tbl(&token, name_idx);
01357 AT_OBJ_CLASS(attr_idx) = Derived_Type;
01358 AT_LOCKED_IN(attr_idx) = TRUE;
01359 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01360 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01361 }
01362 else if (stmt_type == Implicit_Stmt ||
01363 stmt_type == Function_Stmt) {
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374 attr_idx = ntr_host_in_sym_tbl(&token,
01375 name_idx,
01376 host_attr_idx,
01377 host_name_idx,
01378 TRUE);
01379
01380 if (AT_OBJ_CLASS(host_attr_idx) == Derived_Type) {
01381 COPY_ATTR_NTRY(attr_idx, host_attr_idx);
01382 AT_CIF_SYMBOL_ID(attr_idx) = 0;
01383 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
01384 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
01385 AT_LOCKED_IN(attr_idx) = FALSE;
01386 AT_ATTR_LINK(attr_idx) = host_attr_idx;
01387 }
01388 else {
01389 AT_OBJ_CLASS(attr_idx) = Derived_Type;
01390 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01391 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01392 }
01393 }
01394 else if (AT_OBJ_CLASS(host_attr_idx) == Derived_Type &&
01395 !AT_NOT_VISIBLE(host_attr_idx)) {
01396
01397
01398
01399 attr_idx = ntr_host_in_sym_tbl(&token,
01400 name_idx,
01401 host_attr_idx,
01402 host_name_idx,
01403 TRUE);
01404
01405 COPY_ATTR_NTRY(attr_idx, host_attr_idx);
01406 AT_CIF_SYMBOL_ID(attr_idx) = 0;
01407 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
01408 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
01409 AT_ATTR_LINK(attr_idx) = host_attr_idx;
01410 AT_LOCKED_IN(attr_idx) = TRUE;
01411 }
01412 else if (!fnd_semantic_err(Obj_Use_Derived_Type,
01413 TOKEN_LINE(token),
01414 TOKEN_COLUMN(token),
01415 host_attr_idx,
01416 TRUE)) {
01417
01418
01419
01420
01421 attr_idx = ntr_host_in_sym_tbl(&token,
01422 name_idx,
01423 host_attr_idx,
01424 host_name_idx,
01425 TRUE);
01426
01427 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
01428 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
01429 AT_LOCKED_IN(attr_idx) = TRUE;
01430 }
01431 else {
01432
01433
01434
01435
01436 attr_idx = ntr_sym_tbl(&token, name_idx);
01437 AT_OBJ_CLASS(attr_idx) = Derived_Type;
01438 AT_DCL_ERR(attr_idx) = TRUE;
01439 AT_LOCKED_IN(attr_idx) = TRUE;
01440 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01441 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01442 }
01443 }
01444 else if (AT_OBJ_CLASS(attr_idx) == Derived_Type &&
01445 !AT_NOT_VISIBLE(attr_idx)) {
01446 AT_LOCKED_IN(attr_idx) = TRUE;
01447 }
01448 else if (AT_ATTR_LINK(attr_idx) != NULL_IDX) {
01449 host_attr_idx = AT_ATTR_LINK(attr_idx);
01450
01451 while (AT_ATTR_LINK(host_attr_idx) != NULL_IDX) {
01452 host_attr_idx = AT_ATTR_LINK(host_attr_idx);
01453 }
01454
01455 if (AT_OBJ_CLASS(host_attr_idx) == Derived_Type) {
01456 CLEAR_VARIANT_ATTR_INFO(attr_idx, Derived_Type);
01457 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01458 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01459 AT_LOCKED_IN(attr_idx) = TRUE;
01460 }
01461 else {
01462 PRINTMSG(TOKEN_LINE(token), 956, Error,
01463 TOKEN_COLUMN(token),
01464 AT_OBJ_NAME_PTR(attr_idx));
01465 CREATE_ERR_ATTR(attr_idx, TOKEN_LINE(token),
01466 TOKEN_COLUMN(token),
01467 Derived_Type);
01468 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01469 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01470
01471
01472
01473
01474 LN_ATTR_IDX(name_idx) = attr_idx;
01475 LN_NAME_IDX(name_idx) = AT_NAME_IDX(attr_idx);
01476 AT_LOCKED_IN(attr_idx) = TRUE;
01477 }
01478 }
01479 else if (!fnd_semantic_err(Obj_Use_Derived_Type,
01480 TOKEN_LINE(token),
01481 TOKEN_COLUMN(token),
01482 attr_idx,
01483 TRUE)) {
01484
01485
01486
01487 CLEAR_VARIANT_ATTR_INFO(attr_idx, Derived_Type);
01488 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01489 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01490 AT_LOCKED_IN(attr_idx) = TRUE;
01491 }
01492 else {
01493 CREATE_ERR_ATTR(attr_idx, TOKEN_LINE(token),
01494 TOKEN_COLUMN(token),
01495 Derived_Type);
01496 ATT_STRUCT_BIT_LEN_FLD(attr_idx) = CN_Tbl_Idx;
01497 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
01498
01499
01500
01501
01502
01503 NTR_ATTR_LIST_TBL(al_idx);
01504 AL_ATTR_IDX(al_idx) = LN_ATTR_IDX(name_idx);
01505 AL_NEXT_IDX(al_idx) = SCP_CIF_ERR_LIST(curr_scp_idx);
01506 SCP_CIF_ERR_LIST(curr_scp_idx) = al_idx;
01507
01508 LN_ATTR_IDX(name_idx) = attr_idx;
01509 LN_NAME_IDX(name_idx) = AT_NAME_IDX(attr_idx);
01510 AT_LOCKED_IN(attr_idx) = TRUE;
01511
01512 }
01513
01514 if ((cif_flags & XREF_RECS) != 0) {
01515
01516 if (AT_ATTR_LINK(attr_idx) == NULL_IDX) {
01517 host_attr_idx = attr_idx;
01518 }
01519 else {
01520 host_attr_idx = AT_ATTR_LINK(attr_idx);
01521
01522 while (AT_ATTR_LINK(host_attr_idx) != NULL_IDX) {
01523 host_attr_idx = AT_ATTR_LINK(host_attr_idx);
01524 }
01525 }
01526
01527 cif_usage_rec(host_attr_idx,
01528 AT_Tbl_Idx,
01529 TOKEN_LINE(token),
01530 TOKEN_COLUMN(token),
01531 CIF_Derived_Type_Name_Reference);
01532 }
01533
01534 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
01535 TYP_TYPE(TYP_WORK_IDX) = Structure;
01536 TYP_LINEAR(TYP_WORK_IDX) = Structure_Type;
01537 TYP_IDX(TYP_WORK_IDX) = attr_idx;
01538 ATD_TYPE_IDX(AT_WORK_IDX) = ntr_type_tbl();
01539
01540 NEXT_LA_CH;
01541 }
01542 else {
01543 ATD_TYPE_IDX(AT_WORK_IDX) = TYPELESS_DEFAULT_TYPE;
01544 parse_err_flush(Find_Rparen, ")");
01545 }
01546 }
01547
01548 type_done = TRUE;
01549 break;
01550
01551
01552 default:
01553 ATD_TYPE_IDX(AT_WORK_IDX) = TYPELESS_DEFAULT_TYPE;
01554 type_done = TRUE;
01555 PRINTMSG(TOKEN_LINE(token), 197, Error, TOKEN_COLUMN(token),
01556 "INTEGER, REAL, DOUBLE, COMPLEX, LOGICAL, CHARACTER or TYPE",
01557 TOKEN_STR(token));
01558 break;
01559
01560 }
01561
01562 AT_TYPED(AT_WORK_IDX) = TRUE;
01563
01564 if (!type_done) {
01565
01566 if (chk_kind && LA_CH_VALUE == LPAREN) {
01567
01568 NEXT_LA_CH;
01569 parse_kind_selector();
01570
01571 if (LA_CH_VALUE == RPAREN || parse_err_flush(Find_Rparen, ")")) {
01572 NEXT_LA_CH;
01573 }
01574 }
01575 else if (LA_CH_VALUE == STAR) {
01576 NEXT_LA_CH;
01577
01578 #ifdef KEY
01579 ATD_TYPE_IDX(AT_WORK_IDX) =
01580 parse_non_char_kind_selector(double_precision);
01581 #endif
01582 }
01583 }
01584
01585
01586 #if 0
01587
01588
01589
01590
01591
01592
01593
01594
01595 if ((target_triton && target_ieee) &&
01596 (TYP_LINEAR(ATD_TYPE_IDX(AT_WORK_IDX)) == Real_16 ||
01597 TYP_LINEAR(ATD_TYPE_IDX(AT_WORK_IDX)) == Complex_16)) {
01598
01599
01600
01601 PRINTMSG(TOKEN_LINE(token), 1145, Warning, 0);
01602 SET_MSG_SUPPRESS_TBL(1145);
01603 }
01604
01605 #endif
01606
01607
01608 parse_err = SH_ERR_FLG(curr_stmt_sh_idx);
01609 SH_ERR_FLG(curr_stmt_sh_idx) = save_err || parse_err;
01610
01611 TRACE (Func_Exit, "parse_type_spec", NULL);
01612
01613 return (!parse_err);
01614
01615 }
01616
01617
01618
01619
01620
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637 boolean merge_access(int attr_idx,
01638 int line,
01639 int column,
01640 access_type access)
01641
01642 {
01643 boolean err_found;
01644 int sn_idx;
01645
01646
01647 TRACE (Func_Entry, "merge_access", NULL);
01648
01649
01650
01651 err_found = ((AT_ACCESS_SET(attr_idx) && access != AT_PRIVATE(attr_idx)) ||
01652 AT_NOT_VISIBLE(attr_idx) ||
01653 (AT_ATTR_LINK(attr_idx) != NULL_IDX));
01654
01655 switch (AT_OBJ_CLASS(attr_idx)) {
01656 case Data_Obj:
01657
01658 if (ATD_SYMBOLIC_CONSTANT(attr_idx)) {
01659 err_found = TRUE;
01660 }
01661 break;
01662
01663 case Pgm_Unit:
01664 if (ATP_PROC(attr_idx) == Intrin_Proc ||
01665 ATP_PGM_UNIT(attr_idx) == Program ||
01666 ATP_PGM_UNIT(attr_idx) == Module ||
01667 ATP_PGM_UNIT(attr_idx) == Blockdata) {
01668 err_found = TRUE;
01669 }
01670 break;
01671
01672 case Interface:
01673 break;
01674
01675 case Stmt_Func:
01676 err_found = TRUE;
01677 break;
01678
01679 case Label:
01680 err_found = TRUE;
01681 break;
01682
01683 default:
01684 break;
01685
01686 }
01687
01688
01689 # ifdef _DEBUG
01690
01691
01692
01693
01694
01695 if (!err_found &&
01696 fnd_semantic_err(((access == Public) ? Obj_Public : Obj_Private),
01697 line,
01698 column,
01699 attr_idx,
01700 TRUE)) {
01701 PRINTMSG(line, 655, Internal, column, "merge_access");
01702 }
01703 # endif
01704
01705 if (err_found) {
01706 fnd_semantic_err(((access == Public) ? Obj_Public : Obj_Private),
01707 line,
01708 column,
01709 attr_idx,
01710 TRUE);
01711 }
01712 else {
01713
01714 if (AT_ACCESS_SET(attr_idx)) {
01715 #ifdef KEY
01716 PRINTMSG(line, 1259, ansi_or_warning(), column,
01717 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx),
01718 (access == Public) ? "PUBLIC":"PRIVATE");
01719 #else
01720 PRINTMSG(line, 1259, Ansi, column,
01721 AT_OBJ_NAME_PTR(attr_idx),
01722 (access == Public) ? "PUBLIC":"PRIVATE");
01723 #endif
01724 }
01725
01726 AT_PRIVATE(attr_idx) = access;
01727 AT_ACCESS_SET(attr_idx) = TRUE;
01728
01729 if (AT_OBJ_CLASS(attr_idx) == Interface) {
01730
01731 if (AT_IS_INTRIN(attr_idx)) {
01732 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
01733
01734 while (sn_idx != NULL_IDX) {
01735
01736 if (AT_IS_INTRIN(SN_ATTR_IDX(sn_idx))) {
01737 AT_PRIVATE(SN_ATTR_IDX(sn_idx)) = access;
01738 AT_ACCESS_SET(SN_ATTR_IDX(sn_idx)) = TRUE;
01739 }
01740 sn_idx = SN_SIBLING_LINK(sn_idx);
01741 }
01742 }
01743 else if (ATI_PROC_IDX(attr_idx) != NULL_IDX) {
01744 AT_PRIVATE(ATI_PROC_IDX(attr_idx)) = access;
01745 AT_ACCESS_SET(ATI_PROC_IDX(attr_idx)) = TRUE;
01746 }
01747 }
01748 }
01749
01750 TRACE (Func_Exit, "merge_access", NULL);
01751
01752 return(!err_found);
01753
01754 }
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777 boolean merge_allocatable(boolean chk_semantics,
01778 int line,
01779 int column,
01780 int attr_idx)
01781
01782 {
01783 boolean fnd_err = FALSE;
01784
01785
01786 TRACE (Func_Entry, "merge_allocatable", NULL);
01787
01788 #ifdef KEY
01789
01790
01791
01792 if (AT_OBJ_CLASS(attr_idx) == Interface &&
01793 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
01794 attr_idx = ATI_PROC_IDX(attr_idx);
01795 }
01796 #endif
01797
01798 if (chk_semantics) {
01799 #ifdef KEY
01800 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit && ATP_RSLT_NAME(attr_idx)) {
01801 PRINTMSG(line, 36, Error, column, AT_OBJ_NAME_PTR(attr_idx),
01802 AT_OBJ_NAME_PTR(ATP_RSLT_IDX(attr_idx)));
01803 fnd_err = TRUE;
01804 AT_DCL_ERR(attr_idx) = TRUE;
01805 }
01806 else {
01807 fnd_err = fnd_semantic_err(Obj_Allocatable, line, column, attr_idx,
01808 TRUE);
01809 }
01810
01811 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit ||
01812 ATD_CLASS(attr_idx) == Function_Result) {
01813 PRINTMSG(line, 1679, Ansi, column);
01814 }
01815
01816 if (!fnd_err && AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
01817
01818 if (ATP_RSLT_IDX(attr_idx) == NULL_IDX) {
01819 int rslt_idx = NULL_IDX;
01820 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
01821 ATP_PGM_UNIT(attr_idx) = Function;
01822 SET_IMPL_TYPE(rslt_idx);
01823 attr_idx = rslt_idx;
01824 }
01825 else {
01826 attr_idx = ATP_RSLT_IDX(attr_idx);
01827 fnd_err = fnd_semantic_err(Obj_Pointer, line, column, attr_idx,
01828 TRUE);
01829 }
01830 }
01831 #else
01832 fnd_err = fnd_semantic_err(Obj_Allocatable,
01833 line,
01834 column,
01835 attr_idx,
01836 TRUE);
01837 #endif
01838
01839 if (!fnd_err) {
01840
01841 if (ATD_ALLOCATABLE(attr_idx)) {
01842 #ifdef KEY
01843 PRINTMSG(line, 1259, ansi_or_warning(), column,
01844 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx),
01845 "ALLOCATABLE");
01846 #else
01847 PRINTMSG(line, 1259, Ansi, column,
01848 AT_OBJ_NAME_PTR(attr_idx),
01849 "ALLOCATABLE");
01850 #endif
01851 }
01852 ATD_ALLOCATABLE(attr_idx) = TRUE;
01853 ATD_IM_A_DOPE(attr_idx) = TRUE;
01854 }
01855 }
01856 else {
01857 SET_IMPL_TYPE(attr_idx);
01858 ATD_ALLOCATABLE(attr_idx) = TRUE;
01859 ATD_IM_A_DOPE(attr_idx) = TRUE;
01860 }
01861
01862
01863 TRACE (Func_Exit, "merge_allocatable", NULL);
01864
01865 return(!fnd_err);
01866
01867 }
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891 boolean merge_automatic(boolean chk_semantics,
01892 int line,
01893 int column,
01894 int attr_idx)
01895
01896 {
01897 boolean fnd_err = FALSE;
01898 int rslt_idx;
01899
01900
01901 TRACE (Func_Entry, "merge_automatic", NULL);
01902
01903 if (chk_semantics) {
01904 fnd_err = fnd_semantic_err(Obj_Automatic,
01905 line,
01906 column,
01907 attr_idx,
01908 TRUE);
01909
01910 if (!fnd_err && AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
01911
01912 if (ATP_RSLT_IDX(attr_idx) == NULL_IDX) {
01913 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
01914 ATP_PGM_UNIT(attr_idx) = Function;
01915 SET_IMPL_TYPE(rslt_idx);
01916 attr_idx = rslt_idx;
01917 }
01918 else {
01919 attr_idx = ATP_RSLT_IDX(attr_idx);
01920 fnd_err = fnd_semantic_err(Obj_Automatic,
01921 line,
01922 column,
01923 attr_idx,
01924 TRUE);
01925 }
01926 }
01927
01928 if (!fnd_err && ATD_CLASS(attr_idx) == Function_Result &&
01929 (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character ||
01930 TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure ||
01931 ATD_ARRAY_IDX(attr_idx) != NULL_IDX ||
01932 ATD_POINTER(attr_idx))) {
01933 AT_DCL_ERR(attr_idx) = TRUE;
01934 fnd_err = TRUE;
01935 PRINTMSG(line, 1255, Error, column, AT_OBJ_NAME_PTR(attr_idx));
01936 }
01937
01938 if (!fnd_err) {
01939
01940 if (ATD_STACK(attr_idx)) {
01941 #ifdef KEY
01942 PRINTMSG(line, 1259, ansi_or_warning(), column,
01943 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx),
01944 "AUTOMATIC");
01945 #else
01946 PRINTMSG(line, 1259, Ansi, column,
01947 AT_OBJ_NAME_PTR(attr_idx),
01948 "AUTOMATIC");
01949 #endif
01950 }
01951 ATD_STACK(attr_idx) = TRUE;
01952 }
01953 }
01954 else {
01955 SET_IMPL_TYPE(attr_idx);
01956 ATD_STACK(attr_idx) = TRUE;
01957 }
01958
01959 TRACE (Func_Exit, "merge_automatic", NULL);
01960
01961 return(!fnd_err);
01962
01963 }
01964
01965 #ifdef KEY
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988 boolean merge_bind(boolean chk_semantics,
01989 int line,
01990 int column,
01991 int attr_idx)
01992
01993 {
01994 boolean fnd_err = FALSE;
01995 TRACE (Func_Entry, "merge_bind", NULL);
01996
01997 if (chk_semantics) {
01998 fnd_err = fnd_semantic_err(Obj_Bind, line, column, attr_idx, TRUE);
01999 }
02000 else if (!fnd_err && AT_BIND_ATTR(attr_idx)) {
02001
02002
02003 PRINTMSG(line, 1259, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02004 AT_DEF_LINE(attr_idx), "BIND");
02005 }
02006
02007 if (!fnd_err) {
02008 if (ATD_TYPE_IDX(attr_idx) == NULL_IDX) {
02009 SET_IMPL_TYPE(attr_idx);
02010 }
02011 set_binding_label(AT_Tbl_Idx, attr_idx, &new_binding_label);
02012 }
02013
02014 TRACE (Func_Exit, "merge_bind", NULL);
02015 return !fnd_err;
02016 }
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038 boolean merge_value(boolean chk_semantics,
02039 int line,
02040 int column,
02041 int attr_idx)
02042
02043 {
02044 boolean fnd_err = FALSE;
02045 TRACE (Func_Entry, "merge_value", NULL);
02046
02047 if (chk_semantics) {
02048 fnd_err = fnd_semantic_err(Obj_Value, line, column, attr_idx, TRUE);
02049 if (!fnd_err) {
02050 if (ATD_CLASS(attr_idx) == Dummy_Argument && ATD_VALUE_ATTR(attr_idx)) {
02051
02052 PRINTMSG(line, 1259, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02053 AT_DEF_LINE(attr_idx), "VALUE");
02054 fnd_err = TRUE;
02055 }
02056 else if (ATD_INTENT(attr_idx) == Intent_Out ||
02057 ATD_INTENT(attr_idx) == Intent_Inout) {
02058 PRINTMSG(line, 550, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02059 "VALUE", "INTENT(OUT)", AT_DEF_LINE(attr_idx));
02060 fnd_err = TRUE;
02061 }
02062 }
02063 }
02064 else {
02065 SET_IMPL_TYPE(attr_idx);
02066 }
02067
02068 if (!fnd_err) {
02069
02070
02071 ATD_CLASS(attr_idx) = Dummy_Argument;
02072 ATD_VALUE_ATTR(attr_idx) = TRUE;
02073 }
02074
02075 TRACE (Func_Exit, "merge_value", NULL);
02076 return !fnd_err;
02077 }
02078 #endif
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100 boolean merge_dimension(int attr_idx,
02101 int line,
02102 int column,
02103 int array_idx)
02104
02105 {
02106 #ifdef KEY
02107 obj_type dcl_type = Obj_Done;
02108 boolean err_fnd = FALSE;
02109 #else
02110 obj_type dcl_type;
02111 boolean err_fnd;
02112 #endif
02113 int i;
02114 int old_bd_idx;
02115 int rslt_idx;
02116 boolean same;
02117
02118
02119 TRACE (Func_Entry, "merge_dimension", NULL);
02120
02121 if (BD_DCL_ERR(array_idx)) {
02122 AT_DCL_ERR(attr_idx) = TRUE;
02123 err_fnd = TRUE;
02124 goto EXIT;
02125 }
02126
02127 switch (BD_ARRAY_CLASS(array_idx)) {
02128
02129 case Explicit_Shape:
02130 dcl_type = Obj_Expl_Shp_Arr;
02131 break;
02132
02133 case Deferred_Shape:
02134 dcl_type = Obj_Defrd_Shp_Arr;
02135 break;
02136
02137 case Assumed_Size:
02138 dcl_type = Obj_Assum_Size_Arr;
02139 break;
02140
02141 case Assumed_Shape:
02142 dcl_type = Obj_Assum_Shp_Arr;
02143 break;
02144
02145 }
02146
02147 if (AT_OBJ_CLASS(attr_idx) == Interface &&
02148 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02149 attr_idx = ATI_PROC_IDX(attr_idx);
02150 }
02151
02152 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit && ATP_PGM_UNIT(attr_idx) != Module) {
02153 rslt_idx = ATP_RSLT_IDX(attr_idx);
02154
02155 if (rslt_idx != NULL_IDX) {
02156
02157 if (ATP_RSLT_NAME(attr_idx) && !AT_NOT_VISIBLE(attr_idx)) {
02158 PRINTMSG(line, 27, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02159 AT_OBJ_NAME_PTR(rslt_idx));
02160 AT_DCL_ERR(attr_idx) = TRUE;
02161 AT_DCL_ERR(rslt_idx) = TRUE;
02162 }
02163 else {
02164
02165 if (AT_REFERENCED(attr_idx) > Not_Referenced &&
02166 is_attr_referenced_in_bound(array_idx, attr_idx)) {
02167 err_fnd = TRUE;
02168 }
02169 else {
02170 err_fnd = fnd_semantic_err(dcl_type,
02171 line,
02172 column,
02173 attr_idx,
02174 TRUE);
02175 }
02176
02177 if (!err_fnd) {
02178
02179 if (ATD_ARRAY_IDX(rslt_idx) != NULL_IDX) {
02180
02181
02182
02183 old_bd_idx = ATD_ARRAY_IDX(rslt_idx);
02184 same = (old_bd_idx == array_idx);
02185
02186 if (!same &&
02187 BD_ARRAY_CLASS(old_bd_idx)==BD_ARRAY_CLASS(array_idx)&&
02188 BD_RANK(old_bd_idx) == BD_RANK(array_idx) &&
02189 BD_ARRAY_SIZE(old_bd_idx) == BD_ARRAY_SIZE(array_idx)){
02190
02191 if (BD_ARRAY_CLASS(array_idx) != Deferred_Shape) {
02192 same = TRUE;
02193
02194 for (i = 1; i <= BD_RANK(array_idx); i++) {
02195
02196 if (BD_UB_FLD(old_bd_idx,i)!=BD_UB_FLD(array_idx,i)||
02197 (BD_UB_FLD(old_bd_idx,i) == AT_Tbl_Idx &&
02198 BD_UB_IDX(old_bd_idx,i)!=BD_UB_IDX(array_idx,i))||
02199 (BD_UB_FLD(old_bd_idx,i) == CN_Tbl_Idx &&
02200 fold_relationals(BD_UB_IDX(old_bd_idx,i),
02201 BD_UB_IDX(array_idx,i),
02202 Ne_Opr)) ||
02203 BD_LB_FLD(old_bd_idx,i)!=BD_LB_FLD(array_idx,i)||
02204 (BD_LB_FLD(old_bd_idx,i) == AT_Tbl_Idx &&
02205 BD_LB_IDX(old_bd_idx,i)!=BD_LB_IDX(array_idx,i))||
02206 (BD_LB_FLD(old_bd_idx,i) == CN_Tbl_Idx &&
02207 fold_relationals(BD_LB_IDX(old_bd_idx,i),
02208 BD_LB_IDX(array_idx,i),
02209 Ne_Opr))) {
02210 same = FALSE;
02211 break;
02212 }
02213 }
02214 }
02215 }
02216
02217 if (same) {
02218 #ifdef KEY
02219 PRINTMSG(line, 1259, ansi_or_warning(), column,
02220 AT_OBJ_NAME_PTR(rslt_idx), AT_DEF_LINE(attr_idx),
02221 "DIMENSION");
02222 }
02223 else {
02224 PRINTMSG(line, 554, Error, column,
02225 AT_OBJ_NAME_PTR(rslt_idx), "DIMENSION",
02226 "DIMENSION", AT_DEF_LINE(rslt_idx));
02227 #else
02228 PRINTMSG(line, 1259, Ansi, column,
02229 AT_OBJ_NAME_PTR(rslt_idx), "DIMENSION");
02230 }
02231 else {
02232 PRINTMSG(line, 554, Error, column,
02233 AT_OBJ_NAME_PTR(rslt_idx), "DIMENSION",
02234 "DIMENSION");
02235 #endif
02236 }
02237 }
02238 else {
02239 ATD_ARRAY_IDX(rslt_idx) = array_idx;
02240 }
02241 }
02242
02243 if (ATP_RECURSIVE(attr_idx) && !on_off_flags.recursive) {
02244 PRINTMSG(line, 184, Caution, column, AT_OBJ_NAME_PTR(attr_idx));
02245 }
02246 }
02247 }
02248 else {
02249
02250 if (AT_REFERENCED(attr_idx) > Not_Referenced &&
02251 is_attr_referenced_in_bound(array_idx, attr_idx)) {
02252 err_fnd = TRUE;
02253 }
02254 else {
02255 err_fnd = fnd_semantic_err(dcl_type,
02256 line,
02257 column,
02258 attr_idx,
02259 TRUE);
02260 }
02261
02262
02263
02264 if (!err_fnd) {
02265 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
02266 ATP_PGM_UNIT(attr_idx) = Function;
02267 ATD_ARRAY_IDX(rslt_idx) = array_idx;
02268 SET_IMPL_TYPE(rslt_idx);
02269 }
02270 }
02271 }
02272 else {
02273 if (AT_REFERENCED(attr_idx) > Not_Referenced &&
02274 is_attr_referenced_in_bound(array_idx, attr_idx)) {
02275 err_fnd = TRUE;
02276 }
02277 else {
02278 err_fnd = fnd_semantic_err(dcl_type,
02279 line,
02280 column,
02281 attr_idx,
02282 TRUE);
02283 }
02284
02285 if (!err_fnd) {
02286
02287 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
02288
02289
02290
02291 old_bd_idx = ATD_ARRAY_IDX(attr_idx);
02292 same = (old_bd_idx == array_idx);
02293
02294 if (!same &&
02295 BD_ARRAY_CLASS(old_bd_idx) == BD_ARRAY_CLASS(array_idx) &&
02296 BD_RANK(old_bd_idx) == BD_RANK(array_idx) &&
02297 BD_ARRAY_SIZE(old_bd_idx) == BD_ARRAY_SIZE(array_idx)) {
02298
02299 if (BD_ARRAY_CLASS(array_idx) != Deferred_Shape) {
02300 same = TRUE;
02301
02302 for (i = 1; i <= BD_RANK(array_idx); i++) {
02303
02304 if (BD_UB_FLD(old_bd_idx,i) != BD_UB_FLD(array_idx,i)||
02305 (BD_UB_FLD(old_bd_idx,i) == AT_Tbl_Idx &&
02306 BD_UB_IDX(old_bd_idx,i) != BD_UB_IDX(array_idx,i))||
02307 (BD_UB_FLD(old_bd_idx,i) == CN_Tbl_Idx &&
02308 fold_relationals(BD_UB_IDX(old_bd_idx,i),
02309 BD_UB_IDX(array_idx,i),
02310 Ne_Opr)) ||
02311 BD_LB_FLD(old_bd_idx,i) != BD_LB_FLD(array_idx,i)||
02312 (BD_LB_FLD(old_bd_idx,i) == AT_Tbl_Idx &&
02313 BD_LB_IDX(old_bd_idx,i) != BD_LB_IDX(array_idx,i))||
02314 (BD_LB_FLD(old_bd_idx,i) == CN_Tbl_Idx &&
02315 fold_relationals(BD_LB_IDX(old_bd_idx,i),
02316 BD_LB_IDX(array_idx,i),
02317 Ne_Opr))) {
02318
02319 same = FALSE;
02320 break;
02321 }
02322 }
02323 }
02324 }
02325
02326 if (same) {
02327 #ifdef KEY
02328 PRINTMSG(line, 1259, ansi_or_warning(), column,
02329 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx),
02330 "DIMENSION");
02331 }
02332 else {
02333 PRINTMSG(line, 554, Error, column,
02334 AT_OBJ_NAME_PTR(attr_idx), "DIMENSION", "DIMENSION",
02335 AT_DEF_LINE(attr_idx));
02336 #else
02337 PRINTMSG(line, 1259, Ansi, column,
02338 AT_OBJ_NAME_PTR(attr_idx), "DIMENSION");
02339 }
02340 else {
02341 PRINTMSG(line, 554, Error, column,
02342 AT_OBJ_NAME_PTR(attr_idx), "DIMENSION", "DIMENSION");
02343 #endif
02344 }
02345 }
02346 else {
02347 ATD_ARRAY_IDX(attr_idx) = array_idx;
02348
02349 if (BD_ARRAY_CLASS(array_idx) == Assumed_Shape ||
02350 BD_ARRAY_CLASS(array_idx) == Deferred_Shape) {
02351
02352 ATD_IM_A_DOPE(attr_idx) = TRUE;
02353 }
02354 }
02355 }
02356 }
02357
02358 EXIT:
02359
02360 TRACE (Func_Exit, "merge_dimension", NULL);
02361
02362 return(!err_fnd);
02363
02364 }
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381
02382
02383
02384
02385
02386
02387 boolean merge_data(boolean chk_semantics,
02388 int line,
02389 int column,
02390 int attr_idx)
02391
02392 {
02393 boolean fnd_err = FALSE;
02394
02395
02396 TRACE (Func_Entry, "merge_data", NULL);
02397
02398 if (chk_semantics) {
02399 fnd_err = fnd_semantic_err(Obj_Data_Init,
02400 line,
02401 column,
02402 attr_idx,
02403 TRUE);
02404 }
02405
02406 if (!fnd_err) {
02407 AT_DEFINED(attr_idx) = TRUE;
02408 ATD_DATA_INIT(attr_idx) = TRUE;
02409 ATD_CLASS(attr_idx) = Variable;
02410 }
02411
02412 TRACE (Func_Exit, "merge_data", NULL);
02413
02414 return(!fnd_err);
02415
02416 }
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426
02427
02428
02429
02430
02431
02432
02433
02434
02435
02436
02437
02438
02439
02440 boolean merge_external(boolean chk_semantics,
02441 int line,
02442 int column,
02443 int attr_idx)
02444
02445 {
02446 long chk_err = FALSE;
02447
02448
02449 TRACE (Func_Entry, "merge_external", NULL);
02450
02451 if (AT_OBJ_CLASS(attr_idx) == Interface &&
02452 !AT_IS_INTRIN(attr_idx) &&
02453 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02454 attr_idx = ATI_PROC_IDX(attr_idx);
02455 }
02456
02457 if (chk_semantics && fnd_semantic_err(Obj_Dcl_Extern,
02458 line,
02459 column,
02460 attr_idx,
02461 TRUE)) {
02462 chk_err = TRUE;
02463 }
02464 else {
02465
02466 #ifdef KEY
02467
02468
02469 if ((!(AT_OBJ_CLASS(attr_idx) == Data_Obj &&
02470 ATD_CLASS(attr_idx) == Dummy_Argument)) &&
02471 AT_BIND_ATTR(attr_idx)) {
02472 PRINTMSG(line, 550, Error, column, AT_OBJ_NAME_PTR(attr_idx), "BIND",
02473 "EXTERNAL", AT_DEF_LINE(attr_idx));
02474 chk_err = TRUE;
02475 }
02476 #endif
02477 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
02478
02479
02480
02481
02482 chg_data_obj_to_pgm_unit(attr_idx,
02483 Pgm_Unknown,
02484 Extern_Proc);
02485 }
02486 else {
02487
02488 if (ATP_DCL_EXTERNAL(attr_idx)) {
02489 #ifdef KEY
02490 PRINTMSG(line, 1259, ansi_or_warning(), column,
02491 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx),
02492 "EXTERNAL");
02493 #else
02494 PRINTMSG(line, 1259, Ansi, column,
02495 AT_OBJ_NAME_PTR(attr_idx),
02496 "EXTERNAL");
02497 #endif
02498 }
02499
02500 if (ATP_PROC(attr_idx) == Unknown_Proc) {
02501 ATP_PROC(attr_idx) = Extern_Proc;
02502 }
02503
02504 if (attr_idx == SCP_ATTR_IDX(curr_scp_idx)) {
02505
02506
02507
02508 PRINTMSG(line, 279, Ansi, column, AT_OBJ_NAME_PTR(attr_idx));
02509 }
02510 }
02511
02512 ATP_DCL_EXTERNAL(attr_idx) = TRUE;
02513 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
02514 }
02515
02516 TRACE (Func_Exit, "merge_external", NULL);
02517
02518 return(!chk_err);
02519
02520 }
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541
02542
02543
02544
02545 boolean merge_intent(boolean chk_semantics,
02546 int line,
02547 int column,
02548 int attr_idx)
02549
02550 {
02551 boolean fnd_err = FALSE;
02552
02553
02554 TRACE (Func_Entry, "merge_intent", NULL);
02555
02556 if (AT_OBJ_CLASS(attr_idx) == Interface &&
02557 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02558 attr_idx = ATI_PROC_IDX(attr_idx);
02559 }
02560
02561 if (chk_semantics) {
02562 fnd_err = fnd_semantic_err(Obj_Intent,
02563 line,
02564 column,
02565 attr_idx,
02566 TRUE);
02567
02568 if (!fnd_err) {
02569
02570 #ifdef KEY
02571 if (new_intent == Intent_In) {
02572 if (ATD_VOLATILE(attr_idx)) {
02573 PRINTMSG(line, 550, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02574 "VOLATILE", "INTENT(IN)", AT_DEF_LINE(attr_idx));
02575 }
02576 }
02577 else {
02578 if (ATD_VALUE_ATTR(attr_idx)) {
02579 PRINTMSG(line, 550, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02580 "VALUE", "INTENT(OUT)", AT_DEF_LINE(attr_idx));
02581 }
02582 }
02583 #endif
02584 if (ATD_INTENT(attr_idx) != Intent_Unseen) {
02585
02586 if (ATD_INTENT(attr_idx) == new_intent) {
02587 #ifdef KEY
02588 PRINTMSG(line, 1259, ansi_or_warning(), column,
02589 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "INTENT");
02590 }
02591 else {
02592 PRINTMSG(line, 554, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02593 "INTENT", "INTENT", AT_DEF_LINE(attr_idx));
02594 #else
02595 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),
02596 "INTENT");
02597 }
02598 else {
02599 PRINTMSG(line, 554, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02600 "INTENT", "INTENT");
02601 #endif
02602 }
02603 }
02604 }
02605 }
02606 else {
02607 SET_IMPL_TYPE(attr_idx);
02608 }
02609
02610 if (!fnd_err) {
02611 ATD_CLASS(attr_idx) = Dummy_Argument;
02612 ATD_INTENT(attr_idx) = new_intent;
02613 }
02614
02615 TRACE (Func_Exit, "merge_intent", NULL);
02616
02617 return(!fnd_err);
02618
02619 }
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639
02640
02641
02642 boolean merge_intrinsic(boolean chk_semantics,
02643 int line,
02644 int column,
02645 int attr_idx)
02646
02647 {
02648 boolean found_error = FALSE;
02649 int save_curr_scp_idx;
02650 int host_name_idx;
02651 int host_attr_idx;
02652 int sn_idx;
02653 int type_idx;
02654
02655
02656 TRACE (Func_Entry, "merge_intrinsic", NULL);
02657
02658 if (chk_semantics && fnd_semantic_err(Obj_Dcl_Intrin,
02659 line,
02660 column,
02661 attr_idx,
02662 TRUE)) {
02663 found_error = TRUE;
02664 }
02665 else if (AT_IS_INTRIN(attr_idx) && AT_OBJ_CLASS(attr_idx) == Interface) {
02666
02667 if (ATI_DCL_INTRINSIC(attr_idx)) {
02668 #ifdef KEY
02669 PRINTMSG(line, 1259, ansi_or_warning(), column,
02670 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "INTRINSIC");
02671 #else
02672 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),
02673 "INTRINSIC");
02674 #endif
02675 }
02676 ATI_DCL_INTRINSIC(attr_idx) = TRUE;
02677 }
02678 else {
02679
02680
02681
02682 host_attr_idx = srch_host_sym_tbl(AT_OBJ_NAME_PTR(attr_idx),
02683 AT_NAME_LEN(attr_idx),
02684 &host_name_idx,
02685 TRUE);
02686
02687 if (host_attr_idx != NULL_IDX) {
02688
02689
02690
02691
02692 if (AT_OBJ_CLASS(host_attr_idx) != Interface ||
02693 !ATI_GENERIC_INTRINSIC(host_attr_idx)) {
02694 save_curr_scp_idx = curr_scp_idx;
02695 curr_scp_idx = INTRINSIC_SCP_IDX;
02696 host_attr_idx = srch_sym_tbl(AT_OBJ_NAME_PTR(attr_idx),
02697 AT_NAME_LEN(attr_idx),
02698 &host_name_idx);
02699 curr_scp_idx = save_curr_scp_idx;
02700 }
02701
02702 if (host_attr_idx != NULL_IDX &&
02703 AT_IS_INTRIN(host_attr_idx) &&
02704 ATI_FIRST_SPECIFIC_IDX(host_attr_idx) == NULL_IDX) {
02705 complete_intrinsic_definition(host_attr_idx);
02706 }
02707 }
02708
02709 if (host_attr_idx == NULL_IDX) {
02710
02711
02712
02713 PRINTMSG(line, 701, Error, column, AT_OBJ_NAME_PTR(attr_idx));
02714 found_error = TRUE;
02715
02716 if (AT_OBJ_CLASS(attr_idx) == Data_Obj && !AT_TYPED(attr_idx)) {
02717 SET_IMPL_TYPE(attr_idx);
02718 }
02719 else {
02720
02721 if (AT_OBJ_CLASS(attr_idx) == Interface &&
02722 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02723 attr_idx = ATI_PROC_IDX(attr_idx);
02724 }
02725
02726 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
02727 ATP_PGM_UNIT(attr_idx) == Function &&
02728 !AT_TYPED(ATP_RSLT_IDX(attr_idx))) {
02729 SET_IMPL_TYPE(ATP_RSLT_IDX(attr_idx));
02730 }
02731 }
02732 }
02733 else if (AT_OBJ_CLASS(attr_idx) == Interface) {
02734
02735
02736
02737
02738 AT_IS_INTRIN(attr_idx) = TRUE;
02739 ATI_DCL_INTRINSIC(attr_idx) = TRUE;
02740 ATI_NUM_SPECIFICS(attr_idx) += ATI_NUM_SPECIFICS(host_attr_idx);
02741
02742 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
02743
02744 if (sn_idx == NULL_IDX) {
02745 ATI_FIRST_SPECIFIC_IDX(attr_idx) =
02746 ATI_FIRST_SPECIFIC_IDX(host_attr_idx);
02747 }
02748 else {
02749 while (SN_SIBLING_LINK(sn_idx) != NULL_IDX) {
02750 sn_idx = SN_SIBLING_LINK(sn_idx);
02751 }
02752 SN_SIBLING_LINK(sn_idx) = ATI_FIRST_SPECIFIC_IDX(host_attr_idx);
02753 }
02754 }
02755 else {
02756
02757 if (ATI_INTERFACE_CLASS(host_attr_idx) ==
02758 Generic_Subroutine_Interface) {
02759
02760 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
02761
02762 if (ATP_RSLT_IDX(attr_idx) != NULL_IDX &&
02763 AT_TYPED(ATP_RSLT_IDX(attr_idx))) {
02764 PRINTMSG(line, 869, Error, column,
02765 AT_OBJ_NAME_PTR(attr_idx));
02766 found_error = TRUE;
02767 }
02768
02769 ATP_RSLT_IDX(attr_idx) = NULL_IDX;
02770 }
02771 else if (AT_OBJ_CLASS(attr_idx) == Data_Obj && AT_TYPED(attr_idx)){
02772 PRINTMSG(line, 869, Error, column, AT_OBJ_NAME_PTR(attr_idx));
02773 found_error = TRUE;
02774 }
02775 }
02776
02777 type_idx = NULL_IDX;
02778
02779 if (AT_TYPED(attr_idx)) {
02780
02781 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
02782 type_idx = ATD_TYPE_IDX(attr_idx);
02783 }
02784 else if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
02785 ATP_RSLT_IDX(attr_idx) != NULL_IDX) {
02786 type_idx = ATD_TYPE_IDX(ATP_RSLT_IDX(attr_idx));
02787 }
02788 }
02789
02790 COPY_VARIANT_ATTR_INFO(host_attr_idx,
02791 attr_idx,
02792 Interface);
02793
02794 AT_ELEMENTAL_INTRIN(attr_idx) = AT_ELEMENTAL_INTRIN(host_attr_idx);
02795 AT_IS_INTRIN(attr_idx) = TRUE;
02796 ATD_TYPE_IDX(attr_idx) = type_idx;
02797 ATI_DCL_INTRINSIC(attr_idx) = TRUE;
02798 }
02799 }
02800
02801 TRACE (Func_Exit, "merge_intrinsic", NULL);
02802
02803 return(!found_error);
02804
02805 }
02806
02807
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836 boolean merge_optional (boolean chk_semantics,
02837 int line,
02838 int column,
02839 int attr_idx)
02840
02841 {
02842 boolean chk_err = FALSE;
02843
02844
02845 TRACE (Func_Entry, "merge_optional", NULL);
02846
02847 if (chk_semantics) {
02848 chk_err = fnd_semantic_err(Obj_Optional,
02849 line,
02850 column,
02851 attr_idx,
02852 TRUE);
02853
02854 if (!chk_err && AT_OPTIONAL(attr_idx)) {
02855 #ifdef KEY
02856 PRINTMSG(line, 1259, ansi_or_warning(), column,
02857 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "OPTIONAL");
02858 #else
02859 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),
02860 "OPTIONAL");
02861 #endif
02862 }
02863 }
02864 else {
02865 SET_IMPL_TYPE(attr_idx);
02866 }
02867
02868 if (!chk_err) {
02869
02870 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
02871 ATD_CLASS(attr_idx) = Dummy_Argument;
02872 }
02873 else {
02874 ATP_PROC(attr_idx) = Dummy_Proc;
02875 }
02876 AT_OPTIONAL(attr_idx) = TRUE;
02877 }
02878
02879 TRACE (Func_Exit, "merge_optional", NULL);
02880
02881 return(!chk_err);
02882
02883 }
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897
02898
02899
02900
02901
02902
02903
02904
02905 boolean merge_pointer(boolean chk_semantics,
02906 int line,
02907 int column,
02908 int attr_idx)
02909
02910 {
02911 boolean fnd_err = FALSE;
02912 int rslt_idx;
02913
02914
02915 TRACE (Func_Entry, "merge_pointer", NULL);
02916
02917 if (AT_OBJ_CLASS(attr_idx) == Interface &&
02918 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02919 attr_idx = ATI_PROC_IDX(attr_idx);
02920 }
02921
02922 if (chk_semantics) {
02923
02924 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit && ATP_RSLT_NAME(attr_idx)) {
02925 PRINTMSG(line, 36, Error, column, AT_OBJ_NAME_PTR(attr_idx),
02926 AT_OBJ_NAME_PTR(ATP_RSLT_IDX(attr_idx)));
02927 fnd_err = TRUE;
02928 AT_DCL_ERR(attr_idx) = TRUE;
02929 }
02930 else {
02931 fnd_err = fnd_semantic_err(Obj_Pointer,
02932 line,
02933 column,
02934 attr_idx,
02935 TRUE);
02936 }
02937
02938 if (!fnd_err && AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
02939
02940 if (ATP_RSLT_IDX(attr_idx) == NULL_IDX) {
02941 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
02942 ATP_PGM_UNIT(attr_idx) = Function;
02943 SET_IMPL_TYPE(rslt_idx);
02944 attr_idx = rslt_idx;
02945 }
02946 else {
02947 attr_idx = ATP_RSLT_IDX(attr_idx);
02948 fnd_err = fnd_semantic_err(Obj_Pointer,
02949 line,
02950 column,
02951 attr_idx,
02952 TRUE);
02953 }
02954 }
02955
02956 if (!fnd_err) {
02957
02958 if (ATD_POINTER(attr_idx)) {
02959 #ifdef KEY
02960 PRINTMSG(line, 1259, ansi_or_warning(), column,
02961 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "POINTER");
02962 #else
02963 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),
02964 "POINTER");
02965 #endif
02966 }
02967 ATD_POINTER(attr_idx) = TRUE;
02968 ATD_IM_A_DOPE(attr_idx) = TRUE;
02969 }
02970 }
02971 else {
02972 SET_IMPL_TYPE(attr_idx);
02973 ATD_POINTER(attr_idx) = TRUE;
02974 ATD_IM_A_DOPE(attr_idx) = TRUE;
02975 }
02976
02977 TRACE (Func_Exit, "merge_pointer", NULL);
02978
02979 return(!fnd_err);
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 boolean merge_save(boolean chk_semantics,
03005 int line,
03006 int column,
03007 int attr_idx)
03008
03009 {
03010 boolean fnd_err = FALSE;
03011
03012
03013 TRACE (Func_Entry, "merge_save", NULL);
03014
03015 if (chk_semantics) {
03016 fnd_err = fnd_semantic_err(Obj_Saved, line, column, attr_idx, TRUE);
03017
03018 if (!fnd_err && ATD_SAVED(attr_idx)) {
03019 #ifdef KEY
03020 PRINTMSG(line, 1259, ansi_or_warning(), column,
03021 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "SAVE");
03022 #else
03023 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx), "SAVE");
03024 #endif
03025 }
03026 }
03027 else {
03028 SET_IMPL_TYPE(attr_idx);
03029 }
03030
03031 if (!fnd_err) {
03032 ATD_SAVED(attr_idx) = TRUE;
03033 ATD_CLASS(attr_idx) = Variable;
03034 }
03035
03036 TRACE (Func_Exit, "merge_save", NULL);
03037
03038 return(!fnd_err);
03039
03040 }
03041
03042
03043
03044
03045
03046
03047
03048
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062
03063 boolean merge_target(boolean chk_semantics,
03064 int line,
03065 int column,
03066 int attr_idx)
03067
03068 {
03069 boolean fnd_err = FALSE;
03070 int rslt_idx;
03071
03072
03073 TRACE (Func_Entry, "merge_target", NULL);
03074
03075 if (AT_OBJ_CLASS(attr_idx) == Interface &&
03076 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
03077 attr_idx = ATI_PROC_IDX(attr_idx);
03078 }
03079
03080 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit && ATP_RSLT_NAME(attr_idx)) {
03081 PRINTMSG(line, 132, Error, column, AT_OBJ_NAME_PTR(attr_idx),
03082 AT_OBJ_NAME_PTR(ATP_RSLT_IDX(attr_idx)));
03083 fnd_err = TRUE;
03084 AT_DCL_ERR(attr_idx) = TRUE;
03085 }
03086 else if (chk_semantics) {
03087 fnd_err = fnd_semantic_err(Obj_Target, line, column, attr_idx, TRUE);
03088 }
03089 else {
03090 SET_IMPL_TYPE(attr_idx);
03091 }
03092
03093 if (!fnd_err && AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
03094
03095 if (ATP_RSLT_IDX(attr_idx) == NULL_IDX) {
03096 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
03097 ATP_PGM_UNIT(attr_idx) = Function;
03098 SET_IMPL_TYPE(rslt_idx);
03099 attr_idx = rslt_idx;
03100 }
03101 else {
03102 attr_idx = ATP_RSLT_IDX(attr_idx);
03103 fnd_err = fnd_semantic_err(Obj_Target,
03104 line,
03105 column,
03106 attr_idx,
03107 TRUE);
03108 }
03109 }
03110
03111 if (!fnd_err) {
03112
03113 if (!fnd_err && ATD_TARGET(attr_idx)) {
03114 #ifdef KEY
03115 PRINTMSG(line, 1259, ansi_or_warning(), column,
03116 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "TARGET");
03117 #else
03118 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),"TARGET");
03119 #endif
03120 }
03121 ATD_TARGET(attr_idx) = TRUE;
03122 }
03123
03124 TRACE (Func_Exit, "merge_target", NULL);
03125
03126 return(!fnd_err);
03127
03128 }
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151
03152
03153
03154
03155
03156
03157
03158
03159 #ifndef KEY
03160 static
03161 #endif
03162 boolean parse_int_spec_expr(long *len_idx,
03163 fld_type *field_type,
03164 boolean fold_it,
03165 boolean char_len)
03166
03167 {
03168 int column;
03169 expr_arg_type expr_desc;
03170 opnd_type len_opnd;
03171 int line;
03172 boolean parse_ok;
03173 expr_mode_type save_expr_mode = expr_mode;
03174 int type_idx;
03175
03176 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) || defined(_TARGET_OS_DARWIN)
03177 int cvrt_idx;
03178 int new_type;
03179 # endif
03180
03181
03182 TRACE (Func_Entry, "parse_int_spec_expr", NULL);
03183
03184 xref_state = CIF_Symbol_Reference;
03185 *field_type = CN_Tbl_Idx;
03186 *len_idx = CN_INTEGER_ONE_IDX;
03187 expr_mode = fold_it ? Initialization_Expr : Specification_Expr;
03188 line = LA_CH_LINE;
03189 column = LA_CH_COLUMN;
03190 expr_desc = init_exp_desc;
03191
03192 if (!parse_expr(&len_opnd)) {
03193 parse_ok = FALSE;
03194 goto EXIT;
03195 }
03196
03197
03198 if (fold_it) {
03199
03200 expr_desc.rank = 0;
03201
03202 if (!expr_semantics(&len_opnd, &expr_desc)) {
03203 parse_ok = FALSE;
03204 goto EXIT;
03205 }
03206
03207 if (expr_desc.rank != 0) {
03208 PRINTMSG(line, 907, Error, column);
03209 parse_ok = FALSE;
03210 goto EXIT;
03211 }
03212
03213 if (OPND_FLD(len_opnd) != CN_Tbl_Idx) {
03214 PRINTMSG(line, 1531, Error, column);
03215 parse_ok = FALSE;
03216 goto EXIT;
03217 }
03218
03219 if (parsing_kind_selector) {
03220 if (expr_desc.kind0seen) {
03221 kind0seen = TRUE;
03222 }
03223 else if (expr_desc.kind0E0seen) {
03224 kind0E0seen = TRUE;
03225 }
03226 else if (expr_desc.kind0D0seen) {
03227 kind0D0seen = TRUE;
03228 }
03229 else if (! expr_desc.kindnotconst) {
03230 kindconstseen = TRUE;
03231 }
03232 }
03233 }
03234
03235 parse_ok = TRUE;
03236
03237 if (OPND_FLD(len_opnd) == CN_Tbl_Idx) {
03238 type_idx = CN_TYPE_IDX(OPND_IDX(len_opnd));
03239
03240 if (TYP_TYPE(type_idx) != Integer) {
03241
03242 if (TYP_TYPE(type_idx) == Typeless) {
03243
03244 if (TYP_LINEAR(type_idx) == Short_Typeless_Const) {
03245 PRINTMSG(line, 221, Ansi, column);
03246
03247 OPND_IDX(len_opnd) = cast_typeless_constant(OPND_IDX(len_opnd),
03248 INTEGER_DEFAULT_TYPE,
03249 line,
03250 column);
03251 type_idx = INTEGER_DEFAULT_TYPE;
03252 }
03253 else {
03254 PRINTMSG(line, 1133, Error, column);
03255 parse_ok = FALSE;
03256 }
03257 }
03258 else {
03259 PRINTMSG(line, 488, Error, column,
03260 get_basic_type_str(type_idx));
03261 parse_ok = FALSE;
03262 }
03263 }
03264
03265 *len_idx = (long) OPND_IDX(len_opnd);
03266 *field_type = CN_Tbl_Idx;
03267
03268 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) || defined(_TARGET_OS_DARWIN)
03269
03270 if (!parsing_kind_selector) {
03271 new_type = NULL_IDX;
03272
03273 if (char_len) {
03274
03275 if (TYP_LINEAR(CN_TYPE_IDX(OPND_IDX(len_opnd))) != Integer_4) {
03276 new_type = Integer_4;
03277 }
03278 }
03279 else if (cmd_line_flags.s_pointer8 &&
03280 TYP_LINEAR(CN_TYPE_IDX(OPND_IDX(len_opnd))) !=
03281 SA_INTEGER_DEFAULT_TYPE) {
03282 new_type = SA_INTEGER_DEFAULT_TYPE;
03283 }
03284 else if (TYP_LINEAR(CN_TYPE_IDX(OPND_IDX(len_opnd))) <
03285 SA_INTEGER_DEFAULT_TYPE) {
03286
03287
03288
03289 new_type = SA_INTEGER_DEFAULT_TYPE;
03290 }
03291
03292 if (new_type != NULL_IDX) {
03293 NTR_IR_TBL(cvrt_idx);
03294 IR_OPR(cvrt_idx) = Cvrt_Opr;
03295 IR_TYPE_IDX(cvrt_idx) = new_type;
03296 IR_LINE_NUM(cvrt_idx) = line;
03297 IR_COL_NUM(cvrt_idx) = column;
03298
03299 COPY_OPND(IR_OPND_L(cvrt_idx), len_opnd);
03300
03301 OPND_IDX(len_opnd) = cvrt_idx;
03302 OPND_FLD(len_opnd) = IR_Tbl_Idx;
03303
03304 if (fold_it) {
03305 expr_desc.rank = 0;
03306
03307 if (!expr_semantics(&len_opnd, &expr_desc)) {
03308 parse_ok = FALSE;
03309 goto EXIT;
03310 }
03311
03312 *len_idx = (long) OPND_IDX(len_opnd);
03313 *field_type = CN_Tbl_Idx;
03314 }
03315 else {
03316 *field_type = AT_Tbl_Idx;
03317 *len_idx = ntr_bnds_tmp_list(&len_opnd);
03318 ATD_TMP_HAS_CVRT_OPR(*len_idx) = TRUE;
03319 }
03320 }
03321 else {
03322 *len_idx = (long) OPND_IDX(len_opnd);
03323 *field_type = CN_Tbl_Idx;
03324 }
03325 }
03326
03327 # endif
03328
03329 }
03330 else {
03331
03332 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX)) || defined(_TARGET_OS_DARWIN)
03333 new_type = NULL_IDX;
03334
03335 if (!parsing_kind_selector) {
03336
03337 if (char_len) {
03338 new_type = Integer_4;
03339 }
03340 else if (cmd_line_flags.s_pointer8) {
03341 new_type = SA_INTEGER_DEFAULT_TYPE;
03342 }
03343
03344 if (new_type != NULL_IDX) {
03345 NTR_IR_TBL(cvrt_idx);
03346 IR_OPR(cvrt_idx) = Cvrt_Opr;
03347 IR_TYPE_IDX(cvrt_idx) = new_type;
03348 IR_LINE_NUM(cvrt_idx) = line;
03349 IR_COL_NUM(cvrt_idx) = column;
03350
03351 COPY_OPND(IR_OPND_L(cvrt_idx), len_opnd);
03352
03353 OPND_IDX(len_opnd) = cvrt_idx;
03354 OPND_FLD(len_opnd) = IR_Tbl_Idx;
03355
03356 if (fold_it) {
03357 expr_desc.rank = 0;
03358
03359 if (!expr_semantics(&len_opnd, &expr_desc)) {
03360 parse_ok = FALSE;
03361 goto EXIT;
03362 }
03363 }
03364 }
03365 }
03366
03367 *field_type = AT_Tbl_Idx;
03368 *len_idx = ntr_bnds_tmp_list(&len_opnd);
03369
03370 ATD_TMP_SEMANTICS_DONE(*len_idx) = fold_it;
03371
03372 if (new_type != NULL_IDX) {
03373 ATD_TMP_HAS_CVRT_OPR(*len_idx) = TRUE;
03374 }
03375 # else
03376 *field_type = AT_Tbl_Idx;
03377 *len_idx = ntr_bnds_tmp_list(&len_opnd);
03378
03379 ATD_TMP_SEMANTICS_DONE(*len_idx) = fold_it;
03380 # endif
03381
03382 }
03383
03384 EXIT:
03385
03386 expr_mode = save_expr_mode;
03387
03388 TRACE (Func_Exit, "parse_int_spec_expr", NULL);
03389
03390 return(parse_ok);
03391
03392 }
03393
03394
03395
03396
03397
03398
03399
03400
03401
03402
03403
03404
03405
03406
03407
03408
03409
03410
03411
03412
03413
03414
03415
03416
03417 static int ntr_bnds_tmp_list (opnd_type *opnd)
03418
03419 {
03420 int al_idx;
03421 int attr_idx;
03422 int cif_attr = NULL_IDX;
03423 int column;
03424 int ir_idx;
03425 int line;
03426 int prev_al = NULL_IDX;
03427
03428
03429 TRACE (Func_Entry, "ntr_bnds_tmp_list", NULL);
03430
03431 al_idx = SCP_TMP_FW_IDX(curr_scp_idx);
03432 attr_idx = NULL_IDX;
03433
03434 while (al_idx != NULL_IDX) {
03435 attr_idx = AL_ATTR_IDX(al_idx);
03436
03437 if (ATD_CLASS(attr_idx) == Constant) {
03438
03439
03440
03441
03442
03443
03444
03445 al_idx = AL_NEXT_IDX(al_idx);
03446
03447 if (prev_al == NULL_IDX) {
03448 SCP_TMP_FW_IDX(curr_scp_idx) = al_idx;
03449 }
03450 else {
03451 AL_NEXT_IDX(prev_al) = al_idx;
03452 }
03453 continue;
03454 }
03455
03456
03457
03458
03459 if (compare_opnds(opnd, &(IR_OPND_R(ATD_TMP_IDX(attr_idx)))) ) {
03460
03461
03462
03463 if ((cif_flags & XREF_RECS) != 0) {
03464
03465 if (cif_attr == NULL_IDX) {
03466 cif_attr = attr_idx;
03467 }
03468 }
03469 else {
03470
03471 if (OPND_FLD((*opnd)) == IR_Tbl_Idx) {
03472 free_ir_stream(OPND_IDX((*opnd)));
03473 }
03474 goto EXIT;
03475 }
03476 }
03477
03478 prev_al = al_idx;
03479 al_idx = AL_NEXT_IDX(al_idx);
03480 }
03481
03482
03483
03484 NTR_ATTR_LIST_TBL(al_idx);
03485
03486 if (prev_al == NULL_IDX) {
03487 SCP_TMP_FW_IDX(curr_scp_idx) = al_idx;
03488 }
03489 else {
03490 AL_NEXT_IDX(prev_al) = al_idx;
03491 }
03492 find_opnd_line_and_column(opnd, &line, &column);
03493
03494 GEN_COMPILER_TMP_ASG(ir_idx,
03495 attr_idx,
03496 FALSE,
03497 line,
03498 column,
03499 INTEGER_DEFAULT_TYPE,
03500 Priv);
03501
03502 AL_ATTR_IDX(al_idx) = attr_idx;
03503
03504 COPY_OPND(IR_OPND_R(ir_idx), (*opnd));
03505
03506 if (cif_attr != NULL_IDX) {
03507
03508
03509
03510 AT_REFERENCED(attr_idx) = Not_Referenced;
03511 attr_idx = cif_attr;
03512 }
03513
03514 EXIT:
03515
03516 TRACE (Func_Exit, "ntr_bnds_tmp_list", NULL);
03517
03518 return (attr_idx);
03519
03520 }
03521
03522
03523
03524
03525
03526
03527
03528
03529
03530
03531
03532
03533
03534
03535
03536
03537
03538
03539
03540 int generic_spec_semantics(void)
03541
03542 {
03543 int attr_idx;
03544 boolean generic_name;
03545 int host_attr_idx;
03546 int host_name_idx;
03547 int name_idx;
03548 boolean new_attr = FALSE;
03549 int new_attr_idx;
03550 int scp_idx;
03551 int type_idx;
03552
03553
03554 TRACE (Func_Entry, "generic_spec_semantics", NULL);
03555
03556 generic_name = TOKEN_VALUE(token) == Tok_Id;
03557 attr_idx = srch_sym_tbl(TOKEN_STR(token),
03558 TOKEN_LEN(token),
03559 &name_idx);
03560
03561 if (stmt_type == Interface_Stmt) {
03562
03563 if (attr_idx == NULL_IDX) {
03564 host_attr_idx = srch_host_sym_tbl(TOKEN_STR(token),
03565 TOKEN_LEN(token),
03566 &host_name_idx,
03567 TRUE);
03568
03569 if (host_attr_idx == NULL_IDX ||
03570 AT_OBJ_CLASS(host_attr_idx) != Interface) {
03571
03572
03573
03574
03575
03576 attr_idx = ntr_sym_tbl(&token, name_idx);
03577 AT_OBJ_CLASS(attr_idx) = Interface;
03578 LN_DEF_LOC(name_idx) = TRUE;
03579 new_attr = TRUE;
03580
03581 if (generic_name) {
03582 ATI_INTERFACE_CLASS(attr_idx) = Generic_Unknown_Interface;
03583 }
03584 }
03585 else if (AT_NOT_VISIBLE(host_attr_idx)) {
03586 PRINTMSG(TOKEN_LINE(token), 486, Error,
03587 TOKEN_COLUMN(token),
03588 AT_OBJ_NAME_PTR(host_attr_idx),
03589 AT_OBJ_NAME_PTR(AT_MODULE_IDX((host_attr_idx))));
03590 attr_idx = ntr_sym_tbl(&token, name_idx);
03591 AT_OBJ_CLASS(attr_idx) = Interface;
03592 LN_DEF_LOC(name_idx) = TRUE;
03593 new_attr = TRUE;
03594
03595 if (generic_name) {
03596 ATI_INTERFACE_CLASS(attr_idx) = Generic_Unknown_Interface;
03597 }
03598 }
03599 else {
03600
03601
03602 if (AT_IS_INTRIN(host_attr_idx) &&
03603 ATI_FIRST_SPECIFIC_IDX(host_attr_idx) == NULL_IDX) {
03604 complete_intrinsic_definition(host_attr_idx);
03605 attr_idx = srch_sym_tbl(TOKEN_STR(token),
03606 TOKEN_LEN(token),
03607 &name_idx);
03608 }
03609
03610 attr_idx = ntr_host_in_sym_tbl(&token,
03611 name_idx,
03612 host_attr_idx,
03613 host_name_idx,
03614 TRUE);
03615
03616 type_idx = (AT_TYPED(host_attr_idx)) ? ATD_TYPE_IDX(host_attr_idx) :
03617 NULL_IDX;
03618
03619 COPY_VARIANT_ATTR_INFO(host_attr_idx, attr_idx, Interface);
03620
03621 LN_DEF_LOC(name_idx) = TRUE;
03622 AT_ATTR_LINK(attr_idx) = NULL_IDX;
03623 AT_IS_INTRIN(attr_idx) = AT_IS_INTRIN(host_attr_idx);
03624 AT_ELEMENTAL_INTRIN(attr_idx) = AT_ELEMENTAL_INTRIN(host_attr_idx);
03625 ATD_TYPE_IDX(attr_idx) = type_idx;
03626 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
03627 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
03628 }
03629 }
03630 else if ((!AT_USE_ASSOCIATED(attr_idx) ||
03631 AT_OBJ_CLASS(attr_idx) != Pgm_Unit ||
03632 ATP_PROC(attr_idx) != Module_Proc) &&
03633 fnd_semantic_err(Obj_Generic_Interface,
03634 TOKEN_LINE(token),
03635 TOKEN_COLUMN(token),
03636 attr_idx,
03637 TRUE)) {
03638 CREATE_ERR_ATTR(attr_idx, TOKEN_LINE(token),
03639 TOKEN_COLUMN(token), Interface);
03640 AT_OBJ_CLASS(attr_idx) = Interface;
03641 }
03642 else if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit) {
03643
03644
03645
03646 NTR_ATTR_TBL(new_attr_idx);
03647 COPY_COMMON_ATTR_INFO(attr_idx, new_attr_idx, Interface);
03648 AT_DEF_LINE(new_attr_idx) = TOKEN_LINE(token);
03649 AT_DEF_COLUMN(new_attr_idx) = TOKEN_COLUMN(token);
03650 ATI_PROC_IDX(new_attr_idx) = attr_idx;
03651 LN_ATTR_IDX(name_idx) = new_attr_idx;
03652 LN_NAME_IDX(name_idx) = AT_NAME_IDX(new_attr_idx);
03653
03654 if (ATP_RSLT_IDX(attr_idx) != NULL_IDX &&
03655 AT_TYPED(ATP_RSLT_IDX(attr_idx))) {
03656 ATD_TYPE_IDX(new_attr_idx) = ATD_TYPE_IDX(ATP_RSLT_IDX(attr_idx));
03657 }
03658
03659 attr_idx = new_attr_idx;
03660
03661 if (generic_name) {
03662 ATI_INTERFACE_CLASS(attr_idx) = Generic_Unknown_Interface;
03663 }
03664 }
03665 else if (AT_OBJ_CLASS(attr_idx) != Interface) {
03666 scp_idx = curr_scp_idx;
03667 curr_scp_idx = INTRINSIC_SCP_IDX;
03668 host_attr_idx = srch_sym_tbl(TOKEN_STR(token),
03669 TOKEN_LEN(token),
03670 &host_name_idx);
03671 curr_scp_idx = scp_idx;
03672
03673 if (host_attr_idx == NULL_IDX) {
03674 CLEAR_VARIANT_ATTR_INFO(attr_idx, Interface);
03675 type_idx = NULL_IDX;
03676 }
03677 else {
03678 complete_intrinsic_definition(host_attr_idx);
03679 COPY_VARIANT_ATTR_INFO(host_attr_idx, attr_idx, Interface);
03680 AT_ATTR_LINK(attr_idx) = NULL_IDX;
03681 AT_IS_INTRIN(attr_idx) = AT_IS_INTRIN(host_attr_idx);
03682 AT_ELEMENTAL_INTRIN(attr_idx) = AT_ELEMENTAL_INTRIN(host_attr_idx);
03683 type_idx = ATD_TYPE_IDX(host_attr_idx);
03684 }
03685
03686 ATD_TYPE_IDX(attr_idx) = type_idx;
03687 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
03688 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
03689 }
03690 }
03691 else if (CURR_BLK == Module_Blk) {
03692
03693 if (attr_idx == NULL_IDX) {
03694 attr_idx = ntr_sym_tbl(&token, name_idx);
03695 LN_DEF_LOC(name_idx) = TRUE;
03696 new_attr = TRUE;
03697
03698 if (generic_name) {
03699 SET_IMPL_TYPE(attr_idx);
03700 }
03701 else {
03702 AT_OBJ_CLASS(attr_idx) = Interface;
03703 }
03704 }
03705 }
03706 else if (attr_idx == NULL_IDX) {
03707 attr_idx = ntr_sym_tbl(&token, name_idx);
03708 LN_DEF_LOC(name_idx) = TRUE;
03709 new_attr = TRUE;
03710
03711 if (generic_name) {
03712 SET_IMPL_TYPE(attr_idx);
03713 }
03714 else {
03715 AT_OBJ_CLASS(attr_idx) = Interface;
03716 }
03717 }
03718 else if (AT_REFERENCED(attr_idx) == Char_Rslt_Bound_Ref) {
03719 AT_ATTR_LINK(attr_idx) = NULL_IDX;
03720 LN_DEF_LOC(name_idx) = TRUE;
03721 }
03722
03723
03724
03725
03726
03727
03728
03729
03730 if (stmt_type == Interface_Stmt &&
03731 AT_OBJ_CLASS(attr_idx) == Interface && generic_name) {
03732 ATI_USER_SPECIFIED(attr_idx) = TRUE;
03733 }
03734
03735
03736 if (new_attr && !generic_name) {
03737
03738 switch (TOKEN_VALUE(token)) {
03739 case Tok_Op_Add :
03740 ATI_DEFINED_OPR(attr_idx) = Plus_Opr;
03741 ATI_INTERFACE_CLASS(attr_idx) = Defined_Unary_Or_Binary_Interface;
03742 break;
03743
03744 case Tok_Op_Div :
03745 ATI_DEFINED_OPR(attr_idx) = Div_Opr;
03746 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03747 break;
03748
03749 case Tok_Op_Mult :
03750 ATI_DEFINED_OPR(attr_idx) = Mult_Opr;
03751 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03752 break;
03753
03754 case Tok_Op_Power :
03755 ATI_DEFINED_OPR(attr_idx) = Power_Opr;
03756 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03757 break;
03758
03759 case Tok_Op_Sub :
03760 ATI_DEFINED_OPR(attr_idx) = Minus_Opr;
03761 ATI_INTERFACE_CLASS(attr_idx) = Defined_Unary_Or_Binary_Interface;
03762 break;
03763
03764 case Tok_Op_Concat :
03765 ATI_DEFINED_OPR(attr_idx) = Concat_Opr;
03766 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03767 break;
03768
03769 case Tok_Op_Eq :
03770 ATI_DEFINED_OPR(attr_idx) = Eq_Opr;
03771 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03772 break;
03773
03774 case Tok_Op_Ge :
03775 ATI_DEFINED_OPR(attr_idx) = Ge_Opr;
03776 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03777 break;
03778
03779 case Tok_Op_Gt :
03780 ATI_DEFINED_OPR(attr_idx) = Gt_Opr;
03781 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03782 break;
03783
03784 case Tok_Op_Le :
03785 ATI_DEFINED_OPR(attr_idx) = Le_Opr;
03786 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03787 break;
03788
03789 case Tok_Op_Lt :
03790 ATI_DEFINED_OPR(attr_idx) = Lt_Opr;
03791 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03792 break;
03793
03794 case Tok_Op_Ne :
03795 ATI_DEFINED_OPR(attr_idx) = Ne_Opr;
03796 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03797 break;
03798
03799 case Tok_Op_Lg :
03800 ATI_DEFINED_OPR(attr_idx) = Lg_Opr;
03801 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03802 break;
03803
03804 case Tok_Op_And :
03805 ATI_DEFINED_OPR(attr_idx) = And_Opr;
03806 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03807 break;
03808
03809 case Tok_Op_Eqv :
03810 ATI_DEFINED_OPR(attr_idx) = Eqv_Opr;
03811 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03812 break;
03813
03814 case Tok_Op_Neqv :
03815 ATI_DEFINED_OPR(attr_idx) = Neqv_Opr;
03816 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03817 break;
03818
03819 case Tok_Op_Not :
03820 ATI_DEFINED_OPR(attr_idx) = Not_Opr;
03821 ATI_INTERFACE_CLASS(attr_idx) = Defined_Unary_Interface;
03822 break;
03823
03824 case Tok_Op_Or :
03825 ATI_DEFINED_OPR(attr_idx) = Or_Opr;
03826 ATI_INTERFACE_CLASS(attr_idx) = Defined_Binary_Interface;
03827 break;
03828
03829 case Tok_Op_Assign :
03830 ATI_DEFINED_OPR(attr_idx) = Asg_Opr;
03831 ATI_INTERFACE_CLASS(attr_idx) = Defined_Assign_Interface;
03832 break;
03833
03834 case Tok_Op_Defined :
03835 ATI_DEFINED_OPR(attr_idx) = Null_Opr;
03836 ATI_INTERFACE_CLASS(attr_idx) = Defined_Unary_Or_Binary_Interface;
03837 break;
03838 }
03839 }
03840
03841 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
03842 ATD_SEEN_OUTSIDE_IMP_DO(attr_idx) = TRUE;
03843 }
03844
03845 if ((cif_flags & XREF_RECS) != 0) {
03846 cif_usage_rec(attr_idx,
03847 AT_Tbl_Idx,
03848 TOKEN_LINE(token),
03849 TOKEN_COLUMN(token),
03850 CIF_Symbol_Declaration);
03851 }
03852
03853 TRACE (Func_Exit, "generic_spec_semantics", NULL);
03854
03855 return(attr_idx);
03856
03857 }
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868
03869
03870
03871
03872
03873
03874
03875
03876
03877
03878
03879
03880 static boolean is_attr_referenced_in_bound(int bd_idx,
03881 int attr_idx)
03882
03883 {
03884 boolean error = FALSE;
03885 opnd_type opnd;
03886 int rank;
03887
03888
03889 TRACE (Func_Entry, "is_attr_referenced_in_bound", NULL);
03890
03891 if (BD_ARRAY_CLASS(bd_idx) != Deferred_Shape) {
03892
03893 for (rank = BD_RANK(bd_idx); rank >0; rank--) {
03894
03895 if (BD_LB_FLD(bd_idx, rank) == AT_Tbl_Idx &&
03896 ATD_FLD(BD_LB_IDX(bd_idx, rank)) == IR_Tbl_Idx &&
03897 find_attr_in_ir(attr_idx,
03898 ATD_TMP_IDX(BD_LB_IDX(bd_idx, rank)),
03899 &opnd)) {
03900 AT_DCL_ERR(attr_idx) = TRUE;
03901 BD_DCL_ERR(bd_idx) = TRUE;
03902 error = TRUE;
03903 PRINTMSG(OPND_LINE_NUM(opnd), 1036, Error,
03904 OPND_COL_NUM(opnd),
03905 AT_OBJ_NAME_PTR(attr_idx));
03906 break;
03907 }
03908
03909 if (BD_UB_FLD(bd_idx, rank) == AT_Tbl_Idx &&
03910 ATD_FLD(BD_UB_IDX(bd_idx, rank)) == IR_Tbl_Idx &&
03911 find_attr_in_ir(attr_idx,
03912 ATD_TMP_IDX(BD_UB_IDX(bd_idx, rank)),
03913 &opnd)) {
03914 AT_DCL_ERR(attr_idx) = TRUE;
03915 BD_DCL_ERR(bd_idx) = TRUE;
03916 error = TRUE;
03917 PRINTMSG(OPND_LINE_NUM(opnd), 1036, Error,
03918 OPND_COL_NUM(opnd),
03919 AT_OBJ_NAME_PTR(attr_idx));
03920 break;
03921 }
03922 }
03923 }
03924
03925 TRACE (Func_Exit, "is_attr_referenced_in_bound", NULL);
03926
03927 return(error);
03928
03929 }
03930
03931
03932
03933
03934
03935
03936
03937
03938
03939
03940
03941
03942
03943
03944
03945
03946
03947
03948
03949
03950 int parse_pe_array_spec(int attr_idx)
03951
03952 {
03953 int bd_idx;
03954 int column;
03955 boolean fold_it;
03956 boolean found_end = FALSE;
03957 boolean found_error = FALSE;
03958 fld_type lb_fld;
03959 long lb_len_idx;
03960 int line;
03961 boolean lower_bound_found;
03962 boolean non_constant_size = FALSE;
03963 int rank = 1;
03964 reference_type referenced;
03965 fld_type ub_fld;
03966 long ub_len_idx;
03967
03968
03969 TRACE (Func_Entry, "parse_pe_array_spec", NULL);
03970
03971 # ifdef _DEBUG
03972 if (LA_CH_VALUE != LBRKT) {
03973 PRINTMSG(LA_CH_LINE, 295, Internal, LA_CH_COLUMN,
03974 "parse_pe_array_spec", "LBRKT");
03975 }
03976 # endif
03977
03978 NEXT_LA_CH;
03979 bd_idx = reserve_array_ntry(7);
03980 referenced = (reference_type) AT_REFERENCED(attr_idx);
03981 AT_REFERENCED(attr_idx) = Not_Referenced;
03982 BD_LINE_NUM(bd_idx) = LA_CH_LINE;
03983 BD_COLUMN_NUM(bd_idx) = LA_CH_COLUMN;
03984
03985
03986
03987
03988 if (LA_CH_VALUE == RBRKT) {
03989 parse_err_flush(Find_None, "dimension-spec");
03990 BD_ARRAY_CLASS(bd_idx) = Explicit_Shape;
03991 BD_ARRAY_SIZE(bd_idx) = Constant_Size;
03992 BD_DCL_ERR(bd_idx) = TRUE;
03993 BD_RANK(bd_idx) = 1;
03994 BD_LB_FLD(bd_idx, 1) = CN_Tbl_Idx;
03995 BD_LB_IDX(bd_idx, 1) = CN_INTEGER_ONE_IDX;
03996 BD_UB_FLD(bd_idx, 1) = CN_Tbl_Idx;
03997 BD_UB_IDX(bd_idx, 1) = CN_INTEGER_ONE_IDX;
03998 NEXT_LA_CH;
03999 goto EXIT;
04000 }
04001
04002
04003
04004
04005 fold_it = (CURR_BLK == Derived_Type_Blk);
04006
04007 do {
04008 lower_bound_found = FALSE;
04009 lb_len_idx = CN_INTEGER_ONE_IDX;
04010 lb_fld = CN_Tbl_Idx;
04011 ub_len_idx = NULL_IDX;
04012 ub_fld = NO_Tbl_Idx;
04013
04014 if (LA_CH_VALUE != COLON && LA_CH_VALUE != STAR) {
04015 line = LA_CH_LINE;
04016 column = LA_CH_COLUMN;
04017
04018
04019
04020
04021
04022 if (!parse_int_spec_expr(&ub_len_idx, &ub_fld, fold_it, FALSE)) {
04023 ub_len_idx = CN_INTEGER_ONE_IDX;
04024 ub_fld = CN_Tbl_Idx;
04025 BD_DCL_ERR(bd_idx) = TRUE;
04026 }
04027
04028 if (ub_fld != CN_Tbl_Idx) {
04029 non_constant_size = TRUE;
04030 }
04031
04032 if (LA_CH_VALUE == COLON) {
04033 lower_bound_found = TRUE;
04034 lb_len_idx = ub_len_idx;
04035 lb_fld = ub_fld;
04036 ub_len_idx = NULL_IDX;
04037 ub_fld = NO_Tbl_Idx;
04038 }
04039 else {
04040 BD_ARRAY_CLASS(bd_idx) = Explicit_Shape;
04041 }
04042 }
04043
04044
04045
04046
04047
04048
04049
04050
04051
04052
04053 if (LA_CH_VALUE == COLON) {
04054 line = LA_CH_LINE;
04055 column = LA_CH_COLUMN;
04056 NEXT_LA_CH;
04057
04058 if (LA_CH_VALUE == COMMA || LA_CH_VALUE == RBRKT) {
04059
04060
04061
04062
04063
04064
04065 if (BD_ARRAY_CLASS(bd_idx) == Explicit_Shape) {
04066 PRINTMSG(line, 115, Error, column);
04067 BD_DCL_ERR(bd_idx) = TRUE;
04068 }
04069 else {
04070 BD_ARRAY_CLASS(bd_idx) = Deferred_Shape;
04071 }
04072 }
04073 else {
04074
04075
04076
04077
04078
04079
04080 if (!lower_bound_found) {
04081 PRINTMSG(LA_CH_LINE, 119, Error, LA_CH_COLUMN, &LA_CH_VALUE);
04082 BD_DCL_ERR(bd_idx) = TRUE;
04083 }
04084
04085 if (LA_CH_VALUE != STAR) {
04086 line = LA_CH_LINE;
04087 column = LA_CH_COLUMN;
04088
04089 if (!parse_int_spec_expr(&ub_len_idx, &ub_fld, fold_it, FALSE)) {
04090
04091
04092
04093 BD_DCL_ERR(bd_idx) = TRUE;
04094 ub_len_idx = CN_INTEGER_ONE_IDX;
04095 ub_fld = CN_Tbl_Idx;
04096 }
04097
04098 if (ub_fld != CN_Tbl_Idx) {
04099 non_constant_size = TRUE;
04100 }
04101
04102 BD_ARRAY_CLASS(bd_idx)= Explicit_Shape;
04103 }
04104 }
04105 }
04106
04107
04108
04109
04110
04111
04112
04113 if (LA_CH_VALUE == STAR) {
04114 line = LA_CH_LINE;
04115 column = LA_CH_COLUMN;
04116 NEXT_LA_CH;
04117
04118 BD_ARRAY_CLASS(bd_idx) = Assumed_Size;
04119 ub_len_idx = lb_len_idx;
04120 ub_fld = lb_fld;
04121
04122 if (LA_CH_VALUE != RBRKT) {
04123
04124
04125
04126 BD_DCL_ERR(bd_idx) = TRUE;
04127 PRINTMSG(line, 116, Error, column);
04128 parse_err_flush(Find_Rparen, NULL);
04129 }
04130 }
04131
04132 BD_LB_IDX(bd_idx, rank) = lb_len_idx;
04133 BD_LB_FLD(bd_idx, rank) = lb_fld;
04134 BD_UB_IDX(bd_idx, rank) = ub_len_idx;
04135 BD_UB_FLD(bd_idx, rank) = ub_fld;
04136
04137 if (LA_CH_VALUE == COMMA) {
04138
04139 if (rank++ == 7) {
04140 found_end = TRUE;
04141 BD_DCL_ERR(bd_idx) = TRUE;
04142 PRINTMSG(LA_CH_LINE, 117, Error, LA_CH_COLUMN);
04143 parse_err_flush(Find_Rparen, NULL);
04144 }
04145 else {
04146 NEXT_LA_CH;
04147 }
04148 }
04149 else {
04150 found_end = TRUE;
04151 }
04152
04153 found_error = BD_DCL_ERR(bd_idx) | found_error;
04154 }
04155 while (!found_end);
04156
04157 if (LA_CH_VALUE == RBRKT ||
04158 parse_err_flush(Find_EOS, (found_error) ? NULL : ", or )")) {
04159
04160 NEXT_LA_CH;
04161 }
04162
04163 if (!non_constant_size) {
04164 BD_ARRAY_SIZE(bd_idx) = Constant_Size;
04165 }
04166
04167 BD_RANK(bd_idx) = rank;
04168
04169 # ifdef _DEBUG
04170 if (BD_ARRAY_CLASS(bd_idx) == Unknown_Array) {
04171
04172
04173
04174 PRINTMSG(LA_CH_LINE, 178, Internal, LA_CH_COLUMN);
04175 }
04176 # endif
04177
04178 EXIT:
04179
04180 if (AT_REFERENCED(attr_idx) > Not_Referenced) {
04181 is_attr_referenced_in_bound(bd_idx, attr_idx);
04182 }
04183
04184 if (AT_REFERENCED(attr_idx) < referenced) {
04185 AT_REFERENCED(attr_idx) = referenced;
04186 }
04187
04188 bd_idx = ntr_array_in_bd_tbl(bd_idx);
04189
04190 TRACE (Func_Exit, "parse_pe_array_spec", NULL);
04191
04192 return(bd_idx);
04193
04194 }
04195
04196
04197
04198
04199
04200
04201
04202
04203
04204
04205
04206
04207
04208
04209
04210
04211
04212
04213
04214
04215
04216
04217 boolean merge_co_array(boolean chk_semantics,
04218 int line,
04219 int column,
04220 int attr_idx,
04221 int pe_array_idx)
04222 {
04223 boolean fnd_err;
04224
04225
04226 TRACE (Func_Entry, "merge_co_array", NULL);
04227
04228 if (!chk_semantics || !fnd_semantic_err(Obj_Co_Array,
04229 line,
04230 column,
04231 attr_idx,
04232 TRUE)) {
04233 ATD_PE_ARRAY_IDX(attr_idx) = pe_array_idx;
04234 fnd_err = FALSE;
04235 }
04236 else {
04237 fnd_err = TRUE;
04238 }
04239
04240 TRACE (Func_Exit, "merge_co_array", NULL);
04241
04242 return(!fnd_err);
04243
04244 }
04245
04246
04247
04248
04249
04250
04251
04252
04253
04254
04255
04256
04257
04258
04259
04260
04261
04262
04263
04264
04265
04266 boolean merge_volatile(boolean chk_semantics,
04267 int line,
04268 int column,
04269 int attr_idx)
04270
04271 {
04272 boolean fnd_err = FALSE;
04273
04274
04275 TRACE (Func_Entry, "merge_volatile", NULL);
04276
04277 if (chk_semantics) {
04278 fnd_err = fnd_semantic_err(Obj_Volatile, line, column, attr_idx, TRUE);
04279
04280 #ifdef KEY
04281 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
04282 ATD_INTENT(attr_idx) == Intent_In) {
04283 PRINTMSG(line, 550, Error, column, AT_OBJ_NAME_PTR(attr_idx),
04284 "INTENT(IN)", "VOLATILE", AT_DEF_LINE(attr_idx));
04285 }
04286 #endif
04287 if (!fnd_err && ATD_VOLATILE(attr_idx)) {
04288 #ifdef KEY
04289 PRINTMSG(line, 1259, ansi_or_warning(), column,
04290 AT_OBJ_NAME_PTR(attr_idx), AT_DEF_LINE(attr_idx), "VOLATILE");
04291 #else
04292 PRINTMSG(line, 1259, Ansi, column, AT_OBJ_NAME_PTR(attr_idx),
04293 "VOLATILE");
04294 #endif
04295 }
04296 }
04297 else {
04298 SET_IMPL_TYPE(attr_idx);
04299 }
04300
04301 if (!fnd_err) {
04302 ATD_VOLATILE(attr_idx) = TRUE;
04303 }
04304
04305 TRACE (Func_Exit, "merge_volatile", NULL);
04306
04307 return(!fnd_err);
04308
04309 }
04310 #ifdef KEY
04311
04312
04313
04314
04315
04316
04317
04318
04319
04320
04321
04322
04323
04324
04325
04326
04327 int
04328 parse_language_binding_spec(token_type *result) {
04329 int ok = 1;
04330 if (result) {
04331 TOKEN_LEN(*result) = 0;
04332 TOKEN_LINE(*result) = LA_CH_LINE;
04333 TOKEN_COLUMN(*result) = LA_CH_COLUMN;
04334 SET_BIND_SPECIFIES_NAME(*result, FALSE);
04335 }
04336
04337 if (LA_CH_VALUE != LPAREN) {
04338 parse_err_flush(Find_EOS, "(");
04339 return 0;
04340 }
04341 NEXT_LA_CH;
04342 if (LA_CH_VALUE != 'C' && LA_CH_VALUE != 'c') {
04343 parse_err_flush(Find_EOS, "C");
04344 return 0;
04345 }
04346 NEXT_LA_CH;
04347 if (result) {
04348 if (LA_CH_VALUE == COMMA) {
04349 NEXT_LA_CH;
04350 if (!matched_specific_token(Tok_Kwd_Name, Tok_Class_Keyword)) {
04351 parse_err_flush(Find_Rparen, "NAME");
04352 if (LA_CH_VALUE == RPAREN) {
04353 NEXT_LA_CH;
04354 }
04355 return 0;
04356 }
04357 if (LA_CH_VALUE != EQUAL) {
04358 parse_err_flush(Find_Rparen, "=");
04359 if (LA_CH_VALUE == RPAREN) {
04360 NEXT_LA_CH;
04361 }
04362 return 0;
04363 }
04364 NEXT_LA_CH;
04365 opnd_type opnd;
04366 check_type_conversion = FALSE;
04367 target_type_idx = 0;
04368 target_char_len_idx = 0;
04369 expr_arg_type exp_desc = init_exp_desc;
04370 exp_desc.rank = 0;
04371 expr_mode_type save_expr_mode = expr_mode;
04372 expr_mode = Initialization_Expr;
04373 xref_state = CIF_Symbol_Reference;
04374 comp_gen_expr = TRUE;
04375 if (parse_expr(&opnd) && expr_semantics(&opnd, &exp_desc)) {
04376 TOKEN_LINE(*result) = opnd.line_num;
04377 TOKEN_COLUMN(*result) = opnd.col_num;
04378 if (exp_desc.type != Character ||
04379 exp_desc.linear_type != Short_Char_Const ||
04380 !exp_desc.constant || exp_desc.rank) {
04381 PRINTMSG(opnd.line_num, 1690, Error, opnd.col_num);
04382 ok = 0;
04383 }
04384 else {
04385 int len = CN_INT_TO_C(exp_desc.char_len.idx);
04386
04387 memcpy(TOKEN_STR(*result), (char *) &CN_CONST(opnd.idx), len);
04388 TOKEN_LEN(*result) = len;
04389 SET_BIND_SPECIFIES_NAME(*result, TRUE);
04390 }
04391 }
04392 expr_mode = save_expr_mode;
04393 }
04394 }
04395 if (LA_CH_VALUE != RPAREN) {
04396 parse_err_flush(Find_Rparen, ")");
04397 if (LA_CH_VALUE == RPAREN) {
04398 NEXT_LA_CH;
04399 return 0;
04400 }
04401 }
04402 NEXT_LA_CH;
04403 return ok;
04404 }
04405 #endif