h43113
s 00001/00002/00527
d D 1.2 83/03/31 12:26:24 mmm 2 1
c 
e
s 00529/00000/00000
d D 1.1 83/03/15 21:34:18 tes 1 0
c date and time created 83/03/15 21:34:18 by tes
e
u
4
U
t
T
I 1
ifdef(`ERROR_ON',`
integer function errchk (int1, int2)
########################################################################
#                                                                      #
#          THIS MATERIAL IS CONFIDENTIAL AND IS FURNISHED UNDER        #
#          A WRITTEN LICENSE AGREEMENT.  IT MAY NOT BE USED,           #
#          COPIED OR DISCLOSED TO OTHERS EXCEPT IN ACCORDANCE          #
#          WITH THE TERMS OF THAT AGREEMENT.                           #
#                                                                      #
#          COPYRIGHT (C) 1982 GRAPHIC SOFTWARE SYSTEMS INC.            #
#          ALL RIGHTS RESERVED.                                        #
#                                                                      #
#     Function: Perform necessary error checking.                      #
#                                                                      #
#     Input Parameters:                                                #
#            int1 - integer scalar value to check                      #
#            int2 - integer array of values to check                   #
#                                                                      #
#     Output Parameters:                                               #
#            none                                                      #
#                                                                      #
#     Errors:                                                          #
#         None                                                         #
#                                                                      #
#     Routines Called:                                                 #
#            gkserr - output error message                             #
#                                                                      #
########################################################################
D 2
integer errchk
E 2
integer int1, int2(2)

D 2
integer i, j, isub, rounum, numerr, start, nxterr, errind, ipos
E 2
I 2
integer i, j, isub, numerr, start, nxterr, errind, ipos
E 2
integer routin(201), errors(169)

include(`gkscom')

data  routin/  GACWK, 4, 1,
               GCLKS, 1, 5,
               GCLRWK, 3, 6,
               GCLWK, 4, 9,
               GDAWK, 3, 13,
               GESC,  1, 16,
               GFA,   1, 17,
               GGDP,  2, 18,
	       GIAGDP, 4, 20,
	       GICI,   3, 24,
	       GICIAV, 1, 27,
	       GICL,   5, 28,
	       GICLA,  6, 33,
	       GICLAD, 4, 39,
	       GICLIN, 1, 43,
	       GICNT,  1, 44,
	       GICNTN, 1, 45,
	       GICR,   5, 46,
	       GICSPA, 1, 51,
	       GIKSLV, 1, 52,
	       GIMXDS, 3, 53,
	       GIMXNT, 1, 56,
	       GINT,   1, 57,
	       GICF,   4, 58,
	       GIFAF,  4, 62,
	       GIOPWK, 1, 66,
	       GIPAF,  4, 67,
	       GIPLF,  4, 71,
	       GIPMF,  4, 75,
	       GITXF,  4, 79,
	       GITXEX, 4, 83,
	       GIWKCT, 3, 87,
	       GIWKS,  3, 90,
	       GIWKT,  3, 93,
	       GOPWK,  4, 96, 
	       GPL,    1, 100,
	       GPM,    1, 101,
	       GCLA,   2, 102,
	       GRQCH,  4, 104,
	       GRQLC,  4, 108,
	       GRQST,  4, 112, 
	       GRQVL,  4, 116,
	       GSCHH,  1, 120,
	       GSCHU,  1, 121,
	       GSCLIN, 1, 122,
	       GSCR,   4, 123,
	       GSELNT, 2, 127,
	       GSFACI, 2, 129,
	       GSFAIS, 2, 131,
	       GSFASI, 2, 133,
	       GSLWSF, 1, 135,
	       GSMSSF, 1, 136,
	       GSPLCI, 2, 137,
	       GSPLT,  2, 139,
	       GSPMCI, 2, 141,
	       GSPMT,  2, 143,
	       GSTXCI, 2, 145,
	       GSTXFT, 2, 147, 
	       GSTXPR, 2, 149,
	       GSVW,   2, 151,
	       GSW,    2, 153,
	       GSWKVW, 3, 155,
	       GSWKW,  3, 158,
	       GTX,    1, 161,
	       GUPDWK, 3, 162,
	       GSCHAL, 1, 165,
	       GIAIP, 4, 166/

              #(1)
              # 6, 20, 25, 28,           # GACWK
data errors    /4,  7, 11, 12,

              #(5)
              # 2,                       # GCLKS
		1,

              #(6)
              # 6, 20, 25,               # GCLRWK
		4,  7, 11,

              #(9)
              # 7, 20, 25, 28,           # GCLWK
		5,  7, 11, 12,

              #(13)
              # 3, 20, 29,               # GDAWK
		2,  7, 13,
		 
')
ifdef(`ERROR_ON',`
              #(16)
              # 8,                       # GESC
		6,

              #(17)
              # 5,                       # GFA
		3, 

              #(18)
              # 5, 102,                  # GGDP
		3,  28,

              #(20)
	      # 7, 22, 23, 37,           # GIAGDP
		5,  8,  9, 15,

              #(24)
	      # 7, 20, 25,               # GICI
		5,  7, 11,

              #(27)
	      # 8,                       # GICIAV
		6,

              #(28)
	      # 7, 20, 25, 37, 38,       # GICL
		5,  7, 11, 15, 16,

              #(33)
	      # 7, 20, 25, 37, 38, 85,   # GICLA
		5,  7, 11, 15, 16, 18,

              #(39)
	      # 7, 20, 25, 37,           # GICLAD
		5,  7, 11, 15,

              #(43)
	      # 8,                       # GICLIN
		6,

              #(44)
	      # 8,                       # GICNT
		6,

              #(45)
	      # 8,                       # GICNTN
		6,

              #(46)
	      # 7, 20, 25, 86, 88,       # GICR
		5,  7, 11, 19, 20,

              #(51)
              # 8,                       # GICSPA
		6,

              #(52)
              # 8,                       # GIKSLV
		6,

              #(53)
              # 7, 22, 23,               # GIMXDS
		5,  8,  9,

              #(56)
              # 8,                       # GIMXNT
		6,

              #(57)
              # 8,                       # GINT
		6,

              #(58)
              # 7, 22, 23, 37,           # GICF
		5,  8,  9, 15,

              #(62)
              # 7, 22, 23, 37,           # GIFAF
		5,  8,  9, 15,

              #(66)
	      # 8,                       # GIOPWK
		6,

              #(67)
              # 7, 22, 23, 37,           # GIPAF
		5,  8,  9, 15,

              #(71)
              # 7, 22, 23, 37,           # GIPLF
		5,  8,  9, 15,

              #(75)
              # 7, 22, 23, 37,           # GIPMF
		5,  8,  9, 15,

              #(79)
              # 7, 22, 23, 37,           # GITXF
		5,  8,  9, 15,

')
ifdef(`ERROR_ON',`
              #(83)
              # 7, 20, 25, 37,           # GITXEX
		5,  7, 11, 15,

              #(87)
	      # 7, 20, 25,               # GIWKCT
		5,  7, 11,

              #(90)
              # 7, 20, 25,               # GIWKS
		5,  7, 11,

              #(93)
              # 7, 20, 25,               # GIWKT
		5,  7, 11,

              #(96)
              # 8, 20, 22, 24,           # GOPWK
		6,  7,  8, 10,

              #(100)
              # 5,                       # GPL
		3,

              #(101)
              # 5,                       # GPM
		3,

              #(102)
              # 5, 85,                   # GCLA
		3, 18,

              #(104)
              # 7, 20, 25, 36,           # GRQCH
		5,  7, 11, 14,

              #(108)
              # 7, 20, 25, 36,           # GRQLC
		5,  7, 11, 14,

              #(112)
              # 7, 20, 25, 36,           # GRQST
		5,  7, 11, 14,

              #(116)
              # 7, 20, 25, 36,           # GRQVL
		5,  7, 11, 14,

              #(120)
              # 8,                       # GSCHH
		6, 

              #(121)
              # 8,                       # GSCHU
		6, 

              #(122)
              # 8,                       # GSCLIN
		6,

              #(123)
              # 7, 20, 25, 86,           # GSCR
		5,  7, 11, 19,

              #(127)
              # 7, 40,                   # GSELNT
		5, 17,

              #(129)
              # 8, 90,                   # GSFACI
		6, 21,

              #(131)
              # 8, 91,                   # GSFAIS
		6, 22,

              #(133)
              # 8, 92,                   # GSFASI
		5, 23,

              #(135)
              # 8,                       # GSLWSF
		6, 

              #(136)
              # 8,                       # GSMSSF
		6,

              #(137)
              # 8, 90,                   # GSPLCI
		6, 21,

')
ifdef(`ERROR_ON',`
              #(139)
              # 8, 93,                   # GSPLT
		6, 24,

              #(141)
              # 8, 90,                   # GSPMCI
		6, 21,

              #(143)
              # 8, 94,                   # GSPMT
		6, 25,

              #(145)
              # 8, 90,                   # GSTXCI
		6, 21,

              #(147)
              # 8, 95,                   # GSTXFT
		6, 26,

              #(149)
              # 8, 96,                   # GSTXPR
		6, 27,

              #(151)
              # 8, 40,                   # GSVW
		4, 17,

              #(153)
              # 8, 40,                   # GSW
		6, 17,

              #(155)
              # 7, 20, 25,               # GSWKVW
		5,  7, 11,

              #(158)
              # 7, 20, 25,               # GSWKW
		5,  7, 11,

              #(161)
              # 5,                       # GTX
		3,

              #(162)
              # 7, 20, 25,               # GUPDWK
		5,  7, 11,

              #(165)
	      # 8,                       # GSCHAL
		6,

              #(166)
	      # 7, 22, 23, 36/           # GIAIP
		5,  8,  9, 14/

   # This routine works in the following manner:
   #
   # The array routin above contains a list of each routine number,
   # the number of associated errors to be checked, and the position
   # in the array errors of the first of these errors.
   # The array errors contains a list of each of the error conditions
   # to be checked for each routine named in routin. It should be
   # noted that since there are 29 errors to be checked, each error 
   # condition is mapped to its appropriate positional index in the
   # computed go to statement below.
   #
   # When this routine is called routin is searched for the currently
   # set routine number in common.  Once it is found, the number of
   # possible error conditions associated with it is located (the position
   # in routin adjacent to the routine name).  Then the position in
   # errors of the first of these error conditions is determined, and
   # the appropriate error conditions are checked by means of a computed
   # go to statement.  If an error is identified, the routine gkserr
   # is called with the appropriate error indicator number and an error
   # message is output.  Also, the error indicator number is returned
   # in the function name.  If no error is found, the number 0 (zero) is
   # returned in the function name.

   # Search every third element of routin for the current routine number
   for (i= 1; i<=67; i=i+1) {
      isub = 3*(i-1) + 1
      if (rounum == routin(isub)) break
      }

   # Determine the number of error conditions to check
   numerr = routin(isub+1)

   # Locate the position in errors of the first error to check
   start = routin(isub+2)

   # Preset the error indicator in case no error condition is found
   errind = 0

   # Check every error condition.
   for (i=1; i<=numerr; i=i+1) {

      # Determine the position of the current error to check
      ipos = start + i - 1
      nxterr = errors(ipos)

      # Branch to the appropriate label and check the error condition
')
ifdef(`ERROR_ON',`
           #1 2 3 4 5 6 7  8  9  10 11 
      goto (2,3,5,6,7,8,20,22,23,24,25,

	   #12 13 14 15 16 17 18 19 20 
            28,29,36,37,38,40,85,86,88,

           #21 22 23 24 25 26 27 28
            90,91,92,93,94,95,96,102), nxterr

      # If no errors were found, branch around the error checks
      goto 300

# Following are the errors checked by this routine.

2        if (gksopr != GKOP) errind = 2
	 goto 300
3        if (gksopr != WSAC) errind = 3
	 goto 300
5        if (gksopr != WSAC & gksopr != SGOP) errind = 5
	 goto 300
6        if (gksopr != WSOP & gksopr != WSAC) errind = 6
	 goto 300
7        if (gksopr <= GKOP) errind = 7 
         goto 300
8        if (gksopr < GKOP) errind = 8
	 goto 300
20       if (int1 <= 0) errind = 20
         goto 300
22       if (int2(1) < OUTPUT | int2(1) > GKSMI) errind = 22
	 goto 300
23       if (int2(1) != wrktyp) errind = 23
	 goto 300
24       if (int1 == wrkopn) errind = 24
	 goto 300
25       if (wrkid != wrkopn) errind = 25
         goto 300
28       if (int1 == wrkact) errind = 28
	 goto 300
29       if (int1 != wrkact) errind = 29
	 goto 300
')
ifdef(`ERROR_ON',`
36       if (wrktyp != INPUT & wrktyp != OUTIN) errind = 36
	 goto 300
37       if (int2(1) != OUTPUT & int2(1) != OUTIN) errind = 37
	 goto 300
38       if (pxflag != 1) errind = 38
	 goto 300
40       if (int1 < 0 | int1 > NRMMAX) errind = 40
	 goto 300
85       # error check for dimension of color array (CELL)
         if (int2(2) <= 0) errind = 85
	 goto 300
86       if (int2(1) < 0 | int2(1) >= clnum) errind = 86
	 goto 300
88       if (int2(1) >= clnum) errind = 88
	 goto 300
90       # error check 90 fill area color index invalid
         if (int1 < 0) errind = 90
	 goto 300
91       # error check 91 GSFAIS fill area interior style invalid
	 if (int1 < 0 | int1 > 3) errind = 91
	 goto 300
92       # error check 92 GSFASI fill area interior style index invalid
	 if (int1 <= 0 | int1 > npat + nhatst) errind = 92
	 goto 300
93       # error check 93 GSPLT polyline line type invalid
	 if (int1 <= 0 | int1 > nlntyp) errind = 93
	 goto 300
94       # error check 94 GSPMT polymarker marker type invalid
	 if (int1 <= 0 | int1 > nmktyp) errind = 94
	 goto 300
95       # error check 95 GSTXFT text font invalid
	 if (int1 <= 0 | int1 > nfont) errind = 95
	 goto 300
96       # error check 96 GSTXPR text precision invalid
	 if (int1 != STRINGxPRECISION & int1 != CHARACTERxPRECISION)
	    errind = 96
         goto 300
102      # error check 102 for invalid gdp
         if (ngdp == 0) {
	    errind = 102
	    }
         else {
	    do j=1,ngdp {
	       if(int1 == lgdp(j)) break
               if(j == ngdp) errind = 102
	       }
            }
300      continue
         if (errind != 0) break
      }

   #  If an error was detected, output an error message
   if (errind != 0 & (rounum < 9 | rounum > 35)) {
      call gkserr (errind)
      }

   # Return the error indicator number in the function name.
   errchk = errind
   return
end
')
E 1
