[AD] Allegro and Open Watcom

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


The Open Watcom folk have released version 1.0 of their compiler. No problem 
whatsoever for building the library with it under DOS. The binaries appear 
to work reasonably well, except the demo game that sometimes fails to start.

The attached patch makes it possible to build the library in warnmode. The 
only significant change is that the port defines AL_CONST when Open Watcom 
is detected.

Commited to trunk and branch.

-- 
Eric Botcazou
--- /cvs/allegro/include/allegro/platform/alwatcom.h	Sat Nov  2 19:34:10 2002
+++ allegro/include/allegro/platform/alwatcom.h	Fri Feb 14 12:25:56 2003
@@ -33,7 +33,7 @@
 #endif
 
 
-#pragma disable_message (120 201)
+#pragma disable_message (120 201 202)
 
 
 /* describe this platform */
@@ -50,6 +50,10 @@
    #define ALLEGRO_MMX
 #endif
 
+#if __WATCOMC__ >= 1200   /* Open Watcom 1.0 */
+   #define AL_CONST const
+#endif
+
 
 /* emulate some important djgpp routines */
 #define inportb(port)         inp(port)
--- /cvs/allegro/src/dos/wat.c	Tue Nov  6 20:37:24 2001
+++ allegro/src/dos/wat.c	Fri Feb 14 12:34:52 2003
@@ -56,11 +56,20 @@
  *  Stop those stupid "abort, retry, fail" messages from popping up all
  *  over the place.
  */
+#if __WATCOMC__ >= 1200
+
+static void __interrupt __far my_int24()
+{}
+
+#else
+
 static int __interrupt __far my_int24()
 {
    return 3;
 }
 
+#endif
+
 
 
 /* _dos_irq_init:
--- /cvs/allegro/src/misc/modex.c	Mon Feb 10 09:38:54 2003
+++ allegro/src/misc/modex.c	Fri Feb 14 12:12:42 2003
@@ -1149,7 +1149,7 @@
  */
 void _x_draw_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y)
 {
-   signed char *p = sprite->dat;
+   AL_CONST signed char *p = sprite->dat;
    int c;
    int x_pos, y_pos;
    int lgap, width;
@@ -1253,7 +1253,7 @@
  */
 void _x_draw_trans_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y)
 {
-   signed char *p = sprite->dat;
+   AL_CONST signed char *p = sprite->dat;
    int c;
    int x_pos, y_pos;
    int lgap, width;
@@ -1359,7 +1359,7 @@
  */
 void _x_draw_lit_rle_sprite(BITMAP *bmp, AL_CONST RLE_SPRITE *sprite, int x, int y, int color)
 {
-   signed char *p = sprite->dat;
+   AL_CONST signed char *p = sprite->dat;
    int c;
    int x_pos, y_pos;
    int lgap, width;
@@ -1486,8 +1486,8 @@
  */
 void _x_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg)
 {
-   unsigned char *data = glyph->dat;
-   unsigned char *dat;
+   AL_CONST unsigned char *data = glyph->dat;
+   AL_CONST unsigned char *dat;
    unsigned long addr;
    int w = glyph->w;
    int h = glyph->h;
--- /cvs/allegro/src/misc/vbeaf.c	Fri Feb  7 21:13:46 2003
+++ allegro/src/misc/vbeaf.c	Fri Feb 14 12:14:04 2003
@@ -2653,7 +2653,7 @@
  */
 static void vbeaf_draw_glyph(BITMAP *bmp, AL_CONST FONT_GLYPH *glyph, int x, int y, int color, int bg)
 {
-   unsigned char *data = glyph->dat;
+   AL_CONST unsigned char *data = glyph->dat;
    int w = glyph->w;
    int h = glyph->h;
    int stride = (w+7)/8;
@@ -2700,7 +2700,7 @@
 
       af_driver->PutMonoImage(af_driver, color, d,
 			      x+bmp->x_ofs, y+bmp->y_ofs,
-			      stride, 0, 0, stride*8, h, data);
+			      stride, 0, 0, stride*8, h, (unsigned char *)data);
 
       af_driver->SetMix(af_driver, vbeaf_fg_mix, vbeaf_bg_mix);
    );
--- /cvs/allegro/docs/build/watcom.txt	Sat Jul  6 19:44:58 2002
+++ allegro/docs/build/watcom.txt	Fri Feb 14 12:19:24 2003
@@ -27,8 +27,7 @@
    respect.
 
    This library works with version 10.6 and the various 11.0 versions of the
-   Watcom C compiler, except the latest one (11.0c) which can build the
-   library but cannot link Allegro programs.
+   Watcom C compiler, as well as with Open Watcom 1.0 or later.
 
 
 
@@ -36,12 +35,12 @@
 ============ Required software ============
 ===========================================
 
-   - Watcom C, version 10.6 or 11.0 (but not 11.0c).
+   - Watcom C version 10.6 or 11.0x, or Open Watcom 1.0 or later.
    - djgpp compiler (djdev*.zip, gcc*b.zip, and bnu*b.zip).
    - GNU make (mak*b.zip).
    - GNU sed (sed*b.zip):
         Required for 10.6: Used to build asm sources.
-        Optional for 11.0: Used by "make depend".
+        Optional for other versions: Used by "make depend".
 
    Except for the Watcom compiler itself, all of the above packages can be 
    downloaded from your nearest SimTel mirror site, in the 
--- /cvs/allegro/tools/dat2s.c	Fri Feb  7 21:14:06 2003
+++ allegro/tools/dat2s.c	Fri Feb 14 12:39:20 2003
@@ -331,7 +331,7 @@
    fprintf(outfile, "\t.long %-16d# color depth\n", bpp);
    fprintf(outfile, "\t.long %-16d# size\n", sprite->size);
 
-   write_data(sprite->dat, sprite->size);
+   write_data((unsigned char *)sprite->dat, sprite->size);
 
    fprintf(outfile, "\n");
 }


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