TiogaOpsImpl.Mesa
written by Bill Paxton. June 1982
last written by Paxton. December 28, 1982 12:38 pm
Last Edited by: Paxton, January 10, 1983 4:14 pm
Last Edited by: Maxwell, January 19, 1983 12:31 pm
Last Edited by: Plass, April 15, 1983 4:01 pm
DIRECTORY
TiogaOpsDefs,
TiogaExtraOps,
EditSpan,
MessageWindow,
NameSymbolTable,
NodeAddrs,
NodeStyle,
Rope,
RunReader,
TiogaDocument,
TiogaDocumentPrivate,
TiogaInput,
TiogaInputOps,
TiogaLocks,
TiogaMesaOps,
TiogaOps,
TiogaSelection,
TextEdit,
TiogaLooks,
TiogaLooksSupport,
TiogaNode,
TiogaNodeOps,
TiogaOps,
TreeFind;
TiogaOpsImpl: CEDAR MONITOR
IMPORTS EditSpan,
NodeAddrs,
NameSymbolTable,
NodeStyle,
Rope,
TiogaInput,
TiogaInputOps,
TiogaLocks,
TiogaMesaOps,
TiogaOps,
TiogaSelection,
TextEdit,
TiogaLooks,
TiogaNodeOps,
TiogaOps
EXPORTS TiogaOpsDefs, TiogaOps, TiogaExtraOps =
BEGIN OPEN TiogaOps, TiogaExtraOps, TiogaOpsDefs;
Ref: TYPE = REF NodeBody; -- points to a Tioga node
NodeBody: PUBLIC TYPE = TiogaNode.Node;
RefBranchNode: TYPE = REF BranchNodeBody;
BranchNodeBody: TYPE = TiogaNode.Node.branch;
Document Locks
CallWithLocks:
PUBLIC
PROC [proc:
PROC [root: Ref], root: Ref ←
NIL] = {
lockedSel, lockedDoc: BOOL ← FALSE;
Cleanup: PROC = { IF lockedSel THEN UnlockSel; IF lockedDoc THEN Unlock[root] };
{
ENABLE
UNWIND => Cleanup;
LockSel; lockedSel ← TRUE;
IF root=
NIL
AND (root ← SelectionRoot[])=
NIL
THEN {
Cleanup; ERROR NoSelection };
Lock[root]; lockedDoc ← TRUE;
proc[root] };
Cleanup };
NoSelection: PUBLIC ERROR = CODE; -- raised by CallWithLocks when there is no selection
Lock:
PUBLIC
PROC [root: Ref] = {
[] ← TiogaLocks.Lock[root, "TiogaOpsClient"] };
Unlock: PUBLIC PROC [root: Ref] = { TiogaLocks.Unlock[root] };
GetSelectionId:
PROC [which: WhichSelection]
RETURNS [TiogaDocument.SelectionId] = {
RETURN [
SELECT which
FROM
primary => primary,
secondary => secondary,
feedback => feedback,
ENDCASE => ERROR ] };
LockSel:
PUBLIC
PROC [which: WhichSelection ← primary] = {
TiogaSelection.LockSel[GetSelectionId[which], "TiogaOpsClient"] };
UnlockSel:
PUBLIC
PROC [which: WhichSelection ← primary] = {
TiogaSelection.UnlockSel[GetSelectionId[which]] };
Selections
DocGran:
PROC [granularity: SelectionGrain]
RETURNS [TiogaDocument.SelectionGrain] = {
RETURN [
SELECT granularity
FROM
point => point, char => char, word => word, node => node, branch => branch,
ENDCASE => ERROR] };
MyGran:
PROC [granularity: TiogaDocument.SelectionGrain]
RETURNS [SelectionGrain] = {
RETURN [
SELECT granularity
FROM
point => point, char => char, word => word, node => node, branch => branch,
ENDCASE => ERROR] };
DocLoc:
PROC [loc: Location]
RETURNS [TiogaNode.Location] =
INLINE {
RETURN [[loc.node, loc.where]] };
MyLoc:
PROC [loc: TiogaNode.Location]
RETURNS [Location] =
INLINE {
RETURN [[loc.node, loc.where]] };
GetSelection:
PUBLIC
PROC [which: WhichSelection ← primary]
RETURNS [
viewer: Viewer,
start, end: Location,
level: SelectionGrain,
caretBefore: BOOL,
pendingDelete: BOOL] = {
sel: TiogaDocument.Selection =
SELECT which
FROM
primary => TiogaSelection.pSel,
secondary => TiogaSelection.sSel,
feedback => TiogaSelection.fSel,
ENDCASE => ERROR;
RETURN [sel.viewer, MyLoc[sel.start.pos], MyLoc[sel.end.pos], MyGran[sel.granularity],
sel.insertion=before, sel.pendingDelete] };
SelectionRoot:
PUBLIC
PROC [which: WhichSelection ← primary]
RETURNS [root: Ref] = {
RETURN [TiogaNodeOps.NarrowToTextNode[
TiogaSelection.SelectionRoot[
SELECT which
FROM
primary => TiogaSelection.pSel,
secondary => TiogaSelection.sSel,
feedback => TiogaSelection.fSel,
ENDCASE => ERROR]]] };
SelectionError: PUBLIC ERROR [ec: SelectionErrorCode] = CODE;
CheckSelection:
PROC [sel: TiogaDocument.Selection] = {
root, first, last: TiogaNode.Ref;
t1, t2: TiogaNode.RefTextNode;
tdd: TiogaDocument.TiogaDocumentData;
IF sel.viewer=
NIL
OR sel.viewer.destroyed
OR (tdd ←
NARROW[sel.viewer.data])=
NIL
OR (root ← tdd.text)=
NIL
THEN ERROR SelectionError[IllegalViewer];
IF (first ← sel.start.pos.node)=
NIL
OR (last ← sel.end.pos.node)=
NIL
THEN ERROR SelectionError[IllegalNode];
IF TiogaNodeOps.Root[first] # root THEN ERROR SelectionError[WrongDoc];
IF first # last
THEN
-- make sure nodes in same tree and right order
IF EditSpan.CompareNodeOrder[first,last] # before
THEN ERROR SelectionError[WrongOrder];
IF sel.start.pos.where # TiogaNode.NodeItself
THEN
-- make sure start index is ok
IF (t1 ← TiogaNodeOps.NarrowToTextNode[first])=
NIL
OR
sel.start.pos.where
NOT
IN [0..TextEdit.Size[t1]]
THEN ERROR SelectionError[BadStartOffset];
IF sel.end.pos.where # TiogaNode.NodeItself
THEN
-- make sure end index is ok
IF (t2 ← TiogaNodeOps.NarrowToTextNode[last])=
NIL
OR
sel.end.pos.where
NOT
IN [0..TextEdit.Size[t2]]
THEN ERROR SelectionError[BadEndOffset];
IF t1 #
NIL
AND t1 = t2
THEN
-- make sure start is not after end
IF sel.start.pos.where > sel.end.pos.where
THEN ERROR SelectionError[BadEndOffset];
};
SetSelection:
PUBLIC
PROC [
viewer: Viewer,
start, end: Location,
level: SelectionGrain ← char,
caretBefore: BOOL ← TRUE,
pendingDelete: BOOL ← FALSE,
which: WhichSelection ← primary] = {
ENABLE UNWIND => NULL;
tempSel: TiogaDocument.Selection ← TiogaSelection.Alloc[];
tempSel^ ←
SELECT which
FROM
primary => TiogaSelection.pSel^,
secondary => TiogaSelection.sSel^,
feedback => TiogaSelection.fSel^,
ENDCASE => ERROR;
tempSel.viewer ← viewer;
tempSel.data ← NARROW[viewer.data];
tempSel.start.pos ← DocLoc[start];
tempSel.end.pos ← DocLoc[end];
tempSel.granularity ← DocGran[level];
tempSel.insertion ← IF caretBefore OR tempSel.granularity=point THEN before ELSE after;
tempSel.pendingDelete ← pendingDelete;
CheckSelection[tempSel];
TiogaSelection.MakeSelection[tempSel,
SELECT which
FROM
primary => primary,
secondary => secondary,
feedback => feedback,
ENDCASE => ERROR];
TiogaSelection.Free[tempSel] };
SelectNodes:
PUBLIC
PROC [
viewer: Viewer,
start, end: Ref,
level: SelectionGrain ← node,
caretBefore: BOOL ← TRUE,
pendingDelete: BOOL ← FALSE,
which: WhichSelection ← primary] = {
SetSelection[viewer, [start,0], [end,
MAX[Rope.Size[GetRope[end]],1]-1],
level, caretBefore, pendingDelete, which] };
SelectBranches:
PUBLIC
PROC [
viewer: Viewer,
start, end: Ref,
level: SelectionGrain ← node,
caretBefore: BOOL ← TRUE,
pendingDelete: BOOL ← FALSE,
which: WhichSelection ← primary] = {
SelectNodes[viewer, start, LastWithin[end],
level, caretBefore, pendingDelete, which] };
SelectDocument:
PUBLIC
PROC [
viewer: Viewer,
level: SelectionGrain ← node,
caretBefore: BOOL ← TRUE,
pendingDelete: BOOL ← FALSE,
which: WhichSelection ← primary] = {
tdd: TiogaDocument.TiogaDocumentData ← NARROW[viewer.data];
root: Ref ← ViewerDoc[viewer];
SelectBranches[viewer, FirstChild[root], LastChild[root],
level, caretBefore, pendingDelete, which] };
CancelSelection:
PUBLIC
PROC [which: WhichSelection ← primary] = {
TiogaSelection.Deselect[GetSelectionId[which]] };
SaveSelA: PUBLIC PROC = { [] ← TiogaInput.SaveSelectionA[] };
RestoreSelA: PUBLIC PROC = { [] ← TiogaInput.RestoreSelectionA[] };
SaveSelB: PUBLIC PROC = { [] ← TiogaInput.SaveSelectionB[] };
RestoreSelB: PUBLIC PROC = { [] ← TiogaInput.RestoreSelectionB[] };
GrowSelection: PUBLIC PROC = { TiogaSelection.GrowSelection[] };
GrowSelectionToBlanks: PUBLIC PROC = { TiogaSelection.GrowSelectionToBlanks[] };
GrowSelectionToSomething:
PUBLIC
PROC [left, right:
PROC [
CHAR]
RETURNS [BOOLEAN]] = { TiogaSelection.GrowSelectionToSomething[left, right] };
Find
SearchWhere:
PROC [whichDir: SearchDir]
RETURNS [TiogaSelection.FindWhere] =
INLINE {
RETURN [
SELECT whichDir
FROM
forwards => forwards,
backwards => backwards,
anywhere => anywhere,
ENDCASE => ERROR] };
FindText:
PUBLIC
PROC [viewer: Viewer, rope:
ROPE ←
NIL, whichDir: SearchDir ← forwards
,
which: WhichSelection ← primary,
case: BOOL ← TRUE -- case => case of characters is significant -- ]
RETURNS [found: BOOL] = {
IF rope=NIL THEN rope ← TiogaOps.GetSelContents[];
RETURN [TiogaSelection.DoFind[
viewer: viewer, rope: rope, id: GetSelectionId[which],
case: case, findWhere: SearchWhere[whichDir]]] };
FindWord:
PUBLIC
PROC [viewer: Viewer, rope:
ROPE ←
NIL, whichDir: SearchDir ← forwards
,
which: WhichSelection ← primary,
case: BOOL ← TRUE -- case => case of characters is significant -- ]
RETURNS [found: BOOL] = {
IF rope=NIL THEN rope ← TiogaOps.GetSelContents[];
RETURN [TiogaSelection.DoFind[viewer: viewer,
rope: rope, case: case, id: GetSelectionId[which],
findWhere: SearchWhere[whichDir], word: TRUE]] };
FindDef:
PUBLIC
PROC [viewer: Viewer, rope:
ROPE ←
NIL, whichDir: SearchDir ← forwards
,
which: WhichSelection ← primary,
case: BOOL ← TRUE -- case => case of characters is significant -- ]
RETURNS [found: BOOL] = {
IF rope=NIL THEN rope ← TiogaOps.GetSelContents[];
RETURN [TiogaSelection.DoFind[viewer: viewer,
rope: rope, case: case, id: GetSelectionId[which],
findWhere: SearchWhere[whichDir], word: TRUE, def: TRUE]] };
Location procedures
LocRelative:
PUBLIC PROC [
location: Location, count: Offset, break: NAT ← 1, skipCommentNodes: BOOL ← FALSE]
RETURNS [Location] = {
RETURN [
MyLoc[TiogaNodeOps.LocRelative[DocLoc[location], count, break, skipCommentNodes]]] };
LocOffset:
PUBLIC PROC [loc1, loc2: Location,
break:
NAT ← 1, skipCommentNodes:
BOOL ←
FALSE]
RETURNS [count: Offset] = {
count ← TiogaNodeOps.LocOffset[DocLoc[loc1], DocLoc[loc2], break, skipCommentNodes !
TiogaNodeOps.BadArgs => ERROR BadArgs] };
BadArgs: PUBLIC ERROR=CODE;
Caret (for primary selection)
GetCaret: PUBLIC PROC RETURNS [loc: Location] = { RETURN [MyLoc[TiogaOps.CaretLoc[]]] };
CaretBefore: PUBLIC PROC = { TiogaSelection.CaretBeforeSelection[] };
CaretAfter: PUBLIC PROC = { TiogaSelection.CaretAfterSelection[] };
CaretOnly: PUBLIC PROC = { [] ← TiogaInput.MakePointSelection[] };
GoToNextCharacter: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToNextChar[n] };
GoToNextWord: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToNextWord[n] };
GoToNextNode: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToNextNode[n] };
GoToPreviousCharacter: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToPreviousChar[n] };
GoToPreviousWord: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToPreviousWord[n] };
GoToPreviousNode: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.GoToPreviousNode[n] };
Edits requiring secondary selections
ToPrimary: PUBLIC PROC = { TiogaInputOps.Copy[primary] };
ToSecondary: PUBLIC PROC = { TiogaInputOps.Copy[secondary] };
Transpose: PUBLIC PROC = { TiogaInputOps.Transpose[] };
Editing applying to primary selection
InsertRope: PUBLIC PROC [rope: ROPE] = { TiogaInputOps.InsertRope[rope] };
InsertChar: PUBLIC PROC [char: CHAR] = { TiogaInputOps.InsertChar[char] };
InsertLineBreak: PUBLIC PROC = { TiogaInputOps.InsertLineBreak[] };
BackSpace: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.BackSpace[n] };
BackWord: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.BackWord[n] };
DeleteNextCharacter: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.DeleteNextChar[n] };
DeleteNextWord: PUBLIC PROC [n: INT ← 1] = { TiogaInputOps.DeleteNextWord[n] };
InsertTime: PUBLIC PROC = { TiogaInputOps.InsertTime[] };
InsertBrackets:
PUBLIC
PROC [left, right:
CHAR] = {
TiogaInputOps.InsertBrackets[left, right] };
MakeControlCharacter: PUBLIC PROC = { TiogaInputOps.MakeControlCharacter[] };
UnMakeControlCharacter: PUBLIC PROC = { TiogaInputOps.UnMakeControlCharacter[] };
MakeOctalCharacter: PUBLIC PROC = { TiogaInputOps.MakeOctalCharacter[] };
UnMakeOctalCharacter: PUBLIC PROC = { TiogaInputOps.UnMakeOctalCharacter[] };
ExpandAbbreviation: PUBLIC PROC = { TiogaInputOps.ExpandAbbreviation[] };
Delete: PUBLIC PROC = { TiogaInputOps.Delete[] };
Paste: PUBLIC PROC = { TiogaInputOps.Paste[] };
SaveForPaste: PUBLIC PROC = { TiogaInputOps.SaveForPaste[] };
SaveSpanForPaste:
PUBLIC
PROC [startLoc, endLoc: Location, grain: SelectionGrain ← char] = {
TiogaInputOps.SaveSpanForPaste[DocLoc[startLoc], DocLoc[endLoc], DocGran[grain]] };
AllLower: PUBLIC PROC = { TiogaInputOps.Capitalise[allLower] };
AllCaps: PUBLIC PROC = { TiogaInputOps.Capitalise[allCaps] };
InitialCaps: PUBLIC PROC = { TiogaInputOps.Capitalise[initCaps] };
FirstCap: PUBLIC PROC = { TiogaInputOps.Capitalise[firstCap] };
MesaFormatting: PUBLIC PROC = { [] ← TiogaMesaOps.SetMesaLooksOp[] };
Repeat: PUBLIC PROC = { [] ← TiogaInput.Repeat[] };
Undo: PUBLIC PROC = { [] ← TiogaInput.Cancel[] };
Node Editing
Break: PUBLIC PROC = { TiogaInputOps.Break[] };
Join: PUBLIC PROC = { TiogaInputOps.Join[] };
Nest: PUBLIC PROC = { TiogaInputOps.Nest[] };
UnNest: PUBLIC PROC = { TiogaInputOps.UnNest[] };
Looks
SetSelectionLooks:
PUBLIC
PROC [which: WhichSelection ← primary] = {
sets the selection looks from the looks of the character next to the caret
TiogaSelection.SetSelLooks[
SELECT which
FROM
primary => TiogaSelection.pSel,
secondary => TiogaSelection.sSel,
feedback => TiogaSelection.fSel,
ENDCASE => ERROR] };
FetchLooks:
PUBLIC
PROC [node: Ref, index: Offset]
RETURNS [
ROPE] = {
RETURN [TiogaLooks.LooksToRope[TextEdit.FetchLooks[TiogaNodeOps.NarrowToTextNode[node],index]]] };
SetLooks:
PUBLIC
PROC [looks:
ROPE, which: WhichLooks ← selection] = {
lks: TiogaLooks.Looks = TiogaLooks.RopeToLooks[looks];
IF which=selection
THEN
TiogaInputOps.ChangeLooks[add: lks, remove: TiogaLooks.allLooks]
ELSE TiogaInputOps.ChangeCaretLooks[add: lks, remove: TiogaLooks.allLooks] };
AddLooks:
PUBLIC
PROC [looks:
ROPE, which: WhichLooks ← selection] = {
lks: TiogaLooks.Looks = TiogaLooks.RopeToLooks[looks];
IF which=selection
THEN
TiogaInputOps.ChangeLooks[add: lks, remove: TiogaLooks.noLooks]
ELSE TiogaInputOps.ChangeCaretLooks[add: lks, remove: TiogaLooks.noLooks] };
SubtractLooks:
PUBLIC
PROC [looks:
ROPE, which: WhichLooks ← selection] = {
lks: TiogaLooks.Looks = TiogaLooks.RopeToLooks[looks];
IF which=selection
THEN
TiogaInputOps.ChangeLooks[add: TiogaLooks.noLooks, remove: lks]
ELSE TiogaInputOps.ChangeCaretLooks[add: TiogaLooks.noLooks, remove: lks] };
ClearLooks:
PUBLIC
PROC [which: WhichLooks ← selection] = {
IF which=selection
THEN
TiogaInputOps.ChangeLooks[add: TiogaLooks.noLooks, remove: TiogaLooks.allLooks]
ELSE
TiogaInputOps.ChangeCaretLooks[add: TiogaLooks.noLooks, remove: TiogaLooks.allLooks] };
CopyLooks: PUBLIC PROC = { TiogaInputOps.CopyLooks[] };
Formats
GetFormat:
PUBLIC
PROC [node: Ref]
RETURNS [
ROPE] = {
name: NameSymbolTable.Name = node.typename;
RETURN [
IF name=NameSymbolTable.nullName
THEN "default"
ELSE
NameSymbolTable.RopeFromName[name]] };
ForEachNode:
PROC [which: WhichNodes, proc:
PROC [TiogaNode.Ref]] = {
pSel: TiogaDocument.Selection = TiogaSelection.pSel;
SELECT which
FROM
root => proc[TiogaNodeOps.Root[pSel.start.pos.node]];
selection =>
FOR node: TiogaNode.Ref ← pSel.start.pos.node, TiogaNodeOps.StepForward[node]
DO
proc[node];
IF node = pSel.end.pos.node THEN EXIT;
ENDLOOP;
ENDCASE => ERROR };
SetFormat:
PUBLIC
PROC [format:
ROPE, which: WhichNodes ← selection] = {
Set: PROC [ref: TiogaNode.Ref] = { TiogaInputOps.SetFormatName[format, ref] };
ForEachNode[which, Set] };
SetNodeFormat:
PUBLIC
PROC [format:
ROPE, node: Ref] =
TRUSTED {
root: TiogaNode.RefBranchNode;
type: TiogaNode.Name ←
IF format=
NIL
THEN TiogaNode.nullName
ELSE NameSymbolTable.MakeName[LOOPHOLE[Rope.Flatten[format]]];
root ← TiogaNode.Root[node];
[] ← TiogaLocks.Lock[root, "TiogaOpsSetNodeFormat"];
TextEdit.ChangeType[node, type, NIL, root];
TiogaLocks.Unlock[root] };
SetNodeStyle:
PUBLIC
PROC [style:
ROPE, node: Ref] = {
root: TiogaNode.RefBranchNode ← TiogaNode.Root[node];
[] ← TiogaLocks.Lock[root, "TiogaOpsSetNodeStyle"];
TextEdit.ChangeStyle[node, style, NIL, root];
TiogaLocks.Unlock[root] };
CaretNodeFormat: PUBLIC PROC = { TiogaInputOps.SetFormat[] };
InsertFormat: PUBLIC PROC = { TiogaInputOps.GetFormat[] };
CopyFormat: PUBLIC PROC = { TiogaInputOps.CopyFormat[] };
Styles
GetStyle:
PUBLIC
PROC [node: Ref]
RETURNS [
ROPE] = {
name: NameSymbolTable.Name = NodeStyle.StyleNameForNode[node];
RETURN [
IF name=NameSymbolTable.nullName
THEN "default"
ELSE
NameSymbolTable.RopeFromName[name]] };
SetStyle:
PUBLIC
PROC [style:
ROPE, which: WhichNodes ← selection] = {
Set: PROC [ref: TiogaNode.Ref] = { TiogaInputOps.SetStyleName[style, ref] };
ForEachNode[which, Set] };
Comment Property
IsComment:
PUBLIC
PROC [node: Ref]
RETURNS [
BOOL] = {
txt: TiogaNode.RefTextNode = TiogaNodeOps.NarrowToTextNode[node];
RETURN [txt # NIL AND txt.comment] };
SetComment: PUBLIC PROC = { TiogaInputOps.SetCommentProp[TRUE] };
SetNotComment: PUBLIC PROC = { TiogaInputOps.SetCommentProp[FALSE] };
Node Property Lists
SetProp:
PUBLIC
PROC [name:
ROPE, value:
REF, which: WhichNodes ← selection] = {
Put:
PROC [node: TiogaNode.Ref] = {
TextEdit.PutProp[node, name, value, TiogaInput.CurrentEvent[]] };
ForEachNode[which, Put] };
Miscellaneous call-back procedures
RegisterAbbrevFailedProc:
PUBLIC PROC [proc:
PROC
RETURNS [
BOOL]] = {
TiogaInputOps.RegisterAbbrevFailedProc[proc] };
RegisterFileNameProc:
PUBLIC PROC [
proc:
PROC [
ROPE, Viewer]
RETURNS [fileName:
ROPE, search:
ROPE]] = {
TiogaOps.RegisterFileNameProc[proc] };
Text keys: persistent "addresses" for characters in text nodes
PutTextKey:
PUBLIC PROC [node: Ref, where: Offset, key:
REF] = {
Associates the key with the given offset in the text node. Key moves with the text as edits take place in the node. Key doesn't move to new node. May use same key with different nodes without interference.
NodeAddrs.PutTextAddr[TiogaNodeOps.NarrowToTextNode[node], key, where] };
GetTextKey:
PUBLIC PROC [node: Ref, key:
REF]
RETURNS [loc: Location] = {
Tells you where the key is in the node at the current time.
where: Offset;
n: TiogaNode.RefTextNode;
[n, where] ← NodeAddrs.GetTextAddr[TiogaNodeOps.NarrowToTextNode[node], key !
NodeAddrs.TextAddrNotFound => GOTO Error];
RETURN [[n, where]];
EXITS Error => ERROR TextKeyNotFound };
TextKeyNotFound: PUBLIC ERROR = CODE;
RemoveTextKey:
PUBLIC PROC [node: Ref, key:
REF] = {
NodeAddrs.RemTextAddr[TiogaNodeOps.NarrowToTextNode[node], key] };
MapTextKeys:
PUBLIC PROC [
node: Ref,
proc: PROC [key: REF, where: Offset] RETURNS [BOOLEAN]]
RETURNS [BOOLEAN] = {
Do:
PROC [addr:
REF, location: Offset]
RETURNS [
BOOLEAN] = {
RETURN [proc[addr, location]] };
RETURN [NodeAddrs.MapTextAddrs[TiogaNodeOps.NarrowToTextNode[node], Do]] };
END.