DIRECTORY FS USING [Error, StreamOpen], IO USING [CR, EndOf, GetChar, GetIndex, int, PutF, PutFR, rope, SetIndex, SP, STREAM, TAB], RefText USING [AppendChar, Fetch, Length, New], Rope USING [Concat, Fetch, FromRefText, Length, ROPE, Substr], spGlobals USING [branchPtr, EchoInput, GetLineAndCptr, Handle, makeStringNB, MsgTextsWithLook, namePtr, next, nodePtr, PutMsgLine, WorkingDirectory]; spErrors: CEDAR PROGRAM IMPORTS FS, IO, RefText, Rope, spGlobals EXPORTS spGlobals= BEGIN Handle: TYPE= spGlobals.Handle; ErrorSignal: PUBLIC SIGNAL[error: NAT, s: Rope.ROPE]= CODE; ErrWarnSummary: PUBLIC PROC[handle: Handle]= { IF handle.vars.errCount + handle.vars.warnCount > 0 THEN { handle.msgStream.PutF["\n\t"]; IF handle.vars.errCount > 0 THEN { spGlobals.MsgTextsWithLook[handle, "Total errors: ", 'b]; handle.msgStream.PutF["%d", IO.int[handle.vars.errCount]]; IF handle.vars.warnCount > 0 THEN handle.msgStream.PutF["; "] ELSE spGlobals.PutMsgLine[handle, ".\n"]; }; IF handle.vars.warnCount > 0 THEN { spGlobals.MsgTextsWithLook[handle, IF handle.vars.errCount > 0 THEN "tatal warnings: " ELSE "Total Warnings: ", 'b]; handle.msgStream.PutF["%d.\n", IO.int[handle.vars.warnCount]]; }; }; }; -- ErrWarnSummary printError: PROC[handle: Handle, err: NAT, warning: BOOL_ FALSE]= { OPEN handle.vars; errMsg: REF TEXT_ RefText.New[256]; tChar: CHAR; number: NAT_ 0; nonBlank: BOOL; IF thymeDotErrors=NIL AND ~triedOnce THEN {OPEN spGlobals; thymeDotErrors_ FS.StreamOpen[Rope.Concat[WorkingDirectory[handle], "Thyme.errors"] !FS.Error => { thymeDotErrors_ FS.StreamOpen["/DATools/DATools6.0/Thyme/Thyme.errors" !FS.Error => { handle.msgStream.PutF[ "-- Thyme can't find the file \"Thyme.errors\" on your working directory or the Thyme release directory. You need the file to find out what the error is.\n"]; thymeDotErrors_ NIL; triedOnce_ TRUE; CONTINUE; }; ]; CONTINUE; }; ]; IF thymeDotErrors # NIL THEN topOfMsgStream_ thymeDotErrors.GetIndex[]; }; handle.msgStream.PutF["\t\t"]; spGlobals.MsgTextsWithLook[handle, "g", 'm]; spGlobals.MsgTextsWithLook[handle, IF warning THEN " Warning " ELSE " Error ", 'b]; IF warning THEN warnCount_ warnCount + 1 ELSE errCount_ errCount + 1; IF thymeDotErrors # NIL THEN { thymeDotErrors.SetIndex[topOfMsgStream]; UNTIL number=err OR thymeDotErrors.EndOf[] DO errMsg.length _ 0; tChar_ IO.SP; nonBlank_ FALSE; UNTIL thymeDotErrors.EndOf[] DO tChar_ thymeDotErrors.GetChar[]; IF ~nonBlank THEN { IF tChar=IO.SP OR tChar=IO.TAB THEN LOOP ELSE nonBlank_ TRUE; }; IF tChar=IO.CR THEN EXIT; errMsg_ RefText.AppendChar[errMsg, tChar]; ENDLOOP; number_ 0; FOR index: INT IN [0..RefText.Length[errMsg]) DO tChar_ RefText.Fetch[errMsg, index]; IF tChar IN ['0..'9] THEN number_ number*10 + (tChar - '0) ELSE EXIT; ENDLOOP; ENDLOOP; }; IF thymeDotErrors=NIL OR number # err THEN handle.msgStream.PutF["%d.\n", IO.int[err]] ELSE handle.msgStream.PutF["%g.\n", IO.rope[Rope.FromRefText[errMsg]]]; }; -- printError ErrorAtNB: PUBLIC PROC[handle: Handle, err: NAT, n: spGlobals.nodePtr, b: spGlobals.branchPtr]= { handle.msgStream.PutF["%g", IO.rope[ spGlobals.makeStringNB[handle, n, b, FALSE]]]; printError[handle, err]; }; -- ErrorAtNB ErrorStrings: PUBLIC PROC[handle: Handle, err: NAT, s1, s2: Rope.ROPE]= { errLine: Rope.ROPE_ IF s2= NIL THEN IO.PutFR["%g", IO.rope[s1]] ELSE IO.PutFR["%g at %g", IO.rope[s1], IO.rope[s2]]; handle.msgStream.PutF["%g", IO.rope[errLine]]; printError[handle, err]; }; -- ErrorStrings error: PUBLIC PROC[handle: Handle, err: NAT, skip, warning: BOOL_ FALSE]= { cptr, lastPos: INT; line: Rope.ROPE; noEcho: BOOL _ NOT spGlobals.EchoInput[handle]; [line, cptr]_ spGlobals.GetLineAndCptr[handle]; cptr_ MAX[0, cptr - 1]; lastPos_ MAX[0, line.Length[]-1]; IF line.Fetch[lastPos]=IO.CR AND lastPos > 0 THEN lastPos_ lastPos-1; handle.msgStream.PutF[IF noEcho THEN "\n%g" ELSE "%g", IO.rope[line.Substr[0, cptr]]]; spGlobals.MsgTextsWithLook[handle, "8", 'm]; handle.msgStream.PutF["%g\n", IO.rope[line.Substr[cptr, lastPos-cptr+1]]]; printError[handle, err, warning]; IF NOT spGlobals.EchoInput[handle] THEN handle.msgStream.PutF["\t\tat [%g] in %g.\n", IO.int[handle.vars.inStream.GetIndex[] - line.Length[] + cptr - 1], IO.rope[handle.vars.fileNameStack[handle.vars.fileStackTop]] ]; IF skip THEN DO SELECT handle.vars.item FROM semi, eof, rightC, leftC => EXIT; ENDCASE; spGlobals.next[handle]; ENDLOOP; }; -- error error2: PUBLIC PROC[handle: Handle, err: NAT, n: spGlobals.namePtr]= { errLine: Rope.ROPE; errLine_ IO.PutFR["%g", IO.rope[n.name]]; handle.msgStream.PutF["%g", IO.rope[errLine]]; printError[handle, err]; }; -- error2 END. CHANGE LOG Wilhelm, March 30, 1982 8:36 AM Barth, 7-May-82 10:50:38 PDT Chen, June 11, 1984 7:13:37 pm PDT, cedarized. Chen, July 22, 1985 8:03:18 pm PDT, => Cedar6.0. ΎFile: spErrors.mesa Copyright (C) 1985 by Xerox Corporation. All rights reserved. Last Edited by: Pradeep Sindhu March 19, 1986 9:49:32 pm PST Sweetsun Chen, September 18, 1985 9:17:35 pm PDT try to open Thyme.errors once set leading word (Warning or Error) and increment errCount if it's an error. (Current Cedar PutF doesn't seem to support %l.) handle.msgStream.PutF["\t%l8%l ", IO.rope["m"], IO.rope["M"]]; handle.msgStream.PutF[IF warning THEN "%lWarning%l " ELSE "%lError%l ", IO.rope["b"], IO.rope["B"]]; search for the right line in the whole file. get a line of error message from thyme.errors, skipping leading blanks. parse the number, if any loop if number # err and not eof proc name not right. will be makeRopeNB or something better ... handle.msgStream.PutF["%g%l38%l%g\n", IO.rope[line.Substr[0, cptr]], IO.rope["m"], IO.rope["M"], IO.rope[line.Substr[cptr, lastPos-cptr]], ]; (Cedar5.2 doesn't seem to support PutF to change looks.) Κ–"mycedar" style˜J–"mycedar" stylešœ™Jšœ>™>–"mycedar" style™Icode–"mycedar" style™,K–"mycedar" style™0—J–"mycedar" style˜–"mycedar" stylešΟk ˜ J–"mycedar" stylešœœ˜J–"mycedar" styleš œœœ>œœœ˜[J–"mycedar" stylešœœ"˜/J–"mycedar" stylešœœ&œ ˜>J–"mycedar" stylešœ œ†˜•—J–"mycedar" style˜–"mycedar" stylešœ œ˜J–"mycedar" stylešœœœ˜(J–"mycedar" stylešœ ˜J–"mycedar" style˜—J–"mycedar" styleš˜J–"mycedar" style˜J–"mycedar" stylešœœ˜ J–"mycedar" styleš œ œœœ œœ˜<šΟnœœœ˜.šœ2œ˜:J˜šœœ˜"Jšœ9˜9Jšœœ˜:šœ˜!J˜—Jšœ%˜)J˜—šœœ˜#šœ"˜"Jšœœœ˜Q—Jšœœ˜>J˜—Jšœ˜—Jšœ˜J˜—–"mycedar" styleš œ œœ œœ˜CJ–"mycedar" stylešœ ˜J–"mycedar" stylešœœœ˜#J–"mycedar" stylešœœ˜ J–"mycedar" stylešœœ˜J–"mycedar" stylešœ œ˜J–"mycedar" style˜J–"mycedar" stylešœ™–"mycedar" styleš œœœ œœ ˜:–"mycedar" stylešœœA˜S–"mycedar" stylešœœ ˜–"mycedar" stylešœœ4˜F–"mycedar" stylešœœ ˜J–"mycedar" stylešœ˜J–"mycedar" stylešΟfœ˜Ÿœ˜žJ–"mycedar" stylešœœ˜J–"mycedar" stylešœ œ˜J–"mycedar" stylešœ˜ J–"mycedar" stylešœ˜—J–"mycedar" stylešœ˜—J–"mycedar" stylešœ˜ J–"mycedar" stylešœ˜—J–"mycedar" stylešœ˜—J–"mycedar" stylešœœœ+˜GJ–"mycedar" stylešœ˜—J–"mycedar" style˜–"mycedar" stylešœL™LJ–"mycedar" stylešœ0™0J–"mycedar" stylešœ>™>–"mycedar" stylešœG™GJ–"mycedar" stylešœ™——J–"mycedar" stylešœ˜J–"mycedar" stylešœ,˜,J–"mycedar" stylešœ#œ œ œ˜SJ–"mycedar" stylešœ œœ˜EJ–"mycedar" style™J–"mycedar" stylešœ,™,–"mycedar" stylešœœœ˜J–"mycedar" stylešœ-˜-–"mycedar" stylešœ œ˜-J–"mycedar" stylešœ˜J–"mycedar" stylešœœœ˜ J–"mycedar" stylešœ œ˜J–"mycedar" style˜J–"mycedar" stylešœG™G–"mycedar" stylešœ˜J–"mycedar" stylešœ ˜ –"mycedar" stylešœ œ˜J–"mycedar" stylešœœœœœœœ˜(J–"mycedar" stylešœ œ˜J–"mycedar" stylešœ˜—J–"mycedar" styleš œœœœœ˜J–"mycedar" stylešœ*˜*J–"mycedar" stylešœ˜—J–"mycedar" style˜J–"mycedar" stylešœ™J–"mycedar" stylešœ ˜ –"mycedar" stylešœœœ˜0J–"mycedar" stylešœ$˜$J–"mycedar" stylešœœ œ!˜:J–"mycedar" stylešœœ˜ J–"mycedar" stylešœ˜J–"mycedar" style˜—J–"mycedar" stylešœ ™ J–"mycedar" stylešœ˜—J–"mycedar" stylešœ˜—J–"mycedar" style˜–"mycedar" stylešœœœ˜*J–"mycedar" stylešœœ ˜+—J–"mycedar" stylešœ œ"˜HJ–"mycedar" stylešœΟc ˜—J–"mycedar" style˜–"mycedar" stylešž œœœœ˜0J–"mycedar" stylešœ0˜0–"mycedar" stylešœœ˜$J–"mycedar" stylešœ%œ˜.J–"mycedar" stylešœ?™?—J–"mycedar" stylešœ˜J–"mycedar" stylešœ  ˜—J–"mycedar" style˜–"mycedar" styleš ž œœœœœ˜IJ–"mycedar" styleš œœœœœœ œ ˜?J–"mycedar" stylešœœœ œ ˜4J–"mycedar" stylešœœ˜.J–"mycedar" stylešœ˜J–"mycedar" stylešœ ˜—J–"mycedar" style˜–"mycedar" styleš œœœœœœ˜KJ–"mycedar" stylešœœ˜J–"mycedar" stylešœ œ˜J–"mycedar" stylešœœœ ˜2J–"mycedar" stylešœ/˜/J–"mycedar" stylešœœ˜J–"mycedar" stylešœ œ˜!J–"mycedar" styleš œœœœ œ˜E–"mycedar" stylešœ%™%J–"mycedar" stylešœ™J–"mycedar" stylešœ ™ J–"mycedar" stylešœ ™ J–"mycedar" stylešœ)™)J–"mycedar" stylešœ™—J–"mycedar" stylešœ8™8J–"mycedar" styleš œœœœœ˜VJšœ,˜,J–"mycedar" stylešœœ+˜KJ–"mycedar" stylešœ!˜!–"mycedar" stylešœœœ/˜VJ–"mycedar" stylešœA˜CJ–"mycedar" stylešœ:˜