"thomas" <[EMAIL PROTECTED]> wrote
> I have recently heard about this non documented function in the forum.
> Can someone explain what it can be used for and how ?
>
After seeing my last message hit the list I decided that it
might be just too complicated for the concepts to be
understood so this is the guts of the usage.  Of course
I can't gaurantee that this compiles (not that the last
block of code had any more chance).

(debug.h)
void * DebugLock(MemHandle h, const char * msg);
void DebugUnlock(MemHandle h, const char * msg);

#if DEBUGFLAG_LOCK
  #define MemHandleUnlock(x) DebugUnlock((x))
  #define MemHandleLock(x) DebugLock((x))
#endif

(debug.h ends)

(debug.c)
char mstrBuffer[128];

void DebugMsg(char * msg)
{
    // whatever you do to dump debug info
}

#undef MemHandleLock
void * DebugLock(MemHandle h)
{
 void * result = NULL;

 result = MemHandleLock(h);

 StrPrintF(mstrBuffer, "\nLock, %lx, %lx, %d", h, result,
        MemHandleLockCount(hChunk));
 DebugMsg(mstrBuffer);

 return result;
}

#undef MemHandleUnlock
void DebugUnlock(MemHandle h)
{
  StrPrintF(mstrBuffer, "\nUnlock, %lx, 0, %d", h,
        /* pointer placeholder, */ MemHandleLockCount(hChunk));
 DebugMsg(mstrBuffer);

 MemHandleUnlock(h);
}
(debug.c ends)

Make sense now?

Chris Tutty



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to