The above mentioned tred.def file provides a set of pre-defined TrEd macros. Pre-defined macros may be freely used in all other user-defined macros and are guaranteed to be updated and shipped with every version of TrEd preserving their own API. Most of the pre-defined macros wrap the key TrEd's internal function calls. The following table briefly describes each of them.
Table 5. TrEd's pre-defined macros.
Macro name | Description |
---|---|
Redraw | Force TrEd to redraw the current tree immediately. Hence TrEd redraws the tree right after an interactively invoked macro finishes. The Redraw macro is needed only under certain circumstances. |
SetDisplayAttrs(patterns) | Use the given list of TrEd's patterns for displaying attributes. See also Section 5. |
SetBalloonPattern(pattern) | Use the given pattern as a new hint pattern. See also Section 5. |
SwitchContext(context_name) | Switch to a different macro context. See Section 9.9 for more details about contexts. |
CurrentContext | Return the name of the current macro context. See Section 9.9 for more details about contexts. |
GotoTree(n) | Display the n'th tree in the current file. |
NextTree | Display the next tree in the current file. |
PrevTree | Display the previous tree in the current file. |
GetOrd(node) | Return value of the special numbering FS
attribute. This macro actually returns the same value
as
$node->{ $grp->{FSFile}->FS->order } |
CutNode(node) | Cut the node's subtree off the tree and return it. |
PasteNode(node,parent) | Paste the subtree of the node given by the node argument under the node given in the parent argument. TrEd tries to place the top node of the pasted subtree between the present children of parent according to values of the special FS numbering attribute. |
NewTree | Create a new tree before the current tree. The new tree consists of exactly one node. This node is activated and a reference to its FSNode object is returned. |
NewTreeAfter | Create a new tree after the current tree. The new tree consists of exactly one node. This node is activated and a reference to its FSNode object is returned. |
Save | Save the current file. |
SaveAndNextFile | Save the current file and open the next file in the current file-list. |
SaveAndPrevFile | Save the current file and open the previous file in the current file-list. |
Find | Open the Find Node by Attributes GUI dialog. See Find... menu command for more detail. |
FindNext | Searches for the first node matching the criteria of the previous use of the Find... menu command or FindNode macro usage. |
FindPrev | Searches for the previous node matching the criteria of the previous use of the Find... menu command or FindNode macro usage. |
PlainNewSon(parent) | Add a new child node to the given parent and make it the current node (by setting $this to point to it). |
PlainDeleteNode(node) | Delete the given node. The node must be a leaf of the tree (may not have any children) and must have a parent (may not be the root of the tree). |
NewRBrother(node) | Create a new brother of the given node and recalculate the special FS numbering attribute values in the whole tree so that the new node is the first right sibling of the given node. If no node is given, this function operates on $this and resets $this to the newly created node. If some node is given the value of $this is preserved. |
NewLBrother(node) | Create a new brother of the given node and recalculate the special FS numbering attribute values in the whole tree so that the new node is the first left sibling of the given node. If no node is given, this function operates on $this and resets $this to the newly created node. If some node is given the value of $this is preserved. |
NewSon(parent) | Create a new child of the given parent node and recalculate the special FS numbering attribute values in the whole tree so that the new node is the first node left to the given parent. If no parent node is given, this function operates on $this and resets $this to the newly created node. If a parent node is given the value of $this is preserved. |
DeleteThisNode | Delete the current node and recalculate the special FS numbering attribute values in the whole tree so that there is no gap in the numbering. If the current node is not a leaf or if it is the root of the current tree, this macro does nothing. |
CopyValues | Copy the values of all the attributes except the special FS numbering attribute of the current node to a global hash variable named %ValuesClipboard. |
PasteValues | Replace the values of the current node's attributes by those stored in the global hash variable named %ValuesClipboard. |
NextNode(node,top) |
Return the first displayed node following the given
node
in the subtree of top.
This function behaves in the same manner as the
node->following(top)method, except it works only on the nodes which are actually visible according to the state of the View->Show Hidden Nodes menu item. |
PrevNode(node,top) |
Return the first displayed node preceding the given
node
in the subtree of top.
This function behaves in the same manner as the
node->previous(top)method, except it works only on the nodes which are actually visible according to the state of the View->Show Hidden Nodes menu item. |
NextVisibleNode(node,top) |
Return the first visible node following the given
node
in the subtree of top.
This function behaves in the same manner as the
node->following(top)method, except that nodes of hidden subtrees are skipped. |
PrevVisibleNode(node,top) |
Return the first visible node preceding the given
node
in the subtree of top.
This function behaves in the same manner as the
node->previous(top)method, except that nodes of hidden subtrees are skipped. |
IsHidden(node) | Return true if the given
node
is member of a hidden subtree. This macro is only
an abbreviation for
$grp->{FSFile}->FS->isHidden(node) |
Hide(node) | Hide the given node. Return true if the function is successfull. |
GetNodes(top?) | Return the list of all nodes in the subtree of the given top node (or the whole current tree if no top is given). The list returned is ordered in the natural structure ordering. |
GetVisibleNodes(top?) | Return the list of all visible nodes in the subtree of the given top node (or the whole current tree if no top is given). The list returned is ordered in the natural structure ordering and all members of hidden subtrees are skipped. |
NormalizeOrds(listref) | Adjusts the special FS numbering attribute of every node of the list referenced by the listref argument so that the value for the attribute corresponds to the order of the node in the list. |
SortByOrd(listref) | Sort the list of nodes referenced by the listref argumnt according to the values of the special FS numbering attribute. |
RepasteNode(node) | Cut the given node and paste it immediately on the same parent so that its structural position between its parent children is brought to correspondence with the values of the special FS numbering attribute. |
ShiftNodeRightSkipHidden(node) | Shift the current node in the tree to the right leaping over all hidden subtress by modifying the tree structure and value of the special FS numbering attribute appropriately. |
ShiftNodeLeftSkipHidden | Shift the current node in the tree to the left leaping over all hidden subtress by modifying the tree structure and value of the special FS numbering attribute appropriately. |
ShiftNodeRight | Shift the current node in the tree to the right by modifying the tree structure and value of the special FS numbering attribute appropriately. |
ShiftNodeLeft | Shift the current node in the tree to the right by modifying the tree structure and value of the special FS numbering attribute appropriately. |
AtrNo(n) | Retrun name of the
n'th
attribute defined in the FS file. This macro only
abbreviates the following expression:
$grp->{FSFile}->FS->atno(n) |
ValNo(n,string) | Return the n'th field of the given string where individual fields are separated by “|”. |
Union(string-a,string-b) | Return a string consisting of |-separated fields which form a pairwise disjoint set of the |-separated fields of the given strings string-a and string-b. |
Interjection | Return a string consisting of |-separated fields which form the interjection of the sets of |-separated fields of the given strings string_a and string_b. |
ListSplit(string) | Split the given string of |-separated fields and return a list of the individual fields. |
ListJoin(fields) | Form a string of |-separated fields from the given list of fields. |
ListEq(string_a,string_b) | Compare the sets of |-separated fields of the two given strings. Return true if the sets contain the same elements; return false otherwise. |
ListAssign(string,n,value) | Return the given string of |-separated fields, except that the n'th field in the string is replaced by the given value. |