summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDebug.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
commit1411b2f26b3d46b402c4774770fb5356cd47ef95 (patch)
tree080187f8a151cf82a630512856d2315e712cedf9 /macosx/tkMacOSXDebug.c
parent4f2679372f637fcd2f0d997b9d97165a6b558f12 (diff)
downloadtk-1411b2f26b3d46b402c4774770fb5356cd47ef95.zip
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.gz
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.bz2
Lots of small changes to make code more pretty and C89-like.
Diffstat (limited to 'macosx/tkMacOSXDebug.c')
-rw-r--r--macosx/tkMacOSXDebug.c113
1 files changed, 69 insertions, 44 deletions
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index 0065b68..c9ac88c 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.21 2008/10/27 11:55:44 dkf Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.22 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -251,7 +251,8 @@ static MyEventName classicEventNames [] = {
#endif /* TK_MACOSXDEBUG_UNUSED */
MODULE_SCOPE char *
-TkMacOSXCarbonEventToAscii(EventRef eventRef)
+TkMacOSXCarbonEventToAscii(
+ EventRef eventRef)
{
EventClass eventClass;
EventKind eventKind;
@@ -292,33 +293,35 @@ TkMacOSXCarbonEventToAscii(EventRef eventRef)
#ifdef TK_MACOSXDEBUG_UNUSED
MODULE_SCOPE char *
-TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char *buf)
+TkMacOSXCarbonEventKindToAscii(
+ EventRef eventRef,
+ char *buf)
{
- EventClass eventClass;
- EventKind eventKind;
- MyEventNameList *list = eventNameList;
- MyEventName *names = NULL;
- int found = 0;
-
- eventClass = GetEventClass(eventRef);
- eventKind = GetEventKind(eventRef);
- while (list->names && (!names) ) {
- if (eventClass == list -> c) {
- names = list -> names;
- } else {
- list++;
- }
- }
- if (names) {
- found = 0;
- while (names->name && !found) {
- if (eventKind == names->kind) {
- sprintf(buf,"%s",names->name);
- found = 1;
- } else {
- names++;
- }
- }
+ EventClass eventClass;
+ EventKind eventKind;
+ MyEventNameList *list = eventNameList;
+ MyEventName *names = NULL;
+ int found = 0;
+
+ eventClass = GetEventClass(eventRef);
+ eventKind = GetEventKind(eventRef);
+ while (list->names && (!names) ) {
+ if (eventClass == list -> c) {
+ names = list -> names;
+ } else {
+ list++;
+ }
+ }
+ if (names) {
+ found = 0;
+ while (names->name && !found) {
+ if (eventKind == names->kind) {
+ sprintf(buf,"%s",names->name);
+ found = 1;
+ } else {
+ names++;
+ }
+ }
}
if (!found) {
sprintf(buf,"%d", eventKind);
@@ -329,7 +332,9 @@ TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char *buf)
}
MODULE_SCOPE char *
-TkMacOSXClassicEventToAscii(EventRecord *eventPtr, char *buf)
+TkMacOSXClassicEventToAscii(
+ EventRecord *eventPtr,
+ char *buf)
{
MyEventName *names = NULL;
int found = 0;
@@ -354,17 +359,20 @@ TkMacOSXClassicEventToAscii(EventRecord *eventPtr, char *buf)
(int) eventPtr->message, eventPtr->modifiers, buf);
}
return buf;
-
}
MODULE_SCOPE void
-TkMacOSXPrintPoint(char *tag, Point *p)
+TkMacOSXPrintPoint(
+ char *tag,
+ Point *p)
{
TkMacOSXDbgMsg("%s %4d %4d", tag,p->h,p->v );
}
MODULE_SCOPE void
-TkMacOSXPrintRect(char *tag, Rect *r)
+TkMacOSXPrintRect(
+ char *tag,
+ Rect *r)
{
TkMacOSXDbgMsg("%s %4d %4d %4d %4d (%dx%d)",
tag, r->left, r->top, r->right, r->bottom,
@@ -372,20 +380,26 @@ TkMacOSXPrintRect(char *tag, Rect *r)
}
MODULE_SCOPE void
-TkMacOSXPrintRegion(char *tag, RgnHandle rgn)
+TkMacOSXPrintRegion(
+ char *tag,
+ RgnHandle rgn)
{
Rect r;
+
GetRegionBounds(rgn,&r);
TkMacOSXPrintRect(tag,&r);
}
MODULE_SCOPE void
-TkMacOSXPrintWindowTitle(char *tag, WindowRef window)
+TkMacOSXPrintWindowTitle(
+ char *tag,
+ WindowRef window)
{
Str255 title;
- GetWTitle(window,title);
+
+ GetWTitle(window, title);
title[title[0] + 1] = 0;
- TkMacOSXDbgMsg("%s %s", tag, title +1 );
+ TkMacOSXDbgMsg("%s %s", tag, title+1);
}
typedef struct {
@@ -408,15 +422,16 @@ static MsgName msgNames [] = {
};
MODULE_SCOPE char *
-TkMacOSXMenuMessageToAscii(int msg, char *s)
+TkMacOSXMenuMessageToAscii(
+ int msg,
+ char *s)
{
MsgName *msgNamePtr;
- for (msgNamePtr = msgNames;msgNamePtr->name;) {
+
+ for (msgNamePtr=msgNames ; msgNamePtr->name ; msgNamePtr++) {
if (msgNamePtr->msg == msg) {
strcpy(s,msgNamePtr->name);
return s;
- } else {
- msgNamePtr++;
}
}
sprintf(s, "unknown : %d", msg);
@@ -436,9 +451,12 @@ static MsgName trackingNames [] = {
};
MODULE_SCOPE char *
-TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char *buf)
+TkMacOSXMouseTrackingResultToAscii(
+ MouseTrackingResult r,
+ char *buf)
{
MsgName *namePtr;
+
for (namePtr = trackingNames; namePtr->name; namePtr++) {
if (namePtr->msg == r) {
strcpy(buf, namePtr->name);
@@ -510,10 +528,11 @@ TkMacOSXDebugFlashRegion(
MODULE_SCOPE void *
TkMacOSXGetNamedDebugSymbol(
- const char* module,
- const char* symbol)
+ const char *module,
+ const char *symbol)
{
void *addr = TkMacOSXGetNamedSymbol(module, symbol);
+
#ifndef __LP64__
if (!addr) {
const struct mach_header *mh = NULL;
@@ -616,5 +635,11 @@ TkMacOSXGetNamedDebugSymbol(
#endif /* __LP64__ */
return addr;
}
-
#endif /* TK_MAC_DEBUG */
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */