162162#include " srd.h"
163163
164164#include " xiopak.h" // xffilcomp
165- // #include "envpak.h" // hello byebye
166165#include " cuevf.h" // EVFHR EVFMH
167166#include " cvpak.h"
168167#include " lookup.h"
@@ -2049,7 +2048,13 @@ x { printf( "\nRecord trap!");}
20492048
20502049 // standard type-specific members: Copy() and operator=()
20512050 fprintf ( frc, " %s& Copy( const %s& _d) { Copy( static_cast< const record*>(&_d)); return *this; }\n " , rcNam, rcNam);
2051+ #if 0
2052+ 0 experiment re elimination of duplicate Copy / CopyFrom
2053+ 0 retain pending finalization of Copy / CopyFrom merge 6-2023
2054+ 0 fprintf(frc, " %s& operator=( const %s& _d) = delete;\n", rcNam, rcNam);
2055+ #else
20522056 fprintf ( frc, " %s& operator=( const %s& _d) { Copy( static_cast< const record*>(&_d)); return *this; }\n " , rcNam, rcNam);
2057+ #endif
20532058
20542059 // virtual Copy(): override or not
20552060 fprintf ( frc, " virtual void Copy( const record* pSrc, int options=0)%s;\n " ,
@@ -2230,7 +2235,7 @@ x { printf( "\nRecord trap!");}
22302235
22312236 if (fSrfd ) // if doing it and opened ok
22322237 {
2233- wSrfd4 ( fSrfd ); // write part after per-record stuff, below
2238+ // wSrfd4( fSrfd); write part after per-record stuff, below DROPPED 6-2023
22342239 fprintf ( fSrfd , " \n\n /* end of srfd.cpp */\n " );
22352240 fclose (fSrfd );
22362241 printf (" \n " );
@@ -2932,7 +2937,7 @@ LOCAL void wRcTd( FILE *f) // write record and anchor class declara
29322937// ======================================================================
29332938LOCAL void wSrfd1 ( FILE *f)
29342939
2935- // write "Small record and field descriptor" C source file for compilation and linking into applications
2940+ // write "Small record and field descriptor" C++ file for compilation and linking into applications
29362941
29372942// PART 1 of 4 parts: field types table, and stuff above portion repeated for each record type.
29382943
@@ -2945,15 +2950,15 @@ LOCAL void wSrfd1( FILE *f)
29452950 " // srfd.cpp\n "
29462951 " \n "
29472952 " /* This is a Record and Field Descriptor Tables source file generated generated by rcdef.exe.\n "
2948- " This file is compiled and linked into an application, such as CN. */\n " );
2953+ " This file is compiled and linked into CSE. */\n " );
29492954 fprintf ( f, " \n "
29502955 " /* DO NOT EDIT: This file is overwritten when rcdef is run.\n "
29512956 " To change, change rcdef.exe input as desired and re-run rcdef.exe via the appropropriate batch file. */\n\n "
29522957 " \n "
29532958 " #include \" cnglob.h\" // includes <dtypes.h> for DTxxxx symbols\n "
29542959 " #include \" srd.h\" // defines structures and declares variables. Plus comments. Manually generated file.\n "
2955- " #include < ancrec.h> // defines base class for record classes in rc____.h files . Manually generated file.\n "
2956- " // also <rc___.h> file(s) are included below.\n "
2960+ " #include \" ancrec.h\" // defines base class for record classes. Manually generated file.\n "
2961+ " // also rccn.h is included below.\n "
29572962 " \n "
29582963 " #undef o // in case an .h file defines o\n " // 1-95
29592964 );
@@ -2973,9 +2978,8 @@ LOCAL void wSrfd1( FILE *f)
29732978 for (int i = 0 ; i < nfdtypes; i++)
29742979 {
29752980 // write data type 0 as "0", not "DTSI" or whatever is first, for clearer entry 0 (FDNONE)
2976- char * dtTx = (Fdtab[i].dtype ==0 ? const_cast <char *>(" 0" )
2977- : strtcat ( " DT" , dtnames[ dtnmi[ DTBMASK&(Fdtab[i].dtype ) ] ],
2978- NULL ) );
2981+ const char * dtTx = (Fdtab[i].dtype ==0 ? " 0"
2982+ : strtcat ( " DT" , dtnames[ dtnmi[ DTBMASK&(Fdtab[i].dtype ) ] ], NULL ) );
29792983 /* write line: DTXXXX, LMXXXX, UNXXXX, // number NAME */
29802984 fprintf ( f, " {%15s, %10s, %13s },\t //%3d %s\n " ,
29812985 dtTx,
@@ -2990,23 +2994,24 @@ LOCAL void wSrfd1( FILE *f)
29902994
29912995// Write stuff above "fir" tables for record types
29922996
2993- fprintf ( f,
2997+ fprintf (f,
29942998 " \n\n /*========== small FIELDS-IN-RECORDS tables for each record type */\n "
29952999 " \n "
2996- " /* COLUMNS ARE\n "
2997- " .fdTy .evf .ff .off .mName \n "
2998- " (sFdtab (vari- (fld \n "
2999- " index) ation) flgs) (member offset) (member name) field type name\n "
3000- " ------- ------ ----- ----------------- ------------------ --------------- */\n "
3001- " \n "
3002- " /*lint -e619 suppress msg for putting \" text\" in pointer */\n\n " );
3000+ " // COLUMNS ARE\n "
3001+ " // ff field flags\n "
3002+ " // fdTy field type (sFdtab idx)\n "
3003+ " // evf variability (evaluation interval)\n "
3004+ " // nxsc fn of next field requiring special case copy\n "
3005+ " // off member offset\n "
3006+ " // mName member name\n "
3007+ " // data type (as comment)\n\n " );
30033008
30043009// wSrfd3, called for each record type, continues the file
30053010} // wSrfd1
30063011// ======================================================================
30073012LOCAL void wSrfd2 ( FILE *f)
30083013
3009- // write "Small record and field descriptor" C source file for compilation and linking into applications
3014+ // write "Small record and field descriptor" c++ source file for compilation and linking into applications
30103015
30113016// PART 2 of 4 parts: portion repeated at each *file statement
30123017
@@ -3019,7 +3024,7 @@ LOCAL void wSrfd2( FILE *f)
30193024// ======================================================================
30203025LOCAL void wSrfd3 ( FILE *f)
30213026
3022- // write "Small record and field descriptor" C source file for compilation and linking into applications
3027+ // write "Small record and field descriptor" C++ source file for compilation and linking into applications
30233028
30243029// PART 3 of 4 parts: portion repeated for each record type: fields-in-record table for current record.
30253030
@@ -3032,61 +3037,77 @@ LOCAL void wSrfd3( FILE *f)
30323037
30333038// for file format see comments in srd.h, or in srfd.cpp as output.
30343039{
3040+ // identify fields that cannot be copied bit-wise
3041+ // chain them together for use in e.g. record::Copy
3042+ std::vector< int > nxsc (rcdesc->rcdnfds , -1 );
3043+ int iNxscPrior = 0 ;
3044+ for (int j = 0 ; j < rcdesc->rcdnfds ; j++)
3045+ {
3046+ int fdi = rcdesc->rcdfdd [j].rcfdnm ; // field type
3047+ if (strcmp ( rcfdnms[fdi], " CHP" )==0 )
3048+ { nxsc[iNxscPrior] = j;
3049+ iNxscPrior = j;
3050+ }
3051+ }
3052+
30353053 fprintf ( f, " struct SFIR sfir%s[] =\t // fields info for RT%s\n "
30363054 " {\n #define o(m) offsetof(%s,m)\n "
3037- // {dddd, dddd, dddd,ssssssssssssssssssss,sssssssssssssssssss },
3038- " // .ff .fdTy .evf .off .mName\n " ,
3055+ " // ff fdTy evf nxsc off mName\n " ,
30393056 rcNam, rcNam, rcNam );
30403057 for (int j = 0 ; j < rcdesc->rcdnfds ; j++) // fields loop
30413058 {
30423059 int fdi = rcdesc->rcdfdd [j].rcfdnm ; // get field type
3043- fprintf ( f, " {%4d, %4d, %4d,%20s,%19s },\t // %s\n " ,
3060+ fprintf ( f, " {%4d, %4d, %4d, %4d, %20s,%19s },\t // %s\n " ,
30443061 rcdesc->rcdfdd [j].ff , // field flags (attributes)
30453062 fdi, // field type
30463063 rcdesc->rcdfdd [j].evf , // field variation
3064+ nxsc[ j], // next special copy field
30473065 strtprintf (" o(%s)" , fldFullNm2[rcseq][j].c_str ()), // full member name, in macro call to make compiler supply offset
30483066 enquote ( fldNm2[ rcseq][j].c_str ()), // user member name in quotes (for probes, error messages)
30493067 rcfdnms[fdi] ); // name of field type, in comment
30503068#define WARNAT (30 -1 ) // extra -1 got lots of messages
30513069 if (strlen (fldNm2[ rcseq][j].c_str ()) > WARNAT) // report overlong ones
30523070 rcderr ( " Warning: member name over %d long: %s" , WARNAT, fldNm2[ rcseq][j].c_str ());
30533071 }
3054- fprintf ( f, " { 0, 0, 0, 0, 0 }\t // terminator\n "
3072+ fprintf ( f, " { 0, 0, 0, 0, 0, 0 }\t // terminator\n "
30553073 " #undef o\n "
30563074 " }; // sfir%s\n\n " , rcNam );
30573075} // wSrfd3
30583076// ======================================================================
3059- LOCAL void wSrfd4 ( FILE *f)
3060-
3061- // write "Small record and field descriptor" C source file for compilation and linking into applications
3062-
3063- // PART 4 of 4 parts: stuff after portion repeated for each record type; small record descriptor table.
3064- {
3065-
3066- // Write small record descriptor table
3067-
3068- fprintf ( f, " \n\n /*========== small RECORD DESCRIPTOR table */\n "
3069- " \n "
3070- " // find desired entry by searching for .rt \n "
3071- " \n "
3072- " SRD sRd[] =\n "
3073- " { // recTy, #fds, fields-in-record pointer\n "
3074- " // .rt .nFlds .fir\n " );
3075- for (int i = 1 ; i < nrcnms; i++) // loop records types
3076- // note start at 1 to skip RTNONE
3077- {
3078- RCD* rd = (RCD *)( (char *)Rcdtab + (ULI)Rcdtab[ rctypes[i] & RCTMASK]);
3079- // use offset stored in pointer array
3080- // write line " RTXXXX, nFields, sfirXXXX,"
3081- fprintf ( f, " {%15s, %3d, sfir%s },\n " ,
3082- strtcat ( " RT" , rcnms[i], NULL ),
3083- rd->rcdnfds , rcnms[i] );
3084- }
3085- fprintf ( f, " { 0, 0, 0 }\t // terminate table for searching\n "
3086- " }; // sRd[]\n " );
3087-
3088- // caller recs() finishes file and closes.
3089- } // wSrfd4
3077+ #if 0
3078+ 0 DROPPED 6-2023 (unused)
3079+ 0 LOCAL void wSrfd4( FILE *f)
3080+ 0
3081+ 0 // write "Small record and field descriptor" C++ file for compilation and linking into applications
3082+ 0
3083+ 0 // PART 4 of 4 parts: stuff after portion repeated for each record type; small record descriptor table.
3084+ 0 {
3085+ 0
3086+ 0 // Write small record descriptor table
3087+ 0
3088+ 0 fprintf( f, "\n\n/*========== small RECORD DESCRIPTOR table */\n"
3089+ 0 "\n"
3090+ 0 " // find desired entry by searching for .rt \n"
3091+ 0 "\n"
3092+ 0 "SRD sRd[] =\n"
3093+ 0 "{ // recTy, #fds, fields-in-record pointer\n"
3094+ 0 " // .rt .nFlds .fir\n" );
3095+ 0 for (int i = 1; i < nrcnms; i++) // loop records types
3096+ 0 // note start at 1 to skip RTNONE
3097+ 0 {
3098+ 0 RCD* rd = (RCD *)( (char *)Rcdtab + (ULI)Rcdtab[ rctypes[i] & RCTMASK]);
3099+ 0 // use offset stored in pointer array
3100+ 0 // write line " RTXXXX, nFields, sfirXXXX,"
3101+ 0 fprintf( f, " {%15s, %3d, sfir%s },\n",
3102+ 0 strtcat( "RT", rcnms[i], NULL),
3103+ 0 rd->rcdnfds, rcnms[i] );
3104+ 0 }
3105+ 0 fprintf( f, " { 0, 0, 0 }\t// terminate table for searching\n"
3106+ 0 "}; // sRd[]\n");
3107+ 0
3108+ 0 // caller recs() finishes file and closes.
3109+ 0 } // wSrfd4
3110+ #endif
30903111
30913112// ======================================================================
30923113LOCAL void sumry () // write rcdef summary to screen and file
0 commit comments