Re: [AD] Fix dat2c for use with ISO C90 compilers

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Can't the macros ALLEGRO_UNIX, ALLEGRO_WINDOWS etc. be used instead of
> os_type to detect the desired lineendings?

Yes, that's precisely the solution I was leaning towards. Patch applied, as 
well as your patch to remove the note about the limitation of dat2c from 
grabber.txt I had previously forgotten.

Hopefully we are now done with dat2c. Phew!

-- 
Eric Botcazou
Index: tools/dat2c.c
===================================================================
RCS file: /cvsroot/alleg/allegro/tools/dat2c.c,v
retrieving revision 1.9
diff -u -r1.9 dat2c.c
--- tools/dat2c.c	13 May 2003 13:25:11 -0000	1.9
+++ tools/dat2c.c	13 May 2003 15:17:22 -0000
@@ -342,39 +342,16 @@
         }
     }
     
-    if(dat2c->lformat == lineformat_default) {
-        switch(os_type) {
-            case OSTYPE_LINUX:
-            case OSTYPE_SUNOS:
-            case OSTYPE_FREEBSD:
-            case OSTYPE_NETBSD:
-            case OSTYPE_IRIX:
-            case OSTYPE_QNX:
-            case OSTYPE_UNIX:
-            case OSTYPE_BEOS:
-                dat2c->lformat = lineformat_unix;
-                break;
-
-            case OSTYPE_MACOS:
-            case OSTYPE_DARWIN:
-                dat2c->lformat = lineformat_mac;
-                break;
-
-            case OSTYPE_WIN3:
-            case OSTYPE_WIN95:
-            case OSTYPE_WIN98:
-            case OSTYPE_WINME:
-            case OSTYPE_WINNT:
-            case OSTYPE_WIN2000:
-            case OSTYPE_WINXP:
-            case OSTYPE_OS2:
-            case OSTYPE_WARP:
-            case OSTYPE_DOSEMU:
-            case OSTYPE_OPENDOS:
-            default:
-                dat2c->lformat = lineformat_dos;
-        }
-    }
+    if(dat2c->lformat == lineformat_default)
+#if defined ALLEGRO_UNIX
+        dat2c->lformat = lineformat_unix;
+#elif (defined ALLEGRO_WINDOWS || defined ALLEGRO_DOS)
+        dat2c->lformat = lineformat_dos;
+#elif defined ALLEGRO_MPW
+        dat2c->lformat = lineformat_mac;
+#else
+   #error platform not supported
+#endif
     
     return 0;
 }
Index: tools/grabber.txt
===================================================================
RCS file: /cvsroot/alleg/allegro/tools/grabber.txt,v
retrieving revision 1.15
diff -u -r1.15 grabber.txt
--- tools/grabber.txt	25 Sep 2002 06:25:08 -0000	1.15
+++ tools/grabber.txt	13 May 2003 14:58:46 -0000
@@ -857,11 +857,6 @@
    would be more effort than it is worth (especially since you can just
    call get_compiled_sprite() anyway!).
 
- - Under some compilers, you may get a warning about array initialisers
-   being too long; this is normal, and nothing to worry about. It is
-   caused by static initialisation of a zero-size array. Under GCC 3, 
-   this is supported as an extension, so upgrade to that if you can!
-
 
 
 ================================


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/