grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / iffparse / iffparse_init.c
blob149512ae22bbab0d4cddea28b8c2a2ea415c2cd6
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 IFFParse initialization code.
6 */
8 #include <exec/types.h>
9 #include <proto/exec.h>
10 #include <aros/symbolsets.h>
11 #include <utility/utility.h>
13 #ifdef __MORPHOS__
14 /* For HookEntry */
15 #include <intuition/classusr.h>
16 #define CLIB_ALIB_PROTOS_H
17 #endif
19 #include "iffparse_intern.h"
20 #include <aros/debug.h>
21 #include LC_LIBDEFS_FILE
23 #include <proto/alib.h>
25 #ifdef __MORPHOS__
26 ULONG HookEntry(void)
28 struct Hook *h=(struct Hook *)REG_A0;
29 Msg msg=(Msg) REG_A1;
30 Object *obj=(Object*) REG_A2;
32 return ((ULONG(*)(APTR,APTR,APTR))h->h_SubEntry)(h,obj,msg);
35 static struct EmulLibEntry HookEntry_Gate=
37 TRAP_LIB, 0, (void (*)(void))HookEntry
40 #define EasyHook(hook, func) \
41 IFFParseBase->hook.h_Entry = (IPTR (*)())&HookEntry_Gate;\
42 IFFParseBase->hook.h_SubEntry = (IPTR(*)())func;\
43 IFFParseBase->hook.h_Data = IFFParseBase
44 #else
45 #define EasyHook(hook, func) \
46 IFFParseBase->hook.h_Entry = HookEntry; \
47 IFFParseBase->hook.h_SubEntry = (IPTR(*)())func; \
48 IFFParseBase->hook.h_Data = IFFParseBase
49 #endif
51 static int Init(LIBBASETYPEPTR LIBBASE)
53 /* This function is single-threaded by exec by calling Forbid. */
55 EasyHook(stophook, StopFunc );
56 EasyHook(prophook, PropFunc );
57 EasyHook(collectionhook, CollectionFunc );
58 EasyHook(doshook, DOSStreamHandler );
59 EasyHook(cliphook, ClipStreamHandler );
60 EasyHook(bufhook, BufStreamHandler );
61 EasyHook(collectionpurgehook, CollectionPurgeFunc);
62 EasyHook(proppurgehook, PropPurgeFunc );
63 EasyHook(exitcontexthook, ExitContextFunc );
65 return TRUE;
68 ADD2INITLIB(Init, 0);