37 #define va_copy(dest, src) do { BMScopyMemory(&dest, &src); } while( 0 ) 41 #if defined(_WIN32) || defined(_WIN64) 42 #define snprintf _snprintf 43 #define vsnprintf _vsnprintf 62 assert( messagehdlr != NULL );
63 assert( outputfunc != NULL );
64 assert( !usefile2 || file2 != NULL );
65 assert( buffer == NULL || bufferlen != NULL );
74 outputfunc(messagehdlr, file1, msg);
76 outputfunc(messagehdlr, file2, msg);
80 assert(bufferlen != NULL);
86 assert( buffer[*bufferlen] ==
'\0' );
88 outputfunc(messagehdlr, file1, buffer);
90 outputfunc(messagehdlr, file2, buffer);
95 assert( msg != NULL && buffer != NULL );
98 if ( ! usefile1 && ! usefile2 )
109 buffer[(*bufferlen)++] = *(s++);
110 buffer[*bufferlen] =
'\0';
113 outputfunc(messagehdlr, file1, buffer);
115 outputfunc(messagehdlr, file2, buffer);
120 buffer[(*bufferlen)++] = *(s++);
122 buffer[*bufferlen] =
'\0';
154 if( staticErrorPrinting != NULL )
155 staticErrorPrinting(staticErrorPrintingData, file, msg);
165 if ( messagehdlr != NULL && messagehdlr->messagewarning != NULL && (! messagehdlr->
quiet || messagehdlr->
logfile != NULL) )
180 if ( messagehdlr != NULL && messagehdlr->messagedialog != NULL )
182 if ( (file == NULL || file == stdout) && ! messagehdlr->
quiet )
187 else if ( msg != NULL )
192 handleMessage(messagehdlr, messagehdlr->messagedialog, file, !messagehdlr->
quiet || (file != NULL && file != stdout), messagehdlr->
logfile, (messagehdlr->
logfile != NULL), msg, NULL, NULL);
206 if ( messagehdlr != NULL && messagehdlr->messageinfo != NULL )
208 if ( (file == NULL || file == stdout) && ! messagehdlr->
quiet )
213 else if ( msg != NULL )
218 handleMessage(messagehdlr, messagehdlr->messagedialog, file, !messagehdlr->
quiet || (file != NULL && file != stdout), messagehdlr->
logfile, (messagehdlr->
logfile != NULL), msg, NULL, NULL);
231 if( filename != NULL )
233 messagehdlr->
logfile = fopen(filename,
"a");
235 if( messagehdlr->
logfile == NULL )
250 assert(messagehdlr != NULL);
252 if( *messagehdlr != NULL )
259 if( (*messagehdlr)->messagehdlrfree != NULL )
262 SCIP_CALL( (*messagehdlr)->messagehdlrfree(*messagehdlr) );
266 if( (*messagehdlr)->logfile != NULL )
268 fclose((*messagehdlr)->logfile);
288 const char* filename,
298 (*messagehdlr)->messagewarning = messagewarning;
299 (*messagehdlr)->messagedialog = messagedialog;
300 (*messagehdlr)->messageinfo = messageinfo;
301 (*messagehdlr)->messagehdlrfree = messagehdlrfree;
302 (*messagehdlr)->messagehdlrdata = messagehdlrdata;
303 (*messagehdlr)->warningbuffer = NULL;
304 (*messagehdlr)->dialogbuffer = NULL;
305 (*messagehdlr)->infobuffer = NULL;
306 (*messagehdlr)->warningbufferlen = 0;
307 (*messagehdlr)->dialogbufferlen = 0;
308 (*messagehdlr)->infobufferlen = 0;
309 (*messagehdlr)->nuses = 1;
311 (*messagehdlr)->quiet = quiet;
320 (*messagehdlr)->warningbuffer[0] =
'\0';
321 (*messagehdlr)->dialogbuffer[0] =
'\0';
322 (*messagehdlr)->infobuffer[0] =
'\0';
333 if( messagehdlr != NULL )
334 ++messagehdlr->
nuses;
342 assert(messagehdlr != NULL);
344 if( *messagehdlr == NULL )
347 assert((*messagehdlr)->nuses >= 1);
350 --(*messagehdlr)->nuses;
353 if( (*messagehdlr)->nuses == 0 )
356 assert(*messagehdlr == NULL);
372 assert(messagehdlr != NULL);
374 if( messagehdlr == NULL )
388 assert(messagehdlr != NULL);
391 if( messagehdlr->
logfile != NULL )
406 assert(messagehdlr != NULL);
413 messagehdlr->
quiet = quiet;
419 const char* formatstr,
425 va_start(ap, formatstr);
433 const char* formatstr,
443 const char* formatstr,
449 va_start(ap, formatstr);
457 const char* formatstr,
484 m = vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
486 vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
502 const char* formatstr,
508 va_start(ap, formatstr);
516 const char* formatstr,
527 const char* formatstr,
533 va_start(ap, formatstr);
542 const char* formatstr,
569 m = vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
571 vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
586 const char* formatstr,
592 va_start(ap, formatstr);
600 const char* formatstr,
611 const char* formatstr,
617 va_start(ap, formatstr);
626 const char* formatstr,
653 m = vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
655 vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
672 const char* formatstr,
678 va_start(ap, formatstr);
688 const char* formatstr,
701 const char* formatstr,
707 va_start(ap, formatstr);
718 const char* formatstr,
726 if( msgverblevel <= verblevel )
751 m = vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
753 vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
768 const char* sourcefile,
775 (void) snprintf(msg,
SCIP_MAXSTRLEN,
"[%s:%d] ERROR: ", sourcefile, sourceline);
782 const char* formatstr,
788 va_start(ap, formatstr);
795 const char* formatstr,
822 m = vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
824 vsnprintf(bigmsg, (
size_t) n+1, formatstr, aq);
846 staticErrorPrinting = errorPrinting;
847 staticErrorPrintingData = data;
858 staticErrorPrinting = errorPrintingDefault;
859 staticErrorPrintingData = NULL;
872 #undef SCIPmessagehdlrGetData 873 #undef SCIPmessagehdlrGetLogfile 874 #undef SCIPmessagehdlrIsQuiet 881 if( messagehdlr != NULL )
893 if( messagehdlr == NULL )
904 return (messagehdlr == NULL || messagehdlr->
quiet);
void SCIPmessageVFPrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr, va_list ap)
SCIP_Bool SCIPmessagehdlrIsQuiet(SCIP_MESSAGEHDLR *messagehdlr)
struct SCIP_MessagehdlrData SCIP_MESSAGEHDLRDATA
static void messagePrintError(FILE *file, const char *msg)
void SCIPmessagePrintErrorHeader(const char *sourcefile, int sourceline)
#define BMSfreeMemoryArrayNull(ptr)
void SCIPmessageFPrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
void SCIPmessageSetErrorPrintingDefault(void)
#define SCIP_DECL_MESSAGEWARNING(x)
static void messagehdlrOpenLogfile(SCIP_MESSAGEHDLR *messagehdlr, const char *filename)
static void messagePrintDialog(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *msg)
static void messagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *msg)
datastructures for problem statistics
void SCIPmessagehdlrCapture(SCIP_MESSAGEHDLR *messagehdlr)
SCIP_RETCODE SCIPmessagehdlrCreate(SCIP_MESSAGEHDLR **messagehdlr, SCIP_Bool bufferedoutput, const char *filename, SCIP_Bool quiet, SCIP_DECL_MESSAGEWARNING((*messagewarning)), SCIP_DECL_MESSAGEDIALOG((*messagedialog)), SCIP_DECL_MESSAGEINFO((*messageinfo)), SCIP_DECL_MESSAGEHDLRFREE((*messagehdlrfree)), SCIP_MESSAGEHDLRDATA *messagehdlrdata)
enum SCIP_Retcode SCIP_RETCODE
enum SCIP_VerbLevel SCIP_VERBLEVEL
#define BMSallocMemoryArray(ptr, num)
void SCIPmessageVPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr, va_list ap)
#define BMSfreeMemory(ptr)
void SCIPmessageVPrintError(const char *formatstr, va_list ap)
void SCIPmessagehdlrSetLogfile(SCIP_MESSAGEHDLR *messagehdlr, const char *filename)
void SCIPmessagePrintError(const char *formatstr,...)
void SCIPmessagePrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, const char *formatstr,...)
#define SCIP_DECL_MESSAGEOUTPUTFUNC(x)
#define va_copy(dest, src)
static void * staticErrorPrintingData
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
SCIP_RETCODE SCIPmessagehdlrRelease(SCIP_MESSAGEHDLR **messagehdlr)
void SCIPmessageVPrintVerbInfo(SCIP_MESSAGEHDLR *messagehdlr, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, const char *formatstr, va_list ap)
void SCIPmessageFPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
static SCIP_RETCODE messagehdlrFree(SCIP_MESSAGEHDLR **messagehdlr)
void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
void SCIPmessagePrintDialog(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
public data structures and miscellaneous methods
void SCIPmessagehdlrSetQuiet(SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
#define SCIP_DECL_MESSAGEHDLRFREE(x)
FILE * SCIPmessagehdlrGetLogfile(SCIP_MESSAGEHDLR *messagehdlr)
static SCIP_DECL_ERRORPRINTING(errorPrintingDefault)
void SCIPmessageVPrintDialog(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr, va_list ap)
void SCIPmessageFPrintDialog(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
#define SCIP_DECL_MESSAGEDIALOG(x)
void SCIPmessageVFPrintDialog(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr, va_list ap)
void SCIPmessageVFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr, va_list ap)
#define BMSallocMemorySize(ptr, size)
SCIP_RETCODE SCIPmessagehdlrSetData(SCIP_MESSAGEHDLR *messagehdlr, SCIP_MESSAGEHDLRDATA *messagehdlrdata)
void SCIPmessageSetErrorPrinting(SCIP_DECL_ERRORPRINTING((*errorPrinting)), void *data)
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
void SCIPmessageVFPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr, va_list ap)
#define BMSallocMemory(ptr)
static void messagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *msg)
type definitions for message output methods
static void handleMessage(SCIP_MESSAGEHDLR *messagehdlr, SCIP_DECL_MESSAGEOUTPUTFUNC(outputfunc), FILE *file1, SCIP_Bool usefile1, FILE *file2, SCIP_Bool usefile2, const char *msg, char *buffer, int *bufferlen)
void SCIPmessageVPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr, va_list ap)
SCIP_MESSAGEHDLRDATA * messagehdlrdata
common defines and data types used in all packages of SCIP
SCIP_MESSAGEHDLRDATA * SCIPmessagehdlrGetData(SCIP_MESSAGEHDLR *messagehdlr)
#define SCIP_DECL_MESSAGEINFO(x)
memory allocation routines