xref: /minix3/external/bsd/nvi/dist/tcl_scripts/errors.tcl (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	Id: errors.tcl,v 8.2 1995/11/18 12:59:07 bostic Exp  (Berkeley) Date: 1995/11/18 12:59:07
2*84d9c625SLionel Sambuc#
3*84d9c625SLionel Sambuc# File: errors.tcl
4*84d9c625SLionel Sambuc#
5*84d9c625SLionel Sambuc# Author: George V. Neville-Neil
6*84d9c625SLionel Sambuc#
7*84d9c625SLionel Sambuc# Purpose: This file contains vi/tcl code that allows a vi user to parse
8*84d9c625SLionel Sambuc# compiler errors and warnings from a make.out file.
9*84d9c625SLionel Sambuc
10*84d9c625SLionel Sambucproc findErr {} {
11*84d9c625SLionel Sambuc	global errScreen
12*84d9c625SLionel Sambuc	global currFile
13*84d9c625SLionel Sambuc	global fileScreen
14*84d9c625SLionel Sambuc	set errLine [lindex [viGetCursor $errScreen] 0]
15*84d9c625SLionel Sambuc	set currLine [split [viGetLine $errScreen $errLine] :]
16*84d9c625SLionel Sambuc	set currFile [lindex $currLine 0]
17*84d9c625SLionel Sambuc	set fileScreen [viNewScreen $errScreen $currFile]
18*84d9c625SLionel Sambuc	viSetCursor $fileScreen [lindex $currLine 1] 1
19*84d9c625SLionel Sambuc	viMapKey $viScreenId  nextErr
20*84d9c625SLionel Sambuc}
21*84d9c625SLionel Sambuc
22*84d9c625SLionel Sambucproc nextErr {} {
23*84d9c625SLionel Sambuc	global errScreen
24*84d9c625SLionel Sambuc	global fileScreen
25*84d9c625SLionel Sambuc	global currFile
26*84d9c625SLionel Sambuc	set errLine [lindex [viGetCursor $errScreen] 0]
27*84d9c625SLionel Sambuc	set currLine [split [viGetLine $errScreen $errLine] :]
28*84d9c625SLionel Sambuc	if {[string match $currFile [lindex $currLine 0]]} {
29*84d9c625SLionel Sambuc		viSetCursor $fileScreen [lindex $currLine 1] 0
30*84d9c625SLionel Sambuc		viSwitchScreen $fileScreen
31*84d9c625SLionel Sambuc	} else {
32*84d9c625SLionel Sambuc		viEndScreen $fileScreen
33*84d9c625SLionel Sambuc		set currFile [lindex $currLine 0]
34*84d9c625SLionel Sambuc		set fileScreen[viNewScreen $errScreen $currFile]
35*84d9c625SLionel Sambuc		viSetCursor $fileScreen [lindex $currLine 1] 0
36*84d9c625SLionel Sambuc	}
37*84d9c625SLionel Sambuc}
38*84d9c625SLionel Sambuc
39*84d9c625SLionel Sambucproc initErr {} {
40*84d9c625SLionel Sambuc	global viScreenId
41*84d9c625SLionel Sambuc	global errScreen
42*84d9c625SLionel Sambuc	set errScreen [viNewScreen $viScreenId make.out]
43*84d9c625SLionel Sambuc	viMapKey $viScreenId  findErr
44*84d9c625SLionel Sambuc}
45