From fd04d5e931d0a577a7a6533c6c24175f8af5611a Mon Sep 17 00:00:00 2001 From: Chip Barnaby Date: Fri, 3 Jan 2025 16:12:40 -0500 Subject: [PATCH] Probe modernizawtion WIP --- src/ancrec.cpp | 6 +-- src/ancrec.h | 19 +++++---- src/cncult.cpp | 99 ++--------------------------------------------- src/cul.cpp | 10 ++--- src/cuparse.h | 1 + src/cuparsex.h | 2 +- src/cuprobe.cpp | 100 ++++++++++++++++++++++++++++++++++++++++++------ src/srd.h | 33 ++++++++++++++++ 8 files changed, 145 insertions(+), 125 deletions(-) diff --git a/src/ancrec.cpp b/src/ancrec.cpp index 28eee2c14..6a6552d04 100644 --- a/src/ancrec.cpp +++ b/src/ancrec.cpp @@ -863,7 +863,7 @@ basAnc::basAnc( int flags, SFIR * _fir, USI _nFlds, const char * _what, USI _eSz sOff = _sOff; // .. mn = 1; // min record subscript 1 (overwritten with 0 if static) // ptr() = 0; // is done in derived class constructor (deriv vf not avail here; ptr is pure!) - an_pCULT = pCULT; // pointer to associated input CULT table, nullptr = unknown + ba_pCULT = pCULT; // pointer to associated input CULT table, nullptr = unknown if (!dontRegister) regis(); // conditionally include anchor for nextAnc() iteration } // basAnc::basAnc @@ -1351,7 +1351,6 @@ const char* basAnc::getChoiTx( // return text of given value for a choice data *pIsHid = pTyX == chtyHIDDEN; return chtx; } // basAnc::getChoiTx -//----------------------------------------------------------------------------- //============================================================================= //***************************************************************************** @@ -1434,7 +1433,6 @@ const char* getFileName( int fileIx) // get text for file name index return "(bug)"; // (or memory was full at name save) } // getFileName - -//*************************************************** IF-OUTS ************************************************************* +//----------------------------------------------------------------------------- // end of ancrec.cpp diff --git a/src/ancrec.h b/src/ancrec.h index 4bff66b58..3ff57953b 100644 --- a/src/ancrec.h +++ b/src/ancrec.h @@ -85,8 +85,11 @@ class basAnc // base class for record anchors: basAnc // members setable by application user language (cul.cpp) BP tyB; // 0 or ptr to user language TYPES anchor in heap (destructor deletes) BP ownB; // 0 or ptr to anchor whose objects own this anchor's objects (record.ownTi) - const CULT* an_pCULT; // NULL or associated CULT input table for records of this type + const CULT* ba_pCULT; // NULL or associated CULT input table for records of this type // simplifies back translation of input names + const MODERNIZEPAIR* ba_probeModernizeTable; // table of old / new probe names re handling renamed record members + // nullptr if none; see cuprobe.cpp + basAnc(); basAnc( int flags, SFIR * fir, USI nFlds, const char * what, USI eSz, RCT rt, USI sOff, const CULT* pCult, int dontRegister=0 ); void FC regis(); @@ -117,15 +120,18 @@ class basAnc // base class for record anchors: basAnc const char* getChoiTx( int fn, int options=0, SI chan=-1, BOOL* bIsHid=NULL) const; const char* culMbrIdTx(int fn) const; int culMbrArrayDim(int fn) const; - void an_SetCULTLink( const CULT* pCULT) { an_pCULT = pCULT; } - static void an_SetCULTLinks(); + void ba_SetCULTLink( const CULT* pCULT) { ba_pCULT = pCULT; } int GetCount() const; int GetCountMax() const { return n-mn+1; // max possible # records (includes unused) // faster than GetCount() } int MakeRecordList(char* list, size_t listDim, const char* brk, const char* (*proc)(const record* pR)=nullptr) const; - + void ba_SetProbeModernizeTable(const MODERNIZEPAIR* pMP) { + ba_probeModernizeTable = pMP; + } + const char* ba_ModernizeProbeName(const char* inputName) const; + protected: virtual void conRec( TI i, SI noZ=0) = 0; // execute constructor for record i virtual void desRec( TI i) = 0; // .. destructor @@ -380,8 +386,7 @@ template class anc : public basAnc int GetChildCount(const record* pParent) const; RC CheckChildCount(const record* pParent, std::pair countLimits, const char*& msg) const; RC GetIthChild(const record* pParent, int iSought, T* &pRRet, int erOp=ERR) const; - - + protected: virtual void desRec( TI i) { if (p[i].r_status) @@ -563,7 +568,7 @@ template RC anc::RunDup( // duplicate records for run // delete old records, alloc to needed size for min fragmentation RC rc = al(src.n+nxRecs, erOp, _ownB); - an_pCULT = src.an_pCULT; // assume same associated CULT + ba_pCULT = src.ba_pCULT; // assume same associated CULT const T* pT; RLUP( src, pT) diff --git a/src/cncult.cpp b/src/cncult.cpp index cd175830c..d3e82e3f1 100644 --- a/src/cncult.cpp +++ b/src/cncult.cpp @@ -3208,9 +3208,9 @@ void FC cnPreInit() // preliminary cncult.cpp initialization [needed before sho // 'showProbeNames' displays member names of all registered rats for CSE -p. // It is executed before most initialization and can be executed without doing a run. -{ - basAnc::an_SetCULTLinks(); // link record anchors to associated input language CULTs +// note rats are now 'registered' in cse.cpp so input and run rats can be intermixed. +{ // clear/Init the "Top input RAT" which holds once-only input parameters, set mainly via cnTopCult[] TopiR.statSetup(Topi, 1); // init cncult:TopiR as basAnc with 1 static record cncult:Topi. // and zero record Topi and init its front members. @@ -3224,15 +3224,9 @@ void FC cnPreInit() // preliminary cncult.cpp initialization [needed before sho WthrR.ba_flags |= RFNOEX; WthrNxHrR.ba_flags |= RFNOEX; - // note rats are now 'registered' in cse.cpp so input and run rats can be intermixed. + SetupProbeModernizeTables(); } // cnPreInit -//----------------------------------------------------------------------------- -/*static*/ void basAnc::an_SetCULTLinks() -{ - // an_pCULT links set during anc creation (via makAncXXX()) - // nothing further required -} // basAnc::an_SetCULTLinks //============================================================================================ /////////////////////////////////////////////////////////////////////////////// @@ -3383,91 +3377,4 @@ int culShowDoc( // public function: display CULT tree } // culDoc1 //============================================================================= -/************************************************ rest of file is if-outs ***************************************************/ - -#if 0 //ifdef OLDAT // undefined in cnglob.h, 5-92 -o /*------------------------ TERMINAL command (for zone) ----------------------*/ -o -o //-------------------------------------------- terminal pre-input fcn: limit # -o // note: pre-input not Itf used so ownTi (=zi) already set in RAT for errmsg. -o LOCAL RC tuxPrf( CULT *c, TUX *p, ZNI *p2, void *p3) /*ARGSUSED*/ -o{ -o TUX *tu; SI n=0; -o -o // check for too many terminals for zone. -o // NOTE zone terminal tables are in ZNR (not ZNI) -- setup deferred until topTu() below. -o -o // count terminals for same zone. Current one will be included. -o RLUP( TuxiB, tu) // loop TUX records -o if (tu->ownTi==p2->ss) // if terminal belongs to cur zone (reference type, need not check FsVAL 12-91) -o n++; // count it -o -o // error if too many -o if (n > MAX_ZONETUS) // =3, cndefns.h -o return oer( p, "More than %d terminals for zone '%s'", MAX_ZONETUS, p2->Name() ); -o -o return RCOK; -o} // tuxPrf -o -o static CULT tuxT[] = //------------------------- TERMINALX subCmd table for ZONE -o // id cs fn f uc evf ty b dfls p2 ckf -{ -o //-------- ---- ------------------- -------------- -- ----- ----- ----- --------- ------- --- -o "*", STAR, 0, PRFP, 0, 0, 0, 0, N, 0.f, v tuxPrf, N), -o -o "tuxZone", DAT, TUX_OWNTI, NO_INP|RDFLIN, 0, 0, TYIREF, &ZiB, N, 0.f, N, N), -o "tuxTLH", DAT, TUX_TUXTLH, 0, 0, VHRLY, TYFL, 0, N, 68.f, N, N), -o "tuxMxLH", DAT, TUX_TUXMXLH, 0, 0, VHRLY, TYFL, 0, N, 0.f, N, N), -o "tuxMnLH", DAT, TUX_TUXMNLH, 0, 0, VHRLY, TYFL, 0, N, 0.f, N, N), -o #ifdef OLDAT // undefined in cnglob.h, 5-92 -o o "tuxAhu", DAT, TUX_TUXAHI, 0, 0, VEOI, TYREF, &AhuxiB,N, 0, N, N), -o #endif -o "tuxTH", DAT, TUX_TUXTH, 0, 0, VHRLY, TYFL, 0, N, 68.f, N, N), -o "tuxTC", DAT, TUX_TUXTC, 0, 0, VHRLY, TYFL, 0, N, 78.f, N, N), -o "tuxCMn", DAT, TUX_TUXCMN, 0, 0, VHRLY, TYFL, 0, N, 0.f, N, N), -o "tuxCMxH", DAT, TUX_TUXCMXH, 0, 0, VHRLY, TYFL, 0, N, 0.f, N, N), -o "tuxCMxC", DAT, TUX_TUXCMXC, 0, 0, VHRLY, TYFL, 0, N, 0.f, N, N), -o -o "endTerminalx",ENDER,0, 0, 0, 0, 0, 0, N, 0.f, N, N), -oCULT() -o -}; // tuxT -#endif - -// znT deletions: -#ifdef OLDNV // 1-92 cndefns.h -o//natVent -o "nvAHi", DAT, ZI(NVAHI), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "nvALo", DAT, ZI(NVALO), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "nvHD", DAT, ZI(NVHD), 0, 0, VEOI, TYFL, 0, N, 2.f, N, N), -o "nvAzmI", DAT, ZI(NVAZMI), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "nvStEM", DAT, ZI(NVSTEM), 0, 0, VEOI, TYFL, 0, N, 1.f, N, N), -o "nvDdEM", DAT, ZI(NVDDEM), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "nvDiEM", DAT, ZI(NVDIEM), 0, 0, VEOI, TYFL, 0, N, .5f, N, N), -o "nvTD", DAT, ZI(NVTD), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -#endif -#ifdef OLDFV -o//fanvent -o "fvCfm", DAT, ZI(FVCFM), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "fvKW", DAT, ZI(FVKW), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "fvFz", DAT, ZI(FVFZ), 0, 0, VEOI, TYFL, 0, N, 1.f, N, N), -o "fvDECeff", DAT, ZI(FVDECEFF), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "fvIEDeff", DAT, ZI(FVIECEFF), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "fvTD", DAT, ZI(FVTD), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "fvWbMax", DAT, ZI(FVWBMAX), 0, 0, VEOI, TYFL, 0, N, 999.f, N, N), -#endif -#ifdef OLDCF -o//ceiling fan -o "cfKW", DAT, ZI(CFKW), 0, 0, VEOI, TYFL, 0, N, 0.f, N, N), -o "cfFz", DAT, ZI(CFFZ), 0, 0, VEOI, TYFL, 0, N, 1.f, N, N), -#endif -#ifdef OLDNV // old comments, moved to facilitate edit -o//natVent. want erMsg (at end zone) for only 1 of ahigh, alow > 0. -o /* 1-91: chip to verify traditional dH default: something like 2 for 1 story, 8 for 2 stories. 2-91: his memo shows 0. */ -o // 12-90: otta require azmI iff ddEM is non-0. later. -#endif -#if 0 //ifdef OLDAT // undefined in cnglob.h, 5-92 -o "terminalx", RATE, 0, 0, 0, 0, 0, &TuxiB, N, 0.f, tuxT, N), -#endif - // end of cncult.cpp diff --git a/src/cul.cpp b/src/cul.cpp index 8a8454af5..b0911503a 100644 --- a/src/cul.cpp +++ b/src/cul.cpp @@ -3088,8 +3088,6 @@ LOCAL RC CDEC perNxE( MSGORHANDLE ms, ...) return RCSKIP2END; /* ret special value. eg culRun tests for this value and calls skip2end() (next) */ } // perNxE - -// new 1-19-91. old skip2end is in cul.4 and cul.ifo. //=========================================================================== LOCAL SI FC skip2end( @@ -4687,8 +4685,8 @@ const char* basAnc::culMbrIdTx( // return record field id from cult table int fn) const // field number { // use basAnc's associated CULT - if (an_pCULT) // if basAnc has an associated CULT - { for (const CULT* c=an_pCULT; c->id; c++) + if (ba_pCULT) // if basAnc has an associated CULT + { for (const CULT* c=ba_pCULT; c->id; c++) { if (c->cs==DAT && c->fn==fn) return c->id; } @@ -4737,9 +4735,9 @@ int basAnc::culMbrArrayDim( // return field array dimension cult table int arrayDim = -1; // use basAnc's associated CULT - if (an_pCULT) // if basAnc has an associated CULT + if (ba_pCULT) // if basAnc has an associated CULT { - for (const CULT* c = an_pCULT; c->id; c++) + for (const CULT* c = ba_pCULT; c->id; c++) { if (c->cs==DAT && c->fn==fn && (c->f & ARRAY)) arrayDim = int(intptr_t( c->p2)); diff --git a/src/cuparse.h b/src/cuparse.h index 52c253043..0040f0425 100644 --- a/src/cuparse.h +++ b/src/cuparse.h @@ -44,5 +44,6 @@ void FC curLine( int retokPar, int* pFileIx, int* pline, int* pcol, char *s, siz // cuprobe.cpp void FC showProbeNames(int showAll); +RC SetupProbeModernizeTables(); // end of cuparse.h \ No newline at end of file diff --git a/src/cuparsex.h b/src/cuparsex.h index 4bf4b27cd..642d28adb 100644 --- a/src/cuparsex.h +++ b/src/cuparsex.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file. -// cuparsex.h: parsing-related stuff shared between cuparse.cpp and [obsolete file cumain.cpp] and cuprobe.cpp +// cuparsex.h: parsing-related stuff shared between cuparse.cpp and cuprobe.cpp /* 12-91: Extending this file to stuff shared with files split off of cuparse.cpp: initially, cuprobe.cpp. diff --git a/src/cuprobe.cpp b/src/cuprobe.cpp index c8b3d4a64..4bc6c83db 100644 --- a/src/cuprobe.cpp +++ b/src/cuprobe.cpp @@ -36,8 +36,8 @@ struct PROBEOBJECT // info probe() shares with callees: pass single pointer BP po_inB; // 0 or input basAnc found with given name, 0'd if member name not found (0 is "near NULL") BP po_runB; // 0 or run basAnc found with given name, 0'd if member name not found const char* po_what; // name (.what) of basAnc(s) whose records being probed - SFIR* po_inF; // pointer to "fields-in-record" tables (srfd.cpp) for input rat - SFIR* po_runF; // pointer to "fields-in-record" tables (srfd.cpp) for run rat + const SFIR* po_inF; // pointer to "fields-in-record" tables (srfd.cpp) for input rat + const SFIR* po_runF; // pointer to "fields-in-record" tables (srfd.cpp) for run rat const char* po_mName; // name of member being probed USI po_inFn; // input basAnc field number USI po_runFn; // run basAnc field number @@ -56,7 +56,39 @@ struct PROBEOBJECT // info probe() shares with callees: pass single pointer LOCAL RC FC lopNty4dt( USI dt, USI *pTy, USI *pSz, PSOP *pLop, const char** pErrSub); LOCAL void FC disMember( SFIR *f1, SI isIn, SI isRun, SI showAll); +//----------------------------------------------------------------------------- +RC SetupProbeModernizeTables() +{ + RC rc = RCOK; + static MODERNIZEPAIR RSYS_PMTable[]{ {"fanPwrC", "fanSFPC"}, {nullptr, nullptr} }; + RSiB.ba_SetProbeModernizeTable(RSYS_PMTable); + RsR.ba_SetProbeModernizeTable(RSYS_PMTable); + static MODERNIZEPAIR ZONE_PMTable[]{ {"tzx", "tz"}, {nullptr, nullptr} }; + // ZiB.ba_SetProbeModernizeTable(ZONE_PMTable); + ZrB.ba_SetProbeModernizeTable(ZONE_PMTable); + + return rc; +} // ::SetupProbeModernizeTables +//----------------------------------------------------------------------------- +const char* basAnc::ba_ModernizeProbeName( + const char* probeName) const +{ + if (ba_probeModernizeTable) + { + const char* probeNameWas{ probeName }; + for (const MODERNIZEPAIR* pMP = ba_probeModernizeTable; !pMP->mp_IsEnd(); pMP++) + { + if (pMP->mp_ModernizeIf( probeName)) + { + info("Updating %s name '%s' to '%s'", + what, probeNameWas, probeName); + break; + } + } + } + return probeName; +} // basAnc::ba_ModernizeProbeName //========================================================================== RC FC probe() @@ -145,7 +177,7 @@ RC PROBEOBJECT::po_DoProbe() return RCBAD; // ... sets po_inF and/or po_runF; clears po_inB/po_runB if input does not match. // if here, have match in one OR BOTH tables. - SFIR* f = po_inB ? po_inF : po_runF; // single nonNULL pointer to a fir entry + const SFIR* f = po_inB ? po_inF : po_runF; // single nonNULL pointer to a fir entry po_mName = f->fi_GetMName(); // point member name text for many errMsgs @@ -256,6 +288,36 @@ RC PROBEOBJECT::po_DoProbe() return RCOK; // many other returns above, incl in E macros. caller ERREX's. } // PROBEOBJECT::po_DoProbe //========================================================================== + +//----------------------------------------------------------------------------- +/*static*/ void po_SearchSFIR( + BP& pB, + const SFIR* &pFi, + const SFIR* &pF1, + USI& Fn, + int &m, + int &l) + +{ + const char* mNameSought = pB->ba_ModernizeProbeName(cuToktx); + l = strlenInt(mNameSought); // length of the token to match now + + pF1 = pFi; // fir entry for which preceding tokens (m chars) match + while (_strnicmp( mNameSought, pFi->fi_GetMName() + m, l) // while token does not match (continuation of) member name + || isalnumW(pFi->fi_GetMName()[m]) // .. or matching word/number in table + && isalnumW(pFi->fi_GetMName()[m+l]) ) // .. continues w/o delimiter (ie only initial substring given) + { + pFi++; + Fn++; // try next fir table entry, incr field number + if ( !pFi->fi_fdTy // if end fir table, not found + || m && _strnicmp( pF1->fi_GetMName(), pFi->fi_GetMName(), m) ) /* if preceding m chars of this entry don't match + (all entries with same beginning are together) */ + { + pB = nullptr; + break; // say mbr not found in input basAnc. errMsg done after run basAnc search. + } + } +} RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB and/or po_runB fir tables // uses multiple input tokens as necessary. @@ -274,6 +336,7 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB if (!isWord) return perNx( MH_U0010, // "U0010: Expected a word for object member name, found '%s'" cuToktx ); + // loop to match composite field name, using additional input tokens as necessary, in po_inB AND po_runB fir tables (rest of fcn). @@ -282,15 +345,26 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB int m = 0; // # chars matched by preceding tokens in multitoken member name for ( ; ; ) // loop over input tokens until break or error return { - SFIR *f1 = nullptr; // fir entry for which preceding m chars match - int l = strlenInt(cuToktx); // length of the token to match now + const SFIR *f1 = nullptr; // fir entry for which preceding m chars match + int l = 0; + +#if 1 + if (po_inB) + po_SearchSFIR(po_inB, po_inF, f1, po_inFn, m, l); + if (po_runB) + po_SearchSFIR(po_runB, po_runF, f1, po_runFn, m, l); + +#else // search for input & run fir entries that match current token, and any preceding input tokens (m chars) if (po_inB) // if input basAnc found (by caller) & name matches so far here { + const char* mNameSought = po_inB->ApplyAlias(cuToktx); + l = strlenInt(mNameSought); // length of the token to match now + f1 = po_inF; // fir entry for which preceding tokens (m chars) match - while (_strnicmp( cuToktx, po_inF->fi_GetMName() + m, l) // while token does not match (continuation of) member name + while (_strnicmp( mNameSought, po_inF->fi_GetMName() + m, l) // while token does not match (continuation of) member name || isalnumW(po_inF->fi_GetMName()[m]) // .. or matching word/number in table && isalnumW(po_inF->fi_GetMName()[m+l]) ) // .. continues w/o delimiter (ie only initial substring given) { @@ -307,8 +381,11 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB } if (po_runB) // if run basAnc found (by caller) & name matches so far here { + const char* mNameSought = po_runB->ApplyAlias(cuToktx); + l = strlenInt(mNameSought); // length of the token to match now + f1 = po_runF; // fir entry for which preceding tokens (m chars) match - while (_strnicmp( cuToktx, po_runF->fi_GetMName() + m, l) // while token does not match (continuation of) member name + while (_strnicmp( mNameSought, po_runF->fi_GetMName() + m, l) // while token does not match (continuation of) member name || isalnumW( po_runF->fi_GetMName()[m]) // .. or while matching word/number in table && isalnumW(po_runF->fi_GetMName()[m+l]) ) // .. continues w/o delimiter (only initial substring given) { @@ -323,14 +400,15 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB } } } +#endif // if not found, issue error message. syntax ok if here. if (!po_inB && !po_runB) // if found in neither input nor run records basAnc if (!m) // if first token of name return perNx( MH_U0011, po_what, cuToktx); // "U0011: %s member '%s' not found" - else // fancier error message for partial match - { + else + { // fancier error message for partial match const char* foundPart = strncpy0( NULL, f1->fi_GetMName(), m+1); // truncate to Tmpstr return perNx( MH_U0012, //"U0012: %s member '%s%s' not found: \n" @@ -354,7 +432,7 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB //" match algorithm (PROBEOBJECT::po_FindMember()) enhanced.", po_what, po_inF->fi_GetMName(), po_runF->fi_GetMName() ); - char c = po_inB ? po_inF->fi_GetMName()[m] : po_runF->fi_GetMName()[m]; // next char to match: \0, . [ ] digit alpha _ + const char c = po_inB ? po_inF->fi_GetMName()[m] : po_runF->fi_GetMName()[m]; // next char to match: \0, . [ ] digit alpha _ if (c=='\0') // if end of member name in fir table break; // done! complete matching entry found. leave "for ( ; ; )". @@ -402,7 +480,7 @@ RC PROBEOBJECT::po_FindMember() // parse and look up probe member name in po_inB return RCOK; } // PROBEOBJECT::po_FindMember -//========================================================================== +//----------------------------------------------------------------------------- RC PROBEOBJECT::po_TryImInProbe() // do immediate input probe of already set member if possible, producing constant or reference to same expression as in member. diff --git a/src/srd.h b/src/srd.h index d06607fd0..f4bd1e88a 100644 --- a/src/srd.h +++ b/src/srd.h @@ -190,6 +190,39 @@ struct VALNDT }; #endif // NODTYPES +//============================================================================= +// struct MODERNIZEPAIR: single word modernize, maps old -> current +// used re providing input file backwards compatibility +// e.g. probe name moderization +struct MODERNIZEPAIR // single word modernize: old -> current +{ +private: + const char* mp_oldWord; // prior word + const char* mp_curWord; // current (modern) equivalent + +public: + MODERNIZEPAIR(const char* oldWord, const char* curWord) + : mp_oldWord{ oldWord }, mp_curWord{ curWord } + {} + bool mp_IsEnd() const + { + return mp_oldWord==nullptr; + } + bool mp_ModernizeIf( + const char* &word) const // word that may need modernizing + // e.g. from user input + // returned updated if needed + // returns true iff word modernized (word updated) + // else false + { + bool bMatch = _strcmpi(word, mp_oldWord) == 0; + if (bMatch) + word = mp_curWord; + return bMatch; + } + +}; // struct MODERNIZEPAIR + #endif // ifndef SRD_H at start file // end of srd.h