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/src_input.c 5.5 10/20/99 17:17:46\n";
00046
00047
00048 #ifdef KEY
00049 #include <errno.h>
00050 #endif
00051
00052 # include "defines.h"
00053
00054 # include "host.m"
00055 # include "host.h"
00056 # include "target.m"
00057 # include "target.h"
00058
00059 # include "globals.m"
00060 # include "tokens.m"
00061 # include "sytb.m"
00062 # include "p_globals.m"
00063 # include "src_input.m"
00064 # include "debug.m"
00065
00066 # include "globals.h"
00067 # include "tokens.h"
00068 # include "sytb.h"
00069 # include "p_globals.h"
00070 # include "src_input.h"
00071
00072 #ifdef KEY
00073
00074 extern char *preprocessor_output_file;
00075 #endif
00076
00077
00078
00079
00080
00081
00082 static boolean is_pound_line_dir(void);
00083 static void fixed_classify_line (void);
00084 static void fixed_get_stmt (void);
00085 boolean read_line (boolean);
00086 static void free_classify_line (void);
00087 static void free_get_stmt (void);
00088 void ntr_next_msg_queue(int,int,msg_severities_type,
00089 int,char *, long,int);
00090 static void move_up_next_msg_queue(void);
00091 #ifdef KEY
00092 static boolean open_include_file (boolean, boolean);
00093 #else
00094 static boolean open_include_file (boolean);
00095 #endif
00096 static void update_global_line (void);
00097 static int whats_after_paren_group(int *, int *, int);
00098 static int whats_after_brkt_group(int *, int *, int);
00099 static void print_nxt_line(void);
00100 static void classify_line(void);
00101 static boolean get_nxt_line(void);
00102 static void pp_get_stmt (void);
00103 static void shift_to_line_size(int);
00104
00105
00106 # pragma _CRI align fixed_get_char
00107 # pragma _CRI inline scan_thru_close_paren
00108
00109 static boolean issue_classify_msg = TRUE;
00110
00111 # ifdef _DEBUG
00112
00113 static void print_stmt (void);
00114 static void print_src (void);
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 static void print_stmt()
00141
00142 {
00143 int idx;
00144 int line;
00145 int ich2;
00146
00147
00148 for (line = 1; line <= lines_in_buf; line++) {
00149
00150 for (idx = 0;
00151 (((ich2 = stmt_buf[idx + stmt_line_start_idx[line]]) != newline)
00152 && (ich2 != eos));
00153 idx++) {
00154 fprintf(stderr, "%c", ich2);
00155 }
00156 fprintf(stderr, "\n");
00157 }
00158
00159 return;
00160
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 static void print_src()
00182 {
00183 int idx;
00184 int line;
00185
00186 if (source_form == Fixed_Form) {
00187 fprintf(stderr, "Fixed_Form\n");
00188 }
00189 else {
00190 fprintf(stderr, "Free_Form\n");
00191 }
00192
00193 for (line = 1; line <= lines_in_buf; line++) {
00194
00195 fprintf(stderr, "global line num = %d\n", stmt_line_num[line]);
00196 for (idx = stmt_line_start_idx[line]; idx < stmt_line_end_idx[line];
00197 idx++) {
00198
00199 if (stmt_buf[idx] < 0) {
00200 fprintf(stderr, "^%c", stmt_buf[idx]);
00201 }
00202 else {
00203 fprintf(stderr, "%c", stmt_buf[idx]);
00204 }
00205 }
00206 fprintf(stderr, "\n");
00207 }
00208 fprintf(stderr, "*******************************************************\n");
00209
00210 return;
00211
00212 }
00213
00214 # endif
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 void init_src_input (void)
00236
00237 {
00238 TRACE (Func_Entry, "init_src_input", NULL);
00239
00240 dot_i_fptr = stdout;
00241
00242 #ifdef KEY
00243 char *filename = 0;
00244 #endif
00245 if (on_off_flags.save_dot_i) {
00246 filename = dot_i_file;
00247 }
00248 #ifdef KEY
00249 else if (preprocessor_output_file) {
00250 filename = preprocessor_output_file;
00251 }
00252 if (filename) {
00253 dot_i_fptr = fopen(filename, "w");
00254 if (!dot_i_fptr) {
00255 PRINTMSG(0, 1676, Log_Error, 0, filename, strerror(errno));
00256 exit_compiler (RC_USER_ERROR);
00257 }
00258 }
00259 #endif
00260
00261 previous_global_line = 0;
00262
00263
00264
00265 CHECK_INITIAL_ALLOC(src_stk, 1);
00266
00267
00268
00269 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx) = NULL_IDX;
00270 SRC_STK_PREV_SRC_FORM(src_stk_idx) = source_form;
00271
00272
00273
00274 if (src_file[0] == EOS) {
00275 SRC_STK_FILE_LINE(SRC_STK_BASE_IDX) = 0;
00276 SRC_STK_FILE_TYPE(SRC_STK_BASE_IDX) = Stdin_Src;
00277 SRC_STK_FILE_PTR(SRC_STK_BASE_IDX) = stdin;
00278 strcpy (src_file, "'stdin'");
00279 }
00280 else {
00281 SRC_STK_FILE_LINE(SRC_STK_BASE_IDX) = 0;
00282 SRC_STK_FILE_TYPE(SRC_STK_BASE_IDX) = Input_Src;
00283
00284 SRC_STK_FILE_PTR(SRC_STK_BASE_IDX) = fopen (src_file, "r");
00285
00286 if (SRC_STK_FILE_PTR(SRC_STK_BASE_IDX) == NULL) {
00287 PRINTMSG (0, 49, Log_Error, 0, src_file);
00288 exit_compiler (RC_USER_ERROR);
00289 }
00290 }
00291
00292 if (on_off_flags.output_pound_lines &&
00293 (on_off_flags.preprocess_only || on_off_flags.save_dot_i)) {
00294 fprintf(dot_i_fptr, "# 1 \"%s\"\n", src_file);
00295 }
00296
00297
00298
00299 if (src_file[0] != SLASH)
00300 {
00301 getcwd (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), MAX_FILE_NAME_SIZE);
00302
00303 strcat (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), "/");
00304 SRC_STK_FILE_IDX(SRC_STK_BASE_IDX) =
00305 strlen(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX));
00306 strcat (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), src_file);
00307 }
00308 else {
00309 SRC_STK_FILE_IDX(SRC_STK_BASE_IDX) = 0;
00310 strcpy (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), src_file);
00311 }
00312
00313
00314
00315 update_global_line();
00316
00317
00318
00319
00320 GL_GLOBAL_LINE(global_line_tbl_idx) = 1;
00321 GL_FILE_LINE(global_line_tbl_idx) = 1;
00322
00323
00324
00325 starting_pt = NULL_IDX;
00326
00327
00328
00329 have_issued_msg_37 = FALSE;
00330
00331 havent_issued_tab_ansi = TRUE;
00332 havent_issued_at_ansi = TRUE;
00333 havent_issued_dollar_ansi = TRUE;
00334
00335 nxt_line_start_idx[0] = 0;
00336 nxt_line_end_idx[0] = 0;
00337 nxt_line_col[0] = 0;
00338 nxt_line_num_lines = 1;
00339 pp_line_idx = 1;
00340
00341 pp_nxt_line_type[0] = Regular_Line;
00342
00343
00344
00345 nxt_line_start_idx[1] = 1;
00346 nxt_line_end_idx[1] = 2;
00347 nxt_line[0] = blank;
00348 nxt_line[1] = newline;
00349 nxt_line[2] = eos;
00350 nxt_line_idx = 1;
00351 nxt_line_num = 0;
00352 nxt_line_type = Comment_Line;
00353 PP_LINE_TYPE = Comment_Line;
00354 PP_EOL = 1;
00355
00356 if (source_form == Fixed_Form) {
00357
00358 if (cmd_line_flags.line_size_80) {
00359 line_size = FIXED_SRC_LINE_SIZE_80;
00360 }
00361 else if (cmd_line_flags.line_size_132) {
00362 line_size = FIXED_SRC_LINE_SIZE_132;
00363 }
00364 else {
00365 line_size = FIXED_SRC_LINE_SIZE_72;
00366 }
00367
00368 if (! on_off_flags.preprocess_only) {
00369 fixed_get_stmt ();
00370 }
00371 }
00372 else {
00373
00374 line_size = FREE_SRC_LINE_SIZE;
00375 if (! on_off_flags.preprocess_only) {
00376 expected_line = Regular_Line;
00377 free_get_stmt ();
00378 }
00379 }
00380
00381 if (change_orig_src_file) {
00382
00383
00384 if (pound_file[0] != SLASH) {
00385 getcwd (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), MAX_FILE_NAME_SIZE);
00386 strcat (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), "/");
00387 SRC_STK_FILE_IDX(SRC_STK_BASE_IDX) =
00388 strlen(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX));
00389 strcat (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), pound_file);
00390 }
00391 else {
00392 SRC_STK_FILE_IDX(SRC_STK_BASE_IDX) = 0;
00393 strcpy (SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), pound_file);
00394 }
00395
00396
00397
00398
00399 c_i_f = cif_actual_file;
00400 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX) =
00401 cif_file_name_rec(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), pound_file);
00402
00403 if (cif_flags) {
00404 cif_source_file_rec(SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX),
00405 cmd_line_flags.src_form);
00406 }
00407
00408 c_i_f = cif_tmp_file;
00409
00410 cif_file_rec_issued = TRUE;
00411
00412 global_line_tbl_idx = 0;
00413 SRC_STK_FILE_LINE(SRC_STK_BASE_IDX) = 0;
00414 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx) = NULL_IDX;
00415 update_global_line();
00416
00417
00418
00419
00420 GL_CIF_FILE_ID(global_line_tbl_idx) =
00421 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX);
00422 GL_GLOBAL_LINE(global_line_tbl_idx) = 1;
00423 GL_FILE_LINE(global_line_tbl_idx) = 1;
00424
00425 if (source_form == Fixed_Form) {
00426 if (! on_off_flags.preprocess_only) {
00427 fixed_get_stmt ();
00428 }
00429 }
00430 else {
00431 if (! on_off_flags.preprocess_only) {
00432 expected_line = Regular_Line;
00433 free_get_stmt ();
00434 }
00435 }
00436 }
00437 else if (! cif_file_rec_issued ) {
00438
00439
00440
00441 c_i_f = cif_actual_file;
00442 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX) =
00443 cif_file_name_rec(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), src_file);
00444
00445 if (cif_flags) {
00446 cif_source_file_rec(SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX),
00447 cmd_line_flags.src_form);
00448 }
00449
00450 c_i_f = cif_tmp_file;
00451 cif_file_rec_issued = TRUE;
00452
00453
00454
00455
00456 GL_CIF_FILE_ID(global_line_tbl_idx) =
00457 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX);
00458 }
00459
00460 TRACE (Func_Exit, "init_src_input", SRC_STK_FILE_NAME(SRC_STK_BASE_IDX));
00461
00462 return;
00463
00464 }
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488 void reset_src_input (int buf_idx,
00489 int stmt_num)
00490
00491 {
00492 char ch;
00493 int i;
00494
00495 TRACE (Func_Entry, "reset_src_input", NULL);
00496
00497
00498
00499
00500
00501
00502 if (stmt_num != statement_number && !in_action_stmt_of_if_where_or_forall) {
00503 PRINTMSG (stmt_line_num[stmt_line_idx], 207, Internal, 1);
00504 }
00505
00506 if (buf_idx < 0) {
00507 PRINTMSG (stmt_line_num[stmt_line_idx], 626, Internal, 1,
00508 "valid buf_idx",
00509 "reset_src_input");
00510 }
00511
00512 stmt_line_idx = 0;
00513
00514 if (buf_idx == 0) {
00515 stmt_line_idx = 1;
00516 }
00517 else {
00518 for (i = 1; i <= lines_in_buf; i++) {
00519 if (buf_idx >= stmt_line_start_idx[i] &&
00520 buf_idx <= stmt_line_end_idx[i]) {
00521 stmt_line_idx = i;
00522 break;
00523 }
00524 }
00525 }
00526
00527 # ifdef _DEBUG
00528 if (stmt_line_idx == 0) {
00529 PRINTMSG(1,626,Internal,1,
00530 "valid stmt_line_idx",
00531 "reset_src_input");
00532 }
00533 # endif
00534
00535 stmt_buf_idx = buf_idx;
00536
00537 if (stmt_buf_idx == 0 ||
00538 stmt_buf[stmt_buf_idx] == '\0' ||
00539 stmt_buf[stmt_buf_idx] == '\n') {
00540 ch = ' ';
00541 }
00542 else {
00543 ch = stmt_buf[stmt_buf_idx];
00544 }
00545
00546 if (islower(ch)) {
00547 ch = TOUPPER(ch);
00548 }
00549
00550 LA_CH_VALUE = ch;
00551 LA_CH_LINE = stmt_line_num[stmt_line_idx];
00552 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
00553 LA_CH_BUF_IDX = stmt_buf_idx;
00554 LA_CH_STMT_NUM = statement_number;
00555 LA_CH_CLASS = (ch == (char) EOF) ? Ch_Class_EOF : ch_class[LA_CH_VALUE];
00556
00557 TRACE (Func_Exit, "reset_src_input", NULL);
00558
00559 return;
00560
00561 }
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583 void fixed_get_char (void)
00584
00585 {
00586 char ch;
00587 int ich;
00588
00589
00590 TRACE (Func_Entry, "fixed_get_char", NULL);
00591
00592
00593
00594 if (LA_CH_VALUE == EOS) {
00595 stmt_end_line = LA_CH_LINE;
00596 stmt_end_col = LA_CH_COLUMN - 1;
00597
00598 if (change_source_form) {
00599 change_source_form = FALSE;
00600 line_size = FREE_SRC_LINE_SIZE;
00601 expected_line = Regular_Line;
00602 get_char = free_get_char;
00603 get_char_literal = free_get_char_literal;
00604 source_form = Free_Form;
00605
00606 free_get_char ();
00607
00608 TRACE (Func_Exit, "fixed_get_char",
00609 ch_str[(unsigned char)LA_CH_VALUE]);
00610
00611 return;
00612 }
00613
00614 fixed_get_stmt ();
00615
00616
00617 while (stmt_buf_type == Comment_Line) {
00618 if (change_source_form) {
00619 change_source_form = FALSE;
00620 line_size = FREE_SRC_LINE_SIZE;
00621 expected_line = Regular_Line;
00622 get_char = free_get_char;
00623 get_char_literal = free_get_char_literal;
00624 source_form = Free_Form;
00625
00626 free_get_char ();
00627
00628 TRACE (Func_Exit, "fixed_get_char",
00629 ch_str[(unsigned char)LA_CH_VALUE]);
00630
00631 return;
00632 }
00633 else {
00634 fixed_get_stmt ();
00635 }
00636 }
00637
00638
00639 ich = stmt_buf[stmt_buf_idx + 1];
00640
00641 while (((ich == newline) |
00642 (ich == semi_colon) |
00643 (ich == bang)) &&
00644 (stmt_line_idx >= lines_in_buf)) {
00645
00646 fixed_get_stmt ();
00647
00648 while (stmt_buf_type == Comment_Line) {
00649 if (change_source_form) {
00650 change_source_form = FALSE;
00651 line_size = FREE_SRC_LINE_SIZE;
00652 expected_line = Regular_Line;
00653 get_char = free_get_char;
00654 get_char_literal = free_get_char_literal;
00655 source_form = Free_Form;
00656
00657 free_get_char ();
00658
00659 TRACE (Func_Exit, "fixed_get_char",
00660 ch_str[(unsigned char)LA_CH_VALUE]);
00661
00662 return;
00663 }
00664 else {
00665 fixed_get_stmt ();
00666 }
00667 }
00668
00669 ich = stmt_buf[stmt_buf_idx + 1];
00670 }
00671
00672 if (stmt_buf_type == Dir_Line) {
00673 ch = stmt_buf[stmt_buf_idx];
00674
00675 if (islower(ch)) {
00676 ch = TOUPPER(ch);
00677 }
00678
00679 LA_CH_VALUE = ch;
00680 LA_CH_LINE = stmt_line_num[stmt_line_idx];
00681 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
00682 LA_CH_BUF_IDX = stmt_buf_idx;
00683 LA_CH_STMT_NUM = statement_number;
00684
00685 switch (stmt_prefix_len) {
00686 case 1 :
00687 LA_CH_CLASS = Ch_Class_Dir1;
00688 break;
00689 case 2 :
00690 LA_CH_CLASS = Ch_Class_Dir2;
00691 break;
00692 case 3 :
00693 LA_CH_CLASS = Ch_Class_Dir3;
00694 break;
00695 case 4 :
00696 LA_CH_CLASS = Ch_Class_Dir4;
00697 break;
00698 }
00699
00700 TRACE (Func_Exit, "fixed_get_char",
00701 ch_str[(unsigned char) LA_CH_VALUE]);
00702
00703 return;
00704 }
00705 }
00706
00707
00708
00709 do {
00710 ich = stmt_buf[++stmt_buf_idx];
00711
00712 if (stmt_buf_idx == stmt_buf_EOS_idx) {
00713 ich = eos;
00714 }
00715 else if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
00716
00717 if (stmt_line_idx < lines_in_buf) {
00718 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
00719 + stmt_line_offset[stmt_line_idx];
00720
00721 ich = blank;
00722 }
00723 else {
00724 ich = eos;
00725 }
00726 }
00727 }
00728 while ((ich == blank) | (ich == tab));
00729
00730 LA_CH_LINE = stmt_line_num[stmt_line_idx];
00731 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
00732 LA_CH_BUF_IDX = stmt_buf_idx;
00733 LA_CH_STMT_NUM = statement_number;
00734
00735
00736 if (havent_issued_at_ansi && ich == at_sign) {
00737 havent_issued_at_ansi = FALSE;
00738 ntr_msg_queue(LA_CH_LINE, 900, Ansi,
00739 LA_CH_COLUMN,
00740 (char *)NULL,
00741 0,
00742 NO_ARG);
00743 }
00744
00745 if (havent_issued_dollar_ansi && ich == dollar) {
00746 havent_issued_dollar_ansi = FALSE;
00747 ntr_msg_queue(LA_CH_LINE, 901, Ansi,
00748 LA_CH_COLUMN,
00749 (char *)NULL,
00750 0,
00751 NO_ARG);
00752 }
00753
00754 ch = ich;
00755
00756 if (islower(ch)) {
00757 ch = TOUPPER(ch);
00758 }
00759
00760 LA_CH_VALUE = ch;
00761 LA_CH_CLASS = (ch == (char) EOF) ? Ch_Class_EOF : ch_class[LA_CH_VALUE];
00762
00763 TRACE (Func_Exit, "fixed_get_char", ch_str[(unsigned char) LA_CH_VALUE]);
00764
00765 return;
00766
00767 }
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787 void fixed_get_char_literal (void)
00788
00789 {
00790 char ch;
00791 int ich;
00792
00793
00794 TRACE (Func_Entry, "fixed_get_char_literal", NULL);
00795
00796 ich = stmt_buf[++stmt_buf_idx];
00797
00798 if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
00799
00800 if (stmt_line_idx < lines_in_buf) {
00801 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
00802 + stmt_line_offset[stmt_line_idx];
00803
00804 ich = stmt_buf[++stmt_buf_idx];
00805 }
00806 else {
00807 ich = eos;
00808 }
00809 }
00810
00811 ch = ich;
00812 LA_CH_VALUE = ch;
00813 LA_CH_LINE = stmt_line_num[stmt_line_idx];
00814 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
00815 LA_CH_BUF_IDX = stmt_buf_idx;
00816 LA_CH_STMT_NUM = statement_number;
00817 LA_CH_CLASS = (ch == (char) EOF) ? Ch_Class_EOF : ch_class[LA_CH_VALUE];
00818
00819 TRACE (Func_Exit, "fixed_get_char_literal",
00820 ch_str[(unsigned char) LA_CH_VALUE]);
00821
00822 return;
00823
00824 }
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848 void free_get_char (void)
00849
00850 {
00851 char ch;
00852 int ich;
00853
00854
00855 TRACE (Func_Entry, "free_get_char", NULL);
00856
00857 sig_blank = FALSE;
00858
00859
00860
00861 if (LA_CH_VALUE == EOS) {
00862 stmt_end_line = LA_CH_LINE;
00863 stmt_end_col = LA_CH_COLUMN - 1;
00864
00865 if (change_source_form) {
00866 change_source_form = FALSE;
00867
00868 if (cmd_line_flags.line_size_80) {
00869 line_size = FIXED_SRC_LINE_SIZE_80;
00870 }
00871 else if (cmd_line_flags.line_size_132) {
00872 line_size = FIXED_SRC_LINE_SIZE_132;
00873 }
00874 else {
00875 line_size = FIXED_SRC_LINE_SIZE_72;
00876 }
00877 get_char = fixed_get_char;
00878 get_char_literal = fixed_get_char_literal;
00879 source_form = Fixed_Form;
00880
00881 fixed_get_char ();
00882
00883 TRACE (Func_Exit, "free_get_char",
00884 ch_str[(unsigned char) LA_CH_VALUE]);
00885
00886 return;
00887 }
00888
00889 free_get_stmt ();
00890
00891
00892 while (stmt_buf_type == Comment_Line) {
00893 if (change_source_form) {
00894 change_source_form = FALSE;
00895
00896 if (cmd_line_flags.line_size_80) {
00897 line_size = FIXED_SRC_LINE_SIZE_80;
00898 }
00899 else if (cmd_line_flags.line_size_132) {
00900 line_size = FIXED_SRC_LINE_SIZE_132;
00901 }
00902 else {
00903 line_size = FIXED_SRC_LINE_SIZE_72;
00904 }
00905
00906 get_char = fixed_get_char;
00907 get_char_literal = fixed_get_char_literal;
00908 source_form = Fixed_Form;
00909
00910 fixed_get_char ();
00911
00912 TRACE (Func_Exit, "free_get_char",
00913 ch_str[(unsigned char) LA_CH_VALUE]);
00914
00915 return;
00916 }
00917 else {
00918 free_get_stmt ();
00919 }
00920 }
00921
00922 ich = stmt_buf[stmt_buf_idx + 1];
00923
00924 while (((ich == newline) |
00925 (ich == semi_colon) |
00926 (ich == bang)) &&
00927 (stmt_line_idx >= lines_in_buf)) {
00928
00929 free_get_stmt ();
00930
00931 while (stmt_buf_type == Comment_Line) {
00932 if (change_source_form) {
00933 change_source_form = FALSE;
00934
00935 if (cmd_line_flags.line_size_80) {
00936 line_size = FIXED_SRC_LINE_SIZE_80;
00937 }
00938 else if (cmd_line_flags.line_size_132) {
00939 line_size = FIXED_SRC_LINE_SIZE_132;
00940 }
00941 else {
00942 line_size = FIXED_SRC_LINE_SIZE_72;
00943 }
00944
00945 get_char = fixed_get_char;
00946 get_char_literal = fixed_get_char_literal;
00947 source_form = Fixed_Form;
00948
00949 fixed_get_char ();
00950
00951 TRACE (Func_Exit, "free_get_char",
00952 ch_str[(unsigned char) LA_CH_VALUE]);
00953
00954 return;
00955 }
00956 else {
00957 free_get_stmt ();
00958 }
00959 }
00960
00961 ich = stmt_buf[stmt_buf_idx + 1];
00962 }
00963
00964
00965 if (stmt_buf_type == Dir_Line) {
00966 ch = stmt_buf[stmt_buf_idx];
00967
00968 if (islower(ch)) {
00969 ch = TOUPPER(ch);
00970 }
00971
00972 LA_CH_VALUE = ch;
00973 LA_CH_LINE = stmt_line_num[stmt_line_idx];
00974 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
00975 LA_CH_BUF_IDX = stmt_buf_idx;
00976 LA_CH_STMT_NUM = statement_number;
00977
00978 switch (stmt_prefix_len) {
00979 case 1 :
00980 LA_CH_CLASS = Ch_Class_Dir1;
00981 break;
00982 case 2 :
00983 LA_CH_CLASS = Ch_Class_Dir2;
00984 break;
00985 case 3 :
00986 LA_CH_CLASS = Ch_Class_Dir3;
00987 break;
00988 case 4 :
00989 LA_CH_CLASS = Ch_Class_Dir4;
00990 break;
00991 }
00992
00993 TRACE (Func_Exit, "free_get_char",
00994 ch_str[(unsigned char) LA_CH_VALUE]);
00995
00996 return;
00997 }
00998 }
00999
01000
01001
01002
01003
01004
01005
01006
01007 ich = stmt_buf[++stmt_buf_idx];
01008
01009 if (ich == blank || ich == tab) {
01010
01011 do {
01012 ich = stmt_buf[++stmt_buf_idx];
01013 }
01014 while (ich == blank || ich == tab);
01015
01016 sig_blank = TRUE;
01017 }
01018
01019 if (stmt_buf_idx == stmt_buf_EOS_idx) {
01020 ich = eos;
01021 }
01022 else if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
01023
01024 if (stmt_line_idx < lines_in_buf) {
01025 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
01026 + stmt_line_offset[stmt_line_idx];
01027 ich = stmt_buf[++stmt_buf_idx];
01028 }
01029 else {
01030 ich = eos;
01031 }
01032
01033 if (ich == blank || ich == tab) {
01034
01035 do {
01036 ich = stmt_buf[++stmt_buf_idx];
01037 }
01038 while (ich == blank || ich == tab);
01039
01040 sig_blank = TRUE;
01041 }
01042
01043 if (stmt_buf_idx == stmt_buf_EOS_idx) {
01044 ich = eos;
01045 }
01046 }
01047
01048 LA_CH_LINE = stmt_line_num[stmt_line_idx];
01049 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
01050 LA_CH_BUF_IDX = stmt_buf_idx;
01051 LA_CH_STMT_NUM = statement_number;
01052
01053 if (havent_issued_at_ansi && ich == at_sign) {
01054 havent_issued_at_ansi = FALSE;
01055 ntr_msg_queue(LA_CH_LINE, 900, Ansi,
01056 LA_CH_COLUMN,
01057 (char *)NULL,
01058 0,
01059 NO_ARG);
01060 }
01061
01062 if (havent_issued_dollar_ansi && ich == dollar) {
01063 havent_issued_dollar_ansi = FALSE;
01064 ntr_msg_queue(LA_CH_LINE, 901, Ansi,
01065 LA_CH_COLUMN,
01066 (char *)NULL,
01067 0,
01068 NO_ARG);
01069 }
01070
01071 ch = ich;
01072
01073 if (islower(ch)) {
01074 ch = TOUPPER(ch);
01075 }
01076
01077 LA_CH_VALUE = ch;
01078 LA_CH_CLASS = (ch == (char) EOF) ? Ch_Class_EOF : ch_class[LA_CH_VALUE];
01079
01080 TRACE (Func_Exit, "free_get_char",
01081 ch_str[(unsigned char) LA_CH_VALUE]);
01082
01083 return;
01084
01085 }
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105 void free_get_char_literal (void)
01106
01107 {
01108 char ch;
01109 int ich;
01110
01111
01112 TRACE (Func_Entry, "free_get_char_literal", NULL);
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123 ich = stmt_buf[++stmt_buf_idx];
01124
01125
01126 if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
01127
01128 if (stmt_line_idx < lines_in_buf) {
01129 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
01130 + stmt_line_offset[stmt_line_idx];
01131
01132 ich = stmt_buf[++stmt_buf_idx];
01133 }
01134 else {
01135 ich = eos;
01136 }
01137 }
01138
01139 ch = ich;
01140
01141 LA_CH_VALUE = ch;
01142 LA_CH_LINE = stmt_line_num[stmt_line_idx];
01143 LA_CH_COLUMN = stmt_buf_col[stmt_buf_idx];
01144 LA_CH_BUF_IDX = stmt_buf_idx;
01145 LA_CH_STMT_NUM = statement_number;
01146 LA_CH_CLASS = (ch == (char) EOF) ? Ch_Class_EOF : ch_class[LA_CH_VALUE];
01147
01148 TRACE (Func_Exit, "free_get_char_literal",
01149 ch_str[(unsigned char) LA_CH_VALUE]);
01150
01151 return;
01152
01153 }
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183 static void fixed_get_stmt (void)
01184 {
01185 int idx;
01186 int line_counter = 1;
01187 int loc_stmt_num;
01188 int save_idx;
01189 int stmt_buf_EOS;
01190
01191
01192 TRACE (Func_Entry, "fixed_get_stmt", NULL);
01193
01194
01195
01196 issue_deferred_msgs();
01197
01198
01199 if (stmt_buf_type == EOF_Line) {
01200
01201 PRINTMSG (0, 50, Internal, 1);
01202 }
01203
01204 stmt_line_idx = NULL_IDX;
01205 stmt_buf_idx = NULL_IDX;
01206 lines_in_buf = 0;
01207
01208 label_ok = FALSE;
01209
01210
01211 # pragma _CRI align
01212 do {
01213
01214 save_idx = 0;
01215
01216
01217
01218 stmt_line_num[++stmt_line_idx] = nxt_line_num;
01219
01220
01221
01222 if (starting_pt) {
01223 stmt_line_offset[stmt_line_idx] = starting_pt - 2;
01224 label_ok = FALSE;
01225 }
01226 else {
01227 stmt_line_offset[stmt_line_idx] = nxt_line_idx - 1;
01228 starting_pt = nxt_line_idx;
01229
01230 if (nxt_line_label) {
01231 label_ok = TRUE;
01232 }
01233 }
01234
01235
01236
01237 stmt_line_start_idx[stmt_line_idx] = line_counter;
01238
01239
01240
01241 stmt_line_end_idx[stmt_line_idx] = nxt_line_EOL + line_counter - 1;
01242
01243
01244
01245 if (nxt_line_type != Continuation_Line &&
01246 nxt_line_type != Dir_Continuation_Line) {
01247 stmt_buf_type = nxt_line_type;
01248
01249 if (nxt_line_type == Dir_Line) {
01250 stmt_prefix_len = nxt_line_prefix_len;
01251 stmt_buf_dir_prefix = nxt_line_dir_prefix;
01252 }
01253
01254 if (stmt_buf_type != Comment_Line &&
01255 stmt_buf_type != Pound_Src_Line &&
01256 stmt_buf_type != Pound_Include_Exit_Line) {
01257 INCREMENT_STATEMENT_NUMBER;
01258 }
01259 }
01260
01261 if (stmt_buf_type == Dir_Line) {
01262 line_dir_prefix[stmt_line_idx] = nxt_line_actual_dir_prefix;
01263 }
01264
01265 move_up_next_msg_queue();
01266
01267
01268
01269 stmt_buf_idx = line_counter + nxt_line_EOL - 1;
01270 line_counter += nxt_line_EOL;
01271
01272 for (idx = nxt_line_EOL; idx > 0; idx --) {
01273 stmt_buf[stmt_buf_idx] = nxt_line[NXT_COL(idx)];
01274 #ifdef KEY
01275 if (stmt_buf_idx >= MAX_STMT_CHAR_SIZE) {
01276 PRINTMSG(curr_glb_line, 1593, Limit, 0);
01277 }
01278 #endif
01279 stmt_buf_col[stmt_buf_idx] = nxt_line_col[NXT_COL(idx)];
01280 stmt_buf_idx--;
01281
01282 if (havent_issued_tab_ansi &&
01283 idx < nxt_line_EOL &&
01284 nxt_line[NXT_COL(idx)] == tab) {
01285 havent_issued_tab_ansi = FALSE;
01286 ntr_msg_queue(nxt_line_num, 899, Ansi,
01287 idx,
01288 (char *)NULL,
01289 0,
01290 NO_ARG);
01291 }
01292
01293 if (nxt_line[NXT_COL(idx)] == semi_colon &&
01294 stmt_buf_type != Dir_Line) {
01295 if ((idx > starting_pt) && (idx < nxt_line_EOL)) {
01296 save_idx = idx;
01297 }
01298 }
01299 }
01300
01301 idx = 0;
01302 lines_in_buf++;
01303
01304
01305
01306
01307
01308
01309
01310
01311 if (save_idx &&
01312 nxt_line_type != Comment_Line) {
01313
01314 stmt_buf_EOS = save_idx;
01315 idx = save_idx;
01316 while ((nxt_line[NXT_COL(idx)] == semi_colon) |
01317 (nxt_line[NXT_COL(idx)] == blank) |
01318 (nxt_line[NXT_COL(idx)] == tab)) {
01319 idx++;
01320 }
01321
01322
01323
01324 starting_pt = idx;
01325 nxt_line_type = Regular_Line;
01326 continuation_count = 0;
01327 include_found = FALSE;
01328 include_complete = FALSE;
01329 }
01330 else {
01331 stmt_buf_EOS = nxt_line_EOL;
01332 starting_pt = NULL_IDX;
01333 }
01334
01335
01336
01337
01338 if ((stmt_buf_type != EOF_Line) &&
01339 (starting_pt == NULL_IDX)) {
01340
01341
01342 do {
01343 nxt_line_type = Regular_Line;
01344
01345 if (get_nxt_line ()) {
01346
01347 if (include_switch) {
01348 update_global_line();
01349 include_switch = FALSE;
01350 }
01351
01352 if (issue_pound_exit_line) {
01353 OUTPUT_POUND_INCLUDE_EXIT_LINE(curr_glb_line);
01354 issue_pound_exit_line = FALSE;
01355 }
01356
01357 nxt_line_mp_line = FALSE;
01358
01359 if (nxt_line_type != Cond_Comp_Line) {
01360 PP_ORIG_SIZE = line_size;
01361 classify_line();
01362 }
01363
01364 if (on_off_flags.save_dot_i) {
01365
01366 if (ignore_source_line ||
01367 nxt_line_type == Cond_Comp_Line ||
01368 nxt_line_type == Include_Line) {
01369
01370
01371 fprintf(dot_i_fptr, "\n");
01372 previous_global_line++;
01373 }
01374 else {
01375 print_nxt_line();
01376 }
01377 }
01378
01379 switch (nxt_line_type) {
01380 case Comment_Line:
01381 break;
01382
01383 case Cond_Comp_Line:
01384 if (parse_cc_line()) {
01385
01386
01387
01388 nxt_line_type = Include_Line;
01389 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
01390
01391 #ifdef KEY
01392 if (open_include_file (TRUE, FALSE))
01393 #else
01394 if (open_include_file (TRUE))
01395 #endif
01396 {
01397 include_found = TRUE;
01398 include_switch = TRUE;
01399 }
01400 }
01401 else {
01402 nxt_line_type = Comment_Line;
01403 }
01404 angle_brkt_include = FALSE;
01405 break;
01406
01407 case Dir_Line:
01408 case Regular_Line:
01409 continuation_count = 0;
01410 include_found = FALSE;
01411 include_complete = FALSE;
01412 break;
01413
01414 case Continuation_Line:
01415 case Dir_Continuation_Line:
01416
01417 if (++continuation_count == MAX_ANSI_FIXED_LINES) {
01418
01419
01420
01421 ntr_msg_queue(nxt_line_num, 52, Ansi,
01422 CONTINUE_COLUMN,
01423 "fixed",
01424 (MAX_ANSI_FIXED_LINES - 1),
01425 ARG_STR_ARG);
01426 }
01427
01428 if (continuation_count == MAX_FIXED_LINES) {
01429
01430
01431
01432 ntr_msg_queue(nxt_line_num, 524, Error,
01433 CONTINUE_COLUMN,
01434 (char *)NULL,
01435 0,
01436 NO_ARG);
01437 }
01438
01439 if (continuation_count >= MAX_FIXED_LINES) {
01440 nxt_line_type = Comment_Line;
01441 break;
01442 }
01443
01444 if (stmt_buf_type == Dir_Line &&
01445 nxt_line_type == Continuation_Line) {
01446
01447
01448
01449 ntr_msg_queue(nxt_line_num, 51, Error,
01450 CONTINUE_COLUMN,
01451 (char *)NULL,
01452 0,
01453 NO_ARG);
01454 }
01455
01456 if (include_found) {
01457 include_found = FALSE;
01458
01459
01460
01461 ntr_msg_queue(nxt_line_num, 53, Error,
01462 CONTINUE_COLUMN,
01463 (char *)NULL,
01464 0,
01465 NO_ARG);
01466 }
01467
01468 if (include_complete) {
01469 include_complete = FALSE;
01470
01471
01472
01473 ntr_msg_queue(nxt_line_num, 54, Error,
01474 CONTINUE_COLUMN,
01475 (char *)NULL,
01476 0,
01477 NO_ARG);
01478 }
01479
01480 if (cif_flags & MISC_RECS) {
01481 cif_cont_line_rec(
01482 (nxt_line_type == Continuation_Line) ? 0 : 1,
01483 nxt_line_num);
01484 }
01485
01486 break;
01487
01488 case Pound_Src_Line:
01489 break;
01490
01491 case Pound_Include_Exit_Line:
01492 include_complete = TRUE;
01493 nxt_line_type = Comment_Line;
01494 curr_glb_line--;
01495 SRC_STK_FILE_LINE(src_stk_idx)--;
01496 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
01497 SRC_STK_FILE_LINE(src_stk_idx);
01498 set_related_gl_source_lines(
01499 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
01500
01501 if (source_form != SRC_STK_PREV_SRC_FORM(src_stk_idx)) {
01502 change_source_form = TRUE;
01503 }
01504 POP_SRC;
01505 include_switch = TRUE;
01506 break;
01507
01508 case Pound_Include_Enter_Line:
01509 case Include_Line:
01510
01511 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
01512
01513 #ifdef KEY
01514 if (open_include_file (FALSE,
01515 Pound_Include_Enter_Line == nxt_line_type))
01516 #else
01517 if (open_include_file (FALSE))
01518 #endif
01519 {
01520 include_found = TRUE;
01521 include_switch = TRUE;
01522 }
01523
01524 break;
01525 }
01526 }
01527 else {
01528
01529
01530
01531 if (cmd_line_flags.pp_macro_expansion) {
01532 pp_line_idx++;
01533 }
01534
01535
01536
01537 if (src_stk_idx > SRC_STK_BASE_IDX) {
01538 include_complete = TRUE;
01539 nxt_line_type = Comment_Line;
01540 nxt_line_EOL = 2;
01541 curr_glb_line--;
01542
01543 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
01544 SRC_STK_FILE_LINE(src_stk_idx);
01545 set_related_gl_source_lines(
01546 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
01547
01548 if (source_form != SRC_STK_PREV_SRC_FORM(src_stk_idx)) {
01549 change_source_form = TRUE;
01550 }
01551 POP_SRC;
01552 include_switch = TRUE;
01553 issue_pound_exit_line = TRUE;
01554 break;
01555 }
01556 else {
01557 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
01558 SRC_STK_FILE_LINE(src_stk_idx);
01559 set_related_gl_source_lines(
01560 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
01561 nxt_line_type = EOF_Line;
01562 nxt_line_EOL = 2;
01563 }
01564 }
01565 }
01566 while (nxt_line_type == Comment_Line |
01567 nxt_line_type == Include_Line |
01568 nxt_line_type == Pound_Include_Enter_Line);
01569
01570 }
01571 }
01572 while (nxt_line_type == Continuation_Line ||
01573 nxt_line_type == Dir_Continuation_Line);
01574
01575 if (prev_statement_number != statement_number) {
01576 loc_stmt_num = statement_number;
01577 statement_number = prev_statement_number;
01578 prev_statement_number = loc_stmt_num;
01579 }
01580
01581 stmt_buf_EOS_idx = stmt_line_start_idx[lines_in_buf] + stmt_buf_EOS - 1;
01582 stmt_EOS_la_ch.line = stmt_line_num[lines_in_buf];
01583 stmt_EOS_la_ch.column = stmt_buf_col[stmt_buf_EOS_idx];
01584 stmt_EOS_la_ch.stmt_buf_idx = stmt_buf_EOS_idx;
01585 stmt_EOS_la_ch.stmt_num = statement_number;
01586
01587 stmt_buf_idx = stmt_line_offset[1] + 1;
01588 stmt_line_idx = SRC_STK_BASE_IDX;
01589
01590 PRINT_STMT_SRC();
01591
01592 TRACE (Func_Exit, "fixed_get_stmt", NULL);
01593
01594 return;
01595
01596 }
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615 boolean read_line (boolean cc_continuation_line)
01616
01617 {
01618 int ch;
01619 int i;
01620 int k;
01621 int limit;
01622 boolean result = TRUE;
01623
01624
01625 TRACE (Func_Entry, "read_line", NULL);
01626
01627 if (extra_nxt_line != 0 &&
01628 nxt_line_num_lines == 0) {
01629
01630
01631
01632 nxt_line_num_lines++;
01633
01634 if (pp_nxt_line_type[extra_nxt_line] == EOF_Line) {
01635 nxt_line_start_idx[1] = 1;
01636 nxt_line_end_idx[1] = 2;
01637 nxt_line[1] = EOF;
01638 nxt_line[2] = eos;
01639 pp_nxt_line_length[1] = 1;
01640 pp_nxt_line_type[1] = EOF_Line;
01641 pp_nxt_line_idx[1] = NULL_IDX;
01642 result = FALSE;
01643 }
01644 else {
01645 k = 0;
01646 for (i = nxt_line_start_idx[extra_nxt_line];
01647 i <= nxt_line_end_idx[extra_nxt_line];
01648 i++) {
01649
01650 nxt_line[++k] = (nxt_line[i] & 0xFF);
01651 nxt_line_col[k] = nxt_line_col[i];
01652 }
01653 nxt_line_start_idx[1] = 1;
01654 nxt_line_end_idx[1] = k;
01655 pp_nxt_line_length[1] = k-1;
01656 }
01657
01658 pp_nxt_line_num[1] = pp_nxt_line_num[extra_nxt_line];
01659 pp_nxt_line_mp_line[1] = pp_nxt_line_mp_line[extra_nxt_line];
01660
01661 if (pp_nxt_line_type[extra_nxt_line] == Include_Line) {
01662 nxt_line_type = Include_Line;
01663 }
01664
01665 extra_nxt_line = NULL_IDX;
01666
01667 goto EXIT;
01668 }
01669
01670
01671 #ifdef KEY
01672 if (src_stk_idx == NULL_IDX) {
01673 PRINTMSG (curr_glb_line, 1, Internal, 0, "src_stk_idx");
01674 }
01675 #endif
01676 ch = getc(SRC_STK_FILE_PTR(src_stk_idx));
01677
01678 if (on_off_flags.preprocess &&
01679 ch != newline &&
01680 ch != EOF &&
01681 (ch == '#' || cc_continuation_line)) {
01682
01683 limit = MAX_STMT_CHAR_SIZE - 4;
01684
01685 if (! cc_continuation_line) {
01686 cc_stmt_buf_idx = NULL_IDX;
01687 cc_stmt_buf_num_lines = 0;
01688 }
01689
01690 cc_stmt_buf_line[++cc_stmt_buf_num_lines].line = ++curr_glb_line;
01691 cc_stmt_buf_line[cc_stmt_buf_num_lines].start_idx = cc_stmt_buf_idx;
01692 SRC_STK_FILE_LINE(src_stk_idx)++;
01693
01694 cc_stmt_buf[++cc_stmt_buf_idx] = ch;
01695 while ((ch = getc(SRC_STK_FILE_PTR(src_stk_idx))) != newline &&
01696 ch != EOF)
01697 {
01698
01699 if (limit > 0) {
01700 cc_stmt_buf[++cc_stmt_buf_idx] = ch;
01701 limit--;
01702 }
01703 #ifdef KEY
01704 else {
01705 PRINTMSG(curr_glb_line, 1674, Limit, 0, FREE_SRC_LINE_SIZE);
01706 }
01707 #endif
01708 }
01709 #ifdef KEY
01710
01711
01712 if (ch == newline && cc_stmt_buf_idx >= 0 &&
01713 cc_stmt_buf[cc_stmt_buf_idx] == dosnewline) {
01714 cc_stmt_buf_idx -= 1;
01715 }
01716 #endif
01717
01718 cc_stmt_buf[++cc_stmt_buf_idx] = newline;
01719 cc_stmt_buf[++cc_stmt_buf_idx] = eos;
01720
01721 nxt_line_type = Cond_Comp_Line;
01722
01723 goto EXIT;
01724 }
01725
01726 nxt_line_start_idx[nxt_line_num_lines + 1] =
01727 nxt_line_end_idx[nxt_line_num_lines] + 1;
01728
01729 nxt_line_num_lines++;
01730
01731 for (i = nxt_line_start_idx[nxt_line_num_lines] - 1;
01732 i <= nxt_line_start_idx[nxt_line_num_lines] + line_size;
01733 i++) {
01734 nxt_line_col[i] = (i - nxt_line_start_idx[nxt_line_num_lines]) + 1;
01735 }
01736
01737 nxt_line_idx = nxt_line_start_idx[nxt_line_num_lines] - 1;
01738 if (ch != newline && ch != EOF)
01739 {
01740 limit = nxt_line_idx + FREE_SRC_LINE_SIZE;
01741
01742 nxt_line[++nxt_line_idx] = ch;
01743 while ((ch = getc(SRC_STK_FILE_PTR(src_stk_idx))) != newline &&
01744 ch != EOF)
01745 {
01746
01747 if (nxt_line_idx < limit) {
01748 nxt_line[++nxt_line_idx] = ch;
01749 }
01750 #ifdef KEY
01751 else {
01752 PRINTMSG(curr_glb_line, 1674, Limit, 0, FREE_SRC_LINE_SIZE);
01753 }
01754 #endif
01755 }
01756 #ifdef KEY
01757
01758
01759 if (ch == newline && nxt_line_idx >= 0 &&
01760 nxt_line[nxt_line_idx] == dosnewline) {
01761 nxt_line_idx -= 1;
01762 }
01763 #endif
01764 }
01765
01766
01767 if (nxt_line_idx >
01768 (nxt_line_start_idx[nxt_line_num_lines] - 1) + line_size) {
01769
01770 #ifdef KEY
01771
01772
01773
01774
01775
01776 if (1 != nxt_line_num_lines || 1 < nxt_line_start_idx[1] ||
01777 '#' != nxt_line[nxt_line_start_idx[1]]) {
01778 nxt_line_idx = (nxt_line_start_idx[nxt_line_num_lines] - 1) + line_size;
01779 }
01780 #else
01781 nxt_line_idx = (nxt_line_start_idx[nxt_line_num_lines] - 1) + line_size;
01782 #endif
01783 }
01784
01785 if (nxt_line_idx == nxt_line_start_idx[nxt_line_num_lines] - 1 &&
01786 ch == EOF) {
01787
01788 nxt_line[nxt_line_start_idx[nxt_line_num_lines]] = EOF;
01789 nxt_line[nxt_line_start_idx[nxt_line_num_lines] + 1] = eos;
01790 pp_nxt_line_length[nxt_line_num_lines] = 1;
01791 nxt_line_end_idx[nxt_line_num_lines] =
01792 nxt_line_start_idx[nxt_line_num_lines] + 1;
01793 pp_nxt_line_num[nxt_line_num_lines] = ++curr_glb_line;
01794 pp_nxt_line_type[nxt_line_num_lines] = EOF_Line;
01795 pp_nxt_line_idx[nxt_line_num_lines] = NULL_IDX;
01796 result = FALSE;
01797 }
01798 else {
01799 if (source_form == Fixed_Form) {
01800
01801
01802 while (nxt_line_idx <
01803 (nxt_line_start_idx[nxt_line_num_lines] - 1) + CONTINUE_COLUMN) {
01804 nxt_line[++nxt_line_idx] = blank;
01805 }
01806 }
01807
01808 pp_nxt_line_num[nxt_line_num_lines] = ++curr_glb_line;
01809 SRC_STK_FILE_LINE(src_stk_idx)++;
01810
01811 nxt_line[++nxt_line_idx] = newline;
01812 pp_nxt_line_length[nxt_line_num_lines] = nxt_line_idx -
01813 (nxt_line_start_idx[nxt_line_num_lines] - 1);
01814 nxt_line[++nxt_line_idx] = eos;
01815 nxt_line_end_idx[nxt_line_num_lines] = nxt_line_idx;
01816
01817 if (pp_nxt_line_length[nxt_line_num_lines] > 73 &&
01818 source_form == Fixed_Form &&
01819 ! have_issued_msg_37 &&
01820 issue_classify_msg) {
01821 have_issued_msg_37 = TRUE;
01822 ntr_next_msg_queue(curr_glb_line, 37, Ansi,
01823 0,
01824 (char *)NULL,
01825 0,
01826 NO_ARG);
01827 }
01828
01829
01830 # if 0
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841 if (ch == EOF) {
01842 PRINTMSG (curr_glb_line, 55, Warning, 0);
01843 }
01844
01845 # endif
01846
01847
01848 }
01849
01850 EXIT:
01851
01852 TRACE (Func_Exit, "read_line", NULL);
01853
01854 return (result);
01855
01856 }
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874 static boolean is_pound_line_dir(void)
01875
01876 {
01877 int ch;
01878 boolean dir = FALSE;
01879 int idx;
01880
01881 TRACE (Func_Entry, "is_pound_line_dir", NULL);
01882
01883 ch = nxt_line[NXT_COL(1)];
01884
01885 if (ch == pound) {
01886 idx = NXT_COL(2);
01887 ch = nxt_line[idx];
01888
01889 while (ch == blank | ch == tab) {
01890 idx++;
01891 ch = nxt_line[idx];
01892 }
01893
01894 if (isdigit(ch)) {
01895 dir = TRUE;
01896 }
01897 }
01898
01899 TRACE (Func_Exit, "is_pound_line_dir", NULL);
01900
01901 return(dir);
01902
01903 }
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923 static void fixed_classify_line (void)
01924
01925 {
01926 int ch;
01927 char form[4] = " ";
01928 char ch_tmp;
01929 int cont_col;
01930 char delim;
01931 char err_str[2];
01932 int i;
01933 int ich;
01934 int idx;
01935 int incl_idx;
01936 boolean label;
01937 int line_num;
01938 char line_num_str[24];
01939 int nxt_idx;
01940 int save_curr_glb_line;
01941
01942 TRACE (Func_Entry, "fixed_classify_line", NULL);
01943
01944 PP_EOL = nxt_line_end_idx[pp_line_idx] - 1;
01945
01946 START:
01947
01948 cont_col = NXT_COL(CONTINUE_COLUMN);
01949
01950 PP_IDX = NXT_COL(0);
01951 PP_LABEL = FALSE;
01952
01953 ch = nxt_line[NXT_COL(1)];
01954
01955 # ifdef _FRONTEND_CONDITIONAL_COMP
01956 if (ch == pound &&
01957 on_off_flags.preprocess) {
01958
01959 PP_LINE_TYPE = Cond_Comp_Line;
01960 } else
01961 # endif
01962 if (is_pound_line_dir()) {
01963 PP_IDX = NXT_COL(2);
01964 ch = nxt_line[PP_IDX];
01965
01966 while (ch == blank | ch == tab) {
01967 PP_IDX++;
01968 ch = nxt_line[PP_IDX];
01969 }
01970
01971 if (isdigit(ch)) {
01972 idx = 0;
01973 line_num_str[idx++] = ch;
01974 ch = nxt_line[++PP_IDX];
01975 while (isdigit(ch)) {
01976 line_num_str[idx++] = ch;
01977 ch = nxt_line[++PP_IDX];
01978 }
01979
01980 line_num_str[idx] = '\0';
01981 line_num = atoi(line_num_str);
01982
01983 while (ch == blank | ch == tab) {
01984 PP_IDX++;
01985 ch = nxt_line[PP_IDX];
01986 }
01987
01988 if (ch == quote | ch == db_quote) {
01989 char_delim = ch;
01990 ch = nxt_line[++PP_IDX];
01991
01992 idx = 0;
01993 while (ch != char_delim) {
01994 include_file[idx++] = ch;
01995 ch = nxt_line[++PP_IDX];
01996 }
01997 include_file[idx] = '\0';
01998
01999 ch = nxt_line[++PP_IDX];
02000 while (ch == blank | ch == tab) {
02001 PP_IDX++;
02002 ch = nxt_line[PP_IDX];
02003 }
02004
02005 if (ch == '1') {
02006 PP_LINE_TYPE = Pound_Include_Enter_Line;
02007 }
02008 else if (ch == '2') {
02009 PP_LINE_TYPE = Pound_Include_Exit_Line;
02010 }
02011 else {
02012 PP_LINE_TYPE = Comment_Line;
02013
02014
02015
02016
02017 save_curr_glb_line = curr_glb_line;
02018 curr_glb_line = line_num + GL_GLOBAL_LINE(global_line_tbl_idx) -
02019 GL_FILE_LINE(global_line_tbl_idx);
02020 curr_glb_line--;
02021
02022 if (first_pound_line) {
02023 PP_LINE_TYPE = Pound_Src_Line;
02024 change_orig_src_file = TRUE;
02025 strcpy(pound_file, include_file);
02026 }
02027 else {
02028 SRC_STK_FILE_LINE(src_stk_idx) +=
02029 curr_glb_line - save_curr_glb_line;
02030 }
02031 }
02032
02033 first_pound_line = FALSE;
02034
02035 }
02036 else if (ch == newline) {
02037
02038 PP_LINE_TYPE = Comment_Line;
02039
02040
02041
02042
02043 save_curr_glb_line = curr_glb_line;
02044 curr_glb_line = line_num + GL_GLOBAL_LINE(global_line_tbl_idx) -
02045 GL_FILE_LINE(global_line_tbl_idx);
02046 curr_glb_line--;
02047
02048 SRC_STK_FILE_LINE(src_stk_idx) +=
02049 curr_glb_line - save_curr_glb_line;
02050
02051 first_pound_line = FALSE;
02052 }
02053 else {
02054 PP_LINE_TYPE = Comment_Line;
02055 }
02056 }
02057 else {
02058 PP_LINE_TYPE = Comment_Line;
02059 }
02060 }
02061 else if (ignore_source_line) {
02062 PP_LINE_TYPE = Comment_Line;
02063 }
02064 # ifdef _D_LINES_SUPPORTED
02065 else if (ch == uc_d | ch == lc_d) {
02066
02067
02068 if (on_off_flags.d_lines) {
02069 nxt_line[NXT_COL(1)] = ' ';
02070 goto START;
02071 }
02072 else {
02073 PP_LINE_TYPE = Comment_Line;
02074 }
02075 }
02076 # endif
02077 else if (ch == uc_c | ch == lc_c | ch == bang | ch == star) {
02078
02079 if (((ch = nxt_line[NXT_COL(2)]) == uc_d || ch == lc_d) &&
02080 ((ch = nxt_line[NXT_COL(3)]) == uc_i || ch == lc_i) &&
02081 ((ch = nxt_line[NXT_COL(4)]) == uc_r || ch == lc_r) &&
02082 ((ch = nxt_line[NXT_COL(5)]) == dollar || ch == at_sign)) {
02083
02084 PP_PREFIX_LEN = 4;
02085
02086 first_line = FALSE;
02087
02088
02089 MARK_CHAR_CONST(nxt_line[NXT_COL(5)]);
02090
02091
02092 if (nxt_line[NXT_COL(6)] == zero) {
02093 nxt_line[NXT_COL(6)] = blank;
02094 }
02095
02096 if ((ch = nxt_line[NXT_COL(6)]) != blank && ch != tab) {
02097
02098 if (IS_DIR_CONTINUATION(Cdir_Dir)) {
02099
02100 PP_LINE_TYPE = Dir_Continuation_Line;
02101 PP_ACTUAL_DIR_PREFIX = Cdir_Dir;
02102 in_format = FALSE;
02103 PP_IDX = NXT_COL(6);
02104 }
02105 else {
02106 PP_LINE_TYPE = Comment_Line;
02107 }
02108 }
02109 else {
02110 PP_IDX = NXT_COL(2);
02111 PP_LINE_TYPE = Dir_Line;
02112 PP_DIR_PREFIX = Cdir_Dir;
02113 PP_ACTUAL_DIR_PREFIX = Cdir_Dir;
02114 in_format = FALSE;
02115 idx = NXT_COL(6);
02116 do {
02117 ch = nxt_line[++idx];
02118 }
02119 while (ch == blank | ch == tab);
02120
02121 if (ch == lc_f | ch == uc_f) {
02122 i = 0;
02123 while (i < 4) {
02124 ch = nxt_line[++idx];
02125
02126 if (ch == newline) {
02127 break;
02128 }
02129
02130 if (! (ch == blank | ch == tab)) {
02131 if (islower(ch)) {
02132 form[i] = TOUPPER(ch);
02133 }
02134 else {
02135 form[i] = ch;
02136 }
02137 i++;
02138 }
02139 }
02140
02141 if (strncmp(form, "REE ", 4) == 0 &&
02142 !disregard_directive[Tok_Dir_Free-Tok_Dir_Start]) {
02143 PP_CHANGE_SOURCE_FORM = TRUE;
02144 }
02145 }
02146 }
02147 }
02148 else if (((ch = nxt_line[NXT_COL(2)]) == uc_m || ch == lc_m) &&
02149 ((ch = nxt_line[NXT_COL(3)]) == uc_i || ch == lc_i) &&
02150 ((ch = nxt_line[NXT_COL(4)]) == uc_c || ch == lc_c) &&
02151 ((ch = nxt_line[NXT_COL(5)]) == dollar || ch == at_sign)) {
02152
02153 PP_PREFIX_LEN = 4;
02154
02155 first_line = FALSE;
02156
02157
02158 MARK_CHAR_CONST(nxt_line[NXT_COL(5)]);
02159
02160
02161 if ((ch = nxt_line[NXT_COL(6)]) != blank && ch != tab) {
02162
02163 if (IS_DIR_CONTINUATION(Cmic_Dir)) {
02164
02165 PP_LINE_TYPE = Dir_Continuation_Line;
02166 PP_ACTUAL_DIR_PREFIX = Cmic_Dir;
02167 in_format = FALSE;
02168 PP_IDX = NXT_COL(6);
02169 }
02170 else {
02171 PP_LINE_TYPE = Comment_Line;
02172 }
02173 }
02174 else {
02175
02176 PP_IDX = NXT_COL(2);
02177 in_format = FALSE;
02178 PP_LINE_TYPE = Dir_Line;
02179 PP_DIR_PREFIX = Cmic_Dir;
02180 PP_ACTUAL_DIR_PREFIX = Cmic_Dir;
02181
02182 idx = NXT_COL(6);
02183 }
02184 }
02185 else if (((ch = nxt_line[NXT_COL(2)]) == dollar) &&
02186 ((ch = nxt_line[NXT_COL(3)]) == uc_o || ch == lc_o) &&
02187 ((ch = nxt_line[NXT_COL(4)]) == uc_m || ch == lc_m) &&
02188 ((ch = nxt_line[NXT_COL(5)]) == uc_p || ch == lc_p)) {
02189
02190
02191
02192 PP_PREFIX_LEN = 4;
02193
02194 first_line = FALSE;
02195
02196
02197 MARK_CHAR_CONST(nxt_line[NXT_COL(2)]);
02198
02199 if (nxt_line[NXT_COL(6)] == zero) {
02200 nxt_line[NXT_COL(6)] = blank;
02201 }
02202
02203 if ((ch = nxt_line[NXT_COL(6)]) != blank && ch != tab) {
02204
02205 if (IS_DIR_CONTINUATION(Comp_Dir)) {
02206
02207 PP_LINE_TYPE = Dir_Continuation_Line;
02208 PP_ACTUAL_DIR_PREFIX = Comp_Dir;
02209 in_format = FALSE;
02210 PP_IDX = NXT_COL(6);
02211 }
02212 else {
02213 PP_LINE_TYPE = Comment_Line;
02214 }
02215 }
02216 else {
02217
02218 PP_IDX = NXT_COL(2);
02219 in_format = FALSE;
02220 PP_LINE_TYPE = Dir_Line;
02221 PP_DIR_PREFIX = Comp_Dir;
02222 PP_ACTUAL_DIR_PREFIX = Comp_Dir;
02223
02224 idx = NXT_COL(6);
02225
02226 # if ! defined(_TARGET_OS_MAX)
02227 if (! dump_flags.open_mp &&
02228 ! on_off_flags.preprocess_only) {
02229 PP_LINE_TYPE = Comment_Line;
02230 }
02231 # endif
02232 }
02233 }
02234 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
02235 else if (((ch = nxt_line[NXT_COL(2)]) == dollar) &&
02236 ((ch = nxt_line[NXT_COL(3)]) == uc_s || ch == lc_s) &&
02237 ((ch = nxt_line[NXT_COL(4)]) == uc_g || ch == lc_g) &&
02238 ((ch = nxt_line[NXT_COL(5)]) == uc_i || ch == lc_i)) {
02239
02240
02241
02242 PP_PREFIX_LEN = 4;
02243
02244 first_line = FALSE;
02245
02246
02247 MARK_CHAR_CONST(nxt_line[NXT_COL(2)]);
02248
02249 if (nxt_line[NXT_COL(6)] == zero) {
02250 nxt_line[NXT_COL(6)] = blank;
02251 }
02252
02253 if ((ch = nxt_line[NXT_COL(6)]) != blank && ch != tab) {
02254
02255 if (IS_DIR_CONTINUATION(Comp_Dir)) {
02256
02257 PP_LINE_TYPE = Dir_Continuation_Line;
02258 PP_ACTUAL_DIR_PREFIX = Csgi_Dir;
02259 in_format = FALSE;
02260 PP_IDX = NXT_COL(6);
02261 }
02262 else {
02263 PP_LINE_TYPE = Comment_Line;
02264 }
02265 }
02266 else {
02267
02268 PP_IDX = NXT_COL(2);
02269 in_format = FALSE;
02270 PP_LINE_TYPE = Dir_Line;
02271 PP_DIR_PREFIX = Comp_Dir;
02272 PP_ACTUAL_DIR_PREFIX = Csgi_Dir;
02273
02274 idx = NXT_COL(6);
02275
02276 if (! dump_flags.open_mp &&
02277 ! on_off_flags.preprocess_only) {
02278 PP_LINE_TYPE = Comment_Line;
02279 }
02280 }
02281 }
02282 # endif
02283 else if (((ch = nxt_line[NXT_COL(2)]) == dollar) &&
02284 ((ch = nxt_line[NXT_COL(3)]) == uc_p || ch == lc_p) &&
02285 ((ch = nxt_line[NXT_COL(4)]) == uc_a || ch == lc_a) &&
02286 ((ch = nxt_line[NXT_COL(5)]) == uc_r || ch == lc_r)) {
02287
02288
02289
02290 PP_PREFIX_LEN = 4;
02291
02292 first_line = FALSE;
02293
02294
02295 MARK_CHAR_CONST(nxt_line[NXT_COL(2)]);
02296
02297 if ((ch = nxt_line[NXT_COL(6)]) == amp) {
02298
02299 if (IS_DIR_CONTINUATION(Cpar_Dir)) {
02300
02301 PP_LINE_TYPE = Dir_Continuation_Line;
02302 PP_ACTUAL_DIR_PREFIX = Cpar_Dir;
02303 in_format = FALSE;
02304 PP_IDX = NXT_COL(6);
02305 }
02306 else {
02307 PP_LINE_TYPE = Comment_Line;
02308 }
02309 }
02310 else {
02311
02312 PP_IDX = NXT_COL(2);
02313 in_format = FALSE;
02314 PP_LINE_TYPE = Dir_Line;
02315 PP_DIR_PREFIX = Cpar_Dir;
02316 PP_ACTUAL_DIR_PREFIX = Cpar_Dir;
02317
02318 idx = NXT_COL(6);
02319
02320 if ((! dump_flags.mp &&
02321 ! on_off_flags.preprocess_only) ||
02322 ! is_par_directive(idx)) {
02323 PP_LINE_TYPE = Comment_Line;
02324 }
02325 }
02326 }
02327 else if (((ch = nxt_line[NXT_COL(2)]) == star) &&
02328 ((ch = nxt_line[NXT_COL(3)]) == dollar) &&
02329 ((ch = nxt_line[NXT_COL(4)]) == star)) {
02330
02331
02332
02333 PP_PREFIX_LEN = 3;
02334
02335 first_line = FALSE;
02336
02337
02338 MARK_CHAR_CONST(nxt_line[NXT_COL(3)]);
02339
02340
02341 if ((ch = nxt_line[NXT_COL(5)]) == amp) {
02342
02343 if (IS_DIR_CONTINUATION(Cstar_Dir)) {
02344
02345 PP_LINE_TYPE = Dir_Continuation_Line;
02346 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
02347 in_format = FALSE;
02348 PP_IDX = NXT_COL(5);
02349 }
02350 else {
02351 PP_LINE_TYPE = Comment_Line;
02352 }
02353 }
02354 else {
02355
02356 PP_IDX = NXT_COL(2);
02357 in_format = FALSE;
02358 PP_LINE_TYPE = Dir_Line;
02359 PP_DIR_PREFIX = Cstar_Dir;
02360 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
02361
02362 idx = NXT_COL(5);
02363
02364 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
02365 if (! is_star_directive(idx)) {
02366 PP_LINE_TYPE = Comment_Line;
02367 }
02368 # else
02369 if ((! dump_flags.mp &&
02370 ! on_off_flags.preprocess_only) ||
02371 ! is_star_directive(idx)) {
02372 PP_LINE_TYPE = Comment_Line;
02373 }
02374 # endif
02375 }
02376 }
02377 else if ((ch = nxt_line[NXT_COL(2)]) == dollar) {
02378
02379
02380
02381 PP_PREFIX_LEN = 1;
02382
02383 first_line = FALSE;
02384
02385
02386 MARK_CHAR_CONST(nxt_line[NXT_COL(2)]);
02387
02388
02389 if ((ch = nxt_line[NXT_COL(3)]) == amp &&
02390 dump_flags.mp) {
02391
02392 if (IS_DIR_CONTINUATION(Cdollar_Dir)) {
02393
02394 PP_LINE_TYPE = Dir_Continuation_Line;
02395 PP_ACTUAL_DIR_PREFIX = Cdollar_Dir;
02396 in_format = FALSE;
02397 PP_IDX = NXT_COL(3);
02398 }
02399 else {
02400 PP_LINE_TYPE = Comment_Line;
02401 }
02402 }
02403 else {
02404
02405 PP_IDX = NXT_COL(2);
02406 in_format = FALSE;
02407 PP_LINE_TYPE = Dir_Line;
02408 PP_DIR_PREFIX = Cdollar_Dir;
02409 PP_ACTUAL_DIR_PREFIX = Cdollar_Dir;
02410
02411 idx = NXT_COL(3);
02412
02413 if (dump_flags.mp &&
02414 is_dollar_directive(idx)) {
02415
02416 }
02417 else {
02418
02419 ch = nxt_line[NXT_COL(3)];
02420
02421 if (ch == ' ' ||
02422 ch == '\t' ||
02423 isdigit(ch)) {
02424
02425 PP_MP_LINE = TRUE;
02426 }
02427
02428 if ((dump_flags.mp ||
02429 dump_flags.open_mp ||
02430 on_off_flags.preprocess_only) &&
02431 ! cmd_line_flags.disregard_conditional_omp &&
02432 PP_MP_LINE) {
02433
02434 nxt_line[NXT_COL(1)] = ' ';
02435 nxt_line[NXT_COL(2)] = ' ';
02436 goto START;
02437 }
02438 else {
02439 PP_LINE_TYPE = Comment_Line;
02440 PP_MP_LINE = FALSE;
02441 }
02442 }
02443 }
02444 }
02445 # ifdef _DEBUG
02446 else if (((ch = nxt_line[NXT_COL(2)]) == uc_d || ch == lc_d) &&
02447 ((ch = nxt_line[NXT_COL(3)]) == uc_b || ch == lc_b) &&
02448 ((ch = nxt_line[NXT_COL(4)]) == uc_g || ch == lc_g) &&
02449 ((ch = nxt_line[NXT_COL(5)]) == dollar)) {
02450
02451 PP_PREFIX_LEN = 4;
02452
02453 first_line = FALSE;
02454
02455
02456
02457 MARK_CHAR_CONST(nxt_line[NXT_COL(5)]);
02458
02459 if ((ch = nxt_line[NXT_COL(6)]) != blank && ch != tab) {
02460
02461 if (IS_DIR_CONTINUATION(Cdbg_Dir)) {
02462
02463 PP_LINE_TYPE = Dir_Continuation_Line;
02464 PP_ACTUAL_DIR_PREFIX = Cdbg_Dir;
02465 in_format = FALSE;
02466 PP_IDX = NXT_COL(6);
02467 }
02468 else {
02469 PP_LINE_TYPE = Comment_Line;
02470 }
02471 }
02472 else {
02473
02474 PP_IDX = NXT_COL(2);
02475 in_format = FALSE;
02476 PP_LINE_TYPE = Dir_Line;
02477 PP_DIR_PREFIX = Cdbg_Dir;
02478 PP_ACTUAL_DIR_PREFIX = Cdbg_Dir;
02479
02480 idx = NXT_COL(6);
02481 }
02482 }
02483 # endif
02484 else {
02485 PP_LINE_TYPE = Comment_Line;
02486 }
02487 }
02488 else if (ch == star) {
02489 if ((ch = nxt_line[NXT_COL(2)]) == dollar &&
02490 (ch = nxt_line[NXT_COL(3)]) == star) {
02491
02492
02493
02494 PP_PREFIX_LEN = 3;
02495
02496 first_line = FALSE;
02497
02498
02499 MARK_CHAR_CONST(nxt_line[NXT_COL(2)]);
02500
02501
02502 if ((ch = nxt_line[NXT_COL(4)]) == amp) {
02503
02504 if (IS_DIR_CONTINUATION(Cstar_Dir)) {
02505
02506 PP_LINE_TYPE = Dir_Continuation_Line;
02507 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
02508 in_format = FALSE;
02509 PP_IDX = NXT_COL(4);
02510 }
02511 else {
02512 PP_LINE_TYPE = Comment_Line;
02513 }
02514 }
02515 else {
02516
02517 PP_IDX = NXT_COL(1);
02518 in_format = FALSE;
02519 PP_LINE_TYPE = Dir_Line;
02520 PP_DIR_PREFIX = Cstar_Dir;
02521 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
02522
02523 idx = NXT_COL(4);
02524
02525 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
02526 if (! is_star_directive(idx)) {
02527 PP_LINE_TYPE = Comment_Line;
02528 }
02529 # else
02530 if ((! dump_flags.mp &&
02531 ! on_off_flags.preprocess_only) ||
02532 ! is_star_directive(idx)) {
02533 PP_LINE_TYPE = Comment_Line;
02534 }
02535 # endif
02536 }
02537 }
02538 else {
02539 PP_LINE_TYPE = Comment_Line;
02540 }
02541 }
02542 else if (ch == bang | ch == star) {
02543 PP_LINE_TYPE = Comment_Line;
02544 }
02545 else {
02546
02547 do {
02548 if (nxt_line[++PP_IDX] == tab) {
02549
02550
02551
02552
02553
02554
02555
02556
02557 if (IS_1TO9(nxt_line[PP_IDX+1])) {
02558 cont_col = PP_IDX+1;
02559 }
02560 else {
02561 cont_col = PP_IDX;
02562 }
02563 }
02564 }
02565 while (PP_IDX < cont_col);
02566
02567 if (nxt_line[cont_col] == zero) {
02568 nxt_line[cont_col] = blank;
02569 }
02570
02571 PP_IDX = NXT_COL(NULL_IDX);
02572
02573 do {
02574 ch = nxt_line[++PP_IDX];
02575 }
02576 while (ch == blank | ch == tab);
02577
02578 if (ch == newline) {
02579 PP_EOL = PP_IDX;
02580 PP_LINE_TYPE = Comment_Line;
02581 }
02582 else if (ch == bang) {
02583 if (PP_IDX == cont_col) {
02584 PP_LINE_TYPE = Continuation_Line;
02585 }
02586 else {
02587 PP_LINE_TYPE = Comment_Line;
02588 }
02589 }
02590 else if (PP_IDX > cont_col) {
02591 PP_IDX--;
02592 PP_LINE_TYPE = Regular_Line;
02593 format_idx = -1;
02594 in_format = FALSE;
02595 }
02596 else if (PP_IDX < cont_col) {
02597
02598 label = TRUE;
02599
02600
02601 i = PP_IDX;
02602 while (i < cont_col) {
02603
02604 if (nxt_line[i] == blank ||
02605 nxt_line[i] == tab ||
02606 (nxt_line[i] >= zero && nxt_line[i] <= nine)) {
02607
02608 i++;
02609 }
02610 else {
02611 label = FALSE;
02612 break;
02613 }
02614 }
02615
02616 if (label) {
02617
02618 if (nxt_line[cont_col] != blank &&
02619 nxt_line[cont_col] != tab) {
02620
02621
02622
02623 if (issue_classify_msg) {
02624 ntr_next_msg_queue(PP_LINE_NUM, 56, Error,
02625 nxt_line_col[PP_IDX],
02626 (char *)NULL,
02627 0,
02628 NO_ARG);
02629 }
02630
02631 PP_IDX = cont_col;
02632 PP_LINE_TYPE = Continuation_Line;
02633 }
02634 else {
02635 PP_LABEL = TRUE;
02636 PP_IDX--;
02637 PP_LINE_TYPE = Regular_Line;
02638 format_idx = 0;
02639 in_format = FALSE;
02640 }
02641 }
02642 else {
02643
02644
02645
02646 if (issue_classify_msg) {
02647 ntr_next_msg_queue(PP_LINE_NUM, 400, Error,
02648 nxt_line_col[PP_IDX],
02649 (char *)NULL,
02650 0,
02651 NO_ARG);
02652 }
02653
02654 if (nxt_line[cont_col] != blank &&
02655 nxt_line[cont_col] != tab) {
02656 PP_IDX = cont_col;
02657 PP_LINE_TYPE = Continuation_Line;
02658 }
02659 else {
02660 PP_IDX = cont_col;
02661 PP_LINE_TYPE = Regular_Line;
02662 format_idx = -1;
02663 in_format = FALSE;
02664 }
02665 }
02666 }
02667 else {
02668 PP_LINE_TYPE = Continuation_Line;
02669
02670 if (! valid_f90_char[nxt_line[cont_col]] &&
02671 issue_classify_msg) {
02672 err_str[0] = nxt_line[cont_col];
02673 err_str[1] = '\0';
02674 ntr_next_msg_queue(PP_LINE_NUM, 799, Ansi,
02675 nxt_line_col[cont_col],
02676 err_str,
02677 0,
02678 STR_ARG);
02679 }
02680 }
02681
02682 if (first_line && PP_LINE_TYPE != Comment_Line) {
02683
02684 if (PP_LINE_TYPE == Continuation_Line && issue_classify_msg) {
02685 ntr_next_msg_queue(PP_LINE_NUM, 211, Error,
02686 nxt_line_col[cont_col],
02687 (char *)NULL,
02688 0,
02689 NO_ARG);
02690 }
02691
02692 first_line = FALSE;
02693 }
02694 }
02695
02696 if (PP_LINE_TYPE == Regular_Line |
02697 PP_LINE_TYPE == Dir_Line |
02698 PP_LINE_TYPE == Dir_Continuation_Line |
02699 PP_LINE_TYPE == Continuation_Line) {
02700 idx = NXT_COL(0);
02701
02702 if (PP_LINE_TYPE != Continuation_Line &&
02703 PP_LINE_TYPE != Dir_Continuation_Line) {
02704 previous_char = 0;
02705 }
02706
02707
02708
02709
02710
02711
02712
02713
02714 if (format_idx >= 0) {
02715
02716 if (PP_IDX > cont_col) {
02717 idx = PP_IDX;
02718 }
02719 else {
02720 idx = cont_col;
02721 }
02722
02723 ich = nxt_line[idx];
02724 while ((format_idx < 7) && (ich)) {
02725
02726 do {
02727 ich = nxt_line[++idx];
02728 }
02729 while (ich == blank | ich == tab);
02730
02731 if ((ich == newline) | (ich == bang)) {
02732 PP_EOL = idx;
02733 break;
02734 }
02735 if (! ((ich == format_str[format_idx][0]) |
02736 (ich == format_str[format_idx][1]))) {
02737 format_idx = -1;
02738 idx--;
02739 break;
02740 }
02741 format_idx++;
02742
02743 }
02744
02745 if (format_idx == 7) {
02746
02747 in_format = TRUE;
02748 format_idx = -1;
02749 previous_char = ich;
02750 }
02751 }
02752
02753
02754 if (format_idx < 0) {
02755
02756 if (PP_LINE_TYPE != Continuation_Line &&
02757 PP_LINE_TYPE != Dir_Continuation_Line) {
02758 char_delim = 0;
02759 digit_start = 0;
02760 seen_lp_eq_slash = FALSE;
02761 }
02762
02763 if (idx == NXT_COL(0)) {
02764 idx = PP_IDX;
02765 }
02766
02767 if (PP_LINE_TYPE == Continuation_Line &&
02768 prev_char_delim != 0 &&
02769 idx == cont_col &&
02770 nxt_line[idx + 1] == prev_char_delim) {
02771
02772
02773
02774
02775 if (nxt_line_num_lines > 1) {
02776 MARK_CHAR_CONST(nxt_line[prev_char_delim_idx]);
02777 }
02778 else {
02779 MARK_CHAR_CONST(stmt_buf[stmt_line_start_idx[lines_in_buf] +
02780 prev_char_delim_idx - 1]);
02781 }
02782 idx++;
02783 MARK_CHAR_CONST(nxt_line[idx]);
02784 nxt_line[idx] |= (1 << 9);
02785
02786
02787
02788
02789 char_delim = prev_char_delim;
02790 }
02791
02792 prev_char_delim = 0;
02793
02794
02795
02796
02797
02798 # pragma _CRI align
02799 do {
02800 while (char_delim == 0) {
02801 ich = nxt_line[++idx];
02802
02803
02804
02805 while ((ich == blank) |
02806 (ich == tab)) {
02807 ich = nxt_line[++idx];
02808 }
02809
02810
02811
02812
02813 if ((ich == newline) |
02814 (ich == bang)) {
02815 PP_EOL = idx;
02816 idx = 0;
02817 break;
02818 }
02819
02820 else if (ich == semi_colon) {
02821 digit_start = 0;
02822 in_format = FALSE;
02823 seen_lp_eq_slash = FALSE;
02824 }
02825
02826 else if ((ich == quote) |
02827 (ich == db_quote)) {
02828 char_delim = ich;
02829 digit_start = 0;
02830 }
02831
02832 else if ((in_format) && (ich == star)) {
02833 char_delim = ich;
02834 digit_start = 0;
02835 }
02836
02837 else if (ich != EOF &&
02838 ch_class[(char)ich] == Ch_Class_Digit) {
02839
02840 if (digit_start == 0) {
02841
02842 if (PP_LINE_TYPE != Continuation_Line &&
02843 PP_LINE_TYPE != Dir_Continuation_Line) {
02844 digit_start = idx;
02845 }
02846 else if (nxt_line_num_lines > 1) {
02847 digit_start = idx;
02848 }
02849 else {
02850 digit_start = stmt_line_end_idx[lines_in_buf] + idx;
02851 }
02852 num_idx = 0;
02853 }
02854 else {
02855 num_idx++;
02856 }
02857 if (num_idx <= 4) {
02858 num_str[num_idx] = ich;
02859 num_str[num_idx + 1] = '\0';
02860 }
02861
02862
02863 continue;
02864 }
02865
02866 else if ((ich == lparen) |
02867 (ich == equal) |
02868 (ich == slash)) {
02869 seen_lp_eq_slash = TRUE;
02870 digit_start = 0;
02871 }
02872
02873
02874
02875 else if ((digit_start) && (previous_char)) {
02876 if (in_format) {
02877 if ((ich == lc_h) | (ich == uc_h)) {
02878
02879 sscanf(num_str, "%d",&char_delim);
02880 char_delim = - char_delim;
02881 }
02882 }
02883 else if ((ich == lc_h) |
02884 (ich == lc_r) |
02885 (ich == lc_l) |
02886 (ich == uc_h) |
02887 (ich == uc_r) |
02888 (ich == uc_l)) {
02889
02890 if (previous_char == star) {
02891
02892 if (seen_lp_eq_slash) {
02893 sscanf(num_str,"%d",&char_delim);
02894 char_delim = - char_delim;
02895 }
02896 }
02897 else if (previous_char == EOF) {
02898
02899
02900
02901 sscanf(num_str,"%d",&char_delim);
02902 char_delim = - char_delim;
02903 }
02904 else if (ch_class[previous_char] != Ch_Class_Letter &&
02905 previous_char != dollar &&
02906 previous_char != at_sign &&
02907 previous_char != underscore) {
02908 sscanf(num_str,"%d",&char_delim);
02909 char_delim = - char_delim;
02910 }
02911 }
02912 digit_start = 0;
02913
02914 }
02915
02916
02917
02918 previous_char = ich;
02919
02920 }
02921
02922
02923
02924
02925 if (char_delim) {
02926 previous_char = ' ';
02927
02928
02929
02930 if (char_delim < 0) {
02931
02932
02933 for (; char_delim < 0; char_delim++) {
02934 if (nxt_line[++idx] == newline) {
02935 if (idx <= NXT_COL(PP_ORIG_SIZE)) {
02936 shift_to_line_size((NXT_COL(PP_ORIG_SIZE)-idx)+1);
02937 nxt_line[idx] = marked_blank;
02938 for (i = idx + 1; i <= NXT_COL(PP_ORIG_SIZE); i++) {
02939 nxt_line[i] = blank;
02940 }
02941 nxt_line[i] = newline;
02942 PP_EOL = NXT_COL(PP_ORIG_SIZE) + 1;
02943 }
02944 else {
02945 PP_EOL = idx;
02946 idx = 0;
02947 break;
02948 }
02949 }
02950 else {
02951 MARK_CHAR_CONST(nxt_line[idx]);
02952 }
02953 }
02954 }
02955 else {
02956
02957
02958
02959 while (TRUE) {
02960 if (nxt_line[++idx] == newline) {
02961 if (idx <= NXT_COL(PP_ORIG_SIZE)) {
02962 shift_to_line_size((NXT_COL(PP_ORIG_SIZE)-idx)+1);
02963
02964 for (; idx <= NXT_COL(PP_ORIG_SIZE); idx++) {
02965 nxt_line[idx] = marked_blank;
02966 }
02967 nxt_line[idx] = newline;
02968 }
02969 PP_EOL = NXT_COL(PP_ORIG_SIZE) + 1;
02970 idx = 0;
02971 break;
02972 }
02973 else if (nxt_line[idx] == char_delim) {
02974 if (nxt_line[idx + 1] == char_delim) {
02975 MARK_CHAR_CONST(nxt_line[idx]);
02976 ++idx;
02977 MARK_CHAR_CONST(nxt_line[idx]);
02978 nxt_line[idx] |= (1 << 9);
02979 }
02980 else if (nxt_line[idx + 1] == newline &&
02981 idx == NXT_COL(PP_ORIG_SIZE)) {
02982
02983 prev_char_delim = char_delim;
02984 prev_char_delim_idx = idx;
02985 char_delim = 0;
02986 break;
02987 }
02988 else {
02989
02990 char_delim = 0;
02991 break;
02992 }
02993 } else {
02994 MARK_CHAR_CONST(nxt_line[idx]);
02995 }
02996 }
02997 }
02998
02999 }
03000 }
03001 while (idx);
03002
03003 }
03004 }
03005
03006
03007 if (PP_LINE_TYPE == Regular_Line) {
03008 nxt_idx = cont_col;
03009
03010 do {
03011 ch = nxt_line[++nxt_idx];
03012 }
03013 while (ch == blank | ch == tab);
03014
03015 if (ch == uc_i | ch == lc_i) {
03016 incl_idx = NULL_IDX;
03017
03018 do {
03019 ch_tmp = ch;
03020 if (islower(ch_tmp)) {
03021 ch = TOUPPER(ch_tmp);
03022 }
03023 include_file[incl_idx++] = ch;
03024
03025 do {
03026 ch = nxt_line[++nxt_idx];
03027 }
03028 while (ch == blank | ch == tab);
03029 }
03030 while (incl_idx < 7 && ch != eos);
03031
03032 include_file[incl_idx] = EOS;
03033
03034 if (EQUAL_STRS(include_file, "INCLUDE")) {
03035 if (ch == quote | ch == db_quote) {
03036 PP_LINE_TYPE = Comment_Line;
03037
03038
03039 delim = ch;
03040 incl_idx = NULL_IDX;
03041
03042 while ((ch = nxt_line[++nxt_idx]) != delim && ch != eos) {
03043 if (incl_idx < MAX_FILE_NAME_SIZE) {
03044 include_file[incl_idx++] = ch;
03045 }
03046 else if (incl_idx == MAX_FILE_NAME_SIZE) {
03047
03048
03049
03050 ntr_next_msg_queue(PP_LINE_NUM, 57, Error,
03051 nxt_line_col[nxt_idx],
03052 (char *)NULL,
03053 (MAX_FILE_NAME_SIZE - 1),
03054 ARG_ARG);
03055 }
03056 }
03057 include_file[incl_idx] = eos;
03058
03059 if (incl_idx == NULL_IDX) {
03060 ntr_next_msg_queue(PP_LINE_NUM, 58, Error,
03061 nxt_line_col[nxt_idx],
03062 (char *)NULL,
03063 0,
03064 NO_ARG);
03065 }
03066 else if (ch == eos) {
03067 ntr_next_msg_queue(PP_LINE_NUM, 59, Error,
03068 nxt_line_col[NXT_COL(PP_ORIG_SIZE)],
03069 (char *)NULL,
03070 0,
03071 NO_ARG);
03072 }
03073 else {
03074
03075 do {
03076 ch = nxt_line[++nxt_idx];
03077 }
03078 while (ch == blank | ch == tab);
03079
03080 if (ch != newline && ch != bang) {
03081
03082
03083
03084 ntr_next_msg_queue(PP_LINE_NUM, 60, Error,
03085 nxt_line_col[nxt_idx],
03086 (char *)NULL,
03087 0,
03088 NO_ARG);
03089 }
03090 else if (PP_IDX < cont_col) {
03091
03092
03093
03094 ntr_next_msg_queue(PP_LINE_NUM, 61, Error,
03095 nxt_line_col[PP_IDX],
03096 (char *)NULL,
03097 0,
03098 NO_ARG);
03099 }
03100 else {
03101 PP_LINE_TYPE = Include_Line;
03102 }
03103 }
03104 }
03105 }
03106 }
03107 }
03108
03109 if (!issue_obsolete_src_form_msg && !PP_CHANGE_SOURCE_FORM &&
03110 issue_classify_msg) {
03111 issue_obsolete_src_form_msg = TRUE;
03112 ntr_next_msg_queue(PP_LINE_NUM, 1582,
03113 #ifdef KEY
03114 Ansi,
03115 #else
03116 Comment,
03117 #endif
03118 0,
03119 (char *)NULL,
03120 0,
03121 NO_ARG);
03122 }
03123
03124 TRACE (Func_Exit, "fixed_classify_line", line_type_str[PP_LINE_TYPE]);
03125
03126 return;
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 static void free_get_stmt (void)
03155
03156 {
03157 int idx;
03158 int line_counter = 1;
03159 int loc_stmt_num;
03160 int save_idx;
03161 int stmt_buf_EOS;
03162
03163 TRACE (Func_Entry, "free_get_stmt", NULL);
03164
03165
03166
03167 issue_deferred_msgs();
03168
03169
03170 if (stmt_buf_type == EOF_Line) {
03171
03172 PRINTMSG (0, 50, Internal, 0);
03173 }
03174
03175 stmt_line_idx = NULL_IDX;
03176 stmt_buf_idx = NULL_IDX;
03177 lines_in_buf = 0;
03178 label_ok = TRUE;
03179
03180
03181 # pragma _CRI align
03182 do {
03183
03184 save_idx = 0;
03185
03186
03187
03188 stmt_line_num[++stmt_line_idx] = nxt_line_num;
03189
03190
03191
03192 if (starting_pt) {
03193 stmt_line_offset[stmt_line_idx] = starting_pt - 2;
03194 }
03195 else {
03196 stmt_line_offset[stmt_line_idx] = nxt_line_idx - 1;
03197 }
03198
03199
03200
03201 stmt_line_start_idx[stmt_line_idx] = line_counter;
03202
03203
03204
03205 stmt_line_end_idx[stmt_line_idx] = nxt_line_EOL + line_counter - 1;
03206
03207
03208
03209 if (nxt_line_type != Continuation_Line &&
03210 nxt_line_type != Dir_Continuation_Line) {
03211 stmt_buf_type = nxt_line_type;
03212
03213 if (nxt_line_type == Dir_Line) {
03214 stmt_prefix_len = nxt_line_prefix_len;
03215 stmt_buf_dir_prefix = nxt_line_dir_prefix;
03216 }
03217
03218 if (stmt_buf_type != Comment_Line &&
03219 stmt_buf_type != Pound_Src_Line &&
03220 stmt_buf_type != Pound_Include_Exit_Line) {
03221 INCREMENT_STATEMENT_NUMBER;
03222 }
03223 }
03224
03225 if (stmt_buf_type == Dir_Line) {
03226 line_dir_prefix[stmt_line_idx] = nxt_line_actual_dir_prefix;
03227 }
03228
03229 move_up_next_msg_queue();
03230
03231
03232
03233 stmt_buf_idx = line_counter + nxt_line_EOL - 1;
03234 line_counter += nxt_line_EOL;
03235
03236 for (idx = nxt_line_EOL; idx > 0; idx --) {
03237 stmt_buf[stmt_buf_idx] = nxt_line[NXT_COL(idx)];
03238 stmt_buf_col[stmt_buf_idx] = nxt_line_col[NXT_COL(idx)];
03239 stmt_buf_idx--;
03240
03241 if (havent_issued_tab_ansi &&
03242 idx < nxt_line_EOL &&
03243 nxt_line[NXT_COL(idx)] == tab) {
03244 havent_issued_tab_ansi = FALSE;
03245 ntr_msg_queue(nxt_line_num, 899, Ansi,
03246 nxt_line_col[NXT_COL(idx)],
03247 (char *)NULL,
03248 0,
03249 NO_ARG);
03250 }
03251
03252 if (nxt_line[NXT_COL(idx)] == semi_colon &&
03253 stmt_buf_type != Dir_Line) {
03254 if ((idx > starting_pt) && (idx < nxt_line_EOL)) {
03255 save_idx = idx;
03256 }
03257 }
03258 }
03259
03260 lines_in_buf++;
03261
03262
03263
03264
03265
03266
03267
03268
03269 if (save_idx &&
03270 nxt_line_type != Comment_Line) {
03271
03272 stmt_buf_EOS = save_idx;
03273 idx = save_idx;
03274 while ((nxt_line[NXT_COL(idx)] == semi_colon) |
03275 (nxt_line[NXT_COL(idx)] == blank) |
03276 (nxt_line[NXT_COL(idx)] == tab)) {
03277 idx++;
03278 }
03279
03280
03281
03282 starting_pt = idx;
03283 nxt_line_type = Regular_Line;
03284 continuation_count = 0;
03285 include_found = FALSE;
03286 include_complete = FALSE;
03287 }
03288 else {
03289 stmt_buf_EOS = nxt_line_EOL;
03290 starting_pt = NULL_IDX;
03291 }
03292
03293
03294
03295
03296
03297 if ((stmt_buf_type != EOF_Line) &&
03298 (starting_pt == NULL_IDX)) {
03299
03300
03301 do {
03302
03303 nxt_line_type = Regular_Line;
03304
03305 if (get_nxt_line ()) {
03306
03307 if (include_switch) {
03308 update_global_line ();
03309 include_switch = FALSE;
03310 }
03311
03312 if (issue_pound_exit_line) {
03313 OUTPUT_POUND_INCLUDE_EXIT_LINE(curr_glb_line);
03314 issue_pound_exit_line = FALSE;
03315 }
03316
03317 nxt_line_mp_line = FALSE;
03318
03319 if (nxt_line_type != Cond_Comp_Line) {
03320 PP_ORIG_SIZE = line_size;
03321 classify_line();
03322 }
03323
03324 if (on_off_flags.save_dot_i) {
03325
03326 if (ignore_source_line ||
03327 nxt_line_type == Cond_Comp_Line ||
03328 nxt_line_type == Include_Line) {
03329
03330
03331 fprintf(dot_i_fptr, "\n");
03332 previous_global_line++;
03333 }
03334 else {
03335 print_nxt_line();
03336 }
03337 }
03338
03339 switch (nxt_line_type) {
03340 case Comment_Line:
03341 break;
03342
03343 case Cond_Comp_Line:
03344 if (parse_cc_line()) {
03345
03346
03347
03348 nxt_line_type = Include_Line;
03349 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
03350
03351 #ifdef KEY
03352 if (open_include_file (TRUE, FALSE))
03353 #else
03354 if (open_include_file (TRUE))
03355 #endif
03356 {
03357 include_found = TRUE;
03358 include_switch = TRUE;
03359 }
03360 }
03361 else {
03362 nxt_line_type = Comment_Line;
03363 }
03364 angle_brkt_include = FALSE;
03365 break;
03366
03367 case Dir_Line:
03368 case Regular_Line:
03369 continuation_count = 0;
03370 include_found = FALSE;
03371 include_complete = FALSE;
03372 break;
03373
03374 case Continuation_Line:
03375 case Dir_Continuation_Line:
03376
03377 if (++continuation_count == MAX_ANSI_FREE_LINES) {
03378
03379
03380
03381 ntr_msg_queue(nxt_line_num, 52, Ansi,
03382 nxt_line_idx,
03383 "free",
03384 (MAX_ANSI_FREE_LINES - 1),
03385 ARG_STR_ARG);
03386 }
03387
03388 if (continuation_count == MAX_FREE_LINES) {
03389
03390
03391
03392 ntr_msg_queue(nxt_line_num, 525, Error,
03393 CONTINUE_COLUMN,
03394 (char *)NULL,
03395 0,
03396 NO_ARG);
03397 }
03398
03399 if (continuation_count >= MAX_FREE_LINES) {
03400 nxt_line_type = Comment_Line;
03401 break;
03402 }
03403
03404 if (include_found) {
03405
03406
03407
03408 ntr_msg_queue(nxt_line_num, 53, Error,
03409 nxt_line_idx,
03410 (char *)NULL,
03411 0,
03412 NO_ARG);
03413
03414 include_found = FALSE;
03415 }
03416
03417 if (include_complete) {
03418
03419
03420
03421 ntr_msg_queue(nxt_line_num, 54, Error,
03422 nxt_line_idx,
03423 (char *)NULL,
03424 0,
03425 NO_ARG);
03426
03427 include_complete = FALSE;
03428 }
03429
03430 if (cif_flags & MISC_RECS) {
03431 cif_cont_line_rec(
03432 (nxt_line_type == Continuation_Line) ? 0 : 1,
03433 nxt_line_num);
03434 }
03435
03436 break;
03437
03438 case Pound_Src_Line:
03439 break;
03440
03441 case Pound_Include_Exit_Line:
03442 include_complete = TRUE;
03443 nxt_line_type = Comment_Line;
03444 curr_glb_line--;
03445 SRC_STK_FILE_LINE(src_stk_idx)--;
03446 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
03447 SRC_STK_FILE_LINE(src_stk_idx);
03448 set_related_gl_source_lines(
03449 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
03450
03451 if (source_form != SRC_STK_PREV_SRC_FORM(src_stk_idx)) {
03452 change_source_form = TRUE;
03453 }
03454 POP_SRC;
03455 include_switch = TRUE;
03456 break;
03457
03458 case Pound_Include_Enter_Line:
03459 case Include_Line:
03460
03461 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
03462
03463 #ifdef KEY
03464 if (open_include_file (FALSE,
03465 Pound_Include_Enter_Line == nxt_line_type))
03466 #else
03467 if (open_include_file (FALSE))
03468 #endif
03469 {
03470 include_found = TRUE;
03471 include_switch = TRUE;
03472 }
03473 break;
03474 }
03475 }
03476 else {
03477
03478
03479
03480 if (cmd_line_flags.pp_macro_expansion) {
03481 pp_line_idx++;
03482 }
03483
03484 if (expected_line == Continuation_Line) {
03485 ntr_msg_queue(stmt_line_num[lines_in_buf], 539, Error,
03486 stmt_line_end_idx[lines_in_buf] -
03487 stmt_line_start_idx[lines_in_buf] + 1,
03488 (char *)NULL,
03489 0,
03490 NO_ARG);
03491 }
03492
03493
03494
03495 if (src_stk_idx > SRC_STK_BASE_IDX) {
03496 include_complete = TRUE;
03497 nxt_line_type = Comment_Line;
03498 nxt_line_EOL = 2;
03499 curr_glb_line--;
03500
03501 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
03502 SRC_STK_FILE_LINE(src_stk_idx);
03503 set_related_gl_source_lines(
03504 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
03505
03506 if (source_form != SRC_STK_PREV_SRC_FORM(src_stk_idx)) {
03507 change_source_form = TRUE;
03508 }
03509 POP_SRC;
03510 include_switch = TRUE;
03511 issue_pound_exit_line = TRUE;
03512 break;
03513 }
03514 else {
03515 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
03516 SRC_STK_FILE_LINE(src_stk_idx);
03517 set_related_gl_source_lines(
03518 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
03519 nxt_line_type = EOF_Line;
03520 nxt_line_EOL = 2;
03521 }
03522 }
03523 }
03524 while (nxt_line_type == Comment_Line |
03525 nxt_line_type == Include_Line |
03526 nxt_line_type == Pound_Include_Enter_Line);
03527 }
03528 }
03529 while (nxt_line_type == Continuation_Line ||
03530 nxt_line_type == Dir_Continuation_Line);
03531
03532 if (prev_statement_number != statement_number) {
03533 loc_stmt_num = statement_number;
03534 statement_number = prev_statement_number;
03535 prev_statement_number = loc_stmt_num;
03536 }
03537
03538 stmt_buf_EOS_idx = stmt_line_start_idx[lines_in_buf] + stmt_buf_EOS - 1;
03539 stmt_EOS_la_ch.line = stmt_line_num[lines_in_buf];
03540 stmt_EOS_la_ch.column = stmt_buf_col[stmt_buf_EOS_idx];
03541 stmt_EOS_la_ch.stmt_buf_idx = stmt_buf_EOS_idx;
03542 stmt_EOS_la_ch.stmt_num = statement_number;
03543
03544 stmt_buf_idx = stmt_line_offset[1] + 1;
03545 stmt_line_idx = SRC_STK_BASE_IDX;
03546
03547 PRINT_STMT_SRC();
03548
03549 TRACE (Func_Exit, "free_get_stmt", NULL);
03550
03551 return;
03552
03553 }
03554
03555
03556
03557
03558
03559
03560
03561
03562
03563
03564
03565
03566
03567
03568
03569
03570
03571
03572 static void free_classify_line (void)
03573
03574 {
03575 int ch;
03576 char delim;
03577 char form[5] = " ";
03578 boolean had_amp = FALSE;
03579 int i;
03580 int ich;
03581 int idx;
03582 int incl_idx;
03583 boolean label_found = FALSE;
03584 int line_num;
03585 char line_num_str[24];
03586 int save_curr_glb_line;
03587 int src_idx;
03588 int sv_amp;
03589
03590
03591
03592 TRACE (Func_Entry, "free_classify_line", NULL);
03593
03594 PP_EOL = nxt_line_end_idx[pp_line_idx] - 1;
03595 PP_EXPECTED_LINE = expected_line;
03596
03597 START:
03598
03599 ch = nxt_line[NXT_COL(1)];
03600
03601 # ifdef _FRONTEND_CONDITIONAL_COMP
03602 if (ch == pound &&
03603 on_off_flags.preprocess) {
03604
03605 PP_LINE_TYPE = Cond_Comp_Line;
03606 } else
03607 # endif
03608 if (is_pound_line_dir()) {
03609 PP_IDX = NXT_COL(2);
03610 ch = nxt_line[PP_IDX];
03611
03612 while (ch == blank | ch == tab) {
03613 PP_IDX++;
03614 ch = nxt_line[PP_IDX];
03615 }
03616
03617 if (isdigit(ch)) {
03618 idx = 0;
03619 line_num_str[idx++] = ch;
03620 ch = nxt_line[++PP_IDX];
03621 while (isdigit(ch)) {
03622 line_num_str[idx++] = ch;
03623 ch = nxt_line[++PP_IDX];
03624 }
03625
03626 line_num_str[idx] = '\0';
03627 line_num = atoi(line_num_str);
03628
03629 while (ch == blank | ch == tab) {
03630 PP_IDX++;
03631 ch = nxt_line[PP_IDX];
03632 }
03633
03634 if (ch == quote | ch == db_quote) {
03635 char_delim = ch;
03636 ch = nxt_line[++PP_IDX];
03637
03638 idx = 0;
03639 while (ch != char_delim) {
03640 include_file[idx++] = ch;
03641 ch = nxt_line[++PP_IDX];
03642 }
03643 include_file[idx] = '\0';
03644
03645 ch = nxt_line[++PP_IDX];
03646 while (ch == blank | ch == tab) {
03647 PP_IDX++;
03648 ch = nxt_line[PP_IDX];
03649 }
03650
03651 if (ch == '1') {
03652 PP_LINE_TYPE = Pound_Include_Enter_Line;
03653 }
03654 else if (ch == '2') {
03655 PP_LINE_TYPE = Pound_Include_Exit_Line;
03656 }
03657 else {
03658 PP_LINE_TYPE = Comment_Line;
03659
03660
03661
03662
03663 save_curr_glb_line = curr_glb_line;
03664 curr_glb_line = line_num + GL_GLOBAL_LINE(global_line_tbl_idx) -
03665 GL_FILE_LINE(global_line_tbl_idx);
03666 curr_glb_line--;
03667
03668 if (first_pound_line) {
03669 PP_LINE_TYPE = Pound_Src_Line;
03670 change_orig_src_file = TRUE;
03671 strcpy(pound_file, include_file);
03672 }
03673 else {
03674 SRC_STK_FILE_LINE(src_stk_idx) +=
03675 curr_glb_line - save_curr_glb_line;
03676 }
03677 }
03678
03679 first_pound_line = FALSE;
03680
03681 }
03682 else if (ch == newline) {
03683
03684 PP_LINE_TYPE = Comment_Line;
03685
03686
03687
03688
03689 save_curr_glb_line = curr_glb_line;
03690 curr_glb_line = line_num + GL_GLOBAL_LINE(global_line_tbl_idx) -
03691 GL_FILE_LINE(global_line_tbl_idx);
03692 curr_glb_line--;
03693
03694 SRC_STK_FILE_LINE(src_stk_idx) +=
03695 curr_glb_line - save_curr_glb_line;
03696
03697 first_pound_line = FALSE;
03698 }
03699 else {
03700 PP_LINE_TYPE = Comment_Line;
03701 }
03702 }
03703 else {
03704 PP_LINE_TYPE = Comment_Line;
03705 }
03706 }
03707 else if (ignore_source_line) {
03708 PP_LINE_TYPE = Comment_Line;
03709 }
03710 else {
03711
03712 PP_IDX = NXT_COL(NULL_IDX);
03713
03714 do {
03715 ch = nxt_line[++PP_IDX];
03716 }
03717 while (ch == blank || ch == tab);
03718
03719 switch (ch) {
03720 case BANG:
03721 if (((ch = nxt_line[PP_IDX+1]) == uc_d || ch == lc_d) &&
03722 ((ch = nxt_line[PP_IDX+2]) == uc_i || ch == lc_i) &&
03723 ((ch = nxt_line[PP_IDX+3]) == uc_r || ch == lc_r) &&
03724 ((ch = nxt_line[PP_IDX+4]) == dollar || ch == at_sign)) {
03725
03726 PP_PREFIX_LEN = 4;
03727
03728
03729 MARK_CHAR_CONST(nxt_line[PP_IDX+4]);
03730
03731 if (nxt_line[PP_IDX+5] == zero) {
03732 nxt_line[PP_IDX+5] = blank;
03733 }
03734
03735 if (issue_classify_msg &&
03736 expected_line == Continuation_Line) {
03737
03738 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
03739 (char *)NULL,
03740 0,
03741 NO_ARG);
03742 expected_line = Regular_Line;
03743 PP_EXPECTED_LINE = expected_line;
03744 }
03745
03746 if ((ch = nxt_line[PP_IDX+5]) != blank && ch != tab) {
03747
03748 if (IS_DIR_CONTINUATION(Cdir_Dir)) {
03749
03750 PP_LINE_TYPE = Dir_Continuation_Line;
03751 PP_ACTUAL_DIR_PREFIX = Cdir_Dir;
03752 in_format = FALSE;
03753 PP_IDX = PP_IDX+5;
03754 }
03755 else {
03756 PP_LINE_TYPE = Comment_Line;
03757 }
03758 }
03759 else {
03760 PP_IDX++;
03761 PP_LINE_TYPE = Dir_Line;
03762 PP_DIR_PREFIX = Cdir_Dir;
03763 PP_ACTUAL_DIR_PREFIX = Cdir_Dir;
03764 in_format = FALSE;
03765
03766 idx = PP_IDX + 4;
03767 do {
03768 ch = nxt_line[++idx];
03769 }
03770 while (ch == blank | ch == tab);
03771
03772 if (ch == lc_f | ch == uc_f) {
03773 for (i = 0; i < 5; i++) {
03774 ch = nxt_line[++idx];
03775
03776 if (ch == newline) {
03777 break;
03778 }
03779
03780 if (islower(ch)) {
03781 form[i] = TOUPPER(ch);
03782 }
03783 else {
03784 form[i] = ch;
03785 }
03786 }
03787
03788 if (strncmp(form, "IXED ", 5) == 0 &&
03789 !disregard_directive[Tok_Dir_Fixed-Tok_Dir_Start]) {
03790 PP_CHANGE_SOURCE_FORM = TRUE;
03791
03792 if (!issue_obsolete_src_form_msg && issue_classify_msg) {
03793 ntr_next_msg_queue(PP_LINE_NUM, 1582,
03794 #ifdef KEY
03795 Ansi,
03796 #else
03797 Comment,
03798 #endif
03799 0,
03800 (char *)NULL,
03801 0,
03802 NO_ARG);
03803 issue_obsolete_src_form_msg = TRUE;
03804 }
03805 }
03806 }
03807 }
03808 }
03809 else if (((ch = nxt_line[PP_IDX+1]) == uc_m || ch == lc_m) &&
03810 ((ch = nxt_line[PP_IDX+2]) == uc_i || ch == lc_i) &&
03811 ((ch = nxt_line[PP_IDX+3]) == uc_c || ch == lc_c) &&
03812 ((ch = nxt_line[PP_IDX+4]) == dollar || ch == at_sign)) {
03813
03814 PP_PREFIX_LEN = 4;
03815
03816
03817 MARK_CHAR_CONST(nxt_line[PP_IDX+4]);
03818
03819 if (issue_classify_msg &&
03820 expected_line == Continuation_Line) {
03821
03822 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
03823 (char *)NULL,
03824 0,
03825 NO_ARG);
03826 expected_line = Regular_Line;
03827 PP_EXPECTED_LINE = expected_line;
03828 }
03829
03830 if ((ch = nxt_line[PP_IDX+5]) != blank && ch != tab) {
03831
03832 if (IS_DIR_CONTINUATION(Cmic_Dir)) {
03833
03834 PP_LINE_TYPE = Dir_Continuation_Line;
03835 PP_ACTUAL_DIR_PREFIX = Cmic_Dir;
03836 in_format = FALSE;
03837 PP_IDX = PP_IDX+5;
03838 }
03839 else {
03840 PP_LINE_TYPE = Comment_Line;
03841 }
03842 }
03843 else {
03844 PP_IDX++;
03845 PP_LINE_TYPE = Dir_Line;
03846 PP_DIR_PREFIX = Cmic_Dir;
03847 PP_ACTUAL_DIR_PREFIX = Cmic_Dir;
03848 in_format = FALSE;
03849
03850 idx = NXT_COL(6);
03851 }
03852 }
03853 else if (((ch = nxt_line[PP_IDX+1]) == dollar) &&
03854 ((ch = nxt_line[PP_IDX+2]) == uc_o || ch == lc_o) &&
03855 ((ch = nxt_line[PP_IDX+3]) == uc_m || ch == lc_m) &&
03856 ((ch = nxt_line[PP_IDX+4]) == uc_p || ch == lc_p)) {
03857
03858
03859
03860 PP_PREFIX_LEN = 4;
03861
03862
03863 MARK_CHAR_CONST(nxt_line[PP_IDX+1]);
03864
03865 if (issue_classify_msg &&
03866 dump_flags.open_mp &&
03867 expected_line == Continuation_Line) {
03868
03869 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
03870 (char *)NULL,
03871 0,
03872 NO_ARG);
03873 expected_line = Regular_Line;
03874 PP_EXPECTED_LINE = expected_line;
03875 }
03876
03877 if (expected_line == Dir_Continuation_Line) {
03878
03879 PP_EXPECTED_LINE = Regular_Line;
03880
03881 if (IS_DIR_CONTINUATION(Comp_Dir)) {
03882
03883 PP_LINE_TYPE = Dir_Continuation_Line;
03884 PP_ACTUAL_DIR_PREFIX = Comp_Dir;
03885 in_format = FALSE;
03886 PP_IDX = PP_IDX+5;
03887
03888 src_idx = PP_IDX;
03889
03890 do {
03891 ch = nxt_line[++src_idx];
03892 }
03893 while (ch == blank || ch == tab);
03894
03895 if (ch == AMP) {
03896
03897 PP_IDX = src_idx;
03898
03899 do {
03900 ch = nxt_line[++src_idx];
03901 }
03902 while (ch == blank || ch == tab);
03903
03904 if (ch == newline || ch == bang) {
03905 PP_EOL = src_idx;
03906
03907
03908
03909
03910 if (issue_classify_msg) {
03911 ntr_next_msg_queue(PP_LINE_NUM, 71, Ansi,
03912 nxt_line_col[src_idx],
03913 (char *)NULL,
03914 0,
03915 NO_ARG);
03916 }
03917
03918 PP_LINE_TYPE = Comment_Line;
03919 }
03920
03921 had_amp = TRUE;
03922 }
03923 }
03924 else {
03925 PP_LINE_TYPE = Comment_Line;
03926 }
03927 }
03928 else if ((ch = nxt_line[PP_IDX+5]) != blank && ch != tab) {
03929 PP_LINE_TYPE = Comment_Line;
03930 }
03931 else {
03932 idx = PP_IDX+5;
03933 PP_IDX++;
03934 PP_LINE_TYPE = Dir_Line;
03935 PP_DIR_PREFIX = Comp_Dir;
03936 PP_ACTUAL_DIR_PREFIX = Comp_Dir;
03937 in_format = FALSE;
03938
03939 # if ! defined(_TARGET_OS_MAX)
03940 if (! dump_flags.open_mp &&
03941 ! on_off_flags.preprocess_only) {
03942 PP_LINE_TYPE = Comment_Line;
03943 }
03944 # endif
03945 }
03946 }
03947 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
03948 else if (((ch = nxt_line[PP_IDX+1]) == dollar) &&
03949 ((ch = nxt_line[PP_IDX+2]) == uc_s || ch == lc_s) &&
03950 ((ch = nxt_line[PP_IDX+3]) == uc_g || ch == lc_g) &&
03951 ((ch = nxt_line[PP_IDX+4]) == uc_i || ch == lc_i)) {
03952
03953
03954
03955 PP_PREFIX_LEN = 4;
03956
03957
03958 MARK_CHAR_CONST(nxt_line[PP_IDX+1]);
03959
03960 if (issue_classify_msg &&
03961 dump_flags.open_mp &&
03962 expected_line == Continuation_Line) {
03963
03964 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
03965 (char *)NULL,
03966 0,
03967 NO_ARG);
03968 expected_line = Regular_Line;
03969 PP_EXPECTED_LINE = expected_line;
03970 }
03971
03972 if (expected_line == Dir_Continuation_Line) {
03973
03974 PP_EXPECTED_LINE = Regular_Line;
03975
03976 if (IS_DIR_CONTINUATION(Comp_Dir)) {
03977
03978 PP_LINE_TYPE = Dir_Continuation_Line;
03979 PP_ACTUAL_DIR_PREFIX = Csgi_Dir;
03980 in_format = FALSE;
03981 PP_IDX = PP_IDX+5;
03982
03983 src_idx = PP_IDX;
03984
03985 do {
03986 ch = nxt_line[++src_idx];
03987 }
03988 while (ch == blank || ch == tab);
03989
03990 if (ch == AMP) {
03991
03992 PP_IDX = src_idx;
03993
03994 do {
03995 ch = nxt_line[++src_idx];
03996 }
03997 while (ch == blank || ch == tab);
03998
03999 if (ch == newline || ch == bang) {
04000 PP_EOL = src_idx;
04001
04002
04003
04004
04005 if (issue_classify_msg) {
04006 ntr_next_msg_queue(PP_LINE_NUM, 71, Ansi,
04007 nxt_line_col[src_idx],
04008 (char *)NULL,
04009 0,
04010 NO_ARG);
04011 }
04012
04013 PP_LINE_TYPE = Comment_Line;
04014 }
04015
04016 had_amp = TRUE;
04017 }
04018 }
04019 else {
04020 PP_LINE_TYPE = Comment_Line;
04021 }
04022 }
04023 else if ((ch = nxt_line[PP_IDX+5]) != blank && ch != tab) {
04024 PP_LINE_TYPE = Comment_Line;
04025 }
04026 else {
04027 idx = PP_IDX+5;
04028 PP_IDX++;
04029 PP_LINE_TYPE = Dir_Line;
04030 PP_DIR_PREFIX = Comp_Dir;
04031 PP_ACTUAL_DIR_PREFIX = Csgi_Dir;
04032 in_format = FALSE;
04033
04034 if (! dump_flags.open_mp &&
04035 ! on_off_flags.preprocess_only) {
04036 PP_LINE_TYPE = Comment_Line;
04037 }
04038 }
04039 }
04040 # endif
04041 else if (((ch = nxt_line[PP_IDX+1]) == dollar) &&
04042 ((ch = nxt_line[PP_IDX+2]) == uc_p || ch == lc_p) &&
04043 ((ch = nxt_line[PP_IDX+3]) == uc_a || ch == lc_a) &&
04044 ((ch = nxt_line[PP_IDX+4]) == uc_r || ch == lc_r)) {
04045
04046
04047
04048 PP_PREFIX_LEN = 4;
04049
04050
04051 MARK_CHAR_CONST(nxt_line[PP_IDX+1]);
04052
04053 if (issue_classify_msg &&
04054 expected_line == Continuation_Line &&
04055 dump_flags.mp &&
04056 is_par_directive(PP_IDX+5)) {
04057
04058 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
04059 (char *)NULL,
04060 0,
04061 NO_ARG);
04062 expected_line = Regular_Line;
04063 PP_EXPECTED_LINE = expected_line;
04064 }
04065
04066 if ((ch = nxt_line[PP_IDX+5]) == amp) {
04067
04068 if (IS_DIR_CONTINUATION(Cpar_Dir)) {
04069
04070 PP_LINE_TYPE = Dir_Continuation_Line;
04071 PP_ACTUAL_DIR_PREFIX = Cpar_Dir;
04072 in_format = FALSE;
04073 PP_IDX = PP_IDX+5;
04074 }
04075 else {
04076 PP_LINE_TYPE = Comment_Line;
04077 }
04078 }
04079 else {
04080 idx = PP_IDX+5;
04081 PP_IDX++;
04082 PP_LINE_TYPE = Dir_Line;
04083 PP_DIR_PREFIX = Cpar_Dir;
04084 PP_ACTUAL_DIR_PREFIX = Cpar_Dir;
04085 in_format = FALSE;
04086
04087 if ((! dump_flags.mp &&
04088 ! on_off_flags.preprocess_only) ||
04089 ! is_par_directive(idx)) {
04090 PP_LINE_TYPE = Comment_Line;
04091 }
04092 }
04093 }
04094 else if (((ch = nxt_line[PP_IDX+1]) == star) &&
04095 ((ch = nxt_line[PP_IDX+2]) == dollar) &&
04096 ((ch = nxt_line[PP_IDX+3]) == star)) {
04097
04098
04099
04100 PP_PREFIX_LEN = 3;
04101
04102
04103 MARK_CHAR_CONST(nxt_line[PP_IDX+2]);
04104
04105 if (issue_classify_msg &&
04106 expected_line == Continuation_Line &&
04107 dump_flags.mp &&
04108 is_star_directive(PP_IDX+4)) {
04109
04110 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error, nxt_line_col[PP_IDX],
04111 (char *)NULL,
04112 0,
04113 NO_ARG);
04114 expected_line = Regular_Line;
04115 PP_EXPECTED_LINE = expected_line;
04116 }
04117
04118 if ((ch = nxt_line[PP_IDX+4]) == amp) {
04119
04120 if (IS_DIR_CONTINUATION(Cstar_Dir)) {
04121
04122 PP_LINE_TYPE = Dir_Continuation_Line;
04123 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
04124 in_format = FALSE;
04125 PP_IDX = PP_IDX+4;
04126 }
04127 else {
04128 PP_LINE_TYPE = Comment_Line;
04129 }
04130 }
04131 else {
04132 idx = PP_IDX+4;
04133 PP_IDX++;
04134 PP_LINE_TYPE = Dir_Line;
04135 PP_DIR_PREFIX = Cstar_Dir;
04136 PP_ACTUAL_DIR_PREFIX = Cstar_Dir;
04137 in_format = FALSE;
04138
04139 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
04140 if (! is_star_directive(idx)) {
04141 PP_LINE_TYPE = Comment_Line;
04142 }
04143 # else
04144 if ((! dump_flags.mp &&
04145 ! on_off_flags.preprocess_only) ||
04146 ! is_star_directive(idx)) {
04147 PP_LINE_TYPE = Comment_Line;
04148 }
04149 # endif
04150 }
04151 }
04152 else if ((ch = nxt_line[PP_IDX+1]) == dollar) {
04153
04154
04155
04156 PP_PREFIX_LEN = 1;
04157
04158
04159 MARK_CHAR_CONST(nxt_line[PP_IDX+1]);
04160
04161 if ((ch = nxt_line[PP_IDX+2]) == amp &&
04162 dump_flags.mp &&
04163 IS_DIR_CONTINUATION(Cdollar_Dir)) {
04164
04165 PP_LINE_TYPE = Dir_Continuation_Line;
04166 PP_ACTUAL_DIR_PREFIX = Cdollar_Dir;
04167 in_format = FALSE;
04168 PP_IDX = PP_IDX+2;
04169 }
04170 else {
04171 idx = PP_IDX+2;
04172 PP_IDX++;
04173 PP_LINE_TYPE = Dir_Line;
04174 PP_DIR_PREFIX = Cdollar_Dir;
04175 PP_ACTUAL_DIR_PREFIX = Cdollar_Dir;
04176 in_format = FALSE;
04177
04178 if (dump_flags.mp &&
04179 is_dollar_directive(idx)) {
04180
04181 if (issue_classify_msg &&
04182 expected_line == Continuation_Line) {
04183
04184 ntr_next_msg_queue(PP_LINE_NUM, 1656, Error,
04185 nxt_line_col[PP_IDX],
04186 (char *)NULL,
04187 0,
04188 NO_ARG);
04189 expected_line = Regular_Line;
04190 PP_EXPECTED_LINE = expected_line;
04191 }
04192 }
04193 else {
04194
04195 ch = nxt_line[idx];
04196
04197 if (ch == ' ' ||
04198 ch == '\t' ||
04199 ch == amp ||
04200 isdigit(ch)) {
04201
04202 PP_MP_LINE = TRUE;
04203 }
04204
04205 if ((dump_flags.mp ||
04206 dump_flags.open_mp ||
04207 on_off_flags.preprocess_only) &&
04208 ! cmd_line_flags.disregard_conditional_omp &&
04209 PP_MP_LINE) {
04210
04211 nxt_line[PP_IDX - 1] = ' ';
04212 nxt_line[PP_IDX] = ' ';
04213 goto START;
04214 }
04215 else {
04216 PP_LINE_TYPE = Comment_Line;
04217 PP_MP_LINE = FALSE;
04218 }
04219 }
04220 }
04221 }
04222 # ifdef _DEBUG
04223 else if (((ch = nxt_line[PP_IDX+1]) == uc_d || ch == lc_d) &&
04224 ((ch = nxt_line[PP_IDX+2]) == uc_b || ch == lc_b) &&
04225 ((ch = nxt_line[PP_IDX+3]) == uc_g || ch == lc_g) &&
04226 ((ch = nxt_line[PP_IDX+4]) == dollar)) {
04227
04228 PP_PREFIX_LEN = 4;
04229
04230
04231 MARK_CHAR_CONST(nxt_line[PP_IDX+4]);
04232
04233 if ((ch = nxt_line[PP_IDX+5]) != blank && ch != tab) {
04234
04235 if (IS_DIR_CONTINUATION(Cdbg_Dir)) {
04236
04237 PP_LINE_TYPE = Dir_Continuation_Line;
04238 PP_ACTUAL_DIR_PREFIX = Cdbg_Dir;
04239 in_format = FALSE;
04240 PP_IDX = PP_IDX+5;
04241 }
04242 else {
04243 PP_LINE_TYPE = Comment_Line;
04244 }
04245 }
04246 else {
04247 PP_IDX++;
04248 PP_LINE_TYPE = Dir_Line;
04249 PP_DIR_PREFIX = Cdbg_Dir;
04250 PP_ACTUAL_DIR_PREFIX = Cdbg_Dir;
04251 in_format = FALSE;
04252
04253 idx = NXT_COL(6);
04254 }
04255 }
04256 # endif
04257 else {
04258 PP_LINE_TYPE = Comment_Line;
04259 }
04260 break;
04261
04262 case NEWLINE:
04263 PP_LINE_TYPE = Comment_Line;
04264 break;
04265
04266 case AMP:
04267 if (expected_line == Continuation_Line) {
04268
04269
04270 src_idx = PP_IDX;
04271
04272 do {
04273 ch = nxt_line[++src_idx];
04274 }
04275 while (ch == blank || ch == tab);
04276
04277 if (ch == newline || ch == bang) {
04278 PP_EOL = src_idx;
04279
04280
04281
04282 if (issue_classify_msg) {
04283 ntr_next_msg_queue(PP_LINE_NUM, 71, Ansi,
04284 nxt_line_col[src_idx],
04285 (char *)NULL,
04286 0,
04287 NO_ARG);
04288 }
04289
04290 PP_LINE_TYPE = Comment_Line;
04291 }
04292 else {
04293 PP_LINE_TYPE = Continuation_Line;
04294
04295 }
04296
04297 had_amp = TRUE;
04298 }
04299 else {
04300
04301 if (issue_classify_msg) {
04302 ntr_next_msg_queue(PP_LINE_NUM, 703, Error,
04303 nxt_line_col[PP_IDX],
04304 (char *)NULL,
04305 0,
04306 NO_ARG);
04307 }
04308
04309 PP_LINE_TYPE = Comment_Line;
04310 }
04311 break;
04312
04313 default:
04314 if (expected_line == Continuation_Line) {
04315
04316 if (char_delim != 0 && issue_classify_msg) {
04317
04318 ntr_next_msg_queue(PP_LINE_NUM, 505, Error,
04319 nxt_line_col[PP_IDX],
04320 (char *)NULL,
04321 0,
04322 NO_ARG);
04323 }
04324 PP_IDX = NXT_COL(NULL_IDX);
04325 PP_LINE_TYPE = Continuation_Line;
04326 }
04327 else {
04328 PP_IDX--;
04329 PP_LINE_TYPE = Regular_Line;
04330
04331
04332 src_idx = PP_IDX;
04333
04334 do {
04335 ch = nxt_line[++src_idx];
04336
04337 if (isdigit(ch)) {
04338 label_found = TRUE;
04339 ch = blank;
04340 }
04341 }
04342 while (ch == blank || ch == tab);
04343
04344 if (ch == 'I' || ch == 'i') {
04345 incl_idx = NULL_IDX;
04346
04347 do {
04348 if (islower(ch)) {
04349 ch = TOUPPER(ch);
04350 }
04351 include_file[incl_idx++] = ch;
04352 ch = nxt_line[++src_idx];
04353 }
04354 while (incl_idx < 7 && ch != eos);
04355
04356 include_file[incl_idx] = EOS;
04357
04358 if (EQUAL_STRS(include_file, "INCLUDE")) {
04359 do {
04360 ch = nxt_line[++src_idx];
04361 }
04362 while (ch == blank || ch == tab);
04363
04364 if (ch == quote || ch == db_quote) {
04365 PP_LINE_TYPE = Comment_Line;
04366
04367
04368 delim = ch;
04369 incl_idx = NULL_IDX;
04370
04371 while ((ch = nxt_line[++src_idx]) != delim && ch != eos) {
04372 if (incl_idx < MAX_FILE_NAME_SIZE) {
04373 include_file[incl_idx++] = ch;
04374 }
04375 else if (incl_idx == MAX_FILE_NAME_SIZE) {
04376
04377
04378
04379 ntr_next_msg_queue(PP_LINE_NUM, 57, Error,
04380 nxt_line_col[src_idx],
04381 (char *)NULL,
04382 (MAX_FILE_NAME_SIZE - 1),
04383 ARG_ARG);
04384 }
04385 }
04386 include_file[incl_idx] = EOS;
04387
04388 if (incl_idx == NULL_IDX) {
04389
04390
04391
04392 ntr_next_msg_queue(PP_LINE_NUM, 58, Error,
04393 nxt_line_col[src_idx],
04394 (char *)NULL,
04395 0,
04396 NO_ARG);
04397 }
04398 else if (ch == eos) {
04399
04400
04401
04402 ntr_next_msg_queue(PP_LINE_NUM, 59, Error,
04403 nxt_line_col[NXT_COL(PP_ORIG_SIZE)],
04404 (char *)NULL,
04405 0,
04406 NO_ARG);
04407 }
04408 else {
04409
04410 do {
04411 ch = nxt_line[++src_idx];
04412 }
04413 while (ch == blank || ch == tab);
04414
04415 if (ch != newline && ch != bang) {
04416
04417
04418
04419 ntr_next_msg_queue(PP_LINE_NUM, 60, Error,
04420 nxt_line_col[src_idx],
04421 (char *)NULL,
04422 0,
04423 NO_ARG);
04424 }
04425 else if (label_found) {
04426
04427
04428
04429 ntr_next_msg_queue(PP_LINE_NUM, 61, Error,
04430 nxt_line_col[PP_IDX],
04431 (char *)NULL,
04432 0,
04433 NO_ARG);
04434 }
04435 else {
04436 PP_LINE_TYPE = Include_Line;
04437 }
04438 }
04439 }
04440 }
04441 }
04442 }
04443 break;
04444 }
04445 }
04446
04447 if (PP_LINE_TYPE != Comment_Line &&
04448 PP_LINE_TYPE != Cond_Comp_Line &&
04449 PP_LINE_TYPE != Dir_Line) {
04450 PP_EXPECTED_LINE = Regular_Line;
04451 }
04452
04453
04454
04455
04456
04457
04458
04459
04460
04461
04462
04463
04464
04465
04466
04467
04468 if (PP_LINE_TYPE == Regular_Line |
04469 PP_LINE_TYPE == Dir_Line |
04470 PP_LINE_TYPE == Dir_Continuation_Line |
04471 PP_LINE_TYPE == Continuation_Line) {
04472
04473 if (PP_LINE_TYPE != Continuation_Line &&
04474 PP_LINE_TYPE != Dir_Continuation_Line) {
04475 seen_lp_eq_slash = FALSE;
04476 char_delim = 0;
04477 digit_start = 0;
04478 previous_char = 0;
04479 format_idx = -1;
04480 in_format = FALSE;
04481 }
04482
04483 idx = PP_IDX;
04484
04485 if (PP_LINE_TYPE == Continuation_Line &&
04486 prev_char_delim != 0 &&
04487 had_amp &&
04488 nxt_line[idx + 1] == prev_char_delim) {
04489
04490
04491
04492
04493 if (nxt_line_num_lines > 1) {
04494 MARK_CHAR_CONST(nxt_line[prev_char_delim_idx]);
04495 }
04496 else {
04497 MARK_CHAR_CONST(stmt_buf[stmt_line_start_idx[lines_in_buf] +
04498 prev_char_delim_idx - 1]);
04499 }
04500 idx++;
04501 MARK_CHAR_CONST(nxt_line[idx]);
04502 nxt_line[idx] |= (1 << 9);
04503
04504
04505
04506
04507 char_delim = prev_char_delim;
04508 }
04509
04510 prev_char_delim = 0;
04511
04512
04513 # pragma _CRI align
04514 do {
04515 while (char_delim == 0) {
04516 ich = nxt_line[++idx];
04517
04518
04519
04520
04521 if (ich == blank | ich == tab) {
04522 if ((format_idx > 0) && (format_idx < 6)) {
04523 format_idx = -1;
04524 }
04525 ich = nxt_line[++idx];
04526
04527 while ((ich == blank) |
04528 (ich == tab)) {
04529 ich = nxt_line[++idx];
04530 }
04531 }
04532
04533
04534
04535 if ((ich == newline) |
04536 (ich == bang)) {
04537 PP_EOL = idx;
04538 idx = 0;
04539 break;
04540 }
04541
04542 else if (ich == semi_colon) {
04543 in_format = FALSE;
04544 format_idx = -1;
04545 seen_lp_eq_slash = FALSE;
04546 digit_start = 0;
04547 }
04548
04549 else if (ich == amp) {
04550 PP_EOL = idx;
04551 ich = nxt_line[++idx];
04552
04553 while ((ich == blank) |
04554 (ich == tab)) {
04555 ich = nxt_line[++idx];
04556 }
04557 if (ich == newline | ich == bang) {
04558
04559 if (PP_LINE_TYPE == Dir_Line ||
04560 PP_LINE_TYPE == Dir_Continuation_Line) {
04561
04562 PP_EXPECTED_LINE = Dir_Continuation_Line;
04563 }
04564 else {
04565 PP_EXPECTED_LINE = Continuation_Line;
04566 }
04567 idx = 0;
04568 break;
04569 }
04570 else {
04571 format_idx = -1;
04572 idx--;
04573 }
04574 }
04575
04576 else if ((ich == quote) |
04577 (ich == db_quote)) {
04578 char_delim = ich;
04579 digit_start = 0;
04580 format_idx = -1;
04581 }
04582
04583 else if ((in_format) && (ich == star)) {
04584 char_delim = ich;
04585 digit_start = 0;
04586 format_idx = -1;
04587 }
04588
04589 else if (ich != (char) EOF && ch_class[(char) ich] == Ch_Class_Digit) {
04590
04591 if ((previous_char == 0) | (previous_char == semi_colon)) {
04592
04593
04594
04595 format_idx = 0;
04596 digit_start = -1;
04597 }
04598 else if (digit_start >= 0) {
04599 format_idx = -1;
04600 if (digit_start == 0) {
04601 if (PP_LINE_TYPE != Continuation_Line &&
04602 PP_LINE_TYPE != Dir_Continuation_Line) {
04603 digit_start = idx;
04604 }
04605 else if (nxt_line_num_lines > 1) {
04606 digit_start = idx;
04607 }
04608 else {
04609 digit_start = stmt_line_end_idx[lines_in_buf] + idx;
04610 }
04611 num_idx = 0;
04612 }
04613 else {
04614 num_idx++;
04615 }
04616 if (num_idx <= 4) {
04617 num_str[num_idx] = ich;
04618 num_str[num_idx + 1] = '\0';
04619 }
04620
04621
04622 continue;
04623 }
04624 }
04625
04626 else if (format_idx >= 0) {
04627 digit_start = 0;
04628 if (! ((ich == format_str[format_idx][0]) |
04629 (ich == format_str[format_idx][1]))) {
04630 format_idx = -1;
04631 idx--;
04632 continue;
04633 }
04634 else if (format_idx == 6) {
04635 in_format = TRUE;
04636 format_idx = -1;
04637 seen_lp_eq_slash = TRUE;
04638 }
04639 else {
04640 format_idx++;
04641 }
04642 }
04643
04644 else if ((ich == lparen) |
04645 (ich == equal) |
04646 (ich == slash)) {
04647 seen_lp_eq_slash = TRUE;
04648 format_idx = -1;
04649 digit_start = 0;
04650 }
04651
04652
04653
04654 else if ((digit_start > 0) && (previous_char)) {
04655 format_idx = -1;
04656 if (in_format) {
04657 if ((ich == lc_h) | (ich == uc_h)) {
04658
04659 sscanf(num_str, "%d",&char_delim);
04660 char_delim = - char_delim;
04661 }
04662 }
04663 else if ((ich == lc_h) |
04664 (ich == lc_r) |
04665 (ich == lc_l) |
04666 (ich == uc_h) |
04667 (ich == uc_r) |
04668 (ich == uc_l)) {
04669
04670 if (previous_char == star) {
04671
04672 if (seen_lp_eq_slash) {
04673 sscanf(num_str,"%d",&char_delim);
04674 char_delim = - char_delim;
04675 }
04676 }
04677 else if (previous_char == EOF) {
04678 sscanf(num_str,"%d",&char_delim);
04679 char_delim = - char_delim;
04680 }
04681 else if (ch_class[previous_char] != Ch_Class_Letter &&
04682 previous_char != dollar &&
04683 previous_char != at_sign &&
04684 previous_char != underscore) {
04685 sscanf(num_str,"%d",&char_delim);
04686 char_delim = - char_delim;
04687 }
04688 }
04689 digit_start = 0;
04690
04691 }
04692
04693
04694
04695 previous_char = ich;
04696
04697 }
04698
04699
04700
04701 if (char_delim) {
04702 previous_char = ' ';
04703
04704
04705
04706 if (char_delim < 0) {
04707
04708
04709 for (; char_delim < 0; char_delim++) {
04710 if (nxt_line[++idx] == newline) {
04711 if (idx <= NXT_COL(PP_ORIG_SIZE)) {
04712 shift_to_line_size((NXT_COL(PP_ORIG_SIZE)-idx)+1);
04713 nxt_line[idx] = marked_blank;
04714 for (i = idx + 1; i <= NXT_COL(PP_ORIG_SIZE); i++) {
04715 nxt_line[i] = blank;
04716 }
04717 nxt_line[i] = newline;
04718 PP_EOL = NXT_COL(PP_ORIG_SIZE) + 1;
04719 }
04720 else {
04721 PP_EOL = idx;
04722 idx = 0;
04723 break;
04724 }
04725 }
04726 else if (nxt_line[idx] == amp) {
04727 PP_EOL = idx;
04728 sv_amp = idx;
04729 ich = nxt_line[++idx];
04730
04731 while ((ich == blank) |
04732 (ich == tab)) {
04733 ich = nxt_line[++idx];
04734 }
04735
04736 if (ich == newline) {
04737
04738 if (PP_LINE_TYPE == Dir_Line ||
04739 PP_LINE_TYPE == Dir_Continuation_Line) {
04740
04741 PP_EXPECTED_LINE = Dir_Continuation_Line;
04742 }
04743 else {
04744 PP_EXPECTED_LINE = Continuation_Line;
04745 }
04746 idx = 0;
04747 break;
04748 }
04749 else {
04750 idx = sv_amp;
04751 MARK_CHAR_CONST(nxt_line[idx]);
04752 }
04753 }
04754 else {
04755 MARK_CHAR_CONST(nxt_line[idx]);
04756 }
04757 }
04758 }
04759 else {
04760
04761
04762
04763 while (1) {
04764 if (nxt_line[++idx] == newline) {
04765 if (idx <= NXT_COL(PP_ORIG_SIZE)) {
04766 shift_to_line_size((NXT_COL(PP_ORIG_SIZE)-idx)+1);
04767
04768 for (; idx <= NXT_COL(PP_ORIG_SIZE); idx++) {
04769 nxt_line[idx] = marked_blank;
04770 }
04771 nxt_line[idx] = newline;
04772 }
04773 PP_EOL = NXT_COL(PP_ORIG_SIZE) + 1;
04774 idx = 0;
04775 break;
04776 }
04777 else if (nxt_line[idx] == char_delim) {
04778 if (nxt_line[idx + 1] == char_delim) {
04779 MARK_CHAR_CONST(nxt_line[idx]);
04780 ++idx;
04781 MARK_CHAR_CONST(nxt_line[idx]);
04782 nxt_line[idx] |= (1 << 9);
04783 }
04784 else if (nxt_line[idx + 1] == amp) {
04785 prev_char_delim = char_delim;
04786 prev_char_delim_idx = idx;
04787 char_delim = 0;
04788 break;
04789 }
04790 else {
04791
04792 char_delim = 0;
04793 break;
04794 }
04795 }
04796 else if (nxt_line[idx] == amp) {
04797 PP_EOL = idx;
04798 sv_amp = idx;
04799 ich = nxt_line[++idx];
04800
04801 while ((ich == blank) |
04802 (ich == tab)) {
04803 ich = nxt_line[++idx];
04804 }
04805
04806 if (ich == newline) {
04807
04808 if (PP_LINE_TYPE == Dir_Line ||
04809 PP_LINE_TYPE == Dir_Continuation_Line) {
04810
04811 PP_EXPECTED_LINE = Dir_Continuation_Line;
04812 }
04813 else {
04814 PP_EXPECTED_LINE = Continuation_Line;
04815 }
04816 idx = 0;
04817 break;
04818 }
04819 else {
04820 idx = sv_amp;
04821 MARK_CHAR_CONST(nxt_line[idx]);
04822 }
04823 }
04824 else {
04825 MARK_CHAR_CONST(nxt_line[idx]);
04826 }
04827 }
04828 }
04829
04830 }
04831 }
04832 while (idx);
04833
04834 }
04835
04836 TRACE (Func_Exit, "free_classify_line", line_type_str[PP_LINE_TYPE]);
04837
04838 return;
04839
04840 }
04841
04842
04843
04844
04845
04846
04847
04848
04849
04850
04851
04852
04853
04854
04855
04856
04857
04858
04859
04860 #ifdef KEY
04861 static boolean open_include_file (boolean pound_include_line,
04862 boolean allow_recursion)
04863 #else
04864 static boolean open_include_file (boolean pound_include_line)
04865 #endif
04866
04867 {
04868 char *char_ptr;
04869 int cif_file_id;
04870 int i;
04871 int include_idx;
04872 int include_file_len = 0;
04873 FILE *include_file_ptr = NULL;
04874 char include_path[MAX_PATH_NAME_SIZE];
04875 int include_path_len = 0;
04876 boolean more = TRUE;
04877 boolean recursive_use = FALSE;
04878 boolean result = FALSE;
04879 int save_stmt_start_line;
04880 int save_stmt_start_col;
04881 int src_stk_i;
04882 char str[MAX_PATH_NAME_SIZE+10];
04883
04884 # if 0
04885 int full_include_name_len;
04886 int prev_include_idx;
04887 # endif
04888
04889
04890 TRACE (Func_Entry, "open_include_file", NULL);
04891
04892 statement_number++;
04893
04894 if (! cif_file_rec_issued ) {
04895
04896
04897
04898 c_i_f = cif_actual_file;
04899 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX) =
04900 cif_file_name_rec(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX), src_file);
04901
04902 if (cif_flags) {
04903 cif_source_file_rec(SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX),
04904 cmd_line_flags.src_form);
04905 }
04906
04907 c_i_f = cif_tmp_file;
04908 cif_file_rec_issued = TRUE;
04909
04910
04911
04912
04913 GL_CIF_FILE_ID(global_line_tbl_idx) =
04914 SRC_STK_CIF_FILE_ID(SRC_STK_BASE_IDX);
04915 }
04916
04917 if (nxt_line_type == Pound_Include_Enter_Line) {
04918 if (include_file[0] != SLASH) {
04919 getcwd (include_path, MAX_FILE_NAME_SIZE);
04920 strcat (include_path, "/");
04921 include_path_len = strlen(include_path);
04922 strcat (include_path, include_file);
04923 }
04924 else {
04925 include_path_len = 0;
04926 strcpy (include_path, include_file);
04927 }
04928
04929
04930 include_file_ptr = SRC_STK_FILE_PTR(src_stk_idx);
04931 }
04932 else if (include_file[0] == SLASH)
04933 {
04934 include_path_len = 0;
04935 include_file_len = strlen(include_file);
04936 strcpy (include_path, include_file);
04937
04938
04939
04940 include_file_ptr = fopen (include_path, "r");
04941 }
04942 else {
04943
04944 include_file_len = strlen (include_file);
04945 include_idx = include_path_idx;
04946
04947 if (angle_brkt_include) {
04948 if (include_idx != NULL_IDX) {
04949 strcpy (include_path, FP_NAME_PTR(include_idx));
04950 include_idx = FP_NEXT_FILE_IDX(include_idx);
04951 }
04952 else {
04953
04954 more = FALSE;
04955 }
04956 }
04957 else {
04958 strcpy(include_path, SRC_STK_PATH_NAME(src_stk_idx));
04959
04960
04961
04962 char_ptr = strrchr(include_path, SLASH);
04963
04964 if (char_ptr == NULL) {
04965 char_ptr = include_path;
04966 *char_ptr++ = '.';
04967 }
04968 *char_ptr = EOS;
04969
04970 }
04971
04972
04973
04974 while (more) {
04975 include_path_len = strlen(include_path) + 1;
04976
04977
04978
04979 if ((include_path_len + include_file_len) < MAX_PATH_NAME_SIZE) {
04980 strcat (include_path, "/");
04981 strcat (include_path, include_file);
04982
04983
04984 include_file_ptr = fopen (include_path, "r");
04985 }
04986
04987 if (include_file_ptr != NULL || include_idx == NULL_IDX) {
04988 break;
04989 }
04990
04991 strcpy (include_path, FP_NAME_PTR(include_idx));
04992 include_idx = FP_NEXT_FILE_IDX(include_idx);
04993 }
04994 }
04995
04996 if (on_off_flags.output_pound_lines &&
04997 (on_off_flags.preprocess_only || on_off_flags.save_dot_i)) {
04998
04999 if (cmd_line_flags.pp_macro_expansion) {
05000 nxt_line_start_idx[nxt_line_num_lines+1] =
05001 nxt_line_end_idx[nxt_line_num_lines]+1;
05002 nxt_line_num_lines++;
05003 pp_line_idx++;
05004 PP_LINE_TYPE = Comment_Line;
05005 PP_LINE_NUM = curr_glb_line;
05006 PP_EXPECTED_LINE = Regular_Line;
05007
05008 sprintf(str, "# 1 \"%s\" 1\n", include_path);
05009
05010 i = 0;
05011 while (str[i] != '\0') {
05012 nxt_line[nxt_line_start_idx[nxt_line_num_lines] + i] = str[i];
05013 i++;
05014 }
05015
05016 nxt_line[nxt_line_start_idx[nxt_line_num_lines] + i] = '\0';
05017 nxt_line_end_idx[nxt_line_num_lines] =
05018 nxt_line_start_idx[nxt_line_num_lines] + i;
05019 }
05020 else {
05021 fprintf(dot_i_fptr, "# 1 \"%s\" 1\n", include_path);
05022 }
05023 }
05024
05025
05026
05027
05028
05029
05030
05031
05032
05033
05034
05035
05036
05037 if (! cif_need_unit_rec) {
05038 c_i_f = cif_tmp_file;
05039 }
05040
05041 save_stmt_start_line = stmt_start_line;
05042 save_stmt_start_col = stmt_start_col;
05043 stmt_start_line = nxt_line_num;
05044 stmt_start_col = nxt_line_idx + 1;
05045 if (cif_flags & MISC_RECS) {
05046 cif_stmt_type_rec(TRUE, CIF_Include_Stmt, statement_number);
05047 }
05048 stmt_start_line = save_stmt_start_line;
05049 stmt_start_col = save_stmt_start_col;
05050
05051
05052 # if 0
05053
05054
05055
05056
05057
05058
05059
05060
05061
05062
05063
05064
05065
05066
05067
05068
05069
05070
05071
05072
05073
05074
05075
05076
05077
05078 full_include_name_len = include_path_len + include_file_len;
05079 include_idx = full_include_name_idx;
05080 prev_include_idx = NULL_IDX;
05081
05082 while (include_idx != NULL_IDX) {
05083
05084 if (FP_NAME_LEN(include_idx) == full_include_name_len &&
05085 EQUAL_STRS(include_path, FP_NAME_PTR(include_idx))) {
05086 break;
05087 }
05088 else {
05089 prev_include_idx = include_idx;
05090 include_idx = FP_NEXT_FILE_IDX(include_idx);
05091 }
05092 }
05093
05094 if (include_idx == NULL_IDX) {
05095 TBL_REALLOC_CK(file_path_tbl, 1);
05096 CLEAR_TBL_NTRY(file_path_tbl, file_path_tbl_idx);
05097
05098 if (full_include_name_idx == NULL_IDX) {
05099 full_include_name_idx = file_path_tbl_idx;
05100 }
05101 else {
05102 FP_NEXT_FILE_IDX(prev_include_idx) = file_path_tbl_idx;
05103 }
05104
05105 FP_NAME_IDX(file_path_tbl_idx) = str_pool_idx + 1;
05106 FP_NAME_LEN(file_path_tbl_idx) = full_include_name_len;
05107
05108 TBL_REALLOC_CK(str_pool, WORD_LEN(full_include_name_len));
05109
05110 str_pool[str_pool_idx].name_long = 0;
05111
05112 strcpy(FP_NAME_PTR(file_path_tbl_idx), include_path);
05113
05114 cif_file_id = cif_file_name_rec(include_path, include_file);
05115 FP_CIF_ID(file_path_tbl_idx) = cif_file_id;
05116 }
05117 else {
05118 cif_file_id = FP_CIF_ID(include_idx);
05119 }
05120
05121 # endif
05122
05123
05124
05125 cif_file_id = cif_file_name_rec(include_path, include_file);
05126
05127
05128 if (nxt_line_type != Pound_Include_Enter_Line &&
05129 ! pound_include_line) {
05130 for (i = nxt_line_idx + 8;
05131 nxt_line[NXT_COL(i)] != QUOTE &&
05132 nxt_line[NXT_COL(i)] != DBL_QUOTE &&
05133 i < nxt_line_idx + line_size;
05134 ++i) {
05135 }
05136
05137 include_stmt_file_col = ++i;
05138 }
05139 else {
05140
05141
05142
05143 include_stmt_file_col = 10;
05144 }
05145
05146 cif_include_rec(nxt_line_num,
05147 include_stmt_file_col,
05148 cif_file_id);
05149
05150
05151
05152
05153 if (! cif_need_unit_rec) {
05154 c_i_f = cif_actual_file;
05155 }
05156
05157
05158 if (include_file_ptr == NULL) {
05159
05160
05161 ntr_msg_queue(curr_glb_line, 63, Error,
05162 0,
05163 include_file,
05164 0,
05165 STR_ARG);
05166 }
05167 else {
05168
05169 #ifdef KEY
05170
05171
05172
05173
05174
05175
05176
05177
05178
05179
05180 if (!allow_recursion) {
05181 #endif
05182 for (src_stk_i = src_stk_idx; src_stk_i > NULL_IDX; src_stk_i--) {
05183
05184 if (EQUAL_STRS(include_path, SRC_STK_PATH_NAME(src_stk_i))) {
05185 recursive_use = TRUE;
05186 break;
05187 }
05188 }
05189 #ifdef KEY
05190 }
05191 #endif
05192
05193 if (recursive_use) {
05194 ntr_msg_queue(curr_glb_line, 64, Error,
05195 0,
05196 include_file,
05197 0,
05198 STR_ARG);
05199 }
05200 else {
05201 TBL_REALLOC_CK (src_stk, 1);
05202 SRC_STK_FILE_LINE(src_stk_idx) = 0;
05203
05204
05205
05206 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx) = NULL_IDX;
05207 SRC_STK_FILE_TYPE(src_stk_idx) = Include_Src;
05208 SRC_STK_PREV_SRC_FORM(src_stk_idx) = source_form;
05209 SRC_STK_FILE_PTR(src_stk_idx) = include_file_ptr;
05210 SRC_STK_FILE_IDX(src_stk_idx) = include_path_len;
05211 strcpy (SRC_STK_PATH_NAME(src_stk_idx), include_path);
05212
05213 if (nxt_line_type == Pound_Include_Enter_Line) {
05214 SRC_STK_DO_NOT_FCLOSE(src_stk_idx) = TRUE;
05215 }
05216 else {
05217 SRC_STK_DO_NOT_FCLOSE(src_stk_idx) = FALSE;
05218 }
05219
05220
05221
05222
05223 SRC_STK_CIF_FILE_ID(src_stk_idx) = cif_file_id;
05224
05225 result = TRUE;
05226 }
05227 }
05228
05229 TRACE (Func_Exit, "open_include_file", include_path);
05230
05231 return (result);
05232
05233 }
05234
05235
05236
05237
05238
05239
05240
05241
05242
05243
05244
05245
05246
05247
05248
05249
05250
05251
05252
05253
05254 static void update_global_line (void)
05255
05256 {
05257 int idx;
05258 int length;
05259 int lengthp;
05260
05261
05262 TRACE (Func_Entry, "update_global_line", NULL);
05263
05264 TBL_REALLOC_CK (global_line_tbl, 1);
05265 GL_GLOBAL_LINE(global_line_tbl_idx) = curr_glb_line;
05266 GL_FILE_LINE(global_line_tbl_idx) = SRC_STK_FILE_LINE(src_stk_idx);
05267 GL_CIF_FILE_ID(global_line_tbl_idx) = SRC_STK_CIF_FILE_ID(src_stk_idx);
05268
05269
05270
05271
05272
05273 GL_SOURCE_LINES(global_line_tbl_idx) = 0;
05274 GL_INCLUDE_FILE_LINE(global_line_tbl_idx) = include_stmt_file_line;
05275 GL_INCLUDE_FILE_COL(global_line_tbl_idx) = include_stmt_file_col;
05276 include_stmt_file_line = 0;
05277 include_stmt_file_col = 0;
05278
05279
05280
05281
05282 if (SRC_STK_GLOBAL_LINE_IDX(src_stk_idx) == NULL_IDX) {
05283 SRC_STK_GLOBAL_LINE_IDX(src_stk_idx) = global_line_tbl_idx;
05284 }
05285
05286
05287
05288 GL_FILE_NAME_IDX(global_line_tbl_idx) = NULL_IDX;
05289 GL_PATH_NAME_IDX(global_line_tbl_idx) = NULL_IDX;
05290 length = strlen(SRC_STK_FILE_NAME(src_stk_idx));
05291 lengthp = strlen(SRC_STK_PATH_NAME(src_stk_idx));
05292
05293 for (idx = global_line_tbl_idx - 1; idx > NULL_IDX; idx--) {
05294
05295 if (GL_FILE_NAME_LEN(idx) == length &&
05296 EQUAL_STRS(SRC_STK_FILE_NAME(src_stk_idx), GL_FILE_NAME_PTR(idx))) {
05297 GL_FILE_NAME_IDX(global_line_tbl_idx) = GL_FILE_NAME_IDX(idx);
05298 GL_FILE_NAME_LEN(global_line_tbl_idx) = length;
05299 break;
05300 }
05301 }
05302
05303 for (idx = global_line_tbl_idx - 1; idx > NULL_IDX; idx--) {
05304
05305 if (GL_PATH_NAME_LEN(idx) == lengthp &&
05306 EQUAL_STRS(SRC_STK_PATH_NAME(src_stk_idx), GL_PATH_NAME_PTR(idx))) {
05307 GL_PATH_NAME_IDX(global_line_tbl_idx) = GL_PATH_NAME_IDX(idx);
05308 GL_PATH_NAME_LEN(global_line_tbl_idx) = lengthp;
05309 break;
05310 }
05311 }
05312
05313
05314
05315 if (GL_FILE_NAME_IDX(global_line_tbl_idx) == NULL_IDX) {
05316 GL_FILE_NAME_LEN(global_line_tbl_idx) = length;
05317 GL_FILE_NAME_IDX(global_line_tbl_idx) = str_pool_idx+1;
05318 TBL_REALLOC_CK(str_pool, WORD_LEN(length));
05319
05320 for (idx = GL_FILE_NAME_IDX(global_line_tbl_idx);
05321 idx <= str_pool_idx; idx++) {
05322 str_pool[idx].name_long = 0;
05323 }
05324
05325 strcpy(GL_FILE_NAME_PTR(global_line_tbl_idx),
05326 SRC_STK_FILE_NAME(src_stk_idx));
05327 }
05328
05329 if (GL_PATH_NAME_IDX(global_line_tbl_idx) == NULL_IDX) {
05330 GL_PATH_NAME_LEN(global_line_tbl_idx) = lengthp;
05331 GL_PATH_NAME_IDX(global_line_tbl_idx) = str_pool_idx+1;
05332 TBL_REALLOC_CK(str_pool, WORD_LEN(lengthp));
05333
05334 for (idx = GL_PATH_NAME_IDX(global_line_tbl_idx);
05335 idx <= str_pool_idx; idx++) {
05336 str_pool[idx].name_long = 0;
05337 }
05338
05339 strcpy(GL_PATH_NAME_PTR(global_line_tbl_idx),
05340 SRC_STK_PATH_NAME(src_stk_idx));
05341 }
05342
05343 TRACE (Func_Exit, "update_global_line", NULL);
05344
05345 return;
05346
05347 }
05348
05349
05350
05351
05352
05353
05354
05355
05356
05357
05358
05359
05360
05361
05362
05363
05364
05365
05366 void print_err_line(int line, int column)
05367 {
05368 char buf[MAX_SRC_LINE_SIZE];
05369 char buf2[MAX_SRC_LINE_SIZE];
05370 int col_idx = 0;
05371 int i;
05372 int line_idx;
05373
05374
05375 if (line != stmt_line_num[stmt_line_idx]) {
05376
05377 for (line_idx = 1; line_idx <= lines_in_buf; line_idx++) {
05378
05379 if (line == stmt_line_num[line_idx]) {
05380 break;
05381 }
05382 }
05383 }
05384 else {
05385 line_idx = stmt_line_idx;
05386 }
05387
05388 if (line == stmt_line_num[line_idx]) {
05389
05390 for (i = 0;
05391 i <= stmt_line_end_idx[line_idx]-stmt_line_start_idx[line_idx];
05392 i++) {
05393
05394 if (i >= MAX_SRC_LINE_SIZE) {
05395 break;
05396 }
05397
05398 buf2[i] = stmt_buf[stmt_line_start_idx[line_idx] + i];
05399
05400 if (stmt_buf_col[stmt_line_start_idx[line_idx] + i] == column) {
05401 col_idx = i;
05402 }
05403
05404 if (buf2[i] == '\0') {
05405 buf[i] = '\0';
05406 break;
05407 }
05408 else if (buf2[i] == (char)EOF) {
05409 buf[i] = '\0';
05410 buf2[i] = '\0';
05411 break;
05412 }
05413 else if (buf2[i] == '\n') {
05414 buf[i] = ' ';
05415 break;
05416 }
05417 else if (buf2[i] == '\t') {
05418 buf[i] = '\t';
05419 }
05420 else {
05421 buf[i] = ' ';
05422 }
05423 }
05424
05425 buf[++i] = '\0';
05426 buf2[i] = '\0';
05427 fprintf(stderr, "%s", buf2);
05428
05429 if (column != 0) {
05430 buf[col_idx] = '^';
05431 fprintf(stderr, "%s\n", buf);
05432 }
05433 }
05434 else if (line == nxt_line_num) {
05435
05436 for (i = 0; i <= nxt_line_EOL; i++) {
05437 if (i >= MAX_SRC_LINE_SIZE) {
05438 break;
05439 }
05440
05441 buf2[i] = nxt_line[NXT_COL(i)];
05442
05443 if (nxt_line_col[NXT_COL(i)] == column) {
05444 col_idx = i;
05445 }
05446
05447 if (buf2[i] == '\0') {
05448 buf[i] = '\0';
05449 break;
05450 }
05451 else if (buf2[i] == (char)EOF) {
05452 buf[i] = '\0';
05453 buf2[i] = '\0';
05454 break;
05455 }
05456 else if (buf2[i] == '\n') {
05457 buf[i] = ' ';
05458 break;
05459 }
05460 else if (buf2[i] == '\t') {
05461 buf[i] = '\t';
05462 }
05463 else {
05464 buf[i] = ' ';
05465 }
05466 }
05467
05468 buf[++i] = '\0';
05469 buf2[i] = '\0';
05470 fprintf(stderr, "%s", buf2);
05471
05472 if (column != 0) {
05473 buf[col_idx] = '^';
05474 fprintf(stderr, "%s\n", buf);
05475 }
05476 }
05477
05478 return;
05479
05480 }
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495
05496
05497
05498
05499 char scan_thru_close_paren(int idx, int line_idx, int cnt)
05500
05501 {
05502 char ch;
05503 int ich;
05504 int paren_level = 1;
05505
05506 TRACE (Func_Entry, "scan_thru_close_paren", &LA_CH_VALUE);
05507
05508 if (line_idx == 0) {
05509 idx = stmt_buf_idx;
05510 line_idx = stmt_line_idx;
05511 }
05512 ich = stmt_buf[idx];
05513 while ((ich == lparen) && (cnt > 0)) {
05514 while (idx < stmt_buf_EOS_idx) {
05515 ich = stmt_buf[++idx];
05516 if (ich == rparen) {
05517 paren_level--;
05518
05519 if (paren_level == 0) {
05520 do {
05521 ich = stmt_buf[++idx];
05522
05523 if (idx == stmt_line_end_idx[line_idx]) {
05524
05525 if (line_idx < lines_in_buf) {
05526 idx = stmt_line_start_idx[++line_idx] +
05527 stmt_line_offset[line_idx];
05528 ich = blank;
05529 }
05530 else {
05531 ich = eos;
05532 }
05533 }
05534 }
05535 while ((ich == blank) | (ich == tab));
05536 paren_level = 1;
05537 break;
05538 }
05539 }
05540 else if (ich == lparen) {
05541 paren_level++;
05542 }
05543 else if (idx == stmt_line_end_idx[line_idx]) {
05544
05545 if (line_idx < lines_in_buf) {
05546 idx = stmt_line_start_idx[++line_idx] +
05547 stmt_line_offset[line_idx];
05548 }
05549 else {
05550 ich = eos;
05551 break;
05552 }
05553 }
05554 }
05555
05556 cnt--;
05557
05558 }
05559
05560 ch = ich;
05561
05562 if (islower(ch)) {
05563 ch = TOUPPER(ch);
05564 }
05565
05566 TRACE (Func_Exit, "scan_thru_close_paren", NULL);
05567
05568 return (ch);
05569
05570 }
05571
05572
05573
05574
05575
05576
05577
05578
05579
05580
05581
05582
05583
05584
05585
05586
05587
05588
05589
05590 boolean set_stmt_type_known(void)
05591
05592 {
05593
05594 int ich;
05595 int idx;
05596 int lblank = ' ';
05597 int line_idx;
05598 boolean lsig_blank;
05599 int ltab = '\t';
05600 boolean stmt_type_known = FALSE;
05601
05602
05603 TRACE (Func_Entry, "set_stmt_type_known", NULL);
05604
05605 idx = stmt_buf_idx;
05606 line_idx = stmt_line_idx;
05607 ich = stmt_buf[idx];
05608 lsig_blank = sig_blank;
05609
05610 if (source_form != Fixed_Form) {
05611 lblank = -1;
05612 ltab = -1;
05613 }
05614
05615 BACK:
05616
05617 # pragma _CRI align
05618 while ((ich != EOF) &&
05619 ((ch_class[ich] == Ch_Class_Letter) |
05620 (ch_class[ich] == Ch_Class_Digit) |
05621 (ich == underscore) |
05622 (ich == dollar) |
05623 (ich == at_sign) |
05624 (ich == lblank) |
05625 (ich == ltab) |
05626 (ich == newline) |
05627 (ich == bang)) &&
05628 (! lsig_blank)) {
05629
05630 if (idx == stmt_line_end_idx[line_idx]) {
05631
05632 if (line_idx < lines_in_buf) {
05633 idx = stmt_line_start_idx[++line_idx]
05634 + stmt_line_offset[line_idx];
05635 }
05636 else {
05637 goto DONE;
05638 }
05639 }
05640 ich = stmt_buf[++idx];
05641 }
05642
05643 while ((ich == blank) |
05644 (ich == tab) |
05645 (ich == newline) |
05646 (ich == bang)) {
05647
05648 if (idx == stmt_line_end_idx[line_idx]) {
05649
05650 if (line_idx < lines_in_buf) {
05651 idx = stmt_line_start_idx[++line_idx]
05652 + stmt_line_offset[line_idx];
05653 }
05654 else {
05655 goto DONE;
05656 }
05657 }
05658 ich = stmt_buf[++idx];
05659 }
05660
05661 if (ich == lparen) {
05662 ich = whats_after_paren_group(&idx, &line_idx, 2);
05663 }
05664
05665 # ifdef _F_MINUS_MINUS
05666 if (ich == lbrkt && cmd_line_flags.co_array_fortran) {
05667 ich = whats_after_brkt_group(&idx, &line_idx, 2);
05668 }
05669 # endif
05670
05671 if (ich == percent) {
05672
05673 if (idx == stmt_line_end_idx[line_idx]) {
05674
05675 if (line_idx < lines_in_buf) {
05676 idx = stmt_line_start_idx[++line_idx]
05677 + stmt_line_offset[line_idx];
05678 }
05679 else {
05680 goto DONE;
05681 }
05682 }
05683 ich = stmt_buf[++idx];
05684
05685 while ((ich == blank) |
05686 (ich == tab) |
05687 (ich == newline) |
05688 (ich == bang)) {
05689
05690 if (idx == stmt_line_end_idx[line_idx]) {
05691
05692 if (line_idx < lines_in_buf) {
05693 idx = stmt_line_start_idx[++line_idx]
05694 + stmt_line_offset[line_idx];
05695 }
05696 else {
05697 goto DONE;
05698 }
05699 }
05700 ich = stmt_buf[++idx];
05701 }
05702
05703 lsig_blank = FALSE;
05704 goto BACK;
05705 }
05706
05707 DONE:
05708
05709 if (ich != equal) {
05710 stmt_type_known = TRUE;
05711 }
05712
05713 TRACE (Func_Exit, "set_stmt_type_known", NULL);
05714
05715 return(stmt_type_known);
05716
05717 }
05718
05719
05720
05721
05722
05723
05724
05725
05726
05727
05728
05729
05730
05731
05732
05733
05734
05735 static int whats_after_paren_group(int *idx, int *line_idx, int cnt)
05736
05737 {
05738 int ich;
05739 int paren_level = 1;
05740
05741 TRACE (Func_Entry, "whats_after_paren_group", &LA_CH_VALUE);
05742
05743 ich = stmt_buf[*idx];
05744
05745 while ((ich == lparen) && (cnt > 0)) {
05746 while (*idx < stmt_buf_EOS_idx) {
05747 ich = stmt_buf[++(*idx)];
05748 if (ich == rparen) {
05749 paren_level--;
05750
05751 if (paren_level == 0) {
05752 do {
05753 ich = stmt_buf[++(*idx)];
05754
05755 if (*idx == stmt_line_end_idx[*line_idx]) {
05756
05757 if (*line_idx < lines_in_buf) {
05758 *idx = stmt_line_start_idx[++(*line_idx)] +
05759 stmt_line_offset[*line_idx];
05760 ich = blank;
05761 }
05762 else {
05763 ich = eos;
05764 }
05765 }
05766 }
05767 while ((ich == blank) | (ich == tab));
05768 paren_level = 1;
05769 break;
05770 }
05771 }
05772 else if (ich == lparen) {
05773 paren_level++;
05774 }
05775 else if (*idx == stmt_line_end_idx[*line_idx]) {
05776
05777 if (*line_idx < lines_in_buf) {
05778 *idx = stmt_line_start_idx[++(*line_idx)] +
05779 stmt_line_offset[*line_idx];
05780 }
05781 else {
05782 ich = eos;
05783 break;
05784 }
05785 }
05786 }
05787
05788 cnt--;
05789
05790 }
05791
05792 TRACE (Func_Exit, "whats_after_paren_group", NULL);
05793
05794 return (ich);
05795
05796 }
05797
05798
05799
05800
05801
05802
05803
05804
05805
05806
05807
05808
05809
05810
05811
05812
05813
05814 static int whats_after_brkt_group(int *idx, int *line_idx, int cnt)
05815
05816 {
05817 int ich;
05818 int brkt_level = 1;
05819
05820 TRACE (Func_Entry, "whats_after_brkt_group", &LA_CH_VALUE);
05821
05822 ich = stmt_buf[*idx];
05823
05824 while ((ich == lbrkt) && (cnt > 0)) {
05825 while (*idx < stmt_buf_EOS_idx) {
05826 ich = stmt_buf[++(*idx)];
05827 if (ich == rbrkt) {
05828 brkt_level--;
05829
05830 if (brkt_level == 0) {
05831 do {
05832 ich = stmt_buf[++(*idx)];
05833
05834 if (*idx == stmt_line_end_idx[*line_idx]) {
05835
05836 if (*line_idx < lines_in_buf) {
05837 *idx = stmt_line_start_idx[++(*line_idx)] +
05838 stmt_line_offset[*line_idx];
05839 ich = blank;
05840 }
05841 else {
05842 ich = eos;
05843 }
05844 }
05845 }
05846 while ((ich == blank) | (ich == tab));
05847 brkt_level = 1;
05848 break;
05849 }
05850 }
05851 else if (ich == lbrkt) {
05852 brkt_level++;
05853 }
05854 else if (*idx == stmt_line_end_idx[*line_idx]) {
05855 if (*line_idx < lines_in_buf) {
05856 *idx = stmt_line_start_idx[++(*line_idx)] +
05857 stmt_line_offset[*line_idx];
05858 }
05859 else {
05860 ich = eos;
05861 break;
05862 }
05863 }
05864 }
05865
05866 cnt--;
05867
05868 }
05869
05870 TRACE (Func_Exit, "whats_after_brkt_group", NULL);
05871
05872 return (ich);
05873
05874 }
05875
05876
05877
05878
05879
05880
05881
05882
05883
05884
05885
05886
05887
05888
05889
05890
05891
05892
05893 boolean next_arg_is_kwd_equal (void)
05894
05895 {
05896
05897 int ich;
05898 int idx;
05899 int lamp = '&';
05900 int lblank = ' ';
05901 int line_idx;
05902 int ltab = '\t';
05903 int kwd = FALSE;
05904
05905 TRACE (Func_Entry, "next_arg_is_kwd_equal", NULL);
05906
05907 idx = stmt_buf_idx;
05908
05909 line_idx = stmt_line_idx;
05910
05911 ich = stmt_buf[idx];
05912
05913 if (source_form != Fixed_Form) {
05914 lblank = -1;
05915 ltab = -1;
05916 }
05917 else {
05918 lamp = -1;
05919 }
05920
05921 # pragma _CRI align
05922 while ((ich != EOF) &&
05923 (ch_class[(char)ich] == Ch_Class_Letter) |
05924 (ch_class[(char)ich] == Ch_Class_Digit) |
05925 (ich == underscore) |
05926 (ich == dollar) |
05927 (ich == at_sign) |
05928 (ich == lblank) |
05929 (ich == ltab) |
05930 (ich == lamp) |
05931 (ich == newline) |
05932 (ich == bang)) {
05933
05934 if (idx == stmt_line_end_idx[line_idx]) {
05935
05936 if (line_idx < lines_in_buf) {
05937 idx = stmt_line_start_idx[++line_idx]
05938 + stmt_line_offset[line_idx];
05939 }
05940 else {
05941 break;
05942 }
05943 }
05944 else if (ich == lamp) {
05945 break;
05946 }
05947 ich = stmt_buf[++idx];
05948 }
05949
05950 while ((ich == blank) |
05951 (ich == tab) |
05952 (ich == lamp) |
05953 (ich == newline) |
05954 (ich == bang)) {
05955
05956 if (idx == stmt_line_end_idx[line_idx]) {
05957
05958 if (line_idx < lines_in_buf) {
05959 idx = stmt_line_start_idx[++line_idx]
05960 + stmt_line_offset[line_idx];
05961 }
05962 else {
05963 break;
05964 }
05965 }
05966 else if (ich == lamp) {
05967 break;
05968 }
05969
05970 ich = stmt_buf[++idx];
05971 }
05972
05973 kwd = (ich == equal);
05974
05975 if (!kwd) {
05976 goto EXIT;
05977 }
05978
05979 ich = stmt_buf[++idx];
05980
05981 while ((ich == lblank) |
05982 (ich == ltab) |
05983 (ich == lamp) |
05984 (ich == newline) |
05985 (ich == bang)) {
05986
05987 if (idx == stmt_line_end_idx[line_idx]) {
05988
05989 if (line_idx < lines_in_buf) {
05990 idx = stmt_line_start_idx[++line_idx]
05991 + stmt_line_offset[line_idx];
05992 }
05993 else {
05994 break;
05995 }
05996 }
05997 else if (ich == lamp) {
05998 break;
05999 }
06000
06001 ich = stmt_buf[++idx];
06002 }
06003
06004 kwd = (ich != equal);
06005
06006 EXIT:
06007
06008 TRACE (Func_Exit, "next_arg_is_kwd_equal", NULL);
06009
06010 return(kwd);
06011
06012 }
06013
06014
06015
06016
06017
06018
06019
06020
06021
06022
06023
06024
06025
06026
06027
06028
06029
06030 boolean stmt_is_DATA_stmt (void)
06031
06032 {
06033 int ich;
06034 int idx;
06035 int line_idx;
06036 int paren_level = 0;
06037 boolean result = TRUE;
06038
06039 TRACE (Func_Entry, "stmt_is_DATA_stmt", NULL);
06040
06041 ich = stmt_buf[stmt_buf_idx];
06042
06043
06044
06045
06046 if (sig_blank &&
06047 ich != equal &&
06048 ich != percent &&
06049 ich != lparen) {
06050 goto EXIT;
06051 }
06052
06053 idx = stmt_buf_idx - 1;
06054
06055 line_idx = stmt_line_idx;
06056
06057 do {
06058 ich = stmt_buf[++idx];
06059
06060 if (ich == lparen) {
06061 paren_level++;
06062 continue;
06063 }
06064 else if (ich == rparen) {
06065 paren_level--;
06066 continue;
06067 }
06068
06069 if (ich == equal && paren_level == 0) {
06070 result = FALSE;
06071 break;
06072 }
06073
06074 if (idx == stmt_line_end_idx[line_idx]) {
06075
06076 if (line_idx < lines_in_buf) {
06077 idx = stmt_line_start_idx[++line_idx]
06078 + stmt_line_offset[line_idx];
06079 }
06080 else {
06081 break;
06082 }
06083 }
06084 }
06085 while (ich != slash | paren_level);
06086
06087 EXIT:
06088
06089 TRACE (Func_Exit, "stmt_is_DATA_stmt", NULL);
06090
06091 return(result);
06092
06093 }
06094
06095
06096
06097
06098
06099
06100
06101
06102
06103
06104
06105
06106
06107
06108
06109
06110
06111 boolean stmt_has_double_colon (void)
06112
06113 {
06114 boolean colon_found = FALSE;
06115 boolean found = FALSE;
06116 int ich;
06117 int idx;
06118 int lblank = ' ';
06119 int ltab = '\t';
06120 int line_idx;
06121 int paren_level = 0;
06122
06123 TRACE (Func_Entry, "stmt_has_double_colon", NULL);
06124
06125 idx = stmt_buf_idx - 1;
06126
06127 line_idx = stmt_line_idx;
06128
06129 if (source_form != Fixed_Form) {
06130 lblank = -1;
06131 ltab = -1;
06132 }
06133
06134
06135 do {
06136 ich = stmt_buf[++idx];
06137
06138 if (ich == lparen) {
06139 paren_level++;
06140 colon_found = FALSE;
06141 continue;
06142 }
06143 else if (ich == rparen) {
06144 paren_level--;
06145 colon_found = FALSE;
06146 continue;
06147 }
06148
06149 if (idx == stmt_line_end_idx[line_idx]) {
06150
06151 if (line_idx < lines_in_buf) {
06152 idx = stmt_line_start_idx[++line_idx]
06153 + stmt_line_offset[line_idx];
06154 continue;
06155 }
06156 else {
06157 break;
06158 }
06159 }
06160
06161 if (ich == colon && paren_level == 0) {
06162
06163 if (colon_found) {
06164 found = TRUE;
06165 break;
06166 }
06167 else {
06168 colon_found = TRUE;
06169 continue;
06170 }
06171 }
06172
06173 if (ich == lblank | ich == ltab) {
06174 continue;
06175 }
06176
06177 colon_found = FALSE;
06178 }
06179 while (TRUE);
06180
06181 TRACE (Func_Exit, "stmt_has_double_colon", NULL);
06182
06183 return(found);
06184
06185 }
06186
06187
06188
06189
06190
06191
06192
06193
06194
06195
06196
06197
06198
06199
06200
06201
06202
06203
06204 boolean stmt_is_DO_stmt (void)
06205
06206 {
06207 boolean found_eq = FALSE;
06208 int ich;
06209 int idx;
06210 int line_idx;
06211 int paren_level = 0;
06212 boolean result = FALSE;
06213
06214 TRACE (Func_Entry, "stmt_is_DO_stmt", NULL);
06215
06216 idx = stmt_buf_idx - 1;
06217
06218 line_idx = stmt_line_idx;
06219
06220 do {
06221 ich = stmt_buf[++idx];
06222
06223 if (ich == lparen) {
06224 paren_level++;
06225 continue;
06226 }
06227 else if (ich == rparen) {
06228 paren_level--;
06229 continue;
06230 }
06231
06232 if (ich == equal && paren_level == 0) {
06233 found_eq = TRUE;
06234 continue;
06235 }
06236
06237 if (ich == comma && paren_level == 0 && found_eq) {
06238 result = TRUE;
06239 break;
06240 }
06241
06242 if (idx == stmt_line_end_idx[line_idx]) {
06243
06244 if (line_idx < lines_in_buf) {
06245 idx = stmt_line_start_idx[++line_idx]
06246 + stmt_line_offset[line_idx];
06247 }
06248 else {
06249 break;
06250 }
06251 }
06252 }
06253 while (TRUE);
06254
06255 TRACE (Func_Exit, "stmt_is_DO_stmt", NULL);
06256
06257 return (result);
06258
06259 }
06260
06261
06262
06263
06264
06265
06266
06267
06268
06269
06270
06271
06272
06273
06274
06275
06276
06277
06278 void format_line_n_col (int *line,
06279 int *col,
06280 int format_col)
06281
06282 {
06283 int dbl_delim_mask = (1 << 9);
06284 int i;
06285 int ich;
06286 int idx;
06287 int line_idx = NULL_IDX;
06288
06289 TRACE (Func_Entry, "format_line_n_col", NULL);
06290
06291 idx = format_start_idx - 1;
06292
06293 for (i = 1; i <= lines_in_buf; i++) {
06294 if (idx + 1 >= stmt_line_start_idx[i] &&
06295 idx + 1 <= stmt_line_end_idx[i]) {
06296
06297 line_idx = i;
06298 break;
06299 }
06300 }
06301
06302 # ifdef _DEBUG
06303 if (line_idx == NULL_IDX) {
06304 PRINTMSG(1, 626, Internal, 1,
06305 "valid line_idx",
06306 "format_line_n_col");
06307 }
06308 # endif
06309
06310 if (stmt_type == Format_Stmt) {
06311
06312 while (format_col > 0) {
06313 if (idx + format_col < stmt_line_end_idx[line_idx]) {
06314 idx += format_col;
06315 format_col = 0;
06316 }
06317 else {
06318 format_col -= stmt_line_end_idx[line_idx] - idx;
06319 if (line_idx < lines_in_buf) {
06320 idx = stmt_line_start_idx[++line_idx]
06321 + stmt_line_offset[line_idx] + 1;
06322 }
06323 else {
06324 idx = stmt_line_end_idx[line_idx] - 1;
06325 break;
06326 }
06327 }
06328 }
06329 }
06330 else {
06331
06332 while (format_col > 0) {
06333
06334 ich = stmt_buf[++idx];
06335
06336 if (idx == stmt_line_end_idx[line_idx]) {
06337
06338 if (line_idx < lines_in_buf) {
06339 idx = stmt_line_start_idx[++line_idx]
06340 + stmt_line_offset[line_idx];
06341 ich = stmt_buf[++idx];
06342 }
06343 else {
06344 break;
06345 }
06346 }
06347
06348 if ((ich & dbl_delim_mask) == 0) {
06349 format_col--;
06350 }
06351 }
06352 }
06353
06354 *line = stmt_line_num[line_idx];
06355
06356 *col = stmt_buf_col[idx];
06357
06358 TRACE (Func_Exit, "format_line_n_col", NULL);
06359
06360 return;
06361
06362 }
06363
06364
06365
06366
06367
06368
06369
06370
06371
06372
06373
06374
06375
06376
06377
06378
06379
06380
06381 void set_format_start_idx(int buf_idx)
06382
06383 {
06384
06385 TRACE (Func_Entry, "set_format_start_idx", NULL);
06386
06387
06388 buf_idx++;
06389
06390 format_start_idx = buf_idx;
06391
06392 TRACE (Func_Exit, "set_format_start_idx", NULL);
06393
06394 return;
06395
06396 }
06397
06398
06399
06400
06401
06402
06403
06404
06405
06406
06407
06408
06409
06410
06411
06412
06413
06414
06415 int put_char_const_in_tbl (char holler,
06416 int *len)
06417
06418 {
06419 int char_idx = NULL_IDX;
06420 char *char_ptr;
06421 int dbl_delim_mask = (1 << 9);
06422 int ich;
06423 int idx;
06424 long64 length = 0;
06425 linear_type_type linear_type;
06426 int line_idx;
06427 int type_idx;
06428
06429
06430 TRACE (Func_Entry, "put_char_const_in_tbl", NULL);
06431
06432 ich = stmt_buf[stmt_buf_idx];
06433 idx = stmt_buf_idx;
06434 line_idx = stmt_line_idx;
06435
06436 while (ich < 0) {
06437
06438 if ((ich & dbl_delim_mask) == 0) {
06439 length++;
06440 }
06441 ich = stmt_buf[++idx];
06442
06443 if (idx == stmt_line_end_idx[line_idx]) {
06444
06445 if (line_idx < lines_in_buf) {
06446 idx = stmt_line_start_idx[++line_idx]
06447 + stmt_line_offset[line_idx];
06448 ich = stmt_buf[++idx];
06449 }
06450 else {
06451 break;
06452 }
06453 }
06454 }
06455
06456 *len = length;
06457
06458 if (holler != '\0') {
06459
06460 if (WORD_ALIGNED_BIT_LENGTH(CHAR_BIT * length) <=
06461 MAX_SHORT_TYPELESS_BITS) {
06462 linear_type = Short_Typeless_Const;
06463 }
06464 else {
06465 linear_type = Long_Typeless;
06466 }
06467
06468 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06469 TYP_TYPE(TYP_WORK_IDX) = Typeless;
06470 TYP_LINEAR(TYP_WORK_IDX) = linear_type;
06471 TYP_BIT_LEN(TYP_WORK_IDX) = WORD_ALIGNED_BIT_LENGTH(CHAR_BIT * length);
06472 type_idx = ntr_type_tbl();
06473 }
06474 else {
06475 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06476 TYP_TYPE(TYP_WORK_IDX) = Character;
06477 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
06478 TYP_DESC(TYP_WORK_IDX) = Default_Typed;
06479 TYP_CHAR_CLASS(TYP_WORK_IDX)= Const_Len_Char;
06480 TYP_FLD(TYP_WORK_IDX) = CN_Tbl_Idx;
06481 TYP_IDX(TYP_WORK_IDX) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, length),
06482 type_idx = ntr_type_tbl();
06483 }
06484
06485 char_idx = ntr_const_tbl(type_idx, TRUE, NULL);
06486 char_ptr = (char *) &CN_CONST(char_idx);
06487 idx = 0;
06488
06489 if (holler == 'R') {
06490
06491 while (idx < (TARGET_CHARS_PER_WORD - (length % TARGET_CHARS_PER_WORD)) %
06492 TARGET_CHARS_PER_WORD){
06493 idx++;
06494 }
06495 }
06496
06497 idx--;
06498 ich = stmt_buf[stmt_buf_idx];
06499
06500 while (ich < 0) {
06501
06502 if ((ich & dbl_delim_mask) == 0) {
06503 char_ptr[++idx] = ich;
06504 }
06505 ich = stmt_buf[++stmt_buf_idx];
06506
06507 if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
06508
06509 if (stmt_line_idx < lines_in_buf) {
06510 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
06511 + stmt_line_offset[stmt_line_idx];
06512 ich = stmt_buf[++stmt_buf_idx];
06513 }
06514 else {
06515 break;
06516 }
06517 }
06518 }
06519
06520 if (holler == 'H' || holler == '\0') {
06521
06522 while ((++idx) % TARGET_CHARS_PER_WORD != 0) {
06523 char_ptr[idx] = ' ';
06524 }
06525 }
06526
06527 stmt_buf_idx--;
06528
06529 NEXT_LA_CH;
06530
06531 TRACE (Func_Exit, "put_char_const_in_tbl", NULL);
06532
06533 return(char_idx);
06534
06535 }
06536
06537
06538
06539
06540
06541
06542
06543
06544
06545
06546
06547
06548
06549
06550
06551
06552
06553
06554 int put_format_in_tbl (void)
06555
06556 {
06557 int char_idx = NULL_IDX;
06558 char *char_ptr;
06559 char *char_ptr2;
06560 int ich;
06561 int idx;
06562 long64 length = 0;
06563 int line_idx;
06564 long64 new_length;
06565 int paren_lvl = 0;
06566 int type_idx;
06567
06568
06569 TRACE (Func_Entry, "put_format_in_tbl", NULL);
06570
06571 idx = stmt_buf_idx - 1;
06572 line_idx = stmt_line_idx;
06573
06574 ich = stmt_buf[stmt_buf_idx];
06575
06576 char_idx = (MASK_CHAR_CONST_IDX & ich) >> 8;
06577
06578 if (char_idx != NULL_IDX) {
06579 length = CN_INT_TO_C(TYP_IDX(CN_TYPE_IDX(char_idx)));
06580
06581 while (length > 0) {
06582
06583 if ((stmt_buf_idx + length) < stmt_line_end_idx[stmt_line_idx]) {
06584 stmt_buf_idx += length;
06585 length = 0;
06586 }
06587 else {
06588 length -= stmt_line_end_idx[stmt_line_idx] - stmt_buf_idx;
06589 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
06590 + stmt_line_offset[stmt_line_idx] + 1;
06591 }
06592 }
06593 goto EXIT;
06594 }
06595
06596
06597
06598 do {
06599 ++idx;
06600
06601 if (idx == stmt_line_end_idx[line_idx]) {
06602
06603 if (line_idx < lines_in_buf) {
06604 idx = stmt_line_start_idx[++line_idx]
06605 + stmt_line_offset[line_idx];
06606 continue;
06607 }
06608 else {
06609 break;
06610 }
06611 }
06612 ich = stmt_buf[idx];
06613 length++;
06614
06615 if (ich == lparen) {
06616 paren_lvl++;
06617 }
06618 else if (ich == rparen) {
06619 paren_lvl--;
06620 }
06621 }
06622 while (paren_lvl);
06623
06624 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06625 new_length = length + AT_NAME_LEN(stmt_label_idx);
06626 TYP_TYPE(TYP_WORK_IDX) = Character;
06627 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
06628 TYP_DESC(TYP_WORK_IDX) = Default_Typed;
06629 TYP_CHAR_CLASS(TYP_WORK_IDX) = Const_Len_Char;
06630 TYP_FLD(TYP_WORK_IDX) = CN_Tbl_Idx;
06631 TYP_IDX(TYP_WORK_IDX) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
06632 new_length),
06633 type_idx = ntr_type_tbl();
06634 char_idx = ntr_const_tbl(type_idx, TRUE, NULL);
06635
06636 stmt_buf[stmt_buf_idx] |= (char_idx << 8);
06637
06638 char_ptr = (char *) &CN_CONST(char_idx);
06639 char_ptr2 = (char *)AT_OBJ_NAME_PTR(stmt_label_idx);
06640
06641 for (idx = 0; idx < AT_NAME_LEN(stmt_label_idx); idx++) {
06642 char_ptr[idx] = char_ptr2[idx];
06643 }
06644
06645 stmt_buf_idx--;
06646
06647 while (length > 0) {
06648
06649 stmt_buf_idx++;
06650
06651 if (stmt_buf_idx == stmt_line_end_idx[stmt_line_idx]) {
06652
06653 if (stmt_line_idx < lines_in_buf) {
06654 stmt_buf_idx = stmt_line_start_idx[++stmt_line_idx]
06655 + stmt_line_offset[stmt_line_idx];
06656 continue;
06657 }
06658 else {
06659 break;
06660 }
06661 }
06662
06663 char_ptr[idx] = stmt_buf[stmt_buf_idx];
06664 idx++;
06665 length--;
06666 }
06667
06668 stmt_buf_idx++;
06669
06670 EXIT:
06671
06672 stmt_buf_idx--;
06673
06674 NEXT_LA_CH;
06675
06676
06677 TRACE (Func_Exit, "put_format_in_tbl", NULL);
06678
06679 return(char_idx);
06680
06681 }
06682
06683
06684
06685
06686
06687
06688
06689
06690
06691
06692
06693
06694
06695
06696
06697
06698
06699
06700 boolean is_implied_do (void)
06701
06702 {
06703 boolean had_equal = FALSE;
06704 int ich;
06705 int idx;
06706 boolean imp_do = FALSE;
06707 int lblank = ' ';
06708 int ltab = '\t';
06709 int line_idx;
06710 int paren_lvl = 0;
06711 int prev_ich;
06712
06713 TRACE (Func_Entry, "is_implied_do", NULL);
06714
06715 idx = stmt_buf_idx;
06716 line_idx = stmt_line_idx;
06717 ich = stmt_buf[idx];
06718 prev_ich = ich;
06719
06720 if (source_form != Fixed_Form) {
06721 lblank = -1;
06722 ltab = -1;
06723 }
06724
06725 do {
06726
06727 if (had_equal) {
06728
06729 if (ich == equal) {
06730 had_equal = FALSE;
06731 }
06732 else if (ich != lblank && ich != ltab) {
06733 imp_do = TRUE;
06734 break;
06735 }
06736 }
06737 else if (ich == lparen) {
06738 paren_lvl++;
06739 }
06740 else if (ich == rparen) {
06741 paren_lvl--;
06742 }
06743 else if (ich == equal && paren_lvl == 1 &&
06744 prev_ich != slash &&
06745 prev_ich != greater &&
06746 prev_ich != less) {
06747 had_equal = TRUE;
06748 }
06749
06750 if (++idx == stmt_line_end_idx[line_idx]) {
06751
06752 if (line_idx < lines_in_buf) {
06753 idx = stmt_line_start_idx[++line_idx]
06754 + stmt_line_offset[line_idx] + 1;
06755 }
06756 else {
06757 break;
06758 }
06759 }
06760
06761 if (ich != lblank && ich != ltab) {
06762 prev_ich = ich;
06763 }
06764
06765 ich = stmt_buf[idx];
06766 }
06767 while (paren_lvl > 0);
06768
06769 TRACE (Func_Exit, "is_implied_do", NULL);
06770
06771 return(imp_do);
06772
06773 }
06774
06775
06776
06777
06778
06779
06780
06781
06782
06783
06784
06785
06786
06787
06788
06789
06790
06791
06792 boolean is_substring_ref (void)
06793
06794 {
06795 int ich;
06796 int idx;
06797 int line_idx;
06798 int paren_lvl = 0;
06799 boolean substring = FALSE;
06800
06801 TRACE (Func_Entry, "is_substring_ref", NULL);
06802
06803 idx = stmt_buf_idx;
06804 line_idx = stmt_line_idx;
06805
06806 ich = stmt_buf[idx];
06807 do {
06808 if (ich == lparen) {
06809 paren_lvl++;
06810 }
06811 else if (ich == rparen) {
06812 paren_lvl--;
06813 }
06814 else if (ich == colon && paren_lvl == 1) {
06815
06816 if (substring) {
06817 substring = FALSE;
06818 break;
06819 }
06820 else {
06821 substring = TRUE;
06822 }
06823 }
06824 else if (ich == comma && paren_lvl == 1) {
06825 substring = FALSE;
06826 break;
06827 }
06828
06829 if (++idx == stmt_line_end_idx[line_idx]) {
06830
06831 if (line_idx < lines_in_buf) {
06832 idx = stmt_line_start_idx[++line_idx]
06833 + stmt_line_offset[line_idx] + 1;
06834 }
06835 else {
06836 break;
06837 }
06838 }
06839 ich = stmt_buf[idx];
06840 }
06841 while (paren_lvl);
06842
06843 TRACE (Func_Exit, "is_substring_ref", NULL);
06844
06845 return(substring);
06846 }
06847
06848
06849
06850
06851
06852
06853
06854
06855
06856
06857
06858
06859
06860
06861
06862
06863
06864
06865 boolean next_id_is_imp_control(void)
06866 {
06867 boolean cont_var = FALSE;
06868 int ich;
06869 int idx;
06870 int line_idx;
06871 int paren_lvl = 0;
06872
06873 TRACE (Func_Entry, "next_id_is_imp_control", NULL);
06874
06875 idx = stmt_buf_idx;
06876 line_idx = stmt_line_idx;
06877 ich = stmt_buf[idx];
06878
06879 do {
06880 if (ich == lparen) {
06881 paren_lvl++;
06882 }
06883 else if (ich == rparen) {
06884 paren_lvl--;
06885 }
06886 else if (paren_lvl != 0) {
06887 }
06888 else if (ich == equal) {
06889 cont_var = TRUE;
06890 break;
06891 }
06892 else if (ich == EOF) {
06893 break;
06894 }
06895 else if (ich == blank |
06896 ich == tab |
06897 ich == percent |
06898 ich == underscore |
06899 ich == dollar |
06900 ich == at_sign |
06901 ch_class[ich] == Ch_Class_Digit |
06902 ch_class[ich] == Ch_Class_Letter) {
06903 }
06904 else {
06905 break;
06906 }
06907
06908 if (++idx == stmt_line_end_idx[line_idx]) {
06909
06910 if (line_idx < lines_in_buf) {
06911 idx = stmt_line_start_idx[++line_idx]
06912 + stmt_line_offset[line_idx] + 1;
06913 }
06914 else {
06915 break;
06916 }
06917 }
06918 ich = stmt_buf[idx];
06919 }
06920 while (paren_lvl >= 0);
06921
06922 TRACE (Func_Exit, "next_id_is_imp_control", NULL);
06923
06924 return(cont_var);
06925
06926 }
06927
06928
06929
06930
06931
06932
06933
06934
06935
06936
06937
06938
06939
06940
06941
06942
06943
06944 void issue_deferred_msgs (void)
06945
06946 {
06947 char *arg1;
06948 char *arg2;
06949 char *arg3;
06950 char *arg4;
06951 int i;
06952 char *ptr;
06953
06954
06955 TRACE (Func_Entry, "issue_deferred_msgs", NULL);
06956
06957 i = 1;
06958
06959 while (i <= msg_queue_idx) {
06960
06961 switch (msg_queue[i].order) {
06962
06963 case NO_ARG :
06964 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
06965 msg_queue[i].sever, msg_queue[i].col_num);
06966 break;
06967
06968 case STR_ARG :
06969 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
06970 msg_queue[i].sever, msg_queue[i].col_num,
06971 (char *) (&msg_queue[i+1]));
06972 break;
06973
06974 case ARG_ARG :
06975 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
06976 msg_queue[i].sever, msg_queue[i].col_num,
06977 msg_queue[i].arg);
06978 break;
06979
06980 case STR_ARG_ARG :
06981 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
06982 msg_queue[i].sever, msg_queue[i].col_num,
06983 (char *) (&msg_queue[i+1]),
06984 msg_queue[i].arg);
06985 break;
06986
06987 case ARG_STR_ARG :
06988 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
06989 msg_queue[i].sever, msg_queue[i].col_num,
06990 msg_queue[i].arg,
06991 (char *) (&msg_queue[i+1]));
06992 break;
06993
06994 case MULT_STR_ARG :
06995
06996
06997
06998 ptr = (char *) (&msg_queue[i+1]);
06999 arg1 = strtok(ptr, "\n");
07000 arg2 = strtok(NULL, "\n");
07001 arg3 = strtok(NULL, "\n");
07002 arg4 = NULL;
07003
07004 if (arg3 != NULL) {
07005 arg4 = strtok(NULL, "\n");
07006 }
07007
07008 PRINTMSG(msg_queue[i].line_num, msg_queue[i].msg_num,
07009 msg_queue[i].sever, msg_queue[i].col_num,
07010 arg1, arg2, arg3, arg4);
07011 break;
07012 }
07013
07014 i = msg_queue[i].next_msg;
07015 }
07016
07017 msg_queue_idx = NULL_IDX;
07018
07019 TRACE (Func_Exit, "issue_deferred_msgs", NULL);
07020
07021 return;
07022
07023 }
07024
07025
07026 # ifdef _DEBUG
07027
07028
07029
07030
07031
07032
07033
07034
07035
07036
07037
07038
07039
07040
07041
07042
07043
07044
07045
07046 void print_src_stk_entry(int ss_idx)
07047
07048 {
07049 char file_type[12];
07050
07051
07052 TRACE (Func_Entry, "print_src_stk_entry", NULL);
07053
07054 switch (SRC_STK_FILE_TYPE(ss_idx)) {
07055
07056 case Stdin_Src:
07057 strcpy(file_type, "Stdin_Src");
07058 break;
07059
07060 case Input_Src:
07061 strcpy(file_type, "Input_Src");
07062 break;
07063
07064 case Include_Src:
07065 strcpy(file_type, "Include_Src");
07066 }
07067
07068 fprintf(stderr, "Entry #%3d File line = %-5d%12sFile type = %s\n"
07069 "%13sPrev src form = %10s File name start = %d\n"
07070 "%13sFull path name = %s",
07071 ss_idx, SRC_STK_FILE_LINE(ss_idx), " ", file_type,
07072 " ", (SRC_STK_PREV_SRC_FORM(ss_idx) == Fixed_Form) ?
07073 "Fixed Form" : "Free Form",
07074 SRC_STK_FILE_IDX(ss_idx),
07075 " ", SRC_STK_PATH_NAME(ss_idx));
07076
07077 fprintf(stderr, "\n%13sCIF file id = %d",
07078 " ", SRC_STK_CIF_FILE_ID(ss_idx));
07079
07080 putc('\n', stderr);
07081
07082 TRACE (Func_Exit, "print_src_stk_entry", NULL);
07083
07084 return;
07085
07086 }
07087
07088
07089
07090
07091
07092
07093
07094
07095
07096
07097
07098
07099
07100
07101
07102
07103
07104
07105 void print_src_input_tbls(void)
07106
07107 {
07108 fprintf (debug_file, "%-20s %-9s= %-8d %-9s= %-6d %-9s= %-7d\n",
07109 "msg_queue",
07110 "init size", msg_queue_init_size,
07111 "increment", msg_queue_inc,
07112 "num words", msg_queue_num_wds);
07113 fprintf (debug_file, "%-20s %-9s= %-8d %-9s= %-6d %-9s= %-7d\n",
07114 "src_stk",
07115 "init size", src_stk_init_size,
07116 "increment", src_stk_inc,
07117 "num words", src_stk_num_wds);
07118
07119 return;
07120
07121 }
07122 # endif
07123
07124
07125
07126
07127
07128
07129
07130
07131
07132
07133
07134
07135
07136
07137
07138
07139
07140
07141 boolean digit_is_format_label(void)
07142
07143 {
07144 int ich;
07145 int idx;
07146 boolean is_label = TRUE;
07147 int lblank = ' ';
07148 int line_idx;
07149 int ltab = '\t';
07150
07151 TRACE (Func_Entry, "digit_is_format_label", NULL);
07152
07153 idx = stmt_buf_idx;
07154 line_idx = stmt_line_idx;
07155 ich = stmt_buf[idx];
07156
07157 if (source_form == Free_Form) {
07158 lblank = -1;
07159 ltab = -1;
07160 }
07161
07162 while (ich != EOF && (ch_class[ich] == Ch_Class_Digit ||
07163 ich == lblank || ich == ltab)) {
07164
07165 if (++idx == stmt_line_end_idx[line_idx]) {
07166
07167 if (line_idx < lines_in_buf) {
07168 idx = stmt_line_start_idx[++line_idx]
07169 + stmt_line_offset[line_idx] + 1;
07170 }
07171 else {
07172 break;
07173 }
07174 }
07175 ich = stmt_buf[idx];
07176 }
07177
07178 if (ich == dot ||
07179 ich == underscore ||
07180 ich == lc_d || ich == uc_d ||
07181 ich == lc_e || ich == uc_e ||
07182 ich == lc_b || ich == uc_b ||
07183 ich == lc_h || ich == uc_h ||
07184 ich == lc_l || ich == uc_l ||
07185 ich == lc_r || ich == uc_r) {
07186
07187 is_label = FALSE;
07188 }
07189
07190 TRACE (Func_Exit, "digit_is_format_label", NULL);
07191
07192 return(is_label);
07193
07194 }
07195
07196
07197
07198
07199
07200
07201
07202
07203
07204
07205
07206
07207
07208
07209
07210
07211
07212
07213
07214
07215 char *get_src_path_name(void)
07216 {
07217
07218 return(SRC_STK_PATH_NAME(SRC_STK_BASE_IDX));
07219
07220 }
07221
07222
07223
07224
07225
07226
07227
07228
07229
07230
07231
07232
07233
07234
07235
07236
07237
07238
07239
07240 boolean next_tok_is_paren_slash(void)
07241
07242 {
07243 int ich;
07244 int idx;
07245 int line_idx;
07246 int lblank = ' ';
07247 int ltab = '\t';
07248 boolean paren_slash = FALSE;
07249
07250 TRACE (Func_Entry, "next_tok_is_paren_slash", NULL);
07251
07252 idx = stmt_buf_idx;
07253 line_idx = stmt_line_idx;
07254
07255 if (source_form != Fixed_Form) {
07256 lblank = -1;
07257 ltab = -1;
07258 }
07259
07260 ich = stmt_buf[idx];
07261
07262 if (ich == lparen) {
07263
07264 do {
07265 idx++;
07266
07267 if (idx == stmt_line_end_idx[line_idx]) {
07268
07269 if (line_idx < lines_in_buf) {
07270 idx = stmt_line_start_idx[++line_idx]
07271 + stmt_line_offset[line_idx] + 1;
07272 }
07273 else {
07274 break;
07275 }
07276 }
07277
07278 ich = stmt_buf[idx];
07279 }
07280 while (ich == lblank | ich == ltab);
07281
07282 if (ich == slash) {
07283 paren_slash = TRUE;
07284 }
07285 }
07286
07287
07288 TRACE (Func_Exit, "next_tok_is_paren_slash", NULL);
07289
07290 return(paren_slash);
07291
07292 }
07293
07294
07295
07296
07297
07298
07299
07300
07301
07302
07303
07304
07305
07306
07307
07308
07309
07310
07311 void prev_char_line_and_col(int *line,
07312 int *col)
07313
07314 {
07315 int ich;
07316 int idx;
07317 int line_idx;
07318
07319 TRACE (Func_Entry, "prev_char_line_and_col", NULL);
07320
07321 idx = stmt_buf_idx;
07322 line_idx = stmt_line_idx;
07323
07324 do {
07325
07326 idx--;
07327
07328 if (idx <= stmt_line_start_idx[line_idx] + stmt_line_offset[line_idx]) {
07329
07330 if (line_idx > 1) {
07331 line_idx--;
07332 idx = stmt_line_end_idx[line_idx];
07333 ich = blank;
07334 continue;
07335 }
07336 else {
07337 break;
07338 }
07339 }
07340
07341 ich = stmt_buf[idx];
07342 }
07343 while (ich == blank | ich == tab);
07344
07345 *line = stmt_line_num[line_idx];
07346 *col = stmt_buf_col[idx];
07347
07348 TRACE (Func_Exit, "prev_char_line_and_col", NULL);
07349
07350 return;
07351
07352 }
07353
07354
07355
07356
07357
07358
07359
07360
07361
07362
07363
07364
07365
07366
07367
07368
07369
07370
07371
07372 boolean stmt_is_save_stmt(int buf_idx, int stmt_num)
07373
07374 {
07375 boolean is_save_stmt = FALSE;
07376
07377 TRACE (Func_Entry, "stmt_is_save_stmt", NULL);
07378
07379 if (source_form == Free_Form) {
07380 goto EXIT;
07381 }
07382 else {
07383 is_save_stmt = TRUE;
07384 }
07385
07386 reset_src_input(buf_idx, stmt_num);
07387
07388 while (LA_CH_VALUE != 'L') {
07389 NEXT_LA_CH;
07390 }
07391
07392 EXIT:
07393
07394 TRACE (Func_Exit, "stmt_is_save_stmt", NULL);
07395
07396 return(is_save_stmt);
07397
07398 }
07399
07400
07401
07402
07403
07404
07405
07406
07407
07408
07409
07410
07411
07412
07413
07414
07415
07416 void ntr_msg_queue(int line,
07417 int msg_num,
07418 msg_severities_type severity,
07419 int column,
07420 char *str,
07421 long arg,
07422 int order)
07423
07424 {
07425 char *char_idx;
07426 int idx;
07427 int length;
07428 int next_msg_idx;
07429 int num_entries;
07430
07431
07432 TRACE (Func_Entry, "ntr_msg_queue", NULL);
07433
07434 if (msg_queue_size == 0) {
07435 CHECK_INITIAL_ALLOC(msg_queue, 1);
07436 }
07437 else {
07438 TBL_REALLOC_CK(msg_queue, 1);
07439 }
07440
07441 CLEAR_TBL_NTRY(msg_queue, msg_queue_idx);
07442
07443 msg_queue[msg_queue_idx].line_num = line;
07444 msg_queue[msg_queue_idx].col_num = column;
07445 msg_queue[msg_queue_idx].sever = severity;
07446 msg_queue[msg_queue_idx].msg_num = msg_num;
07447 msg_queue[msg_queue_idx].order = order;
07448 msg_queue[msg_queue_idx].arg = arg;
07449
07450 if (str == NULL) {
07451 msg_queue[msg_queue_idx].str_len = 0;
07452 msg_queue[msg_queue_idx].next_msg = msg_queue_idx + 1;
07453 }
07454 else {
07455 next_msg_idx = msg_queue_idx + 1;
07456 length = strlen(str);
07457 num_entries = (WORD_LEN(length) + NUM_MQ_WDS-1) / NUM_MQ_WDS;
07458 msg_queue_idx += num_entries;
07459
07460 msg_queue[next_msg_idx - 1].next_msg = msg_queue_idx + 1;
07461 msg_queue[next_msg_idx - 1].str_len = length;
07462
07463 CHECK_TBL_ALLOC_SIZE(msg_queue, msg_queue_idx);
07464
07465 char_idx = ((char *) (&msg_queue[next_msg_idx]));
07466
07467 for (idx = 0; idx < num_entries; idx++) {
07468 CLEAR_TBL_NTRY(msg_queue, next_msg_idx + idx);
07469 }
07470
07471 strcpy(char_idx, str);
07472 }
07473
07474 TRACE (Func_Exit, "ntr_msg_queue", NULL);
07475
07476 return;
07477
07478 }
07479
07480
07481
07482
07483
07484
07485
07486
07487
07488
07489
07490
07491
07492
07493
07494
07495
07496 void ntr_next_msg_queue(int line,
07497 int msg_num,
07498 msg_severities_type severity,
07499 int column,
07500 char *str,
07501 long arg,
07502 int order)
07503
07504 {
07505 char *char_idx;
07506 int idx;
07507 int length;
07508 int next_msg_idx;
07509 int num_entries;
07510
07511
07512 TRACE (Func_Entry, "ntr_next_msg_queue", NULL);
07513
07514 if (next_msg_queue_size == 0) {
07515 CHECK_INITIAL_ALLOC(next_msg_queue, 1);
07516 }
07517 else {
07518 TBL_REALLOC_CK(next_msg_queue, 1);
07519 }
07520
07521 CLEAR_TBL_NTRY(next_msg_queue, next_msg_queue_idx);
07522
07523 next_msg_queue[next_msg_queue_idx].line_num = line;
07524 next_msg_queue[next_msg_queue_idx].col_num = column;
07525 next_msg_queue[next_msg_queue_idx].sever = severity;
07526 next_msg_queue[next_msg_queue_idx].msg_num = msg_num;
07527 next_msg_queue[next_msg_queue_idx].order = order;
07528 next_msg_queue[next_msg_queue_idx].arg = arg;
07529
07530 if (str == NULL) {
07531 next_msg_queue[next_msg_queue_idx].str_len = 0;
07532 next_msg_queue[next_msg_queue_idx].next_msg = next_msg_queue_idx + 1;
07533 }
07534 else {
07535 next_msg_idx = next_msg_queue_idx + 1;
07536 length = strlen(str);
07537 num_entries = (WORD_LEN(length) + NUM_MQ_WDS-1) / NUM_MQ_WDS;
07538 next_msg_queue_idx += num_entries;
07539
07540 next_msg_queue[next_msg_idx - 1].next_msg = next_msg_queue_idx + 1;
07541 next_msg_queue[next_msg_idx - 1].str_len = length;
07542
07543 CHECK_TBL_ALLOC_SIZE(next_msg_queue, next_msg_queue_idx);
07544
07545 char_idx = ((char *) (&next_msg_queue[next_msg_idx]));
07546
07547 for (idx = 0; idx < num_entries; idx++) {
07548 CLEAR_TBL_NTRY(next_msg_queue, next_msg_idx + idx);
07549 }
07550
07551 strcpy(char_idx, str);
07552 }
07553
07554 TRACE (Func_Exit, "ntr_next_msg_queue", NULL);
07555
07556 return;
07557
07558 }
07559
07560
07561
07562
07563
07564
07565
07566
07567
07568
07569
07570
07571
07572
07573
07574
07575
07576
07577 static void move_up_next_msg_queue(void)
07578
07579 {
07580 #ifdef KEY
07581 char *chptr = 0;
07582 #else
07583 char *chptr;
07584 #endif
07585 int i;
07586 int k;
07587 boolean duplicate;
07588
07589 TRACE (Func_Entry, "move_up_next_msg_queue", NULL);
07590
07591 i = 1;
07592 while (i <= next_msg_queue_idx) {
07593
07594 duplicate = FALSE;
07595
07596 switch(next_msg_queue[i].order) {
07597 case NO_ARG :
07598 case ARG_ARG :
07599 chptr = NULL;
07600 break;
07601
07602 case STR_ARG :
07603 case STR_ARG_ARG :
07604 case ARG_STR_ARG :
07605 chptr = (char *) (&next_msg_queue[i+1]);
07606 break;
07607 }
07608
07609 k = 1;
07610
07611 while (k < i) {
07612 if (next_msg_queue[k].msg_num == next_msg_queue[i].msg_num &&
07613 next_msg_queue[k].line_num == next_msg_queue[i].line_num &&
07614 next_msg_queue[k].col_num == next_msg_queue[i].col_num) {
07615
07616 duplicate = TRUE;
07617 break;
07618 }
07619
07620 k = next_msg_queue[k].next_msg;
07621 }
07622
07623 if (extra_nxt_line != NULL_IDX &&
07624 next_msg_queue[i].line_num == pp_nxt_line_num[extra_nxt_line]) {
07625
07626
07627 duplicate = TRUE;
07628 }
07629
07630 if (! duplicate ) {
07631 ntr_msg_queue(next_msg_queue[i].line_num,
07632 next_msg_queue[i].msg_num,
07633 next_msg_queue[i].sever,
07634 next_msg_queue[i].col_num,
07635 chptr,
07636 next_msg_queue[i].arg,
07637 next_msg_queue[i].order);
07638 }
07639
07640 i = next_msg_queue[i].next_msg;
07641 }
07642
07643 next_msg_queue_idx = NULL_IDX;
07644
07645 TRACE (Func_Exit, "move_up_next_msg_queue", NULL);
07646
07647 return;
07648
07649 }
07650
07651 # ifdef _DEBUG
07652
07653
07654
07655
07656
07657
07658
07659
07660
07661
07662
07663
07664
07665
07666
07667
07668
07669
07670 void final_src_input(void)
07671
07672 {
07673 TRACE (Func_Entry, "final_src_input", NULL);
07674
07675 MEM_REPORT(src_stk);
07676 MEM_REPORT(msg_queue);
07677
07678 TRACE (Func_Exit, "final_src_input", NULL);
07679
07680 return;
07681
07682 }
07683 # endif
07684
07685
07686
07687
07688
07689
07690
07691
07692
07693
07694
07695
07696
07697
07698
07699
07700
07701 void preprocess_only_driver(void)
07702
07703 {
07704 TRACE (Func_Entry, "preprocess_only_driver", NULL);
07705
07706 nxt_line_type = Comment_Line;
07707 include_found = FALSE;
07708 include_switch = FALSE;
07709 include_complete = FALSE;
07710
07711 issue_classify_msg = FALSE;
07712
07713 while (nxt_line_type != EOF_Line) {
07714
07715 nxt_line_type = Regular_Line;
07716
07717 if (get_nxt_line()) {
07718
07719 if (include_switch) {
07720 update_global_line();
07721 include_switch = FALSE;
07722 }
07723
07724 if (issue_pound_exit_line) {
07725 OUTPUT_POUND_INCLUDE_EXIT_LINE(curr_glb_line);
07726 issue_pound_exit_line = FALSE;
07727 }
07728
07729 nxt_line_mp_line = FALSE;
07730
07731 if (nxt_line_type != Cond_Comp_Line) {
07732 PP_ORIG_SIZE = line_size;
07733 classify_line();
07734 }
07735
07736 if (change_source_form) {
07737 if (source_form == Fixed_Form) {
07738 source_form = Free_Form;
07739 line_size = FREE_SRC_LINE_SIZE;
07740 expected_line = Regular_Line;
07741 }
07742 else {
07743 source_form = Fixed_Form;
07744 if (cmd_line_flags.line_size_80) {
07745 line_size = FIXED_SRC_LINE_SIZE_80;
07746 }
07747 else if (cmd_line_flags.line_size_132) {
07748 line_size = FIXED_SRC_LINE_SIZE_132;
07749 }
07750 else {
07751 line_size = FIXED_SRC_LINE_SIZE_72;
07752 }
07753 }
07754
07755 change_source_form = FALSE;
07756 }
07757
07758 if (nxt_line_type == Cond_Comp_Line) {
07759
07760 fprintf(dot_i_fptr, "\n");
07761 previous_global_line++;
07762
07763 if (parse_cc_line()) {
07764
07765
07766
07767 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
07768
07769 #ifdef KEY
07770 if (open_include_file (TRUE, FALSE))
07771 #else
07772 if (open_include_file (TRUE))
07773 #endif
07774 {
07775 include_found = TRUE;
07776 include_switch = TRUE;
07777 }
07778 }
07779
07780 }
07781 else {
07782 if (ignore_source_line) {
07783
07784 fprintf(dot_i_fptr, "\n");
07785 previous_global_line++;
07786 }
07787 else {
07788 print_nxt_line();
07789 }
07790 }
07791 }
07792 else {
07793
07794
07795 if (cmd_line_flags.pp_macro_expansion) {
07796 pp_line_idx++;
07797 }
07798
07799
07800
07801 if (src_stk_idx > SRC_STK_BASE_IDX) {
07802 include_complete = TRUE;
07803 nxt_line_type = Comment_Line;
07804 curr_glb_line--;
07805
07806 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
07807 SRC_STK_FILE_LINE(src_stk_idx);
07808 set_related_gl_source_lines(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
07809
07810 if (source_form != SRC_STK_PREV_SRC_FORM(src_stk_idx)) {
07811 change_source_form = TRUE;
07812 }
07813 POP_SRC;
07814 include_switch = TRUE;
07815 issue_pound_exit_line = TRUE;
07816 }
07817 else {
07818 GL_SOURCE_LINES(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx)) =
07819 SRC_STK_FILE_LINE(src_stk_idx);
07820 set_related_gl_source_lines(SRC_STK_GLOBAL_LINE_IDX(src_stk_idx));
07821 nxt_line_type = EOF_Line;
07822 nxt_line_EOL = 0;
07823 }
07824 }
07825
07826 move_up_next_msg_queue();
07827 }
07828
07829 issue_classify_msg = TRUE;
07830
07831 TRACE (Func_Exit, "preprocess_only_driver", NULL);
07832
07833 return;
07834
07835 }
07836
07837
07838
07839
07840
07841
07842
07843
07844
07845
07846
07847
07848
07849
07850
07851
07852
07853 void set_related_gl_source_lines(int gl_idx)
07854
07855 {
07856 int i;
07857 int id;
07858
07859 TRACE (Func_Entry, "set_related_gl_source_lines", NULL);
07860
07861 id = GL_CIF_FILE_ID(gl_idx);
07862
07863 for (i = gl_idx - 1; i > 0; i--) {
07864 if (GL_CIF_FILE_ID(i) == id) {
07865 GL_SOURCE_LINES(i) = GL_SOURCE_LINES(gl_idx);
07866 }
07867 }
07868
07869 TRACE (Func_Exit, "set_related_gl_source_lines", NULL);
07870
07871 return;
07872
07873 }
07874
07875
07876
07877
07878
07879
07880
07881
07882
07883
07884
07885
07886
07887
07888
07889
07890
07891 int ntr_io_string_constant(void)
07892
07893 {
07894 char *char_ptr;
07895 int cn_idx = NULL_IDX;
07896 long count = 0;
07897 int idx;
07898 int ich;
07899 int line_idx;
07900 int type_idx;
07901
07902 TRACE (Func_Entry, "ntr_io_string_constant", NULL);
07903
07904
07905
07906 for (line_idx = 1; line_idx <= lines_in_buf; line_idx++) {
07907 idx = stmt_line_start_idx[line_idx] + stmt_line_offset[line_idx] + 1;
07908
07909 while (idx < stmt_line_end_idx[line_idx]) {
07910
07911 ich = stmt_buf[idx];
07912
07913 if (ich == blank | ich == tab | ich == newline) {
07914
07915 }
07916 else {
07917 count++;
07918 }
07919 idx++;
07920 }
07921 }
07922
07923
07924
07925 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
07926 TYP_TYPE(TYP_WORK_IDX) = Character;
07927 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
07928 TYP_DESC(TYP_WORK_IDX) = Default_Typed;
07929 TYP_CHAR_CLASS(TYP_WORK_IDX) = Const_Len_Char;
07930 TYP_FLD(TYP_WORK_IDX) = CN_Tbl_Idx;
07931 TYP_IDX(TYP_WORK_IDX) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, count),
07932 type_idx = ntr_type_tbl();
07933 cn_idx = ntr_const_tbl(type_idx, TRUE, NULL);
07934
07935
07936
07937 char_ptr = (char *) &CN_CONST(cn_idx);
07938
07939 count = 0;
07940
07941 for (line_idx = 1; line_idx <= lines_in_buf; line_idx++) {
07942 idx = stmt_line_start_idx[line_idx] + stmt_line_offset[line_idx] + 1;
07943
07944 while (idx < stmt_line_end_idx[line_idx]) {
07945
07946 ich = stmt_buf[idx];
07947
07948 if (ich == blank | ich == tab | ich == newline) {
07949
07950 }
07951 else {
07952 char_ptr[count] = ich;
07953 count++;
07954 }
07955 idx++;
07956 }
07957 }
07958
07959
07960 TRACE (Func_Exit, "ntr_io_string_constant", NULL);
07961
07962 return(cn_idx);
07963
07964 }
07965
07966
07967
07968
07969
07970
07971
07972
07973
07974
07975
07976
07977
07978
07979
07980
07981
07982 boolean omp_extension_prefix(int line)
07983
07984 {
07985 boolean is_extension = FALSE;
07986 int line_idx;
07987
07988 TRACE (Func_Entry, "omp_extension_prefix", NULL);
07989
07990 for (line_idx = 1; line_idx <= lines_in_buf; line_idx++) {
07991 if (line == stmt_line_num[line_idx]) {
07992 break;
07993 }
07994 }
07995
07996 if (line_idx <= lines_in_buf &&
07997 line_dir_prefix[line_idx] == Csgi_Dir) {
07998
07999 is_extension = TRUE;
08000 }
08001
08002
08003 TRACE (Func_Exit, "omp_extension_prefix", NULL);
08004
08005 return(is_extension);
08006
08007 }
08008
08009
08010
08011
08012
08013
08014
08015
08016
08017
08018
08019
08020
08021
08022
08023
08024
08025 static void print_nxt_line(void)
08026
08027 {
08028 int break_point;
08029 char ch;
08030 int i;
08031 int remaining_room;
08032 int whats_left;
08033 boolean continued_line = FALSE;
08034
08035 TRACE (Func_Entry, "print_nxt_line", NULL);
08036
08037 if (PP_LINE_TYPE == Comment_Line &&
08038 nxt_line[NXT_COL(1)] == '#') {
08039
08040 for (i = NXT_COL(1); i < nxt_line_end_idx[pp_line_idx]; i++) {
08041 fprintf(dot_i_fptr, "%c", (char)nxt_line[i]);
08042 }
08043 goto EXIT;
08044 }
08045
08046 i = 1;
08047 whats_left = PP_IDX_TO_COL(PP_EOL) - 1;
08048 remaining_room = line_size;
08049
08050 while (whats_left > 0) {
08051
08052 if (whats_left > remaining_room &&
08053 PP_LINE_TYPE != Comment_Line) {
08054
08055 break_point = i + remaining_room - 2;
08056
08057 while (ch_class[nxt_line[NXT_COL(break_point)]] == Ch_Class_Letter ||
08058 ch_class[nxt_line[NXT_COL(break_point)]] == Ch_Class_Digit ||
08059 nxt_line[NXT_COL(break_point)] == USCORE ||
08060 nxt_line[NXT_COL(break_point)] == DOLLAR ||
08061 nxt_line[NXT_COL(break_point)] == AT_SIGN) {
08062
08063 break_point--;
08064 }
08065 }
08066 else {
08067 break_point = -1;
08068 }
08069
08070 if (PP_LINE_TYPE == Comment_Line) {
08071 previous_global_line++;
08072 }
08073 else {
08074 if (PP_LINE_NUM != previous_global_line + 1 &&
08075 ! continued_line) {
08076 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08077 }
08078
08079 previous_global_line = PP_LINE_NUM;
08080 }
08081
08082 while (i != break_point &&
08083 (ch = nxt_line[NXT_COL(i)]) != newline && ch != eos) {
08084
08085 if (i == 1 &&
08086 PP_MP_LINE) {
08087
08088
08089
08090 fprintf(dot_i_fptr, "!$");
08091 i += 2;
08092 whats_left -= 2;
08093 }
08094 else {
08095 fprintf(dot_i_fptr, "%c", ch);
08096 i++;
08097 whats_left--;
08098 }
08099 }
08100
08101 if (i == break_point) {
08102
08103 remaining_room = line_size;
08104 continued_line = TRUE;
08105
08106 if (source_form == Fixed_Form) {
08107 fprintf(dot_i_fptr, "\n");
08108 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08109
08110 if (PP_LINE_TYPE == Dir_Line) {
08111 switch (PP_ACTUAL_DIR_PREFIX) {
08112 case Cdir_Dir:
08113 fprintf(dot_i_fptr, "!DIR$& ");
08114 remaining_room -= 7;
08115 break;
08116
08117 case Cmic_Dir:
08118 fprintf(dot_i_fptr, "!MIC$& ");
08119 remaining_room -= 7;
08120 break;
08121
08122 case Cpar_Dir:
08123 fprintf(dot_i_fptr, "!$PAR& ");
08124 remaining_room -= 7;
08125 break;
08126
08127 case Cstar_Dir:
08128 fprintf(dot_i_fptr, "!*$*& ");
08129 remaining_room -= 6;
08130 break;
08131
08132 case Cdollar_Dir:
08133 fprintf(dot_i_fptr, "!$& ");
08134 remaining_room -= 4;
08135 break;
08136
08137 case Comp_Dir:
08138 fprintf(dot_i_fptr, "!$OMP& ");
08139 remaining_room -= 7;
08140 break;
08141
08142 case Cdbg_Dir:
08143 fprintf(dot_i_fptr, "!DBG$& ");
08144 remaining_room -= 7;
08145 break;
08146
08147 case Csgi_Dir:
08148 fprintf(dot_i_fptr, "!$SGI& ");
08149 remaining_room -= 7;
08150 break;
08151
08152 }
08153 }
08154 else if (PP_MP_LINE) {
08155 fprintf(dot_i_fptr, "!$ .");
08156 remaining_room -= 7;
08157 }
08158 else {
08159 fprintf(dot_i_fptr, " .");
08160 remaining_room -= 7;
08161 }
08162 }
08163 else {
08164
08165
08166 if (PP_LINE_TYPE == Dir_Line) {
08167 switch (PP_ACTUAL_DIR_PREFIX) {
08168 case Cdir_Dir:
08169 fprintf(dot_i_fptr, "\n");
08170 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08171 fprintf(dot_i_fptr, "!DIR$& ");
08172 remaining_room -= 7;
08173 break;
08174
08175 case Cmic_Dir:
08176 fprintf(dot_i_fptr, "\n");
08177 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08178 fprintf(dot_i_fptr, "!MIC$& ");
08179 remaining_room -= 7;
08180 break;
08181
08182 case Cpar_Dir:
08183 fprintf(dot_i_fptr, "\n");
08184 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08185 fprintf(dot_i_fptr, "!$PAR& ");
08186 remaining_room -= 7;
08187 break;
08188
08189 case Cstar_Dir:
08190 fprintf(dot_i_fptr, "\n");
08191 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08192 fprintf(dot_i_fptr, "!*$*& ");
08193 remaining_room -= 6;
08194 break;
08195
08196 case Cdollar_Dir:
08197 fprintf(dot_i_fptr, "\n");
08198 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08199 fprintf(dot_i_fptr, "!$& ");
08200 remaining_room -= 4;
08201 break;
08202
08203 case Comp_Dir:
08204 fprintf(dot_i_fptr, "&\n");
08205 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08206 fprintf(dot_i_fptr, "!$OMP& ");
08207 remaining_room -= 7;
08208 break;
08209
08210 case Cdbg_Dir:
08211 fprintf(dot_i_fptr, "\n");
08212 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08213 fprintf(dot_i_fptr, "!DBG$& ");
08214 remaining_room -= 7;
08215 break;
08216
08217 case Csgi_Dir:
08218 fprintf(dot_i_fptr, "&\n");
08219 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08220 fprintf(dot_i_fptr, "!$SGI& ");
08221 remaining_room -= 7;
08222 break;
08223
08224 }
08225 }
08226 else if (PP_MP_LINE) {
08227 fprintf(dot_i_fptr, "&\n");
08228 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08229 fprintf(dot_i_fptr, "!$ & ");
08230 remaining_room -= 5;
08231 }
08232 else {
08233 fprintf(dot_i_fptr, "&\n");
08234 OUTPUT_POUND_LINE_NUM(PP_LINE_NUM);
08235 fprintf(dot_i_fptr, "& ");
08236 remaining_room -= 2;
08237 }
08238 }
08239 }
08240 }
08241 fprintf(dot_i_fptr, "\n");
08242
08243 EXIT:
08244
08245 TRACE (Func_Exit, "print_nxt_line", NULL);
08246
08247 return;
08248
08249 }
08250
08251
08252
08253
08254
08255
08256
08257
08258
08259
08260
08261
08262
08263
08264
08265
08266
08267 static void classify_line(void)
08268
08269 {
08270
08271
08272 TRACE (Func_Entry, "classify_line", NULL);
08273
08274 if (cmd_line_flags.pp_macro_expansion) {
08275 pp_line_idx++;
08276
08277 # ifdef _DEBUG
08278 if (pp_line_idx > nxt_line_num_lines) {
08279 PRINTMSG(pp_nxt_line_num[pp_line_idx-1], 626, Internal, 1,
08280 "valid pp_line_idx", "classify_line");
08281 }
08282 # endif
08283 }
08284 else {
08285
08286 PP_MP_LINE = FALSE;
08287 PP_CHANGE_SOURCE_FORM = FALSE;
08288
08289 if (source_form == Fixed_Form) {
08290 fixed_classify_line();
08291 }
08292 else {
08293 free_classify_line();
08294 }
08295 }
08296
08297 if (source_form == Free_Form) {
08298 expected_line = PP_EXPECTED_LINE;
08299 }
08300
08301 nxt_line_idx = PP_IDX_TO_COL(PP_IDX);
08302 nxt_line_label = PP_LABEL;
08303 nxt_line_length = pp_nxt_line_length[pp_line_idx];
08304 nxt_line_num = PP_LINE_NUM;
08305 nxt_line_type = PP_LINE_TYPE;
08306 nxt_line_EOL = PP_IDX_TO_COL(PP_EOL);
08307 nxt_line_prefix_len = PP_PREFIX_LEN;
08308 nxt_line_dir_prefix = PP_DIR_PREFIX;
08309 nxt_line_actual_dir_prefix = PP_ACTUAL_DIR_PREFIX;
08310 nxt_line_mp_line = PP_MP_LINE;
08311 change_source_form = PP_CHANGE_SOURCE_FORM;
08312
08313 TRACE (Func_Exit, "classify_line", NULL);
08314
08315 return;
08316
08317 }
08318
08319
08320
08321
08322
08323
08324
08325
08326
08327
08328
08329
08330
08331
08332
08333
08334
08335 static boolean get_nxt_line(void)
08336
08337 {
08338 boolean not_EOF = TRUE;
08339
08340 TRACE (Func_Entry, "get_nxt_line", NULL);
08341
08342 if (! cmd_line_flags.pp_macro_expansion) {
08343 nxt_line_num_lines = 0;
08344
08345 not_EOF = read_line(FALSE);
08346 }
08347 else {
08348 if (pp_line_idx >= nxt_line_num_lines) {
08349 pp_get_stmt();
08350 }
08351
08352
08353 nxt_line_type = Regular_Line;
08354
08355 if (pp_nxt_line_type[pp_line_idx + 1] == EOF_Line) {
08356 not_EOF = FALSE;
08357 nxt_line_idx = pp_nxt_line_idx[pp_line_idx + 1];
08358 }
08359 }
08360
08361 TRACE (Func_Exit, "get_nxt_line", NULL);
08362
08363 return(not_EOF);
08364
08365 }
08366
08367
08368
08369
08370
08371
08372
08373
08374
08375
08376
08377
08378
08379
08380
08381
08382
08383 static void pp_get_stmt (void)
08384
08385 {
08386 boolean cc_include_line;
08387
08388 TRACE (Func_Entry, "pp_get_stmt", NULL);
08389
08390 SAVE_GLOBAL_VARIABLES
08391
08392 pp_line_idx = 0;
08393 nxt_line_num_lines = 0;
08394
08395
08396 do {
08397
08398
08399
08400 nxt_line_type = Regular_Line;
08401 cc_include_line = FALSE;
08402
08403 if (read_line (FALSE)) {
08404
08405 if (include_switch) {
08406 update_global_line();
08407 include_switch = FALSE;
08408 }
08409
08410 if (issue_pound_exit_line) {
08411 OUTPUT_POUND_INCLUDE_EXIT_LINE(curr_glb_line);
08412 issue_pound_exit_line = FALSE;
08413 }
08414
08415 if (nxt_line_type != Cond_Comp_Line) {
08416 pp_line_idx++;
08417 PP_MP_LINE = FALSE;
08418 PP_CHANGE_SOURCE_FORM = FALSE;
08419 PP_ORIG_SIZE = line_size;
08420
08421 if (source_form == Fixed_Form) {
08422 fixed_classify_line();
08423
08424 while (PP_LINE_TYPE == Comment_Line &&
08425 nxt_line[NXT_COL(1)] > 0 &&
08426 (nxt_line[NXT_COL(1)] == uc_c ||
08427 nxt_line[NXT_COL(1)] == lc_c) &&
08428 scan_fixed_comment()) {
08429
08430 PP_MP_LINE = FALSE;
08431 PP_CHANGE_SOURCE_FORM = FALSE;
08432 fixed_classify_line();
08433 }
08434 }
08435 else {
08436 free_classify_line();
08437 expected_line = PP_EXPECTED_LINE;
08438 }
08439
08440 switch (PP_LINE_TYPE) {
08441 case Comment_Line:
08442
08443 if (on_off_flags.preprocess_only || on_off_flags.save_dot_i) {
08444
08445 if (ignore_source_line) {
08446
08447 #ifdef KEY
08448
08449 #else
08450 fprintf(dot_i_fptr, "\n");
08451 #endif
08452 previous_global_line++;
08453 }
08454 else {
08455 #ifdef KEY
08456
08457
08458
08459
08460
08461
08462
08463
08464
08465
08466
08467
08468
08469
08470
08471 #else
08472 print_nxt_line();
08473 #endif
08474 }
08475 }
08476
08477 pp_line_idx--;
08478 nxt_line_num_lines--;
08479 break;
08480
08481 case Dir_Line:
08482 case Regular_Line:
08483 include_found = FALSE;
08484 include_complete = FALSE;
08485 break;
08486
08487 case Continuation_Line:
08488 case Dir_Continuation_Line:
08489 if (include_found) {
08490 include_found = FALSE;
08491
08492
08493
08494 ntr_msg_queue(PP_LINE_NUM, 53, Error,
08495 (source_form == Fixed_Form ? CONTINUE_COLUMN :
08496 nxt_line_col[PP_IDX]),
08497 (char *)NULL,
08498 0,
08499 NO_ARG);
08500 }
08501
08502 if (include_complete) {
08503 include_complete = FALSE;
08504
08505
08506
08507 ntr_msg_queue(PP_LINE_NUM, 54, Error,
08508 (source_form == Fixed_Form ? CONTINUE_COLUMN :
08509 nxt_line_col[PP_IDX]),
08510 (char *)NULL,
08511 0,
08512 NO_ARG);
08513 }
08514 break;
08515
08516 case Include_Line:
08517
08518 cc_include_line = TRUE;
08519 pp_line_idx--;
08520 nxt_line_num_lines--;
08521
08522 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
08523
08524 #ifdef KEY
08525 if (open_include_file (FALSE, FALSE))
08526 #else
08527 if (open_include_file (FALSE))
08528 #endif
08529 {
08530 include_found = TRUE;
08531 include_switch = TRUE;
08532 }
08533
08534 break;
08535 }
08536 }
08537 else if (parse_cc_line()) {
08538
08539
08540
08541 cc_include_line = TRUE;
08542 include_stmt_file_line = SRC_STK_FILE_LINE(src_stk_idx);
08543
08544 #ifdef KEY
08545 if (open_include_file (TRUE, FALSE))
08546 #else
08547 if (open_include_file (TRUE))
08548 #endif
08549 {
08550 include_found = TRUE;
08551 include_switch = TRUE;
08552 }
08553 }
08554 }
08555 else {
08556
08557
08558
08559 if (cmd_line_flags.pp_macro_expansion) {
08560 pp_line_idx++;
08561 PP_MP_LINE = FALSE;
08562 PP_CHANGE_SOURCE_FORM = FALSE;
08563 }
08564 }
08565 }
08566 while (PP_LINE_TYPE != EOF_Line &&
08567 nxt_line_num_lines < MAX_FIXED_LINES &&
08568 ! PP_CHANGE_SOURCE_FORM &&
08569 (nxt_line_num_lines <= 1 ||
08570 cc_include_line ||
08571 PP_LINE_TYPE == Comment_Line ||
08572 PP_LINE_TYPE == Continuation_Line ||
08573 PP_LINE_TYPE == Dir_Continuation_Line));
08574
08575
08576 if (nxt_line_num_lines > 1 &&
08577 pp_nxt_line_type[nxt_line_num_lines] != Comment_Line &&
08578 pp_nxt_line_type[nxt_line_num_lines] != Continuation_Line &&
08579 pp_nxt_line_type[nxt_line_num_lines] != Dir_Continuation_Line) {
08580
08581 extra_nxt_line = nxt_line_num_lines;
08582 nxt_line_num_lines--;
08583 }
08584
08585 if (pp_nxt_line_type[1] != EOF_Line) {
08586
08587 while (scan_fortran_stmt()) {
08588 pp_line_idx = 0;
08589
08590 RESTORE_GLOBAL_VARIABLES
08591
08592 while (++pp_line_idx <= nxt_line_num_lines) {
08593
08594 if (PP_LINE_TYPE == Comment_Line &&
08595 nxt_line[NXT_COL(1)] == '#') {
08596 continue;
08597 }
08598
08599 PP_MP_LINE = FALSE;
08600 PP_CHANGE_SOURCE_FORM = FALSE;
08601
08602 if (source_form == Fixed_Form) {
08603 fixed_classify_line();
08604 }
08605 else {
08606 free_classify_line();
08607 expected_line = PP_EXPECTED_LINE;
08608 }
08609 }
08610 }
08611 }
08612
08613 expected_line = save_expected_line;
08614
08615
08616 pp_line_idx = 0;
08617
08618 TRACE (Func_Exit, "pp_get_stmt", NULL);
08619
08620 return;
08621
08622 }
08623
08624
08625
08626
08627
08628
08629
08630
08631
08632
08633
08634
08635
08636
08637
08638
08639
08640 static void shift_to_line_size(int shift)
08641
08642 {
08643 int end_line;
08644 int i;
08645 int start_idx;
08646
08647 TRACE (Func_Entry, "shift_to_line_size", NULL);
08648
08649 if (extra_nxt_line) {
08650 end_line = extra_nxt_line;
08651 }
08652 else {
08653 end_line = nxt_line_num_lines;
08654 }
08655
08656 start_idx = nxt_line_end_idx[pp_line_idx];
08657
08658 if (shift > 0) {
08659 for (i = nxt_line_end_idx[end_line]; i >= start_idx; i--) {
08660 nxt_line[i+shift] = nxt_line[i];
08661 nxt_line_col[i+shift] = nxt_line_col[i];
08662 }
08663 }
08664 else if (shift < 0) {
08665 for (i = start_idx; i <= nxt_line_end_idx[end_line]; i++) {
08666 nxt_line[i+shift] = nxt_line[i];
08667 nxt_line_col[i+shift] = nxt_line_col[i];
08668 }
08669 }
08670
08671 nxt_line_end_idx[pp_line_idx] += shift;
08672 pp_nxt_line_length[pp_line_idx] += shift;
08673 pp_nxt_line_EOL[pp_line_idx] += shift;
08674
08675 for (i = pp_line_idx + 1; i <= end_line; i++) {
08676 nxt_line_start_idx[i] += shift;
08677 nxt_line_end_idx[i] += shift;
08678 pp_nxt_line_EOL[i] += shift;
08679 }
08680
08681 TRACE (Func_Exit, "shift_to_line_size", NULL);
08682
08683 return;
08684
08685 }
08686
08687
08688
08689
08690
08691
08692
08693
08694
08695
08696
08697
08698
08699
08700
08701
08702
08703 void get_curr_file_name(char *str)
08704
08705 {
08706
08707
08708 TRACE (Func_Entry, "get_curr_file_name", NULL);
08709
08710 sprintf(str, "\"%s\"", SRC_STK_FILE_NAME(src_stk_idx));
08711
08712 TRACE (Func_Exit, "get_curr_file_name", NULL);
08713
08714 return;
08715
08716 }