Skip to content

Commit

Permalink
Added some comments explaining that the pPrevSrcPhrase I added to som…
Browse files Browse the repository at this point in the history
…e routines is not currently being used, but may be used in the future.
  • Loading branch information
pngbill committed Jan 2, 2025
1 parent 57dc281 commit 67ecfa0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 32 deletions.
19 changes: 10 additions & 9 deletions source/Adapt_ItDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9883,7 +9883,7 @@ void CAdapt_ItDoc::TransferFixedSpaceInfo(CSourcePhrase* pDestSrcPhrase, CSource
/// \param pos_callers -> the iterator position locating the passed in pSrcPhrase
/// pointer (its use herein is deprecated)
/// \param pSrcPhrase <- pointer of the source phrase
/// \param pPrevSrcPhrase <- pointer of the previous source phrase // whm 28Dec2024 added
/// \param pPrevSrcPhrase <- pointer of the previous source phrase // whm 28Dec2024 added - unused - may use in future
/// \param fixesStr -> (its use herein is deprecated, the caller adds to it if
/// FALSE is returned)
/// \param pNewList <- the parsed new source phrase instances
Expand Down Expand Up @@ -9911,7 +9911,7 @@ void CAdapt_ItDoc::TransferFixedSpaceInfo(CSourcePhrase* pDestSrcPhrase, CSource
///////////////////////////////////////////////////////////////////////////////
bool CAdapt_ItDoc::ReconstituteOneAfterPunctuationChange(CAdapt_ItView* pView,
SPList*& WXUNUSED(pList), SPList::Node* WXUNUSED(pos_callers), CSourcePhrase*& pSrcPhrase,
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added - unused - may use in future
wxString& WXUNUSED(fixesStr), SPList*& pNewList, bool bIsOwned)
{
// BEW added 5Apr05
Expand All @@ -9935,7 +9935,7 @@ bool CAdapt_ItDoc::ReconstituteOneAfterPunctuationChange(CAdapt_ItView* pView,
int numElements = 1; // default

// whm 5Feb2024 removed unused parameters - now calls FromSingleMakeSstr2()
srcPhrase = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added pPrevSrcPhrase parameter
srcPhrase = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added pPrevSrcPhrase parameter - unused - may use in future

gloss = pSrcPhrase->m_gloss; // we don't care if glosses have punctuation or not
if (pSrcPhrase->m_adaption.IsEmpty())
Expand Down Expand Up @@ -21522,7 +21522,7 @@ int CAdapt_ItDoc::ParseDate(wxChar* pChar, wxChar* pEnd, wxString spacelessPunct
// whitespace(s), and getting to the puncts may require parsing first over one or more inlineBindingEndMarkers
// whm 26Dec2024 added an additional reference parameter wxString& wordSuffix to the header of this function
// which allows returning to the caller any word suffix that exists after the position of an inline binding end
// marker.
// marker.
wxChar* CAdapt_ItDoc::ParsePostWordPunctsAndEndMkrs(wxChar* pChar, wxChar* pEnd, CSourcePhrase* pSrcPhrase,
int& itemLen, wxString& wordSuffix, wxString spacelessPuncts)
{
Expand Down Expand Up @@ -24591,7 +24591,7 @@ int CAdapt_ItDoc::RetokenizeText(bool bChangedPunctuation, bool bChangedFilterin
if (bChangedPunctuation)
{
pos_pSP = gpApp->m_pSourcePhrases->GetFirst();
CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added
CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added - unused - may use in future
while (pos_pSP != NULL)
{
oldPos = pos_pSP;
Expand All @@ -24602,7 +24602,7 @@ int CAdapt_ItDoc::RetokenizeText(bool bChangedPunctuation, bool bChangedFilterin
// many to the list, or remove some, or leave number in the list unchanged
bSuccessful = ReconstituteAfterPunctuationChange(pView,
gpApp->m_pSourcePhrases, oldPos, pSrcPhrase,
pPrevSrcPhrase, // whm 28Dec2024 added
pPrevSrcPhrase, // whm 28Dec2024 added - unused - may use in future
fixesStr);
if (!bSuccessful)
{
Expand Down Expand Up @@ -24631,7 +24631,7 @@ int CAdapt_ItDoc::RetokenizeText(bool bChangedPunctuation, bool bChangedFilterin
// //wxString progMsg = _("Retokenizing - File: %s - %d of %d Total words and phrases");
// //progMsg = progMsg.Format(progMsg,gpApp->m_curOutputFilename.c_str(),nOldCount,nOldTotal);
//}
pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added
pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added - unused - may use in future
} // end of while (pos_pSP != NULL)
}

Expand Down Expand Up @@ -26346,10 +26346,11 @@ wxString CAdapt_ItDoc::MakeAdaptionAfterPunctuationChange(wxString& targetStrWit
/// without loss, and alerting the user to where we think a visual inspection should be
/// done in order to verify the results are acceptable - and edit if not.
/// whm 28Dec2024 added a CSourcePhrase*& pPrevSrcPhrase parameter to the function header.
/// Currently pPrevSrcPhrase is unused - may use in future
///////////////////////////////////////////////////////////////////////////////
bool CAdapt_ItDoc::ReconstituteAfterPunctuationChange(CAdapt_ItView* pView,
SPList*& pList, SPList::Node* pos_callers, CSourcePhrase*& pSrcPhrase,
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added - unused - may use in future
wxString& fixesStr)
{
int nOriginalCount = pSrcPhrase->m_nSrcWords;
Expand Down Expand Up @@ -26653,7 +26654,7 @@ bool CAdapt_ItDoc::ReconstituteAfterPunctuationChange(CAdapt_ItView* pView,
// CSourcePhrase and so is not visible in the layout
bool bWasOK = ReconstituteOneAfterPunctuationChange(
pView, pList, pos_callers, pSrcPhrase,
pPrevSrcPhrase, fixesStr, pResultList, FALSE); // whm 28Dec2024 added pPrevSrcPhrase parameter
pPrevSrcPhrase, fixesStr, pResultList, FALSE); // whm 28Dec2024 added pPrevSrcPhrase parameter - unused - may use in future

//#ifdef _DEBUG
// wxLogDebug(_T(" 17950 After ...One..., RETURNED bWasOK = %d , pSrcPhrase sn = %d m_srcPhrase = %s"),
Expand Down
4 changes: 2 additions & 2 deletions source/Adapt_ItDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ bool bMarkAsDirty); // might want it instantly saveable
void RemoveVenturaOptionalHyphens(wxString*& pstr);
bool ReconstituteAfterPunctuationChange(CAdapt_ItView* pView, SPList*& pList,
SPList::Node* pos_callers, CSourcePhrase*& pSrcPhrase,
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added - unused - may use in future
wxString& fixesStr);
bool ReconstituteOneAfterPunctuationChange(CAdapt_ItView* pView, SPList*& WXUNUSED(pList),
SPList::Node* WXUNUSED(pos_callers), CSourcePhrase*& pSrcPhrase,
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added
CSourcePhrase*& pPrevSrcPhrase, // whm 28Dec2024 added - unused - may use in future
wxString& WXUNUSED(fixesStr), SPList*& pNewList, bool bIsOwned);
bool ReconstituteAfterFilteringChange(CAdapt_ItView* pView, SPList*& pList, wxString& fixesStr);
void SetupForSFMSetChange(enum SfmSet oldSet, enum SfmSet newSet, wxString oldFilterMarkers,
Expand Down
6 changes: 3 additions & 3 deletions source/Adapt_ItView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28307,7 +28307,7 @@ bool CAdapt_ItView::ScanSpanDoingSourceTextReconstruction(SPList* pSrcPhrases,
int length = 0;
pos_pSP = pSublist->GetFirst(); // re-initialize pos_pSP to start of sublist
wxASSERT(pos_pSP != NULL);
CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added
CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added - unused - may use in future
while (pos_pSP != NULL)
{
pSrcPhrase = pos_pSP->GetData();
Expand All @@ -28325,7 +28325,7 @@ bool CAdapt_ItView::ScanSpanDoingSourceTextReconstruction(SPList* pSrcPhrases,
else
{
// whm 5Feb2024 removed unused parameters - now calls FromSingleMakeSstr2()
srcStr = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added 2nd parameter
srcStr = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added 2nd parameter - unused - may use in future
}
// figure out how to concatenate the substrings - after an endmarker (we'll
// assume USFM, it's unlikely we'll have to bother with PNG 1998 SFM now, and
Expand Down Expand Up @@ -28387,7 +28387,7 @@ bool CAdapt_ItView::ScanSpanDoingSourceTextReconstruction(SPList* pSrcPhrases,
}
srcStr.Empty();
} // end of block for TRUE result from test of sequence number
pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added
pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added - unused - may use in future
} // end of loop

// Don't leak memory. In the next call, FALSE is bDoPartnerPileDeletionAlso; calls
Expand Down
14 changes: 7 additions & 7 deletions source/ExportFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17612,8 +17612,8 @@ int RebuildSourceText(wxString& source, SPList* pUseThisList)

// whm 28Dec2024 added a pPrevSrcPhrase. This is needed to be able to get filtered information
// restored in correct position from a pPrevSrcPhrase to the pSrcPhrase currently being
// processed in the while loop below. Filtered information is stored on a previous source
// phrase in the incoming pList data.
// processed in the while loop below - unused - may use in future. Filtered information is
// stored on a previous source phrase in the incoming pList data.
CSourcePhrase* pPrevSrcPhrase = NULL;

while (pos_pList != NULL)
Expand Down Expand Up @@ -17904,7 +17904,7 @@ int RebuildSourceText(wxString& source, SPList* pUseThisList)
#endif

// whm 5Feb2024 removed unused parameters
str = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added second parameter
str = FromSingleMakeSstr2(pSrcPhrase, pPrevSrcPhrase); // whm 28Dec2024 added second parameter - unused - may use in future

/* BEW 17May CreateOldSrcBitsArr works correctly, it was put here only to test it - leave until we move it elsewhere for needed use
wxString spacelessPuncts; // make the string for sourceLang
Expand Down Expand Up @@ -18033,7 +18033,7 @@ int RebuildSourceText(wxString& source, SPList* pUseThisList)
str.Empty();
} // end of else block, i.e., it's a single word sourcephrase

// whm 28Dec2024 added to keep track of previous source phrase data
// whm 28Dec2024 added to keep track of previous source phrase data - unused - may use in future
pPrevSrcPhrase = pSrcPhrase;

} // end of while (pos_pList != NULL) for scanning whole document's CSourcePhrase instances
Expand Down Expand Up @@ -19166,7 +19166,7 @@ int RebuildTargetText(wxString& target, SPList* pUseThisList)
SPList::Node* pos_pList = pList->GetFirst();
wxASSERT(pos_pList != NULL);

CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added
CSourcePhrase* pPrevSrcPhrase = NULL; // whm 28Dec2024 added - unused - may use in future

while (pos_pList != NULL)
{
Expand Down Expand Up @@ -19296,7 +19296,7 @@ int RebuildTargetText(wxString& target, SPList* pUseThisList)
// with USFM fixed space symbol ~ conjoining them; first TRUE is bDoCount
// (of words in the free translation section, if any such section), and
// second TRUE is bCountInTargetText
str = FromSingleMakeTstr(pSrcPhrase, pPrevSrcPhrase, // whm 28Dec2024 added pPrevSrcPhrase parameter
str = FromSingleMakeTstr(pSrcPhrase, pPrevSrcPhrase, // whm 28Dec2024 added pPrevSrcPhrase parameter - unused - may use in future
str, TRUE, TRUE, bLastTstrOnlyContentWasPunct);
#if defined(_DEBUG)
wxLogDebug(_T("Rebuild TGT: line %d, sn=%d, FromSingleMakeTstr= [%s]"), __LINE__, pSrcPhrase->m_nSequNumber, str.c_str());
Expand Down Expand Up @@ -19396,7 +19396,7 @@ int RebuildTargetText(wxString& target, SPList* pUseThisList)

#endif

pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added
pPrevSrcPhrase = pSrcPhrase; // whm 28Dec2024 added - unused - may use in future

}// end of while (pos_pList != NULL)

Expand Down
19 changes: 10 additions & 9 deletions source/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6664,7 +6664,8 @@ wxString RemoveCustomFilteredInfoFrom(wxString str)
/// the next call of this function. This may be necessary when the Tstr returned from this
/// function only contains punctuation and not m_targetStr content - due to the user
/// selecting <no adaptation> on pSingleSrcPhrase.
/// whm 28Dec2024 added a parameter pPrevSingleSrcPhrase making it the second parameter
/// whm 28Dec2024 added a parameter pPrevSingleSrcPhrase making it the second parameter.
/// - unused - may use in future.
/// This is needed to track any filtered information which is stored on a previous source
/// phrase.
/////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -7200,7 +7201,7 @@ wxString FromSingleMakeTstr(CSourcePhrase* pSingleSrcPhrase, CSourcePhrase* pPre
if (pSingleSrcPhrase->m_tgtMkrPattern.IsEmpty())
{
// whm 5Feb2024 removed unused paramters - and retired the older version
wxString Sstr = FromSingleMakeSstr2(pSingleSrcPhrase, pPrevSingleSrcPhrase); // whm 28Dec2024 added 2nd parameter
wxString Sstr = FromSingleMakeSstr2(pSingleSrcPhrase, pPrevSingleSrcPhrase); // whm 28Dec2024 added 2nd parameter - unused - may use in future
// need Sstr for the dialog; and we pass it to AutoPlaceSomeMarkers(),
// but the latter currently does not use it internally (one day, it might)
#if defined (_DEBUG)
Expand Down Expand Up @@ -8562,12 +8563,12 @@ wxString FromSingleMakeSstr(CSourcePhrase* pSingleSrcPhrase)
// throughout the application.
// whm 26Dec2024 - 28Dec2024 modifications made to improve the ordering of
// exported material. Added a second parameter pPrevSingleSrcPhrase to the
// function header. We need to be able to track the previous source phrase
// in pList in order to have access to filtered information which is now
// stored on a previous source phrase. To correctly make up the source text
// for a single source phrase, and include filtered information, we must be
// able to access any of its filtered information which would have been
// stored on a pPrevSingleSrcPhrase.
// function header - unused - may use in future. We need to be able to track
// the previous source phrase in pList in order to have access to filtered
// information which is now stored on a previous source phrase. To correctly
// make up the source text for a single source phrase, and include filtered
// information, we must be able to access any of its filtered information
// which would have been stored on a pPrevSingleSrcPhrase.
// Here is a detailed example that demonstrates this need taken from a
// unittest text:
// --------
Expand Down Expand Up @@ -8621,7 +8622,7 @@ wxString FromSingleMakeSstr(CSourcePhrase* pSingleSrcPhrase)
//
//wxString FromSingleMakeSstr2(CSourcePhrase* pSingleSrcPhrase)
wxString FromSingleMakeSstr2(CSourcePhrase* pSingleSrcPhrase, // whm 5Feb2024 - this one is now the only one used in the app
CSourcePhrase* pPrevSingleSrcPhrase) // whm 28Dec2024 added second parameter pPrevSingleSrcPhrase
CSourcePhrase* pPrevSingleSrcPhrase) // whm 28Dec2024 added second parameter pPrevSingleSrcPhrase - unused - may use in future
{
CAdapt_ItDoc* pDoc = gpApp->GetDocument();

Expand Down
4 changes: 2 additions & 2 deletions source/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ wxString GetFilteredStuffAsUnfiltered(CSourcePhrase* pSrcPhrase,
wxString RebuildFixedSpaceTstr(CSourcePhrase* pSingleSrcPhrase); // BEW created 11Oct10
wxString FromMergerMakeTstr(CSourcePhrase* pMergedSrcPhrase, wxString Tstr, bool bDoCount,
bool bCountInTargetText);
// whm 28Dec2024 added second parameter pPrevSingleSrcPhrase
// whm 28Dec2024 added second parameter pPrevSingleSrcPhrase - unused - may use in future
wxString FromSingleMakeTstr(CSourcePhrase* pSingleSrcPhrase, CSourcePhrase* pPrevSingleSrcPhrase,
wxString Tstr, bool bDoCount,
bool bCountInTargetText, bool& bLastTstrOnlyContentWasPunct);
Expand All @@ -392,7 +392,7 @@ bool AnalyseSstr(wxString s, wxArrayString& arrItems, wxString separator, wxSt

wxString FromSingleMakeSstr(CSourcePhrase* pSingleSrcPhrase); // whm 5Feb2024 removed unused parameters - no longer used
//wxString FromSingleMakeSstr2(CSourcePhrase* pSingleSrcPhrase); // whm 5Feb2024 - this one is now the only one used in the app
// whm 28Dec2024 added second parameter pPrevSingleSrcPhrase
// whm 28Dec2024 added second parameter pPrevSingleSrcPhrase - unused - may use in future
wxString FromSingleMakeSstr2(CSourcePhrase * pSingleSrcPhrase, // whm 5Feb2024 - this one is now the only one used in the app
CSourcePhrase* pPrevSingleSrcPhrase);
wxString BuildPostWordStringWithoutUnfiltering(CSourcePhrase* pSingleSrcPhrase, wxString& inlineNBMkrs); // BEW added 8May17
Expand Down

0 comments on commit 67ecfa0

Please sign in to comment.