@@ -1091,7 +1091,7 @@ CULT( "colWid", DAT, COL_COLWID, 0, 0, VEOI, TYSI, 0,
10911091CULT ( " colDec" , DAT, COL_COLDEC, 0 , 0 , VEOI, TYSI, 0 , v -1 , 0 .f , N, N),
10921092CULT ( " colJust" , DAT, COL_COLJUST, 0 , 0 , VEOI, TYCH, 0 , N, 0 .f , N, N),
10931093CULT ( " colVal" , DAT, COL_COLVAL, RQD, 0 , VSUBHRLY|EVPSTIVL, // ok to evaluate at post interval
1094- TYFLSTR, // float or string, struct w/ dt.
1094+ TYFLSTR, // float or string, struct w/ dt.
109510950 , N, 0 .f , N, N),
10961096CULT ( " endExportcol" ,ENDER, 0 , 0 , 0 , 0 , 0 , 0 , N, 0 .f , N, N),
10971097CULT ()
@@ -1100,142 +1100,17 @@ CULT()
11001100
11011101// ===================================== REPORT command ============================================
11021102
1103- /* re/exports and re/exportfiles persist through autosize and main sim phases;
1104- they are not reinitialized and thus cannot have any VFAZLY members. 6-95. */
1105-
1106- RC FC rpStarCkf ( CULT *c, /* RI* */ void *p, void *p2, void *p3) /* ARGSUSED*/ // ---------------------------------
1103+ // re/exports and re/exportfiles persist through autosize and main sim phases;
1104+ // they are not reinitialized and thus cannot have any VFAZLY members. 6-95.
11071105
1106+ static RC FC rpStarCkf ( CULT *c, /* RI* */ void *p, void *p2, void *p3) /* ARGSUSED*/
11081107// check function automatically called at end of REPORT and EXPORT object entry (per tables * lines).
11091108// also called by code in TopCkf.
11101109// ONLY argument 'p' is used.
11111110{
1112- RI* P = (RI *)p;
1113- RC rc=RCOK;
1114- UCH *fs = (UCH *)p + P->b ->sOff ; // ptr to field status byte array
1115- SI isEx = P->isExport ; // 0 for report, nz for export: prefetch for several uses
1116- char * exrp = isEx ? " ex" : " rp" ; // to insert in member names in error messages
1117- char * exrePort = isEx ? " export" : " report" ; // to insert in errmsgs
1118- // get field texts for errMsgs, issue no errmsg (except in returned text) if value out of range.
1119- const char * tyTx = P->getChoiTx ( RI_RPTY, 1 ); // rpTy/exTy as text
1120- const char * fqTx = P->getChoiTx ( RI_RPFREQ, 1 ); // rpFreq/exFreq
1121-
1122-
1123- // note: file, zone, meter references not checked here as not stored till input complete (to permit forward references)
1124-
1125- // check: type ok for export (all types ok for report)
1126- // rpFreq given or not per rpType.
1127- // immediately return errors that would cause additional spurious messages in this function.
1128-
1129- switch (P->rpTy ) // a TYCH with evf==0 (no deferred exprs) member
1130- {
1131- case 0 :
1132- break ; // if omitted, let cul.cpp do its msg (RQD field; calls here first)
1133-
1134- // types not allowing rpFreq nor dates and also not allowed as exports.
1135- case C_RPTYCH_ERR: // "Err" (error messages)
1136- case C_RPTYCH_LOG: // "Log" (run messages)
1137- case C_RPTYCH_INP: // "Inp" (input echo, with some or all error messages)
1138- case C_RPTYCH_SUM: // "Summary"
1139- case C_RPTYCH_ZDD: // "Zone Data Dump"
1140- if (isEx)
1141- return P->ooer ( RI_RPTY, " Invalid exType '%s'" , tyTx); // bad type for export
1142- // fall thru
1143- // types not allowing rpFreq nor dates but as exports
1144- case C_RPTYCH_AHSIZE: // 6-95
1145- case C_RPTYCH_AHLOAD: // 6-95
1146- case C_RPTYCH_TUSIZE: // 6-95
1147- case C_RPTYCH_TULOAD: // 6-95
1148- if (fs[ RI_RPFREQ ] & FsSET)
1149- rc = P->ooer ( RI_RPFREQ, (char *)MH_S0428, exrp, exrp, tyTx); // "%sFreq may not be given with %sType=%s"
1150- if (fs[ RI_RPDAYBEG ] & FsSET)
1151- rc = P->ooer ( RI_RPDAYBEG, (char *)MH_S0429, exrp, exrp, tyTx); // "%sDayBeg may not be given with %sType=%s"
1152- if (fs[ RI_RPDAYEND ] & FsSET)
1153- rc = P->ooer ( RI_RPDAYEND, (char *)MH_S0430, exrp, exrp, tyTx); // "%sDayEnd may not be given with %sType=%s"
1154- break ;
1155-
1156- // types requiring rpFreq and allowing or requiring start and end day depending on rpFreq
1157-
1158- case C_RPTYCH_ZST: // "Zone Statistics"
1159- case C_RPTYCH_ZEB: // "Zone Energy Balance"
1160- case C_RPTYCH_MTR: // "Meter"
1161- case C_RPTYCH_DHWMTR: // "DHWMeter"
1162- case C_RPTYCH_AH: // "Air Handler"
1163- case C_RPTYCH_UDT: // "User-defined Table"
1164- switch (P->rpFreq ) // rpFreq is TYCH with evf==0 ---> no exprs
1165- {
1166- case 0 :
1167- return P->oer ( (char *)MH_S0431, exrp, exrp, tyTx); // "No %sFreq given: required with %sType=%s"
1168-
1169- // dates not allowed: year
1170- case C_IVLCH_Y:
1171- if (fs[ RI_RPDAYBEG ] & FsSET)
1172- rc = P->ooer ( RI_RPDAYBEG, (char *)MH_S0432, // "%sDayBeg may not be given with %sFreq=%s"
1173- exrp, exrp, fqTx);
1174- if (fs[ RI_RPDAYEND ] & FsSET)
1175- rc = P->ooer ( RI_RPDAYEND, (char *)MH_S0433, // "%sDayEnd may not be given with %sFreq=%s"
1176- exrp, exrp, fqTx);
1177- break ;
1178- // date optional: month
1179- case C_IVLCH_M:
1180- break ;
1181-
1182- // start date required: day, hour, both, subhour
1183- case C_IVLCH_HS:
1184- case C_IVLCH_S:
1185- if ( P->rpTy ==C_RPTYCH_MTR // have no subhourly meter info
1186- || P->rpTy ==C_RPTYCH_DHWMTR // have no subhourly DHW meter info
1187- || P->rpTy ==C_RPTYCH_ZST ) // have no subhourly statistics info, right?
1188- return P->ooer ( RI_RPFREQ, (char *)MH_S0434, // "%sFreq=%s not allowed with %sty=%s"
1189- exrp, fqTx, exrp, tyTx );
1190- {
1191- char *badSumOf=NULL ; // check for types without subhour sum info
1192- if (P->rpTy ==C_RPTYCH_ZEB && (fs[RI_ZI] & FsSET) && P->zi ==TI_SUM) badSumOf = " zones" ;
1193- else if (P->rpTy ==C_RPTYCH_AH && (fs[RI_AHI] & FsSET) && P->ahi ==TI_SUM) badSumOf = " ahs" ;
1194- if (badSumOf)
1195- return P->ooer ( RI_RPFREQ, (char *)MH_S0435, // "%sFreq=%s not allowed in Sum-of-%s %s"
1196- exrp, fqTx, badSumOf, exrePort );
1197- }
1198- /* lint -e616 fall thru */
1199- case C_IVLCH_H:
1200- case C_IVLCH_D:
1201- if (!P->rpDayBeg )
1202- rc = P->oer ( (char *)MH_S0436, // "No %sDayBeg given: required with %sFreq=%s"
1203- exrp, exrp, fqTx );
1204- break ;
1205- /* lint +e616 */
1206-
1207- default :
1208- return P->ooer ( RI_RPFREQ, (char *)MH_S0437, // "Internal error in cncult:rpStarCkf: bad rpFreq %d"
1209- (INT)P->rpFreq );
1210- }
1211- break ;
1212-
1213- default :
1214- return P->ooer ( RI_RPTY, (char *)MH_S0438, // "Internal error in cncult:rpStarCkf: bad rpTy %d"
1215- (INT)P->rpTy );
1216- } // switch (P->rpTy)
1217-
1218-
1219- // disallow title and cpl if not UDT
1220-
1221- if (P->rpTy != C_RPTYCH_UDT)
1222- {
1223- if (fs[RI_RPCPL] & FsSET)
1224- rc = P->ooer ( RI_RPCPL, (char *)MH_S0439, exrp, exrp); // "%sCpl cannot be given unless %sTy is UDT"
1225- if (fs[RI_RPTITLE] & FsSET)
1226- rc = P->ooer ( RI_RPTITLE, (char *)MH_S0440, exrp, exrp); // "%sTitle cannot be given unless %sTy is UDT"
1227- }
1228-
1229- // disallow columns only for report file
1230- if (!isEx && P->rpHeader == C_RPTHDCH_COL) {
1231- const char * rpHdTyTx = P->getChoiTx (RI_RPHEADER, 1 );
1232- rc |= P->oWarn (" Reports cannot have rpHeader=%s, using rpHeader=Yes instead" , rpHdTyTx);
1233- P->rpHeader = C_RPTHDCH_YES;
1234- }
1235-
1236- return rc; // and several error returns above
1111+ return ((RI *)p)->ri_CkF ();
12371112} // rpStarCkf
1238-
1113+ // -------------------------------------------------------------------------------------------------
12391114static CULT rpT[] = // ----------- REPORT cmd table, used from cnTopCult and rpfT
12401115{
12411116// id cs fn f uc evf ty b dfls p2 ckf
@@ -1280,30 +1155,30 @@ x Exports/exportFiles likewise. rob 11-29-91. */
12801155
12811156static CULT exT[] = // ----------- EXPORT cmd table, used from cnTopCult and exfT
12821157{
1283- // id cs fn f uc evf ty b dfls p2 ckf
1284- // ---------- ----- ------------- --------------- -- ----- ----- ----- ---------- ---- ----
1285- CULT ( " *" , STAR, 0 , 0 , 0 , 0 , 0 , 0 , N, 0 .f , N, rpStarCkf), // Ckf fcn shared with REPORT *****
1286- CULT ( " exExportfile" ,DAT, RI_OWNTI, DFLIN, 0 , VEOI, TYIREF, &XfiB, N, 0 .f , N, N), // also dflt'd in cncult4. TYREF->TYIREF 10-9-92
1287- CULT ( " exZone" , DAT, RI_ZI, DFLIN|SUM_OK|ALL_OK, 0 , VEOI, TYREF, &ZiB, N, 0 .f , N, N), // rqd/disallowed per rpTy
1288- CULT ( " exMeter" , DAT, RI_MTRI, SUM_OK|ALL_OK, 0 , VEOI, TYREF, &MtriB, N, 0 .f , N, N),
1289- CULT ( " exAh" , DAT, RI_AHI, SUM_OK|ALL_OK, 0 , VEOI, TYREF, &AhiB, N, 0 .f , N, N),
1290- CULT ( " exDHWMeter" , DAT, RI_DHWMTRI, ALL_OK, 0 , VEOI, TYREF, &WMtriB, N, 0 .f , N, N),
1291- CULT ( " exTu" , DAT, RI_TUI, ALL_OK, 0 , VEOI, TYREF, &TuiB, N, 0 .f , N, N), // 6-95
1292- CULT ( " exType" , DAT, RI_RPTY, RQD, 0 , 0 , TYCH, 0 , v 0 , 0 .f , N, N), // used in rpStarCkf: no VEOI
1293- CULT ( " exFreq" , DAT, RI_RPFREQ, 0 , 0 , 0 , TYCH, 0 , v 0 , 0 .f , N, N), // used in rpStarCkf: no VEOI
1294- CULT ( " exDayBeg" , DAT, RI_RPDAYBEG, 0 , 0 , VEOI, TYDOY, 0 , v 0 , 0 .f , N, N),
1295- CULT ( " exDayEnd" , DAT, RI_RPDAYEND, 0 , 0 , VEOI, TYDOY, 0 , v 0 , 0 .f , N, N),
1296- CULT ( " exBtuSf" , DAT, RI_RPBTUSF, 0 , 0 , VEOI, TYFL, 0 , v 0 , 1e6 , N, N), // show mBtu. Also in cncult4:addRep().
1297- CULT ( " exCond" , DAT, RI_RPCOND, 0 , 0 , VSUBHRLY|EVPSTIVL, // ok if evaluated post interval
1298- TYLLI, // SI condition, dflt TRUE, in LI for NAN
1299- 0 , v 1L ,0 .f , N, N),
1300- CULT ( " exTitle" , DAT, RI_RPTITLE, 0 , 0 , VEOI, TYSTR, 0 , v 0 , 0 .f , N, N),
1301- CULT ( " exHeader" , DAT, RI_RPHEADER, 0 , 0 , VEOI, TYCH, 0 , v C_RPTHDCH_YES,0 .f , N, N),
1302- CULT ( " exFooter" , DAT, RI_RPFOOTER, 0 , 0 , VEOI, TYCH, 0 , v C_NOYESCH_YES,0 .f , N, N),
1303- CULT ( " exportCol" , RATE, 0 , 0 , 0 , 0 , 0 , &XcoliB, N, 0 .f , exColT, N),
1304- CULT ( " isExport" , DAT, RI_ISEXPORT, NO_INP, 0 , 0 , TYSI, 0 , v 1 , 0 .f , N, N), // set 1 for export
1305- CULT ( " endExport" , ENDER, 0 , 0 , 0 , 0 , 0 , 0 , N, 0 .f , N, N),
1306- CULT ()
1158+ // id cs fn f uc evf ty b dfls p2 ckf
1159+ // ---------- ----- ------------- --------------- -- ----- ----- ----- ---------- ---- ----
1160+ CULT ( " *" , STAR, 0 , 0 , 0 , 0 , 0 , 0 , N, 0 .f , N, rpStarCkf), // Ckf fcn shared with REPORT *****
1161+ CULT ( " exExportfile" ,DAT, RI_OWNTI, DFLIN, 0 , VEOI, TYIREF, &XfiB, N, 0 .f , N, N), // also dflt'd in cncult4. TYREF->TYIREF 10-9-92
1162+ CULT ( " exZone" , DAT, RI_ZI, DFLIN|SUM_OK|ALL_OK, 0 , VEOI, TYREF, &ZiB, N, 0 .f , N, N), // rqd/disallowed per rpTy
1163+ CULT ( " exMeter" , DAT, RI_MTRI, SUM_OK|ALL_OK, 0 , VEOI, TYREF, &MtriB, N, 0 .f , N, N),
1164+ CULT ( " exAh" , DAT, RI_AHI, SUM_OK|ALL_OK, 0 , VEOI, TYREF, &AhiB, N, 0 .f , N, N),
1165+ CULT ( " exDHWMeter" , DAT, RI_DHWMTRI, ALL_OK, 0 , VEOI, TYREF, &WMtriB, N, 0 .f , N, N),
1166+ CULT ( " exTu" , DAT, RI_TUI, ALL_OK, 0 , VEOI, TYREF, &TuiB, N, 0 .f , N, N), // 6-95
1167+ CULT ( " exType" , DAT, RI_RPTY, RQD, 0 , 0 , TYCH, 0 , v 0 , 0 .f , N, N), // used in rpStarCkf: no VEOI
1168+ CULT ( " exFreq" , DAT, RI_RPFREQ, 0 , 0 , 0 , TYCH, 0 , v 0 , 0 .f , N, N), // used in rpStarCkf: no VEOI
1169+ CULT ( " exDayBeg" , DAT, RI_RPDAYBEG, 0 , 0 , VEOI, TYDOY, 0 , v 0 , 0 .f , N, N),
1170+ CULT ( " exDayEnd" , DAT, RI_RPDAYEND, 0 , 0 , VEOI, TYDOY, 0 , v 0 , 0 .f , N, N),
1171+ CULT ( " exBtuSf" , DAT, RI_RPBTUSF, 0 , 0 , VEOI, TYFL, 0 , v 0 , 1e6 , N, N), // show mBtu. Also in cncult4:addRep().
1172+ CULT ( " exCond" , DAT, RI_RPCOND, 0 , 0 , VSUBHRLY|EVPSTIVL, // ok if evaluated post interval
1173+ TYLLI, // SI condition, dflt TRUE, in LI for NAN
1174+ 0 , v 1L ,0 .f , N, N),
1175+ CULT ( " exTitle" , DAT, RI_RPTITLE, 0 , 0 , VEOI, TYSTR, 0 , v 0 , 0 .f , N, N),
1176+ CULT ( " exHeader" , DAT, RI_RPHEADER, 0 , 0 , VEOI, TYCH, 0 , v C_RPTHDCH_YES,0 .f , N, N),
1177+ CULT ( " exFooter" , DAT, RI_RPFOOTER, 0 , 0 , VEOI, TYCH, 0 , v C_NOYESCH_YES,0 .f , N, N),
1178+ CULT ( " exportCol" , RATE, 0 , 0 , 0 , 0 , 0 , &XcoliB, N, 0 .f , exColT, N),
1179+ CULT ( " isExport" , DAT, RI_ISEXPORT, NO_INP, 0 , 0 , TYSI, 0 , v 1 , 0 .f , N, N), // set 1 for export
1180+ CULT ( " endExport" , ENDER, 0 , 0 , 0 , 0 , 0 , 0 , N, 0 .f , N, N),
1181+ CULT ()
13071182}; // exT
13081183
13091184
0 commit comments