File: delete-tree.2gg

package info (click to toggle)
golf 601.4.41-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,824 kB
  • sloc: ansic: 20,020; sh: 1,171; makefile: 292
file content (53 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.TH GOLF 2gg $VERSION $DATE Development Tools
.SH NAME
delete-tree \-  (tree)
.SH PURPOSE
Delete a node from a tree.

.SH SYNTAX

.RS 4
.EX

delete-tree <tree> key <key> \\
    [ status <status> ] \\
    [ value <value> ] \\

.EE
.RE

.SH DESCRIPTION
delete-tree will search <tree> for string <key> and if found, delete its node (including the key in it), set <value> (in "value" clause) to node's value, and set <status> number (in "status" clause) to GG_OKAY. If <key> is not found, <status> will be GG_ERR_EXIST. If <status> is not GG_OKAY, <value> is unchanged.

.SH EXAMPLES
Delete node with key "123", and obtain its value:

.RS 4
.EX

set-string k = "123"
delete-tree mytree key k value val status st
if-true st not-equal GG_OKAY
   @Could not find key <<print-out k>>
   exit-handler
end-if
// display key/value deleted
@Deleted key <<print-out k>> with value <<print-out val>>
// delete the original value
delete-string val

.EE
.RE

.SH SEE ALSO
 Tree

\fBdelete-tree\fP  
\fBget-tree\fP  
\fBnew-tree\fP  
\fBpurge-tree\fP  
\fBread-tree\fP  
\fBuse-cursor\fP  
\fBwrite-tree\fP   
See all 
\fBdocumentation\fP