2 (C) 1998-2001 AROS - The Amiga Research OS
5 Desc: Test program for Commodities
9 #include <proto/exec.h>
10 #include <proto/commodities.h>
11 #include <proto/intuition.h>
12 #include <intuition/intuition.h>
13 #include <exec/memory.h>
14 #include <libraries/commodities.h>
20 struct IntuitionBase
*IntuitionBase
;
22 int main(int argc
, char* argv
[])
24 struct Library
*CxBase
;
28 struct InputEvent myie
;
29 struct Window
*window
;
31 struct NewBroker brok
=
36 "Broker for testing the commodities library",
40 NULL
, /* nb_Port - will be initialized below */
45 myie
.ie_NextEvent
= NULL
;
46 myie
.ie_Class
= IECLASS_RAWKEY
;
47 myie
.ie_SubClass
= IESUBCLASS_COMPATIBLE
;
49 myie
.ie_Qualifier
= 0;
51 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library",39);
53 window
= OpenWindowTags(NULL
,
54 WA_IDCMP
, IDCMP_RAWKEY
,
61 fprintf(stderr
, "Window failed to open.\n");
66 fprintf(stderr
, "Testing commodities.library...\n");
68 CxBase
= OpenLibrary("commodities.library", 0);
70 brok
.nb_Port
= CreateMsgPort();
74 fprintf(stderr
, "Couldn't open commodities.library.\n");
78 fprintf(stderr
, "Calling CxBroker().\n");
81 myBroker
= CxBroker(&brok
, NULL
);
83 fprintf(stderr
, "Broker installed.\n");
88 fprintf(stderr
, "Error in creating object.\n");
93 fprintf(stderr
, "Creating filter object.\n");
94 filter
= CxFilter("rawkey return");
98 fprintf(stderr
, "Error in creating filter.\n");
103 fprintf(stderr
, "Filter created.\n");
105 AttachCxObj(myBroker
, filter
);
107 fprintf(stderr
, "Filter attached.\n");
111 /* int sig = AllocSignal(-1); */
113 /* trans = CxSignal(FindTask(NULL), sig); */
114 /* trans = CxDebug(1); */
115 trans
= CxTranslate(&myie
);
118 fprintf(stderr
, "Error in creating translator.\n");
122 AttachCxObj(filter
, trans
);
124 ActivateCxObj(myBroker
, TRUE
);
126 fprintf(stderr
, "Broker activated.\n");
129 Wait(SIGBREAKF_CTRL_C
);
130 /* Wait(SIGBREAKF_CTRL_C | 1 << sig); */
133 fprintf(stderr
, "Deleting all objects.\n");
134 DeleteCxObjAll(myBroker
);
138 fprintf(stderr
, "Closing commodities.library...\n");
139 CloseLibrary(CxBase
);
140 CloseLibrary((struct Library
*)IntuitionBase
);
141 fprintf(stderr
, "All done.\n");