43 #if defined __cplusplus
48 static const char smr_mallocFailed[] =
"statusMessageReporting could not allocate memory for message";
52 enum smr_status status,
const char *fmt, va_list *args );
53 static char *smr_getFullMessage2(
char const *fmt, ... );
84 va_start( args, fmt );
85 status = smr_setMessage( smr, userInterface, file, line, code,
smr_status_Info, fmt, &args );
94 int status = smr_setMessage( smr, userInterface, file, line, code,
smr_status_Info, fmt, args );
105 va_start( args, fmt );
106 status = smr_setMessage( smr, userInterface, file, line, code,
smr_status_Error, fmt, &args );
115 int status = smr_setMessage( smr, userInterface, file, line, code,
smr_status_Error, fmt, args );
126 va_start( args, fmt );
137 char *message = NULL;
141 if( ( message = (
char *) realloc( message, size ) ) == NULL )
return( NULL );
145 #elif defined __IBMCPP__
146 va_copy( args_, *args );
148 __va_copy( args_, *args );
150 n = vsnprintf( message, size, fmt, args_ );
152 if( ( n > -1 ) && ( n < size ) )
break;
165 enum smr_status status,
const char *fmt, va_list *args ) {
167 char *userMsg = NULL;
170 if( smr == NULL )
return( 0 );
179 if( userInterface != NULL ) {
180 if( ( userSize = (*(
smr_userInterface *) userInterface)( (
void *) userInterface, NULL ) ) > 0 ) {
182 if( (smr->
message = (
char*) realloc(smr->
message, strlen( smr->
message ) + userSize + 2)) == NULL )
return( smr_setAllocationFailure( smr, fmt, args ) );
184 userSize = (*(
smr_userInterface *) userInterface)( (
void *) userInterface, &userMsg );
185 if( userSize < 0 )
return( smr_setAllocationFailure( smr, fmt, args ) );
187 strcat( smr->
message, userMsg );
199 vfprintf( stderr, fmt, *args );
200 fprintf( stderr,
"\nAt line %d of %s\n", smr->
line, smr->
packageName );
202 smr->
message = (
char *) smr_mallocFailed;
210 if( smr == NULL )
return( 1 );
218 if( smr == NULL )
return( 1 );
226 if( smr == NULL )
return( 1 );
234 if( smr == NULL )
return( 1 );
254 static char *smr_getFullMessage2(
char const *fmt, ... ) {
259 va_start( args, fmt );
273 #if defined __cplusplus