Listing: 1 (******************************************************************************) 2 (* POLYGONS.MOD *) 3 (* *) 4 (* MetaWINDOW HOWTO: program series. Demonstrates usage of polygons. *) 5 (* Transcribed from POLYGONS.C METAGRAPHICS SOFTWARE CORPORATION (c) 1987-1989*) 6 (* *) 7 (* PSW 10/31/90 02:44am *) 8 (******************************************************************************) 9 10 MODULE Polygons; 11 (* 12 * Graphix 13 * Release 3.7 14 * (c) Copyright 1986-1992 PMI 15 * Green Bay, Wisconsin 16 * (414) 468-6040 17 * All rights reserved 18 * 19 *) 20 21 IMPORT GrConst; 22 IMPORT GrPorts; 23 IMPORT Meta; 24 IMPORT GrQry; 25 IMPORT IO; 26 27 FROM GrConst IMPORT rect, point, polyHead; ***** ^ duplicate identifier 28 29 CONST 30 NUMPTS = 11; (* how many points in polygon points array *) 31 32 VAR 33 GrafixCard, 34 CommPort: INTEGER; 35 scrnR: rect; 36 i: INTEGER; 37 c: CHAR; 38 39 PROCEDURE DrawPoly(); 40 VAR 41 x, y, z: INTEGER; 42 p_pts: ARRAY[0..NUMPTS-1] OF point; (* The polygon point series *) ***** ^ not supported yet ***** ^ not supported yet 43 p_hdr: ARRAY[0..1] OF polyHead; (* the polygon header array *) ***** ^ not supported yet ***** ^ not supported yet 44 BEGIN 45 x := scrnR.Xmax DIV 15; (* obtain some scaling factors *) ***** ^ not supported yet ***** ^ not supported yet 46 y := scrnR.Ymax DIV 12; ***** ^ not supported yet ***** ^ not supported yet 47 48 (* set up the first polygon header array - 8 points *) 49 p_hdr[0].polyBgn := 0; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 p_hdr[0].polyEnd := 7; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 p_hdr[0].polyRect := scrnR; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 53 (* set up the second polygon header array - 3 points *) 54 p_hdr[1].polyBgn := 8; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 55 p_hdr[1].polyEnd := 10; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 56 p_hdr[1].polyRect := scrnR; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 57 58 (* set up the polygon point series *) 59 z := 0; 60 61 p_pts[z].X := x*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 p_pts[z].Y := y*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 63 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 64 65 p_pts[z].X := x*6; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 66 p_pts[z].Y := y*5; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 67 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 68 69 p_pts[z].X := x*12; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 70 p_pts[z].Y := y*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 71 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 72 73 p_pts[z].X := x*7; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 74 p_pts[z].Y := y*8; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 75 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 76 77 p_pts[z].X := x*12; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 78 p_pts[z].Y := y*10; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 79 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 80 81 p_pts[z].X := x*8; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 p_pts[z].Y := y*7; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 83 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 84 85 p_pts[z].X := x*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 86 p_pts[z].Y := y*9; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 87 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 88 89 p_pts[z].X := x*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 90 p_pts[z].Y := y*2; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 91 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 92 93 p_pts[z].X := x*15; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 94 p_pts[z].Y := y*12; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 95 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 96 97 p_pts[z].X := x*13; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 98 p_pts[z].Y := y*12; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 99 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 100 101 p_pts[z].X := x*14; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 102 p_pts[z].Y := y*10; ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 103 INC(z); ***** ^ undeclared identifier ***** ^ not supported yet 104 105 Meta.PaintPoly(2, ADR(p_hdr), ADR(p_pts)); (* draw two polygons with one call *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 106 c := IO.RdChar(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 107 108 Meta.ErasePoly(2,ADR(p_hdr),ADR(p_pts)); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet 109 c := IO.RdChar(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 110 111 Meta.FillPoly(2,ADR(p_hdr),ADR(p_pts),3); ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 112 c := IO.RdChar(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 113 END DrawPoly; ***** ^ not supported yet 114 115 116 BEGIN 117 (* init the system *) 118 119 GrQry.GrQuery(GrafixCard, CommPort); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 120 121 i := Meta.InitGrafix(-GrafixCard); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 122 123 IF (i # 0) THEN 124 (* Display reason for no go *) 125 GrQry.GrInitErr(GrafixCard, CommPort, i); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 126 END; 127 128 Meta.SetDisplay(GrConst.GrafPg0); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 129 Meta.ScreenRect(scrnR); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 130 Meta.EraseRect(scrnR); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 131 DrawPoly(); ***** ^ not supported yet ***** ^ not supported yet 132 133 GrQry.GrQuit('', 0) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 134 END Polygons. 170 errors