!----------------------------+------------------------------------------+ ! Kurt Andersen | Jet Propulsion Laboratory | ! MIPL Applications | Mail Stop 168-427 | ! Software Engineer | 4800 Oak Grove Drive | ! Office: 169-425 | Pasadena, Calif. 91109 | !----------------------------+-------------------------+----------------+ ! NETWORKS: | | ! SPAN: Mipl3::KKA059 (5.153) | Does the verb | ! ARPA Internet: KKA059@Mipl3.Jpl.Nasa.Gov | `to flame' | ! Internet Address: [128.149.1.28] | come from the | ! ARPAnet->SPAN: KKA059%Mipl3@Star.Stanford.Edu | days of the | ! or: KKA059%Mipl3.Span@Jpl-Vlsi.Arpa | Inquisition? | ! Ma Bell (R.I.P.): (818) 354-1672 | | !------------------------------------------------------+----------------+ ! The following TPU procedures may be freely used and distributed. ! If any improvements are made, please communicate them back to me! ! Error ! ! Procedure will locate the next compiler error message in the DCL ! buffer after the current cursor position and set the current ! positition in the other buffer to the identified error. ! ! Parameters: ! ! none procedure eve_error local this_buffer, this_position, err_pat, err_range, err_mess, pre_target, target_pat, target_range, eol_range, eol_pat, target, line_number, found_range, f_name_pat, f_name, pat ; if (get_info (eve$x_dcl_process, eve$kt_type) = unspecified) or (eve$x_dcl_process = 0) then message ("No DCL buffer to search for error messages"); return (0) ; endif; this_buffer := current_buffer; ! ! First: position the cursor into the DCL buffer ! if this_buffer = eve$dcl_buffer then if eve$x_number_of_windows > 1 then eve_other_window; endif; if current_buffer = eve$dcl_buffer then message ("Must have another buffer on the screen"); return (0); else if eve$x_number_of_windows > 1 then eve_other_window; endif; endif; else if eve$x_number_of_windows > 1 then eve_other_window; endif; if current_buffer <> eve$dcl_buffer then if eve$x_number_of_windows > 1 then eve_other_window; endif; position (eve$dcl_buffer); endif; endif; ! ! These are the patterns to search for: ! pat -- the line number on which the error occurred ! f_name_pat -- the file in which the error occurred ! err_pat -- the beginning of an error message ! target_pat -- the offending text ! pat := 'At line number ' & span('01213456789'); f_name_pat := ' ' & scan(' :[')& ':[' & match(']') & match('.') & match(';') @f_name & span('0123456789'); err_pat := line_begin & '%' & match('-') & any('iwef') & '-' & match(',') & remain; target_pat := anchor & match('"') @pre_target & match('"'); err_range := search (err_pat, FORWARD, NO_EXACT); if err_range <> 0 then position (err_range); target_range := search (target_pat, FORWARD, NO_EXACT); else target_range := err_range; endif; found_range := search (pat, FORWARD, NO_EXACT); if found_range = 0 then message ("No more errors found") ; if eve$x_number_of_windows > 1 then eve_other_window; else position (this_buffer); endif; else position (found_range); found_range := search (span('0123456789'), FORWARD, NO_EXACT); position (found_range); line_number := int (substr (found_range, 1, length(found_range))); found_range := search (f_name_pat, FORWARD, NO_EXACT); f_name := substr (f_name, 2, length(f_name) - 2); fs_name := file_search (f_name); if length (fs_name) = 0 then fs_name := (file_search (f_name)); endif; err_mess := substr (err_range, 1, length(err_range)); eve$position_in_middle (end_of( found_range)); cursor_horizontal (-132); move_horizontal (-current_offset); move_vertical (1); this_position := mark (none); if eve$x_number_of_windows > 1 then eve_other_window; else position (this_buffer); endif; if (fs_name <> get_info (current_buffer, eve$kt_output_file)) and (fs_name <> get_info (current_buffer, eve$kt_file_name)) then eve_get_file (f_name); endif; eve_line (line_number); message (fao ("Error: !AS", err_mess)); if target_range <> 0 then target := substr (target_range, length (pre_target), length(target_range)); target := substr (target, 2, length(target) - 2); target_pat := '' & (target | LINE_END) ; eol_pat := line_end; target_range := search (target_pat, FORWARD, EXACT); eol_range := search (eol_pat, FORWARD); if target_range <> 0 then if length(eol_range) <> length(target_range) then message ("Moving to target..."); position (beginning_of (target_range)); endif; endif; endif; endif; endprocedure;