Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors


Manual Reference Pages  - func_rtn (5)

NAME

func/rtn - Return from a program function

CONTENTS

Synopsis
Description
Error Handling
See Also
Author

SYNOPSIS

func/rtn
func/rtn value

DESCRIPTION

Returns program execution to the command following the func/call, or func/bcall, that called this function, optionally returning a value.

If value is supplied and the function was declared to have a return value with func/def, then the value will be encoded as if attr/def had been called. The resulting encoded value will be made available to the caller through the register provided to the func/call or func/bcall instruction as type PSUNIT_TYPE_XVALUE.

If the supplied value is already of type PSUNIT_TYPE_XVALUE and the encoded attribute is the same type, or uses the same syntax, as the function return type, then it will be returned unmodified. Otherwise it will be re-encoded to the correct type via a byte string representation, and the new encoding will be returned.

The stack will be flushed back to an internal lock marker (PSUNIT_TYPE_INTLOCKF) that was set when the function was called. This guarantees that the stack will be returned to the caller in the same state as prior to the function call.

If this is the first function in the stack, func/rtn will terminate thread execution.

ERROR HANDLING

A runtime error is generated if an argument is of the wrong type, if a return value is supplied but the function was not declared to return one, or if no return value is supplied when the function was declared to return one. If the function that is returning has defined an error trap with the error/jmp instruction, an error triggered during the processing of arguments will call that error handler.

SEE ALSO

pal_commands(5), pal_stack(5), func_def(5), func_call(5), func_bcall(5), attr_def(5),
PROSE Assembly Language at prose.sourceforge.net.

AUTHOR

Copyright (c) 2002-2010 Mark R. Bannister <cambridge@users.sourceforge.net>.

This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


PAL 1.0 func_rtn (5) 28 October 2010
Generated by manServer 1.07 from man5/func_rtn.5 using man macros.