+2005-02-10 Jiri Malak <Jiri.Malak@iol.cz>
+ Danny Smith <dannysmith@users.sourceforge.net>
+
+ * lib/directx/dinput_private.h (ATTRIBUTE_TEXT_SECTION): New
+ define for Open Watcom portability.
+ * lib/directx/(dinput_joy.c, dinput_joy2.c, dinput_kbd.c,
+ dinput_mouse.c, dinput_mouse2.c): Use new macro in definition
+ of local c_rgodfDI* objects. Replace .rdata section attribute
+ with 'const' keyword in definition of global c_dfDI* objects.
+
2005-02-07 Danny Smith <dannysmith@users.sourceforge.net>
* include/winioctl.h (IOCTL_VOLUME_BASE,
#include "dinput_private.h"
-static DIOBJECTDATAFORMAT c_rgodfDIJoy[] __attribute__ ((section(".text"))) =
+static DIOBJECTDATAFORMAT ATTRIBUTE_TEXT_SECTION c_rgodfDIJoy[] =
{
{&GUID_XAxis,0x0,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION},
{&GUID_YAxis,0x4,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION},
{NULL,0x4f,DIDFT_BUTTON|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,0x0}
};
-DIDATAFORMAT c_dfDIJoystick __attribute__ ((section(".rdata"))) = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_ABSAXIS,80,sizeof(c_rgodfDIJoy)/sizeof(c_rgodfDIJoy[0]),c_rgodfDIJoy};
+const DIDATAFORMAT c_dfDIJoystick = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_ABSAXIS,80,sizeof(c_rgodfDIJoy)/sizeof(c_rgodfDIJoy[0]),c_rgodfDIJoy};
#include "dinput_private.h"
-static DIOBJECTDATAFORMAT c_rgodfDIJoy2[] __attribute__ ((section(".text"))) =
+static DIOBJECTDATAFORMAT ATTRIBUTE_TEXT_SECTION c_rgodfDIJoy2[] =
{
{&GUID_XAxis,0x0,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION},
{&GUID_YAxis,0x4,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION},
{&GUID_Slider,0x1c,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,DIDOI_ASPECTFORCE}
};
-DIDATAFORMAT c_dfDIJoystick2 __attribute__ ((section(".rdata"))) = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_ABSAXIS,272,sizeof(c_rgodfDIJoy2)/sizeof(c_rgodfDIJoy2[0]),c_rgodfDIJoy2};
+const DIDATAFORMAT c_dfDIJoystick2 = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_ABSAXIS,272,sizeof(c_rgodfDIJoy2)/sizeof(c_rgodfDIJoy2[0]),c_rgodfDIJoy2};
#include "dinput_private.h"
-static DIOBJECTDATAFORMAT c_rgodfDIKeyboard[] __attribute__ ((section(".text"))) =
+static DIOBJECTDATAFORMAT ATTRIBUTE_TEXT_SECTION c_rgodfDIKeyboard[] =
{
{&GUID_Key,0x0,DIDFT_BUTTON|DIDFT_MAKEINSTANCE(0x0)|DIDFT_OPTIONAL,0x0},
{&GUID_Key,0x1,DIDFT_BUTTON|DIDFT_MAKEINSTANCE(0x1)|DIDFT_OPTIONAL,0x0},
{&GUID_Key,0xff,DIDFT_BUTTON|DIDFT_MAKEINSTANCE(0xff)|DIDFT_OPTIONAL,0x0}
};
-DIDATAFORMAT c_dfDIKeyboard __attribute__ ((section(".rdata"))) = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,256,sizeof(c_rgodfDIKeyboard)/sizeof(c_rgodfDIKeyboard[0]),c_rgodfDIKeyboard};
+const DIDATAFORMAT c_dfDIKeyboard = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,256,sizeof(c_rgodfDIKeyboard)/sizeof(c_rgodfDIKeyboard[0]),c_rgodfDIKeyboard};
#include "dinput_private.h"
-static DIOBJECTDATAFORMAT c_rgodfDIMouse[] __attribute__ ((section(".text"))) =
+static DIOBJECTDATAFORMAT ATTRIBUTE_TEXT_SECTION c_rgodfDIMouse[] =
{
{&GUID_XAxis,0x0,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE,0x0},
{&GUID_YAxis,0x4,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE,0x0},
{NULL,0xf,DIDFT_BUTTON|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,0x0}
};
-DIDATAFORMAT c_dfDIMouse __attribute__ ((section(".rdata"))) = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,16,sizeof(c_rgodfDIMouse)/sizeof(c_rgodfDIMouse[0]),c_rgodfDIMouse};
+const DIDATAFORMAT c_dfDIMouse = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,16,sizeof(c_rgodfDIMouse)/sizeof(c_rgodfDIMouse[0]),c_rgodfDIMouse};
#include "dinput_private.h"
-static DIOBJECTDATAFORMAT c_rgodfDIMouse2[] __attribute__ ((section(".text"))) =
+static DIOBJECTDATAFORMAT ATTRIBUTE_TEXT_SECTION c_rgodfDIMouse2[] =
{
{&GUID_XAxis,0x0,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE,0x0},
{&GUID_YAxis,0x4,DIDFT_ABSAXIS|DIDFT_RELAXIS|DIDFT_ANYINSTANCE,0x0},
{NULL,0x13,DIDFT_BUTTON|DIDFT_ANYINSTANCE|DIDFT_OPTIONAL,0x0}
};
-DIDATAFORMAT c_dfDIMouse2 __attribute__ ((section(".rdata"))) = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,20,sizeof(c_rgodfDIMouse2)/sizeof(c_rgodfDIMouse2[0]),c_rgodfDIMouse2};
+const DIDATAFORMAT c_dfDIMouse2 = {sizeof(DIDATAFORMAT),sizeof(DIOBJECTDATAFORMAT),DIDF_RELAXIS,20,sizeof(c_rgodfDIMouse2)/sizeof(c_rgodfDIMouse2[0]),c_rgodfDIMouse2};
extern GUID GUID_Key;
extern GUID GUID_POV;
+#if defined (__WATCOMC__)
+#define ATTRIBUTE_TEXT_SECTION __based( __segname( "_CODE" ) )
+#elif defined (__GNUC__)
+#define ATTRIBUTE_TEXT_SECTION __attribute__ ((section(".text")))
+#else
+#define ATTRIBUTE_TEXT_SECTION
+#endif
+
#endif