5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
12 #include <_PDCLIB_io.h>
14 /* TODO - "except that a function is called after any previously registered
15 functions that had already been called at the time it was registered.
18 /* TODO: 32 is guaranteed. This should be dynamic but ATM gives problems
21 #define NUMBER_OF_SLOTS 40
23 void (*_PDCLIB_regstack[ NUMBER_OF_SLOTS ])( void ) = { _PDCLIB_closeall };
24 size_t _PDCLIB_regptr = NUMBER_OF_SLOTS;
26 void exit( int status )
28 while ( _PDCLIB_regptr < NUMBER_OF_SLOTS )
30 _PDCLIB_regstack[ _PDCLIB_regptr++ ]();
38 #include <_PDCLIB_test.h>
42 /* Unwinding of regstack tested in atexit(). */