From 3123192dfca6336a0fc90d34dec4269aa329b4d0 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 19 Feb 2011 17:19:38 +0000 Subject: Move timer.device stuff to schedule.c svn path=/trunk/netsurf/; revision=11712 --- amiga/gui.c | 28 ++-------------------------- amiga/schedule.c | 32 +++++++++++++++++++++++++++++++- amiga/schedule.h | 5 +++++ amiga/system_colour.c | 1 - 4 files changed, 38 insertions(+), 28 deletions(-) (limited to 'amiga') diff --git a/amiga/gui.c b/amiga/gui.c index 1db49bb27..64785d26b 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -79,7 +79,6 @@ #include #include #include -#include #include #include @@ -133,8 +132,6 @@ char *quirks_stylesheet_url; char *adblock_stylesheet_url; struct MsgPort *appport; -struct Device *TimerBase; -struct TimerIFace *ITimer; struct Library *PopupMenuBase = NULL; struct PopupMenuIFace *IPopupMenu = NULL; struct Library *KeymapBase = NULL; @@ -272,20 +269,7 @@ void ami_open_resources(void) urlStringClass = MakeStringClass(); - msgport = AllocSysObjectTags(ASOT_PORT, - ASO_NoTrack,FALSE, - TAG_DONE); - - tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST, - ASOIOR_Size,sizeof(struct TimeRequest), - ASOIOR_ReplyPort,msgport, - ASO_NoTrack,FALSE, - TAG_DONE); - - OpenDevice("timer.device",UNIT_WAITUNTIL,(struct IORequest *)tioreq,0); - - TimerBase = (struct Device *)tioreq->Request.io_Device; - ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL); + ami_schedule_open_timer(); if(!(appport = AllocSysObjectTags(ASOT_PORT, ASO_NoTrack,FALSE, @@ -2131,15 +2115,7 @@ void gui_quit(void) if(IKeymap) DropInterface((struct Interface *)IKeymap); if(KeymapBase) CloseLibrary(KeymapBase); - if(ITimer) - { - DropInterface((struct Interface *)ITimer); - } - - CloseDevice((struct IORequest *) tioreq); - FreeSysObject(ASOT_IOREQUEST,tioreq); - FreeSysObject(ASOT_PORT,msgport); - + ami_schedule_close_timer(); ami_schedule_free(); FreeObjList(window_list); diff --git a/amiga/schedule.c b/amiga/schedule.c index 1c670c4bb..030ed266a 100755 --- a/amiga/schedule.c +++ b/amiga/schedule.c @@ -133,7 +133,7 @@ void schedule_run(BOOL poll) nscb = pblHeapGetFirst(schedule_list); - if(nscb == -1) return false; + if(nscb == -1) return; if(poll) { @@ -188,3 +188,33 @@ void ami_schedule_free(void) { pblHeapFree(schedule_list); } + +void ami_schedule_open_timer(void) +{ + msgport = AllocSysObjectTags(ASOT_PORT, + ASO_NoTrack,FALSE, + TAG_DONE); + + tioreq = (struct TimeRequest *)AllocSysObjectTags(ASOT_IOREQUEST, + ASOIOR_Size,sizeof(struct TimeRequest), + ASOIOR_ReplyPort,msgport, + ASO_NoTrack,FALSE, + TAG_DONE); + + OpenDevice("timer.device", UNIT_WAITUNTIL, (struct IORequest *)tioreq, 0); + + TimerBase = (struct Device *)tioreq->Request.io_Device; + ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL); +} + +void ami_schedule_close_timer(void) +{ + if(ITimer) + { + DropInterface((struct Interface *)ITimer); + } + + CloseDevice((struct IORequest *) tioreq); + FreeSysObject(ASOT_IOREQUEST,tioreq); + FreeSysObject(ASOT_PORT,msgport); +} diff --git a/amiga/schedule.h b/amiga/schedule.h index 7a3b25f1b..50071e5a8 100755 --- a/amiga/schedule.h +++ b/amiga/schedule.h @@ -22,9 +22,14 @@ #include "amiga/os3support.h" +struct Device *TimerBase; +struct TimerIFace *ITimer; + struct TimeRequest *tioreq; struct MsgPort *msgport; +void ami_schedule_open_timer(void); +void ami_schedule_close_timer(void); BOOL ami_schedule_create(void); void ami_schedule_free(void); void schedule_run(BOOL poll); diff --git a/amiga/system_colour.c b/amiga/system_colour.c index eb8a34c95..69c869a16 100644 --- a/amiga/system_colour.c +++ b/amiga/system_colour.c @@ -30,7 +30,6 @@ #include #include #include -#include struct gui_system_colour_ctx { const char *name; -- cgit v1.2.3