20.8.1 with_cur_ios

The standard function with_cur_ios provides the following interface:

fun with_cur_ios = (int<32> ios,
                    Pk_With_Ios_Fn do = lambda void:{},
                    int<32> endian = get_endian) void:

Where ios is an IO space identifier, do is a function of type ()void that defaults to a function that does nothing, and endian is the endianness to use by default when accessing ios.

When invoked it switches to the given IO space and executes the given function. Once the function finishes executing, either by returning or by the raise of an exception, the current IO space and endianness are restored to their previous values.