MCPcopy Create free account
hub / github.com/WinMerge/winmerge / LoadWinMergeDiffsFromDiffUtilsScript3

Method LoadWinMergeDiffsFromDiffUtilsScript3

Src/DiffWrapper.cpp:1453–1601  ·  view source on GitHub ↗

* @brief Walk the diff utils change script, building the WinMerge list of diff blocks */

Source from the content-addressed store, hash-verified

1451 * @brief Walk the diff utils change script, building the WinMerge list of diff blocks
1452 */
1453void
1454CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript3(
1455 struct change * script10,
1456 struct change * script12,
1457 struct change * script02,
1458 const file_data * inf10,
1459 const file_data * inf12,
1460 const file_data * inf02)
1461{
1462 DiffList diff10, diff12, diff02;
1463 diff10.Clear();
1464 diff12.Clear();
1465 diff02.Clear();
1466
1467 const bool usefilters = m_options.m_filterCommentsLines ||
1468 m_options.m_bIgnoreMissingTrailingEol ||
1469 m_options.m_bIgnoreLineBreaks ||
1470 (m_pFilterList && m_pFilterList->HasRegExps()) ||
1471 (m_pSubstitutionList && m_pSubstitutionList->HasRegExps());
1472
1473 for (int file = 0; file < 3; file++)
1474 {
1475 struct change *next = nullptr;
1476 int trans_a0, trans_b0, trans_a1, trans_b1;
1477 int first0, last0, first1, last1, deletes, inserts;
1478 OP_TYPE op;
1479 const file_data *pinf = nullptr;
1480 DiffList *pdiff = nullptr;
1481 PostFilterContext ctxt;
1482
1483 switch (file)
1484 {
1485 case 0: next = script10; pdiff = &diff10; pinf = inf10; break;
1486 case 1: next = script12; pdiff = &diff12; pinf = inf12; break;
1487 case 2: next = script02; pdiff = &diff02; pinf = inf02; break;
1488 }
1489
1490 while (next != nullptr)
1491 {
1492 /* Find a set of changes that belong together. */
1493 struct change *thisob = next;
1494 struct change *end = find_change(next);
1495
1496 /* Disconnect them from the rest of the changes,
1497 making them a hunk, and remember the rest for next iteration. */
1498 next = end->link;
1499 end->link = nullptr;
1500#ifdef DEBUG
1501 debug_script(thisob);
1502#endif
1503
1504 /* Print thisob hunk. */
1505 //(*printfun) (thisob);
1506 {
1507 /* Determine range of line numbers involved in each file. */
1508 analyze_hunk (thisob, &first0, &last0, &first1, &last1, &deletes, &inserts, pinf);
1509
1510 /* Reconnect the script so it will all be freed properly. */

Callers 1

CompareFilesMethod · 0.80

Calls 10

find_changeFunction · 0.85
debug_scriptFunction · 0.85
analyze_hunkFunction · 0.85
translate_rangeFunction · 0.85
assertClass · 0.85
Make3wayDiffFunction · 0.85
Comp02FunctorClass · 0.70
ClearMethod · 0.45
HasRegExpsMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected