"McCollister, Mike" <[EMAIL PROTECTED]> wrote
> I seem to recall that there is a way in POSER to print some strings to a
log
> file on the PC. Does anyone know how to do that?
>
The emulator install includes a file called HostControl.h. This contains
the set of functions you want.
To get you started, here's the code I use to start a debug session.
void DebugInitialise(void)
{
#if DEBUG_ON
hfDebug = HostFOpen("c:\\temp\\Debug.log", "w");
if (!hfDebug)
return;
HostFPutS("\n--------------------", hfDebug);
HostFPutS("\nDebug session begins\n", hfDebug);
TimeStamp();
HostFPutS(mstrBuffer, hfDebug);
HostFPutS("\n--------------------\n", hfDebug);
HostFFlush(hfDebug);
SequenceCounter = 0; // CJT August 2000, RefID:10383
LockCounter = 0; // CJT August 2000, RefID:10383
StartDebugOutput();
#endif
}
I also created the following routine for tracing chunk locking problems.
It's not optimised for speed and I haven't tested it under 3.5 but I hope
it's as useful for others as it was for me :-)
/* This (very low-level) macro will dump the contents of a
chunk header. It's mainly useful for checking lock counts
(which is why that's all I've bothered outputting).
Note that this has to be passed a locked handle to get access
to the chunk header so the two parameters provide minimal information
for a handle only, or better information if a handle and the locked
pointer
for that handle are passed in. This avoids the possibility of causing
a chunk overlock error by locking within this routine.
I'm using the global variable gTempStr to build up the information.
Follow
this routine with a 'TRACEMSG(gTempStr);' or show an alert of some sort.
Chris Tutty
August 2000
*/
#if DEBUGFLAG_CHUNKS
#define NON_PORTABLE
#include <SystemPrv.h>
#include <MemoryPrv.h>
#define DUMPCHUNKDATA(hChunk,pChunk) \
{ \
StrCopy(gTempStr, " H: "); \
StrIToH(&gTempStr[StrLen(gTempStr)], (ULong) hChunk); \
\
if (pChunk) \
{ \
CharPtr p = pChunk; \
p -= sizeof(MemChunkHeaderType); \
\
StrCat(gTempStr, " Lock: "); \
StrIToA(&gTempStr[StrLen(gTempStr)], \
((MemChunkHeaderPtr) p)->lockCount - 1); \
StrCat(gTempStr, " Size: "); \
StrIToA(&gTempStr[StrLen(gTempStr)], \
((MemChunkHeaderPtr) p)->size); \
} \
}
#else
// define it empty so that trace code can still call it.
#define DUMPCHUNKDATA(hChunk,pChunk) {}
#endif //DEBUGFLAG_CHUNKS
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/