[ Previous | Next | Contents | Glossary | Home | Search ]
The graPHIGS Programming Interface: Understanding Concepts

Appendix A. House Sample Program

The following pages contain a listing of the completed house sample program.

 
* DECLARE VARIABLES
      INTEGERx4 STATUS,CHOICE
      INTEGERx4 WSID,STRID(5),VIEW1
      REALx4 WINDOW(4),VIEWPT(4)
      REALx4 HOUSE(12)
      INTEGERx4 CHARID(2),VALUE(2)
      REALx4 MATRIX(9)
      INTEGERx4 POST
      REALx4 DOOR(10),TRANSD(9)
      INTEGERx4 ATLIST(3),ATFLAG(3)
      INTEGERx4 COLOR(2)
      REALx4 CTABLE(3)
      REALx4 TRANSW(9), HWNDW1(10),HWNDW2(4),HWNDW3(4)
      REALx4 WNDOW2(4),VIEWPA(4)
      INTEGERx4 VIEW2
      REALx4 AREA(6),CSIZE(3)
      INTEGERx4 DATAL,DATA(7),ERRIND,UNITS,ASIZE(3)
      CHARACTERx8 ACONID,AWSTYP
      INTEGERx4 IWSID,CLASS,DEVICE,ILEN,OLEN
      INTEGERx4 VDATAL,VDATA(4)
      REALx4 VVALUE,LOW,HIGH,SCALE(2),VMATRX(9)
      INTEGERx4 ACTNUM,ACTLEN,CDATA(2),TERM
* INITIALIZE VARIABLES
      DATA WSID  /1/
      DATA STRID /1,2,3,4,5/
      DATA VIEW1 /1/
      DATA WINDOW /-100.0,100.0,-100.0,100.0/
      DATA VIEWPT /0.0,0.5,0.0,0.5/
      DATA CHARID /6,8/
      DATA VALUE /2,2/
      DATA VIEW2 /2/
      DATA WNDOW2 /-50.0,50.0,-50.0,50.0/
      DATA VIEWPA /0.5,1.0,0.5,1.0/
      DATA HOUSE/0.0,0.0,0.0,40.0,30.0,70.0,
     *           60.0,40.0,60.0,0.0,0.0,0.0/
      DATA MATRIX /1.0,0.0,0.0,
     *             0.0,1.0,0.0,
     *           -30.0,-35.0,1.0/
      DATA DOOR /0.0,0.0,0.0,20.0,10.0,20.0,
     *           10.0,0.0,0.0,0.0/
      DATA TRANSD /1.0,0.0,0.0,
     *             0.0,1.0,0.0,
     *            10.0,0.0,1.0/
      DATA POST /2/
      DATA ATLIST /1,2,3/
      DATA ATFLAG /2,1,2/
      DATA COLOR /1,2/
      DATA CTABLE /0.40,0.25,0.25/
      DATA HWNDW1 /0.0,0.0,0.0,10.0,16.0,10.0,16.0,0.0,0.0,0.0/
      DATA HWNDW2 /0.0,5.0,16.0,5.0/
      DATA HWNDW3 /8.0,0.0,8.0,10.0/
      DATA TRANSW / 1.0, 0.0,0.0,
     *              0.0, 1.0,0.0,
     *             37.0,25.0,1.0/
      DATA DATAL /28/
      DATA DATA /4,0,0,2,1,1,2/
      DATA ILEN /8/
      DATA VDATAL /16/
      DATA VDATA /1,0,0,10/
      DATA LOW /0.5/
      DATA HIGH /2.0/
* OPEN FUNCTIONS
      CALL GPOPPH('SYSPRINT',0)
      CALL GPCRWS(WSID,1,7,'IBM5080','5080    ',0)
* VIEW DEFINITION
      CALL GPXVR(WSID,VIEW1,14,VIEWPT)
      CALL GPXVR(WSID,VIEW1,16,WINDOW)
      CALL GPXVCH(WSID,VIEW1,1,8,2)
      CALL GPXVR(WSID,VIEW2,14,VIEWPA)
      CALL GPXVR(WSID,VIEW2,16,WNDOW2)
      CALL GPXVCH(WSID,VIEW2,2,CHARID,VALUE)
* DATA CREATION
      CALL GPCR(WSID,6,1,CTABLE)
      CALL GPXPLR(WSID,1,1,1)
      CALL GPXPLR(WSID,1,2,2.0)
      CALL GPXPLR(WSID,1,3,COLOR)
*
      CALL GPOPST(STRID(1))
      CALL GPMLX2(MATRIX,POST)
      CALL GPASF(3,ATLIST,ATFLAG)
      CALL GPPLI(1)
      CALL GPPLCI(5)
      CALL GPPL2(6,2,HOUSE)
      CALL GPEXST(STRID(2))
      CALL GPEXST(STRID(3))
      CALL GPCLST
*
      CALL GPOPST(STRID(2))
      CALL GPMLX2(TRANSD,POST)
      CALL GPINLB(1)
      CALL GPLT(6)
      CALL GPPLCI(6)
      CALL GPPL2(5,2,DOOR)
      CALL GPCLST
*
      CALL GPOPST(STRID(3))
      CALL GPMLX2(TRANSW,POST)
      CALL GPPLCI(4)
      CALL GPPL2(5,2,HWNDW1)
      CALL GPPL2(2,2,HWNDW2)
      CALL GPPL2(2,2,HWNDW3)
      CALL GPCLST
* DATA DISPLAY
      CALL GPASSW(WSID,1)
      CALL GPARV(WSID,VIEW1,STRID(1),1.0)
      CALL GPARV(WSID,VIEW2,STRID(1),1.0)
      CALL GPUPWS(WSID,2)
* INPUT FUNCTIONS
      CALL GPQRCT(WSID,ILEN,ERRIND,OLEN,ACONID,AWSTYP)
      CALL GPQDS(AWSTYP,ERRIND,UNITS,CSIZE,ASIZE)
      IF(ERRIND.NE.0) GOTO 200
      AREA(1) = 0.
      AREA(2) = CSIZE(1)
      AREA(3) = 0.
      AREA(4) = CSIZE(2)
      AREA(5) = 0.
      AREA(6) = CSIZE(3)
      CALL GPINCH(WSID,1,1,2,AREA,DATAL,DATA)
      CALL GPCHMO(WSID,1,3,2)
      CALL GPINVL(WSID,1,1.,4,AREA,LOW,HIGH,VDATAL,VDATA)
      CALL GPVLMO(WSID,1,3,2)
      TIME = 10.
 100  CALL GPAWEV(TIME,IWSID,CLASS,DEVICE)
      IF(CLASS.EQ.4) THEN
        IF(DEVICE.EQ.1) THEN
          CALL GPGTCH(CHOICE)
          IF(CHOICE.EQ.1) GOTO 200
          IF(CHOICE.EQ.4) THEN
            CALL GPOPST(STRID(2))
            CALL GPEDMO(2)
            CALL GPEPLB(1)
            CALL GPOEP(1)
            CALL GPQED(1,32,ERRIND,ACTNUM,ACTLEN,CDATA,TERM)
            IF(CDATA(2).EQ.6) CALL GPLT(1)
            IF(CDATA(2).EQ.1) CALL GPLT(6)
            CALL GPCLST
            CALL GPUPWS(WSID,2)
          ENDIF
        ENDIF
      ENDIF
      IF(CLASS.EQ.3) THEN
        IF(DEVICE.EQ.1) THEN
          CALL GPGTVL(VVALUE)
          SCALE(1) = VVALUE
          SCALE(2) = VVALUE
          CALL GPSC2(SCALE,VMATRX)
          CALL GPXVR(WSID,VIEW1,18,VMATRX)
          CALL GPUPWS(WSID,2)
        ENDIF
      ENDIF
      GOTO 100
* CLOSE FUNCTIONS
 200  CALL GPCLWS(WSID)
      CALL GPCLPH
      STOP
      END

[ Previous | Next | Contents | Glossary | Home | Search ]