POLYGONS.LST 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. Listing:
  2. 1 (******************************************************************************)
  3. 2 (* POLYGONS.MOD *)
  4. 3 (* *)
  5. 4 (* MetaWINDOW HOWTO: program series. Demonstrates usage of polygons. *)
  6. 5 (* Transcribed from POLYGONS.C METAGRAPHICS SOFTWARE CORPORATION (c) 1987-1989*)
  7. 6 (* *)
  8. 7 (* PSW 10/31/90 02:44am *)
  9. 8 (******************************************************************************)
  10. 9
  11. 10 MODULE Polygons;
  12. 11 (*
  13. 12 * Graphix
  14. 13 * Release 3.7
  15. 14 * (c) Copyright 1986-1992 PMI
  16. 15 * Green Bay, Wisconsin
  17. 16 * (414) 468-6040
  18. 17 * All rights reserved
  19. 18 *
  20. 19 *)
  21. 20
  22. 21 IMPORT GrConst;
  23. 22 IMPORT GrPorts;
  24. 23 IMPORT Meta;
  25. 24 IMPORT GrQry;
  26. 25 IMPORT IO;
  27. 26
  28. 27 FROM GrConst IMPORT rect, point, polyHead;
  29. ***** ^ duplicate identifier
  30. 28
  31. 29 CONST
  32. 30 NUMPTS = 11; (* how many points in polygon points array *)
  33. 31
  34. 32 VAR
  35. 33 GrafixCard,
  36. 34 CommPort: INTEGER;
  37. 35 scrnR: rect;
  38. 36 i: INTEGER;
  39. 37 c: CHAR;
  40. 38
  41. 39 PROCEDURE DrawPoly();
  42. 40 VAR
  43. 41 x, y, z: INTEGER;
  44. 42 p_pts: ARRAY[0..NUMPTS-1] OF point; (* The polygon point series *)
  45. ***** ^ not supported yet
  46. ***** ^ not supported yet
  47. 43 p_hdr: ARRAY[0..1] OF polyHead; (* the polygon header array *)
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. 44 BEGIN
  51. 45 x := scrnR.Xmax DIV 15; (* obtain some scaling factors *)
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 46 y := scrnR.Ymax DIV 12;
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. 47
  58. 48 (* set up the first polygon header array - 8 points *)
  59. 49 p_hdr[0].polyBgn := 0;
  60. ***** ^ not supported yet
  61. ***** ^ not supported yet
  62. ***** ^ not supported yet
  63. 50 p_hdr[0].polyEnd := 7;
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. 51 p_hdr[0].polyRect := scrnR;
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. 52
  73. 53 (* set up the second polygon header array - 3 points *)
  74. 54 p_hdr[1].polyBgn := 8;
  75. ***** ^ not supported yet
  76. ***** ^ not supported yet
  77. ***** ^ not supported yet
  78. 55 p_hdr[1].polyEnd := 10;
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. ***** ^ not supported yet
  82. 56 p_hdr[1].polyRect := scrnR;
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. 57
  88. 58 (* set up the polygon point series *)
  89. 59 z := 0;
  90. 60
  91. 61 p_pts[z].X := x*2;
  92. ***** ^ not supported yet
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 62 p_pts[z].Y := y*2;
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. 63 INC(z);
  100. ***** ^ undeclared identifier
  101. ***** ^ not supported yet
  102. 64
  103. 65 p_pts[z].X := x*6;
  104. ***** ^ not supported yet
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. 66 p_pts[z].Y := y*5;
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. 67 INC(z);
  112. ***** ^ undeclared identifier
  113. ***** ^ not supported yet
  114. 68
  115. 69 p_pts[z].X := x*12;
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. 70 p_pts[z].Y := y*2;
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. 71 INC(z);
  124. ***** ^ undeclared identifier
  125. ***** ^ not supported yet
  126. 72
  127. 73 p_pts[z].X := x*7;
  128. ***** ^ not supported yet
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. 74 p_pts[z].Y := y*8;
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. 75 INC(z);
  136. ***** ^ undeclared identifier
  137. ***** ^ not supported yet
  138. 76
  139. 77 p_pts[z].X := x*12;
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. ***** ^ not supported yet
  143. 78 p_pts[z].Y := y*10;
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. 79 INC(z);
  148. ***** ^ undeclared identifier
  149. ***** ^ not supported yet
  150. 80
  151. 81 p_pts[z].X := x*8;
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. 82 p_pts[z].Y := y*7;
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. 83 INC(z);
  160. ***** ^ undeclared identifier
  161. ***** ^ not supported yet
  162. 84
  163. 85 p_pts[z].X := x*2;
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 86 p_pts[z].Y := y*9;
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. 87 INC(z);
  172. ***** ^ undeclared identifier
  173. ***** ^ not supported yet
  174. 88
  175. 89 p_pts[z].X := x*2;
  176. ***** ^ not supported yet
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 90 p_pts[z].Y := y*2;
  180. ***** ^ not supported yet
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. 91 INC(z);
  184. ***** ^ undeclared identifier
  185. ***** ^ not supported yet
  186. 92
  187. 93 p_pts[z].X := x*15;
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. 94 p_pts[z].Y := y*12;
  192. ***** ^ not supported yet
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. 95 INC(z);
  196. ***** ^ undeclared identifier
  197. ***** ^ not supported yet
  198. 96
  199. 97 p_pts[z].X := x*13;
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. 98 p_pts[z].Y := y*12;
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. ***** ^ not supported yet
  207. 99 INC(z);
  208. ***** ^ undeclared identifier
  209. ***** ^ not supported yet
  210. 100
  211. 101 p_pts[z].X := x*14;
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. ***** ^ not supported yet
  215. 102 p_pts[z].Y := y*10;
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. 103 INC(z);
  220. ***** ^ undeclared identifier
  221. ***** ^ not supported yet
  222. 104
  223. 105 Meta.PaintPoly(2, ADR(p_hdr), ADR(p_pts)); (* draw two polygons with one call *)
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ undeclared identifier
  227. ***** ^ not supported yet
  228. ***** ^ undeclared identifier
  229. ***** ^ not supported yet
  230. 106 c := IO.RdChar();
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. 107
  235. 108 Meta.ErasePoly(2,ADR(p_hdr),ADR(p_pts));
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. ***** ^ undeclared identifier
  239. ***** ^ not supported yet
  240. ***** ^ undeclared identifier
  241. ***** ^ not supported yet
  242. 109 c := IO.RdChar();
  243. ***** ^ not supported yet
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. 110
  247. 111 Meta.FillPoly(2,ADR(p_hdr),ADR(p_pts),3);
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ undeclared identifier
  251. ***** ^ not supported yet
  252. ***** ^ undeclared identifier
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. 112 c := IO.RdChar();
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. 113 END DrawPoly;
  260. ***** ^ not supported yet
  261. 114
  262. 115
  263. 116 BEGIN
  264. 117 (* init the system *)
  265. 118
  266. 119 GrQry.GrQuery(GrafixCard, CommPort);
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. ***** ^ not supported yet
  270. 120
  271. 121 i := Meta.InitGrafix(-GrafixCard);
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. 122
  276. 123 IF (i # 0) THEN
  277. 124 (* Display reason for no go *)
  278. 125 GrQry.GrInitErr(GrafixCard, CommPort, i);
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. ***** ^ not supported yet
  282. 126 END;
  283. 127
  284. 128 Meta.SetDisplay(GrConst.GrafPg0);
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. ***** ^ not supported yet
  289. 129 Meta.ScreenRect(scrnR);
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. 130 Meta.EraseRect(scrnR);
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. 131 DrawPoly();
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. 132
  301. 133 GrQry.GrQuit('', 0)
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. 134 END Polygons.
  306. 170 errors