cerror.h File Reference

#include "cgeneral.h"
#include <stdarg.h>
#include <stdio.h>

Typedefs

typedef TBoolean( JpmcdsErrCallBackFunc )(char *string, void *callBackData)

Functions

void JpmcdsErrMsg (char *format,...)
 Writes an error message with a variable number of arguments to a log file.
void JpmcdsErrMsgV (char *format, va_list args)
 Same as JpmcdsErrMsg but using va_list for its arguments.
void JpmcdsErrLogWrite (char *message)
 Writes an error message to a log file.
void JpmcdsErrMsgOn (void)
 Tells JpmcdsErrMsg to actually write something.
void JpmcdsErrMsgOff (void)
 Tells JpmcdsErrMsg NOT to actually write something.
int JpmcdsErrMsgFailure (char *routine)
int JpmcdsErrMsgFlush (void)
 Flushes the err message stream.
EXPORT TBoolean JpmcdsErrMsgStatus (void)
 Returns the current logging state.
EXPORT int JpmcdsErrMsgFileName (char *fileName, TBoolean append)
 Tells JpmcdsErrMsg to write to the provided file name.
EXPORT char * JpmcdsErrMsgGetFileName (void)
 Returns pointer to privately held error log file name which was set by JpmcdsErrMsgFileName.
EXPORT char ** JpmcdsErrGetMsgRecord (void)
 Turns on the error message record facility.
EXPORT int JpmcdsErrMsgEnableRecord (int numberOfMessages, int messageSize)
 Turns on the error message record facility.
EXPORT int JpmcdsErrMsgDisableRecord (void)
 Turns off the error message record facility.
TBoolean JpmcdsErrMsgRecordEnabled (void)
 Returns whether the error message record has been enabled.
EXPORT void JpmcdsErrMsgAddCallback (JpmcdsErrCallBackFunc *userFunc, TBoolean sendTimeStamp, void *callbackData)
 Allows the user to supply a callback for error handling.
EXPORT void JpmcdsErrMsgGetCallback (JpmcdsErrCallBackFunc **userFunc, TBoolean *sendTimeStamp, void **callBackData)
 Returns callback information currently in use.

Detailed Description


Typedef Documentation

typedef TBoolean( JpmcdsErrCallBackFunc)(char *string, void *callBackData)

Error callback function


Function Documentation

void JpmcdsErrMsg ( char *  format,
  ... 
)

Writes an error message with a variable number of arguments to a log file.

EXPORT void JpmcdsErrMsgAddCallback ( JpmcdsErrCallBackFunc userFunc,
TBoolean  sendTimeStamp,
void *  callbackData 
)

Allows the user to supply a callback for error handling.

After you add a callback, then any call to JpmcdsErrMsg which would otherwise result in a message being written to file (not that if error messaging is off then messages are not being written to file) will first invoke a call to the callback routine.

The callback routine returns TRUE to indicate that the message should still be logged to file, and FALSE to indicate that the message should not be logged to file.

The callbackData provided in this function call will be made available to the callback routine.

int JpmcdsErrMsgFailure ( char *  routine  ) 

Writes the message "%s: Failed.\n" to the error log and returns FAILURE. This is to enable a single function call on failing within a function as follows: return (JpmcdsErrMsgFailure (routine));

EXPORT int JpmcdsErrMsgFileName ( char *  fileName,
TBoolean  append 
)

Tells JpmcdsErrMsg to write to the provided file name.

Routine opens the file, and returns SUCCESS or FAILURE depending on whether the file was successfully opened or not.

int JpmcdsErrMsgFlush ( void   ) 

Flushes the err message stream.

This can be called from within a debugger to make sure that the latest output written to the error log is flushed.

void JpmcdsErrMsgOff ( void   ) 

Tells JpmcdsErrMsg NOT to actually write something.

Tells JpmcdsErrMsg NOT to actually write something (either to log file, or to standard out, depending on how USE_PRINTF is set.)

void JpmcdsErrMsgOn ( void   ) 

Tells JpmcdsErrMsg to actually write something.

Tells JpmcdsErrMsg to actually write something (either to log file, or to standard out, depending on how USE_PRINTF is set.)

TBoolean JpmcdsErrMsgRecordEnabled ( void   ) 

Returns whether the error message record has been enabled.

Effectively error message record is enabled via the add-in function ErrorLog(1) and disabled by ErrorLog(0).

Thus we can use this function to determine in a pure add-in based interface whether the user has requested error logging.

This enables a special interface error handler to determine whether the user has requested a full error log.


Distributed by BN Algorithms Ltd -- consulting in quantitative finance, mathematical algorithms and software implementations. CDS Home Page. For enquires contact webs@bnikolic.co.uk.
This documentation is derived from ISDA CDS Standard Model version 1.7. You can get a copy of the original ISDA code at www.bnikolic.co.uk. This is a derivative work under the terms of the ISDA CDS Standard Model Public License. BN Algorithms Ltd licenses this work to you solely for on-screen viewing on your own computer. Making copies and further distribution of this work is prohibited.
This documentation is provided "as-is", without warranty of any kind, either expressed or implied, including, without limitation, warranties that the documentation is free of defects, merchantable, fit for a particular purpose or non-infringing. the entire risk as to the quality of the documentation is with you. Should this documentation prove defective in any respect, you (not the licensor) assume the cost of any necessary correction. This disclaimer of warranty constitutes an essential part of this license.