1#ifndef statusMessageReporting_h_included
2#define statusMessageReporting_h_included
8#define __func__ __FUNCTION__
11#if defined __cplusplus
16#define smr_unknownID 0
17#define smr_tooManyIDs 1
18#define smr_invalidID 2
22#define smr_maximumNumberOfRegisteredLibraries 128
23#define smr_maximumFileNameSize 1024
25#define smr_codeFileIO -1
26#define smr_codeMemoryAllocating -2
28typedef char *(*smr_userInterface)(
void *userData );
111#define smr_malloc2( smr, size, zero, forItem ) smr_malloc( smr, size, zero, forItem, __FILE__, __LINE__, __func__ )
112#define smr_realloc2( smr, old, size, forItem ) smr_realloc( smr, old, size, forItem, __FILE__, __LINE__, __func__ )
113#define smr_allocateCopyString2( smr, s, forItem ) smr_allocateCopyString( smr, s, forItem, __FILE__, __LINE__, __func__ )
114#define smr_allocateCopyStringN2( smr, s, n, forItem ) smr_allocateCopyStringN( smr, s, n, forItem, __FILE__, __LINE__, __func__ )
116#define smr_setReportInfo2( smr, libraryID, code, fmt, ... ) smr_setReportInfo( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
117#define smr_setReportInfo2p( smr, libraryID, code, fmt ) smr_setReportInfo( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt )
118#define smr_vsetReportInfo2( smr, libraryID, code, fmt, args ) smr_vsetReportInfo( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
119#define smr_setReportWarning2( smr, libraryID, code, fmt, ... ) smr_setReportWarning( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
120#define smr_setReportWarning2p( smr, libraryID, code, fmt ) smr_setReportWarning( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt )
121#define smr_vsetReportWarning2( smr, libraryID, code, fmt, args ) smr_vsetReportWarning( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
122#define smr_setReportError2( smr, libraryID, code, fmt, ... ) smr_setReportError( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
123#define smr_setReportError2p( smr, libraryID, code, fmt ) smr_setReportError( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt )
124#define smr_vsetReportError2( smr, libraryID, code, fmt, args ) smr_vsetReportError( smr, NULL, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
126#define smr_setReportInfo3( smr, userInterface, libraryID, code, fmt, ... ) smr_setReportInfo( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
127#define smr_setReportInfo3p( smr, userInterface, libraryID, code, fmt ) smr_setReportInfo( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt )
128#define smr_vsetReportInfo3( smr, userInterface, libraryID, code, fmt, args ) smr_vsetReportInfo( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
129#define smr_setReportWarning3( smr, userInterface, libraryID, code, fmt, ... ) smr_setReportWarning( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
130#define smr_setReportWarning3p( smr, userInterface, libraryID, code, fmt ) smr_setReportWarning( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt )
131#define smr_vsetReportWarning3( smr, userInterface, libraryID, code, fmt, args ) smr_vsetReportWarning( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
132#define smr_setReportError3( smr, userInterface, libraryID, code, fmt, ... ) smr_setReportError( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, __VA_ARGS__ )
133#define smr_setReportError3p( smr, userInterface, libraryID, code, fmt ) smr_setReportError( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt )
134#define smr_vsetReportError3( smr, userInterface, libraryID, code, fmt, args ) smr_vsetReportError( smr, userInterface, __FILE__, __LINE__, __func__, libraryID, code, fmt, args )
136#if defined __cplusplus
G4double(*)(G4double) function
int smr_vsetReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args)
int smr_registerLibrary(char const *libraryName)
char * smr_copyMessage(statusMessageReport *report)
int smr_isInfo(statusMessageReporting *smr)
int smr_initialize(statusMessageReporting *smr, enum smr_status verbosity, int append)
char * smr_allocateCopyString(statusMessageReporting *smr, char const *s, char const *forItem, char const *file, int line, char const *function)
char * smr_vallocateFormatMessage(char const *fmt, va_list *args)
int smr_isError(statusMessageReporting *smr)
int smr_isReportOk(statusMessageReport *report)
char * smr_copyFullMessage(statusMessageReport *report)
int smr_isReportWarningOrError(statusMessageReport *report)
int smr_getAppend(statusMessageReporting *smr)
statusMessageReport * smr_nextReport(statusMessageReport *report)
int smr_isReportWarning(statusMessageReport *report)
#define smr_maximumFileNameSize
char const * smr_getFile(statusMessageReport *report)
statusMessageReporting * smr_new(statusMessageReporting *smr, enum smr_status verbosity, int append)
int smr_numberOfReports(statusMessageReporting *smr)
void * smr_realloc(statusMessageReporting *smr, void *pOld, size_t size, char const *forItem, char const *file, int line, char const *function)
int smr_isWarningOrError(statusMessageReporting *smr)
statusMessageReporting * smr_clone(statusMessageReporting *smr)
statusMessageReport * smr_firstReport(statusMessageReporting *smr)
enum smr_status smr_highestStatus(statusMessageReporting *smr)
int smr_getLibraryID(statusMessageReport *report)
int smr_vsetReportInfo(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args)
void * smr_free(statusMessageReporting **smr)
int smr_setReportWarning(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
void smr_print(statusMessageReporting *smr, int clear)
int smr_isReportInfo(statusMessageReport *report)
char const * smr_getMessage(statusMessageReport *report)
int smr_vsetReportWarning(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args)
char const * smr_statusToString(enum smr_status status)
void * smr_freeMemory(void **p)
char const * smr_getRegisteredLibrariesName(int ID)
int smr_isWarning(statusMessageReporting *smr)
void smr_write(statusMessageReporting *smr, FILE *f, int clear)
int smr_getLine(statusMessageReport *report)
void smr_reportWrite(statusMessageReport *report, FILE *f)
void * smr_malloc(statusMessageReporting *smr, size_t size, int zero, char const *forItem, char const *file, int line, char const *function)
int smr_setReportInfo(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
int smr_setReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
enum smr_status smr_getVerbosity(statusMessageReporting *smr)
void smr_release(statusMessageReporting *smr)
int smr_isOk(statusMessageReporting *smr)
void smr_reportPrint(statusMessageReport *report)
char * smr_allocateFormatMessage(char const *fmt,...)
char * smr_allocateCopyStringN(statusMessageReporting *smr, char const *s, size_t n, char const *forItem, char const *file, int line, char const *function)
int smr_numberOfRegisteredLibraries(void)
int smr_getCode(statusMessageReport *report)
char const * smr_getFunction(statusMessageReport *report)
int smr_isReportError(statusMessageReport *report)
struct statusMessageReport * next
enum smr_status verbosity
statusMessageReport report