Page Numbers: Yes First Page: 1
Heading:
October 6, 1977 12:23 AM[IFS]<KRL>code>alignSetup.bravo
# # # # # # # # # # # # # # #
[MakeNewFindGoal ((parent (ONEOF NIL Goal))
(doArg (ONEOF ActionForm BindingForm))
(RETURNS Irrelevant))
(DECL ((alignEnvironment STACKP (BOUNDIN FullAlign))))
(DPROG ((actionForm (NOT (FMEMB doArg:1 ’(Bind BindElement))) BOOL))
THEN (variable (if actionForm
then ’X
else (EvalAtom doArg:variable))
LITATOM)
(type (if actionForm
then (SELECTQ doArg:ActionType
((ReplaceElement AddAfter AddBefore) ’Element)
(ReplaceDescriptor ’Descriptor)
NIL)
else (EvalAtom doArg:bindingType))
LITATOM)
(test (if actionForm
then (EvalAtom doArg:actionTest)
else (EvalAtom doArg:bindingCount))
ANY)
(count (if actionForm
then (EvalAtom doArg:actionCount)
else (EvalAtom doArg:bindingCount))
(ONEOF (MEMQ ALL COMPLETE NIL) FIXP))
THEN (goal (Create Goal
goalDesc ← (CREATE BindingForm
bindingType ← actionForm
variableSpec ← variable
valueType ← type
bindingTest ← test
bindingCount ← count)
resultType ← (if actionForm then ’FindForAction
else ’FindForBind)
goalType ← (SELECTQ type
(Anchor ’FindAnchor)
(Descriptor ’FindDescriptor)
((Post Primary Pointer Hook) ’FindPost)
(Element ’FindEnumeration)
(KHelp "illegal find type" type))
goalArgs ← actionForm
patternContext ← parent:patternContext
datumContext ← parent:datumContext
datum ← parent:datum
anchorPath ← parent:anchorPath
links ← parent:links
parent ← parent
resultType ← ’ConjunctiveSubgoal)
(SetUpGoal goal parent]
# # # # # # # # # # # # # # #
[SetUpAnchorGoal ((parent Goal)
(pattern Anchor)
(datum (ONEOF Anchor NIL))
(links (LST OF Link))
(goalArgs ANY)
(RETURNS Irrelevant))
(* this is called in various SETUP functions such as that for AlignMapDescOneOf)
(DPROG((goal (CREATE Goal
goalType ← ’AlignAnchor
goalDesc ← pattern
datum ← datum
anchorPath ← (AND datum
parent:anchorPath
<datum ! parent:anchorPath>)
parent ← parent
resultType ← ’ConjunctiveSubgoal
patternContext ← parent:patternContext
datumContext ← parent:datumContext
goalArgs ← goalArgs
links ← links)
Goal))
(if (OR datum (NOT describe))
then (SetUpGoal goal parent ’AlignAnchor)]
# # # # # # # # # # # # # # #
[SetUpOneOf ((parent Goal))
(datMapd Descriptor
(SATISFIES (SameFocusSlot datMapD parent:goalDesc)))
(doStartUp BOOL)
(RETURNS Irrelevant))
(* this is called in AlignMapDesceUnique and AlignMapDescMultiple to set up the subgoal of matching the pattern against a specific mapDescriptor found in the datum. Parent is the AlignMapDesc.. goal)
(DPROG((unique (SELECTQ parent:goalType
(AlignMapDescMulti NIL)
(AlignMapDescUnique T)
(KHelp "bad parent for SetUpOneOf" parent))
BOOL)
THEN(goal (CREATE Goal
goalType ← ’AlignMapDescOneOf
goalDesc ← parent:goalDesc
patternContext ← parent:patternContext
datumContext ← parent:datumContext
datum ← (AND unique parent:datum)
goalArg ← datMapd
anchorPath ← (AND parent:anchorPath
(FindHandle datMapd
parent:anchorPath:1
descrs
(ConstantHandle))
<datMapd ! parent:anchorPath>)
parent ← parent
resultType ← (if unique then ’EquivalentGoal
else ’ConjunctiveSubgoal))
Goal))
(SetUpGoal goal)
(if goal:suspended
then (PUSH parent:goalArgs goal:datum)
(* goalArgs is used for a list of mapDescriptors which have been tried but for
which no goals were set up)
(ReleaseGoal goal)
else (PUSH parent:children goal)
(if doStartUp then (StartUpGoal goal]