@@ -604,17 +604,35 @@ static inline jmp_buf* getBestJumpBuffer(threadData_t *threadData)
604604 }
605605}
606606
607+ /**
608+ * @brief Variadic stream print and throw.
609+ *
610+ * Print message to LOG_ASSERT.
611+ *
612+ * @param threadData Thread data for throwing.
613+ * @param format Format string.
614+ * @param args Variadic argument list for format string
615+ */
607616void va_throwStreamPrint (threadData_t * threadData , const char * format , va_list args )
608617{
609618#if !defined(OMC_MINIMAL_LOGGING )
610- char logBuffer [SIZE_LOG_BUFFER ];
611- vsnprintf (logBuffer , SIZE_LOG_BUFFER , format , args );
612- messageFunction (LOG_TYPE_DEBUG , LOG_ASSERT , omc_dummyFileInfo , 0 , logBuffer , 0 , NULL );
619+ if (useStream [LOG_ASSERT ]) {
620+ char logBuffer [SIZE_LOG_BUFFER ];
621+ vsnprintf (logBuffer , SIZE_LOG_BUFFER , format , args );
622+ messageFunction (LOG_TYPE_DEBUG , LOG_ASSERT , omc_dummyFileInfo , 0 , logBuffer , 0 , NULL );
623+ }
613624#endif
614625 threadData = threadData ? threadData : (threadData_t * )pthread_getspecific (mmc_thread_data_key );
615626 longjmp (* getBestJumpBuffer (threadData ), 1 );
616627}
617628
629+ /**
630+ * @brief Print message to LOG_ASSERT and throw.
631+ *
632+ * @param threadData Thread data for throwing.
633+ * @param format Format string.
634+ * @param ... Additional arguments for format string.
635+ */
618636void throwStreamPrint (threadData_t * threadData , const char * format , ...)
619637{
620638#if !defined(OMC_MINIMAL_LOGGING )
@@ -628,15 +646,26 @@ void throwStreamPrint(threadData_t *threadData, const char *format, ...)
628646#endif
629647}
630648
649+ /**
650+ * @brief Print message with equation indices to LOG_ASSERT stream and throw.
651+ *
652+ * @param threadData Thread data for throwing.
653+ * @param info File info, can be omc_dummyFileInfo.
654+ * @param indexes Equation indices.
655+ * @param format Format string.
656+ * @param ... Additional arguments for format string.
657+ */
631658void throwStreamPrintWithEquationIndexes (threadData_t * threadData , FILE_INFO info , const int * indexes , const char * format , ...)
632659{
633660#if !defined(OMC_MINIMAL_LOGGING )
634- char logBuffer [SIZE_LOG_BUFFER ];
635- va_list args ;
636- va_start (args , format );
637- vsnprintf (logBuffer , SIZE_LOG_BUFFER , format , args );
638- va_end (args );
639- messageFunction (LOG_TYPE_DEBUG , LOG_ASSERT , info , 0 , logBuffer , 0 , indexes );
661+ if (useStream [LOG_ASSERT ]) {
662+ char logBuffer [SIZE_LOG_BUFFER ];
663+ va_list args ;
664+ va_start (args , format );
665+ vsnprintf (logBuffer , SIZE_LOG_BUFFER , format , args );
666+ va_end (args );
667+ messageFunction (LOG_TYPE_DEBUG , LOG_ASSERT , info , 0 , logBuffer , 0 , indexes );
668+ }
640669#endif
641670 threadData = threadData ? threadData : (threadData_t * )pthread_getspecific (mmc_thread_data_key );
642671 longjmp (* getBestJumpBuffer (threadData ), 1 );
0 commit comments