Hi,
We're reformatting a lot of our project code using the excellent
uncrustify beautifier.
However, to gain confidence that it really is only changing whitespace
(forget { } issues for just now), we were hoping to do a diff - a
textual comparison of the files, ignoring whitespace.
However, most diffs we've tried can't handle multi-line whitespace, so
the following two
prototypes are deemed to be different:
void doStuff( int a, float b);
void doStuff(int a,
float b);
Has anyone found a way to do a diff like this, that handles multi-line
whitespace?
Shug 4 1783
Shug wrote:
We're reformatting a lot of our project code using the excellent
uncrustify beautifier.
However, to gain confidence that it really is only changing whitespace
(forget { } issues for just now), we were hoping to do a diff - a
textual comparison of the files, ignoring whitespace.
However, most diffs we've tried can't handle multi-line whitespace, so
the following two
prototypes are deemed to be different:
void doStuff( int a, float b);
void doStuff(int a,
float b);
Has anyone found a way to do a diff like this, that handles multi-line
whitespace?
I would actually do it differently: tokenize both sources. If the set
of tokens is the same, you have the same source (now, don't ask me where
you can find C++ tokenizers, I don't know, GIYF). The other way is to
convert both of those into the third type of formatting (which should
give you the exactly same output) and compare them. If the formatter
make mistakes, it's likely to make them independently.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On Feb 12, 3:24 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
Shug wrote:
We're reformatting a lot of our project code using the excellent
uncrustify beautifier.
However, to gain confidence that it really is only changing whitespace
(forget { } issues for just now), we were hoping to do a diff - a
textual comparison of the files, ignoring whitespace.
However, most diffs we've tried can't handle multi-line whitespace, so
the following two
prototypes are deemed to be different:
void doStuff( int a, float b);
void doStuff(int a,
float b);
Has anyone found a way to do a diff like this, that handles multi-line
whitespace?
I would actually do it differently: tokenize both sources. If the set
of tokens is the same, you have the same source (now, don't ask me where
you can find C++ tokenizers, I don't know, GIYF). The other way is to
convert both of those into the third type of formatting (which should
give you the exactly same output) and compare them. If the formatter
make mistakes, it's likely to make them independently.
A simple third format would be one where every whitespace is replaced
by a newline, which will give a format that is easy to compare (and I
think it will still be valid C++ :-)
--
Erik Wikström
Erik Wikström wrote:
On Feb 12, 3:24 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
>Shug wrote:
>>We're reformatting a lot of our project code using the excellent uncrustify beautifier.
>>However, to gain confidence that it really is only changing whitespace (forget { } issues for just now), we were hoping to do a diff - a textual comparison of the files, ignoring whitespace.
>>However, most diffs we've tried can't handle multi-line whitespace, so the following two prototypes are deemed to be different:
>>void doStuff( int a, float b);
>>void doStuff(int a, float b);
>>Has anyone found a way to do a diff like this, that handles multi-line whitespace?
I would actually do it differently: tokenize both sources. If the set of tokens is the same, you have the same source (now, don't ask me where you can find C++ tokenizers, I don't know, GIYF). The other way is to convert both of those into the third type of formatting (which should give you the exactly same output) and compare them. If the formatter make mistakes, it's likely to make them independently.
A simple third format would be one where every whitespace is replaced
by a newline, which will give a format that is easy to compare (and I
think it will still be valid C++ :-)
It wouldn't be valid C++ without some continuation characters (\) in
macro definitions. And broken up include directives aren't going to
work either. :-)
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On 12 Feb, 13:15, "Shug" <enoesqu...@yah oo.co.ukwrote:
Hi,
We're reformatting a lot of our project code using the excellent
uncrustifybeaut ifier.
However, to gain confidence that it really is only changing whitespace
(forget { } issues for just now), we were hoping to do a diff - a
textual comparison of the files, ignoring whitespace.
However, most diffs we've tried can't handle multi-line whitespace, so
the following two
prototypes are deemed to be different:
void doStuff( int a, float b);
void doStuff(int a,
float b);
Has anyone found a way to do a diff like this, that handles multi-line
whitespace?
Shug
Thanks for your contributions guys.
In the end, we've managed to find another satisfactory solution.
After reformatting the source code, we run both the before and after
source files through tr:
tr -d '\r\n' < file1.cpp temp1.txt
tr -d '\r\n' < file2.cpp temp2.txt
then do a diff on the tr'd files
C:\cygwin\bin\d iff -bBw temp1.txt temp2.txt
This is all using a cygwin installation on Windows XP.
This does exactly what we need.
Thanks again.
Shug This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Charley |
last post by:
I've got a diff file that I think is a patch for a bunch of file in a
directory. How do I apply this file?
I thought it was
#patch myfile.diff
But that does nothing. I must be missing something. The diff file
contains diff's for a nuch of files, not just a single file. Do I need a
|
by: python |
last post by:
Hi-
I have a lot of monthly time series data. I need to be able to compare
two dates and get the number of months that they are apart.
The datetime module is a daily-frequency data type. It has a timedelta
object that returns the difference in days between two dates:
>>> d1 = datetime.date(2002,1,1)
|
by: Pete |
last post by:
Hello everybody --
Forgive my multi-posting my question. I posted first to ciwah, but I
learned that ciwas is the better group for this CSS question.
The problem has me stopped. The page:
http://www.key-horse.com/fftst.html
is rendered completely differently by Firefox 1.0 and IE 6.0. The code
|
by: Sabra D via AccessMonster.com |
last post by:
I have a db with 3 tables, owner, lessee, and tract, tract is the main table
and has two lookup fields to find the owner and lessee info.
My problem - i have a form with the owner info on top and the tract info
(including lessee) in a subform below. When i change the lessee on the form,
it changes all of them in the entire database. I looked but couldn't find
anything about this on your site. I'm at a loss, i'm sure it's something i
set...
|
by: Ching-Lung |
last post by:
Hi all,
I try to create a tool to check the delta (diff) of 2
binaries and create the delta binary. I use binary
formatter (serialization) to create the delta binary. It
works fine but the delta binary is pretty huge in size. I
have 1 byte file and 2 bytes file, the delta should be 1
byte but somehow it turns out to be 249 bytes using binary
formatter. I guess serialization has some other things
added to the delta file.
| |
by: Igor Shevchenko |
last post by:
Hi!
Suppose I have "pg_dump -s" of two pg installs, one is "dev", another is
"production". Their schemas don't differ too much, and I want to get a "diff
-u"-like schema diff so I can quickly add missing/remove old
tables/sequences/etc to one or another (manually). Is there some quick tool
for doing this ?
There was a thread about it sometime in aug, 2002, but it ended without
producing anything useful.
|
by: Andreas Kasparek |
last post by:
Hola!
I'm preparing my master thesis about a XML Merge Tool implementation and was
wondering if there is any open standard for XML diff regarding topics like:
- is a diff result computed on the ordered or unordered xml node tree of
the compared documents?
- what identifiers/criteria should be used by default to match elements of
the same type in different documents?
- should a diff tool consider move operations or only insert/delete
|
by: Jon Davis |
last post by:
I have a couple questions. First of all, would anyone consider a
multi-layered programming approach (building business objects that are
seperate from data access logic and seperate from user interface logic but
that interface the UI and the data) an n-tier implementation by definition?
Or does n-tier necessitate a network-distributed architecture (beyond IIS
and SQL Server, i.e. COM+/MTS/MSMQ/WCF) in addition to the layered
programming? If...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
A lot of users at my workplace use different screen resolutions, and I build
apps to use 1680 x 1050 pixels res by default. But some users are using 800
x 600, and the apps are too large for their screen.
I used to write code in Java a few years ago (2005), and you could stretch a
form with the mouse and all the controls and fonts would resize to larger or
smaller size. Does .Net framework 3.5 support this kind of functionality?
Or -...
|
by: akshaycjoshi |
last post by:
I have got one tree tree view control.I have three levels in it.
Example-
Root1
------->child1
------->child2
---------------->child1
---------------->child2
------->child3
Root2
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |