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

Method LoadWinMergeDiffsFromDiffUtilsScript

Src/DiffWrapper.cpp:1279–1419  ·  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

1277 * @brief Walk the diff utils change script, building the WinMerge list of diff blocks
1278 */
1279void
1280CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const file_data * file_data_ary)
1281{
1282 //Logic needed for Ignore comment option
1283 PostFilterContext ctxt;
1284
1285 struct change *next = script;
1286
1287 const bool usefilters = m_options.m_filterCommentsLines ||
1288 m_options.m_bIgnoreMissingTrailingEol ||
1289 m_options.m_bIgnoreLineBreaks ||
1290 (m_pFilterList && m_pFilterList->HasRegExps()) ||
1291 (m_pSubstitutionList && m_pSubstitutionList->HasRegExps());
1292
1293 while (next != nullptr)
1294 {
1295 /* Find a set of changes that belong together. */
1296 struct change *thisob = next;
1297 struct change *end = find_change(next);
1298
1299 /* Disconnect them from the rest of the changes,
1300 making them a hunk, and remember the rest for next iteration. */
1301 next = end->link;
1302 end->link = nullptr;
1303#ifdef DEBUG
1304 debug_script(thisob);
1305#endif
1306
1307 /* Print thisob hunk. */
1308 //(*printfun) (thisob);
1309 {
1310 /* Determine range of line numbers involved in each file. */
1311 int first0=0, last0=0, first1=0, last1=0, deletes=0, inserts=0;
1312 analyze_hunk (thisob, &first0, &last0, &first1, &last1, &deletes, &inserts, file_data_ary);
1313
1314 /* Reconnect the script so it will all be freed properly. */
1315 end->link = next;
1316
1317 if (deletes || inserts || thisob->trivial)
1318 {
1319 OP_TYPE op = OP_NONE;
1320 if (deletes && inserts)
1321 op = OP_DIFF;
1322 else if (deletes || inserts)
1323 op = OP_DIFF;
1324 else
1325 op = OP_TRIVIAL;
1326
1327 /* Print the lines that the first file has. */
1328 int trans_a0=0, trans_b0=0, trans_a1=0, trans_b1=0;
1329 translate_range(&file_data_ary[0], first0, last0, &trans_a0, &trans_b0);
1330 translate_range(&file_data_ary[1], first1, last1, &trans_a1, &trans_b1);
1331
1332 // Store information about these blocks in moved line info
1333 if (GetDetectMovedBlocks())
1334 {
1335 if (thisob->match0>=0)
1336 {

Callers

nothing calls this directly

Calls 7

find_changeFunction · 0.85
debug_scriptFunction · 0.85
analyze_hunkFunction · 0.85
translate_rangeFunction · 0.85
assertClass · 0.85
HasRegExpsMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected