Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Default Ignoring carriage-return in text compare

    Hi,

    Is it possible to create a regular expression to ignore carriage-return (0x0d) when comparing C++ or C code? Or can anyone help me create one?

    Thanks,

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,728

    Default

    Sorry, it isn't possible to ignore carriage return in the BC3 Text Compare.
    Chris K Scooter Software

  3. #3
    Join Date
    Jun 2005
    Location
    Stockholm, Sweden
    Posts
    192

    Default I found this entry and I thought I'd add something

    I'm using BC to compare "mainframe" files created on the PC. As a result, since these have the concept of "record lengths" and no x'0D0A', I'm used to having to "tell" BC the EXACT length of the file - normally, this isn't a problem, unless ....

    Since many mainframe files can contain packed fields, then a packed value of say 13 might well be represented by the value x'0D'. As a result, when comparing files, a file that contains 'Michael' x'0D' 'Simpson' will be shown in BC as

    Michael
    Simpson

    even though I specified 15 as the characters per line limit. I IMAGINE that the latter is some max value, but as the same time, it doesn't seem to make much sense specifying a specific value if it's ignored as soon as x'0D' is found.

    Is there no work-around (apart from editing the file and changing all x'0D' to something like §) ????

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,899

    Default

    If you create a custom conversion, you can call it automatically and create temporary files (rather than actually editing your files) for the comparison. This is similar to how we compare MS Word files: by temporarily creating a plain text file for the comparison.

    http://www.scootersoftware.com/suppo...conversion.php
    Aaron P Scooter Software

  5. #5
    Join Date
    Dec 2009
    Location
    56201
    Posts
    3

    Default

    Quote Originally Posted by Chris View Post
    Sorry, it isn't possible to ignore carriage return in the BC3 Text Compare.
    Plz fix, k? Thx.

    Okay, that's trite, so... Most programming languages treat the newline as just another whitespace - why should our comparison tool be any different?

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,728

    Default

    nklatt,

    Thanks for the suggestion. Comparing across newline or ignoring newline is on our wish list for a future version.
    Chris K Scooter Software

  7. #7
    Join Date
    Jun 2005
    Location
    Stockholm, Sweden
    Posts
    192

    Default Thanks Aaron for the suggestion

    Since I don't write C/C++ I threw together a program in Rexx instead. Worked like a charm !!!

    Out of interest - I like to put up a quick windows message to the user indicating that something is happening. This "tells" the user that they're using the correct conversion routines so if they DO see any differences, they know it has nothing to do with CR or LF. One point though - is there any way of knowing WHICH file is being converted ? I would like to be able to put out a message similar to

    "Converting file n" (where n obviously is either left/right or 1/2).

    Any way of knowing this or will I have to create generic message ???

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,728

    Default

    %s and %t are temp files, but you can obtain the original file name using the %n variable to use in your "converting file" message.

    It isn't possible to determine if a file is left or right, number 1 or 2 when calling a conversion tool from BC.
    Chris K Scooter Software

  9. #9
    Join Date
    May 2011
    Posts
    1

    Default how is that wish list coming along?

    it sure would be nice to not be bothered by differences caused by people adding carriage returns to wrap function signatures into their viewable area...

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,728

    Default

    robwafle,

    Marking carriage return differences unimportant is still on our wish list for a future release of Beyond Compare.
    Chris K Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •