9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rodolfo kix Garcia <kix@kix.es>
To: <9fans@9fans.net>
Subject: Re: [9fans] c code differencing
Date: Wed, 31 Aug 2011 16:01:49 +0200	[thread overview]
Message-ID: <f9ff261d9f323a62a39bec78297219b9@kix.es> (raw)
In-Reply-To: <3ad045e675c92ccadaa4dcb0e5f36a38@quintile.net>

On Wed, 31 Aug 2011 14:01:34 +0100, Steve Simon wrote:
> Anyone have any pointers to a diff for C code.
>
> I have two libraries, A and B.
>
> B is and expanded and modified version of A and I have been
> asked to extract A from B to build two libraries one
> built on top of the other.
>
> What I think I need is a program which parses C and will
> do diffs at the level of functions, globals , #defines and enums.
>
> it would ideally have two input files and generate two outputs
> one output being the common code, one with the extensions on the
> common.
>
> I don't expect this to be fully automated, there is going to be a
> load
> of hand edition before I am done, but is there somthing which can do
> the easy stuff for me?
>
> -Steve

Why don't use a C preprocessor to do that?
You can have one file with ifdefs, and print the two files using an
argument

Example:

#ifdef LIBA
#include <windows.h>
#else
#include <unistd.h>
#endif

and run

"cpp -DLIBA ..." and
"cpp -ULIBA ..." or "cpp ..."


--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/



  reply	other threads:[~2011-08-31 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 13:01 Steve Simon
2011-08-31 14:01 ` Rodolfo kix Garcia [this message]
2011-09-01 13:16 ` Ethan Grammatikidis
2011-09-01 14:33 ` FENG Yu Ning
2011-09-01 14:51 ` Anthony Sorace
2011-09-01 14:59   ` Anthony Sorace
2011-09-03 12:17 ` Comeau At9Fans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9ff261d9f323a62a39bec78297219b9@kix.es \
    --to=kix@kix.es \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).