more updates from John Fay

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@515 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
brianp 2004-09-13 18:39:10 +00:00
parent 447cac3357
commit a82a0dff4a
9 changed files with 33 additions and 35 deletions

View File

@ -50,7 +50,7 @@ void FGAPIENTRY glutDisplayFunc( void (* callback)( void ) )
{ {
if( !callback ) if( !callback )
fgError( "Fatal error in program. NULL display callback not " fgError( "Fatal error in program. NULL display callback not "
"permitted in GLUT 3.0+ or freeglut 2.0.1+\n" ); "permitted in GLUT 3.0+ or freeglut 2.0.1+" );
SET_CALLBACK( Display ); SET_CALLBACK( Display );
} }
@ -106,7 +106,7 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ),
{ {
if( ! (timer = malloc(sizeof(SFG_Timer))) ) if( ! (timer = malloc(sizeof(SFG_Timer))) )
fgError( "Fatal error: " fgError( "Fatal error: "
"Memory allocation failure in glutTimerFunc()\n" ); "Memory allocation failure in glutTimerFunc()" );
} }
timer->Callback = callback; timer->Callback = callback;

View File

@ -167,7 +167,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
break; break;
default: default:
fgWarning( "Unknown cursor type: %d\n", cursorID ); fgWarning( "Unknown cursor type: %d", cursorID );
return; return;
} }

View File

@ -96,7 +96,7 @@ static void fghRememberState( void )
); );
if( !fgDisplay.DisplayModeValid ) if( !fgDisplay.DisplayModeValid )
fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" ); fgWarning( "Runtime use of XF86VidModeGetModeLine failed." );
# else # else
/* /*
@ -559,6 +559,7 @@ int FGAPIENTRY glutGameModeGet( GLenum eWhat )
return !!fgStructure.GameMode; return !!fgStructure.GameMode;
} }
fgWarning( "Unknown gamemode get: %d", eWhat );
return -1; return -1;
} }

View File

@ -864,8 +864,8 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
break ; break ;
case 28 : /* Unrecognized */ case 28 : /* Unrecognized */
printf ( "WARNING - Display string token not recognized: %s\n", fgWarning ( "WARNING - Display string token not recognized: %s",
token ); token );
break ; break ;
} }

View File

@ -698,7 +698,6 @@ void fgCloseWindow( SFG_Window* window );
void fgAddToWindowDestroyList ( SFG_Window* window ); void fgAddToWindowDestroyList ( SFG_Window* window );
void fgCloseWindows (); void fgCloseWindows ();
void fgDestroyWindow( SFG_Window* window ); void fgDestroyWindow( SFG_Window* window );
void fgClearCallBacks( SFG_Window *window );
/* Menu creation and destruction. Defined in freeglut_structure.c */ /* Menu creation and destruction. Defined in freeglut_structure.c */
SFG_Menu* fgCreateMenu( FGCBMenu menuCallback ); SFG_Menu* fgCreateMenu( FGCBMenu menuCallback );

View File

@ -241,8 +241,7 @@ static int fghJoystickFindUSBdev(char *name, char *out, int outlen)
return 1; return 1;
} else if (errno == EACCES) { } else if (errno == EACCES) {
if (!protection_warned) { if (!protection_warned) {
fprintf(stderr, "Can't open %s for read!\n", fgWarning ( "Can't open %s for read!", buf );
buf);
protection_warned = 1; protection_warned = 1;
} }
} }
@ -263,7 +262,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os,
if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 ) if ( ( rd = hid_get_report_desc( os->fd ) ) == 0 )
{ {
fprintf( stderr, "error: %s: %s", os->fname, strerror( errno ) ); fgWarning ( "error: %s: %s", os->fname, strerror( errno ) );
return FALSE; return FALSE;
} }
@ -273,8 +272,7 @@ static int fghJoystickInitializeHID(struct os_specific_s *os,
if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0) if( ioctl( os->fd, USB_GET_REPORT_ID, &report_id ) < 0)
{ {
/*** XXX {report_id} may not be the right variable? ***/ /*** XXX {report_id} may not be the right variable? ***/
fprintf( stderr, "error: %s%d: %s", fgWarning ( "error: %s%d: %s", UHIDDEV, report_id, strerror( errno ) );
UHIDDEV, report_id, strerror( errno ) );
return FALSE; return FALSE;
} }
@ -724,7 +722,7 @@ static void fghJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
break; break;
default: default:
fgWarning ( "%s", "PLIB_JS: Unrecognised /dev/js return!?!" ); fgWarning ( "PLIB_JS: Unrecognised /dev/js return!?!" );
/* use the old values */ /* use the old values */
@ -851,7 +849,7 @@ static int fghJoystickFindDevices ( SFG_Joystick *joy, mach_port_t masterPort )
rv = IOServiceGetMatchingServices(masterPort, hidMatch, &hidIterator); rv = IOServiceGetMatchingServices(masterPort, hidMatch, &hidIterator);
if (rv != kIOReturnSuccess || !hidIterator) { if (rv != kIOReturnSuccess || !hidIterator) {
fgWarning( "%s", "no joystick (HID) devices found" ); fgWarning( "no joystick (HID) devices found" );
return; return;
} }
@ -894,13 +892,13 @@ static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick *joy, io_object
rv = IORegistryEntryGetParentEntry (ioDev, kIOServicePlane, &parent1); rv = IORegistryEntryGetParentEntry (ioDev, kIOServicePlane, &parent1);
if (rv != kIOReturnSuccess) { if (rv != kIOReturnSuccess) {
fgWarning ( "%s", "error getting device entry parent"); fgWarning ( "error getting device entry parent");
return NULL; return NULL;
} }
rv = IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2); rv = IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2);
if (rv != kIOReturnSuccess) { if (rv != kIOReturnSuccess) {
fgWarning ( "%s", "error getting device entry parent 2"); fgWarning ( "error getting device entry parent 2");
return NULL; return NULL;
} }
#endif #endif
@ -908,7 +906,7 @@ static CFDictionaryRef fghJoystickGetCFProperties ( SFG_Joystick *joy, io_object
rv = IORegistryEntryCreateCFProperties( ioDev /*parent2*/, rv = IORegistryEntryCreateCFProperties( ioDev /*parent2*/,
&cfProperties, kCFAllocatorDefault, kNilOptions); &cfProperties, kCFAllocatorDefault, kNilOptions);
if (rv != kIOReturnSuccess || !cfProperties) { if (rv != kIOReturnSuccess || !cfProperties) {
fgWarning ( "%s", "error getting device properties"); fgWarning ( "error getting device properties");
return NULL; return NULL;
} }
@ -974,14 +972,14 @@ static void fghJoystickParseElement ( SFG_Joystick *joy, CFDictionaryRef element
break; break;
default: default:
printf("input type element has weird usage (%x)\n", usage); fgWarning ( "input type element has weird usage (%x)", usage);
break; break;
} }
} else if (page == kHIDPage_Button) { } else if (page == kHIDPage_Button) {
printf(" button\n"); printf(" button\n");
fghJoystickAddButtonElement((CFDictionaryRef) element); fghJoystickAddButtonElement((CFDictionaryRef) element);
} else } else
printf("input type element has weird page (%x)\n", page); fgWarning ( "input type element has weird page (%x)", page);
break; break;
case kIOHIDElementTypeCollection: case kIOHIDElementTypeCollection:
@ -1239,7 +1237,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
#if TARGET_HOST_MAC_OSX #if TARGET_HOST_MAC_OSX
if( joy->id >= numDevices ) if( joy->id >= numDevices )
{ {
fgWarning( "%s", "device index out of range in fgJoystickOpen()" ); fgWarning( "device index out of range in fgJoystickOpen()" );
return; return;
} }
@ -1251,7 +1249,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
if( rv != kIOReturnSuccess ) if( rv != kIOReturnSuccess )
{ {
fgWarning( "%s", "error creating plugin for io device" ); fgWarning( "error creating plugin for io device" );
return; return;
} }
@ -1262,7 +1260,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
); );
if( pluginResult != S_OK ) if( pluginResult != S_OK )
fgWarning ( "%s", "QI-ing IO plugin to HID Device interface failed" ); fgWarning ( "QI-ing IO plugin to HID Device interface failed" );
( *plugin )->Release( plugin ); /* don't leak a ref */ ( *plugin )->Release( plugin ); /* don't leak a ref */
if( joy->hidDev == NULL ) if( joy->hidDev == NULL )
@ -1358,7 +1356,7 @@ static void fghJoystickOpen( SFG_Joystick* joy )
joy->os->fd = open( joy->os->fname, O_RDONLY | O_NONBLOCK); joy->os->fd = open( joy->os->fname, O_RDONLY | O_NONBLOCK);
if( joy->os->fd < 0 && errno == EACCES ) if( joy->os->fd < 0 && errno == EACCES )
fgWarning ( "%s exists but is not readable by you\n", joy->os->fname ); fgWarning ( "%s exists but is not readable by you", joy->os->fname );
joy->error =( joy->os->fd < 0 ); joy->error =( joy->os->fd < 0 );
@ -1533,10 +1531,10 @@ static void fghJoystickOpen( SFG_Joystick* joy )
void fgJoystickInit( int ident ) void fgJoystickInit( int ident )
{ {
if( ident >= MAX_NUM_JOYSTICKS ) if( ident >= MAX_NUM_JOYSTICKS )
fgError( "Too large a joystick number" ); fgError( "Too large a joystick number: %d", ident );
if( fgJoystick[ ident ] ) if( fgJoystick[ ident ] )
fgError( "illegal attempt to initialize joystick device" ); fgError( "illegal attempt to initialize joystick device again" );
fgJoystick[ ident ] = fgJoystick[ ident ] =
( SFG_Joystick * )calloc( sizeof( SFG_Joystick ), 1 ); ( SFG_Joystick * )calloc( sizeof( SFG_Joystick ), 1 );
@ -1566,7 +1564,7 @@ void fgJoystickInit( int ident )
IOReturn rv = IOMasterPort( bootstrap_port, &masterPort ); IOReturn rv = IOMasterPort( bootstrap_port, &masterPort );
if( rv != kIOReturnSuccess ) if( rv != kIOReturnSuccess )
{ {
fgWarning( "%s", "error getting master Mach port" ); fgWarning( "error getting master Mach port" );
return; return;
} }
fghJoystickFindDevices( masterPort ); fghJoystickFindDevices( masterPort );
@ -1589,7 +1587,7 @@ void fgJoystickInit( int ident )
!CFStringGetCString( ( CFStringRef )ref, name, 128, !CFStringGetCString( ( CFStringRef )ref, name, 128,
CFStringGetSystemEncoding( ) ) ) CFStringGetSystemEncoding( ) ) )
{ {
fgWarning( "%s", "error getting device name" ); fgWarning( "error getting device name" );
name[ 0 ] = '\0'; name[ 0 ] = '\0';
} }
#endif #endif

View File

@ -502,7 +502,7 @@ static void fghSleepForEvents( void )
err = select( socket+1, &fdset, NULL, NULL, &wait ); err = select( socket+1, &fdset, NULL, NULL, &wait );
if( -1 == err ) if( -1 == err )
fgWarning ( "freeglut select() error: %d\n", errno ); fgWarning ( "freeglut select() error: %d", errno );
} }
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE #elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS ); MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS );
@ -696,7 +696,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
break; break;
default: default:
fgWarning( "Uknown X visibility state: %d", fgWarning( "Unknown X visibility state: %d",
event.xvisibility.state ); event.xvisibility.state );
break; break;
} }
@ -1953,7 +1953,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam,
default: default:
#if _DEBUG #if _DEBUG
fgWarning( "Unknown wParam type 0x%x\n", wParam ); fgWarning( "Unknown wParam type 0x%x", wParam );
#endif #endif
break; break;
} }

View File

@ -118,7 +118,7 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
break; break;
default: default:
fgWarning( "glutSetOption(): missing enum handle %i\n", eWhat ); fgWarning( "glutSetOption(): missing enum handle %d", eWhat );
break; break;
} }
} }
@ -454,7 +454,7 @@ int FGAPIENTRY glutGet( GLenum eWhat )
break; break;
default: default:
fgWarning( "glutGet(): missing enum handle %i\n", eWhat ); fgWarning( "glutGet(): missing enum handle %d", eWhat );
break; break;
} }
return -1; return -1;
@ -555,7 +555,7 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat )
return GLUT_KEY_REPEAT_DEFAULT; return GLUT_KEY_REPEAT_DEFAULT;
default: default:
fgWarning( "glutDeviceGet(): missing enum handle %i\n", eWhat ); fgWarning( "glutDeviceGet(): missing enum handle %d", eWhat );
break; break;
} }
@ -649,7 +649,7 @@ int FGAPIENTRY glutLayerGet( GLenum eWhat )
#endif #endif
default: default:
fgWarning( "glutLayerGet(): missing enum handle %i\n", eWhat ); fgWarning( "glutLayerGet(): missing enum handle %d", eWhat );
break; break;
} }

View File

@ -725,7 +725,7 @@ void FGAPIENTRY glutSetWindow( int ID )
window = fgWindowByID( ID ); window = fgWindowByID( ID );
if( window == NULL ) if( window == NULL )
{ {
fgWarning( "glutSetWindow(): window ID %i not found!", ID ); fgWarning( "glutSetWindow(): window ID %d not found!", ID );
return; return;
} }