LDebug

Description Debugging support
Header file LDebug.h
Author Camil Demetrescu
Created Dec 19, 2001
Last updated Sep 24, 2003

 

Contents


Introduction

The component LDebug provides support for reading and sending debugging messages to the standard console (to elsewhere) and for terminating the program abnormally.


Interface

Constants

LDebug_ID
LDebug_INTERNAL_ERROR

Types

void (*LDebug_THandler) (const i1* inMessage);

Functions

void        LDebug_GetString           (i1* outStr, ui4 inSize);
void        LDebug_Print               (const i1* inMsg, ...);
void        LDebug_Write               (const i1* inMsg, ui4 inSize);
void        LDebug_Exit                ();
void        LDebug_InstallPrintHandler (LDebug_THandler inHandler);
void        LDebug_OpenBlock           ();
void        LDebug_CloseBlock          (i1** outBlock, ui4* outSize);


API Reference

Function Arguments Description Returns Throws
GetString i1* outStr Read at most inSize characters from the console, stopping when a newline is found, and copy them to buffer outStr as a C string. The newline, if any, is not copied to outStr. - -
ui4 inSize
Print const i1* inMsg

Send to the debugging console message inMsg, which can be a format string followed by a variable number or arguments as in the C printf family functions. We recommend using the following specifiers on a 32-bit data model, i.e., on platforms where sizeof(long)==4:

i1 %c, or %hd
ui1 %c, or %hu
i2 %hd
ui2 %hu
i4 %ld
ui4 %lu
f4 %f
f8 %Lf
i1* %s

Example:

ui4 theCode     = 27;
i1  theChannel  = 'k';
LDebug_Print("Opening stream %lu at channel %c\n", theCode, theChannel);
      

-

-
...
Write const i1* inMsg Writes to the debugging console message inMsg of size inSize (in bytes) - -
ui4 inSize

Exit

-

Stop executing the program.

-

-

InstallPrintHandler

LDebug_THandler inHandler

Installs a handler that is called upon invocation of Print and Write and receives the message as a C string. This can be useful to send messages to a place different from the standard debugging console. If inHandler is NULL, the default behavior is restored.

-

-

OpenBlock - Starts collecting messages in an internal data block instead of sending them to the debugging console. See also CloseBlock.

-

-

CloseBlock i1** outBlock Stops collecting messages and passes back in *outBlock the messages collected since the call of OpenBlock. The size of the created block is written to *outSize. Caller is responsible of dellocating the created clock using LMemory_Free. - -
ui4* outSize


Revision history