use new typed rset only if UNTYPED_RSET is not defined, adapted release notes

Also moved the old definition(s) to a separate header file named oldRecSup.h
to avoid cluttering the new header file.
This commit is contained in:
Ben Franksen
2017-03-21 17:01:13 +01:00
parent f71fe62bc3
commit 40c9e4799b
4 changed files with 55 additions and 3 deletions

View File

@@ -32,9 +32,24 @@ a script by starting those lines with '#-' rather than just '#'.</p>
<p>The table of record support functions (rset methods for short) no longer
has entries of type <tt>RECSUPFUN</tt> (which says: any number and type of
arguments). The <tt>RECSUPFUN</tt> typedef has been removed and casts to
<tt>RECSUPFUN</tt> can no longer be used when initializing <tt>struct
rset</tt>. Record supports can define the macro <tt>REC_TYPE</tt> to the
arguments). Instead, rset methods are now typed by default. The
<tt>RECSUPFUN</tt> typedef has been removed and casts to <tt>RECSUPFUN</tt>
can no longer be used when initializing <tt>struct rset</tt>.</p>
<p>Existing code (e.g. external record supports) might not compile cleanly
against the new rset definition without changes. Instead of adapting their
code as described further below, users can instead get the old untyped
definitions back by placing</p>
<blockquote><pre>
#define UNTYPED_RSET
</pre></blockquote>
<p>before including headers from base.</p>
<p>The following assumes that <tt>UNTYPED_RSET</tt> has not been defined.</p>
<p>Record supports can define the macro <tt>REC_TYPE</tt> to the
name of their record type (including the <tt>Record</tt> suffix) before
including any headers from base, like this:</p>

View File

@@ -21,6 +21,7 @@ INC += guigroup.h
INC += devSup.h
INC += drvSup.h
INC += recSup.h
INC += oldRecSup.h
INC += dbStaticIocRegister.h
dbCore_SRCS += dbStaticLib.c

View File

@@ -0,0 +1,30 @@
/*
* DO NOT INCLUDE THIS FILE
*
* Instead #define UNTYPED_RSET, then #include "recSup.h"
*/
typedef long (*RECSUPFUN) (); /* ptr to record support function*/
typedef struct rset { /* record support entry table */
long number; /*number of support routines */
RECSUPFUN report; /*print report */
RECSUPFUN init; /*init support */
RECSUPFUN init_record; /*init record */
RECSUPFUN process; /*process record */
RECSUPFUN special; /*special processing */
RECSUPFUN get_value; /*no longer used */
RECSUPFUN cvt_dbaddr; /*cvt dbAddr */
RECSUPFUN get_array_info;
RECSUPFUN put_array_info;
RECSUPFUN get_units;
RECSUPFUN get_precision;
RECSUPFUN get_enum_str; /*get string from enum item*/
RECSUPFUN get_enum_strs; /*get all enum strings */
RECSUPFUN put_enum_str; /*put string from enum item*/
RECSUPFUN get_graphic_double;
RECSUPFUN get_control_double;
RECSUPFUN get_alarm_double;
}rset;
#define RSETNUMBER ( (sizeof(struct rset) - sizeof(long))/sizeof(RECSUPFUN) )

View File

@@ -23,6 +23,10 @@ extern "C" {
typedef struct rset rset;
#ifdef UNTYPED_RSET
#include "oldRecSup.h"
#else
/* defined elsewhere */
struct dbAddr;
struct dbr_enumStrs;
@@ -60,6 +64,8 @@ struct rset {
#define RSETNUMBER 17
#endif /* UNTYPED_RSET */
#define S_rec_noRSET (M_recSup| 1) /*Missing record support entry table*/
#define S_rec_noSizeOffset (M_recSup| 2) /*Missing SizeOffset Routine*/
#define S_rec_outMem (M_recSup| 3) /*Out of Memory*/