From 1ea747196ea9f1b01dcb29fedac62372ca0e300b Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 24 Feb 2015 19:51:51 +0000 Subject: Fix more hook functions --- amiga/agclass/amigaguide_class.c | 11 ++++++++--- amiga/context_menu.c | 10 +++++----- amiga/file.c | 7 +++---- amiga/history_local.c | 4 ++-- amiga/tree.c | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/amiga/agclass/amigaguide_class.c b/amiga/agclass/amigaguide_class.c index 556445e1b..2b80223ca 100644 --- a/amiga/agclass/amigaguide_class.c +++ b/amiga/agclass/amigaguide_class.c @@ -7,7 +7,11 @@ #include "amiga/os3support.h" #include "amigaguide_class.h" - +#ifdef __amigaos4__ +#define DISPATCHHOOK(func) static uint32 func(Class *cl, Object *o, Msg msg) +#else +#define DISPATCHHOOK(func) static ASM uint32 func(REG(a0, Class *cl),REG(a2, Object *o), REG(a1, Msg msg)) +#endif struct localObjectData { @@ -24,7 +28,8 @@ struct AmigaGuideIFace *IAmigaGuide = NULL; /* ********************************** function prototypes ************************************ */ -static uint32 dispatchAGClass(Class *, Object *, Msg); +DISPATCHHOOK(dispatchAGClass); + // class methods uint32 om_new(Class *, Object *, struct opSet *); @@ -89,7 +94,7 @@ BOOL freeAGClass(Class *cl) /* ************************************** class dispatcher ************************************ */ -static uint32 dispatchAGClass(Class *cl, Object *o, Msg msg) +DISPATCHHOOK(dispatchAGClass) { switch (msg->MethodID) diff --git a/amiga/context_menu.c b/amiga/context_menu.c index b74affb11..970490e16 100644 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -52,12 +52,12 @@ #include "amiga/context_menu.h" -static uint32 ami_context_menu_hook(struct Hook *hook, Object *item, APTR reserved); +HOOKF(uint32, ami_context_menu_hook, Object *, item, APTR); +HOOKF(uint32, ami_popup_hook, Object *, item, APTR); + static bool ami_context_menu_history(const struct browser_window *bw, int x0, int y0, int x1, int y1, const struct history_entry *entry, void *user_data); -static uint32 ami_popup_hook(struct Hook *hook,Object *item,APTR reserved); - enum { CMID_SELECTFILE, CMID_COPYURL, @@ -695,7 +695,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y) IDoMethod(ctxmenuobj, PM_OPEN, gwin->win); } -static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved) +HOOKF(uint32, ami_context_menu_hook, Object *, item, APTR) { int32 itemid = 0; struct gui_window_2 *gwin = hook->h_Data; @@ -1255,7 +1255,7 @@ static bool ami_context_menu_history(const struct browser_window *bw, return true; } -static uint32 ami_popup_hook(struct Hook *hook,Object *item,APTR reserved) +HOOKF(uint32, ami_popup_hook, Object *, item, APTR) { uint32 itemid = 0; struct gui_window *gwin = hook->h_Data; diff --git a/amiga/file.c b/amiga/file.c index 733c9c780..e7f1fd356 100644 --- a/amiga/file.c +++ b/amiga/file.c @@ -46,8 +46,7 @@ static struct Hook aslhookfunc; -static ULONG ami_file_asl_mime_hook(struct Hook *mh, - struct FileRequester *fr, struct AnchorPathOld *ap) +HOOKF(ULONG, ami_file_asl_mime_hook, struct FileRequester *, fr, struct AnchorPathOld *) { char fname[1024]; BOOL ret = FALSE; @@ -56,10 +55,10 @@ static ULONG ami_file_asl_mime_hook(struct Hook *mh, lwc_error lerror; content_type ct; - if(ap->ap_Info.fib_DirEntryType > 0) return(TRUE); + if(msg->ap_Info.fib_DirEntryType > 0) return(TRUE); strcpy(fname,fr->fr_Drawer); - AddPart(fname,ap->ap_Info.fib_FileName,1024); + AddPart(fname, msg->ap_Info.fib_FileName,1024); mt = strdup(fetch_filetype(fname)); lerror = lwc_intern_string(mt, strlen(mt), &lwc_mt); diff --git a/amiga/history_local.c b/amiga/history_local.c index b56293d48..39456496c 100755 --- a/amiga/history_local.c +++ b/amiga/history_local.c @@ -57,7 +57,7 @@ #include "amiga/history_local.h" void ami_history_update_extent(struct history_window *hw); -static void ami_history_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg); +HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *); /** * Redraw history window. @@ -323,7 +323,7 @@ void ami_history_update_extent(struct history_window *hw) ami_gui_free_space_box(bbox); } -void ami_history_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg) +HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *) { ULONG gid; struct history_window *hw = hook->h_Data; diff --git a/amiga/tree.c b/amiga/tree.c index 4f2c28630..cba5375b6 100644 --- a/amiga/tree.c +++ b/amiga/tree.c @@ -524,7 +524,7 @@ static void ami_tree_drag_end(struct treeview_window *twin, int x, int y) } } -static void ami_tree_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg) +HOOKF(void, ami_tree_scroller_hook, Object *, object, struct IntuiMessage *) { ULONG gid; struct treeview_window *twin = hook->h_Data; -- cgit v1.2.3