(FILECREATED "27-Mar-86 21:46:14" {QV}<PEDERSEN>LISP>PLOTOBJECTS.;67 80972  

      changes to:  (FNS PLOTCOMPOUND PLOTCURVE PLOTFILLEDRECTANGLE PLOTGRAPH PLOTLINE PLOTPOINT 
			PLOTPOLYGON PLOTTEXT COPYCOMPOUND DISTANCETOCOMPOUND LABELGENERIC LABELPOINT 
			DRAWCOMPOUNDOBJECT ERASECOMPOUNDOBJECT EXTENTOFCOMPOUND HIGHLIGHTCOMPOUND 
			LOWLIGHTCOMPOUND MOVECOMPOUND)

      previous date: "25-Feb-86 15:40:42" {QV}<PEDERSEN>LISP>PLOTOBJECTS.;66)


(* Copyright (c) 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT PLOTOBJECTSCOMS)

(RPAQQ PLOTOBJECTSCOMS [(FNS COPYCOMPOUND COPYCURVE COPYFILLEDRECTANGLE COPYGENERIC COPYGRAPHOBJECT 
			       COPYLINE COPYPOINT COPYPOLYGON COPYTEXT CREATECOMPOUND CREATECURVE 
			       CREATEFILLEDRECTANGLE CREATEGRAPH CREATELINE CREATEPOINT CREATEPOLYGON 
			       CREATETEXT DISTANCETOCOMPOUND DISTANCETOCURVE 
			       DISTANCETOFILLEDRECTANGLE DISTANCETOGRAPH DISTANCETOLINE 
			       DISTANCETOPOINT DISTANCETOPOLYGON DISTANCETOTEXT DRAWCOMPOUNDOBJECT 
			       DRAWCURVEOBJECT DRAWFILLEDRECTANGLEOBJECT DRAWGRAPHOBJECT 
			       DRAWLINEOBJECT DRAWPOINTOBJECT DRAWPOLYGONOBJECT DRAWTEXTOBJECT 
			       ERASECOMPOUNDOBJECT ERASECURVEOBJECT ERASEFILLEDRECTANGLEOBJECT 
			       ERASEGRAPHOBJECT ERASELINEOBJECT ERASEPOINTOBJECT ERASEPOLYGONOBJECT 
			       ERASETEXTOBJECT EXTENTOFCOMPOUND EXTENTOFCURVE EXTENTOFFILLEDRECTANGLE 
			       EXTENTOFGRAPH EXTENTOFLINE EXTENTOFPOINT EXTENTOFPOLYGON EXTENTOFTEXT 
			       GETCOMPOUND GETCURVE GETFILLEDRECTANGLE GETGENERIC GETGRAPH GETLINE 
			       GETPOINT GETPOLYGON GETTEXT HIGHLIGHTCOMPOUND HIGHLIGHTCURVE 
			       HIGHLIGHTFILLEDRECTANGLE HIGHLIGHTGRAPH HIGHLIGHTLINE HIGHLIGHTPOINT 
			       HIGHLIGHTPOLYGON HIGHLIGHTTEXT LABELGENERIC LABELPOINT LABELTEXT 
			       LOWLIGHTCOMPOUND MOVECOMPOUND MOVECURVE MOVEFILLEDRECTANGLE MOVELINE 
			       MOVEPOINT MOVEPOLYGON MOVETEXT PLOTCOMPOUND PLOTCURVE 
			       PLOTFILLEDRECTANGLE PLOTGRAPH PLOTLINE PLOTPOINT PLOTPOINTS 
			       PLOTPOLYGON PLOTTEXT PUTCOMPOUND PUTCURVE PUTFILLEDRECTANGLE 
			       PUTGENERIC PUTGRAPH PUTLINE PUTPOINT PUTPOLYGON PUTTEXT)
	(MACROS L1METRIC L2METRIC)
	(VARS CIRCLE CROSS DASH DOT DOTDASH SHADE1 SHADE2 SHADE3 SHADE4 SHADE5 SHADE6 SHADE7 SHADE8 
	      STAR)
	(RECORDS COMPOUNDDATA CURVEDATA FILLEDRECTANGLEDATA GRAPHDATA LINEDATA PLOT.STYLE POINTDATA 
		 POLYGONDATA TEXTDATA)
	(PROP ARGNAMES PLOTCOMPOUND)
	(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY (LOCALVARS . T))
	(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA)
									      (NLAML)
									      (LAMA PLOTCOMPOUND])
(DEFINEQ

(COPYCOMPOUND
  [LAMBDA (PLOTOBJECT PLOT)                                  (* edited: "27-Mar-86 21:23")

          (* * Copyfn for COMPOUND objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create COMPOUNDDATA
				COMPONENTS ←(for OBJECT in (fetch (COMPOUNDDATA COMPONENTS)
								  of OBJECTDATA)
					       collect (COPYPLOTOBJECT OBJECT PLOT))
				COMPOUNDTYPE ←(fetch (COMPOUNDDATA COMPOUNDTYPE) of OBJECTDATA])

(COPYCURVE
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: " 8-Dec-85 16:20")

          (* * Copyfn for CURVE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create CURVEDATA
				CURVEPOINTS ←(COPYALL (fetch (CURVEDATA CURVEPOINTS)
							   of OBJECTDATA))
				STYLE ←(COPYALL (fetch (CURVEDATA STYLE) of OBJECTDATA])

(COPYFILLEDRECTANGLE
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: " 8-Dec-85 16:35")

          (* * Copyfn for FILLEDRECTANGLE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create FILLEDRECTANGLEDATA
				OBJECTLEFT ←(fetch (FILLEDRECTANGLEDATA OBJECTLEFT) of OBJECTDATA)
				OBJECTBOTTOM ←(fetch (FILLEDRECTANGLEDATA OBJECTBOTTOM)
						 of OBJECTDATA)
				OBJECTWIDTH ←(fetch (FILLEDRECTANGLEDATA OBJECTWIDTH) of 
										       OBJECTDATA)
				OBJECTHEIGHT ←(fetch (FILLEDRECTANGLEDATA OBJECTHEIGHT)
						 of OBJECTDATA)
				BORDERWIDTH ←(fetch (FILLEDRECTANGLEDATA BORDERWIDTH) of 
										       OBJECTDATA)
				TEXTURE ←(fetch (FILLEDRECTANGLEDATA TEXTURE) of OBJECTDATA])

(COPYGENERIC
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: "27-Aug-85 21:53")

          (* * Default COPYFN)


    (HCOPYALL (fetch OBJECTDATA of PLOTOBJECT])

(COPYGRAPHOBJECT
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: "12-Dec-85 13:13")

          (* *)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create GRAPHDATA
				GRAPHFN ←(fetch (GRAPHDATA GRAPHFN) of OBJECTDATA)
				NSAMPLES ←(fetch (GRAPHDATA NSAMPLES) of OBJECTDATA)
				STYLE ←(COPYALL (fetch (GRAPHDATA STYLE) of OBJECTDATA])

(COPYLINE
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: " 8-Dec-85 16:48")

          (* * Copyfn for LINE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create LINEDATA
				INFINITESLOPE? ←(fetch (LINEDATA INFINITESLOPE?) of OBJECTDATA)
				SLOPE ←(fetch (LINEDATA SLOPE) of OBJECTDATA)
				CONSTANT ←(fetch (LINEDATA CONSTANT) of OBJECTDATA)
				STYLE ←(COPYALL (fetch (LINEDATA STYLE) of OBJECTDATA])

(COPYPOINT
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: "27-Aug-85 21:50")

          (* * Copyfn for POINT objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create POINTDATA
				POINTPOSITION ←(COPYALL (fetch (POINTDATA POINTPOSITION)
							     of OBJECTDATA))
				SYMBOL ←(fetch (POINTDATA SYMBOL) of OBJECTDATA])

(COPYPOLYGON
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: " 8-Dec-85 16:49")

          (* * Copyfn for POLYGON objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create POLYGONDATA
				POLYGONPOINTS ←(COPYALL (fetch (POLYGONDATA POLYGONPOINTS)
							     of OBJECTDATA))
				STYLE ←(COPYALL (fetch (POLYGONDATA STYLE) of OBJECTDATA])

(COPYTEXT
  [LAMBDA (PLOTOBJECT PLOT)                                  (* jop: "27-Aug-85 21:52")

          (* * Copyfn for TEXT objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (RETURN (create TEXTDATA
				TEXTPOSITION ←(COPYALL (fetch (TEXTDATA TEXTPOSITION)
							    of OBJECTDATA))
				TEXT ←(COPYALL (fetch (TEXTDATA TEXT) of OBJECTDATA))
				FONT ←(fetch (TEXTDATA FONT) of OBJECTDATA])

(CREATECOMPOUND
  [LAMBDA (COMPOUNDTYPE COMPONENTS LABEL MENU)               (* edited: "21-May-85 15:29")

          (* * create a compound plot object. First is the required Compoundtype, then the components, a list of plotobjects,
	  then the optional label,and menu)


    (CREATEPLOTOBJECT COMPOUNDFNS (QUOTE COMPOUND)
			LABEL MENU (create COMPOUNDDATA
					     COMPONENTS ← COMPONENTS
					     COMPOUNDTYPE ← COMPOUNDTYPE])

(CREATECURVE
  [LAMBDA (POSITIONS LABEL STYLE MENU)                       (* jop: " 8-Dec-85 16:59")

          (* * Create a curve plot object)


    (CREATEPLOTOBJECT CURVEFNS (QUOTE CURVE)
			LABEL MENU (create CURVEDATA
					     CURVEPOINTS ← POSITIONS
					     STYLE ←(if (FIXP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ← STYLE)
						      elseif (LISTP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ←(CAR STYLE)
									 DASHING ←(CADR STYLE)
									 COLOR ←(CADDR STYLE))
						      else (create PLOT.STYLE
								       LINEWIDTH ← 1])

(CREATEFILLEDRECTANGLE
  [LAMBDA (LEFT BOTTOM WIDTH HEIGHT LABEL TEXTURE BORDERWIDTH MENU)
                                                             (* jop: " 8-Dec-85 16:34")

          (* * Create a filledrectangle plot object)


    (if (NULL TEXTURE)
	then (SETQ TEXTURE (QUOTE SHADE3)))
    (CREATEPLOTOBJECT FILLEDRECTANGLEFNS (QUOTE FILLEDRECTANGLE)
			LABEL MENU
			(create FILLEDRECTANGLEDATA
				  OBJECTLEFT ← LEFT
				  OBJECTBOTTOM ← BOTTOM
				  OBJECTWIDTH ← WIDTH
				  OBJECTHEIGHT ← HEIGHT
				  BORDERWIDTH ←(OR BORDERWIDTH 1)
				  TEXTURE ← TEXTURE])

(CREATEGRAPH
  [LAMBDA (GRAPHFN NSAMPLES LABEL STYLE MENU)                (* jop: "15-Dec-85 17:59")

          (* *)


    (CREATEPLOTOBJECT GRAPHFNS (QUOTE GRAPH)
			LABEL MENU (create GRAPHDATA
					     GRAPHFN ← GRAPHFN
					     NSAMPLES ←(OR (FIXP NSAMPLES)
							     100)
					     STYLE ←(if (FIXP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ← STYLE)
						      elseif (LISTP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ←(CAR STYLE)
									 DASHING ←(CADR STYLE)
									 COLOR ←(CADDR STYLE))
						      else (create PLOT.STYLE
								       LINEWIDTH ← 1])

(CREATELINE
  [LAMBDA (SLOPE CONSTANT LABEL STYLE MENU)                  (* jop: " 8-Dec-85 16:59")

          (* * Create a line plot object)


    (CREATEPLOTOBJECT LINEFNS (QUOTE LINE)
			LABEL MENU (create LINEDATA
					     INFINITESLOPE? ←(NOT SLOPE)
					     SLOPE ←(OR SLOPE 0.0)
					     CONSTANT ← CONSTANT
					     STYLE ←(if (FIXP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ← STYLE)
						      elseif (LISTP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ←(CAR STYLE)
									 DASHING ←(CADR STYLE)
									 COLOR ←(CADDR STYLE))
						      else (create PLOT.STYLE
								       LINEWIDTH ← 1])

(CREATEPOINT
  [LAMBDA (POSITION LABEL SYMBOL MENU)                     (* edited: "21-May-85 15:28")

          (* * Create a point plot object)


    (if (NULL SYMBOL)
	then (SETQ SYMBOL STAR))
    (CREATEPLOTOBJECT POINTFNS (QUOTE POINT)
			LABEL MENU (create POINTDATA
					     POINTPOSITION ← POSITION
					     SYMBOL ← SYMBOL])

(CREATEPOLYGON
  [LAMBDA (POSITIONS LABEL STYLE MENU)                       (* jop: " 8-Dec-85 16:59")

          (* * Create a polygon Plot object)


    (CREATEPLOTOBJECT POLYGONFNS (QUOTE POLYGON)
			LABEL MENU (create POLYGONDATA
					     POLYGONPOINTS ← POSITIONS
					     STYLE ←(if (FIXP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ← STYLE)
						      elseif (LISTP STYLE)
							then (create PLOT.STYLE
									 LINEWIDTH ←(CAR STYLE)
									 DASHING ←(CADR STYLE)
									 COLOR ←(CADDR STYLE))
						      else (create PLOT.STYLE
								       LINEWIDTH ← 1])

(CREATETEXT
  [LAMBDA (POSITION TEXT LABEL FONT MENU)                  (* edited: "21-May-85 15:32")

          (* * Create a Text Plot object)


    (CREATEPLOTOBJECT TEXTFNS (QUOTE TEXT)
			LABEL MENU (create TEXTDATA
					     TEXTPOSITION ← POSITION
					     TEXT ← TEXT
					     FONT ← FONT])

(DISTANCETOCOMPOUND
  [LAMBDA (COMPOUNDDATA STREAMPOSITION PLOT)                 (* edited: "27-Mar-86 21:25")
    (PROG [(COMPONENTS (fetch (COMPOUNDDATA COMPONENTS) of (fetch OBJECTDATA of 
										     COMPOUNDDATA]
	    (RETURN (bind (CMIN ←(DISTANCETOPLOTOBJECT (CAR COMPONENTS)
							     STREAMPOSITION PLOT))
			      PMIN for PART in (CDR COMPONENTS)
			 do (SETQ PMIN (DISTANCETOPLOTOBJECT PART STREAMPOSITION PLOT))
			      (if (LESSP PMIN CMIN)
				  then (SETQ CMIN PMIN))
			 finally (RETURN CMIN])

(DISTANCETOCURVE
  [LAMBDA (CURVEDATA STREAMPOSITION PLOT)                    (* edited: "21-May-85 15:28")
    (L1METRIC STREAMPOSITION (for POINT in (fetch (CURVEDATA STREAMPOINTS)
						  of (fetch OBJECTDATA of CURVEDATA))
				smallest (L1METRIC POINT STREAMPOSITION])

(DISTANCETOFILLEDRECTANGLE
  [LAMBDA (FILLEDRECTANGLE STREAMPOSITION PLOT)              (* edited: "21-May-85 15:29")
    (PROG ((OBJECTDATA (fetch OBJECTDATA of FILLEDRECTANGLE))
	     (CLOSEST (CONSTANT (create POSITION)))
	     (STREAMX (fetch XCOORD of STREAMPOSITION))
	     (STREAMY (fetch YCOORD of STREAMPOSITION))
	     STREAMLEFT STREAMBOTTOM STREAMRIGHT STREAMTOP INSIDEFLG)
	    (SETQ STREAMLEFT (fetch (FILLEDRECTANGLEDATA STREAMLEFT) of OBJECTDATA))
	    (SETQ STREAMBOTTOM (fetch (FILLEDRECTANGLEDATA STREAMBOTTOM) of OBJECTDATA))
	    (SETQ STREAMRIGHT (fetch (FILLEDRECTANGLEDATA STREAMRIGHT) of OBJECTDATA))
	    (SETQ STREAMTOP (fetch (FILLEDRECTANGLEDATA STREAMTOP) of OBJECTDATA))
	    [replace XCOORD of CLOSEST
	       with (if (GREATERP STREAMX STREAMRIGHT)
			  then STREAMRIGHT
			elseif (LESSP STREAMX STREAMLEFT)
			  then STREAMLEFT
			else (if (OR (GREATERP STREAMY STREAMTOP)
					   (LESSP STREAMY STREAMBOTTOM))
				   then STREAMX
				 else (SETQ INSIDEFLG T) 
                                                             (* Hack to deal with the case of adjacent 
							     filledrectangles. Bonus subtracted from metric if 
							     cursor inside rectangle)
					(if (LESSP (IMIN (IDIFFERENCE STREAMTOP STREAMY)
							       (IDIFFERENCE STREAMY STREAMBOTTOM))
						       (IMIN (IDIFFERENCE STREAMRIGHT STREAMX)
							       (IDIFFERENCE STREAMX STREAMLEFT)))
					    then STREAMX
					  else (if (LESSP (IDIFFERENCE STREAMRIGHT STREAMX)
								(IDIFFERENCE STREAMX STREAMLEFT))
						     then STREAMRIGHT
						   else STREAMLEFT]
	    [replace YCOORD of CLOSEST
	       with (if (GREATERP STREAMY STREAMTOP)
			  then STREAMTOP
			elseif (LESSP STREAMY STREAMBOTTOM)
			  then STREAMBOTTOM
			else (if (OR (GREATERP STREAMX STREAMRIGHT)
					   (LESSP STREAMX STREAMLEFT))
				   then STREAMY
				 else (if (LESSP (IMIN (IDIFFERENCE STREAMRIGHT STREAMX)
							       (IDIFFERENCE STREAMX STREAMLEFT))
						       (IMIN (IDIFFERENCE STREAMTOP STREAMY)
							       (IDIFFERENCE STREAMY STREAMBOTTOM)))
					    then STREAMY
					  else (if (LESSP (IDIFFERENCE STREAMTOP STREAMY)
								(IDIFFERENCE STREAMY STREAMBOTTOM))
						     then STREAMTOP
						   else STREAMBOTTOM]
	    (RETURN (if INSIDEFLG
			  then (IDIFFERENCE (L1METRIC STREAMPOSITION CLOSEST)
						2)
			else (L1METRIC STREAMPOSITION CLOSEST])

(DISTANCETOGRAPH
  [LAMBDA (GRAPHOBJECT STREAMPOSITION PLOT)                  (* jop: "12-Dec-85 13:15")
    (L1METRIC STREAMPOSITION (for POINT in (fetch (GRAPHDATA STREAMPOSITIONS)
						  of (fetch OBJECTDATA of GRAPHOBJECT))
				smallest (L1METRIC POINT STREAMPOSITION])

(DISTANCETOLINE
  [LAMBDA (LINEOBJECT STREAMPOSITION PLOT)                   (* edited: "18-May-85 17:34")
    (PROG ((X0 (fetch XCOORD of STREAMPOSITION))
	     (Y0 (fetch YCOORD of STREAMPOSITION))
	     (STREAMSLOPE (fetch STREAMSLOPE of (fetch OBJECTDATA of LINEOBJECT)))
	     (STREAMCONSTANT (fetch STREAMCONSTANT of (fetch OBJECTDATA of LINEOBJECT)))
	     MP BP XI YI)                                    (* Assumes use of the L1metric)
	    (RETURN (FIXR (if (fetch INFINITESLOPE? of (fetch OBJECTDATA of LINEOBJECT))
				  then (FABS (FDIFFERENCE X0 STREAMCONSTANT))
				elseif (EQP STREAMSLOPE 0.0)
				  then (FABS (FDIFFERENCE Y0 STREAMCONSTANT))
				else (SETQ MP (FMINUS (FQUOTIENT 1.0 STREAMSLOPE)))
				       (SETQ BP (FDIFFERENCE Y0 (FTIMES MP X0)))
				       (SETQ XI (FQUOTIENT (FDIFFERENCE BP STREAMCONSTANT)
							       (FDIFFERENCE STREAMSLOPE MP)))
				       (SETQ YI (FPLUS (FTIMES MP XI)
							   BP))
				       (L1METRIC STREAMPOSITION
						 (create POSITION
							   XCOORD ← XI
							   YCOORD ← YI])

(DISTANCETOPOINT
  [LAMBDA (POINT STREAMPOSITION PLOT)                        (* edited: "21-May-85 15:28")
    (L1METRIC (fetch (POINTDATA STREAMPOSITION) of (fetch OBJECTDATA of POINT))
	      STREAMPOSITION])

(DISTANCETOPOLYGON
  [LAMBDA (POLYGONDATA STREAMPOSITION PLOT)                  (* edited: "21-May-85 15:32")
    (L1METRIC STREAMPOSITION (for POINT in (fetch (POLYGONDATA STREAMPOINTS)
						  of (fetch OBJECTDATA of POLYGONDATA))
				smallest (L1METRIC POINT STREAMPOSITION])

(DISTANCETOTEXT
  [LAMBDA (TEXTOBJECT STREAMPOSITION PLOT)                   (* jop: "12-Aug-85 13:42")
    (L1METRIC (fetch (TEXTDATA STREAMPOSITION) of (fetch OBJECTDATA of TEXTOBJECT))
	      STREAMPOSITION])

(DRAWCOMPOUNDOBJECT
  [LAMBDA (COMPOUNDOBJECT VIEWPORT PLOT)                     (* edited: "27-Mar-86 21:25")
    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of (fetch (PLOTOBJECT OBJECTDATA)
								  of COMPOUNDOBJECT))
       do (DRAWPLOTOBJECT OBJECT VIEWPORT PLOT])

(DRAWCURVEOBJECT
  [LAMBDA (CURVEOBJECT VIEWPORT PLOT)                        (* jop: "24-Feb-86 15:28")

          (* * Draw a series of connected lines in VIEWPORT. Style is the line width in pixels.)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of CURVEOBJECT))
	   (POINTS (fetch (CURVEDATA CURVEPOINTS) of OBJECTDATA))
	   (STREAMPOINTS (for PT in POINTS collect (WORLDTOSTREAM PT VIEWPORT)))
	   (STYLE (fetch (CURVEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (TIMES (DSPSCALE NIL STREAM)
			       (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (DASHING (fetch (PLOT.STYLE DASHING) of STYLE))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOINTS))
			     (fetch YCOORD of (CAR STREAMPOINTS))
			     STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE REPLACE)
								       STREAM COLOR DASHING))
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (CURVEDATA STREAMPOINTS) of OBJECTDATA with STREAMPOINTS])

(DRAWFILLEDRECTANGLEOBJECT
  [LAMBDA (FILLEDRECTANGLEOBJECT VIEWPORT PLOT)              (* jop: "24-Feb-86 18:16")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of FILLEDRECTANGLEOBJECT))
	   (TEXTURE (fetch (FILLEDRECTANGLEDATA TEXTURE) of OBJECTDATA))
	   (BORDERWIDTH (TIMES (DSPSCALE NIL STREAM)
				 (fetch (FILLEDRECTANGLEDATA BORDERWIDTH) of OBJECTDATA)))
	   STREAMLEFT STREAMBOTTOM STREAMWIDTH STREAMHEIGHT STREAMRIGHT STREAMTOP)
          (SETQ STREAMLEFT (WORLDTOSTREAMX (fetch (FILLEDRECTANGLEDATA OBJECTLEFT)
						  of OBJECTDATA)
					       VIEWPORT))
          (SETQ STREAMBOTTOM (WORLDTOSTREAMY (fetch (FILLEDRECTANGLEDATA OBJECTBOTTOM)
						    of OBJECTDATA)
						 VIEWPORT))
          (SETQ STREAMWIDTH (DIFFERENCE (WORLDTOSTREAMX (fetch (FILLEDRECTANGLEDATA 
										      OBJECTRIGHT)
								 of OBJECTDATA)
							      VIEWPORT)
					    STREAMLEFT))
          (SETQ STREAMHEIGHT (DIFFERENCE (WORLDTOSTREAMY (fetch (FILLEDRECTANGLEDATA 
											OBJECTTOP)
								  of OBJECTDATA)
							       VIEWPORT)
					     STREAMBOTTOM))
          (SETQ STREAMRIGHT (PLUS STREAMLEFT STREAMWIDTH))
          (SETQ STREAMTOP (PLUS STREAMBOTTOM STREAMHEIGHT))
          (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM STREAMLEFT STREAMBOTTOM STREAMWIDTH 
			    STREAMHEIGHT (QUOTE TEXTURE)
			    (QUOTE PAINT)
			    TEXTURE)
          (MOVETO STREAMLEFT STREAMBOTTOM STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMBOTTOM BORDERWIDTH (QUOTE REPLACE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMTOP BORDERWIDTH (QUOTE REPLACE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMTOP BORDERWIDTH (QUOTE REPLACE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMBOTTOM BORDERWIDTH (QUOTE REPLACE)
			    STREAM)
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (FILLEDRECTANGLEDATA STREAMLEFT) of OBJECTDATA with STREAMLEFT)
		     (replace (FILLEDRECTANGLEDATA STREAMBOTTOM) of OBJECTDATA with 
										     STREAMBOTTOM)
		     (replace (FILLEDRECTANGLEDATA STREAMWIDTH) of OBJECTDATA with STREAMWIDTH)
		     (replace (FILLEDRECTANGLEDATA STREAMHEIGHT) of OBJECTDATA with 
										     STREAMHEIGHT])

(DRAWGRAPHOBJECT
  [LAMBDA (GRAPHOBJECT VIEWPORT PLOT)                        (* jop: "24-Feb-86 16:18")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of GRAPHOBJECT))
	   (XUPPER (fetch (PLOT XUPPER) of PLOT))
	   (XLOWER (fetch (PLOT XLOWER) of PLOT))
	   (YUPPER (fetch (PLOT YUPPER) of PLOT))
	   (YLOWER (fetch (PLOT YLOWER) of PLOT))
	   (GRAPHFN (fetch (GRAPHDATA GRAPHFN) of OBJECTDATA))
	   (NSAMPLES (fetch (GRAPHDATA NSAMPLES) of OBJECTDATA))
	   (STYLE (fetch (GRAPHDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (TIMES (DSPSCALE NIL STREAM)
			       (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (DASHING (fetch (PLOT.STYLE DASHING) of STYLE))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE))
	   STREAMPOSITIONS)
          [SETQ STREAMPOSITIONS (NCONC1 (bind (INC ←(FQUOTIENT (FDIFFERENCE XUPPER XLOWER)
								       (SUB1 NSAMPLES)))
					       for I from 1 to (SUB1 NSAMPLES) as X
					       from XLOWER by INC
					       collect (CREATEPOSITION (WORLDTOSTREAMX X 
											 VIEWPORT)
									   (WORLDTOSTREAMY
									     (APPLY* GRAPHFN X)
									     VIEWPORT)))
					    (CREATEPOSITION (WORLDTOSTREAMX XUPPER VIEWPORT)
							      (WORLDTOSTREAMY (APPLY* GRAPHFN 
											  XUPPER)
										VIEWPORT]
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOSITIONS))
			     (fetch YCOORD of (CAR STREAMPOSITIONS))
			     STREAM)
	     for PT in (CDR STREAMPOSITIONS) do (CLIPPED.DRAWTO STREAMSUBREGION
									  (fetch XCOORD
									     of PT)
									  (fetch YCOORD
									     of PT)
									  LINEWIDTH
									  (QUOTE REPLACE)
									  STREAM COLOR DASHING))
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (GRAPHDATA STREAMPOSITIONS) of OBJECTDATA with STREAMPOSITIONS])

(DRAWLINEOBJECT
  [LAMBDA (LINEOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 16:05")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of LINEOBJECT))
	   (XUPPER (fetch (PLOT XUPPER) of PLOT))
	   (XLOWER (fetch (PLOT XLOWER) of PLOT))
	   (YUPPER (fetch (PLOT YUPPER) of PLOT))
	   (YLOWER (fetch (PLOT YLOWER) of PLOT))
	   (STYLE (fetch (LINEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (TIMES (DSPSCALE NIL STREAM)
			       (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (DASHING (fetch (PLOT.STYLE DASHING) of STYLE))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE))
	   (INFINITESLOPE? (fetch (LINEDATA INFINITESLOPE?) of OBJECTDATA))
	   (SLOPE (fetch (LINEDATA SLOPE) of OBJECTDATA))
	   (CONSTANT (fetch (LINEDATA CONSTANT) of OBJECTDATA))
	   STREAMSLOPE STREAMCONSTANT STREAMPT1 STREAMPT2 X1 Y1 X2 Y2)
          (SETQ X1 (if INFINITESLOPE?
			 then CONSTANT
		       else XLOWER))
          [SETQ Y1 (if INFINITESLOPE?
			 then YLOWER
		       else (FPLUS CONSTANT (FTIMES SLOPE X1]
          (SETQ X2 (if INFINITESLOPE?
			 then CONSTANT
		       else XUPPER))
          [SETQ Y2 (if INFINITESLOPE?
			 then YUPPER
		       else (FPLUS CONSTANT (FTIMES SLOPE X2]
          [SETQ STREAMSLOPE (AND (NOT INFINITESLOPE?)
				     (FTIMES SLOPE (FQUOTIENT (fetch (VIEWPORT WORLDTOSTREAMMY)
								     of VIEWPORT)
								  (fetch (VIEWPORT WORLDTOSTREAMMX)
								     of VIEWPORT]
          [SETQ STREAMCONSTANT (if INFINITESLOPE?
				     then (WORLDTOSTREAMX CONSTANT VIEWPORT)
				   else (FDIFFERENCE (WORLDTOSTREAMY CONSTANT VIEWPORT)
							 (FTIMES STREAMSLOPE (fetch (VIEWPORT
											  
										  WORLDTOSTREAMAX)
										  of VIEWPORT]
          (SETQ STREAMPT1 (CREATEPOSITION (WORLDTOSTREAMX X1 VIEWPORT)
					      (WORLDTOSTREAMY Y1 VIEWPORT)))
          (SETQ STREAMPT2 (CREATEPOSITION (WORLDTOSTREAMX X2 VIEWPORT)
					      (WORLDTOSTREAMY Y2 VIEWPORT)))
          (CLIPPED.DRAWBETWEEN STREAMSUBREGION STREAMPT1 STREAMPT2 LINEWIDTH (QUOTE REPLACE)
				 STREAM COLOR DASHING)
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (if STREAMSLOPE
			 then (replace (LINEDATA STREAMSLOPE) of OBJECTDATA with STREAMSLOPE)
		       else (replace (LINEDATA STREAMSLOPE) of OBJECTDATA with 0.0))
		     (replace (LINEDATA STREAMCONSTANT) of OBJECTDATA with STREAMCONSTANT)
		     (replace (LINEDATA STREAMPT1) of OBJECTDATA with STREAMPT1)
		     (replace (LINEDATA STREAMPT2) of OBJECTDATA with STREAMPT2])

(DRAWPOINTOBJECT
  [LAMBDA (POINT VIEWPORT PLOT)                              (* jop: "24-Feb-86 14:52")

          (* * Draw a glyph at POINTPOSITION. SYMBOL is the glyph to be drawn.)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POINT))
	   (SYMBOL (fetch (POINTDATA SYMBOL) of OBJECTDATA))
	   (PT (fetch (POINTDATA POINTPOSITION) of OBJECTDATA))
	   (STREAMPT (WORLDTOSTREAM PT VIEWPORT)))
          (CLIPPED.PLOTAT STREAMSUBREGION STREAMPT SYMBOL STREAM)
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (POINTDATA STREAMPOSITION) of OBJECTDATA with STREAMPT])

(DRAWPOLYGONOBJECT
  [LAMBDA (POLYGONOBJECT VIEWPORT PLOT)                      (* jop: "24-Feb-86 15:30")

          (* * Draws a polygon in VIEWPORT.)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POLYGONOBJECT))
	   (POINTS (fetch (POLYGONDATA POLYGONPOINTS) of OBJECTDATA))
	   (STREAMPOINTS (for PT in POINTS collect (WORLDTOSTREAM PT VIEWPORT)))
	   (STYLE (fetch (POLYGONDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (TIMES (DSPSCALE NIL STREAM)
			       (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (DASHING (fetch (PLOT.STYLE DASHING) of STYLE))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (bind (START ←(CAR STREAMPOINTS)) first (MOVETO (fetch XCOORD of START)
								  (fetch YCOORD of START)
								  STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE REPLACE)
								       STREAM COLOR DASHING)
	     finally (CLIPPED.DRAWTO STREAMSUBREGION (fetch XCOORD of START)
					 (fetch YCOORD of START)
					 LINEWIDTH
					 (QUOTE REPLACE)
					 STREAM COLOR DASHING))
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (POLYGONDATA STREAMPOINTS) of OBJECTDATA with STREAMPOINTS])

(DRAWTEXTOBJECT
  [LAMBDA (TEXTOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 18:00")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of TEXTOBJECT))
	   (TEXT (fetch (TEXTDATA TEXT) of OBJECTDATA))
	   (FONT (fetch (TEXTDATA FONT) of OBJECTDATA))
	   (PT (fetch (TEXTDATA TEXTPOSITION) of OBJECTDATA))
	   STREAMX STREAMY)
          (SETQ STREAMX (WORLDTOSTREAMX (fetch XCOORD of PT)
					    VIEWPORT))
          (SETQ STREAMY (WORLDTOSTREAMY (fetch YCOORD of PT)
					    VIEWPORT))
          (RESETLST (RESETSAVE (DSPFONT FONT STREAM)
				   (LIST (QUOTE DSPFONT)
					   (DSPFONT NIL STREAM)
					   STREAM))
		      (MOVETO STREAMX STREAMY STREAM)
		      (CLIPPED.PRIN1 STREAMSUBREGION TEXT STREAM))
          (if (EQ STREAM (WINDOWPROP (fetch (PLOT PLOTWINDOW) of PLOT)
					   (QUOTE DSP)))
	      then (replace (TEXTDATA STREAMPOSITION) of OBJECTDATA with (CREATEPOSITION
										   STREAMX STREAMY])

(ERASECOMPOUNDOBJECT
  [LAMBDA (COMPOUNDOBJECT VIEWPORT PLOT)                     (* edited: "27-Mar-86 21:26")
    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of (fetch (PLOTOBJECT OBJECTDATA)
								  of COMPOUNDOBJECT))
       do (ERASEPLOTOBJECT OBJECT PLOT])

(ERASECURVEOBJECT
  [LAMBDA (CURVEOBJECT VIEWPORT)                             (* jop: "24-Feb-86 15:30")

          (* * Erase the CURVEOBJECT, using the cached stream coordinates)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of CURVEOBJECT))
	   (STREAMPOINTS (fetch (CURVEDATA STREAMPOINTS) of OBJECTDATA))
	   (STYLE (fetch (CURVEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOINTS))
			     (fetch YCOORD of (CAR STREAMPOINTS))
			     STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE ERASE)
								       STREAM COLOR])

(ERASEFILLEDRECTANGLEOBJECT
  [LAMBDA (FILLEDRECTANGLE VIEWPORT PLOT)                    (* jop: "24-Feb-86 18:19")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of FILLEDRECTANGLE))
	   (TEXTURE (fetch (FILLEDRECTANGLEDATA TEXTURE) of OBJECTDATA))
	   (BORDERWIDTH (TIMES (DSPSCALE NIL STREAM)
				 (fetch (FILLEDRECTANGLEDATA BORDERWIDTH) of OBJECTDATA)))
	   (STREAMLEFT (fetch (FILLEDRECTANGLEDATA STREAMLEFT) of OBJECTDATA))
	   (STREAMBOTTOM (fetch (FILLEDRECTANGLEDATA STREAMBOTTOM) of OBJECTDATA))
	   (STREAMWIDTH (fetch (FILLEDRECTANGLEDATA STREAMWIDTH) of OBJECTDATA))
	   (STREAMHEIGHT (fetch (FILLEDRECTANGLEDATA STREAMHEIGHT) of OBJECTDATA))
	   (STREAMRIGHT (fetch (FILLEDRECTANGLEDATA STREAMRIGHT) of OBJECTDATA))
	   (STREAMTOP (fetch (FILLEDRECTANGLEDATA STREAMTOP) of OBJECTDATA)))
          (MOVETO STREAMLEFT STREAMBOTTOM STREAM)
          (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM STREAMLEFT STREAMBOTTOM STREAMWIDTH 
			    STREAMHEIGHT (QUOTE TEXTURE)
			    (QUOTE INVERT)
			    TEXTURE)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMBOTTOM BORDERWIDTH (QUOTE ERASE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMTOP BORDERWIDTH (QUOTE ERASE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMTOP BORDERWIDTH (QUOTE ERASE)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMBOTTOM BORDERWIDTH (QUOTE ERASE)
			    STREAM])

(ERASEGRAPHOBJECT
  [LAMBDA (GRAPHOBJECT VIEWPORT)                             (* jop: "24-Feb-86 16:20")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of GRAPHOBJECT))
	   (STREAMPOSITIONS (fetch (GRAPHDATA STREAMPOSITIONS) of OBJECTDATA))
	   (STYLE (fetch (GRAPHDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOSITIONS))
			     (fetch YCOORD of (CAR STREAMPOSITIONS))
			     STREAM)
	     for PT in (CDR STREAMPOSITIONS) do (CLIPPED.DRAWTO STREAMSUBREGION
									  (fetch XCOORD
									     of PT)
									  (fetch YCOORD
									     of PT)
									  LINEWIDTH
									  (QUOTE ERASE)
									  STREAM COLOR])

(ERASELINEOBJECT
  [LAMBDA (LINEOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 16:09")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of LINEOBJECT))
	   (STYLE (fetch (LINEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
			       2))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE))
	   (STREAMPT1 (fetch (LINEDATA STREAMPT1) of OBJECTDATA))
	   (STREAMPT2 (fetch (LINEDATA STREAMPT2) of OBJECTDATA)))
          (CLIPPED.DRAWBETWEEN STREAMSUBREGION STREAMPT1 STREAMPT2 LINEWIDTH (QUOTE ERASE)
				 STREAM COLOR])

(ERASEPOINTOBJECT
  [LAMBDA (POINT VIEWPORT PLOT)                              (* jop: "24-Feb-86 15:03")

          (* * Erase POINT, using cached stream coordinates)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POINT))
	   (SYMBOL (fetch (POINTDATA SYMBOL) of OBJECTDATA))
	   (STREAMPT (fetch (POINTDATA STREAMPOSITION) of OBJECTDATA)))
          (CLIPPED.PLOTAT STREAMSUBREGION STREAMPT SYMBOL STREAM (QUOTE ERASE])

(ERASEPOLYGONOBJECT
  [LAMBDA (POLYGONOBJECT VIEWPORT)                           (* jop: "24-Feb-86 15:31")

          (* * Erase a POLYGONDATA)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POLYGONOBJECT))
	   (STREAMPOINTS (fetch (POLYGONDATA STREAMPOINTS) of OBJECTDATA))
	   (STYLE (fetch (POLYGONDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (bind (START ←(CAR STREAMPOINTS)) first (MOVETO (fetch XCOORD of START)
								  (fetch YCOORD of START)
								  STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE ERASE)
								       STREAM COLOR)
	     finally (CLIPPED.DRAWTO STREAMSUBREGION (fetch XCOORD of START)
					 (fetch YCOORD of START)
					 LINEWIDTH
					 (QUOTE ERASE)
					 STREAM COLOR])

(ERASETEXTOBJECT
  [LAMBDA (TEXTOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 18:02")

          (* * ERASE the TEXTDATA)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of TEXTOBJECT))
	   (TEXT (fetch (TEXTDATA TEXT) of OBJECTDATA))
	   (FONT (fetch (TEXTDATA FONT) of OBJECTDATA))
	   (STREAMPOSITION (fetch (TEXTDATA STREAMPOSITION) of OBJECTDATA))
	   (STREAMX (fetch XCOORD of STREAMPOSITION))
	   (STREAMY (fetch YCOORD of STREAMPOSITION))
	   BLANCREGION)
          (RESETLST (RESETSAVE (DSPFONT FONT STREAM)
				   (LIST (QUOTE DSPFONT)
					   (DSPFONT NIL STREAM)
					   STREAM))
		      (MOVETO STREAMX STREAMY STREAM)
		      (SETQ BLANCREGION (STRINGREGION TEXT STREAM))
		      (with REGION BLANCREGION (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM 
								   LEFT BOTTOM WIDTH HEIGHT
								   (QUOTE TEXTURE])

(EXTENTOFCOMPOUND
  [LAMBDA (COMPOUNDOBJECT)                                   (* edited: "27-Mar-86 21:26")
    (bind (CMINX ← MAX.FLOAT)
	    (CMAXX ← MIN.FLOAT)
	    (CMINY ← MAX.FLOAT)
	    (CMAXY ← MIN.FLOAT)
	    PEXTENT for PART in (fetch (COMPOUNDDATA COMPONENTS) of (fetch OBJECTDATA
									       of COMPOUNDOBJECT))
       declare (TYPE FLOATING CMINX CMAXX CMINY CMAXY)
       do (SETQ PEXTENT (EXTENTOFPLOTOBJECT PART))
	    (if (LESSP (fetch MINX of PEXTENT)
			   CMINX)
		then (SETQ CMINX (fetch MINX of PEXTENT)))
	    (if (GREATERP (fetch MAXX of PEXTENT)
			      CMAXX)
		then (SETQ CMAXX (fetch MAXX of PEXTENT)))
	    (if (LESSP (fetch MINY of PEXTENT)
			   CMINY)
		then (SETQ CMINY (fetch MINY of PEXTENT)))
	    (if (GREATERP (fetch MAXY of PEXTENT)
			      CMAXY)
		then (SETQ CMAXY (fetch MAXY of PEXTENT)))
       finally (RETURN (create EXTENT
				     MINX ← CMINX
				     MAXX ← CMAXX
				     MINY ← CMINY
				     MAXY ← CMAXY])

(EXTENTOFCURVE
  [LAMBDA (CURVEOBJECT)                                      (* jop: " 8-Dec-85 18:31")
    (bind (MINX ← MAX.FLOAT)
	    (MAXX ← MIN.FLOAT)
	    (MINY ← MAX.FLOAT)
	    (MAXY ← MIN.FLOAT)
	    X Y for POSITION in (fetch (CURVEDATA CURVEPOINTS) of (fetch OBJECTDATA
									     of CURVEOBJECT))
       declare (TYPE FLOATING MINX MAXX MINY MAXY X Y)
       do (SETQ X (fetch XCOORD of POSITION))
	    (SETQ Y (fetch YCOORD of POSITION))
	    (if (FLESSP X MINX)
		then (SETQ MINX X))
	    (if (FGREATERP X MAXX)
		then (SETQ MAXX X))
	    (if (FLESSP Y MINY)
		then (SETQ MINY Y))
	    (if (FGREATERP Y MAXY)
		then (SETQ MAXY Y))
       finally (RETURN (create EXTENT
				     MINX ← MINX
				     MAXX ← MAXX
				     MINY ← MINY
				     MAXY ← MAXY])

(EXTENTOFFILLEDRECTANGLE
  [LAMBDA (FILLEDRECTANGLE)                                  (* edited: "21-May-85 15:29")
    (create EXTENT
	      MINX ←(fetch (FILLEDRECTANGLEDATA OBJECTLEFT) of (fetch OBJECTDATA of 
										  FILLEDRECTANGLE))
	      MAXX ←(fetch (FILLEDRECTANGLEDATA OBJECTRIGHT) of (fetch OBJECTDATA of 
										  FILLEDRECTANGLE))
	      MINY ←(fetch (FILLEDRECTANGLEDATA OBJECTBOTTOM) of (fetch OBJECTDATA
									of FILLEDRECTANGLE))
	      MAXY ←(fetch (FILLEDRECTANGLEDATA OBJECTTOP) of (fetch OBJECTDATA of 
										  FILLEDRECTANGLE])

(EXTENTOFGRAPH
  [LAMBDA (GRAPHOBJECT)                                      (* jop: "12-Dec-85 13:09")

          (* *)


    (create EXTENT
	      MINX ← MAX.FLOAT
	      MAXX ← MIN.FLOAT
	      MINY ← MAX.FLOAT
	      MAXY ← MIN.FLOAT])

(EXTENTOFLINE
  [LAMBDA (LINEOBJECT)                                       (* jop: " 5-Mar-85 14:03")
    (create EXTENT
	      MINX ← MAX.FLOAT
	      MAXX ← MIN.FLOAT
	      MINY ← MAX.FLOAT
	      MAXY ← MIN.FLOAT])

(EXTENTOFPOINT
  [LAMBDA (POINT)                                            (* edited: "21-May-85 15:28")
    (PROG [(POSITION (fetch (POINTDATA POINTPOSITION) of (fetch OBJECTDATA of POINT]
	    (RETURN (create EXTENT
				MINX ←(fetch XCOORD of POSITION)
				MAXX ←(fetch XCOORD of POSITION)
				MINY ←(fetch YCOORD of POSITION)
				MAXY ←(fetch YCOORD of POSITION])

(EXTENTOFPOLYGON
  [LAMBDA (POLYGONOBJECT)                                    (* edited: "18-May-85 16:14")
    (bind (MINX ← MAX.FLOAT)
	    (MAXX ← MIN.FLOAT)
	    (MINY ← MAX.FLOAT)
	    (MAXY ← MIN.FLOAT)
	    X Y for POSITION in (fetch POLYGONPOINTS of (fetch OBJECTDATA of 
										    POLYGONOBJECT))
       declare (TYPE FLOATING MINX MAXX MINY MAXY X Y)
       do (SETQ X (fetch XCOORD of POSITION))
	    (SETQ Y (fetch YCOORD of POSITION))
	    (if (FLESSP X MINX)
		then (SETQ MINX X))
	    (if (FGREATERP X MAXX)
		then (SETQ MAXX X))
	    (if (FLESSP Y MINY)
		then (SETQ MINY Y))
	    (if (FGREATERP Y MAXY)
		then (SETQ MAXY Y))
       finally (RETURN (create EXTENT
				     MINX ← MINX
				     MAXX ← MAXX
				     MINY ← MINY
				     MAXY ← MAXY])

(EXTENTOFTEXT
  [LAMBDA (TEXTOBJECT)                                       (* edited: "18-May-85 17:03")
    (PROG [(POSITION (fetch TEXTPOSITION of (fetch OBJECTDATA of TEXTOBJECT]
	    (RETURN (create EXTENT
				MINX ←(fetch XCOORD of POSITION)
				MAXX ←(fetch XCOORD of POSITION)
				MINY ←(fetch YCOORD of POSITION)
				MAXY ←(fetch YCOORD of POSITION])

(GETCOMPOUND
  [LAMBDA (PROPLST)                                          (* jop: "27-Aug-85 16:34")

          (* * GETFN for COMPOUND objects)


    (create COMPOUNDDATA
	      COMPOUNDTYPE ←(LISTGET PROPLST (QUOTE COMPOUNDTYPE))
	      COMPONENTS ←(LISTGET PROPLST (QUOTE COMPONENTS])

(GETCURVE
  [LAMBDA (PROPLST)                                          (* jop: " 8-Dec-85 19:09")

          (* * GETFN for CURVE objects)


    (PROG [(STYLELST (LISTGET PROPLST (QUOTE STYLE]
	    (RETURN (create CURVEDATA
				CURVEPOINTS ←(LISTGET PROPLST (QUOTE CURVEPOINTS))
				STYLE ←(create PLOT.STYLE
						 LINEWIDTH ←(CAR STYLELST)
						 DASHING ←(CADR STYLELST)
						 COLOR ←(CADDR STYLELST])

(GETFILLEDRECTANGLE
  [LAMBDA (PROPLST)                                          (* jop: " 8-Dec-85 19:11")

          (* * GETFN for FILLEDRECTANGLE objects)


    (create FILLEDRECTANGLEDATA
	      OBJECTLEFT ←(LISTGET PROPLST (QUOTE OBJECTLEFT))
	      OBJECTBOTTOM ←(LISTGET PROPLST (QUOTE OBJECTBOTTOM))
	      OBJECTWIDTH ←(LISTGET PROPLST (QUOTE OBJECTWIDTH))
	      OBJECTHEIGHT ←(LISTGET PROPLST (QUOTE OBJECTHEIGHT))
	      BORDERWIDTH ←(LISTGET PROPLST (QUOTE BORDERWIDTH))
	      TEXTURE ←(LISTGET PROPLST (QUOTE TEXTURE])

(GETGENERIC
  [LAMBDA (EXPR)                                             (* jop: "27-Aug-85 17:11")
    EXPR])

(GETGRAPH
  [LAMBDA (PROPLST)                                          (* jop: "12-Dec-85 13:20")

          (* *)


    (PROG [(STYLELST (LISTGET PROPLST (QUOTE STYLE]
	    (RETURN (create GRAPHDATA
				GRAPHFN ←(LISTGET PROPLST (QUOTE GRAPHFN))
				NSAMPLES ←(LISTGET PROPLST (QUOTE NSAMPLES))
				STYLE ←(create PLOT.STYLE
						 LINEWIDTH ←(CAR STYLELST)
						 DASHING ←(CADR STYLELST)
						 COLOR ←(CADDR STYLELST])

(GETLINE
  [LAMBDA (PROPLST)                                          (* jop: " 8-Dec-85 19:08")

          (* * GETFN for LINE objects)


    (PROG [(STYLELST (LISTGET PROPLST (QUOTE STYLE]
	    (RETURN (create LINEDATA
				INFINITESLOPE? ←(LISTGET PROPLST (QUOTE INFINITESLOPE?))
				SLOPE ←(LISTGET PROPLST (QUOTE SLOPE))
				CONSTANT ←(LISTGET PROPLST (QUOTE CONSTANT))
				STYLE ←(create PLOT.STYLE
						 LINEWIDTH ←(CAR STYLELST)
						 DASHING ←(CADR STYLELST)
						 COLOR ←(CADDR STYLELST])

(GETPOINT
  [LAMBDA (PROPLST)                                          (* jop: "27-Aug-85 16:20")

          (* * Putfn for POINT objects)


    (create POINTDATA
	      POINTPOSITION ←(LISTGET PROPLST (QUOTE POINTPOSITION))
	      SYMBOL ←(LET [(SYMBOL (LISTGET PROPLST (QUOTE SYMBOL]
		           (if (LITATOM SYMBOL)
			       then (EVAL SYMBOL)
			     else SYMBOL])

(GETPOLYGON
  [LAMBDA (PROPLST)                                          (* jop: " 8-Dec-85 19:09")

          (* * GETFN for POLYGON objects)


    (PROG [(STYLELST (LISTGET PROPLST (QUOTE STYLE]
	    (RETURN (create POLYGONDATA
				POLYGONPOINTS ←(LISTGET PROPLST (QUOTE POLYGONPOINTS))
				STYLE ←(create PLOT.STYLE
						 LINEWIDTH ←(CAR STYLELST)
						 DASHING ←(CADR STYLELST)
						 COLOR ←(CADDR STYLELST])

(GETTEXT
  [LAMBDA (PROPLST)                                          (* jop: "27-Aug-85 16:28")

          (* * GETFN for TEXT objects)


    (create TEXTDATA
	      TEXTPOSITION ←(LISTGET PROPLST (QUOTE TEXTPOSITION))
	      TEXT ←(LISTGET PROPLST (QUOTE TEXT))
	      FONT ←(LISTGET PROPLST (QUOTE FONT])

(HIGHLIGHTCOMPOUND
  [LAMBDA (COMPOUNDOBJECT VIEWPORT PLOT)                     (* edited: "27-Mar-86 21:26")
    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of (fetch (PLOTOBJECT OBJECTDATA)
								  of COMPOUNDOBJECT))
       do (HIGHLIGHTPLOTOBJECT OBJECT PLOT])

(HIGHLIGHTCURVE
  [LAMBDA (CURVEOBJECT VIEWPORT PLOT)                        (* jop: "24-Feb-86 15:29")

          (* * Highlight the CURVEOBJECT, by redrawing in invert mode with fatter lines)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of CURVEOBJECT))
	   (STREAMPOINTS (fetch (CURVEDATA STREAMPOINTS) of OBJECTDATA))
	   (STYLE (fetch (CURVEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOINTS))
			     (fetch YCOORD of (CAR STREAMPOINTS))
			     STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE INVERT)
								       STREAM COLOR])

(HIGHLIGHTFILLEDRECTANGLE
  [LAMBDA (FILLEDRECTANGLE VIEWPORT PLOT)                    (* jop: "24-Feb-86 18:17")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of FILLEDRECTANGLE))
	   (BORDERWIDTH (IPLUS 2 (OR (fetch (FILLEDRECTANGLEDATA BORDERWIDTH) of OBJECTDATA)
					 1)))
	   (STREAMLEFT (fetch (FILLEDRECTANGLEDATA STREAMLEFT) of OBJECTDATA))
	   (STREAMBOTTOM (fetch (FILLEDRECTANGLEDATA STREAMBOTTOM) of OBJECTDATA))
	   (STREAMWIDTH (fetch (FILLEDRECTANGLEDATA STREAMWIDTH) of OBJECTDATA))
	   (STREAMHEIGHT (fetch (FILLEDRECTANGLEDATA STREAMHEIGHT) of OBJECTDATA))
	   (STREAMRIGHT (fetch (FILLEDRECTANGLEDATA STREAMRIGHT) of OBJECTDATA))
	   (STREAMTOP (fetch (FILLEDRECTANGLEDATA STREAMTOP) of OBJECTDATA)))
          (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM STREAMLEFT STREAMBOTTOM STREAMWIDTH 
			    STREAMHEIGHT (QUOTE TEXTURE)
			    (QUOTE INVERT)
			    BLACKSHADE)
          (MOVETO STREAMLEFT STREAMBOTTOM STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMBOTTOM BORDERWIDTH (QUOTE INVERT)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMRIGHT STREAMTOP BORDERWIDTH (QUOTE INVERT)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMTOP BORDERWIDTH (QUOTE INVERT)
			    STREAM)
          (CLIPPED.DRAWTO STREAMSUBREGION STREAMLEFT STREAMBOTTOM BORDERWIDTH (QUOTE INVERT)
			    STREAM])

(HIGHLIGHTGRAPH
  [LAMBDA (GRAPHOBJECT VIEWPORT PLOT)                        (* jop: "24-Feb-86 16:21")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of GRAPHOBJECT))
	   (STREAMPOSITIONS (fetch (GRAPHDATA STREAMPOSITIONS) of OBJECTDATA))
	   (STYLE (fetch (GRAPHDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (first (MOVETO (fetch XCOORD of (CAR STREAMPOSITIONS))
			     (fetch YCOORD of (CAR STREAMPOSITIONS))
			     STREAM)
	     for PT in (CDR STREAMPOSITIONS) do (CLIPPED.DRAWTO STREAMSUBREGION
									  (fetch XCOORD
									     of PT)
									  (fetch YCOORD
									     of PT)
									  LINEWIDTH
									  (QUOTE INVERT)
									  STREAM COLOR])

(HIGHLIGHTLINE
  [LAMBDA (LINEOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 16:09")

          (* *)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of LINEOBJECT))
	   (STYLE (fetch (LINEDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
			       2))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE))
	   (STREAMPT1 (fetch (LINEDATA STREAMPT1) of OBJECTDATA))
	   (STREAMPT2 (fetch (LINEDATA STREAMPT2) of OBJECTDATA)))
          (CLIPPED.DRAWBETWEEN STREAMSUBREGION STREAMPT1 STREAMPT2 LINEWIDTH (QUOTE INVERT)
				 STREAM COLOR])

(HIGHLIGHTPOINT
  [LAMBDA (POINT VIEWPORT PLOT)                              (* jop: "24-Feb-86 14:41")

          (* * Highlight POINT)


    (LET* [(STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POINT))
	   (SYMBOL (fetch (POINTDATA SYMBOL) of OBJECTDATA))
	   (STREAMPT (fetch (POINTDATA STREAMPOSITION) of OBJECTDATA))
	   (WIDTHGLYPH (BITMAPWIDTH SYMBOL))
	   (HEIGHTGLYPH (BITMAPHEIGHT SYMBOL))
	   (OFFSETX (IDIFFERENCE (fetch XCOORD of STREAMPT)
				   (IQUOTIENT WIDTHGLYPH 2)))
	   (OFFSETY (IDIFFERENCE (fetch YCOORD of STREAMPT)
				   (IQUOTIENT HEIGHTGLYPH 2]
          (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM OFFSETX OFFSETY WIDTHGLYPH HEIGHTGLYPH
			    (QUOTE TEXTURE)
			    (QUOTE INVERT)
			    BLACKSHADE])

(HIGHLIGHTPOLYGON
  [LAMBDA (POLYGONOBJECT VIEWPORT PLOT)                      (* jop: "24-Feb-86 15:31")

          (* * Highlight a Polygon)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POLYGONOBJECT))
	   (STREAMPOINTS (fetch (POLYGONDATA STREAMPOINTS) of OBJECTDATA))
	   (STYLE (fetch (POLYGONDATA STYLE) of OBJECTDATA))
	   (LINEWIDTH (IPLUS 2 (fetch (PLOT.STYLE LINEWIDTH) of STYLE)))
	   (COLOR (fetch (PLOT.STYLE COLOR) of STYLE)))
          (bind (START ←(CAR STREAMPOINTS)) first (MOVETO (fetch XCOORD of START)
								  (fetch YCOORD of START)
								  STREAM)
	     for PT in (CDR STREAMPOINTS) do (CLIPPED.DRAWTO STREAMSUBREGION
								       (fetch XCOORD of PT)
								       (fetch YCOORD of PT)
								       LINEWIDTH
								       (QUOTE INVERT)
								       STREAM COLOR)
	     finally (CLIPPED.DRAWTO STREAMSUBREGION (fetch XCOORD of START)
					 (fetch YCOORD of START)
					 LINEWIDTH
					 (QUOTE INVERT)
					 STREAM COLOR])

(HIGHLIGHTTEXT
  [LAMBDA (TEXTOBJECT VIEWPORT PLOT)                         (* jop: "24-Feb-86 18:01")

          (* * HIGHLIGHT the TEXTDATA)


    (LET* ((STREAM (fetch (VIEWPORT PARENTSTREAM) of VIEWPORT))
	   (STREAMSUBREGION (fetch (VIEWPORT STREAMSUBREGION) of VIEWPORT))
	   (OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of TEXTOBJECT))
	   (TEXT (fetch (TEXTDATA TEXT) of OBJECTDATA))
	   (FONT (fetch (TEXTDATA FONT) of OBJECTDATA))
	   (STREAMPOSITION (fetch (TEXTDATA STREAMPOSITION) of OBJECTDATA))
	   (STREAMX (fetch XCOORD of STREAMPOSITION))
	   (STREAMY (fetch YCOORD of STREAMPOSITION))
	   BLANCREGION)
          (RESETLST (RESETSAVE (DSPFONT FONT STREAM)
				   (LIST (QUOTE DSPFONT)
					   (DSPFONT NIL STREAM)
					   STREAM))
		      (MOVETO STREAMX STREAMY STREAM)
		      (SETQ BLANCREGION (STRINGREGION TEXT STREAM))
		      (with REGION BLANCREGION (CLIPPED.BITBLT STREAMSUBREGION NIL NIL NIL STREAM 
								   LEFT BOTTOM WIDTH HEIGHT
								   (QUOTE TEXTURE)
								   (QUOTE INVERT)
								   BLACKSHADE])

(LABELGENERIC
  [LAMBDA (OBJECT PLOT)                                      (* edited: "27-Mar-86 21:25")

          (* * Generic label routine. Intended for interactive use only)


    (PROG ((LABEL (fetch OBJECTLABEL of OBJECT))
	     (VIEWPORT (fetch PLOTWINDOWVIEWPORT of PLOT))
	     (TEXTOBJECT (PLOTOBJECTPROP OBJECT (QUOTE LABEL)))
	     LABELPOSITION)
	    (if TEXTOBJECT
		then (DRAWPLOTOBJECT TEXTOBJECT VIEWPORT PLOT)
	      else (PLOTPROMPT (CONCAT "SELECT A POSITION FOR LABEL " LABEL)
				   PLOT)
		     (SETQ LABELPOSITION (STREAMTOWORLD (GETPOSITION (fetch PLOTWINDOW
									      of PLOT))
							    VIEWPORT))
		     (SETQ TEXTOBJECT (CREATETEXT LABELPOSITION LABEL NIL SMALLPLOTFONT))
		     (DRAWPLOTOBJECT TEXTOBJECT VIEWPORT PLOT)
		     (PLOTOBJECTPROP OBJECT (QUOTE LABEL)
				       TEXTOBJECT])

(LABELPOINT
  [LAMBDA (POINT PLOT)                                       (* edited: "27-Mar-86 21:25")

          (* * Label a POINT)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of POINT))
	     (VIEWPORT (fetch (PLOT PLOTWINDOWVIEWPORT) of PLOT))
	     (LABEL (fetch (PLOTOBJECT OBJECTLABEL) of POINT))
	     (TEXTOBJECT (PLOTOBJECTPROP POINT (QUOTE LABEL)))
	     SYMBOL LABELPOSITION)
	    (SETQ LABELPOSITION (create POSITION using (fetch (POINTDATA POINTPOSITION)
								of OBJECTDATA)))
	    (SETQ SYMBOL (fetch (POINTDATA SYMBOL) of OBJECTDATA))
                                                             (* Displace Label to right of point object)
	    (if TEXTOBJECT
		then (DRAWPLOTOBJECT TEXTOBJECT VIEWPORT PLOT)
	      else [replace XCOORD of LABELPOSITION with (PLUS (fetch XCOORD
									    of LABELPOSITION)
									 (TIMES
									   2
									   (STREAMTOWORLDXLENGTH
									     (BITMAPWIDTH SYMBOL)
									     VIEWPORT]
		     (SETQ TEXTOBJECT (CREATETEXT LABELPOSITION LABEL NIL SMALLPLOTFONT))
		     (DRAWPLOTOBJECT TEXTOBJECT VIEWPORT PLOT) 
                                                             (* CACHE LABEL ON PROP LIST OF OBJECT)
		     (PLOTOBJECTPROP POINT (QUOTE LABEL)
				       TEXTOBJECT])

(LABELTEXT
  [LAMBDA (TEXTOBJECT PLOT)                                  (* jop: "20-Feb-86 17:56")
    (PLOTPROMPT "Cannot label text" PLOT])

(LOWLIGHTCOMPOUND
  [LAMBDA (COMPOUNDOBJECT VIEWPORT PLOT)                     (* edited: "27-Mar-86 21:27")
    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of (fetch (PLOTOBJECT OBJECTDATA)
								  of COMPOUNDOBJECT))
       do (LOWLIGHTPLOTOBJECT OBJECT PLOT])

(MOVECOMPOUND
  [LAMBDA (COMPOUNDOBJECT DX DY PLOT)                        (* edited: "27-Mar-86 21:27")
    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of (fetch OBJECTDATA of 
										   COMPOUNDOBJECT))
       do (MOVEPLOTOBJECT OBJECT DX DY PLOT])

(MOVECURVE
  [LAMBDA (CURVEOBJECT DX DY PLOT)                           (* jop: " 8-Dec-85 18:35")
    (PROG [(POINTS (fetch (CURVEDATA CURVEPOINTS) of (fetch OBJECTDATA of CURVEOBJECT]
	    (for POINT in POINTS
	       do (replace XCOORD of POINT with (PLUS DX (fetch XCOORD of POINT)))
		    (replace YCOORD of POINT with (PLUS DY (fetch YCOORD of POINT])

(MOVEFILLEDRECTANGLE
  [LAMBDA (FILLEDRECTANGLEOBJECT DX DY PLOT)                 (* edited: "18-May-85 16:32")
    (PROG ((OBJECTDATA (fetch OBJECTDATA of FILLEDRECTANGLEOBJECT)))
	    (replace OBJECTLEFT of OBJECTDATA with (PLUS DX (fetch OBJECTLEFT of 
										       OBJECTDATA)))
	    (replace OBJECTBOTTOM of OBJECTDATA with (PLUS DY (fetch OBJECTBOTTOM
									 of OBJECTDATA])

(MOVELINE
  [LAMBDA (LINEOBJECT DX DY PLOT)                            (* edited: "18-May-85 16:58")
    (PROG ((OBJECTDATA (fetch OBJECTDATA of LINEOBJECT)))
	    (replace CONSTANT of OBJECTDATA
	       with (if (fetch INFINITESLOPE? of OBJECTDATA)
			  then (PLUS DX (fetch CONSTANT of OBJECTDATA))
			else (DIFFERENCE (PLUS (fetch CONSTANT of OBJECTDATA)
						     (TIMES DX (fetch SLOPE of OBJECTDATA)))
					     DY])

(MOVEPOINT
  [LAMBDA (POINT DX DY PLOT)                                 (* jop: "24-Feb-86 14:43")
    (PROG [(POSITION (fetch (POINTDATA POINTPOSITION) of (fetch (PLOTOBJECT OBJECTDATA)
								    of POINT]
	    (replace XCOORD of POSITION with (PLUS DX (fetch XCOORD of POSITION)))
	    (replace YCOORD of POSITION with (PLUS DY (fetch YCOORD of POSITION])

(MOVEPOLYGON
  [LAMBDA (POLYGONOBJECT DX DY PLOT)                         (* edited: "18-May-85 16:16")
    (PROG [(POINTS (fetch POLYGONPOINTS of (fetch OBJECTDATA of POLYGONOBJECT]
	    (for POINT in POINTS
	       do (replace XCOORD of POINT with (PLUS DX (fetch XCOORD of POINT)))
		    (replace YCOORD of POINT with (PLUS DY (fetch YCOORD of POINT])

(MOVETEXT
  [LAMBDA (TEXTOBJECT DX DY PLOT)                            (* edited: "18-May-85 17:05")
    (PROG [(POSITION (fetch TEXTPOSITION of (fetch OBJECTDATA of TEXTOBJECT]
	    (replace XCOORD of POSITION with (PLUS DX (fetch XCOORD of POSITION)))
	    (replace YCOORD of POSITION with (PLUS DY (fetch YCOORD of POSITION])

(PLOTCOMPOUND
  [LAMBDA ARGS                                               (* edited: "27-Mar-86 21:22")

          (* * ADD A COMPOUND OBJECT with an unknown number of COMPONENTS. First arg must be a PLOT. Second arg must be the 
	  compound object type. Next are the Nospread COMPONENTS, then the optional LABEL, MENU, and NODRAWFLG)


    (if (LESSP ARGS 3)
	then (HELP "Must have at least 3 args. Plot, compound type, and one component"))
    (PROG ((PLOT (ARG ARGS 1))
	     (COMPOUNDTYPE (ARG ARGS 2))
	     COMPONENTS STARTRESTARGS)
	    (if (NOT (type? PLOT PLOT))
		then (HELP "NOT a PLOT " PLOT))
	    (SETQ COMPONENTS (for I from 3 to ARGS while (type? PLOTOBJECT
									    (ARG ARGS I))
				  collect (ARG ARGS I)))
	    (SETQ STARTRESTARGS (PLUS 3 (LENGTH COMPONENTS)))
	    (RETURN (ADDPLOTOBJECT [CREATECOMPOUND COMPOUNDTYPE COMPONENTS
							 (if (GEQ ARGS STARTRESTARGS)
							     then (ARG ARGS STARTRESTARGS))
							 (if (GEQ ARGS (PLUS 1 STARTRESTARGS))
							     then (ARG ARGS (PLUS 1 
										    STARTRESTARGS]
				       PLOT
				       (if (GEQ ARGS (PLUS 2 STARTRESTARGS))
					   then (ARG ARGS (PLUS 2 STARTRESTARGS])

(PLOTCURVE
  [LAMBDA (PLOT POSITIONS LABEL STYLE MENU NODRAWFLG)        (* edited: "27-Mar-86 21:22")

          (* * User Entry Point. Draw a piecewise linear curve in a Plotting WINDOW. Style is either the line width to use or
	  a list (width dashing color) or an instance of PLOT.STYLE. POSITIONS is a list of positions to be contected.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (ADDPLOTOBJECT (CREATECURVE POSITIONS LABEL STYLE MENU)
		     PLOT NODRAWFLG])

(PLOTFILLEDRECTANGLE
  [LAMBDA (PLOT LEFT BOTTOM WIDTH HEIGHT LABEL TEXTURE BORDERWIDTH MENU NODRAWFLG)
                                                             (* edited: "27-Mar-86 21:22")

          (* * User Entry Point. Draw a FILLEDRECTANGLE in a Plotting WINDOW. Style is the line width to use.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (if (NULL TEXTURE)
	then (SETQ TEXTURE SHADE3))
    (ADDPLOTOBJECT (CREATEFILLEDRECTANGLE LEFT BOTTOM WIDTH HEIGHT LABEL TEXTURE BORDERWIDTH MENU)
		     PLOT NODRAWFLG])

(PLOTGRAPH
  [LAMBDA (PLOT GRAPHFN NSAMPLES LABEL STYLE MENU NODRAWFLG)
                                                             (* edited: "27-Mar-86 21:22")

          (* * User Entry Point.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (ADDPLOTOBJECT (CREATEGRAPH GRAPHFN NSAMPLES LABEL STYLE MENU)
		     PLOT NODRAWFLG])

(PLOTLINE
  [LAMBDA (PLOT SLOPE CONSTANT LABEL STYLE MENU NODRAWFLG)   (* edited: "27-Mar-86 21:22")

          (* * User Entry Point.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (ADDPLOTOBJECT (CREATELINE SLOPE CONSTANT LABEL STYLE MENU)
		     PLOT NODRAWFLG])

(PLOTPOINT
  [LAMBDA (PLOT POSITION LABEL SYMBOL MENU NODRAWFLG)        (* edited: "27-Mar-86 21:22")

          (* * User entry point. Add a point to the plotwindow WINDOW, at world position POSITION, with Label LABEL and 
	  plotting symbol SYMBOL)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (ADDPLOTOBJECT (CREATEPOINT POSITION LABEL SYMBOL MENU)
		     PLOT NODRAWFLG])

(PLOTPOINTS
  [LAMBDA (PLOT POSITIONS LABELS SYMBOL MENU NODRAWFLG)      (* jop: "20-Feb-86 17:05")

          (* * User Entry Point. Draw the POINTs at POSITIONS in a Plotting WINDOW. Symbol is a LITATOM which Describes the 
	  glyph to use.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (PROG (EXTENT NEWSCALES OBJECTS)
	    [SETQ EXTENT
	      (bind (MINX ← MAX.FLOAT)
		      (MAXX ← MIN.FLOAT)
		      (MINY ← MAX.FLOAT)
		      (MAXY ← MIN.FLOAT) for PT in POSITIONS
		 do (if (LESSP (fetch XCOORD of PT)
				     MINX)
			  then (SETQ MINX (fetch XCOORD of PT)))
		      (if (GREATERP (fetch XCOORD of PT)
					MAXX)
			  then (SETQ MAXX (fetch XCOORD of PT)))
		      (if (LESSP (fetch YCOORD of PT)
				     MINY)
			  then (SETQ MINY (fetch YCOORD of PT)))
		      (if (GREATERP (fetch YCOORD of PT)
					MAXY)
			  then (SETQ MAXY (fetch YCOORD of PT)))
		 finally (RETURN (create EXTENT
					       MINX ← MINX
					       MAXX ← MAXX
					       MINY ← MINY
					       MAXY ← MAXY]
	    (ADJUSTSCALE? EXTENT PLOT)                     (* Scale up the plot so that each ADDOBJECT need not 
							     rescale)
	    [SETQ OBJECTS (bind (LABEL ← LABELS) for POSITION in POSITIONS
			       collect (PROG1 (CREATEPOINT POSITION (CAR LABEL)
								 SYMBOL MENU)
						  (SETQ LABEL (CDR LABEL]
                                                             (* Do surgury on the display list)
	    (replace (PLOT PLOTOBJECTS) of PLOT with (APPEND OBJECTS (fetch (PLOT 
										      PLOTOBJECTS)
										of PLOT)))
	    (if (NULL NODRAWFLG)
		then (REDRAWPLOTWINDOW PLOT))
	    (RETURN OBJECTS])

(PLOTPOLYGON
  [LAMBDA (PLOT POSITIONS LABEL STYLE MENU NODRAWFLG)        (* edited: "27-Mar-86 21:22")

          (* * User Entry Point. Draw a POLYGON in a Plotting WINDOW. Style is the line width to use.
	  POSITIONS is a list of positions to be contected.)


    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT a PLOT " PLOT))
    (ADDPLOTOBJECT (CREATEPOLYGON POSITIONS LABEL STYLE MENU)
		     PLOT NODRAWFLG])

(PLOTTEXT
  [LAMBDA (PLOT POSITION TEXT LABEL FONT MENU NODRAWFLG)     (* edited: "27-Mar-86 21:22")
    (if (NOT (type? PLOT PLOT))
	then (HELP "NOT A PLOT " PLOT))
    (if (NULL FONT)
	then (SETQ FONT SMALLPLOTFONT))
    (ADDPLOTOBJECT (CREATETEXT POSITION TEXT LABEL FONT MENU)
		     PLOT NODRAWFLG])

(PUTCOMPOUND
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: "27-Aug-85 16:53")

          (* * PUTFN for COMPOUND objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (PRINTOUT STREAM "(" ,)
	    (PRINTOUT STREAM "COMPOUNDTYPE" , .P2 (fetch (COMPOUNDDATA COMPOUNDTYPE) of 
										       OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "COMPONENTS (" ,)               (* THIS ASSUMES APPROPRIATE HPRINT MACROS)
	    (for OBJECT in (fetch (COMPOUNDDATA COMPONENTS) of OBJECTDATA)
	       do (HPRINT OBJECT STREAM T T))
	    (PRINTOUT STREAM "))"])

(PUTCURVE
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: " 8-Dec-85 19:06")

          (* * Putfn for CURVE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     STYLE)
	    (SETQ STYLE (fetch (CURVEDATA STYLE) of OBJECTDATA))
	    (PRINTOUT STREAM "(" , "CURVEPOINTS" , .P2 (fetch (CURVEDATA CURVEPOINTS) of 
										       OBJECTDATA)
		      , "STYLE" , .P2 (LIST (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
					      (fetch (PLOT.STYLE DASHING) of STYLE)
					      (fetch (PLOT.STYLE COLOR) of STYLE))
		      , ")"])

(PUTFILLEDRECTANGLE
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: " 8-Dec-85 19:12")

          (* * PUTFN for FILLEDRECTANGLE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT)))
	    (PRINTOUT STREAM "(" ,)
	    (PRINTOUT STREAM "OBJECTLEFT" , .P2 (fetch (FILLEDRECTANGLEDATA OBJECTLEFT)
						   of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "OBJECTBOTTOM" , .P2 (fetch (FILLEDRECTANGLEDATA OBJECTBOTTOM)
						     of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "OBJECTWIDTH" , .P2 (fetch (FILLEDRECTANGLEDATA OBJECTWIDTH)
						    of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "OBJECTHEIGHT" , .P2 (fetch (FILLEDRECTANGLEDATA OBJECTHEIGHT)
						     of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "BORDERWIDTH" , .P2 (fetch (FILLEDRECTANGLEDATA BORDERWIDTH)
						    of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM "TEXTURE" , .P2 (fetch (FILLEDRECTANGLEDATA TEXTURE) of OBJECTDATA)
		      ,)
	    (PRINTOUT STREAM ")"])

(PUTGENERIC
  [LAMBDA (OBJECT PLOT STREAM)                               (* jop: "27-Aug-85 17:10")
    (HPRINT (fetch OBJECTDATA of OBJECT)
	      STREAM NIL T])

(PUTGRAPH
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: "12-Dec-85 13:19")

          (* * Putfn for CURVE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     STYLE)
	    (SETQ STYLE (fetch (GRAPHDATA STYLE) of OBJECTDATA))
	    (PRINTOUT STREAM "(" , "GRAPHFN" , .P2 (fetch (GRAPHDATA GRAPHFN) of OBJECTDATA)
		      , "NSAMPLES" , .P2 (fetch (GRAPHDATA NSAMPLES) of OBJECTDATA)
		      , "STYLE" , .P2 (LIST (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
					      (fetch (PLOT.STYLE DASHING) of STYLE)
					      (fetch (PLOT.STYLE COLOR) of STYLE))
		      , ")"])

(PUTLINE
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: " 4-Feb-86 10:16")

          (* * Putfn for LINE objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     STYLE)
	    (SETQ STYLE (fetch (LINEDATA STYLE) of OBJECTDATA))
	    (PRINTOUT STREAM "(" , "INFINITESLOPE?" , .P2 (fetch (LINEDATA INFINITESLOPE?)
							     of OBJECTDATA)
		      , "SLOPE" , .P2 (fetch (LINEDATA SLOPE) of OBJECTDATA)
		      , "CONSTANT" , .P2 (fetch (LINEDATA CONSTANT) of OBJECTDATA)
		      , "STYLE" , .P2 (LIST (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
					      (fetch (PLOT.STYLE DASHING) of STYLE)
					      (fetch (PLOT.STYLE COLOR) of STYLE))
		      ")"])

(PUTPOINT
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: "25-Feb-86 15:35")

          (* * Putfn for POINT objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     SYMBOL LAB)
	    (SETQ SYMBOL (fetch (POINTDATA SYMBOL) of OBJECTDATA))
	    (SETQ LAB (if (EQ SYMBOL STAR)
			    then (QUOTE STAR)
			  elseif (EQ SYMBOL CROSS)
			    then (QUOTE CROSS)
			  elseif (EQ SYMBOL CIRCLE)
			    then (QUOTE CIRCLE)))
	    (PRINTOUT STREAM "(" , "POINTPOSITION" , .P2 (fetch (POINTDATA POINTPOSITION)
							    of OBJECTDATA)
		      , "SYMBOL" ,)
	    (if LAB
		then (PRINTOUT STREAM .P2 LAB ,)
	      else (HPRINT SYMBOL STREAM T T))
	    (PRINTOUT STREAM ")"])

(PUTPOLYGON
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: " 4-Feb-86 10:18")

          (* * Putfn for POLYGON objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     STYLE)
	    (SETQ STYLE (fetch (POLYGONDATA STYLE) of OBJECTDATA))
	    (PRINTOUT STREAM "(" , "POLYGONPOINTS" , .P2 (fetch (POLYGONDATA POLYGONPOINTS)
							    of OBJECTDATA)
		      , "STYLE" , .P2 (LIST (fetch (PLOT.STYLE LINEWIDTH) of STYLE)
					      (fetch (PLOT.STYLE DASHING) of STYLE)
					      (fetch (PLOT.STYLE COLOR) of STYLE))
		      , ")"])

(PUTTEXT
  [LAMBDA (PLOTOBJECT PLOT STREAM)                           (* jop: "27-Aug-85 15:40")

          (* * Putfn for TEXT objects)


    (PROG ((OBJECTDATA (fetch (PLOTOBJECT OBJECTDATA) of PLOTOBJECT))
	     FONT)
	    (SETQ FONT (fetch (TEXTDATA FONT) of OBJECTDATA))
	    (PRINTOUT STREAM "(" , "TEXTPOSITION" , .P2 (fetch (TEXTDATA TEXTPOSITION)
							   of OBJECTDATA)
		      , "TEXT" , .P2 (fetch (TEXTDATA TEXT) of OBJECTDATA)
		      , "FONT" ,)                            (* Assumes FONT has an HPRINTMACRO)
	    (HPRINT FONT STREAM T T)
	    (PRINTOUT STREAM ")"])
)
(DECLARE: EVAL@COMPILE 
[PUTPROPS L1METRIC MACRO (OPENLAMBDA (POINT1 POINT2)
				     (* jop: "17-Jan-85 15:27")
				     (* * Computes the L 1 metric between POINT1 and POINT2)
				     (PLUS (IABS (DIFFERENCE (fetch XCOORD of POINT1)
							     (fetch XCOORD of POINT2)))
					   (IABS (DIFFERENCE (fetch YCOORD of POINT1)
							     (fetch YCOORD of POINT2]
[PUTPROPS L2METRIC MACRO (OPENLAMBDA (POINT1 POINT2 PLOT)
				     (* jop: "17-Jan-85 15:27")
				     (* * Computes the L 1 metric between POINT1 and POINT2)
				     (FPLUS (FTIMES (FDIFFERENCE (fetch XCOORD of POINT1)
								 (fetch XCOORD of POINT2))
						    (FDIFFERENCE (fetch XCOORD of POINT1)
								 (fetch XCOORD of POINT2)))
					    (FTIMES (FTIMES (fetch NORMCONSTANT of PLOT)
							    (FDIFFERENCE (fetch YCOORD of POINT1)
									 (fetch YCOORD of POINT2)))
						    (FTIMES (fetch NORMCONSTANT of PLOT)
							    (FDIFFERENCE (fetch YCOORD of POINT1)
									 (fetch YCOORD of POINT2]
)

(RPAQ CIRCLE (READBITMAP))
(5 5
"G@@@"
"HH@@"
"HH@@"
"HH@@"
"G@@@")

(RPAQ CROSS (READBITMAP))
(5 5
"B@@@"
"B@@@"
"OH@@"
"B@@@"
"B@@@")

(RPAQQ DASH (5))

(RPAQQ DOT (1 5))

(RPAQQ DOTDASH (5 5 1 5))

(RPAQQ SHADE1 64)

(RPAQQ SHADE2 576)

(RPAQQ SHADE3 4680)

(RPAQQ SHADE4 37449)

(RPAQQ SHADE5 55899)

(RPAQQ SHADE6 31710)

(RPAQQ SHADE7 64479)

(RPAQQ SHADE8 65023)

(RPAQ STAR (READBITMAP))
(5 5
"JH@@"
"G@@@"
"OH@@"
"G@@@"
"JH@@")
[DECLARE: EVAL@COMPILE 

(DATATYPE COMPOUNDDATA (COMPOUNDTYPE COMPONENTS))

(DATATYPE CURVEDATA (CURVEPOINTS STREAMPOINTS STYLE))

(DATATYPE FILLEDRECTANGLEDATA ((OBJECTLEFT FLOATING)
				 (OBJECTBOTTOM FLOATING)
				 (OBJECTWIDTH FLOATING)
				 (OBJECTHEIGHT FLOATING)
				 STREAMLEFT STREAMBOTTOM STREAMWIDTH STREAMHEIGHT BORDERWIDTH TEXTURE)
				BORDERWIDTH ← 1 [ACCESSFNS ((OBJECTRIGHT
								(PLUS (fetch (FILLEDRECTANGLEDATA
										   OBJECTLEFT)
									   of DATUM)
									(fetch (FILLEDRECTANGLEDATA
										   OBJECTWIDTH)
									   of DATUM)))
							      (OBJECTTOP (PLUS (fetch
										   (
FILLEDRECTANGLEDATA OBJECTBOTTOM) of DATUM)
										 (fetch
										   (
FILLEDRECTANGLEDATA OBJECTHEIGHT) of DATUM)))
							      (STREAMRIGHT
								(PLUS (fetch (FILLEDRECTANGLEDATA
										   STREAMLEFT)
									   of DATUM)
									(fetch (FILLEDRECTANGLEDATA
										   STREAMWIDTH)
									   of DATUM)))
							      (STREAMTOP (PLUS (fetch
										   (
FILLEDRECTANGLEDATA STREAMBOTTOM) of DATUM)
										 (fetch
										   (
FILLEDRECTANGLEDATA STREAMHEIGHT) of DATUM])

(DATATYPE GRAPHDATA (GRAPHFN NSAMPLES STYLE STREAMPOSITIONS))

(DATATYPE LINEDATA (STYLE INFINITESLOPE? (SLOPE FLOATING)
			    (CONSTANT FLOATING)
			    (STREAMSLOPE FLOATING)
			    (STREAMCONSTANT FLOATING)
			    STREAMPT1 STREAMPT2)
		     STYLE ← 1)

(DATATYPE PLOT.STYLE (LINEWIDTH DASHING COLOR)
		       LINEWIDTH ← 1)

(DATATYPE POINTDATA (POINTPOSITION STREAMPOSITION SYMBOL)
		      SYMBOL ← STAR)

(DATATYPE POLYGONDATA (POLYGONPOINTS STREAMPOINTS STYLE)
			STYLE ← 1)

(DATATYPE TEXTDATA (TEXTPOSITION STREAMPOSITION TEXT FONT)
		     FONT ← SMALLPLOTFONT)
]
(/DECLAREDATATYPE (QUOTE COMPOUNDDATA)
		  (QUOTE (POINTER POINTER))
		  (QUOTE ((COMPOUNDDATA 0 POINTER)
			  (COMPOUNDDATA 2 POINTER)))
		  (QUOTE 4))
(/DECLAREDATATYPE (QUOTE CURVEDATA)
		  (QUOTE (POINTER POINTER POINTER))
		  (QUOTE ((CURVEDATA 0 POINTER)
			  (CURVEDATA 2 POINTER)
			  (CURVEDATA 4 POINTER)))
		  (QUOTE 6))
(/DECLAREDATATYPE (QUOTE FILLEDRECTANGLEDATA)
		  (QUOTE (FLOATP FLOATP FLOATP FLOATP POINTER POINTER POINTER POINTER POINTER POINTER)
			 )
		  (QUOTE ((FILLEDRECTANGLEDATA 0 FLOATP)
			  (FILLEDRECTANGLEDATA 2 FLOATP)
			  (FILLEDRECTANGLEDATA 4 FLOATP)
			  (FILLEDRECTANGLEDATA 6 FLOATP)
			  (FILLEDRECTANGLEDATA 8 POINTER)
			  (FILLEDRECTANGLEDATA 10 POINTER)
			  (FILLEDRECTANGLEDATA 12 POINTER)
			  (FILLEDRECTANGLEDATA 14 POINTER)
			  (FILLEDRECTANGLEDATA 16 POINTER)
			  (FILLEDRECTANGLEDATA 18 POINTER)))
		  (QUOTE 20))
(/DECLAREDATATYPE (QUOTE GRAPHDATA)
		  (QUOTE (POINTER POINTER POINTER POINTER))
		  (QUOTE ((GRAPHDATA 0 POINTER)
			  (GRAPHDATA 2 POINTER)
			  (GRAPHDATA 4 POINTER)
			  (GRAPHDATA 6 POINTER)))
		  (QUOTE 8))
(/DECLAREDATATYPE (QUOTE LINEDATA)
		  (QUOTE (POINTER POINTER FLOATP FLOATP FLOATP FLOATP POINTER POINTER))
		  (QUOTE ((LINEDATA 0 POINTER)
			  (LINEDATA 2 POINTER)
			  (LINEDATA 4 FLOATP)
			  (LINEDATA 6 FLOATP)
			  (LINEDATA 8 FLOATP)
			  (LINEDATA 10 FLOATP)
			  (LINEDATA 12 POINTER)
			  (LINEDATA 14 POINTER)))
		  (QUOTE 16))
(/DECLAREDATATYPE (QUOTE PLOT.STYLE)
		  (QUOTE (POINTER POINTER POINTER))
		  (QUOTE ((PLOT.STYLE 0 POINTER)
			  (PLOT.STYLE 2 POINTER)
			  (PLOT.STYLE 4 POINTER)))
		  (QUOTE 6))
(/DECLAREDATATYPE (QUOTE POINTDATA)
		  (QUOTE (POINTER POINTER POINTER))
		  (QUOTE ((POINTDATA 0 POINTER)
			  (POINTDATA 2 POINTER)
			  (POINTDATA 4 POINTER)))
		  (QUOTE 6))
(/DECLAREDATATYPE (QUOTE POLYGONDATA)
		  (QUOTE (POINTER POINTER POINTER))
		  (QUOTE ((POLYGONDATA 0 POINTER)
			  (POLYGONDATA 2 POINTER)
			  (POLYGONDATA 4 POINTER)))
		  (QUOTE 6))
(/DECLAREDATATYPE (QUOTE TEXTDATA)
		  (QUOTE (POINTER POINTER POINTER POINTER))
		  (QUOTE ((TEXTDATA 0 POINTER)
			  (TEXTDATA 2 POINTER)
			  (TEXTDATA 4 POINTER)
			  (TEXTDATA 6 POINTER)))
		  (QUOTE 8))

(PUTPROPS PLOTCOMPOUND ARGNAMES (NIL (PLOT COMPOUNDTYPE COMPONENT1 ... LABEL MENU NODRAWFLG) . 
				       COMPOUNDARGS))
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY 
(DECLARE: DOEVAL@COMPILE DONTCOPY

(LOCALVARS . T)
)
)
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA )

(ADDTOVAR NLAML )

(ADDTOVAR LAMA PLOTCOMPOUND)
)
(PUTPROPS PLOTOBJECTS COPYRIGHT ("Xerox Corporation" 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (2643 75054 (COPYCOMPOUND 2653 . 3181) (COPYCURVE 3183 . 3627) (COPYFILLEDRECTANGLE 3629
 . 4466) (COPYGENERIC 4468 . 4674) (COPYGRAPHOBJECT 4676 . 5134) (COPYLINE 5136 . 5679) (COPYPOINT 
5681 . 6120) (COPYPOLYGON 6122 . 6582) (COPYTEXT 6584 . 7081) (CREATECOMPOUND 7083 . 7543) (
CREATECURVE 7545 . 8200) (CREATEFILLEDRECTANGLE 8202 . 8824) (CREATEGRAPH 8826 . 9513) (CREATELINE 
9515 . 10239) (CREATEPOINT 10241 . 10620) (CREATEPOLYGON 10622 . 11289) (CREATETEXT 11291 . 11618) (
DISTANCETOCOMPOUND 11620 . 12228) (DISTANCETOCURVE 12230 . 12538) (DISTANCETOFILLEDRECTANGLE 12540 . 
15288) (DISTANCETOGRAPH 15290 . 15600) (DISTANCETOLINE 15602 . 16824) (DISTANCETOPOINT 16826 . 17061) 
(DISTANCETOPOLYGON 17063 . 17377) (DISTANCETOTEXT 17379 . 17614) (DRAWCOMPOUNDOBJECT 17616 . 17931) (
DRAWCURVEOBJECT 17933 . 19460) (DRAWFILLEDRECTANGLEOBJECT 19462 . 22182) (DRAWGRAPHOBJECT 22184 . 
24451) (DRAWLINEOBJECT 24453 . 27538) (DRAWPOINTOBJECT 27540 . 28410) (DRAWPOLYGONOBJECT 28412 . 30104
) (DRAWTEXTOBJECT 30106 . 31355) (ERASECOMPOUNDOBJECT 31357 . 31665) (ERASECURVEOBJECT 31667 . 32773) 
(ERASEFILLEDRECTANGLEOBJECT 32775 . 34531) (ERASEGRAPHOBJECT 34533 . 35603) (ERASELINEOBJECT 35605 . 
36417) (ERASEPOINTOBJECT 36419 . 37038) (ERASEPOLYGONOBJECT 37040 . 38310) (ERASETEXTOBJECT 38312 . 
39423) (EXTENTOFCOMPOUND 39425 . 40583) (EXTENTOFCURVE 40585 . 41500) (EXTENTOFFILLEDRECTANGLE 41502
 . 42142) (EXTENTOFGRAPH 42144 . 42398) (EXTENTOFLINE 42400 . 42630) (EXTENTOFPOINT 42632 . 43071) (
EXTENTOFPOLYGON 43073 . 43986) (EXTENTOFTEXT 43988 . 44418) (GETCOMPOUND 44420 . 44739) (GETCURVE 
44741 . 45202) (GETFILLEDRECTANGLE 45204 . 45802) (GETGENERIC 45804 . 45922) (GETGRAPH 45924 . 46410) 
(GETLINE 46412 . 46984) (GETPOINT 46986 . 47408) (GETPOLYGON 47410 . 47881) (GETTEXT 47883 . 48230) (
HIGHLIGHTCOMPOUND 48232 . 48542) (HIGHLIGHTCURVE 48544 . 49663) (HIGHLIGHTFILLEDRECTANGLE 49665 . 
51340) (HIGHLIGHTGRAPH 51342 . 52411) (HIGHLIGHTLINE 52413 . 53224) (HIGHLIGHTPOINT 53226 . 54193) (
HIGHLIGHTPOLYGON 54195 . 55465) (HIGHLIGHTTEXT 55467 . 56633) (LABELGENERIC 56635 . 57563) (LABELPOINT
 57565 . 58978) (LABELTEXT 58980 . 59133) (LOWLIGHTCOMPOUND 59135 . 59443) (MOVECOMPOUND 59445 . 59742
) (MOVECURVE 59744 . 60189) (MOVEFILLEDRECTANGLE 60191 . 60646) (MOVELINE 60648 . 61163) (MOVEPOINT 
61165 . 61604) (MOVEPOLYGON 61606 . 62048) (MOVETEXT 62050 . 62458) (PLOTCOMPOUND 62460 . 63804) (
PLOTCURVE 63806 . 64342) (PLOTFILLEDRECTANGLE 64344 . 64948) (PLOTGRAPH 64950 . 65345) (PLOTLINE 65347
 . 65677) (PLOTPOINT 65679 . 66124) (PLOTPOINTS 66126 . 68058) (PLOTPOLYGON 68060 . 68517) (PLOTTEXT 
68519 . 68875) (PUTCOMPOUND 68877 . 69538) (PUTCURVE 69540 . 70188) (PUTFILLEDRECTANGLE 70190 . 71249)
 (PUTGENERIC 71251 . 71433) (PUTGRAPH 71435 . 72135) (PUTLINE 72137 . 72927) (PUTPOINT 72929 . 73753) 
(PUTPOLYGON 73755 . 74408) (PUTTEXT 74410 . 75052)))))
STOP