TryMatch:
PROC [buffer: Buffer, pCBTable: SymTab.Ref] ~ {
part: Part;
orient: NAT;
refDesLength: NAT;
refDes: ROPE;
IF NOT IsChar[CircularBufferGet[buffer, -3]] THEN RETURN;
IF (
NOT IsNum[CircularBufferGet[buffer, -2]])
AND (
NOT IsChar[CircularBufferGet[buffer, -2]])
THEN
RETURN;
Used to test only for Numerical character but was changed to accomodate RefDes with 2 alphabetic characters. (10-4-88 JCC)
orient ← Basics.BITAND[CircularBufferGet[buffer, -19], 07FH]; -- Mask the MSB
orient ← orient * 256 + CircularBufferGet[buffer, -18];
The orientation of a part should be 0, 90, 180 or 270.
IF orient # 0 AND orient # 90 AND orient # 180 AND orient # 270 THEN RETURN;
refDesLength ← CircularBufferGet[buffer, -4];
refDes ← Convert.RopeFromChar[VAL[CircularBufferGet[buffer, -3]], FALSE];
refDes ← Rope.Cat[refDes, Convert.RopeFromChar[VAL[CircularBufferGet[buffer, -2]], FALSE]];
SELECT refDesLength
FROM
= 3 => {
refDes ← Rope.Cat[refDes, Convert.RopeFromChar[VAL[CircularBufferGet[buffer, -1]], FALSE]];
};
= 4 => {
refDes ← Rope.Cat[refDes, Convert.RopeFromChar[VAL[CircularBufferGet[buffer, -1]], FALSE]];
refDes ← Rope.Cat[refDes, Convert.RopeFromChar[VAL[CircularBufferGet[buffer, 0]], FALSE]];
};
ENDCASE;
part ← NEW[PartRep];
part.x ← CircularBufferGet[buffer, -23];
part.x ← part.x * 256 + CircularBufferGet[buffer, -22];
part.y ← CircularBufferGet[buffer, -21];
part.y ← - (part.y * 256 + CircularBufferGet[buffer, -20]);
part.orientation ← orient;
part.libraryEntry ← CircularBufferGet[buffer, -27];
part.libraryEntry ← part.libraryEntry * 256 + CircularBufferGet[buffer, -26];
part.libraryEntry ← part.libraryEntry * 256 + CircularBufferGet[buffer, -29];
part.libraryEntry ← part.libraryEntry * 256 + CircularBufferGet[buffer, -28];
IF part.libraryEntry < 200
THEN
RETURN;
No library entry should be under 200
[] ← SymTab.Insert[pCBTable, refDes, part];
};