XRETURN

Return control to a calling routine

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
XRETURN [return_value]

Arguments

return_value

(optional) A ^VAL value to be returned to the caller. In an external subroutine, this value can be retrieved using XSTAT. It can also be retrieved by declaring the subroutine as a ^VAL function and returning return_value as the function return value. A C routine can also retrieve the return value from XRETURN. (n) (traditional Synergy only)

Discussion

The XRETURN statement returns control to the calling routine from an external subroutine. Any internal CALLs in the subroutine are disregarded; in other words, you don’t have to RETURN from them before XRETURNing to the calling routine.

XRETURN cannot be used in a main routine or a function. If the compiler encounters an ­XRETURN statement outside of a subroutine, it generates an error.

See also

Examples

The following example shows an external subroutine that uses XRETURN.

subroutine choice
    a_data              ,a
external function 
    decide              ,d
proc
    repeat
      begin
        case %decide(a_data) of
          begincase
            writes(TTCHN, "processing result #1")
            writes(TTCHN, "processing result #2")
            writes(TTCHN, "processing result #3")
          endcase
        else
          writes(TTCHN, "... invalid result")
      end
    xreturn
endsubroutine