home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 17986 < prev    next >
Encoding:
Text File  |  1992-12-31  |  4.1 KB  |  147 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!panther!mothost!lmpsbbs!supra.comm.mot.com!rittle
  3. From: rittle@supra.comm.mot.com (Loren James Rittle)
  4. Subject: Bug in Flood () or my test program?
  5. Organization: Systems Technology Research, Motorola, Inc.
  6. Date: Thu, 31 Dec 1992 02:17:29 GMT
  7. Message-ID: <1992Dec31.021729.26691@lmpsbbs.comm.mot.com>
  8. Sender: news@lmpsbbs.comm.mot.com (Net News)
  9. Nntp-Posting-Host: 145.1.80.40
  10. Lines: 135
  11.  
  12. Please tell me if the bug seen in the program below is in my code or
  13. Flood ().
  14.  
  15. If in Flood (), is it a known problem that isn't well documented?  Is
  16. there a good work around?  If problem with my code, how do I fix the
  17. problem?
  18.  
  19. I will report via official channels if it is decided that this is
  20. an OS bug that is not well known.
  21.  
  22. Thanks for your time,
  23. Loren
  24.  
  25. /* This test shows what I believe to be a bug in Flood ()
  26.    under OS 3.0 (Kickstart 39.106, Workbench 39.29) on an A4000.
  27.    This has not been tested for under any other OS rev.
  28.    or any other Amiga system.  There is no mention of size
  29.    limitations in the autodocs or RKMs that I can find...
  30.    But, it sure looks like funny things happen if the x size
  31.    gets over about 1024... :-( */
  32.  
  33. /* compiles under SAS/C 6.x */
  34.  
  35. /* To allow this to compile with the STRICT ANSI WARNING=ALL options: */
  36. #pragma msg 148 ignore
  37. #pragma msg 149 ignore push
  38. #pragma msg 61 ignore push
  39. #include <proto/exec.h>
  40. #include <proto/dos.h>
  41. #include <proto/intuition.h>
  42. #include <proto/graphics.h>
  43. /* As an aside, I wish someone at C= or SAS would fix the standard system
  44.    includes...  The 2.04 standard system includes are *NOT* ANSI compliant!
  45.    To avoid finger pointing between SAS and C=, let me point out
  46.    that the problems do appear to lie in the standard C= includes
  47.    that the SAS proto/#?.h files pull in, I use proto/#?.h because
  48.    they are easier to get right (less typing, etc.). */
  49. #pragma msg 149 pop
  50. #pragma msg 61 pop
  51. #include <stdlib.h>
  52. #include <string.h>
  53. #include <stdio.h>
  54.  
  55. /* Thanks to Chris Green: */
  56. LoadRGB32 (struct ViewPort *, unsigned long *table);
  57. #pragma libcall GfxBase LoadRGB32 372 9802
  58.  
  59. int main (void)
  60. {
  61.   int rc = 0;
  62.  
  63.   UWORD t[] = {0xffff};
  64.   struct Screen *s = OpenScreenTags (NULL, SA_Width, 1280, SA_Height, 710,
  65.             SA_AutoScroll, TRUE, SA_Overscan, OSCAN_TEXT,
  66.             SA_Pens, t, SA_SysFont, 1,
  67.             SA_Title, "Flood () test by Loren J. Rittle <rittle@comm.mot.com>",
  68.             SA_DisplayID, HIRESLACE_KEY, SA_Depth, 4, TAG_DONE);
  69.  
  70.   if (s)
  71.     {
  72.       struct Window *w = OpenWindowTags (NULL, WA_CustomScreen, s,
  73.         WA_IDCMP, IDCMP_MOUSEBUTTONS | IDCMP_VANILLAKEY, WA_Backdrop, 1,
  74.         WA_Borderless, 1, WA_Activate, TRUE, TAG_DONE);
  75.  
  76.       if (w)
  77.     {
  78.       struct RastPort *rp = w->RPort;
  79.       int i, j, k;
  80.       static ULONG ct[1 + 64 * 3 + 1];
  81.  
  82.       ct[0] = (8 << 16) + 8;
  83.       for (i = 0; i < 2; i++)
  84.         for (j = 0; j < 2; j++)
  85.           for (k = 0; k < 2; k++)
  86.         {
  87.           ct[(k * 4 + j * 2 + i) * 3 + 1] = i ? 0xffffffff : 0;
  88.           ct[(k * 4 + j * 2 + i) * 3 + 2] = j ? 0xffffffff : 0;
  89.           ct[(k * 4 + j * 2 + i) * 3 + 3] = k ? 0xffffffff : 0;
  90.         }
  91.       LoadRGB32 (&(s->ViewPort), ct);
  92. #define COLOR_BLACK 8
  93. #define COLOR_RED 9
  94. #define COLOR_GREEN 10
  95. #define COLOR_YELLOW 11
  96. #define COLOR_BLUE 12
  97. #define COLOR_PURPLE 13
  98. #define COLOR_AQUA 14
  99. #define COLOR_WHITE 15
  100.  
  101.       {
  102.         static struct AreaInfo ai;
  103.         static UWORD aib[50];
  104.         static struct TmpRas tr;
  105.         static UBYTE __chip trb[(1280 / 8) * 710];
  106.  
  107.         InitArea (&ai, aib, ((sizeof aib) * 2) / 5);
  108.         InitTmpRas (&tr, trb, sizeof trb);
  109.         rp->AreaInfo = &ai;
  110.         rp->TmpRas = &tr;
  111.       }
  112.  
  113.       SetRast (rp, COLOR_WHITE);
  114.  
  115. /* try other values for XSIZE: less than 1024 works great,
  116.    over 1024, will show what I believe to be a bug */
  117. #ifndef XSIZE
  118. #define XSIZE 1025
  119. #endif
  120.  
  121.       SetAPen (rp, COLOR_BLUE);
  122.       Move (rp, 0, 20);
  123.       Draw (rp, XSIZE, 20);
  124.       Draw (rp, XSIZE, 709);
  125.       Draw (rp, 0, 709);
  126.       Draw (rp, 0, 20);
  127.       rc = Flood (rp, 1, 1, 21);
  128.  
  129.       Wait (SIGBREAKF_CTRL_C | (1 << w->UserPort->mp_SigBit));
  130.  
  131.       CloseWindow (w);
  132.     }
  133.       else
  134.     rc = 1;
  135.  
  136.       CloseScreen (s);
  137.     }
  138.   else
  139.     rc = 1;
  140.   return rc;
  141. }
  142. --
  143. Loren J. Rittle (rittle@comm.mot.com)
  144. Systems Technology Research (IL02/2240)
  145. Motorola, Inc.
  146. (708)576-7794
  147.