From 63d674fa13dff86f138c22414c3fc16bbffcd62a Mon Sep 17 00:00:00 2001 From: Mark Winter <mwinter@drexel.edu> Date: Sun, 1 Mar 2020 18:00:10 +0100 Subject: [PATCH] Support script warning message output --- src/c/Mex/MexTypes.h | 6 ++++++ src/c/Python/PyTypes.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/c/Mex/MexTypes.h b/src/c/Mex/MexTypes.h index ec0e7ee6..5303ea05 100644 --- a/src/c/Mex/MexTypes.h +++ b/src/c/Mex/MexTypes.h @@ -36,6 +36,12 @@ namespace Script mexPrintf(fmt, std::forward<Args>(args)...); } + template <typename... Args> + inline void warnMsg(const char* fmt, Args&&... args) + { + mexWarnMsgTxt(formatMsg(fmt, std::forward<Args>(args)...).c_str()); + } + template <typename... Args> inline void errorMsg(const char* fmt, Args&&... args) { diff --git a/src/c/Python/PyTypes.h b/src/c/Python/PyTypes.h index b186a910..51156c03 100644 --- a/src/c/Python/PyTypes.h +++ b/src/c/Python/PyTypes.h @@ -39,6 +39,12 @@ namespace Script PySys_WriteStdout(fmt, std::forward<Args>(args)...); } + template <typename... Args> + inline void warnMsg(const char* fmt, Args&&... args) + { + PyErr_WarnFormat(nullptr, 2, fmt, std::forward<Args>(args)...); + } + template <typename... Args> inline void errorMsg(const char* fmt, Args&&... args) { -- GitLab