//routeCorrectOut.bcpl

// Writes those parts of the .wl and .ad files peculiar to re-working.

// last modified by E. McCreight, June 19, 1979 9:32 PM

get "route.defs"

external [ ReadBlock ]

let PrintNewNet(net) be
[
unless net>>net.isSame do
[
WeAre(doingADFile)
PrintNet(net)
]
]

and DeleteNets() be
[
if OldWlFile eq empty then OldWlFile = GetFile(wlOldFileName)
if deletePosFile eq empty then deletePosFile = GetFile("route.dpf")
Resets(deletePosFile)
until Endofs(deletePosFile) do
[
WeAre(doingADFile)

let owlFilePos = vec 2
ReadBlock(deletePosFile, owlFilePos, 2)
SetFilePos(OldWlFile, owlFilePos)

char = used
let oldname = vec 30
let attributes = vec 10
ReadNetName(OldWlFile, oldname, attributes, empty, colonMask)
until char eq $*n do [ char = used; GetValidChar(OldWlFile) ]
char = used
ZeroTheTable()
PutTemplate(ADFile, "*n*nDELETE: <$D> ; $S*n", baseNetNumber,
oldname)
baseNetNumber = baseNetNumber+1
let lastValidChar = $*n
GetValidChar(OldWlFile)
until char eq filegone % (char eq $*n & lastValidChar eq $*n) do
[
Puts(ADFile, char)
lastValidChar = char; char = used; GetValidChar(OldWlFile)
]
Puts(ADFile, $*n)
]
Closes(OldWlFile); OldWlFile = empty
Resets(deletePosFile); TruncateDiskStream(deletePosFile)
Closes(deletePosFile); deletePosFile = empty
]

and ReportNewCutPins(icclass) be
[
unless icclass>>icclass.isTraceWired do return
let cutPins = icclass>>icclass.cutPins
if cutPins eq empty then CallSwat()
for i=1 to Npins(icclass) do
[
if GetBit(cutPins, i) eq 0 %
GetBit(icclass>>icclass.oldCutPins, i) ne 0 then loop

let x,y,info = nil,nil,nil
if (icclass>>icclass.PinOffset)(0, i, lv x, lv y, lv info) ne absolute then
CallSwat()
if (info<<info.level & currentlevel) eq 0 then loop
Heading("DISCONNECT")
PrintPin(icclass, i)
]
]

and ReportRepairedPins(icclass) be
[
unless icclass>>icclass.isTraceWired do return
let oldCutPins = icclass>>icclass.oldCutPins
if oldCutPins eq empty then CallSwat()
for i=1 to Npins(icclass) do
[
if GetBit(oldCutPins, i) eq 0 %
GetBit(icclass>>icclass.cutPins, i) ne 0 then loop

let x,y,info = nil,nil,nil
if (icclass>>icclass.PinOffset)(0, i, lv x, lv y, lv info) ne absolute then
CallSwat()
if (info<<info.level & currentlevel) eq 0 then loop
Heading("RECONNECT")
PrintPin(icclass, i)
]
]