SETFILLMASK Graphics Routine and Integer Range Error F2367 (62476)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 4.1
  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0
  • Microsoft FORTRAN PowerStation for MS-DOS 1.0a
  • Microsoft Fortran Powerstation 32 for Windows NT 1.0
  • Microsoft FORTRAN compiler for OS/2 4.1
  • Microsoft FORTRAN compiler for OS/2 5.0
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q62476

SUMMARY

If you use the SETFILLMASK graphics routine in Microsoft FORTRAN, you shouldn't use the $DEBUG metacommand in the source code or compile using the /4Yb compiler switch. The array used by the routine is declared as INTEGER*1 and if you have any values greater than 127 in the array, it produces an "F2367 Integer range error" at compile time.

The SINE.FOR and FILL.FOR sample programs which are included on the Source Code Disk in the Samples subdirectory will produce the above error when either /4Yb or $DEBUG are used.

MORE INFORMATION

SETFILLMASK uses an 8 x 8 bit array for the fill-mask design. The array must be initialized as INTEGER*1, which has a range of -128 to 127. The values of the bit array must be able to range from 0 to 255 in decimal and 00000000 to 11111111 in binary to get every combination of fill patterns. This, however, can exceed the range of the INTEGER*1 array.

Without using the debug options, the program compiles and works correctly, but if you add one of the above debug options and have a value in the mask array that is larger that 127, you receive the following compiler error:
name.for(23) : error F2367: value 129 : INTEGER : range error
The debug option performs range checking of variables. For example, if an INTEGER*1 variable exceeds 127 the compiler produces an error.

If you compile the following example with the /4Yb compiler switch, the following errors are produced:
fill.for
fill.for(23) : error F2367: value 129 : INTEGER : range error
fill.for(23) : error F2367: value 145 : INTEGER : range error
The following is an example using the SETFILLMASK graphics routine:
C Won't compile with $DEBUG metacommand or with the /4Yb
C compiler switch because of the two elements in the array
C mask that are larger than 127.


      INCLUDE 'FGRAPH.FI'
      INCLUDE 'FGRAPH.FD'

      INTEGER*2 dummy_2    ! Variables for Function Return
      INTEGER*4 dummy_4    !    Values

      INTEGER*1 mask(8)    ! Integer*1 has range of -128 to 127
                           !    Largest mask value can be
                           !    11111111b or 255d

C               Binary      Decimal
C              --------     -------
      DATA mask / 2# 00000000 ,   !  0d
     +            2# 00111100 ,   !  60d
     +            2# 01000010 ,   !  66d
     +            2# 10000001 ,   !  129d ! Error with /4Yb
     +            2# 10010001 ,   !  145d ! Error with /$Yb
     +            2# 01001010 ,   !  74d
     +            2# 00111100 ,   !  60d
     +            2# 00000011  /  !  3d


      dummy_2 = setvideomode( $VRES16COLOR )  ! Set 16 Color VGA Mode
      dummy_4 = setbkcolor( $BLUE )     !BLUE ! Set Background Color

      CALL clearscreen( $GCLEARSCREEN )

      dummy_2 = setcolor( 15 )          !WHITE

      CALL setfillmask(mask)

      dummy_s = rectangle( $GBORDER, 100,100,500,300 ) ! Border

      dummy_2 = rectangle( $GFILLINTERIOR, 100,100,500,300 ) ! Fill
                                                             ! with
      PAUSE                                                  ! Mask

      dummy_2 = setvideomode( $DEFAULTMODE )  ! Reset Video Mode

      END
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:KB62476