Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] Re: (PR#5378) Diplomacy information in map middle-click
Home

[Freeciv-Dev] Re: (PR#5378) Diplomacy information in map middle-click

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: dspeyer@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#5378) Diplomacy information in map middle-click
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Wed, 22 Oct 2003 06:58:26 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, 22 Oct 2003, Raimar Falke wrote:

> On Fri, Sep 19, 2003 at 05:44:18AM -0700, Gregory Berkolaiko wrote:
> > 
> > On Wed, 17 Sep 2003, Daniel L Speyer wrote:
> > 
> > > OK, the "if("s are fixed.  That's all I found for remaining style 
> > > errors.  This whole style thing is getting really annoying.  Has anyone 
> > > written some tools to help with it?
> > 
> > I don't know any such tools unfortunately.  I think Raimar had something.
> 
> See this old posting
> http://lists.complete.org/freeciv-dev@xxxxxxxxxxx/2001/08/msg00486.html.gz.
> 
> Read the other postings in this thread about the problems of this
> issue. I think that the script proposed in the current thread can't
> exists or must be quite complex. Think about a patch like this
> 
>   if (cond) {
> -    something
> +    something other
> + } else {
> +    something other 2
>   }

Ths case is one of the easiest.  A bit harder is something like this:

     blah
     blahblah
-    something
+    something other
+ } else {
+    something other 2
     blahblah
     blah

Here the opening and closing brackets are absent.

But in general, it is of course possible to handle.  Here is an example:

     int j = 1;
     {
       int k = 1;
-      i = add(k+1,
+      i = add(k +1,
               j);
    }
   }

1. Remove all trailing context lines and all but one preceding context 
lines:

       int k = 1;
-      i = add(k+1,
+      i = add(k +1,

2. Split the patch into original and changed version:
Orig:
      int k = 1;
      i = add(k+1,
Changed:
      int k = 1;
      i = add(k +1,

3. Pad the changed with enough brackets:
{
  {
    {
      int k = 1;
      i = add(k +1,
    );
    }
  }
}

4. Indent the both changed version.  Make sure the lines are not 
merged.
{
  {
    {
      int k = 1;
      i = add(k + 1,
              );
    }
  }
}

5. Remove previously added padding lines
      int k = 1;
      i = add(k + 1,

6. Diff with the original version.

       int k = 1;
-      i = add(k+1,
+      i = add(k + 1,

7. Add the context lines back.

So it's a lot of work...

G.





[Prev in Thread] Current Thread [Next in Thread]