revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / developer / debug / test / misc / aslhook.c
blob69dc1e7bf1b1041356a68c5fae3395d72642db17
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*
7 Test for FRF_INTUIFUNC. Activating of the window "ASL hook" triggers
8 the callback function. Note that the function used for ASL_HookFunc isn't
9 a Hook function. It's a function whose arguments are given on the stack.
12 #include <exec/types.h>
13 #include <intuition/intuition.h>
14 #include <dos/dosasl.h>
15 #include <libraries/asl.h>
17 #include <proto/exec.h>
18 #include <proto/dos.h>
19 #include <proto/asl.h>
20 #include <proto/intuition.h>
21 #include <proto/intuition.h>
23 #include <stdio.h>
25 static struct Window *window;
27 static IPTR func(ULONG mask, APTR object, struct FileRequester *fr)
29 struct IntuiMessage *msg;
30 printf("hookfunc mask %u object %p filerequester %p\n", (unsigned int)mask, object, fr);
31 switch (mask)
33 case FRF_INTUIFUNC:
34 msg = (struct IntuiMessage *)object;
35 printf("intuimsg msg %p, class %u code %d\n", msg, (unsigned int)msg->Class, msg->Code);
36 return (IPTR)object;
37 break;
38 case FRF_FILTERFUNC:
39 printf("filterfunc: %s\n", ((struct AnchorPath *)object)->ap_Info.fib_FileName);
40 return 0;
41 break;
43 return 0;
46 int main(void)
48 struct FileRequester *fr;
50 if (window = OpenWindowTags(NULL,
51 WA_Title, "ASL hook",
52 WA_Width, 300,
53 WA_Height, 200,
54 WA_IDCMP, IDCMP_ACTIVEWINDOW,
55 WA_Flags, WFLG_DEPTHGADGET,
56 TAG_END))
58 if (fr = AllocFileRequest())
60 if (AslRequestTags(fr,
61 ASL_Dir, "RAM:",
62 ASL_Window, window,
63 ASL_Hail, "Test",
64 ASL_HookFunc, func,
65 ASLFR_Flags1, FRF_FILTERFUNC | FRF_INTUIFUNC,
66 TAG_END))
68 printf("path %s file %s\n", fr->rf_Dir, fr->rf_File);
70 FreeFileRequest(fr);
72 CloseWindow(window);
74 return 0;