Skip to content
Merged
12 changes: 6 additions & 6 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,15 @@ o *s POWER radDiffSh // .. end subhour instantaneous value, interpolated
RECORD PYLINEAR "linear poly sub" *SUBSTRUCT // linear polnomial (mononomial?)(one independent variable) for TOWERPLANT

*declare "DBL val(DBL x) { return k[0] + k[1]*x; }"
*declare "RC normalize( record *r, SI fn, char *descrip, DBL x=1.0);" // function in cncult5.cpp
*declare "RC normalize( record *r, SI fn, const char* descrip, DBL x=1.0);" // function in cncult5.cpp

*f *ARRAY 3 FLOAT k // FLOAT k[3]. One extra member needed as terminator by cul.cpp array input logic.
*END // PYLINEAR
//==================================================================================================================
RECORD PYCUBIC "cubic poly sub" *SUBSTRUCT // cubic polnomial (one independent variable) for FAN, COIL,

*declare "DBL val(DBL x) { return k[0] + k[1]*x + k[2]*x*x + k[3]*x*x*x; }"
*declare "RC normalize( record *r, SI fn, char *descrip, DBL x=1.0);" // function in cncult5.cpp
*declare "RC normalize( record *r, SI fn, const char* descrip, DBL x=1.0);" // function in cncult5.cpp

*f *ARRAY 5 FLOAT k // FLOAT k[5]. One extra member needed as terminator by cul.cpp array input logic, 5-92.
/* possible future setup optimizations: 1) select ptr to fcn that does not compute terms whose k is 0;
Expand All @@ -646,15 +646,15 @@ RECORD PYCUBIC "cubic poly sub" *SUBSTRUCT // cubic polnomial (one independent v
RECORD PYCUBIC2 "cubic poly sub" *SUBSTRUCT // cubic polnomial (one independent variable) with x0 for FAN, COIL,

*declare "DBL val(DBL x) { x -= k[4]; if (x < 0.) x = 0.; return k[0] + k[1]*x + k[2]*x*x + k[3]*x*x*x; }"
*declare "RC normalize( record *r, SI fn, char *descrip, DBL x=1.0);" // function in cncult5.cpp
*declare "RC normalize( record *r, SI fn, const char *descrip, DBL x=1.0);" // function in cncult5.cpp

*f *ARRAY 6 FLOAT k // FLOAT k[6]. [0..3] are coeff, [4] is minimum x, [5] is terminator needed by cul.cpp.
*END // PYCUBIC2
//==================================================================================================================
RECORD PYBIQUAD "biquadratic ply sub" *SUBSTRUCT // biQuadratic polynomial (two independent variables)

*declare "DBL val( DBL x, DBL y) { return k[0] + k[1]*x + k[2]*x*x + k[3]*y + k[4]*y*y + k[5]*x*y; }"
*declare "RC normalize( record *r, SI fn, char *descX, char*descY, DBL x, DBL y, BOO noWarn=FALSE);" // cncult5.cpp
*declare "RC normalize( record *r, SI fn, const char* descX, const char* descY, DBL x, DBL y, BOO noWarn=FALSE);" // cncult5.cpp
*declare "RC normalizeCoil( AH *ah, SI fn);" // function in cncult5.cpp

*f *ARRAY 7 FLOAT k // FLOAT k[7]. One extra member needed as terminator by cul.cpp array input logic, 5-92.
Expand Down Expand Up @@ -2854,7 +2854,7 @@ RECORD HEATEXCHANGER "heat exchanger sub" *SUBSTRUCT // Used in DOAS and AIRHAN
*prefix hx_

*declare "RC hx_setup( record *r, SI parentFieldNum);"
*declare "void hx_begSubhr(AIRFLOW supInletAF, AIRFLOW exhInletAF, DBL tWant);" // calculates bypass and final outlet air state given setpoint
*declare "RC hx_begSubhr(AIRFLOW supInletAF, AIRFLOW exhInletAF, DBL tWant);" // calculates bypass and final outlet air state given setpoint
*declare "void hx_calc();" // calculates hx only, called by begSubhr()
*declare "double hx_calcBypass(float bypassFraction);" // returns outlet temperature for a given bypass fraction

Expand Down Expand Up @@ -4606,7 +4606,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
// C_WHTYPECH_STRGSML, _STRGLRG, _INSTSML, _INSTLRG,
// _INSTUEF, _BUILTUP
*i ANAME wh_desc; // probe-able description text
*declare "virtual const char* GetDescription( int options=0) { options; return wh_desc; }"
*declare "virtual const char* GetDescription( int /*options*/=0) { return wh_desc; }"
*r INT wh_fcn; // function of this DHWHEATER per whfcnXXX enum
*declare "enum { whfcnUNKNOWN=0, whfcnPRIMARY, whfcnLOOPHEATER, whfcnSUPPLIESCHDHW=0x10, whfcnSUPPLIESLOOP=0x20, whfcnSUPPLIESLOAD=0x40 };"
*declare "int wh_SetFunction();"
Expand Down
48 changes: 25 additions & 23 deletions src/RCDEF/rcdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class LUTAB
unsigned char* lu_stat; // optional char array of status bytes

public:
LUTAB(const char** nmp, int N, unsigned char* stat = nullptr) : lu_nmp(nmp), lu_nent(0), lu_mxent(N), lu_stat(stat)
LUTAB(const char** nmp, int N, unsigned char* stat = nullptr) : lu_nent(0), lu_mxent(N), lu_nmp(nmp), lu_stat(stat)
{
}
int lu_GetCount() const { return lu_nent; }
Expand Down Expand Up @@ -314,8 +314,8 @@ class LUTAB

/*------------ General variables ------------*/

char * ProgVrsnId = "RCDEF"; /* program version identifying string used in errorlog file header info, erpak2.cpp.
Defined in config.cpp in "real" products. */
const char* ProgVrsnId = "RCDEF"; // program version identifying string used in errorlog file header info, erpak2.cpp.
// Defined in config.cpp in "real" products.
FILE * Fpm; /* current input stream, read by gtoks. Note several files are opened
during command line checking; Fpm is set to each in sequence as they are used. */
FILE *Fout; /* current output .hx file stream -- used locally several places. */
Expand Down Expand Up @@ -387,7 +387,7 @@ struct FIELDDESC
int lmtype;
int untype;
};
static FIELDDESC Fdtab[MAXFIELDS] = { 0 }; // field descriptors table
static FIELDDESC Fdtab[MAXFIELDS] = { { 0} }; // field descriptors table

// Field name stuff
static const char * rcfdnms[MAXFIELDS]; // Table of field name pointers
Expand Down Expand Up @@ -420,13 +420,16 @@ LOCAL void wRcTd( FILE *f);
LOCAL void wSrfd1( FILE *f);
LOCAL void wSrfd2( FILE *f);
LOCAL void wSrfd3( FILE *f);
LOCAL void wSrfd4( FILE *f);
#if 0
0 unused
0 LOCAL void wSrfd4( FILE *f);
#endif
LOCAL void sumry( void);
LOCAL FILE * rcfopen( const char *s, char **argv, int argi);
LOCAL int gtoks( const char * );
LOCAL void rcderr( const char *s, ...);
LOCAL int update( const char* old, const char* nu);
LOCAL void newsec( char *);
LOCAL void newsec( const char *);
LOCAL const char* enquote( const char *s);

// Common string buffer
Expand Down Expand Up @@ -660,19 +663,18 @@ static int determine_size( // size of a data type
// returns size (bytes) of decl if known else 0
{
static SWTABLE declSize[] =
{ "short", sizeof(short),
"int", sizeof(int),
"unsigned short", sizeof(unsigned short),
"unsigned", sizeof(unsigned),
"long", sizeof(unsigned long),
"unsigned long", sizeof(unsigned long),
"float", sizeof(float),
"double", sizeof(double),
"char", sizeof(char),
"unsigned char", sizeof(unsigned char),
"time_t", sizeof(time_t),

NULL, 0
{ { "short", sizeof(short) },
{ "int", sizeof(int) },
{ "unsigned short", sizeof(unsigned short) },
{ "unsigned", sizeof(unsigned) },
{ "long", sizeof(unsigned long) },
{ "unsigned long", sizeof(unsigned long) },
{ "float", sizeof(float) },
{ "double", sizeof(double) },
{ "char", sizeof(char) },
{ "unsigned char", sizeof(unsigned char) },
{ "time_t", sizeof(time_t) },
{ NULL, 0 }
};
int sz = 0;
if (strchr(decl, '*'))
Expand Down Expand Up @@ -2273,8 +2275,8 @@ LOCAL void base_fds()
// base fields info. MUST BE MAINTAINED TO MATCH BASE CLASS (ancrec.h:record, or as changed).
static struct BASEFIELDS
{
char* name;
char* fdTyNam;
const char* name;
const char* fdTyNam;
int evf;
int ff;
} baseFields[] =
Expand Down Expand Up @@ -3291,7 +3293,7 @@ LOCAL int gtoks( // Retrieve tokens from input stream "Fpm" acco
printf( "\n gtoks removing leading null from token !? \n");
}
#endif
static char* comdelims[2] = { "/*", "*/" }; // Comment delimiters
static const char* comdelims[2] = { "/*", "*/" }; // Comment delimiters
oldcommentflag = commentflag;
commentflag =
!(commentflag ^ (strcmp( token, comdelims[commentflag]) !=0) );
Expand Down Expand Up @@ -3397,7 +3399,7 @@ LOCAL void rcderr( const char *s, ...) // Print an error message
#endif
} // rcderr
//======================================================================
LOCAL void newsec(char *s) // Output heading (s) for new section of run
LOCAL void newsec(const char *s) // Output heading (s) for new section of run
{
printf("\n%-16s ", s); // no trailing \n. -20s-->-16s 1-31-94.
} // newsec
Expand Down
Loading