diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog index c48297285..7b36f5290 100644 --- a/winsup/w32api/ChangeLog +++ b/winsup/w32api/ChangeLog @@ -1,3 +1,13 @@ +2005-02-10 Jiri Malak + Danny Smith + + * 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 * include/winioctl.h (IOCTL_VOLUME_BASE, diff --git a/winsup/w32api/lib/directx/dinput_joy.c b/winsup/w32api/lib/directx/dinput_joy.c index 6c88d575b..e2a6f9fce 100644 --- a/winsup/w32api/lib/directx/dinput_joy.c +++ b/winsup/w32api/lib/directx/dinput_joy.c @@ -12,7 +12,7 @@ #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}, @@ -60,4 +60,4 @@ static DIOBJECTDATAFORMAT c_rgodfDIJoy[] __attribute__ ((section(".text"))) = {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}; diff --git a/winsup/w32api/lib/directx/dinput_joy2.c b/winsup/w32api/lib/directx/dinput_joy2.c index 214e2161a..3c27abd33 100644 --- a/winsup/w32api/lib/directx/dinput_joy2.c +++ b/winsup/w32api/lib/directx/dinput_joy2.c @@ -12,7 +12,7 @@ #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}, @@ -180,4 +180,4 @@ static DIOBJECTDATAFORMAT c_rgodfDIJoy2[] __attribute__ ((section(".text"))) = {&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}; diff --git a/winsup/w32api/lib/directx/dinput_kbd.c b/winsup/w32api/lib/directx/dinput_kbd.c index b32d0a186..88cac861c 100644 --- a/winsup/w32api/lib/directx/dinput_kbd.c +++ b/winsup/w32api/lib/directx/dinput_kbd.c @@ -12,7 +12,7 @@ #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}, @@ -272,4 +272,4 @@ static DIOBJECTDATAFORMAT c_rgodfDIKeyboard[] __attribute__ ((section(".text"))) {&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}; diff --git a/winsup/w32api/lib/directx/dinput_mouse.c b/winsup/w32api/lib/directx/dinput_mouse.c index a4f8a312e..21e3e0380 100644 --- a/winsup/w32api/lib/directx/dinput_mouse.c +++ b/winsup/w32api/lib/directx/dinput_mouse.c @@ -12,7 +12,7 @@ #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}, @@ -23,4 +23,4 @@ static DIOBJECTDATAFORMAT c_rgodfDIMouse[] __attribute__ ((section(".text"))) = {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}; diff --git a/winsup/w32api/lib/directx/dinput_mouse2.c b/winsup/w32api/lib/directx/dinput_mouse2.c index 89e18a73d..90f46c01b 100644 --- a/winsup/w32api/lib/directx/dinput_mouse2.c +++ b/winsup/w32api/lib/directx/dinput_mouse2.c @@ -12,7 +12,7 @@ #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}, @@ -27,4 +27,4 @@ static DIOBJECTDATAFORMAT c_rgodfDIMouse2[] __attribute__ ((section(".text"))) = {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}; diff --git a/winsup/w32api/lib/directx/dinput_private.h b/winsup/w32api/lib/directx/dinput_private.h index f620aa84b..e1629134a 100644 --- a/winsup/w32api/lib/directx/dinput_private.h +++ b/winsup/w32api/lib/directx/dinput_private.h @@ -70,4 +70,12 @@ extern GUID GUID_Slider; 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