crete an idle task to run when theres ... umm. .. nothing to do ..
[AROS.git] / test / benchmarks / boopsi / common.c
blobe43731b9beae5e432c4fc0ae581d32842890ddc8
1 /*
2 Copyright © 2003-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <sys/time.h>
9 #include <stdio.h>
11 #include <string.h>
13 #include <exec/types.h>
14 #include <utility/tagitem.h>
15 #include <libraries/mui.h>
17 #include <proto/alib.h>
18 #include <proto/exec.h>
19 #include <proto/dos.h>
20 #include <proto/intuition.h>
21 #include <proto/muimaster.h>
22 #include <proto/utility.h>
24 /*** Instance data **********************************************************/
25 struct Test_DATA
27 ULONG td_Dummy1,
28 td_Dummy2,
29 td_Dummy3,
30 td_Dummy4;
33 /*** Methods ****************************************************************/
34 #define MUIM_Test_Dummy (TAG_USER | 0x42)
36 Object *Test__OM_NEW
38 Class *CLASS, Object *self, struct opSet *message
41 struct Test_DATA *data = NULL;
43 self = (Object *) DoSuperMethodA(CLASS, self, (Msg) message);
44 if (self == NULL) goto error;
46 data = INST_DATA(CLASS, self);
47 data->td_Dummy1 = 42;
48 data->td_Dummy2 = 42;
49 data->td_Dummy3 = 42;
50 data->td_Dummy4 = 42;
52 return self;
54 error:
56 return NULL;
59 IPTR Test__MUIM_Test_Dummy
61 Class *CLASS, Object *self, Msg message
64 struct Test_DATA *data = INST_DATA(CLASS, self);
66 /*
67 Need to do *something* so that the compiler doesn't optimize away
68 this function call completely...
70 data->td_Dummy1 += data->td_Dummy2;
72 return TRUE;
76 /*** Dispatcher *************************************************************/
77 BOOPSI_DISPATCHER(IPTR, Test_Dispatcher, CLASS, self, message)
79 switch (message->MethodID)
81 case OM_NEW: return (IPTR) Test__OM_NEW(CLASS, self, (struct opSet *) message);
82 case MUIM_Test_Dummy: return Test__MUIM_Test_Dummy(CLASS, self, message);
83 default: return DoSuperMethodA(CLASS, self, message);
86 return (IPTR) NULL;
88 BOOPSI_DISPATCHER_END
90 /*** Setup ******************************************************************/
91 struct MUI_CustomClass *Test_CLASS;
93 BOOL Test_Initialize()
95 Test_CLASS = MUI_CreateCustomClass
97 NULL, MUIC_Notify, NULL,
98 sizeof(struct Test_DATA), Test_Dispatcher
101 if (Test_CLASS != NULL) return TRUE;
102 else return FALSE;
105 void Test_Deinitialize()
107 MUI_DeleteCustomClass(Test_CLASS);
110 #define TestObject BOOPSIOBJMACRO_START(Test_CLASS->mcc_Class)