EDT PDV SDK Documentation 6.2.0
edt_error.h File Reference

(git d83b3c1980, 2023-10-18)

Generalized error handling for edt and pdv libraries (header file) More...

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

Data Structures

struct  edt_msg_handler_s
 

Macros

#define EDTAPP_MSG_FATAL   0x1
 
#define EDTAPP_MSG_WARNING   0x2
 
#define EDTAPP_MSG_INFO_1   0x4
 
#define EDTAPP_MSG_INFO_2   0x8
 
#define EDTLIB_MSG_FATAL   0x10
 
#define EDTLIB_MSG_WARNING   0x20
 
#define EDTLIB_MSG_INFO_1   0x40
 
#define EDTLIB_MSG_INFO_2   0x80
 
#define PDVLIB_MSG_FATAL   0x100
 
#define PDVLIB_MSG_WARNING   0x200
 
#define PDVLIB_MSG_INFO_1   0x400
 
#define PDVLIB_MSG_INFO_2   0x800
 

Typedefs

typedef int(* EdtMsgFunction) (void *target, int level, const char *message)
 An EdtMsgFunction is a function which outputs a message if that message's level is high enough. More...
 
typedef struct edt_msg_handler_s EdtMsgHandler
 

Functions

void edt_msg_init (EdtMsgHandler *msg_p)
 Initializes a message handler with default values. The message file is initialized to stderr. The output subroutine pointer is set to fprintf (to write output to the console). The message level is set to EDT_MSG_WARNING | EDT_MSG_FATAL. More...
 
void edt_msg_init_file (EdtMsgHandler *msg_p, FILE *file, int level)
 Initializes a message handler to use the specified file and level. This takes a pointer to a FILE which has been opened by the caller. More...
 
void edt_msg_close (EdtMsgHandler *msg_p)
 Closes and frees up memory associated with a message handler. Use only on message handlers that have been explicitly initialized by edt_msg_init. Do not try to close the default message handler. If the message handler has been configured to use a file which the user opened, through functions such as edt_msg_init_file or edt_msg_set_file, then the user is responsible for closing that file after calling this function. More...
 
void edt_msg_set_level (EdtMsgHandler *msg_p, int newlevel)
 Sets the "message level" flag bits that determine whether to call the message handler for a given message. The flags set by this function are ANDed with the flags set in each edt_msg call, to determine whether the call goes to the message function and actually results in any output. More...
 
int edt_msg_get_level (EdtMsgHandler *msg_p)
 Gets the message level that messages must match in order to be handled by the message handler msg_p. The level is a combination of flags OR'ed together as described in the overview. More...
 
void edt_msg_set_function (EdtMsgHandler *msg_p, EdtMsgFunction f)
 Sets the function to call when a message event occurs. The default message function is fprintf() (which outputs to stderr); this routine allows programmers to substitute any type of message handler (pop-up callback, file write, etc). More...
 
void edt_msg_set_file (EdtMsgHandler *msg_p, FILE *f)
 Sets the output file pointer for the message handler. More...
 
void edt_msg_set_target (EdtMsgHandler *msg_p, void *t)
 Sets the target in the message handler. More...
 
void edt_msg_set_name (EdtMsgHandler *msg_p, const char *name)
 Sets the output file to the named file. More...
 
int edt_msg (int level, const char *format,...)
 Submits a message to the default message handler, which will conditionally (based on the flag bits) send the message to the default message handler function. This function uses the default message handler, and is equivalent to calling edt_msg_output(edt_msg_default_handle(), ...). To submit a message for handling by other than the default message handle, use edt_msg_output. More...
 
int edt_msg_output (EdtMsgHandler *msg_p, int level, const char *format,...)
 
int edt_msg_perror (int level, const char *msg)
 Conditionally outputs a system perror using the default message handler. More...
 
int edt_msg_output_perror (EdtMsgHandler *msg_p, int level, const char *message)
 Conditionally (based on the flag bits) outputs message, followed by the last system error message, to msg_p. More...
 
int edt_msg_output_printf_perror (EdtMsgHandler *msg_p, int level, const char *format,...)
 Writes to the specified EdtMsgHandler a caller-specified message (in the printf-style format) followed by the last system error message. More...
 
EdtMsgHandleredt_msg_default_handle (void)
 Gets the default message handler. More...
 
int edt_msg_default_level (void)
 Gets the message level that messages must match in order to be handled by the default message handler. The level is a combination of flags OR'ed together as described in the overview. More...
 
char * edt_msg_last_error (void)
 Returns pointer to most recent msg string. More...
 
void edt_set_verbosity (int verbose)
 Simple verbose level setting output message simplified - levels 0 - 3. More...
 
int edt_get_verbosity (void)
 Return simple verbose level setting.
 

Detailed Description

Generalized error handling for edt and pdv libraries (header file)