DIRECTORY ConvertUnsafe: TYPE USING [EqualSubStrings, SubString], ReplOps: TYPE USING [BodyHandle, IdHandle, MatchAttr], SymbolTable: TYPE USING [Base], Symbols: TYPE USING [Linkage, SEIndex, ISEIndex, CSEIndex, RecordSEIndex, CTXIndex, CBTIndex, nullName, SENull, ISENull, typeTYPE], Types: TYPE USING [Handle, Assignable, Equivalent]; ReplPack: PROGRAM IMPORTS ConvertUnsafe, Types EXPORTS ReplOps = { OPEN Symbols; IdHandle: TYPE = ReplOps.IdHandle; MatchedNames: PROC[id1, id2: IdHandle] RETURNS[BOOL] = { OPEN b1: id1.stb, b2: id2.stb; ss1, ss2: ConvertUnsafe.SubString; IF id1.sei = ISENull OR id2.sei = ISENull THEN RETURN [FALSE]; ss1 _ b1.SubStringForName[b1.seb[id1.sei].hash]; ss2 _ b2.SubStringForName[b2.seb[id2.sei].hash]; RETURN [ConvertUnsafe.EqualSubStrings[ss1, ss2]]}; MatchMode: PROC[id: IdHandle] RETURNS[Linkage] = { OPEN b: id.stb; RETURN[IF b.seb[id.sei].idType = typeTYPE AND b.seb[id.sei].public THEN $type ELSE IF b.seb[id.sei].constant THEN SELECT b.XferMode[b.seb[id.sei].idType] FROM proc, program, signal, error => $val, ENDCASE => $manifest ELSE $ref] }; MatchedAttrs: PROC[idL, idR: IdHandle] RETURNS[BOOL] = { OPEN bL: idL.stb, bR: idR.stb; typeL: CSEIndex = bL.UnderType[bL.seb[idL.sei].idType]; mode: Linkage = MatchMode[idL]; matched: BOOL; IF idR.sei # ISENull THEN { typeR: CSEIndex = bR.UnderType[bR.seb[idR.sei].idType]; matched _ (SELECT mode FROM $val => Types.Assignable[[idL.stb, typeL], [idR.stb, typeR]] AND (bL.seb[idL.sei].idValue = bR.seb[idR.sei].idValue), $ref => Types.Equivalent[[idL.stb, typeL], [idR.stb, typeR]] AND (bL.seb[idL.sei].idValue = bR.seb[idR.sei].idValue) -- offsets AND (bL.seb[idL.sei].idInfo = bR.seb[idR.sei].idInfo), -- sizes $type => (bR.seb[idR.sei].idType = typeTYPE) AND (bR.seb[idR.sei].public) AND Types.Equivalent[ [idL.stb, bL.UnderType[idL.sei]], [idR.stb, bR.UnderType[idR.sei]]], ENDCASE => TRUE)} ELSE matched _ (mode = manifest); IF ~matched THEN SIGNAL Unmatched[$id, idL]; RETURN[matched]}; CTXHandle: TYPE = RECORD [ stb: SymbolTable.Base, ctx: CTXIndex]; MatchedContexts: PROC[ctxL, ctxR: CTXHandle] RETURNS[BOOL] = { OPEN bL: ctxL.stb, bR: ctxR.stb; n: CARDINAL _ 0; FOR sei: ISEIndex _ bL.FirstCtxSe[ctxL.ctx], bL.NextSe[sei] UNTIL sei = ISENull OR n > 4 DO IF bL.seb[sei].hash # nullName THEN { ss: ConvertUnsafe.SubString _ bL.SubStringForName[bL.seb[sei].hash]; IF ~MatchedAttrs[ [ctxL.stb, sei], [ctxR.stb, bR.SearchContext[bR.FindString[ss], ctxR.ctx]]] THEN n _ n+1}; ENDLOOP; RETURN[n = 0]}; RecordHandle: TYPE = RECORD[ stb: SymbolTable.Base, sei: RecordSEIndex]; MatchedRecords: PROC[recL, recR: RecordHandle] RETURNS[BOOL] = { OPEN bL: recL.stb, bR: recR.stb; RETURN[IF recL.sei = SENull OR recR.sei = SENull THEN recL.sei = recR.sei ELSE MatchedContexts[ [recL.stb, bL.seb[recL.sei].fieldCtx], [recR.stb, bR.seb[recR.sei].fieldCtx]]] }; MatchedArgLists: PROC[argL, argR: Types.Handle] RETURNS[BOOL] = { OPEN bL: argL.stb, bR: argR.stb; inL, inR, outL, outR: RecordSEIndex; [inL, outL] _ bL.TransferTypes[argL.sei]; [inR, outR] _ bR.TransferTypes[argR.sei]; RETURN[ MatchedRecords[[argL.stb, inL], [argR.stb, inR]] AND MatchedRecords[[argL.stb, outL], [argR.stb, outR]]] }; BodyHandle: TYPE = ReplOps.BodyHandle; Unmatched: PUBLIC SIGNAL[ReplOps.MatchAttr, IdHandle] = CODE; MatchedBodies: PUBLIC PROC[bodyL, bodyR: BodyHandle] RETURNS[BOOL] = { OPEN bL: bodyL.stb, bR: bodyR.stb; matched: BOOL _ TRUE; IF ~bL.bb[bodyL.bti].hints.noStrings THEN { SIGNAL Unmatched[$strings, [bodyL.stb, bL.bb[bodyL.bti].id]]; matched _ FALSE}; IF ~bR.bb[bodyR.bti].hints.noStrings THEN { IF ~matched THEN SIGNAL Unmatched[$strings, [bodyR.stb, bR.bb[bodyR.bti].id]]; matched _ FALSE}; IF ~( MatchedNames[ [bodyL.stb, bL.bb[bodyL.bti].id], [bodyR.stb, bR.bb[bodyR.bti].id]] AND (bL.bb[bodyL.bti].entryIndex = bR.bb[bodyR.bti].entryIndex) AND Types.Assignable[ [bodyL.stb, bL.bb[bodyL.bti].ioType], [bodyR.stb, bR.bb[bodyR.bti].ioType]] AND MatchedArgLists[ [bodyL.stb, bL.bb[bodyL.bti].ioType], [bodyR.stb, bR.bb[bodyR.bti].ioType]]) THEN { SIGNAL Unmatched[$id, [bodyL.stb, bL.bb[bodyL.bti].id]]; matched _ FALSE}; IF ~MatchedContexts[ [bodyL.stb, bL.bb[bodyL.bti].localCtx], [bodyR.stb, bR.bb[bodyR.bti].localCtx]] THEN matched _ FALSE; RETURN[matched]}; }. ReplPack.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Satterthwaite, September 26, 1985 10:01:19 am PDT Maxwell, August 1, 1983 3:02 pm Russ Atkinson (RRA) March 6, 1985 10:24:19 pm PST matching fields LinkMode for a virtual defs module main entry Êÿ˜codešœ ™ Kšœ Ïmœ1™K˜0K˜0Kšžœ,˜2K˜——Kšœ™˜šŸ œžœžœ ˜2Kšœ"™"Kšžœ ˜šžœžœ!žœ˜BKšžœ˜ šžœž˜#šžœ"ž˜,K˜%Kšžœ ˜——Kšžœ˜ —šœ˜K˜——šŸ œžœžœžœ˜8Kšžœ˜K˜7K˜Kšœ žœ˜šžœžœ˜K˜7šœ žœž˜˜˜4Kšž˜—K˜4—˜˜4Kšž˜—šœ4Ïc ˜>Kšž˜—Kšœ3 ˜;—˜šœ$žœ˜@Kšž˜—˜K˜D——Kšžœžœ˜——Kšžœ˜!Kšžœ žœžœ˜,Kšžœ ˜K˜K˜—šœ žœžœ˜K˜K˜K˜—šŸœžœžœžœ˜>Kšžœ˜ Kšœžœ˜šžœ8˜;šžœžœž˜šžœžœ˜%K˜Dšžœ˜KšœLž˜PK˜ ——Kšžœ˜——Kšžœ ˜K˜K˜—šœžœžœ˜K˜K˜K˜—šŸœžœžœžœ˜@Kšžœ˜ šžœžœžœ˜0Kšžœ˜šžœ˜K˜N——˜K˜——šŸœžœžœžœ˜AKšžœ˜ K˜$K˜)K˜)šžœ˜˜0Kšž˜—K˜3—˜K˜K˜———Kšœ ™ ˜Kšœ žœ˜&K˜Kšœ žœžœ žœ˜=K˜š Ÿ œžœžœžœžœ˜FKšžœ˜"Kšœ žœžœ˜šžœ#žœ˜+Kšžœ7˜=Kšœ žœ˜—šžœ#žœ˜+Kšžœ žœžœ7˜NKšœ žœ˜—šžœ˜˜ ˜CKšž˜——˜;Kšž˜—˜K˜%˜%Kšž˜——˜K˜%K˜&—šžœ˜Kšžœ2˜8Kšœ žœ˜——šžœ˜K˜'Kšœ(žœ žœ˜=—Kšžœ ˜K˜—K˜K˜——…—¬¿