No announcement yet.

Compare C code against design

  • Filter
  • Time
  • Show
Clear All
new posts

  • Compare C code against design

    I need to compare C code against a design document which is closely related to the C code.

    I want to ignore some differences between C and the design language such as the following

    ==     is
    !=     is not equal to
    &&     AND
    ||     OR
    else   Else
    and so on.

    I have used replacements and ignore unimportant differences but I really wanted to relate these to a "File Format". From what I have found I can't do this, it seems the replacements apply to the current session or to all BC3 sessions forevermore. Have I completely misunderstood the whole use of replacements? Can someone suggest a better approach?

    I also note that the replacement "==" to "is" does not work.

    Darren .)

  • #2

    Replacements are currently supported on the session level. There is not a method to limit them to only a specific file extension, but you could setup a specific parent session that shows only *.C files, then setup a child compare to have these specific replacements. When using this saved parent session, then only it would have the saved child settings.

    To do this, launch a Folder Compare, load your folder pair, and save the Session. Then double click and launch a child comparison. You can then configure the child Text Compare's Session Settings (Replacements), but switch from "Only use for this view" to "Use for all files in parent session". Close the child Text Compare and re-save the Folder Compare.

    The replacement == to is should work as expected. If you enable the View menu -> Alignment Details, does the text on those two lines align, or is it perhaps broken up? In my quick test, I was able to create this replacement without issue.
    Aaron P Scooter Software


    • #3
      I am using version 3.3.5 (build 15075).

      Thanks for that explanation. It fits with the way that I work since my C files and designs are generally in 2 specific folders so I had already saved a session "Compare C files v design".

      I have re-read the Help system and now understand better. Thanks.

      As to the == problem, I had ticked "whole words only". Unticking that makes it work correctly.

      One other question on replacements, I wanted to ignore certain words in one side so I tried to enter Left="ignore-this-word", Right=blank. However, the OK button is grayed out until I enter some text in the right hand side. Simply adding a space character to the end of both sides is not good enough as the ignore-this-word won't always have a space character. Adding (.) to the Left and $1 on the Right and setting Regular Expression seems to work (not fully tested it) but this is bad on 2 counts, 1=Not intuitive (what I originally had seemed better), 2=Consumes an extra character which might affect other comparisons(?).

      Darren .)


      • #4
        Text Replacements is designed to replace one string with another in terms of equality. It does not support a blank entry on either side. If the side can be disregarded, you can define a grammar element and mark it as Unimportant, but this would be unimportant on either side of the compare.
        Beyond Compare is a multi-platform utility that combines directory compare and file compare functions in one package. Use it to manage source code, keep directories in sync, compare program output, etc.

        Each side can use a different File Format. One workaround could be to define two different, but almost equal file formats. One to use on the left side, one to use on the right side. Then either side could have the extra grammar element defined and marked as Unimportant.

        Both of these are fairly advanced features, so if you are having any trouble setting this up or not finding the relevant documentation, feel free to ask any questions. Example files and current setting files help, which you can post here publicly or email us at [email protected].

        If you email us, please include a link back to this forum thread for our reference.
        Aaron P Scooter Software