From afcca06ed3221aa0ea486c7f0db628da68cf3e86 Mon Sep 17 00:00:00 2001 From: mazze Date: Sat, 16 Sep 2017 22:52:00 +0000 Subject: [PATCH] Test for asl.library/FRF_INTUIFUNC. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@54928 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- developer/debug/test/misc/aslhook.c | 75 +++++++++++++++++++++++++++++++++ developer/debug/test/misc/mmakefile.src | 1 + 2 files changed, 76 insertions(+) create mode 100644 developer/debug/test/misc/aslhook.c diff --git a/developer/debug/test/misc/aslhook.c b/developer/debug/test/misc/aslhook.c new file mode 100644 index 0000000000..69dc1e7bf1 --- /dev/null +++ b/developer/debug/test/misc/aslhook.c @@ -0,0 +1,75 @@ +/* + Copyright © 1995-2017, The AROS Development Team. All rights reserved. + $Id$ +*/ + +/* + Test for FRF_INTUIFUNC. Activating of the window "ASL hook" triggers + the callback function. Note that the function used for ASL_HookFunc isn't + a Hook function. It's a function whose arguments are given on the stack. +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +static struct Window *window; + +static IPTR func(ULONG mask, APTR object, struct FileRequester *fr) +{ + struct IntuiMessage *msg; + printf("hookfunc mask %u object %p filerequester %p\n", (unsigned int)mask, object, fr); + switch (mask) + { + case FRF_INTUIFUNC: + msg = (struct IntuiMessage *)object; + printf("intuimsg msg %p, class %u code %d\n", msg, (unsigned int)msg->Class, msg->Code); + return (IPTR)object; + break; + case FRF_FILTERFUNC: + printf("filterfunc: %s\n", ((struct AnchorPath *)object)->ap_Info.fib_FileName); + return 0; + break; + } + return 0; +} + +int main(void) +{ + struct FileRequester *fr; + + if (window = OpenWindowTags(NULL, + WA_Title, "ASL hook", + WA_Width, 300, + WA_Height, 200, + WA_IDCMP, IDCMP_ACTIVEWINDOW, + WA_Flags, WFLG_DEPTHGADGET, + TAG_END)) + { + if (fr = AllocFileRequest()) + { + if (AslRequestTags(fr, + ASL_Dir, "RAM:", + ASL_Window, window, + ASL_Hail, "Test", + ASL_HookFunc, func, + ASLFR_Flags1, FRF_FILTERFUNC | FRF_INTUIFUNC, + TAG_END)) + { + printf("path %s file %s\n", fr->rf_Dir, fr->rf_File); + } + FreeFileRequest(fr); + } + CloseWindow(window); + } + return 0; +} diff --git a/developer/debug/test/misc/mmakefile.src b/developer/debug/test/misc/mmakefile.src index b98702726e..599a2c9f01 100644 --- a/developer/debug/test/misc/mmakefile.src +++ b/developer/debug/test/misc/mmakefile.src @@ -4,6 +4,7 @@ include $(SRCDIR)/config/aros.cfg FILES := \ + aslhook \ busyloop \ camdtree \ cctest \ -- 2.11.4.GIT