No announcement yet.

Comparing folders of C++ source w/ common heritage

  • Filter
  • Time
  • Show
Clear All
new posts

  • Comparing folders of C++ source w/ common heritage

    Apologies if this question has already been addressed elsewhere, but since I am finding it difficult to summarize in a one liner, it is equally difficult to imagine the many other ways it may have been described by others.

    There is a folder of C++ source code which at some point in its lifetime was cloned, creating a separate other folder of C++ code, but with certain of the symbols renamed in the copy, e.g., "CSomeOldApp" in the original code became "CSomeNewApp"; also, "CSomeOldAppSettings" in the original became "CSomeNewAppSettings". The commensurate C++ source files were also renamed, e.g. SomeOldApp.h (and .cpp) in the original became SomeNewApp.h (and .cpp), etc., and likewise for SomeOldAppSettings.h (and .cpp). This also affects the contents of some other files, since '#include "SomeOldApp.h"' must be changed to '#include "SomeNewApp.h"'; also, the VC++ project file (makefile). You get the idea.

    Without wanting to get into an OOP refactoring discussion, I will just say that for reasons I won't go into, I must maintain the two projects separately, but still merge improvements between them.

    I would like to somehow specify to BC2 an "equivalence", that is, to specify that occurrances of "SomeOldApp" in in the original source files should not be treated as different from "SomeNewApp" in the new ones. Also, filenames should be mappable, making it unneccesary to explicitly specify that, say, SomeOldApp.h (in the original code) should be compared against SomeNewApp.h in the new code.

    Obviously, if a modified section needs to be copied from one to the other, it should have the appropriate transformation applied (i.e., "CSomeNewApp" in code copied from the close to the original should end up as "CSomeOldApp" after copying).

    Before I jump in and examine the scripting capability of BC2, I am posting this here to see if I can determine whether it will be worth the effort?

  • #2
    Re: Comparing folders of C++ source w/ common heri

    The current version of BC will only match files for comparison if their filenames are the same. Using a mapping to match files with mismatched names is on our wish list for a future version of BC.

    In the current version, the only way to compare files with mismatched names is to manually name them. This can be done by right clicking on the first file and selecting "Compare To" and then clicking on the corresponding renamed file. You can also pass the filenames on the command line to BC2.exe. In a script you can use the file-report command and pass the two filenames at the end of the command.

    There isn't a way to mark strings as equivalent (string1 in file1 = string2 in file2) in the current version of BC, but this is something we're working on. The best you can do in the current version of BC is make the two strings unimportant. This will miss ocurrences of the strings on the wrong side or only on one side.
    Chris K Scooter Software