DIRECTORY Atom, Commander, IO; XlDebug: CEDAR PROGRAM IMPORTS Atom, Commander, IO ~ BEGIN debugArrayCnt: INT = 4000; --same as in XlImplUtilities DebugArray: TYPE = ARRAY [0..debugArrayCnt) OF BYTE ¬ ALL[0]; WriteDebugInfo: Commander.CommandProc ~ { s: IO.STREAM ¬ cmd.out; cnt, idx, sequenceNumber: INT ¬ 0; fix: REF PACKED ARRAY [0..32) OF BYTE ¬ NEW[PACKED ARRAY [0..32) OF BYTE ¬ ALL[0]]; da: REF DebugArray; -- ¬ NEW[DebugArray ¬ ALL[0]]; WITH Atom.GetProp[$XlDebug, $XlDebug1] SELECT FROM ri: REF INT => sequenceNumber ¬ ri­; ENDCASE => {}; WITH Atom.GetProp[$XlDebug, $XlDebug2] SELECT FROM x: REF PACKED ARRAY [0..32) OF BYTE => fix­ ¬ x­; ENDCASE => {}; WITH Atom.GetProp[$XlDebug, $XlDebug3] SELECT FROM x: REF DebugArray => da ¬ x; ENDCASE => {}; idx ¬ (sequenceNumber MOD debugArrayCnt) + 2*debugArrayCnt; --make it positive enough that simple mod will work IF da=NIL THEN IO.PutRope[s, "no unexpected replies so far\n"] ELSE { IO.PutRope[s, "un-expected reply\ntext:"]; FOR i: INT IN [0..32) DO IO.PutF1[s, " %g", IO.int[fix[i]]] ENDLOOP; IO.PutF1[s, "\nsequencenumber %g \n", IO.int[sequenceNumber]]; IO.PutF[s, "request codes: %g %g %g\n", IO.int[da[(idx-1) MOD debugArrayCnt]], IO.int[da[idx MOD debugArrayCnt]], IO.int[da[(idx+1) MOD debugArrayCnt]]] }; WITH Atom.GetProp[$XlDebug, $XlDebugSP] SELECT FROM ri: REF INT => cnt ¬ ri­; ENDCASE => {}; IO.PutF1[s, "Count of double replies so far: %g \n", IO.int[cnt]]; }; XlDebugBlock: Commander.CommandProc ~ { Atom.PutProp[$XlDebug, $SignalReplyNotExpected, $TRUE]; }; Commander.Register["XlDebugWrite", WriteDebugInfo, "Write debug data for famous error"]; Commander.Register["XlDebugBlock", XlDebugBlock, "Block if famous error occurs"]; END. occurs ”XlDebug.mesa Copyright Σ 1989, 1990, 1991, 1993 by Xerox Corporation. All rights reserved. Christian Jacobi, September 30, 1993 4:18 pm PDT Κ₯–(cedarcode) style•NewlineDelimiter ˜code™ Kšœ ΟeœC™NK™0K™—KšΟk œžœ˜K˜šΟnœžœž˜Kšžœžœ˜—šž˜K˜—Kšœžœ Οc˜7Kš œ žœžœžœžœžœ˜=K˜šŸœ˜)Kšœžœžœ ˜Kšœžœ˜"Kšœžœžœžœ žœžœžœžœžœ žœžœžœ˜UKšœžœ  ˜2šžœ#žœž˜2Kšœžœžœ˜$Kšžœ˜—šžœ#žœž˜2Kš œžœžœžœ žœžœ˜1Kšžœ˜—šžœ#žœž˜2Kšœžœ˜Kšžœ˜—Kšœžœ# 3˜ošžœžœ˜ Kšžœžœ-˜4šžœ˜Kšžœ(˜*šžœžœžœ ž˜Kšžœžœ ˜"Kšžœ˜—Kšžœ$žœ˜>Kšžœ'žœžœžœ žœžœžœ˜™K˜——šžœ$žœž˜3Kšœžœžœ˜Kšžœ˜—Kšžœ3žœ ˜BK˜K˜—šŸ œ˜'K˜7K˜—K˜K˜XK˜QKšžœœœœœ˜ K˜—…—Β ϋ