From b09a089f549aa7c67ab4fecc07da47c28f7526d4 Mon Sep 17 00:00:00 2001 From: Mike Dunston Date: Wed, 20 Nov 2024 07:31:12 -0800 Subject: [PATCH 1/4] Initial implementation of the Hints() element for Group and Int fields in the CDI. This is based on how the element is handled. --- src/openlcb/ConfigRenderer.hxx | 24 ++++++++++++++++++++++-- src/openlcb/ConfigRepresentation.hxx | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/openlcb/ConfigRenderer.hxx b/src/openlcb/ConfigRenderer.hxx index cc307870f..102dc463f 100644 --- a/src/openlcb/ConfigRenderer.hxx +++ b/src/openlcb/ConfigRenderer.hxx @@ -52,6 +52,7 @@ struct AtomConfigDefs DECLARE_OPTIONALARG(Name, name, const char *, 0, nullptr); DECLARE_OPTIONALARG(Description, description, const char *, 1, nullptr); DECLARE_OPTIONALARG(MapValues, mapvalues, const char *, 2, nullptr); + DECLARE_OPTIONALARG(Hints, hints, const char *, 3, nullptr); DECLARE_OPTIONALARG(SkipInit, skip_init, int, 15, 0); DECLARE_OPTIONALARG(Offset, offset, int, 10, 0); using Base = OptionalArg; @@ -71,6 +72,8 @@ public: DEFINE_OPTIONALARG(Description, description, const char *); /// Represent the value enclosed in the "" tag of the data element. DEFINE_OPTIONALARG(MapValues, mapvalues, const char *); + /// Represent the value enclosed in the "" tag of the data element. + DEFINE_OPTIONALARG(Hints, hints, const char *); /// When set to true, the event initializers will be skipped in this event /// or group. DEFINE_OPTIONALARG(SkipInit, skip_init, int); @@ -94,6 +97,10 @@ public: { *r += StringPrintf("%s\n", mapvalues()); } + if (hints()) + { + *r += StringPrintf("%s\n", mapvalues()); + } } }; @@ -147,7 +154,7 @@ struct NumericConfigDefs : public AtomConfigDefs DECLARE_OPTIONALARG(Max, maxvalue, int, 7, INT_MAX); DECLARE_OPTIONALARG(Default, defaultvalue, int, 8, INT_MAX); using Base = OptionalArg; + Hints, Min, Max, Default, SkipInit, Offset>; }; /// Definitions for the options for numeric CDI entries. @@ -164,6 +171,8 @@ public: DEFINE_OPTIONALARG(Description, description, const char *); /// Represent the value enclosed in the tag of the data element. DEFINE_OPTIONALARG(MapValues, mapvalues, const char *); + /// Represent the value enclosed in the tag of the data element. + DEFINE_OPTIONALARG(Hints, hints, const char *); DEFINE_OPTIONALARG(Min, minvalue, int); DEFINE_OPTIONALARG(Max, maxvalue, int); DEFINE_OPTIONALARG(Default, defaultvalue, int); @@ -197,6 +206,10 @@ public: { *r += StringPrintf("%s\n", mapvalues()); } + if (hints()) + { + *r += StringPrintf("%s\n", mapvalues()); + } } int clip(int value) { @@ -263,7 +276,7 @@ struct GroupConfigDefs : public AtomConfigDefs DECLARE_OPTIONALARG(FixedSize, fixed_size, unsigned, 13, 0); DECLARE_OPTIONALARG(Hidden, hidden, int, 14, 0); using Base = OptionalArg