Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
statusMessageReporting.c
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include <stdio.h>
11#include <stdlib.h>
12#include <string.h>
13#include <stdarg.h>
14
16
17#define SMR_InitialMessageSize 1024
18#define SMR_IncrementMessageSize 1024
19
20static int smrIsSetup = 0;
21static char smr_mallocFailed[] = "statusMessageReporting could not allocate memory for message";
22static char statusStringOk[] = "Ok", statusStringInfo[] = "Info",
23 statusStringWarning[] = "Warning", statusStringError[] = "Error", statusStringInvalid[] = "Invalid";
24
25static int numberOfRegisteredLibraries = 0;
26static char unknownLibrary[] = "unknownID";
27static char tooManyLibrary[] = "tooManyIDs";
28static char invalidLibrary[] = "invalidID";
29static char errnoLibrary[] = "errnoID";
30static char smrLibrary[] = "statusMessageReporting";
31static char *registeredLibraries[smr_maximumNumberOfRegisteredLibraries];
32
33static statusMessageReport *smr_reportNew( void );
34static int smr_reportInitialize( statusMessageReport *report );
35static void smr_reportRelease( statusMessageReport *report );
36static int smr_setReport( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code,
37 enum smr_status status, char const *fmt, va_list *args );
38static int smr_setAllocationFailure( statusMessageReport *report, char const *file, int line, char const *function, char const *fmt, va_list *args );
39static statusMessageReport *smr_firstReport2( statusMessageReporting const *smr );
41static void smr_write2( statusMessageReport const *report, FILE *f );
42/*
43============================================================
44*/
45int smr_setup( void ) {
46
47 int i;
48
49 if( smrIsSetup ) return( 0 );
50 smrIsSetup = 1;
51 for( i = 0; i < smr_maximumNumberOfRegisteredLibraries; ++i ) registeredLibraries[i] = NULL;
52 registeredLibraries[smr_unknownID] = unknownLibrary;
53 ++numberOfRegisteredLibraries;
54 registeredLibraries[smr_tooManyIDs] = tooManyLibrary;
55 ++numberOfRegisteredLibraries;
56 registeredLibraries[smr_invalidID] = invalidLibrary;
57 ++numberOfRegisteredLibraries;
58 registeredLibraries[smr_errnoID] = errnoLibrary;
59 ++numberOfRegisteredLibraries;
60 registeredLibraries[smr_smrID] = smrLibrary;
61 ++numberOfRegisteredLibraries;
62 return( 1 );
63}
64/*
65============================================================
66*/
67int smr_cleanup( void ) {
68
69 int i;
70
71 if( smrIsSetup == 0 ) return( 0 );
72 for( i = smr_smrID + 1; i < numberOfRegisteredLibraries; ++i ) smr_freeMemory( (void **) &(registeredLibraries[i]) );
73 numberOfRegisteredLibraries = 0;
74 smrIsSetup = 0;
75
76 return( 0 );
77}
78/*
79============================================================
80*/
81int smr_registerLibrary( char const *libraryName ) {
82
83 int i;
84
85 if( smrIsSetup == 0 ) smr_setup( );
86 for( i = 0; i < numberOfRegisteredLibraries; ++i ) { /* Check if name is already registered. */
87 if( strcmp( libraryName, registeredLibraries[i] ) == 0 ) return( i );
88 }
89 if( numberOfRegisteredLibraries == smr_maximumNumberOfRegisteredLibraries ) return( smr_tooManyIDs );
90 if( ( registeredLibraries[numberOfRegisteredLibraries] = strdup( libraryName ) ) == NULL ) return( -1 );
91 ++numberOfRegisteredLibraries;
92 return( numberOfRegisteredLibraries - 1 );
93}
94/*
95============================================================
96*/
98
99 return( numberOfRegisteredLibraries );
100}
101/*
102============================================================
103*/
104char const *smr_getRegisteredLibrarysName( int ID ) {
105
106 if( ( ID < 0 ) || ( ID >= smr_maximumNumberOfRegisteredLibraries ) ) return( NULL );
107 return( registeredLibraries[ID] );
108}
109/*
110============================================================
111*/
113
114 statusMessageReporting *new_SMR;
115
116 if( ( new_SMR = (statusMessageReporting *) smr_malloc2( smr, sizeof( statusMessageReporting ), 0, "new_SMR" ) ) == NULL ) return( NULL );
117 smr_initialize( new_SMR, verbosity );
118 return( new_SMR );
119}
120/*
121============================================================
122*/
124
125 if( smr == NULL ) return( 0 );
126 smr->verbosity = verbosity;
127 smr_reportInitialize( &(smr->report) );
128 return( 0 );
129}
130/*
131============================================================
132*/
134
135 if( smr == NULL ) return( NULL );
136 return( smr_new( NULL, smr->verbosity ) );
137}
138/*
139============================================================
140*/
142
143 statusMessageReport *current, *next, *first = smr_firstReport2( smr );
144
145 if( smr == NULL ) return;
146 for( current = first; current != NULL; current = next ) {
147 next = smr_nextReport2( current );
148 smr_reportRelease( current );
149 if( current != first ) smr_freeMemory( (void **) &current );
150 }
151 smr_initialize( smr, smr->verbosity );
152}
153/*
154============================================================
155*/
157
158 if( smr == NULL ) return( NULL );
159 if( *smr != NULL ) {
160 smr_release( *smr );
161 smr_freeMemory( (void **) smr );
162 }
163 return( *smr );
164}
165/*
166============================================================
167*/
168static statusMessageReport *smr_reportNew( void ) {
169
170 statusMessageReport *report;
171
172 if( ( report = (statusMessageReport *) smr_malloc2( NULL, sizeof( statusMessageReport ), 0, "report" ) ) == NULL ) return( NULL );
173 smr_reportInitialize( report );
174 return( report );
175}
176/*
177============================================================
178*/
179static int smr_reportInitialize( statusMessageReport *report ) {
180
181 report->next = NULL;
182 report->status = smr_status_Ok;
183 report->libraryID = smr_unknownID;
184 report->code = smr_codeNULL;
185 report->line = -1;
186 report->fileName[0] = 0;
187 report->function[0] = 0;
188 report->message = NULL;
189 return( 0 );
190}
191/*
192============================================================
193*/
194static void smr_reportRelease( statusMessageReport *report ) {
195
196 if( report->message != NULL ) {
197 if( report->message != smr_mallocFailed ) smr_freeMemory( (void **) &(report->message) );
198 }
199 smr_reportInitialize( report );
200}
201/*
202============================================================
203*/
204static int smr_setReport( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code,
205 enum smr_status status, char const *fmt, va_list *args ) {
206
207 char *userMsg;
208 statusMessageReport *report, *next;
209
210 if( smr == NULL ) return( 0 );
211 if( (int) status < (int) smr->verbosity ) return( 0 );
212 if( status == smr_status_Ok ) return( 0 );
213 if( smr->report.status == smr_status_Ok ) {
214 report = &smr->report; }
215 else {
216 if( ( report = smr_reportNew( ) ) == NULL ) return( smr_setAllocationFailure( NULL, file, line, function, fmt, args ) );
217 for( next = smr_firstReport2( smr ); next->next != NULL; next = next->next );
218 next->next = report;
219 }
220 report->status = status;
221 if( ( libraryID < 0 ) || ( libraryID >= numberOfRegisteredLibraries ) ) libraryID = smr_invalidID;
222 report->libraryID = libraryID;
223 report->code = code;
224 report->line = line;
225 if( file != NULL ) strncpy( report->fileName, file, smr_maximumFileNameSize );
227 if( function != NULL ) strncpy( report->function, function, smr_maximumFileNameSize );
229
230 if( ( report->message = smr_vallocateFormatMessage( fmt, args ) ) == NULL ) return( smr_setAllocationFailure( report, file, line, function, fmt, args ) );
231 if( userInterface != NULL ) {
232 if( ( userMsg = (*(smr_userInterface *) userInterface)( (void *) userInterface ) ) != NULL ) {
233 int userSize = (int) strlen( userMsg );
234 if( ( report->message = (char *) smr_realloc2( NULL, report->message, strlen( report->message ) + userSize + 2, "report->message" ) ) == NULL ) {
235 free( userMsg );
236 return( smr_setAllocationFailure( report, file, line, function, fmt, args ) );
237 }
238 strcat( report->message, userMsg );
239 free( userMsg );
240 }
241 }
242 return( 0 );
243}
244/*
245============================================================
246*/
247static int smr_setAllocationFailure( statusMessageReport *report, char const *file, int line, char const *function, char const *fmt, va_list *args ) {
248
249 vfprintf( stderr, fmt, *args );
250 va_end( *args );
251 fprintf( stderr, "\n At line %d of %s in function %s\n", line, file, function );
252 if( report != NULL ) {
253 report->status = smr_status_Error;
254 report->message = (char *) smr_mallocFailed;
255 return( 1 );
256 }
257 return( -1 );
258}
259/*
260============================================================
261*/
262int smr_setReportInfo( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, ... ) {
263
264 int status;
265 va_list args;
266
267 va_start( args, fmt );
268 status = smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Info, fmt, &args );
269 va_end( args );
270 return( status );
271}
272/*
273============================================================
274*/
275int smr_vsetReportInfo( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args ) {
276
277 return( smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Info, fmt, args ) );
278}
279/*
280============================================================
281*/
282int smr_setReportWarning( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, ... ) {
283
284 int status;
285 va_list args;
286
287 va_start( args, fmt );
288 status = smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Warning, fmt, &args );
289 va_end( args );
290 return( status );
291}
292/*
293============================================================
294*/
295int smr_vsetReportWarning( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args ) {
296
297 return( smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Warning, fmt, args ) );
298}
299/*
300============================================================
301*/
302int smr_setReportError( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, ... ) {
303
304 int status;
305 va_list args;
306
307 va_start( args, fmt );
308 status = smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Error, fmt, &args );
309 va_end( args );
310 return( status );
311}
312/*
313============================================================
314*/
315int smr_vsetReportError( statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt, va_list *args ) {
316
317 return( smr_setReport( smr, userInterface, file, line, function, libraryID, code, smr_status_Error, fmt, args ) );
318}
319/*
320============================================================
321*/
323
324 enum smr_status status = smr_status_Ok;
325 statusMessageReport const *report;
326
327 if( smr == NULL ) return( smr_status_Ok );
328 for( report = smr_firstReport( smr ); report != NULL; report = smr_nextReport( report ) ) if( report->status > status ) status = report->status;
329 return( status );
330}
331/*
332============================================================
333*/
335
336 return( smr_highestStatus( smr ) == smr_status_Ok );
337}
338/*
339============================================================
340*/
342
343 return( smr_highestStatus( smr ) == smr_status_Info );
344}
345/*
346============================================================
347*/
349
350 return( smr_highestStatus( smr ) == smr_status_Warning );
351}
352/*
353============================================================
354*/
356
357 return( smr_highestStatus( smr ) == smr_status_Error );
358}
359/*
360============================================================
361*/
363
364 enum smr_status status = smr_highestStatus( smr );
365
366 return( ( status == smr_status_Warning ) || ( status == smr_status_Error ) );
367}
368/*
369============================================================
370*/
371int smr_isReportOk( statusMessageReport const *report ) {
372
373 if( report == NULL ) return( 0 );
374 return( report->status == smr_status_Ok );
375}
376/*
377============================================================
378*/
380
381 if( report == NULL ) return( 0 );
382 return( report->status == smr_status_Info );
383}
384/*
385============================================================
386*/
388
389 if( report == NULL ) return( 0 );
390 return( report->status == smr_status_Warning );
391}
392/*
393============================================================
394*/
396
397 if( report == NULL ) return( 0 );
398 return( report->status == smr_status_Error );
399}
400/*
401============================================================
402*/
404
405 if( report == NULL ) return( 0 );
406 return( ( report->status == smr_status_Warning ) || ( report->status == smr_status_Error ) );
407}
408/*
409============================================================
410*/
412
413 int n = 0;
414 statusMessageReport const *report;
415
416 if( smr == NULL ) return( 0 );
417 if( smr->report.status == smr_status_Ok ) return( 0 );
418 for( report = smr_firstReport( smr ); report != NULL; report = smr_nextReport( report ) ) ++n;
419 return( n );
420}
421/*
422============================================================
423*/
425
426 return( (statusMessageReport const *) smr_firstReport2( smr ) );
427}
428/*
429============================================================
430*/
431static statusMessageReport *smr_firstReport2( statusMessageReporting const *smr ) {
432
433 if( smr == NULL ) return( NULL );
434 if( smr->report.status == smr_status_Ok ) return( NULL );
435 return( &(((statusMessageReporting *) smr)->report) );
436}
437/*
438============================================================
439*/
441
442 return( smr_nextReport2( report ) );
443}
444/*
445============================================================
446*/
448
449 if( report == NULL ) return( NULL );
450 return( report->next );
451}
452/*
453============================================================
454*/
456
457 if( smr == NULL ) return( smr_status_Ok );
458 return( smr->verbosity );
459}
460/*
461============================================================
462*/
464
465 if( report == NULL ) return( 0 );
466 return( report->libraryID );
467}
468/*
469============================================================
470*/
471int smr_getCode( statusMessageReport const *report ) {
472
473 if( report == NULL ) return( -1 );
474 return( report->code );
475}
476/*
477============================================================
478*/
479int smr_getLine( statusMessageReport const *report ) {
480
481 if( report == NULL ) return( -1 );
482 return( report->line );
483}
484/*
485============================================================
486*/
487char const *smr_getFile( statusMessageReport const *report ) {
488
489 if( report == NULL ) return( NULL );
490 return( report->fileName );
491}
492/*
493============================================================
494*/
495char const *smr_getFunction( statusMessageReport const *report ) {
496
497 if( report == NULL ) return( NULL );
498 return( report->function );
499}
500/*
501============================================================
502*/
503char const *smr_getMessage( statusMessageReport const *report ) {
504
505 if( report == NULL ) return( NULL );
506 return( report->message );
507}
508/*
509============================================================
510*/
511char *smr_copyMessage( statusMessageReport const *report ) {
512
513 if( report == NULL ) return( NULL );
514 if( report->status == smr_status_Ok ) return( NULL );
515 return( smr_allocateFormatMessage( report->message ) );
516}
517/*
518============================================================
519*/
521
522 if( report == NULL ) return( NULL );
523 if( report->status == smr_status_Ok ) return( NULL );
524 return( smr_allocateFormatMessage( "%s\n At line %d of %s in function %s", report->message, report->line, report->fileName, report->function ) );
525}
526/*
527============================================================
528*/
529void smr_print( statusMessageReporting *smr, int clear ) {
530
531 smr_write( smr, stdout, clear );
532}
533/*
534============================================================
535*/
536void smr_write( statusMessageReporting *smr, FILE *f, int clear ) {
537
538 if( smr == NULL ) return;
539 fprintf( f, "======= Status message reports =======\n" );
540 smr_write2( smr_firstReport( smr ), f );
541 if( clear ) smr_release( smr );
542}
543/*
544============================================================
545*/
546static void smr_write2( statusMessageReport const *report, FILE *f ) {
547
548 if( report == NULL ) return;
549
550 smr_write2( smr_nextReport( report ), f );
551 smr_reportWrite( report, f );
552}
553/*
554============================================================
555*/
557
558 smr_reportWrite( report, stdout );
559}
560/*
561============================================================
562*/
563void smr_reportWrite( statusMessageReport const *report, FILE *f ) {
564
565 if( report->message != NULL ) fprintf( f, "%s\n At line %d of %s in function %s\n", report->message, report->line, report->fileName, report->function );
566}
567/*
568============================================================
569*/
570char const *smr_statusToString( enum smr_status status ) {
571
572 switch( status ) {
573 case smr_status_Ok : return( statusStringOk );
574 case smr_status_Info : return( statusStringInfo );
575 case smr_status_Warning : return( statusStringWarning );
576 case smr_status_Error : return( statusStringError );
577 }
578 return( statusStringInvalid );
579}
580/*
581============================================================
582*/
583char *smr_allocateFormatMessage( char const *fmt, ... ) {
584
585 char *s;
586 va_list args;
587
588 va_start( args, fmt );
589 s = smr_vallocateFormatMessage( fmt, &args );
590 va_end( args );
591 return( s );
592}
593/*
594============================================================
595*/
596char *smr_vallocateFormatMessage( char const *fmt, va_list *args ) {
597
598 int n, size = SMR_InitialMessageSize;
599 char buffer[SMR_InitialMessageSize], *message = buffer;
600 va_list args_;
601
602 while( 1 ) {
603 va_copy( args_, *args );
604 n = vsnprintf( message, size, fmt, args_ );
605 va_end( args_ );
606 if( ( n > -1 ) && ( n < size ) ) break;
607 if( n > -1 ) { /* glibc 2.1 */
608 size = n + 3; }
609 else { /* glibc 2.0 */
610 size *= 2;
611 }
612 if( message == buffer ) message = NULL;
613 if( ( message = (char *) realloc( message, size ) ) == NULL ) return( NULL );
614 }
615 if( message == buffer ) {
616 if( ( message = (char *) malloc( n + 1 ) ) == NULL ) return( NULL );
617 strcpy( message, buffer ); }
618 else {
619 char *old = message;
620 if( ( message = (char *) realloc( message, n + 1 ) ) == NULL ) {
621 if( old != NULL ) free( old );
622 }
623 }
624 return( message );
625}
626/*
627============================================================
628*/
629void *smr_malloc( statusMessageReporting *smr, size_t size, int zero, char const *forItem, char const *file, int line, char const *function ) {
630
631 void *p = smr_realloc( smr, NULL, size, forItem, file, line, function );
632 size_t i;
633 char *c;
634 long long *l;
635
636 if( ( p != NULL ) && zero ) {
637 for( i = 0, l = (long long *) p; i < size / sizeof( long long ); i++, l++ ) *l = 0;
638 for( i *= sizeof( long long ), c = (char *) l; i < size; i++, c++ ) *c = 0;
639 }
640
641 return( p );
642}
643/*
644============================================================
645*/
646void *smr_realloc( statusMessageReporting *smr, void *pOld, size_t size, char const *forItem, char const *file, int line, char const *function ) {
647
648 void *p = realloc( pOld, size );
649
650 if( ( p == NULL ) && ( smr != NULL ) ) {
651 smr_setReportError( smr, NULL, file, line, function, smr_smrID, smr_codeMemoryAllocating, " smr_realloc: failed to realloc size = %z for variable %s\n", size, forItem );
652 }
653 return( p );
654}
655/*
656============================================================
657*/
658void *smr_freeMemory( void **p ) {
659
660 if( p == NULL ) return( NULL );
661 if( *p != NULL ) {
662 free( *p );
663 *p = NULL;
664 }
665 return( *p );
666}
667/*
668============================================================
669*/
670char *smr_allocateCopyString( statusMessageReporting *smr, char const *s, char const *forItem, char const *file, int line, char const *function ) {
671/*
672* User must free returned string.
673*/
674 char *c = strdup( s );
675
676 if( c == NULL ) smr_setReportError( smr, NULL, file, line, function, smr_smrID, smr_codeMemoryAllocating, " smr_allocateCopyString: strdup failed for strlen( s ) = %z for variable %s",
677 strlen( s ), forItem );
678 return( c );
679}
680/*
681============================================================
682*/
683char *smr_allocateCopyStringN( statusMessageReporting *smr, char const *s, size_t n, char const *forItem, char const *file, int line, char const *function ) {
684/*
685* User must free returned string.
686*/
687 size_t l = strlen( s );
688 char *c;
689
690 if( l > n ) l = n;
691 if( ( c = (char *) smr_malloc( smr, l + 1, 0, forItem, file, line, function ) ) != NULL ) {
692 strncpy( c, s, n );
693 c[l] = 0;
694 }
695/*
696 c = strndup( s, l ); # Not standard on enough systems.
697 if( c != NULL ) {
698 c[l] = 0; }
699 else {
700 smr_setReportError( smr, NULL, file, line, function, smr_smrID, smr_codeMemoryAllocating, " smr_allocateCopyStringN: strndup failed for strlen( s ) = %z for variable %s",
701 strlen( s ), forItem );
702 }
703*/
704 return( c );
705}
G4double(*)(G4double) function
void free(voidpf ptr)
voidp malloc(uInt size)
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)
statusMessageReporting * smr_clone(statusMessageReporting const *smr)
int smr_registerLibrary(char const *libraryName)
char * smr_allocateCopyString(statusMessageReporting *smr, char const *s, char const *forItem, char const *file, int line, char const *function)
int smr_getLine(statusMessageReport const *report)
char const * smr_getRegisteredLibrarysName(int ID)
int smr_isReportInfo(statusMessageReport const *report)
char * smr_vallocateFormatMessage(char const *fmt, va_list *args)
int smr_setup(void)
int smr_isReportWarning(statusMessageReport const *report)
char * smr_copyMessage(statusMessageReport const *report)
int smr_getLibraryID(statusMessageReport const *report)
void * smr_realloc(statusMessageReporting *smr, void *pOld, size_t size, char const *forItem, char const *file, int line, char const *function)
char const * smr_getFunction(statusMessageReport const *report)
void smr_reportWrite(statusMessageReport const *report, FILE *f)
int smr_getCode(statusMessageReport const *report)
int smr_initialize(statusMessageReporting *smr, enum smr_status verbosity)
statusMessageReport const * smr_firstReport(statusMessageReporting const *smr)
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,...)
char const * smr_getMessage(statusMessageReport const *report)
void smr_print(statusMessageReporting *smr, int clear)
char const * smr_getFile(statusMessageReport const *report)
int smr_isInfo(statusMessageReporting const *smr)
enum smr_status smr_highestStatus(statusMessageReporting const *smr)
#define SMR_InitialMessageSize
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)
int smr_numberOfReports(statusMessageReporting const *smr)
void * smr_freeMemory(void **p)
int smr_isReportWarningOrError(statusMessageReport const *report)
void smr_write(statusMessageReporting *smr, FILE *f, int clear)
void * smr_malloc(statusMessageReporting *smr, size_t size, int zero, char const *forItem, char const *file, int line, char const *function)
void smr_reportPrint(statusMessageReport const *report)
enum smr_status smr_getVerbosity(statusMessageReporting const *smr)
int smr_setReportInfo(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
int smr_isWarningOrError(statusMessageReporting const *smr)
int smr_setReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
statusMessageReport * smr_nextReport2(statusMessageReport const *report)
int smr_cleanup(void)
int smr_isReportError(statusMessageReport const *report)
statusMessageReporting * smr_new(statusMessageReporting *smr, enum smr_status verbosity)
void smr_release(statusMessageReporting *smr)
int smr_isOk(statusMessageReporting const *smr)
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)
statusMessageReport const * smr_nextReport(statusMessageReport const *report)
char * smr_copyFullMessage(statusMessageReport const *report)
int smr_isReportOk(statusMessageReport const *report)
int smr_isWarning(statusMessageReporting const *smr)
int smr_isError(statusMessageReporting const *smr)
char * smr_vallocateFormatMessage(char const *fmt, va_list *args)
#define smr_maximumFileNameSize
#define smr_realloc2(smr, old, size, forItem)
#define smr_tooManyIDs
#define smr_errnoID
char *(* smr_userInterface)(void *userData)
#define smr_smrID
#define smr_maximumNumberOfRegisteredLibraries
#define smr_codeNULL
@ smr_status_Warning
@ smr_status_Error
@ smr_status_Info
#define smr_malloc2(smr, size, zero, forItem)
#define smr_codeMemoryAllocating
#define smr_unknownID
#define smr_invalidID
char function[smr_maximumFileNameSize+1]
struct statusMessageReport * next
char fileName[smr_maximumFileNameSize+1]