gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Indent rules


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Indent rules
Date: Sat, 30 Aug 2003 22:10:24 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Teun wrote:
> Since there have been some e-mail to the list about how code
> should be formatted, I thought it might be a good idea to add
> some rules to the Make that use indent to format the code.
> 
> The indent flags are set in configure.in.
> 
> make indent in the toplevel directory after this patch format
> the source in the engine subdir for a start.
> 
> - add makefile rules for indenting code with indent

No thanks. When I test this indent comes up with way too many funny
reindentations, including some which are not even internally
consistent. It also destroys various "hand-tuned" indentations which
don't follow any strict rules but still improve readability.

Appended are some random examples of dubious reindentations (in mixed
files):

/Gunnar

@@ -18,7 +18,7 @@
  * License along with this program; if not, write to the Free        *
  * Software Foundation, Inc., 59 Temple Place - Suite 330,           *
  * Boston, MA 02111, USA.                                            *
-\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+ \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 
 #include "gnugo.h"
@@ -97,9 +97,9 @@
  * genmove() call should return pass.
  */
 int
-aftermath_genmove(int *aftermath_move, int color,
-                 int under_control[BOARDMAX],
-                 int do_capture_dead_stones)
+  aftermath_genmove(int *aftermath_move, int color,
+                   int under_control[BOARDMAX],
+                   int do_capture_dead_stones)
 {
   int k;
   int other = OTHER_COLOR(color);
@@ -1036,8 +1036,7 @@
  * BLACK_TERRITORY, and DAME.
  */
 enum dragon_status
-aftermath_final_status(int color, int pos)
-{
+  aftermath_final_status(int color, int pos) {
   ASSERT_ON_BOARD1(pos);
   aftermath_sgftree = NULL;
   play_aftermath(color);


And one really fanciful from cache.c:
@@ -47,55 +47,67 @@
 static Hash_data target2_hash[BOARDMAX];
 static Hash_data routine_hash[NUM_CACHE_ROUTINES];
 
-static struct init_struct {
-  Hash_data *array;
-  int array_size;
-} hash_init_values[] = {
-  {komaster_hash, NUM_KOMASTER_STATES},
-  {kom_pos_hash,  BOARDMAX},
-  {target1_hash,  BOARDMAX},
-  {target2_hash,  BOARDMAX},
-  {routine_hash,  NUM_CACHE_ROUTINES}
+static struct init_struct
+  {
+    Hash_data *array;
+    int array_size;
+  }
+hash_init_values[] =
+{
+  {
+  komaster_hash, NUM_KOMASTER_STATES}
+  ,
+  {
+  kom_pos_hash, BOARDMAX}
+  ,
+  {
+  target1_hash, BOARDMAX}
+  ,
+  {
+  target2_hash, BOARDMAX}
+  ,
+  {
+  routine_hash, NUM_CACHE_ROUTINES}
 };
 
 /* Initialize random hash values identifying input data (other than the
  * board position) in a cache entry.
  */
@@ -221,10 +232,9 @@
  */
 
 void
-tt_update(Transposition_table *table,
-         int komaster, int kom_pos, enum routine_id routine, int target, 
-         int remaining_depth, int result, int move)
-{
+  tt_update(Transposition_table * table,
+           int komaster, int kom_pos, enum routine_id routine, int target,
+           int remaining_depth, int result, int move) {
   Hash_data hashval;
   Hashentry_ng *entry;
   Hashnode_ng *deepest;




reply via email to

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