From 17736b24a0995556de8eaf4a06c304a49d6c9653 Mon Sep 17 00:00:00 2001 From: Tong Zhang Date: Fri, 28 Feb 2025 10:16:06 -0500 Subject: [PATCH] REF: Support -M json5 for JSON5 string requests from pva tools. - see e5961df of pvAccessCPP repo - eliminated the json5 opt test on EPICS base version: - explicitly pass -M json for regular JSON string - while -M json5 for JSON5 string --- src/factory/printer.cpp | 7 +++---- src/pv/pvData.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp index 846f2def..c5ee330c 100644 --- a/src/factory/printer.cpp +++ b/src/factory/printer.cpp @@ -401,12 +401,11 @@ void printRaw(std::ostream& strm, const PVStructure::Formatter& format, const PV std::ostream& operator<<(std::ostream& strm, const PVStructure::Formatter& format) { - if(format.xfmt==PVStructure::Formatter::JSON) { + if(format.xfmt==PVStructure::Formatter::JSON || \ + format.xfmt==PVStructure::Formatter::JSON5) { JSONPrintOptions opts; opts.multiLine = false; -#if EPICS_VERSION_INT>=VERSION_INT(7,0,6,1) - opts.json5 = true; -#endif + opts.json5 = format.xfmt==PVStructure::Formatter::JSON5 ? true : false; printJSON(strm, format.xtop, format.xshow ? *format.xshow : BitSet().set(0), opts); strm<<'\n'; return strm; diff --git a/src/pv/pvData.h b/src/pv/pvData.h index a33fb0eb..da88c2d0 100644 --- a/src/pv/pvData.h +++ b/src/pv/pvData.h @@ -881,6 +881,7 @@ class epicsShareClass PVStructure : public PVField, public BitSetSerializable Raw, NT, JSON, + JSON5, }; private: const PVStructure& xtop;