gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] compatibility patch


From: Tanguy URVOY
Subject: [gnugo-devel] compatibility patch
Date: Mon, 14 Jun 2004 17:58:24 +0200

Hello,

The following path fix a compilation
problem on (my) machine.

Tanguy



-- 
------------------------------
Tanguy Urvoy Bur. 15 Bat 1R1
Tel  33 (0) 5 61 55 69 26
Fax  33 (0) 5 61 55 68 47
------------------------------
I dont know why, but my version of gcc (2.95.3) does 
not allows unnamed (and transparent) unions.

Here is my machine:

Machine hardware:   sun4u
OS version:         5.8
Processor type:     sparc
Hardware:           SUNW,Sun-Fire-880

The following patch
fixes this problem.


Tanguy



Index: gnugo/patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.135
diff -u -r1.135 mkpat.c
--- gnugo/patterns/mkpat.c      8 Jun 2004 05:52:26 -0000       1.135
+++ gnugo/patterns/mkpat.c      14 Jun 2004 15:49:24 -0000
@@ -2715,20 +2715,6 @@
   int k;
 
   fprintf(outfile, "static struct pattern_attribute attributes[] = {\n");
-  fprintf(outfile, "#ifdef __GNUC__\n");
-
-  for (k = 0; k < num_attributes; k++) {
-    fprintf(outfile, "  {%s,", attribute_name[attributes[k].type]);
-    if (attributes[k].type >= FIRST_OFFSET_ATTRIBUTE)
-      fprintf(outfile, "{.offset=%d}}", attributes[k].offset);
-    else
-      fprintf(outfile, "{.value=%f}}", attributes[k].value);
-
-    if (k != num_attributes - 1)
-      fprintf(outfile, ",\n");
-  }
-
-  fprintf(outfile, "\n#else\n");
 
   for (k = 0; k < num_attributes; k++) {
     fprintf(outfile, "  {%s,", attribute_name[attributes[k].type]);
@@ -2741,7 +2727,8 @@
       fprintf(outfile, ",\n");
   }
 
-  fprintf(outfile, "\n#endif\n};\n\n");
+ fprintf(outfile, "\n};\n\n"); 
+
 }
 
 
Index: gnugo/patterns/patterns.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v
retrieving revision 1.64
diff -u -r1.64 patterns.h
--- gnugo/patterns/patterns.h   25 May 2004 03:14:06 -0000      1.64
+++ gnugo/patterns/patterns.h   14 Jun 2004 15:49:24 -0000
@@ -1,3 +1,4 @@
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\\
  * This is GNU Go, a Go program. Contact address@hidden, or see       *
  * http://www.gnu.org/software/gnugo/ for more information.          *
@@ -85,10 +86,10 @@
  */
  
 typedef int (*pattern_helper_fn_ptr)(struct pattern *, int rotation,
-                                    int move, int color);
+                                     int move, int color);
 
 typedef int (*autohelper_fn_ptr)(int rotation, int move,
-                                int color, int action);
+                                 int color, int action);
 
 
 /* each pattern is compiled into a sequence of these elements.
@@ -127,7 +128,7 @@
 #define CLASS_D     0x0040   /* defense pattern */
 #define CLASS_C     0x0080   /* move connects two worms */
 #define CLASS_c     0x0100   /* move weakly connects two worms */ 
-                            /* for owl databases: combinable pattern */
+                             /* for owl databases: combinable pattern */
 #define CLASS_B     0x0200   /* move breaks connection between enemy worms */
 #define CLASS_A     0x0400   /* attack pattern */
 #define CLASS_b     0x0800   /* move is intended to block opponent */
@@ -149,7 +150,7 @@
 /* Collection of the classes inducing move reasons. */
 #define CLASS_MOVE_REASONS (CLASS_C | CLASS_B | CLASS_b | \
                             CLASS_e | CLASS_E | CLASS_I | CLASS_a | CLASS_d | \
-                           CLASS_J | CLASS_j | CLASS_U | CLASS_T | CLASS_t | \
+                            CLASS_J | CLASS_j | CLASS_U | CLASS_T | CLASS_t | \
                             CLASS_W | CLASS_c | CLASS_F)
 
 /* directions for applying edge-constraints */
@@ -202,28 +203,12 @@
   LAST_ATTRIBUTE = NUM_ATTRIBUTES
 };
 
-
-#ifdef __GNUC__
-
-struct pattern_attribute {
-  enum attribute_type type;
-
-  /* GCC allows unnamed (and transparent) unions. */
-  union {
-    float value;
-    int offset;
-  };
-};
-
-#else
-
 struct pattern_attribute {
   enum attribute_type type;
   float value;
   int offset;
 };
 
-#endif
 
 
 /*
@@ -239,7 +224,7 @@
   int maxi, maxj;       /* ...the pattern */
   int height, width;    /* differences between max and min extents */
   unsigned int edge_constraints; /* and combinations of NORTH, EAST etc.
-                                 * for edges */
+                                  * for edges */
 
   int move_offset;      /* offset of the suggested move (relative to anchor) */
 
@@ -410,18 +395,18 @@
 struct corner_pattern;
 
 struct corner_db {
-  int max_width;       /* Largest possible width and... */
-  int max_height;      /* ... largest possible height of database patterns. */
+  int max_width;        /* Largest possible width and... */
+  int max_height;       /* ... largest possible height of database patterns. */
 
   char num_top_variations; /* Number of top level variations. */
   struct corner_variation *top_variations;
 };
 
 struct corner_variation {
-  int move_offset;     /* Offset of the move in this variation. */
-  char xor_att;        /* 0 - the same color as the first matched stone,
-                        * 3 - the opposite color.
-                        */
+  int move_offset;      /* Offset of the move in this variation. */
+  char xor_att;         /* 0 - the same color as the first matched stone,
+                         * 3 - the opposite color.
+                         */
   char num_stones;      /* Number of stones in the `move_offset' rectangle. */
 
   char num_variations;  /* Number of subvariations. */
@@ -432,15 +417,15 @@
 
 struct corner_pattern {
   int second_corner_offset; /* Offset of pattern's second corner. */
-  int symmetric;       /* If the pattern is symmetric ('/' symmetry). */
+  int symmetric;        /* If the pattern is symmetric ('/' symmetry). */
 
-  unsigned int class;  /* Pattern class. */
-  const char *name;    /* Pattern name (optional). */
+  unsigned int class;   /* Pattern class. */
+  const char *name;     /* Pattern name (optional). */
 
   /* Pattern attributes like shape (the only one used currently). */
   struct pattern_attribute *attributes;
 
-  int autohelper_flag; /* Whether autohelper has constraint and/or action. */
+  int autohelper_flag;  /* Whether autohelper has constraint and/or action. */
   autohelper_fn_ptr autohelper; /* Automatically generated helper (or NULL). */
 };
 

reply via email to

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