Next: , Previous: , Up: Top   [Contents][Index]

21 Running location handlers

A location is a chunk of code between the following enter and leave actions:


inside a location we can register a “handler command” that is automatically executed whenever the location is left by calling mbfl_location_leave(). We can nest locations at will. We can run all the handlers registered so far in a stack of locations.

Function: mbfl_location_enter

Enter into a new location. Initialise the internal state.

Function: mbfl_location_leave

Leave the current location. Run all the registered handlers in reverse order.

Function: mbfl_location_handler handler_script

Register a new handler in the current location. It is an error if this function is called outside a location.

Function: mbfl_location_run_all

Run all the handlers unwinding all the locations. This is useful as atexit handler, Running scripts at exit–time.

Function: mbfl_location_enable_cleanup_atexit
Function: mbfl_location_disable_cleanup_atexit

Enable or disable running the location handlers through an atexit handler. The enable operation registers an atexit handler that cleans up the current stack of locations.

Next: , Previous: , Up: Top   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.