|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/native/macosx Modified Files: hid.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp Log Message: Implemented proper debug levels Index: hid.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/hid.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/hid.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- hid.cpp 15 Dec 2003 11:49:17 -0000 1.3 +++ hid.cpp 20 Dec 2003 14:01:30 -0000 1.4 @@ -123,7 +123,7 @@ static void addToDeviceQueue(hid_device_t *hid_dev, IOHIDElementCookie cookie, int index) { HRESULT result = (*hid_dev->device_queue)->addElement(hid_dev->device_queue, cookie, 0); if (result != S_OK) { - printfDebug("Could not add cookie to queue\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not add cookie to queue\n"); return; } CFDictionaryAddValue(hid_dev->cookie_map, cookie, (void *)index); @@ -191,7 +191,7 @@ CFDictionaryRef matching_dic = IOServiceMatching(kIOHIDDeviceKey); IOReturn err = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dic, &device_iterator); if (err != kIOReturnSuccess) { - printfDebug("Could not find matching devices\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not find matching devices\n"); return false; } while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) { @@ -201,7 +201,7 @@ long usage_page; if (getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsageKey), &usage) && getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page)) { - if (ATDEBUGLEVEL()) { + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { printf("Considering device '"); printProperty(dev_props, CFSTR(kIOHIDProductKey)); printf("', usage page %ld usage %ld\n", usage_page, usage); Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.10 +++ org_lwjgl_Sys.cpp 20 Dec 2003 14:01:30 -0000 1.11 @@ -64,7 +64,7 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug("Could not read current time\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority (JNIEnv * env, jclass clazz, jint priority) { - printfDebug("WARNING: setProcessPriority unsupported\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "WARNING: setProcessPriority unsupported\n"); } /* Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_input_Keyboard.cpp 15 Dec 2003 11:49:17 -0000 1.19 +++ org_lwjgl_input_Keyboard.cpp 20 Dec 2003 14:01:30 -0000 1.20 @@ -70,12 +70,12 @@ static bool handleKey(UInt32 key_code, unsigned char state) { if (key_code >= KEYBOARD_SIZE) { - printfDebug("Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); + printfDebug(org_lwjgl_Sys_DEBUG, "Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); return false; } unsigned char mapped_code = key_map[key_code]; if (mapped_code == 0) { - printfDebug("unknown key code: %x\n", (unsigned int)key_code); + printfDebug(org_lwjgl_Sys_DEBUG, "unknown key code: %x\n", (unsigned int)key_code); return false; } return handleMappedKey(mapped_code, state); @@ -129,7 +129,7 @@ KeyboardLayoutRef layout; OSStatus err = KLGetCurrentKeyboardLayout(&layout); if (err != noErr) { - printfDebug("Could not get current keyboard layout\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get current keyboard layout\n"); return false; } @@ -143,7 +143,7 @@ success = success && GetEventParameter(event, kEventParamKeyboardType, typeUInt32, NULL, sizeof(keyboardType), NULL, &keyboardType) == noErr; success = success && GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifierKeyState), NULL, &modifierKeyState) == noErr; if (!success) { - printfDebug("Could not get event parameters for character translation\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event parameters for character translation\n"); return false; } err = KLGetKeyboardLayoutProperty(layout, kKLuchrData, (const void **)&uchrHandle); @@ -175,7 +175,7 @@ if (state) return writeAsciiChars(count, ascii_buffer); } else { - printfDebug("Could not translate key\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not translate key\n"); return false; } } @@ -186,7 +186,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } if (handleKey(key_code, 1) && !handleTranslation(event, true)) { @@ -199,7 +199,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } if (handleKey(key_code, 0) && !handleTranslation(event, false)) { @@ -222,7 +222,7 @@ UInt32 modifier_bits; OSStatus err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier_bits), NULL, &modifier_bits); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } handleModifier(modifier_bits, controlKey, 0x1d); Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.22 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:30 -0000 1.23 @@ -70,7 +70,7 @@ static void handleButton(unsigned char button_index, jbyte state) { if (button_index >= NUM_BUTTONS) { - printfDebug("Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); + printfDebug(org_lwjgl_Sys_DEBUG, "Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); return; } button_states[button_index] = state; @@ -106,7 +106,7 @@ } } } - printfDebug("Recieved an unknown HID device event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Recieved an unknown HID device event\n"); } } */ @@ -120,7 +120,7 @@ EventMouseButton button; OSStatus err = GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); if (err != noErr) { - printfDebug("Could not get button parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get button parameter from event\n"); return; } handleButton(button - 1, state); @@ -130,7 +130,7 @@ HIPoint delta; OSStatus err = GetEventParameter(event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug("Could not delta parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); return; } last_dx += (int)delta.x; @@ -141,7 +141,7 @@ long delta; OSStatus err = GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug("Could not delta parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); return; } last_dz += (int)delta; |