Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / test / benchmarks / boopsi / common.c
blob9acf972531acbe8e016ac952d4d5d1097ec364b0
1 /*
2 Copyright © 2003, 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/exec.h>
18 #include <proto/dos.h>
19 #include <proto/intuition.h>
20 #include <proto/muimaster.h>
21 #include <proto/utility.h>
23 /*** Instance data **********************************************************/
24 struct Test_DATA
26 ULONG td_Dummy1,
27 td_Dummy2,
28 td_Dummy3,
29 td_Dummy4;
32 /*** Methods ****************************************************************/
33 #define MUIM_Test_Dummy (TAG_USER | 0x42)
35 Object *Test__OM_NEW
37 Class *CLASS, Object *self, struct opSet *message
40 struct Test_DATA *data = NULL;
42 self = (Object *) DoSuperMethodA(CLASS, self, (Msg) message);
43 if (self == NULL) goto error;
45 data = INST_DATA(CLASS, self);
46 data->td_Dummy1 = 42;
47 data->td_Dummy2 = 42;
48 data->td_Dummy3 = 42;
49 data->td_Dummy4 = 42;
51 return self;
53 error:
55 return NULL;
58 IPTR Test__MUIM_Test_Dummy
60 Class *CLASS, Object *self, Msg message
63 struct Test_DATA *data = INST_DATA(CLASS, self);
65 /*
66 Need to do *something* so that the compiler doesn't optimize away
67 this function call completely...
69 data->td_Dummy1 += data->td_Dummy2;
71 return TRUE;
75 /*** Dispatcher *************************************************************/
76 BOOPSI_DISPATCHER(IPTR, Test_Dispatcher, CLASS, self, message)
78 switch (message->MethodID)
80 case OM_NEW: return (IPTR) Test__OM_NEW(CLASS, self, (struct opSet *) message);
81 case MUIM_Test_Dummy: return Test__MUIM_Test_Dummy(CLASS, self, message);
82 default: return DoSuperMethodA(CLASS, self, message);
85 return (IPTR) NULL;
87 BOOPSI_DISPATCHER_END
89 /*** Setup ******************************************************************/
90 struct MUI_CustomClass *Test_CLASS;
92 BOOL Test_Initialize()
94 Test_CLASS = MUI_CreateCustomClass
96 NULL, MUIC_Notify, NULL,
97 sizeof(struct Test_DATA), Test_Dispatcher
100 if (Test_CLASS != NULL) return TRUE;
101 else return FALSE;
104 void Test_Deinitialize()
106 MUI_DeleteCustomClass(Test_CLASS);
109 #define TestObject BOOPSIOBJMACRO_START(Test_CLASS->mcc_Class)