File: return-handler.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 (67 lines) | stat: -rw-r--r-- 1,849 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.TH GOLF 2gg $VERSION $DATE Development Tools
.SH NAME
return-handler \-  (program-flow)
.SH PURPOSE
Return from current request handler back to its caller.

.SH SYNTAX

.RS 4
.EX

return-handler  [ <return value> ]

.EE
.RE

.SH DESCRIPTION
Returns from current request handler by transferring control back to its caller. If the current request handler is handling an external request (such as from a web browser, API, command line etc.), then return-handler is equivalent to \fBexit-handler\fP. If the current request handler was handling an internal request (i.e. called from another request handler with \fBcall-handler\fP), then control transfers back to that handler immediately after call-handler.

For internal requests, the number <return value> will be passed back to the caller, who can obtain it via "return-value" clause in \fBcall-handler\fP. If <return value> is omitted, then it is assumed to be 0. If current request handler is handling an external request, then <return value> will also set the handler's exit status (see \fBexit-status\fP and \fBexit-handler\fP).

.SH EXAMPLES
In this example, "req-handler" (the caller) will call "other-handler" (the callee), which will return to the caller (immediately after call-handler). Here's the caller:

.RS 4
.EX

begin-handler /req-handler public
    ...
    call-handler "/other-handler" return-value rval
    ...
end-handler

.EE
.RE

The callee handler:

.RS 4
.EX

begin-handler /other-handler public
    ...
    return-handler 5
    ...
end-handler
The value of "rval" in the caller will be 5.

.EE
.RE

.SH SEE ALSO
 Program flow

\fBbreak-loop\fP  
\fBcall-handler\fP  
\fBcode-blocks\fP  
\fBcontinue-loop\fP  
\fBdo-once\fP  
\fBexit-handler\fP  
\fBif-defined\fP  
\fBif-true\fP  
\fBquit-process\fP  
\fBreturn-handler\fP  
\fBstart-loop\fP   
See all 
\fBdocumentation\fP