r6831@lvps87-230-33-50: verhaegs | 2008-02-03 14:08:57 +0100
[tangerine.git] / compiler / clib / __exitfunc.c
blob56d49be36dbe3704215bcb7db085dcfe80f00227
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "__arosc_privdata.h"
8 #include <aros/symbolsets.h>
9 #include <aros/startup.h>
10 #include <exec/lists.h>
11 #include "__exitfunc.h"
13 int __addexitfunc(struct AtExitNode *aen)
15 ADDHEAD((struct List *)&__atexit_list, (struct Node *)aen);
17 return 0;
20 int __init_atexit(void)
22 NEWLIST((struct List *)&__atexit_list);
24 return 1;
27 void __exit_atexit(void)
30 struct AtExitNode *aen;
32 while ((aen = (struct AtExitNode *) REMHEAD(
33 (struct List *) &__atexit_list)))
35 switch (aen->node.ln_Type)
37 case AEN_VOID:
38 aen->func.fvoid();
39 break;
41 case AEN_PTR:
42 aen->func.fptr(__aros_startup_error, aen->ptr);
43 break;
49 ADD2INIT(__init_atexit, 100);
50 ADD2EXIT(__exit_atexit, 100);