cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c									 c
c 		 Copyright (C) 1983, Silicon Graphics, Inc.		 c
c									 c
c  These coded instructions, statements, and computer programs  contain  c
c  unpublished  proprietary  information of Silicon Graphics, Inc., and  c
c  are protected by Federal copyright law.  They  may  not be disclosed  c
c  to  third  parties  or copied or duplicated in any form, in whole or  c
c  in part, without the prior written consent of Silicon Graphics, Inc.  c
c									 c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

      include 'gl.h'
      include 'device.h'
      integer BDIM, CSEG
      PARAMETER (BDIM = 2, CSEG = 15)

      real c(12)
      real bsplin(4,4), card(4,4), bezier(4,4)
      integer box, b
      integer*2 i, j, n, x, y
      data c/0.0, 0.0, 0.0, 0.0,
     *       0.0, 0.0, 0.0, 0.0,
     *       0.0, 0.0, 0.0, 0.0/
      data bsplin/-1.0, 3.0, -3.0, 1.0, 3.0, -6.0, 3.0, 0.0,
     *            -3.0, 0.0, 3.0, 0.0, 1.0, 4.0, 1.0, 0.0/
      data card/-0.5, 1.5, -1.5, 0.5, 1.0, -2.5, 2.0, -0.5,
     *          -0.5, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0/
      data bezier/-1.0, 3.0, -3.0, 1.0, 3.0, -6.0, 3.0, 0.0,
     *            -3.0, 3.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0/

      call ginit
      box = genobj()
      b = gentag()

      call makeob(box)
        call pushat
        call color(YELLOW)
        call maketa(b)
        call recti(0, 0, 0, 0)
        call popatt
      call closeo

      call curson
      n = 0
      call color(BLACK)
      call clear
10    if(getbut(MOUSE1).and.getbut(MOUSE2).and.getbut(MOUSE3))goto 99
      if (getbut(MOUSE3)) goto 20
      goto 10
20    x = getval(MOUSEX)
      y = getval(MOUSEY)
      if (n.lt.4) n = n + 1
      do 30 i= 1,7,3
        c(i) = c(i+3)
        c(i+1) = c(i+4)
30    continue
40    c(1+3*(n-1)) = x
      c(2+3*(n-1)) = y
      call editob(box)
      call replac(b, 0)
        call recti(x-BDIM, y-BDIM, x+BDIM, y+BDIM)
      call closeo
      call callob(box)
      if (n.lt.4) goto 10
      call color(BLUE)
      call curve(CSEG, bsplin, c)
      call color(RED)
      call curve(CSEG, card, c)
      call color(GREEN) 
      call curve(CSEG, bezier, c)
      goto 10
99    call cursof
      call gexit
      end
