Match.mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Last edited by: David Kurlander - September 6, 1987 5:21:25 pm PDT
Bier, May 24, 1988 11:43:18 pm PDT
Pier, August 19, 1988 5:14:55 pm PDT
DIRECTORY
GGFont, GGInterfaceTypes, GGModelTypes, GGSegmentTypes, GGUserInput, Imager, MatchTurtle, MatchViewer, Rope;
Match: CEDAR DEFINITIONS = BEGIN
GGData: TYPE = GGInterfaceTypes.GGData;
Segment: TYPE = GGSegmentTypes.Segment;
Slice: TYPE = GGModelTypes.Slice;
SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor;
Traj: TYPE = GGModelTypes.Traj;
Type Definitions
ItemID: TYPE = RECORD [
slice: Slice ← NIL,
traj: Traj ← NIL,
seg: Segment ← NIL
];
LooksInfo: TYPE = REF LooksInfoObj;
LooksInfoObj: TYPE = RECORD [
owner: ItemID,
shape: MatchTurtle.TurtleHeader ← NIL,
class: ATOM,
type: REF ANYNIL,
color: Imager.Color ← NIL,
fillColor: Imager.Color ← NIL,
string: Rope.ROPENIL,
font: GGFont.FontData ← NIL,
fontTform: GGFont.FontData ← NIL,
dashes: DashInfo ← NIL,
joints: Imager.StrokeJoint, -- TYPE = {miter, bevel, round}
ends: Imager.StrokeEnd, -- TYPE = {square, butt, round}
width: REAL,
shapeDef, classDef, typeDef, colorDef, fillColorDef, stringDef, fontDef, fontTformDef, dashesDef, jointsDef, endsDef, widthDef: BOOLEANFALSE
];
DashInfo: TYPE = REF DashInfoObj;
DashInfoObj: TYPE = RECORD [
dashed: BOOLFALSE,
pattern: GGModelTypes.SequenceOfReal ← NIL,
offset: REAL ← 0.0,
length: REAL ← -1.0
];
SearchInfo: TYPE = REF SearchInfoObj;
SearchInfoObj: TYPE = RECORD [
reverse: BOOLFALSE,
slice: Slice ← NIL,
kids: LIST OF Slice ← NIL, -- in normal order, or reverse order depending on the value of reverse.
closedTraj: BOOLFALSE,
segs: LIST OF Segment ← NIL, -- should belong to first traj on list, if slice is an Outline
string: Rope.ROPENIL,
empty: BOOLFALSE
];
ItemMatch: TYPE = REF ItemMatchObj;
ItemMatchObj: TYPE = RECORD [
matcher: ItemID,
matchee: ItemID,
backwards: BOOLFALSE
];
MatchDescriptor: TYPE = REF MatchDObj;
MatchDObj: TYPE = RECORD [
posD: MatchTurtle.PositionDescriptor ← NIL,
isMatch: BOOLFALSE, --a complete match has been found
matchedSlices: LIST OF SliceDescriptor ← NIL,
mapping: LIST OF ItemMatch ← NIL
];
SearchState: TYPE = REF SearchStateObj;
SearchStateObj: TYPE = RECORD [
ahead, behind: LIST OF SearchInfo ← NIL, -- SearchInfo's yet to be matched
lastDirection: REF ANYNIL, -- specifies direction of last search,
macroOps: LIST OF LIST OF REF ANY, -- events stored between StartOps and EndOps
macroOn: BOOLFALSE -- specifies that we're currently saving To Viewer events
];
Searching
In MatchImplA
Search: PROC [toSearch: GGData, event: LIST OF REF ANY, refresh: BOOL] RETURNS [found: BOOL];
SearchDisjInit: PROC [them: GGData, event: LIST OF REF ANY];
RemakeDisjList: PROC [theirData: GGData, direction: REF ANY, select: BOOL] RETURNS [toSearch: LIST OF SearchInfo];
SearchDisjNext: PROC [searchList: LIST OF SearchInfo, direction: REF ANY, refresh: BOOLTRUE] RETURNS [newSearchList: LIST OF SearchInfo, found: BOOL];
In MatchImplB
ChangeAll: GGUserInput.UserInputProc;
GetSearchState: PROC RETURNS [SearchState];
CreateMatchDescriptor: PROC [] RETURNS [matchD: MatchDescriptor];
RememberMatchDescriptor: PROC [matchD: MatchDescriptor];
InitializeSearch: PROC [them: GGData, event: LIST OF REF ANY];
SearchConjNext: PROC [ahead, behind: LIST OF SearchInfo, direction: REF ANY, refresh: BOOLTRUE] RETURNS [newAhead, newBehind: LIST OF SearchInfo, found: BOOL];
Utilities
In MatchImplA
HeightSort: PROC [slices: LIST OF Slice, ascending: BOOL] RETURNS [LIST OF Slice];
Building a SearchInfo
In MatchImplA
CreateSearchInfo: PROC [slice: Slice, direction: REF ANY] RETURNS [searchInfo: SearchInfo];
IsEmptySearchInfo: PROC [searchInfo: SearchInfo] RETURNS [BOOLFALSE];
CacheSegsOfFirstTraj: PROC [domain: SearchInfo];
AfterDescriptor: PROC [sliceD: SliceDescriptor, direction: REF ANY] RETURNS [after: SearchInfo ← NIL];
Building a LooksList
In MatchImplA
GetFromLooks: PROC RETURNS [looksList: LIST OF REF ANYNIL]; -- returns looks information of objects in the From (source) viewer
GetToLooks: PROC RETURNS [looksList: LIST OF REF ANYNIL]; -- returns looks information of objects in the To (target) viewer
GetLooksOfSlice: PROC [slice: Slice, choice: MatchViewer.ChoiceData, value: BOOLTRUE] RETURNS [REF ANY];
GetLooksOfTraj: PROC [traj: Traj, choice: MatchViewer.ChoiceData, value: BOOLTRUE] RETURNS [LIST OF LooksInfo];
GetLooksOfSegment: PROC [slice: Slice, traj: Traj, seg: Segment, choice: MatchViewer.ChoiceData, value: BOOL, shape: MatchTurtle.TurtleHeader] RETURNS [looks: LooksInfo];
FindMatchInSlice: PROC [searchInfo: SearchInfo, fromLooks: LIST OF REF ANY, direction: REF ANY, matchD: MatchDescriptor] RETURNS [match: SliceDescriptor ← NIL, rest: SearchInfo ← NIL];
LooksEqual: PROC [l1, l2: LooksInfo] RETURNS [BOOLTRUE];
RemoveSelected: PROC [infoList: LIST OF SearchInfo, sliceD: SliceDescriptor];
RemoveDescriptorFromInfo: PROC [sliceD: SliceDescriptor, info: SearchInfo];
Selecting
In MatchImplB
SelectMapped: PROC [scene: GGModelTypes.Scene, matches: LIST OF ItemMatch];
SelectionFilter: PROC [scene: GGModelTypes.Scene, matches: LIST OF ItemMatch] RETURNS [selectList: LIST OF ItemMatch ← NIL];
Replacing
In MatchImplB
ReplaceOperation: PROC [refresh: BOOLTRUE] RETURNS [success: BOOLFALSE];
END.