F¤€‚|ƒē„S†¾‡)‰•ŠŒmŲŽCÆ‘“‰”õ•d—NNNNNNNNNNNNNNNNNNN”””žÉ=NNNNNNNNNNNNNNNNNNNNNNž”””ū€DGLPRG!„y žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĒNNNNNNNNNNNNNNNNNNNNNN”””ūction returns one of the one hundred values in the structured }  { constant "Voltages" every time it is called. This function is called by }  { the "Progressive Example" programs in the graphics techniques chapters. }  {-------------------------äמNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žc›NNNNNNNNNNNNNNNNNNNNNN”””ūZ  \N^¦ÄØõPRINTER: <¼¦žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žś NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŒPNNNNNNNNNNNNNNNNNNNNNN”””ū---------------------------------------------------}  type "VoltsType= array [1..100] of real;  const "Voltages= VoltsType[0.1610, 0.1625, 0.1625, 0.1628, 0.1636, :0.1631, 0.1627, 0.1608, 0.1610, 0.1606, :0.1607, 0.1617, 0.1614, 0.1626, 0.1634ŖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žPŖNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÆ_NNNNNNNNNNNNNNNNNNNNNNž”””ūDataPointTź> „5€SinLineT__ź> „7€SinWindowTź> „9€SinAspectTź>* „A€SinViewptTź>6 „C€SinLabel1Tź>B„E€SinLabel2Tź>R„G€SinLabel3Tź>b„P€ģžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž æaNNNNNNNNNNNNNNNNNNNNNN”””ū, :0.1640, 0.1656, 0.1660, 0.1644, 0.1651, :0.1635, 0.1641, 0.1628, 0.1619, 0.1630, :0.1624, 0.1627, 0.1644, 0.1644, 0.1657, :0.1660, 0.1670, 0.1672, 0.1666, 0.1658, :0.1662, 0.1646, 0.1633, 0.1634, 0.1636, :0.1645, 0.1652, 0.1656, 0.1677, 0.1689, 9±žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@”NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žœnNNNNNNNNNNNNNNNNNNNNNN”””ūSinAxes1T_ź>v0„S€SinClipT__ź>¦<„W€SinAxes2T_ź>āD„€ConvVtoWT_ź>&„€ConvWtoVT_ź>6„€CharCellT_ź>F„€CsizeProgTź>V„€LdirProgT_ź>j„€JžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žź2NNNNNNNNNNNNNNNNNNNNNN”””ū:0.1680, 0.1696, 0.1680, 0.1674, 0.1677, :0.1669, 0.1655, 0.1665, 0.1662, 0.1667, :0.1668, 0.1681, 0.1688, 0.1687, 0.1707, :0.1716, 0.1716, 0.1694, 0.1698, 0.1683, :0.1683, 0.1671, 0.1681, 0.1683, 0.1684, :0.1681, 0.1698, 0.1705, 0.1723, 0.1730, :0.Ū–žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž s„NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žłNNNNNNNNNNNNNNNNNNNNNN”””ūJustProgT_ź>~8„$€DrawMdPrgTź>¶,„0€IsoProgT__ź>āH„6€AxesGridT_ź>*L„C€LogPlotT__ź>v„H€GstorProgTź>Š€„W€PLineProgTź> „ €PolyProgT_ź>„ €~ķžö’¹NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŁNNNNNNNNNNNNNNNNNNNNNN”””ū1734, 0.1714, 0.1722, 0.1716, 0.1696, :0.1702, 0.1699, 0.1684, 0.1706, 0.1696, :0.1715, 0.1730, 0.1737, 0.1739, 0.1751, :0.1732, 0.1747, 0.1729, 0.1717, 0.1710, :0.1707, 0.1706, 0.1709, 0.1713, 0.1720];  begin {body of)žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž &öNNNNNNNNNNNNNNNNNNNNNNž”””ū $page$ {********************************************************************}  function DataPoint(I: integer): real; {function that returns the y-values}  {----------------------------------------------------------------------------}  { This fun½\žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6ČNNNNNNNNNNNNNNNNNNNNNN”””ūFillProgT_ź>"„ €FillGraphTź>6 „ €MarkrProgTź>B „ &€BAR_KNOBA_N„ 3€BAR_KNOB2Am0„ @€LOCATORA__%„ G€COLORA____ĀW„ V€COLORC____†™"€O©ž ļöNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žé^NNNNNNNNNNNNNNNNNNNNNN”””ūē.[’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’ŠwžüŸīNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN؀‚ƒź„U†Į‡,‰—ŠŒoŪŽG³‘“Š”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž6 NNNNNNNNNNNNNNNNNNNNNN”””ū}  begin {body of program "SinLine"}  graphics_init; {initialize graphics system}  display_init(CrtAddr,Control,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin öŃžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žźŚNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žœ†NNNNNNNNNNNNNNNNNNNNNN”””ūZ ¶N^¦ÄØu“šžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNN”””ū {output device initialization OK?} "for X:=1 to 100 do begin {100 points total} " Y:=DataPoint(X); {get a point from the function}  if X=1 then move(X/100,Y) {move to the first point...} €lžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žsMNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÆ·NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž PBNNNNNNNNNNNNNNNNNNNNNN”””ū$else line(X/100,Y); {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {program "SinLine"} Ć·žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@|NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žæ‰NNNNNNNNNNNNNNNNNNNNNN”””ūf function "DataPoint"}  DataPoint:=Voltages[I]; {assign it to the function name}  end; {function "DataPoint"} {return}  ą3žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž csNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/NNNNNNNNNNNNNNNNNNNNNN”””ū program SinLine(output);  import dgl_lib; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "Control= 0; {device control; 0 for CRT}  var "ErrorReturn: ÷¢žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŒøNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž śäNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&NNNNNNNNNNNNNNNNNNNNNN”””ū integer; {variable for initialization outcome}  X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {********************************************************************ŲžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŁėNNNNNNNNNNNNNNNNNNNNNNž”””ūZ 1 2 3 0 4 5 6 7 8 ½]x§-ŗė ?‘ \N^¦ÄØõPRINTER: <„EžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ÉÕNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŸźNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚ƒė„W†Ć‡.‰šŠŒrŽŽIµ‘!“”ł•e—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž$UNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ųÆNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŽóNNNNNNNNNNNNNNNNNNNNNNž”””ū if X=1 then move(X,Y) {move to the first point...} $else line(X,Y) {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics u,žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ždNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž a8NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž½ĀNNNNNNNNNNNNNNNNNNNNNN”””ūpackage}  end. {program "SinWindow"} ŽõžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB7NNNNNNNNNNNNNNNNNNNNNN”””ū program SinWindow(output);  import dgl_lib; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  var "ErrorReturn~žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž R NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž­üNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žqNNNNNNNNNNNNNNNNNNNNNN”””ū: integer; {variable for initialization outcome}  X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  {**************************************************************************:™žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žZNNNNNNNNNNNNNNNNNNNNNN”””ū program SinAspect(output);  import dgl_lib; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  var "ErrorReturn²¤žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž žĶNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žč‘NNNNNNNNNNNNNNNNNNNNNN”””ū**}  begin {body of program "SinWindow"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin å’žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4kNNNNNNNNNNNNNNNNNNNNNN”””ū: integer; {variable for initialization outcome}  X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {****************************************************************** žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĖžNNNNNNNNNNNNNNNNNNNNNNž”””ūZ æ \N^¦ÄØõPRINTER: <@†žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŪ NNNNNNNNNNNNNNNNNNNNNN”””ū {output device initialization OK?} "set_window(0,100,0.16,0.18); {scale the window for the data} "for X:=1 to 100 do begin {100 points total} " Y:=DataPoint(X); {get a point from the function} šAžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žØ€‚€ƒģ„X†Ć‡.‰šŠŒqŻŽI“‘ “Œ”ų•d—NNNNNNNNNNNNNNNNNNNNNNNNN”””žŪHNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž²NNNNNNNNNNNNNNNNNNNNNNž”””ūn=0?}  graphics_term; {terminate the graphics package}  end. {program "SinAspect"} ģ$žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žqīNNNNNNNNNNNNNNNNNNNNNNž”””ū"set_window(0,100,0.16,0.18); {scale the window for the data} "for X:=1 to 100 do begin {100 points total} " Y:=DataPoint(X); {get a point from the function}  if X=1 then move(X,Y) {move to thÉžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž čyNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žž%NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBßNNNNNNNNNNNNNNNNNNNNNN”””ūe first point...} $else line(X,Y) {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {pžzžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ½*NNNNNNNNNNNNNNNNNNNNNN”””ū program SinViewpt(output);  import dgl_lib; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  var "ErrorReturn€žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž­NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žRįNNNNNNNNNNNNNNNNNNNNNN”””ū**}  begin {body of program "SinAspect"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin ƒzžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŽNNNNNNNNNNNNNNNNNNNNNN”””ū: integer; {variable for initialization outcome}  X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {****************************************************************** žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žųGNNNNNNNNNNNNNNNNNNNNNNž”””ūZ Ą \N^¦ÄØõPRINTER: <BŒžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žaŠNNNNNNNNNNNNNNNNNNNNNN”””ū {output device initialization OK?} "set_aspect(511,389); {use the whole screen} "set_window(0,100,0.16,0.18); {scale the window for the data} "for X:=1 to 100 do begin {100 points total} ŸäžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŒNNNNNNNNNNNNNNNNNNNNNNž”””ū**}  begin {body of program "SinViewpt"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin æ"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĖvNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4ƒNNNNNNNNNNNNNNNNNNNNNNž”””ū" Y:=DataPoint(X); {get a point from the function}  if X=1 then move(X,Y) {move to the first point...} $else line(X,Y) {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorRetur›²žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž $½NNNNNNNNNNNNNNNNNNNNNN”””ū {output device initialization OK?} "set_aspect(511,389); {use the whole screen} "set_viewport(0.10,0.99,0.12,0.70); {define subset of screen} "move(-1,-1); line(1,-1); line(1,1); line(-1,1); line(-1,-1); {frame} C,žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žr‚NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚€ƒė„W†Ā‡.‰šŠŒpÜŽG³‘“‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNN”””žĢNNNNNNNNNNNNNNNNNNNNNN”””ūrogram "SinViewpt"} cžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ß6NNNNNNNNNNNNNNNNNNNNNNž”””ūs title} "for Character:=1 to strlen(Strng) do {follow every character...} $gtext(str(Strng,Character,1)+chr(13)+chr(10)); {...with a CR/LF} "move(-0.3,-0.9); {starting point for the x-axis label} "gtext('Time (seconds)'); 6ÓžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©jNNNNNNNNNNNNNNNNNNNNNN”””ūprogram SinLabel1(output); import dgl_lib, dgl_inq; {get graphics routines} const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT} var "ErrorReturn: integęžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0żNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž F”NNNNNNNNNNNNNNNNNNNNNN”””ū {x-axis label} "set_viewport(0.1,0.99,0.12,0.7); {define subset of screen} "move(-1,-1); line(1,-1); line(1,1); line(-1,1); line(-1,-1); {frame} "set_window(0,100,0.16,0.18); {scale the window for the data} "for X:=1 to 100 do×žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žš[NNNNNNNNNNNNNNNNNNNNNN”””ūer; {variable for initialization outcome} "Strng: string[7]; {seven characters in 'Voltage'} "Character: integer; {loop counter for labelling} "X: integer; "Y: real; $include 'D IžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””že®NNNNNNNNNNNNNNNNNNNNNN”””ūZ < \N^§µØõPRINTER: <]ŸžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž uNNNNNNNNNNNNNNNNNNNNNN”””ū begin {100 points total} $Y:=DataPoint(X); {get a point from the function} $if X=1 then move(X,Y) {move to the first point...} $else line(X,Y); {...and draw to all the rest} õMžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŠeNNNNNNNNNNNNNNNNNNNNNN”””ūGLPRG:DataPoint'$ {function: y:=f(x) } $page$ {********************************************************************} begin {body of program "SinLabel1"} graphics_init; {initialize graphąŪžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žVŸNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĆNNNNNNNNNNNNNNNNNNNNNN”””ū"end; {for X:=1 to 100} end; {ErrorReturn=0?} graphics_term; {terminate the graphics package} end. {program "SinLabel1"} ę~žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¹TNNNNNNNNNNNNNNNNNNNNNNž”””ūics system} display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?} if ErrorReturn=0 then begin {output device initialization OK?} "set_aspect(511,389); {use the whole screen} ?ÅžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĻNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žņNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ģNNNNNNNNNNNNNNNNNNNNNN”””ū"move(-0.45,0.9); {starting point for the title} "gtext('VOLTAGE VARIANCE'); {label the plot} "Strng:='Voltage'; {the y-axis label} "move(-0.95,0.3); {starting point for the y-axižNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žü9NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž#ÆNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN.NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚€ƒė„W†Ā‡.‰šŠŒrŽŽJ¶‘"“Ž”ł•d—NNNNNNNNNNNNNNNNNNNNNNNNN”””žüŃNNNNNNNNNNNNNNNNNNNNNNž”””ū {variable for initialization outcome} "X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {********************************************************************}  begin «žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž +NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žVwNNNNNNNNNNNNNNNNNNNNNN”””ū"gtext(Text); {label the text} "set_text_rot(1,0); {horizontal labels} "Text:='Time (seconds)'; {define the text to be labelled} "move(-(strlen(Text)*CharWidth)/2,-0.92); {start point of ceדžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĻąNNNNNNNNNNNNNNNNNNNNNN”””ū {body of program "SinLabel2"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?} ”מĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¹¼NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žeFNNNNNNNNNNNNNNNNNNNNNN”””ūntered label} "gtext(Text); {label the text} "set_viewport(0.1,0.99,0.12,0.7); {define subset of screen} "move(-1,-1); line(-1,1); line(1,1); line(1,-1); line(-1,-1); {frame} "set_window(0,100,0.16,0.18); {scale žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž š³NNNNNNNNNNNNNNNNNNNNNN”””ū if ErrorReturn=0 then begin {output device initialization OK?} "set_aspect(511,389); {use the whole screen} "CharWidth:=2*0.04; {char width: 4% of screen width} "CharHeight:=2*0.08; {chawžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŠNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žuxNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ©‚NNNNNNNNNNNNNNNNNNNNNN”””ūar height: 8% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='VOLTAGE VARIANCE'; {define the text to be labelled} "move(-(strlen(Text)*CharWidth)/2,0.9);{go to start point for centered label} "gtextoCžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žߎNNNNNNNNNNNNNNNNNNNNNN”””ū program SinLabel2(output);  import dgl_lib, dgl_inq; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  var "CharWidth: ×?žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žFINNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 0NNNNNNNNNNNNNNNNNNNNNN”””ū(Text); {label the text} "set_text_rot(0,1); {vertical labels} "CharWidth:=2*0.025; {char width: 2.5% of screen width} "CharHeight:=2*0.04; {char height: 4% of screen heightĘžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žģļNNNNNNNNNNNNNNNNNNNNNN”””ū real; {width of character in world coords} "CharHeight: real; {height of character in world coords} "Text: string[20]; {temporary holding place for text} "ErrorReturn: integer; K©žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žNNNNNNNNNNNNNNNNNNNNNN”””ūC1 C2 V1 D2 Z S töÜ£ \N^¦ÄØõPRINTER: <žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž $NNNNNNNNNNNNNNNNNNNNNN”””ū} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='Voltage'; {define the text to be labelled} "move(-0.9,-(strlen(Text)*CharWidth)/2); {start point of centered label} ēažNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žUNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚ƒė„W†Ā‡.‰™ŠŒpÜŽH³‘“‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNN”””žī¤NNNNNNNNNNNNNNNNNNNNNN”””ūthe window for the data} "for X:=1 to 100 do begin {100 points total} $Y:=DataPoint(X); {get a point from the function} $if X=1 then move(X,Y) {move to the first point...} $else line(X,Y); låžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 2^NNNNNNNNNNNNNNNNNNNNNN”””ūar height: 8% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='VOLTAGE VARIANCE'; {define the text to be labelled} "for X:=-3 to 3 do begin {make "bold" label} $move(-(strlen(Text)*Char’ĆžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žDNNNNNNNNNNNNNNNNNNNNNN”””ū program SinLabel3(output);  import dgl_lib, dgl_inq; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  var "CharWidth: ĢńžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŻ•NNNNNNNNNNNNNNNNNNNNNN”””ū {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {program "SinLabel2"} &&žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž «ÉNNNNNNNNNNNNNNNNNNNNNN”””ūWidth)/2+X*0.002,0.9); {center label} $gtext(Text); {label the text} "end; {for X} "set_text_rot(0,1); {vertical labels} "CharWidth:=2*0.025; {char width: 2.5% of screen width} "CharHeiĢžžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žw3NNNNNNNNNNNNNNNNNNNNNNž”””ū real; {width of character in world coords} "CharHeight: real; {height of character in world coords} "Text: string[20]; {temporary holding place for text} "ErrorReturn: integer; K©žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žˆĘNNNNNNNNNNNNNNNNNNNNNN”””ūC1 C2 V1 D2 Z S °öÜ \N^¦ÄØõPRINTER: <Ģ„žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ˜ųNNNNNNNNNNNNNNNNNNNNNNž”””ūght:=2*0.04; {char height: 4% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='Voltage'; {define the text to be labelled} SāžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žg NNNNNNNNNNNNNNNNNNNNNN”””ū {variable for initialization outcome} "X: integer;  Y: real;  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {********************************************************************}  begin «žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž»÷NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĶ«NNNNNNNNNNNNNNNNNNNNNN”””ū"move(-0.9,-(strlen(Text)*CharWidth)/2); {start point of centered label} "gtext(Text); {label the text} "set_text_rot(1,0); {horizontal labels} "Text:='Time (seconds)'; {define the text toCržĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Tepsilon then ,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Rounded)*M; (end; "Near: Rounded:=trunc(N/M+M*0.5)*M; {...to the nearest multiple?IžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž :¢NNNNNNNNNNNNNNNNNNNNNN”””ūe(X,Location+SemiMinsize); {...draw to the top of minor tick}  end; {else begin}  Counter:=(Counter+1) mod Major; {keep track of which length tick to do}  X:=X+Spacing; {go to next tick position} ™žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÅWNNNNNNNNNNNNNNNNNNNNNN”””ū-----------------------------------------------------}  var "X: real; {current X of tick marks}  SemiMinsize: real; {half of minor tick size} "SemiMajsize: real; {half of major tick sĆ&žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž­NNNNNNNNNNNNNNNNNNNNNN”””ū}  end; {case}  if Negative then Rounded:=-Rounded; {reinstate the sign}  Round2:=Rounded; {assign to function name}  end; {function "Round2"}  $page$ {***********************************ńIžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žońNNNNNNNNNNNNNNNNNNNNNNž”””ū end; {while} {loop if not done}  end; {procedure "Xaxis"}  $page$ {********************************************************************}  procedure Yaxis(Spacing,Location,Ymin,Ymax: real; 幞ĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž öfNNNNNNNNNNNNNNNNNNNNNN”””ūize} "Counter: integer; {keeps track of when to do major ticks}  begin {body of procedure "Xaxis"}  move(Xmin,Location); {left end of the x-axis} qžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž€:NNNNNNNNNNNNNNNNNNNNNNž”””ū*********************************}  procedure Xaxis(Spacing,Location,Xmin,Xmax: real; EMajor: integer; ;Majsize,Minsize: real);  {----------------------------------------------------------------------------}  { This procedure draws an X-axis at any iµĢžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž\ĄNNNNNNNNNNNNNNNNNNNNNN”””ūEMajor: integer; ;Majsize,Minsize: real);  {----------------------------------------------------------------------------}  { This procedure draws an Y-axis at any intersection point on the plotting }  { surface. Parameters are as follows: HŠžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž £5NNNNNNNNNNNNNNNNNNNNNN”””ū line(Xmax,Location); {draw x-axis}  SemiMinsize:=Minsize*0.5; {half of every tick mark needs to...}  SemiMajsize:=Majsize*0.5; {...be on each side of the axis}  X:=Round2(Xmin,Spacing*Major,Down); {rošžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž³ NNNNNNNNNNNNNNNNNNNNNN”””ūntersection point on the plotting }  { surface. Parameters are as follows: }  { Spacing: The distance between tick marks on the axis. } žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žlNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žL؀‚ƒź„U†Ą‡,‰—ŠŒoŚŽE±‘“ˆ”ó•^—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž ³ćNNNNNNNNNNNNNNNNNNNNNN”””ūaw to the right of major tick}  end; {else begin}  Counter:=(Counter+1) mod Major; {keep track of which length tick to do}  Y:=Y+Spacing; {go to next tick position}  end; {while} {loop if { žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž oNNNNNNNNNNNNNNNNNNNNNN”””ū real; {current Y of tick marks}  SemiMinsize: real; {half of minor tick size} "SemiMajsize: real; {half of major tick size} "Counter: integer; {keeps track of when to‘»žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ENNNNNNNNNNNNNNNNNNNNNN”””ū"set_char_size(CharWidth,CharHeight); {install character size} "Text:='Voltage'; {define the text to be labelled} "move(-0.9,-(strlen(Text)*CharWidth)/2); {start point of centered label} "gtext(Text); ėģžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž €ŅNNNNNNNNNNNNNNNNNNNNNN”””ūnot done}  end; {procedure "Yaxis"} $page$ {********************************************************************}  begin {body of program "SinAxes1"} óhžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž öŽNNNNNNNNNNNNNNNNNNNNNN”””ū do major ticks}  begin {body of procedure "Axes"}  move(Location,Ymin); {lower end of the y-axis}  line(Location,Ymax); {draw y-axis}  SemiMinsize:=Minsize*0.5; {halžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž *tNNNNNNNNNNNNNNNNNNNNNN”””ū {label the text} "Text:='Time (seconds)'; {define the text to be labelled} "set_text_rot(1,0); {horizontal labels} "move(-(strlen(Text)*CharWidth)/2,-0.92); {start point of centered label} "gtext(Text); PœžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ՁNNNNNNNNNNNNNNNNNNNNNN”””ū graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin {output device initialization OK?} "set_aspect(511,389); SžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ÅæNNNNNNNNNNNNNNNNNNNNNN”””ūf of every tick mark needs to...}  SemiMajsize:=Majsize*0.5; {...be on each side of the axis}  Y:=Round2(Ymin,Spacing*Major,Down); {round start point to next lower major} °¼žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž :JNNNNNNNNNNNNNNNNNNNNNN”””ū }  { Spacing: The distance between tick marks on the axis. }  { Location: The X-value of the Y-axis. }  { Ymin,Ymax: The left and right ends of the Y-axis, respecŠēžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ę°NNNNNNNNNNNNNNNNNNNNNN”””ū {use the whole screen} "CharWidth:=2*0.04; {char width: 4% of screen width} "CharHeight:=2*0.08; {char height: 4% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='VO©äžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ģNNNNNNNNNNNNNNNNNNNNNN”””ū Counter:=0; {start with a major tick}  while Y<=Ymax do begin {loop until greater than Xmax} "if Counter=0 then begin {should we do a major tick?} $move(Location-SemiMajsize,Y); {move to„pžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž  {NNNNNNNNNNNNNNNNNNNNNN”””ūtively. }  { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth tick mark will be major. }  džēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 'NNNNNNNNNNNNNNNNNNNNNN”””ūLTAGE VARIANCE'; {define text to be labelled} "for X:=-3 to 3 do begin {make "bold" label} $move(-(strlen(Text)*CharWidth)/2+X*0.002,0.9); {center label} $gtext(Text); {label the text} "end; "set_t\HžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž £ŻNNNNNNNNNNNNNNNNNNNNNNž”””ū left of major tick, and...} $line(Location+SemiMajsize,Y); {...draw to the right of major tick} "end {Counter=0?} "else begin $move(Location-SemiMinsize,Y); {move to left of major tick, and...} $line(Location+SemiMinsize,Y); {...dr¦NžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž \(NNNNNNNNNNNNNNNNNNNNNN”””ū { Majsize: The length, in current units, of the major tick marks. }  { Minsize: The length, in current units, of the minor tick marks. }  {----------------------------------------------------------------------------}  var "Y: `5žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž LNNNNNNNNNNNNNNNNNNNNNN”””ūext_rot(0,1); {vertical labels} "CharWidth:=2*0.025; {char width: 2.5% of screen width} "CharHeight:=2*0.04; {char height: 4% of screen height} ”žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž )NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ؀‚ƒė„W†Ć‡/‰šŠŒqÜŽG²‘“‰”ō•`—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž ”–NNNNNNNNNNNNNNNNNNNNNN”””ū {label the text} "set_viewport(0.1,0.99,0.12,0.7); {define subset of screen} "move(-1,-1); line(-1,1); line(1,1); line(1,-1); line(-1,-1); {frame} "set_window(0,100,0.16,0.18); {scale the window for the data} "Xaxis(1,0.1ā¼žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž }lNNNNNNNNNNNNNNNNNNNNNN”””ū (Up, Down, Near); {used by function Round2}  var "CharWidth: real; {width of char is world coords} "CharHeight: real; {height of char is world coords} "Text: string[20]; {te¾‡žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž  0NNNNNNNNNNNNNNNNNNNNNN”””ū YAXCLIPBZ CLIPDRAWCLIPLIMACLIPLIMBCLIPDRWACLIPDRWBXAXCLIPAXAXCLIPBYAXCLIPA*«*· łr ł łļš#Ģ#Ģ \N^¦ÄØõPRINTER: < žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ’§NNNNNNNNNNNNNNNNNNNNNN”””ū6,-50,150,5,0.001,0.0005); {draw the x-axis} "Yaxis(0.001,0,0.1,0.2,5,2,1); {draw the y-axis} "for X:=1 to 100 do begin {100 points total} $Y:=DataPoint(X); {get a point from the function} Ą®žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž äūNNNNNNNNNNNNNNNNNNNNNN”””ūmporary holding place for text} "ErrorReturn: integer; {variable for initialization outcome} "X: integer; "Y: real;  ClipXmin, ClipXmax: real; {soft clip limits in x} "ClipYmin, ClipYūžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 8NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĒōNNNNNNNNNNNNNNNNNNNNNN”””ū$if X=1 then move(X,Y) {move to the first point...} $else line(X,Y); {...and draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics packžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ׏NNNNNNNNNNNNNNNNNNNNNN”””ūmax: real; {soft clip limits in y}  $include 'DGLPRG:DataPoint'$ {function: y:=f(x) }  $page$ {********************************************************************}  procedure ClipLimit(Xmin, Xmax, Ymin, Ymax: real); QžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž (?NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ōÅNNNNNNNNNNNNNNNNNNNNNN”””ūage}  end. {program "SinAxes1"} +„žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ‚™NNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  { This procedure defines the four global variables which specify where the }  { soft clip limits are. }  {----------²žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž mRNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ±ØNNNNNNNNNNNNNNNNNNNNNNž”””ū------------------------------------------------------------------}  begin  if XminClipXmax then Out:=[right]; {off right edge?}  if yClipYmax theé;žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ‚qNNNNNNNNNNNNNNNNNNNNNN”””ū { / Y values passed into } "ClipYmin:=Ymax; { / the procedure. } "ClipYmax:=Ymin; { / }  end; { / &¶žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ō-NNNNNNNNNNNNNNNNNNNNNN”””ū$x:=X1+(X2-X1)*(ClipYmin-Y1)/(Y2-Y1);{adjust value of x appropriately} $y:=ClipYmin; {new y is bottom edge} "end {bottom in Out?} "else if top in Out then begin {it crosses the top edge} $x:=X1+(X2-X1)*(ClipYmax-Y1)/(Y2ŃüžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž mŗNNNNNNNNNNNNNNNNNNNNNN”””ūn Out:=Out+[top]; {off the top?}  end; {nested procedure "Code"}  {----------------------------------------------------------------------------} TnžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ęNNNNNNNNNNNNNNNNNNNNNNž”””ū }  end; $page$ {********************************************************************}  procedure ClipDraw(X1, Y1, X2, Y2: real);  {----------------------------------------------------------------------------}  { This procedure takes the eĢtžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĒNNNNNNNNNNNNNNNNNNNNNN”””ū-Y1);{adjust value of x appropriately} $y:=ClipYmax; {new y is top edge} "end; {top in Out?} "if Out=Out1 then begin $X1:=x; Y1:=y; Code(x,y,Out1); {redefine first end point} "end {Out=Out1?} "else begin $X2:=x; Y2:=l žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 8éNNNNNNNNNNNNNNNNNNNNNN”””ū begin {body of procedure "ClipDraw"}  Code(X1,Y1,Out1); {figure status of point 1}  Code(X2,Y2,Out2); {figure status of point 2}  while (Out1<>[]) or (Out2<>[]) do begin {loj\žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž (×NNNNNNNNNNNNNNNNNNNNNN”””ūndpoints of a line, and clips it. The soft }  { clip limits are the real global variables ClipXmin, ClipXmax, ClipYmin, }  { and ClipYmax. These may be defined through the procedure ClipLimit. } ˆžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ×"NNNNNNNNNNNNNNNNNNNNNN”””ū { \ clip limit in X to be }  end { \ the smaller of the two }  else begin { / X values passed into } "ClipXmin:=Xmax; { / the procedur5ŻžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž  ŲNNNNNNNNNNNNNNNNNNNNNNž”””ūop while either point out of range} "if (Out1*Out2)<>[] then goto 1; {if intersection non-null, no line}  if Out1<>[] then Out:=Out1 " else Out:=Out2; {Out is the non-empty one} "if left in Out then begin {it j˜žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž }„NNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  label "1;  type "Edges= (Left,Right,Top,Bottom); {possible edges to cross} "OutOfBounds= set of Edges; {set of edges crossed}  var  ĮÖžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž äNNNNNNNNNNNNNNNNNNNNNN”””ūe. } "ClipXmax:=Xmin; { / }  end; { / }  if Yminepsilon then ,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Roun™‹žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž µ>NNNNNNNNNNNNNNNNNNNNNN”””ū end; {procedure "ClipDraw"} {return}  $page$ {********************************************************************}  function Round2(N, M: real; Mode: RoundType): real; Ń_žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĆbNNNNNNNNNNNNNNNNNNNNNN”””ū-----------------------------------------------------}  var "X: real; "SemiMajsize: real;  SemiMinsize: real; "Counter: integer; {keeps track of when to do major ticks} begin {body o¬JžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ˜NNNNNNNNNNNNNNNNNNNNNNž”””ūded)*M; (end; "Near: Rounded:=trunc(N/M+M*0.5)*M; {...to the nearest multiple?}  end; {case}  if Negative then Rounded:=-Rounded; {reinstate the sign}  Round2:=Rounded; {assign to function name}  end; jÉžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ąmNNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  { This function rounds "N" to the nearest "M", according to "Mode". This }  { function works only when the argument is in the range of MININT..MAXINT. }  {----------ķŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž šSNNNNNNNNNNNNNNNNNNNNNN”””ūf procedure "XaxisClip"}  SemiMajsize:=MajSize*0.5;  SemiMinsize:=MinSize*0.5;  Counter:=0; {start with a major tick}  ClipDraw(ClipXmin,Location,ClipXmax,Location); …užNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¦NNNNNNNNNNNNNNNNNNNNNN”””ū {function "Round2"} $page$ {********************************************************************}  procedure XaxisClip(Spacing, Location: real; Major: integer; "Majsize,Minsize: real);  {-----------------------------------------------užNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Ó\NNNNNNNNNNNNNNNNNNNNNNž”””ū------------------------------------------------------------------}  const "epsilon= 1E-10; {roundoff error fudge factor}  var "Rounded: real; {temporary holding area}  Negative: boolean; g1žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž „NNNNNNNNNNNNNNNNNNNNNN”””ū X:=Round2(ClipXmin,Spacing*Major,Down); {round to next lower major}  while X<=ClipXmax do begin "if Counter=0 then $ClipDraw(X,Location-SemiMajsize,X,Location+SemiMajsize) "else $ClipDraw(X,Location-SemiMinsize,X,Location+SemiMinsize);  Counter:=‡žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž <—NNNNNNNNNNNNNNNNNNNNNN”””ū-----------------------------}  { This procedure draws an X-axis at any intersection point on the plotting }  { surface. Parameters are as follows: } E§žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž JĖNNNNNNNNNNNNNNNNNNNNNN”””ū {flag: "It is negative?"}  begin {body of "Round2"}  Negative:=(N<0.0); {is the number negative?}  if Negative then begin "N:=abs(N); {work with a positive number}  FžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž –1NNNNNNNNNNNNNNNNNNNNNN”””ū(Counter+1) mod Major;  X:=X+Spacing;  end; {while}  end; {procedure "XaxisClip"} $page$ {********************************************************************}  procedure YaxisClip(Spacing, Location: real; Major: ĒnžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž iÄNNNNNNNNNNNNNNNNNNNNNNž”””ū { Spacing: The distance between tick marks on the axis. }  { Location: The Y-value of the X-axis. }  { Major: The number of tick marks to ge before drawing a major tick }  { #ķžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž yśNNNNNNNNNNNNNNNNNNNNNN”””ū if Mode=Up then Mode:=Down {if number is negative, ...} "else if Mode=Down then Mode:=Up; {...reverse up and down}  end;  case Mode of {should we round the number...} ó1žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¦lNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ©€‚€ƒģ„W†Ā‡-‰™ŠŒoŚŽE±‘“‡”ņ•]—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž yNNNNNNNNNNNNNNNNNNNNNN”””ūn {output device initialization OK?} "set_aspect(511,389); {use the whole screen} "CharWidth:=2*0.04; {char width: 4% of screen width} "CharHeight:=2*0.08; {char height: 8% of screen heig+ėžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž „čNNNNNNNNNNNNNNNNNNNNNN”””ūe: The length, in world units, of the minor tick marks. }  {----------------------------------------------------------------------------}  var "Y: real;  SemiMinsize: real; "SemiMajsize: real; "Counter: integer; ­xžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Ó“NNNNNNNNNNNNNNNNNNNNNN”””ū"set_window(0,100,0.16,0.18); {scale the window for the data} "ClipLimit(0,100,0.16,0.18); {define the soft clip limits} "XaxisClip(1,0.16,5,0.0008,0.0004); {draw the clipped X-axis} "YaxisClip(0.001,0,5,2,1); {draw th̉žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž J#NNNNNNNNNNNNNNNNNNNNNN”””ūht} "set_char_size(CharWidth,CharHeight); {install the character size} "Text:='VOLTAGE VARIANCE'; {define the text to be labelled} "for X:=-3 to 3 do begin {make "bold" label} ælžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž <NNNNNNNNNNNNNNNNNNNNNN”””ū {keeps track of when to do major ticks}  begin {body of procedure "YaxisClip"}  SemiMajsize:=Majsize*0.5;  SemiMinsize:=Minsize*0.5;  Counter:=0; {start with a major tick}  ClipDraw(psžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ą…NNNNNNNNNNNNNNNNNNNNNN”””ūe clipped Y-axis} "for X:=1 to 100 do begin {100 points total} $Y:=DataPoint(X); {get a point from the function} $if X=1 then move(X,Y) {move to the first point...} $else line(X,Y); {...¹³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž pNNNNNNNNNNNNNNNNNNNNNN”””ū$move(-(strlen(Text)*CharWidth)/2+X*0.002,0.9); {center label} $gtext(Text); {label the text} "end; "set_text_rot(0,1); {vertical labels} "CharWidth:=2*0.025; {char width: 2.5% of screen/žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNNN”””ūLocation,ClipYmin,Location,ClipYmax);  Y:=Round2(ClipYmin,Spacing*Major,Down); {round to next lower major}  while Y<=ClipYmax do begin "if Counter=0 then $ClipDraw(Location-SemiMajsize,Y,Location+SemiMajsize,Y) "else A‰žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž š»NNNNNNNNNNNNNNNNNNNNNN”””ūinteger; "Majsize, Minsize: real);  {----------------------------------------------------------------------------}  { This procedure draws an Y-axis at any intersection point on the plotting }  { surface. Parameters are as follows: žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ,ANNNNNNNNNNNNNNNNNNNNNN”””ū width} "CharHeight:=2*0.04; {char height: 4% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='Voltage'; {define text to be labelled} "move(-0.9,-(strlen(Text)*CharWidth)/2¢žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ZNNNNNNNNNNNNNNNNNNNNNN”””ū$ClipDraw(Location-SemiMinsize,Y,Location+SemiMinsize,Y);  Counter:=(Counter+1) mod Major;  Y:=Y+Spacing;  end; {while}  end; {procedure "YaxisClip"} $page$ {****************************************************łužNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ÊNNNNNNNNNNNNNNNNNNNNNN”””ū }  { Spacing: The distance between tick marks on the axis. }  { Location: The X-value of the Y-axis. } ØžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž µÖNNNNNNNNNNNNNNNNNNNNNN”””ū); {start point of centered label} "gtext(Text); {label the text} "Text:='Time (seconds)'; {define text to be labelled} "set_text_rot(1,0); {horizontal labels} "move(-(strlen(Text)*CharWidĖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž i,NNNNNNNNNNNNNNNNNNNNNN”””ū****************}  begin {program "SinClip"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begi‰DžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž –ŁNNNNNNNNNNNNNNNNNNNNNN”””ū { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth tick mark will be major. }  { Majsize: The length, in world units, of the major tick marks. }  { MinsizyKžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž †ēNNNNNNNNNNNNNNNNNNNNNN”””ūth)/2,-0.92); {start point of centered label} "gtext(Text); {label the text} "set_viewport(0.1,0.99,0.12,0.7); {define subset of window} "move(-1,-1); line(-1,1); line(1,1); line(1,-1); line(-1,-1); {frame} Y£žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŠŲNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ؀‚ƒź„V†Į‡,‰—ŠŒoŪŽG²‘“‰”õ•a—NNNNNNNNNNNNNNNNNNNNNNNNN”””žkgNNNNNNNNNNNNNNNNNNNNNN”””ūand draw to all the rest} "end; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {program "SinClip"} vŹžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ·NNNNNNNNNNNNNNNNNNNNNN”””ūal variables which specify where the }  { soft clip limits are. }  {----------------------------------------------------------------------------}  begin {body of proÆēžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĮĮNNNNNNNNNNNNNNNNNNNNNN”””ū program SinAxes2(output);  import dgl_lib; {get graphics routines}  const "CrtAddr= 3; {address of internal CRT} "ControlWord= 0; {device control; 0 for CRT}  type  RoundTypeĪDžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žXVNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž . NNNNNNNNNNNNNNNNNNNNNN”””ūcedure "ClipLimit"}  if XminžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ;NNNNNNNNNNNNNNNNNNNNNN”””ū { \ the smaller of the two }  else begin { / X values passed into } "ClipXmin:=Xmax; { / the procedure. } ›TžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žāĪNNNNNNNNNNNNNNNNNNNNNNž”””ūemporary holding place for text} "ErrorReturn: integer; {variable for initialization outcome} "I: integer; {return variable from STRWRITE} "X: integer; "Y: real;  ClipXmś8žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>4NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žHhNNNNNNNNNNNNNNNNNNNNNN”””ū"ClipXmax:=Xmin; { / }  end; { / }  if Ymin[] then goto 1; {if intersection non-null, no line}  if Out1<>[] then Out:=Out1 " else Out:=Out2; {Out is the non-empty one} "if left in Out then begin {it crosses the left edge} $y:=Y1+(Y2-Y1)*(ClipXmin̘žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žH€NNNNNNNNNNNNNNNNNNNNNN”””ū------------------------------------------------------------------}  label "1;  type "Edges= (Left,Right,Top,Bottom); {possible edges to cross} "OutOfBounds= set of Edges; {set of edges crossed}  var  Out,Out1,Out2£?žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>ÜNNNNNNNNNNNNNNNNNNNNNN”””ū 1: end; {procedure "ClipDraw"}  $page$ {********************************************************************}  function Round2(N, M: real; Mode: RoundType): real;  {-----------------------------------------------------XžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž §KNNNNNNNNNNNNNNNNNNNNNN”””ū-X1)/(X2-X1);{adjust value of y appropriately} $x:=ClipXmin; {new x is left edge} "end {left in Out?} "else if right in Out then begin {it crosses right edge} ņ}žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŃNNNNNNNNNNNNNNNNNNNNNN”””ū:OutOfBounds; "X, Y: real;  {----------------------------------------------------------------------------}  procedure Code(X, Y: real; var Out: OutOfBounds);  begin {nested procedure "Code"}  Out:=[]; šžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ķNNNNNNNNNNNNNNNNNNNNNN”””ū-----------------------}  { This function rounds "N" to the nearest "M", according to "Mode". This }  { function works only when the argument is in the range of MININT..MAXINT. }  {------------------------------------------------------------------ާžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ņNNNNNNNNNNNNNNNNNNNNNN”””ū$y:=Y1+(Y2-Y1)*(ClipXmax-X1)/(X2-X1);{adjust value of y appropriately} $x:=ClipXmax; {new x is right edge} "end {right in Out?} "else if bottom in Out then begin {it crosses the bottom edge} $x:=X1+(X2-X1)*(ClipYmin-Y1)/(YŌMžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žā&NNNNNNNNNNNNNNNNNNNNNNž”””ū {null set}  if xClipXmax then Out:=[right]; {off right edge?}  if yClipYmax then Out:=Out+[top]; {off the top?}  end; {nested procedure "Code"}  {----------------------------------------------------------------------------}  begin {body ÷™žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.āNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure "ClipLimit"} $page$ {********************************************************************}  procedure ClipDraw(X1, Y1, X2, Y2: real);  {----------------------------------------------------------------------------} @]žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž X¾NNNNNNNNNNNNNNNNNNNNNN”””ūately} $y:=ClipYmax; {new y is top edge} "end; {top in Out?} "if Out=Out1 then begin $X1:=x; Y1:=y; Code(x,y,Out1); {redefine first end point} "end {Out=Out1?} "else begin $X2:=x; Y2:=y; Code(x,y,Out2); {redefinežNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž„DNNNNNNNNNNNNNNNNNNNNNN”””ūof procedure "ClipDraw"}  Code(X1,Y1,Out1); {figure status of point 1}  Code(X2,Y2,Out2); {figure status of point 2}  while (Out1<>[]) or (Out2<>[]) do begin {loop while either point out of range} "if (Out1*O_TžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž{±NNNNNNNNNNNNNNNNNNNNNN”””ū { This procedure takes the endpoints of a line, and clips it. The soft }  { clip limits are the real global variables ClipXmin, ClipXmax, ClipYmin, }  { and ClipYmax. These may be defined through the procedure ClipLimit. }  {----------łžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž kNNNNNNNNNNNNNNNNNNNNNN”””ū second end point} "end; {else begin}  end; {while}  move(x1,y1); {if we get to this point, the line...}  line(x2,y2); {...is completely visible, so draw it} mJžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=°NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚ƒė„W†Ā‡-‰˜ŠŒoŪŽG³‘“Š”õ•a—NNNNNNNNNNNNNNNNNNNNNNNNN”””žҚNNNNNNNNNNNNNNNNNNNNNN”””ū----------}  const "epsilon= 1E-10; {roundoff error fudge factor}  var "Rounded: real; {temporary holding area}  Negative: boolean; {flag: "It is negative?"}  begin ] žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž `NNNNNNNNNNNNNNNNNNNNNNž”””ū {start with a major tick}  ClipDraw(ClipXmin,Location,ClipXmax,Location); {draw the X-axis itself}  X:=Round2(ClipXmin,Spacing*Major,Down); {round to next lower major}  while X<=ClipXmax do begin {loop until greater than Clipm{žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žxepsilon then ,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Rounded)*M; (end; "Near: Rounded:=trunc(FöžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žń•NNNNNNNNNNNNNNNNNNNNNN”””ū$page$ {********************************************************************}  procedure YaxisClip(Spacing, Location: real; Major: integer; "Majsize, Minsize: real);  {----------------------------------------------------------------------------}  { TūēžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž hNNNNNNNNNNNNNNNNNNNNNNž”””ū {X position of tick marks} "SemiMajsize: real; {half of major tick size}  SemiMinsize: real; {half of minor tick size} "Counter: integer; {keeps track of when to do major ticks} }zžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž^NNNNNNNNNNNNNNNNNNNNNN”””ūN/M+M*0.5)*M; {...to the nearest multiple?}  end; {case}  if Negative then Rounded:=-Rounded; {reinstate the sign}  Round2:=Rounded; {assign to function name}  end; {function "Round2"} €ćžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¤NNNNNNNNNNNNNNNNNNNNNN”””ūhis procedure draws an Y-axis at any intersection point on the plotting }  { surface. Parameters are as follows: }  { Spacing: The distance between tick marks on the axis. }  { Location: TL¤žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž =QNNNNNNNNNNNNNNNNNNNNNN”””ūbegin {body of procedure "XaxisClip"}  SemiMajsize:=MajSize*0.5; {calculate half of major tick size}  SemiMinsize:=MinSize*0.5; {calculate half of minor tick size}  Counter:=0; Ž)žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-oNNNNNNNNNNNNNNNNNNNNNN”””ū $page$ {********************************************************************}  procedure XaxisClip(Spacing, Location: real; Major: integer; "Majsize,Minsize: real);  {----------------------------------------------------------------------------} ö†žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žņłNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚~ƒé„U†Į‡-‰˜ŠŒoŪŽG³‘“‹”÷•c—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž-‡NNNNNNNNNNNNNNNNNNNNNN”””ū output device?}  if ErrorReturn=0 then begin {output device initialization OK?} "set_aspect(511,389); {use the whole screen} "CharWidth:=2*0.04; {char width: 4% of screen width} "CharHeight:=2*0.08; åžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žń}NNNNNNNNNNNNNNNNNNNNNN”””ū when to do major ticks}  begin {body of procedure "YaxisClip"}  SemiMajsize:=Majsize*0.5; {calculate half of major tick size}  SemiMinsize:=Minsize*0.5; {calculate half of minor tick size} ą%žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž‡!NNNNNNNNNNNNNNNNNNNNNN”””ū"set_window(0,100,0.16,0.18); {scale the window for the data} "ClipLimit(0,100,0.16,0.18); {define the soft clip limits} "XaxisClip(1,0.16,5,0.0008,0.0004); {draw the clipped X-axis} "YaxisClip(0.0005,0,5,2,1); {draw thŗVžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¶NNNNNNNNNNNNNNNNNNNNNNž”””ū {char height: 4% of screen height} "set_char_size(CharWidth,CharHeight); {install character size} "Text:='VOLTAGE VARIANCE'; {define text to be labelled} "for X:=-3 to 3 do begin {make "bold" label} ÆČžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žhźNNNNNNNNNNNNNNNNNNNNNN”””ū Counter:=0; {start with a major tick}  ClipDraw(Location,ClipYmin,Location,ClipYmax);  Y:=Round2(ClipYmin,Spacing*Major,Down); {round to next lower major}  while Y<=ClipYmax do begin {loop until greater than Yma}üžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž“NNNNNNNNNNNNNNNNNNNNNNž”””ūe clipped Y-axis} "CharWidth:=1.3; {char width: 1.3 user X units wide} "CharHeight:=0.0008; {char height: .0008 user Y units high} "set_char_size(CharWidth,CharHeight); {install character size} "Text:=''; ŪžžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž KåNNNNNNNNNNNNNNNNNNNNNN”””ū$move(-(strlen(Text)*CharWidth)/2+X*0.002,0.9); {center label} $gtext(Text); {label the text} "end; "set_text_rot(0,1); {vertical labels} "CharWidth:=2*0.025; {char width: 2.5% of screen/žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž[ŪNNNNNNNNNNNNNNNNNNNNNNž”””ūx} "if Counter=0 then {should we do a major tick?} $ClipDraw(Location-SemiMajsize,Y,Location+SemiMajsize,Y) "else $ClipDraw(Location-SemiMinsize,Y,Location+SemiMinsize,Y); Į˜žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¤.NNNNNNNNNNNNNNNNNNNNNN”””ūhe X-value of the Y-axis. }  { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth tick mark will be major. }  { Majsize: The length, inĪzžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž xŌNNNNNNNNNNNNNNNNNNNNNN”””ū width} "CharHeight:=2*0.04; {char height: 4% of screen height} "set_char_size(CharWidth,CharHeight); {install char size} "Text:='Voltage'; {define text to be labelled} "move(-0.97,-(strlen(Text)*CharWidth)/2); 4žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žˆNNNNNNNNNNNNNNNNNNNNNN”””ū Counter:=(Counter+1) mod Major; {keep track of which size tick to do}  Y:=Y+Spacing; {go to next tick position}  end; {while}  end; {procedure "YaxisClip"} $page$ {****************œžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž—NNNNNNNNNNNNNNNNNNNNNNž”””ū world units, of the major tick marks. }  { Minsize: The length, in world units, of the minor tick marks. }  {----------------------------------------------------------------------------}  var |žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž įCNNNNNNNNNNNNNNNNNNNNNN”””ū {start point of centered label} "gtext(Text); {label the text} "Text:='Time (seconds)'; {define text to be labelled} "set_text_rot(1,0); {horizontal labels} "move(-(strlen(Text)*CharWidth)/2£©žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=¹NNNNNNNNNNNNNNNNNNNNNN”””ū****************************************************}  begin {body of program "SinAxes2"}  graphics_init; {initialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {whichŽ-žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĀLNNNNNNNNNNNNNNNNNNNNNN”””ū"Y: real; {Y position of tick marks} "SemiMajsize: real; {half of major tick size}  SemiMinsize: real; {half of minor tick size} "Counter: integer; {keeps track ofėHžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŅrNNNNNNNNNNNNNNNNNNNNNN”””ū,-0.92); {start point of centered label} "gtext(Text); {label the text} "set_viewport(0.1,0.99,0.12,0.7); {define subset of the screen} "move(-1,-1); line(-1,1); line(1,1); line(1,-1); line(-1,-1); {frame} ‚NžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž„MNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNsNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž؀‚ƒė„W†Ć‡/‰šŠŒqÜŽG³‘“‰”ō•`—NNNNNNNNNNNNNNNNNNNNNNNNN”””ž?ņNNNNNNNNNNNNNNNNNNNNNNž”””ū {erase previous definitions of string} "for X:=0 to 10 do begin {eleven X labels} $strwrite(Text,1,I,X*10:0); {convert number to string} $move(X*10-(strlen(Text)*CharWidth)/2,0.1593); {center the label}JžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ćNNNNNNNNNNNNNNNNNNNNNN”””ū { This routine converts any point in virtual coordinates, whether on the }  { plotting surface or not, into world coordinates. }  {----------------------------------------------------------------------------}  const "Wind7łžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž•TNNNNNNNNNNNNNNNNNNNNNN”””ūN^¦Ä§u[žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĆNNNNNNNNNNNNNNNNNNNNNNž”””ū $gtext(Text); {label the text} "end; {for x} "Y:=0.16; {starting Y position for Y labels} "repeat $strwrite(Text,1,X,Y:6:4); {convert number to string} }žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž zŸNNNNNNNNNNNNNNNNNNNNNNž”””ūowLimits= 450; {mnemonic better than magic number} "ViewportLimits= 451; {...here, too. }  type "LimitOrder= (Xmin, Xmax, Ymin, Ymax); "LimitType= array [LimitOrder] of real;  var "Pac: pacųšžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¦eNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žYNNNNNNNNNNNNNNNNNNNNNN”””ū$move(-8,Y-0.0002); {center the text vertically} $gtext(Text); {label the text} " Y:=Y+0.0025; {next Y position} "until Y>0.18; {terminating condition} "for X:=1 t‘&žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž I®NNNNNNNNNNNNNNNNNNNNNN”””ūked array [1..1] of char; { \ These are the sundries } "Iarray: array [1..1] of integer; { \ needed by the call to }  Window: LimitType; { > the DGL procedure } „·žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¶[NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žj”NNNNNNNNNNNNNNNNNNNNNN”””ūo 100 do begin {100 points total} $Y:=DataPoint(X); {get a point from the fuinction} $if X=1 then move(X,Y) {move to the first point...} $else line(X,Y); {...and draw to all the rest} "e÷©žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žżNNNNNNNNNNNNNNNNNNNNNN”””ū Viewport: LimitType; { / "inq_ws". } "Error: integer; { / }  begin {body of procedure "ConvertVirtualToWorld"}  inq_ws(Winč+žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž …jNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žó6NNNNNNNNNNNNNNNNNNNNNN”””ūnd; {for X:=1 to 100}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {program "SinAxes2"} «ĻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ĢNNNNNNNNNNNNNNNNNNNNNN”””ūdowLimits,0,0,4,Pac,Iarray,Window,Error);  if Error<>0 then writeln('Error ',Error:0, "' in determining window limits in "ConvertVirtualToWorld".');  inq_ws(ViewportLimits,0,0,4,Pac,Iarray,Viewport,Error);  if Error<>0 then writeln('Error ',Error:0, "J1žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Š9NNNNNNNNNNNNNNNNNNNNNN”””ū {****************************************************************************}  procedure ConvertVirtualToWorld(VirtualX, VirtualY: real; 0 then writeln('Error ',Error:0, "' in determining window limits in "ConvertWorldToVirtual".');  inq_ws(ViewportLimits,0,0,4,Pac,Iarray,Viewport,Error);  if Error<>0 then writeln('Error ',Error:0, " ÅžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¦NNNNNNNNNNNNNNNNNNNNNN”””ū {****************************************************************************}  procedure ConvertWorldToVirtual(WorldX, WorldY: real;  the DGL procedure } „·žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ži%NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚ƒķ„Y†Å‡1‰ŠŒtąŽLø‘$“”ü•h—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žkNNNNNNNNNNNNNNNNNNNNNNž”””ū' in determining viewport limits in "ConvertWorldToVirtual".');  VirtualX:=(WorldX-Window[Xmin]) { \ Calculate X distance from left... } "/(Window[Xmax]-Window[Xmin]) { \ ...convert to a fraction... } "*(Viewport[Xmax]-Viewport[XmßžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž đNNNNNNNNNNNNNNNNNNNNNN”””ū 0; {device control word; ignored for CRT}  type "LorgType= 1..9; {the valid values to pass the "Lorg"}  Str255= string[255]; {for the procedure "Glabel"}  var "Error: integer; LžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž²ĶNNNNNNNNNNNNNNNNNNNNNNž”””ūZ z \N^¦ÄØõPRINTER: <ĶĪžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ZNNNNNNNNNNNNNNNNNNNNNN”””ūin]) { / ...go same fraction into world... } "+Viewport[Xmin]; { / ...add Xmin to get value. }  VirtualY:=(WorldY-Window[Ymin]) { \ Calculate Y distance from bottom...} "„žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ]NNNNNNNNNNNNNNNNNNNNNNž”””ū {display_init return variable; 0 = ok}  I, X, Y: integer; {loop control variables}  $page$ {********************************************************************}  begin {body of program "CharCg[žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žüNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž~ NNNNNNNNNNNNNNNNNNNNNNž”””ū"/(Window[Ymax]-Window[Ymin]) { \ ...convert to a fraction... } "*(Viewport[Ymax]-Viewport[Ymin]) { / ...go same fraction into world... } "+Viewport[Ymin]; { / ...add Ymin to get value. }  end; |ŻžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž n7NNNNNNNNNNNNNNNNNNNNNN”””ūell"}  graphics_init; {initialize graphics library}  display_init(Crt,Control,Error); {initialize CRT}  if Error=0 then begin {if no error occurred...} ”&žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž‘ĀNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žM8NNNNNNNNNNNNNNNNNNNNNNž”””ū {procedure "ConvertWorldToVirtual"} Ö3žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;dNNNNNNNNNNNNNNNNNNNNNNž”””ū set_aspect(511,389); {use the whole screen} "move(-1,-1); line(-1,1); line(1,1); line(1,-1); line(-1,-1); "set_window(-2,38,-7.5,22.5); {define appropriate window} "set_char_size(1,2); { \ }˜žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¢óNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŌÆNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žUNNNNNNNNNNNNNNNNNNNNNN”””ū }  move(1,21); { > Do main label. } "gtext('Size of Character in Character Cell'); { / } "for X:=0 to 36 do begin { \ } "ŅąžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ÷ NNNNNNNNNNNNNNNNNNNNNNž”””ū program CharCell(output); {program name same as file name}  import dgl_lib, dgl_inq; {access the necessary procedures}  const "Crt= 3; {device address of graphics raster} "Control= ‰ģžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žēžNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN*NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒė„W†Ć‡/‰šŠŒqÜŽH“‘“‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žēvNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ŒNNNNNNNNNNNNNNNNNNNNNN”””ū {go to starting position} "gtext('Gby;'); {label some characters}  end; {Error=0?} {end of conditional code}  graphics_term; {terminate graphics library}  end. {program "CharCel旾NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žMŠNNNNNNNNNNNNNNNNNNNNNN”””ū { aspect ratio of the character cell. The values for the window limits }  { may be anything; they are taken into account and do not affect the size }  { of the characters, since they are defined in virtual coordinates. This }  { procedurńžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŌGNNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¢NNNNNNNNNNNNNNNNNNNNNN”””ūl"} {end of program} EMžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž~įNNNNNNNNNNNNNNNNNNNNNN”””ūe, along with Lorg and Ldir, define global variables for use by }  { Glabel. }  {----------------------------------------------------------------------------}  var "Width: real"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNN”””ū program CsizeProg(output);  import dgl_lib, dgl_inq; {get graphics routines}  const "Crt= 3; {address of internal CRT} "Control= 0; {device control; 0 for CRT}  var "Error: <žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž‘*NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žnßNNNNNNNNNNNNNNNNNNNNNN”””ū for Y:=0 to 15 do begin { \ } &move(X-0.1,y+0.1); { \ Draw the four 9x15 } &line(X+0.1,Y-0.1); { \ character cells. Make } &move(X+0.1,Y+0.1); { / rįžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ²%NNNNNNNNNNNNNNNNNNNNNN”””ū integer; {variable for initialization outcome}  I, J: integer; {utility variables}  Strng: string[10]; {temporary holding place for strings}  $include 'DGLPRG:ConvVtoW'$ {virtuaQ{žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÄyNNNNNNNNNNNNNNNNNNNNNNž”””ūZ N^¦ÄØ„c©žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž]īNNNNNNNNNNNNNNNNNNNNNN”””ūa frame around each, } &line(X-0.1,Y-0.1); { / and an X at every } $end; {for y} { / point. } "end; {for x} { / } ŗÕžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž +²NNNNNNNNNNNNNNNNNNNNNN”””ūl-to-world conversion}  $page$ {********************************************************************}  procedure CharSize(Height, AspectRatio: real);  {----------------------------------------------------------------------------}  { This procedure Ņ÷žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž÷HNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž½NNNNNNNNNNNNNNNNNNNNNN”””ū for I:=0 to 3 do begin {draw a frame around each char cell} " move(I*9,0); line(I*9,15); line(I*9+9,15); line(I*9+9,0); line(I*9,0); "end; "set_char_size(9,15); {big characters} "move(1,4); īČžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ƒNNNNNNNNNNNNNNNNNNNNNN”””ūdefines character cell size and the puts the Width and }  { Height values into global variables for later use. The arguments passed }  { in are the height of the character cell in VIRTUAL coordinates, and the } ßQžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žN¼NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNÓNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒģ„W†Ć‡.‰™ŠŒqŻŽH“‘ “Œ”÷•c—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žõNNNNNNNNNNNNNNNNNNNNNN”””ū; {temporary spot for width} "X0, Y0: real; {0,0 (virtual) in world} "X1, Y1: real; {1,1 (virtual) in world}  begin {body of procedure "CharSize"}  Conv½‘žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž )łNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž_„NNNNNNNNNNNNNNNNNNNNNN”””ū$gtext(Strng+'%'); {label the string} "end; {for i}  end; {Error=0?}  graphics_term; {terminate the graphics package}  end. {program "CsizeProg"} éžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĘ2NNNNNNNNNNNNNNNNNNNNNN”””ūertVirtualToWorld(0,0,X0,Y0); {convert 0,0 in virtual to world}  ConvertVirtualToWorld(1,1,X1,Y1); {convert 1,1 in virtual to world}  Height:=Height*(Y1-Y0); {convert height in virtual to world} ąDžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž °nNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žl”NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž“aNNNNNNNNNNNNNNNNNNNNNN”””ū Width:=Height*AspectRatio*(X1-X0)/(Y1-Y0); {convert width in virtual to world}  set_char_size(Width,Height); {invoke the parameters}  end; {procedure "CharSize"}  $page$ {********************************ŪbžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ƒ_NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž|ŖNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž PNNNNNNNNNNNNNNNNNNNNNNž”””ū************************************}  begin {body of program "CsizeProg"}  graphics_init; {initialize the graphics system}  display_init(Crt,Control,Error); {which output device?}  if EŃāžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÖ NNNNNNNNNNNNNNNNNNNNNN”””ū program LdirProg; {program name same as file name}  import dgl_lib; {access the necessary procedures}  const "Crt= 3; {device address of graphics raster} "Control= ž“žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž O›NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9ĒNNNNNNNNNNNNNNNNNNNNNN”””ūrror=0 then begin {output device initialization OK?}  set_aspect(511,389); {use the whole screen}  set_window(1,2,100,0); {scale the window for the data} "for I:=1 to 6 do begin {six dkžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žå=NNNNNNNNNNNNNNNNNNNNNN”””ū 0; {device control word; ignored for CRT}  type "AngType= (Deg,Rad,Grad); {used by procedure LabelDirection}  var "Error: integer; {display_init return variable; 0 = ok}  I,J: integāĘžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ČNNNNNNNNNNNNNNNNNNNNNN”””ūZ xN.¦ÄØ„†±žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž öNNNNNNNNNNNNNNNNNNNNNN”””ūifferent character sizes} $CharSize(I*I*0.01,0.6); {install character size} $move(1,I*I*I*0.4+I); {move to a appropriate place} $strwrite(Strng,1,J,I*I:0); {convert number to string} ‚<žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÕ`NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN;NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚ƒź„U†Ą‡+‰–ŠŒnŁŽDÆ‘“†”ń•]—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNNž”””ū {every ten degrees} $Strng:=''; {empty the string} $strwrite(strng,1,J,I*10:0); {convert the loop variable to degrees} $Strng:='-------'+Strng+' deg'; {attach prefix and suffix} $LabelDirection(I*10,Deg); ÜžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÖäNNNNNNNNNNNNNNNNNNNNNN”””ū_per_rad= 57.2957795131; {180/pi: for converting degrees to radians} "Grad_per_rad= 63.6619772368; {200/pi: for converting grads to radians}  begin {procedure "LabelDirection"}  case Units of "Deg: Direction:=Direc6CžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž øNNNNNNNNNNNNNNNNNNNNNN”””ūC1 C2 Z ”Å \N^¦ÄØõPRINTER: <åČžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 9/NNNNNNNNNNNNNNNNNNNNNN”””ū {specify label direction} $move(0,0); {move to the center of the screen} $gtext(Strng); {label the text} "end; {for I}  end; {Error=0?} ·ŅžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žOsNNNNNNNNNNNNNNNNNNNNNN”””ūtion/Deg_per_rad; {degrees to radians} "Rad: ; {correct units already} "Grad: Direction:=Direction/Grad_per_rad; {grads to radians}  end; {case}  CharTheta:=Direction; {put into a global variable;[žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž“‰NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž l|NNNNNNNNNNNNNNNNNNNNNN”””ū graphics_term; {terminate graphics library}  end. {program "LdirProg"} é žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž|BNNNNNNNNNNNNNNNNNNNNNNž”””ū}  set_text_rot(cos(CharTheta),sin(CharTheta)); {invoke the new text direction}  end; {procedure "LabelDirection"} $page$ {********************************************************************} P žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žƒ·NNNNNNNNNNNNNNNNNNNNNNž”””ūer; {loop control variable and spare}  Strng: string[50]; {string to label}  CharTheta: real; {global variable for label direction} $page$ {**************************************************************)žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž _MNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)NNNNNNNNNNNNNNNNNNNNNN”””ū begin {body of program "LdirProg"}  graphics_init; {initialize graphics library}  display_init(Crt,Control,Error); {initialize CRT}  if Error=0 then begin {if no errorXžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž°†NNNNNNNNNNNNNNNNNNNNNN”””ū******}  procedure LabelDirection(Direction: real; Units: AngType);  {----------------------------------------------------------------------------}  { This procedure is used in conjunction with LabelOrigin, CharSize and } ’lžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĘŚNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNN”””ū occurred...}  set_aspect(511,389); {use the whole screen} "set_window(-1,1,-1,1); {define appropriate window} "set_char_size(0.05,0.08); {set the size for the characters} "for I:=0 to 35 do begin ¢īžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žåÕNNNNNNNNNNNNNNNNNNNNNN”””ū { Glabel. It sets the labelling direction to be used, and places the }  { direction into a global variable so Glabel can use it. }  {----------------------------------------------------------------------------}  const "Deg°›žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž õėNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž£ŌNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒė„W†Ā‡-‰™ŠŒqÜŽG³‘“‰”ō•_—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žWYNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ‹£NNNNNNNNNNNNNNNNNNNNNN”””ūits,0,0,4,Pac,Iarray,Window,Error);  if Error=0 then begin "move(Window[Xmin],Window[Ymin]); {move to lower left corner} "line(Window[Xmin],Window[Ymax]); {draw to upper left corner} "line(Window[Xmax],Window[Ymax]); ±žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žż’NNNNNNNNNNNNNNNNNNNNNN”””ū"HJustification: HJustifyType; { \ needed by the LabelJustify/ } "VJustification: VJustifyType; { / LabelDirection/CharSize } "CharTheta: real; { / series of procedures. }  $include 'DGLPRG:ConvVžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žāNNNNNNNNNNNNNNNNNNNNNNž”””ū begin {function "Atan"}  if X=0.0 then Atan:=(Pi/2+Pi*ord(Y<0.0))*ord(Y<>0.0)  else Atan:=arctan(Y/X)+Pi*ord(X<0.0)+2*Pi*ord((X>0.0) and (Y<0.0));  end; {function "Atan"} $page$ {**ÓCžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ›uNNNNNNNNNNNNNNNNNNNNNNž”””ū {********************************************************************}  procedure LabelJustify(HJust: HJustifyType; VJust: VJustifyType);  {----------------------------------------------------------------------------} JEžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žķ)NNNNNNNNNNNNNNNNNNNNNN”””ūze"} $page$ {********************************************************************}  procedure LabelDirection(Direction: real; Units: AngType);  {----------------------------------------------------------------------------}  { This procedure is used mŹžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1ÓNNNNNNNNNNNNNNNNNNNNNN”””ū******************************************************************}  procedure Glabel(Text: Str255);  {----------------------------------------------------------------------------}  { This procedure labels a string of text at the current pen positionUžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Ī&NNNNNNNNNNNNNNNNNNNNNN”””ū { This procedure is used in conjunction with procedures CharSize, }  { LabelDirection, and Glabel. This just puts a value into global }  { variables which will be subsequently used by Glabel. }  {---------- 1žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŽNNNNNNNNNNNNNNNNNNNNNN”””ūin conjunction with LabelOrigin, CharSize and }  { Glabel. It sets the labelling direction to be used, and places the }  { direction into a global variable so Glabel can use it. } {PžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!ķNNNNNNNNNNNNNNNNNNNNNN”””ūnce they are defined in virtual coordinates. This }  { procedure, along with Lorg and Ldir, define global variables for use by }  { Glabel. }  {------------------------------------U žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž żNNNNNNNNNNNNNNNNNNNNNN”””ū------------------------------------------------------------------}  begin {procedure "LabelJustify"}  HJustification:=HJust;  VJustification:=VJust;  end; {procedure "LabelJustify"} ×<žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž‹KNNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  const "Deg_per_rad= 57.2957795131; {180/pi: for converting degrees to radians} "Grad_per_rad= 63.6619772368; {200/pi: for converting grads to radians}  begin Š4žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÜNNNNNNNNNNNNNNNNNNNNNN”””ū----------------------------------------}  var "Width: real; {temporary spot for width} "X0, Y0: real; {0,0 (virtual) in world} "X1, Y1: real; {1,1 (virtual) in world} ŠYžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž d€NNNNNNNNNNNNNNNNNNNNNN”””ū$page$ {********************************************************************}  function Atan(Y, X: real): real;  {----------------------------------------------------------------------------}  { This function returns the value of the arctangent of YŠžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žøzNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure "LabelDirection"}  case Units of "Deg: Direction:=Direction/Deg_per_rad; {degrees to radians} "Rad: ; {correct units already} "Grad: Direction:=Direction/Grad_per_rad; {grads toĘĮžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žGNNNNNNNNNNNNNNNNNNNNNN”””ū begin {body of procedure "CharSize"}  ConvertVirtualToWorld(0,0,X0,Y0); {convert 0,0 in virtual to world}  ConvertVirtualToWorld(1,1,X1,Y1); {convert 1,1 in virtual to world}  Height:=Height*(Y1-Y0); ĮVžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž W±NNNNNNNNNNNNNNNNNNNNNN”””ū/X, placing it }  { in the correct quadrant. If Y and X are both zero, the result is zero. }  {----------------------------------------------------------------------------}  const "Pi= 3.14159265359; {pi} vōžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŽNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN*NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚ƒź„U†Ą‡,‰—ŠŒmŲŽC®‘“„”š•[—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žŗ1NNNNNNNNNNNNNNNNNNNNNN”””ū. }  { It takes into account the current label direction (set by procedure }  { "LabelDirection", the current character size (set by procedure }  { "CharSize"), and the current label justification (set by procedure }  { {gžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž fĖNNNNNNNNNNNNNNNNNNNNNN”””ūinitialize the graphics system}  display_init(CrtAddr,ControlWord,ErrorReturn); {which output device?}  if ErrorReturn=0 then begin {output device initialization OK?}  set_aspect(511,389); {use the whole screen} "set_winłžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž—NNNNNNNNNNNNNNNNNNNNNN”””ū if Error<>0 then writeln('Error',Error:0,' in "Glabel".');  Chars:=strlen(text);  Len:=Charsize[Width]*(7*Chars+2*(Chars-1))/9; {length minus inter-char gap}  Height:=Charsize[Heighth]*8/15; {height minus inter-line "%žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž‰NNNNNNNNNNNNNNNNNNNNNN”””ū"LabelJustify"). }  {----------------------------------------------------------------------------}  const "CharSizeCode= 250; {mnemonic better than magic number} €užNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ’\NNNNNNNNNNNNNNNNNNNNNN”””ūdow(-1,2.5,-0.5,2.5); {scale the window for the data}  Frame; {draw a frame around the screen} "CharSize(0.03,0.6); {width=3% screen width; asp. ratio=.6}  LabelDirection(0,Deg); P>žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž#¦NNNNNNNNNNNNNNNNNNNNNN”””ūgap}  Dx:=Len*(-ord(HJustification)/2);  Dy:=Height*(-ord(VJustification)/2);  R:=sqrt(Dx*Dx+Dy*Dy); { \ Convert to polar coordinates so }  Theta:=Atan(Dy,Dx); { / rotation is easy. }  Theta:=TheˆžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÜSNNNNNNNNNNNNNNNNNNNNNN”””ū"CurrentPosition= 259; {ditto}  type "Positions= (X,Y); "PositionType= array [Positions] of real;  CharAttributes= (Width,Heighth); "CharAttrType= array [CharAttributes] of real;  var "Chars: ”XžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĢmNNNNNNNNNNNNNNNNNNNNNN”””ū {horizontal labels} "{===== Labels at the top ==================================================} "LabelJustify(HCentered,Top); {label's reference point: top middle} "for Hjust:=Left to Right do begin {horizontal loop} 8YžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3˜NNNNNNNNNNNNNNNNNNNNNN”””ūta+CharTheta; {add the LabelDirection angle}  Dx:=R*cos(Theta); { \ Convert R and the new Theta back }  Dy:=R*sin(Theta); { / to rectangular coodinates. }  inq_ws(CurrentPosition,0,0,2,^ žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žļbNNNNNNNNNNNNNNNNNNNNNN”””ū integer; "Charsize: CharAttrType; "Len,Height: real; {length and height of character string}  Dx,Dy: real;  R,Theta: real; {for rectangular-to-polar conversion}  PacłZžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž™>NNNNNNNNNNNNNNNNNNNNNN”””ū$Strng:=''; {null the string so nothing left over} $strwrite(Strng,1,I,Hjust); {convert enumerated type to string} " move(ord(Hjust),2.4); {move to the appropriate place} $Glabel(Strng); X—žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ©NNNNNNNNNNNNNNNNNNNNNN”””ūPac,Iarray,Position,Error); {get pen position}  if Error=0 then begin "move(Position[X]+Dx,Position[Y]+Dy); {move to the new starting point} "gtext(text);  end {Error=0?}  else writeln('Error',Error:0,' in "Glabel".'); ¦2žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žvõNNNNNNNNNNNNNNNNNNNNNN”””ū: packed array [1..1] of char; { \ These are the } "Iarray: array [1..1] of integer; { \ sundry items } "Position: PositionType; { / needed for the }  Error: šžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖNNNNNNNNNNNNNNNNNNNNNN”””ū {label the string} "end; {for Hjust} "{===== Labels on the left edge ============================================} "LabelJustify(Left,VCentered); {label's reference point: left middle} "for Vjust:=Top downto Bottom do begin {vertical loop-¬žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž UśNNNNNNNNNNNNNNNNNNNNNN”””ū end; {procedure "Glabel"} $page$ {********************************************************************}  begin {body of program "JustProg"}  graphics_init; {…TžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žEÄNNNNNNNNNNNNNNNNNNNNNN”””ū integer; { / call to "inq_ws"}  begin {procedure "Glabel"}  inq_ws(CharSizeCode,0,0,2,Pac,Iarray,Charsize,Error); {get pen position} Č"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žšRNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒģ„X†Ä‡/‰šŠŒqÜŽH“‘ “‹”÷•b—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žE,NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž™ÖNNNNNNNNNNNNNNNNNNNNNN”””ū the "x" at } &move(ord(Hjust)-0.03,ord(Vjust)+0.03); { / the appropriate } &line(ord(Hjust)+0.03,ord(Vjust)-0.03); { / place. } &move(ord(Hjust),ord(Vjust)); {move to label's starting position} &Glabel('TEST'); • žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žļŠNNNNNNNNNNNNNNNNNNNNNN”””ū"seed: integer; {random number seed} "error: integer; {display_init return variable; 0 = ok}  $page$ {********************************************************************}  procedure Alpha(State: DisplaySta|:žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž vNNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žANNNNNNNNNNNNNNNNNNNNNNž”””ū {label the text} $end; {for Vjust} "end; {for Hjust}  end; {ErrorReturn=0?}  graphics_term; {terminate the graphics package}  end. {program "JustProg"} mIžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žÜ»NNNNNNNNNNNNNNNNNNNNNN”””ūtes);  {----------------------------------------------------------------------------}  { This procedure turns the alpha raster on or off. }  {----------------------------------------------------------------------------}  const¼ÖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž #NNNNNNNNNNNNNNNNNNNNNNN”””ū program DrawMdPrg(output); {program name same as file name} import dgl_lib; {access the necessary procedures} const "Polygons= 100; {how many polygons?} "Sides= 3; hāžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3pNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĢ…NNNNNNNNNNNNNNNNNNNNNN”””ū} $Strng:=''; {null the string so nothing left over} $strwrite(Strng,1,I,Vjust); {convert enumerated type to string} $move(-0.9,ord(Vjust)); {move to the appropriate place} $Glabel(Strng); ®QžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž NNNNNNNNNNNNNNNNNNNNNN”””ū{how many sides apiece?} "crt= 3; {device address of graphics raster} "control= 0; {device control word; ignored for CRT} type "short_int= -32768..32767; {16-bit integer} "DrawingModeT`öžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žf#NNNNNNNNNNNNNNNNNNNNNN”””ūZ N^§µØ„n—žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž’“NNNNNNNNNNNNNNNNNNNNNN”””ū {label the string} "end; {for Vjust} "{===== Labels ("TEST") with different justifications ======================} "CharSize(0.06,0.6); {characters a bit bigger} "for Hjust:=Left to Right do begin {horizontal loop} “(žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ‰čNNNNNNNNNNNNNNNNNNNNNNž”””ūype= (Dominant,Erase,Complement); DisplayStates=(Off,On);  var "X: array [0..Polygons-1,1..Sides] of short_int; "Y: array [0..Polygons-1,1..Sides] of short_int; "Dx, Dy: array [1..Sides] of short_int; "Poly, Side: +…žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žUNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖēNNNNNNNNNNNNNNNNNNNNNN”””ū$for Vjust:=Top downto Bottom do begin {vertical loop} &LabelJustify(Hjust,Vjust); {set label justification} &move(ord(Hjust)+0.03,ord(Vjust)+0.03); { \ } &line(ord(Hjust)-0.03,ord(Vjust)-0.03); { \ MakeģTžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŗŁNNNNNNNNNNNNNNNNNNNNNN”””ūshort_int; {loop control variables} "DrawMode: DrawingModeType; "Temp: short_int; {temporary holding area} "New,Previous: short_int; {for efficient use of arrays} ¢žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žģęNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚ƒķ„Y†Å‡1‰œŠŒsŽŽIµ‘ “‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žØNNNNNNNNNNNNNNNNNNNNNN”””ū "AlphaRaster= 1051; {mnemonic better than magic number}  var "AlphaOn: array [1..1] of integer; { \ This is all stuff that } "Rarray: array [1..1] of real; { > is needed by the } "Error: +ŒžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ARNNNNNNNNNNNNNNNNNNNNNNž”””ūs dx} "Dy[Side]:=Rand mod 5+2; {magnitude of this dy} "if Rand>=5000 then Dy[Side]:=-Dy[Side]; {sign of this dy} end; {for side} end; {body of procedure "DefineDeltas"}  $page$ {******************϶žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7NNNNNNNNNNNNNNNNNNNNNN”””ū"Erase: DrawMode[1]:=2; { \ Convert DrawingMode enumerated } "Dominant: DrawMode[1]:=0; { > type into the appropriate } "Complement: DrawMode[1]:=3; { / value for OUTPUT_ESC procedure. }  end; {case}  ŖžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž®™NNNNNNNNNNNNNNNNNNNNNNž”””ū integer; { / "output_esc" procedure. }  begin {procedure "Alpha"}  if State=On then AlphaOn[1]:=1  else AlphaOn[1]:=0;  output_esc(AlphaRaster,1,0,AlphaOn,Rarray,Error); /ežēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŲÅNNNNNNNNNNNNNNNNNNNNNN”””ū**************************************************} begin {body of program "DrawMdPrg"} DrawMode:=Dominant; {specify drawing mode} Seed:=1173; {initialize random number seed},žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?NNNNNNNNNNNNNNNNNNNNNNž”””ū { / }  output_esc(SetDrawingMode,1,0,DrawMode,Rarray,Error); {set it}  if Error<>0 then writeln('Error ',Error:0,' in procedure "DrawingMode".');  end; {proceduń÷žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žūŹNNNNNNNNNNNNNNNNNNNNNN”””ū if Error<>0 then writeln('Error ',Error:0,' in procedure "Alpha".');  end; {procedure "Alpha"}  $page$ {********************************************************************}  procedure DrawingMode(Mode: DrawingModeT­ĖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ėōNNNNNNNNNNNNNNNNNNNNNN”””ū graphics_init; {initialize graphics library} display_init(crt,control,error); {initialize CRT} if error=0 then begin {if no error occurred...} ŪžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žNNNNNNNNNNNNNNNNNNNNNN”””ūre "DrawingMode"} $page$ {********************************************************************} function Rand: short_int;  begin {function "Rand"}  Seed:=((Seed+13579)*39777) mod 10000; {make new seed}  Rand:=Seed; ‡[žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žČūNNNNNNNNNNNNNNNNNNNNNN”””ūype);  {----------------------------------------------------------------------------}  { This procedure selects drawing modes for a monochromatic CRT. }  {----------------------------------------------------------------------------}  const"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¾§NNNNNNNNNNNNNNNNNNNNNN”””ū"set_aspect(511,389); {use the whole screen} "set_window(0,511,0,389); {one user unit=one pixel} "Alpha(Off); {turn off the alpha screen} "DrawingMode(DrawMode); {select specified d®0žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž '0NNNNNNNNNNNNNNNNNNNNNN”””ū {return current value of seed}  end; {function "Rand"} $page$ {********************************************************************} procedure DefineDeltas; var "Side: short_int; ¹łžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žQlNNNNNNNNNNNNNNNNNNNNNN”””ū "SetDrawingMode= 1052; {mnemonic better than magic number}  var "DrawMode: array [1..1] of integer; { \ This is all stuff that } "Rarray: array [1..1] of real; { > is needed by the } "Error: HžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž–NNNNNNNNNNNNNNNNNNNNNN”””ūrawing mode} "for Side:=1 to Sides do begin {define the first polygon} $X[0,Side]:=Rand mod 511; {define X component} $Y[0,Side]:=Rand mod 389; {define Y component} $if Side=1 then { \ *sžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž rcNNNNNNNNNNNNNNNNNNNNNN”””ūbegin {body of procedure "DefineDeltas"} for Side:=1 to Sides do begin {for each vertex} "Dx[Side]:=Rand mod 5+2; {magnitude of this dx} "if Rand>=5000 then Dx[Side]:=-Dx[Side]; {sign of thiR¼žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žb]NNNNNNNNNNNNNNNNNNNNNN”””ū integer; { / "output_esc" procedure. }  begin {procedure "DrawingMode"}  case Mode of { \ } µžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž½ĖNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN@NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒė„V†Į‡,‰—ŠŒnŁŽDÆ‘“‡”ņ•]—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žbµNNNNNNNNNNNNNNNNNNNNNN”””ūrawing mode} $for Side:=1 to Sides do begin {erase the oldest line} &if Side=1 then { \ Move to the } (int_move(X[New,Side],Y[New,Side]) { \ first point, } &else ß žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¾ONNNNNNNNNNNNNNNNNNNNNNž”””ūf Temp<0 then { / screen? } (Dx[Side]:=-Dx[Side]; { / } &X[Poly,Side]:=X[Poly-1,Side]+Dx[Side]; {calculate next x} &Temp:=Y[Poly-1,Side]+Dy[Side]; {avoid recalculation} &if Temp>389 then NRžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žČNNNNNNNNNNNNNNNNNNNNNN”””ū(Dy[Side]:=-Dy[Side]; { / } &Y[New,Side]:=Y[Previous,Side]+Dy[Side]; { / } &if Side=1 then int_move(X[New,Side],Y[New,Side]) { / } &else int_line(X[New,Side],Y[ÓžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Q„NNNNNNNNNNNNNNNNNNNNNN”””ū { / draw to all the } (int_line(X[New,Side],Y[New,Side]); { / rest. } $end; {for Side} $if Sides>2 then {if simple line, don't close polygon} &int_line(X[New,1],Y[New,1]); QžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'ŲNNNNNNNNNNNNNNNNNNNNNN”””ū { \ } (Dy[Side]:=-Dy[Side] { \ Is Y off the } &else if Temp<0 then { / screen? } (Dy[Side]:=-Dy[Side]; { / } &Y[Poly,Side]:=Y[Poly-1,Side]+Dy ÉžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žū"NNNNNNNNNNNNNNNNNNNNNN”””ūNew,Side]); { / } $end; {for side} { / } $if Sides>2 then { / } &int_line(X[New,1],Y[New,1]); {/yūžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ×NNNNNNNNNNNNNNNNNNNNNN”””ū$if DrawMode=Erase then DrawMode:=Dominant; { \ If Erase, toggle state} $DrawingMode(DrawMode); {select specified drawing mode} $for Side:=1 to Sides do begin {\ } &Temp:=X[Previous,Side]+Dx[Side];Ÿ³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žéNNNNNNNNNNNNNNNNNNNNNN”””ū[Side]; {calculate next y} &if Side=1 then int_move(X[Poly,Side],Y[Poly,Side]) {move to first point,} &else int_line(X[Poly,Side],Y[Poly,Side]); {draw to all the rest} $end; {for side} F žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žėNNNNNNNNNNNNNNNNNNNNNN”””ū } &int_move(X[0,Side],Y[0,Side]) { \ Move to the first } $else { > point, and draw to } &int_line(X[0,Side],Y[0,Side]); { / all the rest. } "end; {for side} "if Sides>2 then $int_line(X[0,1]MĮžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 7ęNNNNNNNNNNNNNNNNNNNNNN”””ū { \ } &if Temp>511 then { \ } (Dx[Side]:=-Dx[Side] { \ } &else if Temp<0 then { \ ÕužNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAŗNNNNNNNNNNNNNNNNNNNNNN”””ū$if Sides>2 then {if simple line, don't close polygon} &int_line(X[Poly,1],Y[Poly,1]); "end; {for poly} "New:=0; {start re-use at entry 0} "while true do begin {ad infinitum...} $ifČīžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŲ-NNNNNNNNNNNNNNNNNNNNNN”””ū,Y[0,1]); {if simple line, don't close} "DefineDeltas; {define dx and dy for each vertex} "for Poly:=1 to Polygons-1 do begin {draw all the polygons} :«žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ®qNNNNNNNNNNNNNNNNNNNNNN”””ū } (Dx[Side]:=-Dx[Side]; { \ } &X[New,Side]:=X[Previous,Side]+Dx[Side]; { \ Draw the } &Temp:=Y[Previous,Side]+Dy[Side]; { \ new line } &if Temp>389 thenuķžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žr‹NNNNNNNNNNNNNNNNNNNNNN”””ū New=0 then Previous:=Polygons-1 {start re-using over} $else Previous:=(Previous+1) mod Polygons; {re-use next entry} $if DrawMode=Dominant then DrawMode:=Erase; { \ If Dominant, toggle state} $DrawingMode(DrawMode); {select specified dŗ²žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž~NNNNNNNNNNNNNNNNNNNNNN”””ū$for Side:=1 to Sides do begin {each vertex of each polygon} &Temp:=X[Poly-1,Side]+Dx[Side]; {avoid recalculation} &if Temp>511 then { \ } (Dx[Side]:=-Dx[Side] { \ Is X off the } &else iųĒžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž @NNNNNNNNNNNNNNNNNNNNNN”””ū { \ the same } (Dy[Side]:=-Dy[Side] { / way as } &else if Temp<0 then { / before. } £žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žĖNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚ƒź„U†Ą‡,‰˜ŠŒnŚŽE°‘“ˆ”ó•_—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žpĄNNNNNNNNNNNNNNNNNNNNNN”””ū } $New:=(New+1) mod Polygons; {next one to re-use} "end; {while} end; {error=0?} {end of conditional code} graphics_term; {terminate graphics library} end. {program "DrawMdPršsžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¬:NNNNNNNNNNNNNNNNNNNNNN”””ūimitOrder= (Xmin, Xmax, Ymin,Ymax); "LimitType= array [LimitOrder] of real;  var "Pac: packed array [1..1] of char; { \ These are the sundries } "Iarray: array [1..1] of integer; { \ needed by the call to }  WindowvDžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŚfNNNNNNNNNNNNNNNNNNNNNN”””ū program IsoProg(input,output,keyboard); import dgl_lib, dgl_inq; {access the necessary procedures} const "Crt= 3; {device address of graphics raster} "Control= 0; {device control woŖßžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žCńNNNNNNNNNNNNNNNNNNNNNN”””ūg"} {end of program} B³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 5­NNNNNNNNNNNNNNNNNNNNNN”””ū: LimitType; { / the DGL procedure } "Error: integer; { / "inq_ws". }  begin {body of procedure "Frame"}  inq_ws(WindowLimits,0,0,4,2žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žéWNNNNNNNNNNNNNNNNNNNNNN”””ūrd; ignored for CRT} "Ratio= 1.31362467886; {aspect ratio of Model 236 screen} type "RoundType= (Up,Down,Near); {used by function Round2} var "Error: integer; {display_init return variable; 0 = ok} "XminžgžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¢NNNNNNNNNNNNNNNNNNNNNN”””ūZ 9Ś \N^§µØõPRINTER: <fžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž œNNNNNNNNNNNNNNNNNNNNNN”””ūPac,Iarray,Window,Error);  if Error=0 then begin "move(Window[Xmin],Window[Ymin]); {move to lower left corner} "line(Window[Xmin],Window[Ymax]); {draw to upper left corner} L°žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žłiNNNNNNNNNNNNNNNNNNNNNN”””ū,Xmax,Ymin,Ymax: real; {isotropic units for window} "Character: string[1]; {for continue message} "ClipXmin, ClipXmax: real; {soft clip limits in X} "ClipYmin, ClipYmax: real; {soft clip limits in Y} ć^žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%“NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žSĻNNNNNNNNNNNNNNNNNNNNNN”””ū"line(Window[Xmax],Window[Ymax]); {draw to upper right corner} "line(Window[Xmax],Window[Ymin]); {draw to lower right corner} "line(Window[Xmin],Window[Ymin]); {draw to lower left corner}  end {Error=0?}  else wгžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŹXNNNNNNNNNNNNNNNNNNNNNN”””ūkeyboard: text; {non-echoing input}  $page$ {********************************************************************}  procedure Frame;  {----------------------------------------------------------------------------} ™×žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¼NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž`žNNNNNNNNNNNNNNNNNNNNNN”””ūriteln('Error ',Error:0,' occurred in "Frame"');  end; {procedure "Frame"} {return}  $page$ {********************************************************************}  procedure ClipLimit(Xmin, Xmax, Ymin, Ymax: real);  {-------------------™ažNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Ÿ NNNNNNNNNNNNNNNNNNNNNN”””ū { This procedure draws a frame around the current window limits. }  {----------------------------------------------------------------------------}  const "WindowLimits= 450; {mnemonic better than magic number}  type "Lļ{žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žP£NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNJNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒģ„W†Ć‡.‰šŠŒqŪŽG³‘“‹”÷•c—NNNNNNNNNNNNNNNNNNNNNNNNNN”””žŻNNNNNNNNNNNNNNNNNNNNNN”””ū limits are the real global variables ClipXmin, ClipXmax, ClipYmin, }  { and ClipYmax. These may be defined through the procedure ClipLimit. }  {----------------------------------------------------------------------------}  label "1;  type "s žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žS'NNNNNNNNNNNNNNNNNNNNNN”””ū { / X values passed into } "ClipXmin:=Xmax; { / the procedure. } "ClipXmax:=Xmin; { / }  end; { / ’ģžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%{NNNNNNNNNNNNNNNNNNNNNN”””ū if Out1<>[] then Out:=Out1 " else Out:=Out2; {Out is the non-empty one} "if left in Out then begin {it crosses the left edge} $y:=Y1+(Y2-Y1)*(ClipXmin-X1)/(X2-X1);{adjust value of y appropriately} $x:=ClipXmin; ĻžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ¼ģNNNNNNNNNNNNNNNNNNNNNN”””ūEdges= (Left,Right,Top,Bottom); {possible edges to cross} "OutOfBounds= set of Edges; {set of edges crossed}  var  Out,Out1,Out2:OutOfBounds; "X, Y: real; _˜žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žʰNNNNNNNNNNNNNNNNNNNNNN”””ū }  if YminClipXmax then Out:=[right]; {off right edge?}  if yClipYmax then Out:=Out+[top]; {off the top?}  end; GWžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž¬ŅNNNNNNNNNNNNNNNNNNNNNN”””ū"ClipYmax:=Ymin; { / }  end; { / }  end; {procedure "ClipLimit"}  $page$ {*****************************_gžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5ENNNNNNNNNNNNNNNNNNNNNNž”””ū--------------------------------------------}  begin {procedure "ClipLimit"}  if Xmin[]) or (Out2<>[]) do begin {loop while either point out of range} "if (Out1*Out2)<>[] then goto 1; {if intersection non-null, no line} šžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚~ƒź„U†Ą‡,‰—ŠŒnŚŽF±‘“‰”ō•_—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž žsNNNNNNNNNNNNNNNNNNNNNN”””ūge} "end {right in Out?} "else if bottom in Out then begin {it crosses the bottom edge} $x:=X1+(X2-X1)*(ClipYmin-Y1)/(Y2-Y1);{adjust value of x appropriately} $y:=ClipYmin; {new y is bottom edge} "end {bottom in Out?} "eüžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž "‰NNNNNNNNNNNNNNNNNNNNNN”””ū real; Xmajor, Ymajor: integer; "Xminsize, Yminsize: real); {----------------------------------------------------------------------------} { This procedure draws a grid on the plotting surface, with user-definable } { minor tick size. Parameters are a GžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž TÕNNNNNNNNNNNNNNNNNNNNNNž”””ū"Rounded: real; {temporary holding area}  Negative: boolean; {flag: "It is negative?"}  begin {body of "Round2"}  Negative:=(N<0.0); {is the number negatāažĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ĶBNNNNNNNNNNNNNNNNNNNNNN”””ūlse if top in Out then begin {it crosses the top edge} $x:=X1+(X2-X1)*(ClipYmax-Y1)/(Y2-Y1);{adjust value of x appropriately} $y:=ClipYmax; {new y is top edge} "end; {top in Out?} "if Out=Out1 then begin ܳžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž »NNNNNNNNNNNNNNNNNNNNNN”””ūs follows: } { Xspacing: The distance between tick marks on the X axis. } { Yspacing: The distance between tick marks on the Y axis. } { XlocY: The X-value of the Y-axis. i2žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž gäNNNNNNNNNNNNNNNNNNNNNN”””ūive?}  if Negative then begin "N:=abs(N); {work with a positive number}  if Mode=Up then Mode:=Down {if number is negative, ...} "else if Mode=Down then Mode:=Up; {...reverse up and down}  end;  case Mode ƳžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ˜NNNNNNNNNNNNNNNNNNNNNN”””ū$X1:=x; Y1:=y; Code(x,y,Out1); {redefine first end point} "end {Out=Out1?} "else begin $X2:=x; Y2:=y; Code(x,y,Out2); {redefine second end point} "end; {else begin}  end; {while}  move(x1,y1); {if we get to ź\žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ˆ/NNNNNNNNNNNNNNNNNNNNNN”””ū } { YlocX: The Y-value of the X-axis. } { Xmajor, The number of tick marks to ge before drawing a major tick }  ĮžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž wŚNNNNNNNNNNNNNNNNNNNNNN”””ūof {should we round the number...} "Down: Rounded:=trunc(N/M)*M; {...left on the number line?} "Up: begin *Rounded:=N/M; {...right on the number line?} *if abs(Rounded-round(Rounded))>epsilon then E)žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž « NNNNNNNNNNNNNNNNNNNNNN”””ūthis point, the line...}  line(x2,y2); {...is completely visible, so draw it}  1: end; {procedure "ClipDraw"}  $page$ {********************************************************************}  fuc•žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž Ż|NNNNNNNNNNNNNNNNNNNNNNž”””ū{ Ymajor: mark. If Major=5, every fifth tick mark will be major. } { Xminsize: The length, in world units, of the X minor tick marks. } { Yminsize: The length, in world units, of the Y minor tick marks. } {------------------öŅžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž DėNNNNNNNNNNNNNNNNNNNNNN”””ū,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Rounded)*M; (end; "Near: Rounded:=trunc(N/M+M*0.5)*M; {...to the nearest multiple?}  end; {case}  if Negative then Rounded:=-Rounded; {reinstate the sign} ĆźžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž 2·NNNNNNNNNNNNNNNNNNNNNN”””ūnction Round2(N, M: real; Mode: RoundType): real;  {----------------------------------------------------------------------------}  { This function rounds "N" to the nearest "M", according to "Mode". This }  { function works only when the argument iīžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž īMNNNNNNNNNNNNNNNNNNNNNNž”””ū----------------------------------------------------------} var "X, Y: real; "Xstart,Ystart:real; "XsemiMinsize: real; "YsemiMinsize: real; "Counter: integer; begin {body of procedure "Grid"} XsemiMinsize!©žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž øNNNNNNNNNNNNNNNNNNNNNN”””ū Round2:=Rounded; {assign to function name}  end; {function "Round2"}  $page$ {********************************************************************} procedure Grid(Xspacing,Yspacing,XlocY,YlocX:EežNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž †NNNNNNNNNNNNNNNNNNNNNN”””ūs in the range of MININT..MAXINT. }  {----------------------------------------------------------------------------}  const "epsilon= 1E-10; {roundoff error fudge factor}  var +ģžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ŽNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN§NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž ©€‚€ƒģ„X†Ć‡.‰™ŠŒoŚŽF²‘“‰”õ•`—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!nNNNNNNNNNNNNNNNNNNNNNN”””ūc: packed array [1..1] of char; { \ ...sundry variables } "Iarray: array [1..1] of integer; { \ needed by the "inq_ws" } "Viewport: LimitType; { / procedure, called to get } "Error: inteUžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!Ż”NNNNNNNNNNNNNNNNNNNNNNž”””ūbegin &ClipDraw(X,Y-YSemiMinsize,X,Y+YSemiMinsize); &Y:=Y+Yspacing; $end; {while Y<=ClipYmax} "end; {counter<>0?} "Counter:=(Counter+1) mod Xmajor; "X:=X+Xspacing; end; {while} {===== Draw horizontal minor ticks ===================================°×žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!«ČNNNNNNNNNNNNNNNNNNNNNN”””ū"Wymid:=Wymin+Wyrange*0.5; {Y midpoint in desired window} "WVratio:=abs(Wratio/Vratio); {ratio of aspect ratios} "Multiplier:=Wyrange*0.5*WVratio; {what the Y range must be extended by} "Wymin:=Wymid-Multiplier; {9łžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž! 2_NNNNNNNNNNNNNNNNNNNNNN”””ūger; { / window limits. } "Wxrange, Wyrange: real; {X/Y range in window (world) coordinates}  Vxrange, Vyrange: real; {X/Y range in viewport (virtual) coordinates} žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!DNNNNNNNNNNNNNNNNNNNNNN”””ū=======} Y:=Ystart; Counter:=0; while Y<=ClipYmax do begin "if Counter<>0 then begin $X:=Xstart; $while X<=ClipXmax do begin &ClipDraw(X-XSemiMinsize,Y,X+XSemiMinsize,Y); &X:=X+Xspacing; $end; {while X<=ClipXmax} "end; {counter<>0?} "Counter:=(Co—ÜžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!˜łNNNNNNNNNNNNNNNNNNNNNN”””ūnew minimum Y for window} "Wymax:=Wymid+Multiplier; {new maximum Y for window}  end  else begin {need more room on right and left} "Wxmid:=Wxmin+Wxrange*0.5; {X midpoint in desired window} "VWratio—’žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž! g NNNNNNNNNNNNNNNNNNNNNN”””ū Wratio, Vratio: real; {aspect ratios of window and viewport}  Wxmid, Wymid: real; {X/Y midpoints of window}  WVratio, VWratio: real; {ratios of the ratios}  Multiplier: real; {the amount to multiply the semi«žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!w2NNNNNNNNNNNNNNNNNNNNNN”””ūunter+1) mod Ymajor; "Y:=Y+Yspacing; end; {while} end; {procedure "Grid"} $page$ {********************************************************************} procedure IsotropicWindow(Wxmin,Wxmax,Wymin,Wymax: real); ܎žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!ˆĒNNNNNNNNNNNNNNNNNNNNNN”””ū:=Xminsize*0.5; YsemiMinsize:=Yminsize*0.5; Xstart:=Round2(ClipXmin,Xspacing*Xmajor,Down); {round to next lower major} Ystart:=Round2(ClipYmin,Yspacing*Ymajor,Down); {round to next lower major} {===== Draw vertical major ticks ===========================„qžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž! T=NNNNNNNNNNNNNNNNNNNNNN”””ūrange by}  begin {procedure "IsotropicWindow"}  inq_ws(ViewportLimits,0,0,4,Pac,Iarray,Viewport,Error); {get viewport limits}  if Error<>0 then "writeln('Error ',Error:0,' in procedure "Show".');  Wxrange:=Wxmax-WxmiēŻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!"aNNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  { This procedure allows the user to specify a window which forces the }  { units to be isotropic, i.e., X units are exactly as long as Y units are. }  {----------c%žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!»öNNNNNNNNNNNNNNNNNNNNNN”””ū=================} X:=Xstart; while X<=ClipXmax do begin "ClipDraw(X,ClipYmin,X,ClipYmax); "X:=X+Xspacing*Xmajor; end; {===== Draw horizontal major ticks ==========================================} Y:=Ystart; while Y<=ClipYmax do begin ŒžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž! ĶŖNNNNNNNNNNNNNNNNNNNNNN”””ūn; {range of X in desired window}  Wyrange:=Wymax-Wymin; {range of Y in desired window}  Wratio:=Wxrange/Wyrange; {aspect ratio of desired window}  Vxrange:=Viewport[Vxmax]-Viewport[Vxmin]; {range æčžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!PNNNNNNNNNNNNNNNNNNNNNN”””ū------------------------------------------------------------------}  const "ViewportLimits= 451; {mnemonic better than magic number}  type "LimitOrder= (Vxmin,Vxmax,Vymin,Vymax); "LimitType= array [LimitOrder] of real;  var "Paź(žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž!ī„NNNNNNNNNNNNNNNNNNNNNN”””ū"ClipDraw(ClipXmin,Y,ClipXmax,Y); "Y:=Y+Yspacing*Ymajor; end; {===== Draw vertical minor ticks ============================================} X:=Xstart; Counter:=0; while X<=ClipXmax do begin "if Counter<>0 then begin $Y:=Ystart; $while Y<=ClipYmax do ŁąžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž! ž›NNNNNNNNNNNNNNNNNNNNNN”””ūof X in current viewport}  Vyrange:=Viewport[Vymax]-Viewport[Vymin]; {range of Y in current viewport}  Vratio:=Vxrange/Vyrange; {aspect ratio of viewport}  if abs(Vratio)ClipXmax then Out:=[right]; {off right edge?}  if yClipYmax then Out:=Out+[top]; {off the top?}  end; {nested procedure "Code"}  {----------------------------------------------------------------------------}  begin {body ÷™žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$ BŽNNNNNNNNNNNNNNNNNNNNNN”””ūbody of "Round2"}  Negative:=(N<0.0); {is the number negative?}  if Negative then begin "N:=abs(N); {work with a positive number}  if Mode=Up then Mode:=Down {if number is negative, ...} ¤MžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$½+NNNNNNNNNNNNNNNNNNNNNN”””ūately} $y:=ClipYmax; {new y is top edge} "end; {top in Out?} "if Out=Out1 then begin $X1:=x; Y1:=y; Code(x,y,Out1); {redefine first end point} "end {Out=Out1?} "else begin $X2:=x; Y2:=y; Code(x,y,Out2); {redefinežēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$aŃNNNNNNNNNNNNNNNNNNNNNNž”””ūof procedure "ClipDraw"}  Code(X1,Y1,Out1); {figure status of point 1}  Code(X2,Y2,Out2); {figure status of point 2}  while (Out1<>[]) or (Out2<>[]) do begin {loop while either point out of range} "if (Out1*O_TžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$NNNNNNNNNNNNNNNNNNNNNNž”””ū"else if Mode=Down then Mode:=Up; {...reverse up and down}  end;  case Mode of {should we round the number...} "Down: Rounded:=trunc(N/M)*M; {...left on the number line?} "Up: begin *Rounded:=N/M; ÕĆžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$ ŽNNNNNNNNNNNNNNNNNNNNNNž”””ū second end point} "end; {else begin}  end; {while}  move(x1,y1); {if we get to this point, the line...}  line(x2,y2); {...is completely visible, so draw it} mJžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$ųFNNNNNNNNNNNNNNNNNNNNNNž”””ūut2)<>[] then goto 1; {if intersection non-null, no line}  if Out1<>[] then Out:=Out1 " else Out:=Out2; {Out is the non-empty one} "if left in Out then begin {it crosses the left edge} $y:=Y1+(Y2-Y1)*(ClipXmin̘žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$$¼NNNNNNNNNNNNNNNNNNNNNNž”””ū {...right on the number line?} *if abs(Rounded-round(Rounded))>epsilon then ,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Rounded)*M; (end; "Near: Rounded:=trunc(N/M+M*0.5)*M; {...to the nearest multiple?}  end; {case}  if NegaЇžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$ ŪINNNNNNNNNNNNNNNNNNNNNNž”””ū 1: end; {procedure "ClipDraw"} {return} $page$ {********************************************************************}  function Round2(N, M: real; Mode: RoundType): real;  {---------------------------------------------------------------------]ZžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$ĖwNNNNNNNNNNNNNNNNNNNNNN”””ū-X1)/(X2-X1);{adjust value of y appropriately} $x:=ClipXmin; {new x is left edge} "end {left in Out?} "else if right in Out then begin {it crosses right edge} ņ}žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$įNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž$©€‚~ƒé„T†æ‡+‰–ŠŒmŲŽDÆ‘“…”ń•NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%˟NNNNNNNNNNNNNNNNNNNNNN”””ū*************************************************************}  procedure YaxisClip(Spacing, Location: real; Major: integer; "Majsize, Minsize: real);  {----------------------------------------------------------------------------}  { This procedure drā žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%eNNNNNNNNNNNNNNNNNNNNNN”””ūon: The Y-value of the X-axis. }  { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth tick mark will be major. }  { Majsize: The leng!!žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%a9NNNNNNNNNNNNNNNNNNNNNN”””ū$ClipDraw(Location-SemiMajsize,Y,Location+SemiMajsize,Y) "else $ClipDraw(Location-SemiMinsize,Y,Location+SemiMinsize,Y);  Counter:=(Counter+1) mod Major;  Y:=Y+Spacing;  end; {while}  end; {procedure "YaxisCli³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž% ų®NNNNNNNNNNNNNNNNNNNNNN”””ūaws an Y-axis at any intersection point on the plotting }  { surface. Parameters are as follows: }  { Spacing: The distance between tick marks on the axis. } œBžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%ŽņNNNNNNNNNNNNNNNNNNNNNN”””ūth, in world units, of the major tick marks. }  { Minsize: The length, in world units, of the minor tick marks. }  {----------------------------------------------------------------------------}  var "X: real; "SemiMajsiJ|žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%RNNNNNNNNNNNNNNNNNNNNNN”””ūp"} $page$ {********************************************************************} procedure Grid(Xspacing,Yspacing,XlocY,YlocX: real; Xmajor, Ymajor: integer; "Xminsize, Yminsize: real); {------------------------------------------------------------------½MžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž% ­żNNNNNNNNNNNNNNNNNNNNNN”””ū { Location: The X-value of the Y-axis. }  { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth tick mark will be major. }  { MajsizlžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%½ĆNNNNNNNNNNNNNNNNNNNNNN”””ūze: real;  SemiMinsize: real; "Counter: integer; {keeps track of when to do major ticks} begin {body of procedure "XaxisClip"}  SemiMajsize:=MajSize*0.5;  SemiMinsize:=MinSize*0.5; H«žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%B6NNNNNNNNNNNNNNNNNNNNNN”””ūtive then Rounded:=-Rounded; {reinstate the sign}  Round2:=Rounded; {assign to function name}  end; {function "Round2"}  $page$ {*************************************************************“ĻžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž% žĢNNNNNNNNNNNNNNNNNNNNNN”””ūe: The length, in world units, of the major tick marks. }  { Minsize: The length, in world units, of the minor tick marks. }  {----------------------------------------------------------------------------}  var "Y: realŹWžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%čNNNNNNNNNNNNNNNNNNNNNNž”””ū Counter:=0; {start with a major tick}  ClipDraw(ClipXmin,Location,ClipXmax,Location);  X:=Round2(ClipXmin,Spacing*Major,Down); {round to next lower major}  while X<=ClipXmax do begin "if Counter=0 then $ClipDraw(X,LocatioQ1žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%qNNNNNNNNNNNNNNNNNNNNNN”””ū*******}  procedure XaxisClip(Spacing, Location: real; Major: integer; "Majsize,Minsize: real);  {----------------------------------------------------------------------------} ‚žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž% [NNNNNNNNNNNNNNNNNNNNNN”””ū;  SemiMinsize: real; "SemiMajsize: real; "Counter: integer; {keeps track of when to do major ticks}  begin {body of procedure "YaxisClip"}  SemiMajsize:=Majsize*0.5;  SemiMinsize:=Minsize*0.5AžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%Ū”NNNNNNNNNNNNNNNNNNNNNN”””ūn-SemiMajsize,X,Location+SemiMajsize) "else $ClipDraw(X,Location-SemiMinsize,X,Location+SemiMinsize);  Counter:=(Counter+1) mod Major;  X:=X+Spacing;  end; {while}  end; {procedure "XaxisClip"} $page$ {******* ½žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%$TNNNNNNNNNNNNNNNNNNNNNNž”””ū { This procedure draws an X-axis at any intersection point on the plotting }  { surface. Parameters are as follows: }  { Spacing: The distance between tick marks on the axis. }  { Locatiø™žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž% 4jNNNNNNNNNNNNNNNNNNNNNN”””ū;  Counter:=0; {start with a major tick}  ClipDraw(Location,ClipYmin,Location,ClipYmax);  Y:=Round2(ClipYmin,Spacing*Major,Down); {round to next lower major}  while Y<=ClipYmax do begin "if Counter=0 then YžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž%bUNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””©€‚ƒķ„X†Ä‡0‰›ŠŒsßŽK·‘#“”ū•g—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&ŁźNNNNNNNNNNNNNNNNNNNNNNž”””ū----------} { This procedure draws a grid on the plotting surface, with user-definable } { minor tick size. Parameters are as follows: } { Xspacing: The distance between tick marks on the X axis. } { Ys›IžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž& NNNNNNNNNNNNNNNNNNNNNN”””ūorReturn);  if ErrorReturn=0 then begin "{=== Do program setup =====================================================} "Ratio:=511/389; "set_aspect(Ratio,1);  if Ratio>1 then begin $VirtXmax:=1; $VirtYmax:=1/Ratio; "end "else begin $VirtXmax:=RaĘäžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&sLNNNNNNNNNNNNNNNNNNNNNNž”””ū"X:=X+Xspacing*Xmajor; end; {===== Draw horizontal major ticks ==========================================} Y:=Ystart; while Y<=ClipYmax do begin "ClipDraw(ClipXmin,Y,ClipXmax,Y); "Y:=Y+Yspacing*Ymajor; end; {===== Draw vertical minor ticks =============£]žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&źŪNNNNNNNNNNNNNNNNNNNNNN”””ūpacing: The distance between tick marks on the Y axis. } { XlocY: The X-value of the Y-axis. } { YlocX: The Y-value of the X-axis. } ĒežNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž& œ‡NNNNNNNNNNNNNNNNNNNNNNž”””ūtio; $VirtYmax:=1; "end; "{=== Upper left viewport ==================================================} "LeftEdge:=0; "RightEdge:=0.48*VirtXmax; "BottomEdge:=0.52*VirtYmax; "TopEdge:=VirtYmax;  set_viewport(LeftEdge,RightEdge,BottomEdge,TopEdge); ¢§žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&@}NNNNNNNNNNNNNNNNNNNNNN”””ū===============================} X:=Xstart; Counter:=0; while X<=ClipXmax do begin "if Counter<>0 then begin $Y:=Ystart; $while Y<=ClipYmax do begin &ClipDraw(X,Y-YSemiMinsize,X,Y+YSemiMinsize); &Y:=Y+Yspacing; $end; {while Y<=ClipYmax} "end; {cou‘žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&æˆNNNNNNNNNNNNNNNNNNNNNN”””ū{ Xmin,Xmax: The left and right ends of the X-axis, respectively. } { Xmajor, The number of tick marks to ge before drawing a major tick } { Ymajor: mark. If Major=5, every fifth tick mark will be major. } { Xminsize: TheMāžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž& ƶNNNNNNNNNNNNNNNNNNNNNN”””ū"set_window(0,80,0,40); "Frame; "ClipLimit(0,80,0,40); "XaxisClip(1,0,5,2,1); "YaxisClip(1,0,5,2,1); "{=== Upper right viewport =================================================} "LeftEdge:=0.52*VirtXmax; "RightEdge:=VirtXmax; ōųžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&PCNNNNNNNNNNNNNNNNNNNNNNž”””ūnter<>0?} "Counter:=(Counter+1) mod Xmajor; "X:=X+Xspacing; end; {while} {===== Draw horizontal minor ticks ==========================================} Y:=Ystart; Counter:=0; while Y<=ClipYmax do begin "if Counter<>0 then begin $X:=Xstart; $while X<=& žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&Œ¹NNNNNNNNNNNNNNNNNNNNNNž”””ū length, in world units, of the X minor tick marks. } { Yminsize: The length, in world units, of the Y minor tick marks. } {----------------------------------------------------------------------------} var "X, Y: real; "Xstart,YstбžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&śåNNNNNNNNNNNNNNNNNNNNNNž”””ū"BottomEdge:=0.52*VirtYmax; "TopEdge:=VirtYmax;  set_viewport(LeftEdge,RightEdge,BottomEdge,TopEdge); "set_window(0,80,0,40); "Frame; "ClipLimit(0,80,0,40); "Grid(5,5,0,0,4,4,1,0.8); "{=== Lower left viewport =====================================ß®žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž& crNNNNNNNNNNNNNNNNNNNNNN”””ūClipXmax do begin &ClipDraw(X-XSemiMinsize,Y,X+XSemiMinsize,Y); &X:=X+Xspacing; $end; {while X<=ClipXmax} "end; {counter<>0?} "Counter:=(Counter+1) mod Ymajor; "Y:=Y+Yspacing; end; {while} ū=žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&.NNNNNNNNNNNNNNNNNNNNNNž”””ūart:real; "XsemiMinsize: real; "YsemiMinsize: real; "Counter: integer; begin {body of procedure "Grid"} XsemiMinsize:=Xminsize*0.5; YsemiMinsize:=Yminsize*0.5; Xstart:=Round2(ClipXmin,Xspacing*Xmajor,Down); {roundč?žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&ÉŌNNNNNNNNNNNNNNNNNNNNNNž”””ū=============} "LeftEdge:=0; "RightEdge:=0.48*VirtXmax; "BottomEdge:=0; "TopEdge:=0.48*VirtYmax;  set_viewport(LeftEdge,RightEdge,BottomEdge,TopEdge); "set_window(0,80,0,40); "Frame; "ClipLimit(0,80,0,40); "Grid(2,1,0,0,10,10,0.001,0.001); "{==1ŚžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž& 6!NNNNNNNNNNNNNNNNNNNNNN”””ūend; {procedure "Grid"} $page$ {********************************************************************}  begin {program "AxesGrid"}  graphics_init;  display_init(CrtAddr,ControlWord,Err¾XžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&&NNNNNNNNNNNNNNNNNNNNNN”””ū to next lower major} Ystart:=Round2(ClipYmin,Yspacing*Ymajor,Down); {round to next lower major} {===== Draw vertical major ticks ============================================} X:=Xstart; while X<=ClipXmax do begin "ClipDraw(X,ClipYmin,X,ClipYmax); ņ\žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&ł‰NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNKNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž&©€‚€ƒė„W†Ć‡/‰›ŠŒqÜŽG³‘“‰”õ•`—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'&÷NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'ś NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'ŒQNNNNNNNNNNNNNNNNNNNNNN”””ū $page$ {********************************************************************} function Log10(X: real): real;  {----------------------------------------------------------------------------}  { This function returns the logarithm to the base ten of a n¹ĖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž' ĘNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'cšNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'æ`NNNNNNNNNNNNNNNNNNNNNN”””ūumber. }  {----------------------------------------------------------------------------}  const "Log_10= 2.30258509299; {log to the base e of 10}  begin {function "Log10"}  Log10:=ln(X)/Log_10;LĒžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž' @•NNNNNNNNNNNNNNNNNNNNNN”””ūprogram LogPlot(keyboard,output); import dgl_lib; const "Xmin= -4; { \ } "Xmax= 2; { \ Decade minima } "Ymin= 0; { / and maxima. } "åPžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'P«NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'Æ^NNNNNNNNNNNNNNNNNNNNNN”””ū= Lower right viewport =================================================} "LeftEdge:=0.52*VirtXmax;; "RightEdge:=VirtXmax; "BottomEdge:=0; "TopEdge:=0.48*VirtYmax;;  set_viewport(LeftEdge,RightEdge,BottomEdge,TopEdge); "set_window(0,80,0,40); "FraVWžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž' s¤NNNNNNNNNNNNNNNNNNNNNN”””ūYmax= 3; { / } "Crt= 3; {device address of graphics raster} "Control= 0; {device control word; ignored for CRT} type "RDataType= array [1..15] of/^žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'ųNNNNNNNNNNNNNNNNNNNNNN”””ūZ N^§µØ„ŠŠžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'œoNNNNNNNNNNNNNNNNNNNNNN”””ūme; "ClipLimit(0,80,0,40); "XaxisClip(1,0,5,2,1); "YaxisClip(1,0,5,2,1); "XaxisClip(1,40,5,2,1); "YaxisClip(1,80,5,2,1); "Grid(10,10,0,0,1,1,2,2);  end; {ErrorReturn=0?}  graphics_term; gžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž' ź3NNNNNNNNNNNNNNNNNNNNNN”””ū real;  const "Xvalues= RDataType[0.0003, 0.0009, 0.004, 0.008, 0.01, 0.07, 0.22, 0.5, :1.2, 2.6, 8.9, 18.6, 34, 56, 97];  Yvalues= RDataType[1.1, 4.5, 13.38, 45.9, 60.33, 130.7, 346, 690.4, :899, 933, 903, 841, 720, 505, 390];  var "ErržNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'6ÉNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž'ÉŻNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(ā'NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(ŅNNNNNNNNNNNNNNNNNNNNNNž”””ū"for Decade:=Xmin to Xmax do begin {one decade equals one mantissa cycle} $if Decade=Xmax then UpperLimit:=1 $else UpperLimit:=9; $for Units:=1 to UpperLimit do begin {do 2-9 if not last cycle} &X:=Decade+Log10(Units); &move(X,Ymin); &li„(žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(  ģNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(ņNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(.ćNNNNNNNNNNNNNNNNNNNNNN”””ūne(X,Ymax); $end; {for units} "end; {for decade} "{===== Draw and label logarithmic Y-axis grid =============================} "for Decade:=Ymin to Ymax do begin {one decade equals one mantissa cycle} $if Decade=Ymax then UpperLimit:=1 $else Up€žžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(XæNNNNNNNNNNNNNNNNNNNNNN”””ū$sysprog on$ {so we can define array addresses} program GstorProg(keyboard,output); {program name same as file name} label 1; import dgl_lib, dgl_inq; {access the necessary procedures}  const "Crt= 3ó+žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž( Į(NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(·tNNNNNNNNNNNNNNNNNNNNNN”””ūperLimit:=9; $for Units:=1 to UpperLimit do begin {do 2-9 if not last cycle} &Y:=Decade+Log10(Units); &move(Xmin,Y); &line(Xmax,Y); $end; {for units} "end; {for decade} "{===== Draw the logarithmic data curve ==============================©+žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(kŽNNNNNNNNNNNNNNNNNNNNNN”””ū; {device address of graphics raster} "Control= 0; {device control word; ignored for CRT} "GRasterAddr= hex('530000'); {address of graphics memory} "GRasterSize= 6240; {32-bit iś„žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž( ”{NNNNNNNNNNNNNNNNNNNNNNž”””ūZ ]M \N^§µØõPRINTER: <×lžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž(„ENNNNNNNNNNNNNNNNNNNNNN”””ū======} for I:=1 to 15 do begin $if I=1 then move(Log10(XValues[I]),Log10(Yvalues[I])) $else line(Log10(XValues[I]),Log10(Yvalues[I]));  end; {for i}  end; {Error=0?} {end of conditional code} ©žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž([ÓNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž©€‚€ƒģ„W†Ć‡.‰™ŠŒpŪŽG²‘“‰”ō•_—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)„­NNNNNNNNNNNNNNNNNNNNNN”””ūio: real);  {----------------------------------------------------------------------------}  { This procedure defines character cell size and the puts the Width and }  { Height values into global variables for later use. The arguments passed }  ‡žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)XWNNNNNNNNNNNNNNNNNNNNNN”””ūvariables} "Y,Dy: real; {y-axis variables} "Ymin,Ymax,Yrange: integer; {more y-axis variables} "I: integer; {utility variable} "Strng: Str255; {another utility variabgšžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž). NNNNNNNNNNNNNNNNNNNNNNž”””ū end; {procedure "CharSize"} $page$ {********************************************************************}  procedure LabelDirection(Direction: real; Units: AngType);  {------------------------------------------------>ŁžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) ·œNNNNNNNNNNNNNNNNNNNNNN”””ū{ in are the height of the character cell in VIRTUAL coordinates, and the }  { aspect ratio of the character cell. The values for the window limits }  { may be anything; they are taken into account and do not affect the size } cžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)ĮĄNNNNNNNNNNNNNNNNNNNNNN”””ūle} "Character: char; {and yet another} "Temperature: real; {need a larger range than an integer} "OldX, OldY: real; {last point drawn to} "GRaster[GRasterAddr]: GRasterType; {actual graphi¦ńžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž):NNNNNNNNNNNNNNNNNNNNNN”””ū----------------------------}  { This procedure is used in conjunction with LabelOrigin, CharSize and }  { Glabel. It sets the labelling direction to be used, and places the }  { direction into a global variable so Glabel can use it. ¶±žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) āĻNNNNNNNNNNNNNNNNNNNNNN”””ū { of the characters, since they are defined in virtual coordinates. This }  { procedure, along with Lorg and Ldir, define global variables for use by }  { Glabel. }  {----------oņžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)ņńNNNNNNNNNNNNNNNNNNNNNN”””ūcs raster} "Screen: GRasterType; {user's screen image} "keyboard: text; {allow GETs from the keyboard} "CharWidth,CharHeight: real; { \ These are global variables } NLžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) NNNNNNNNNNNNNNNNNNNNNN”””ūntegers in graphics raster} "Ratio= 1.31362467886; {aspect ratio of the Model 36 CRT} type "GRasterType= array [1..GRasterSize] of integer; "HJustifyType= (Left,HCentered,Right); "VJustifyType= (Bottom,VCentered,Top); "DisplayStates=(CnžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) ŃžNNNNNNNNNNNNNNNNNNNNNN”””ū------------------------------------------------------------------}  var "Width: real; {temporary spot for width} "X0, Y0: real; {0,0 (virtual) in world} "X1, Y1: real; {1,1 (virtĮ(žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)§¢NNNNNNNNNNNNNNNNNNNNNN”””ū"HJustification: HJustifyType; { \ used by the CharSize/ } "VJustification: VJustifyType; { / LabelDirection/LabelJustify/ } "CharTheta: real; { / Glabel series of procedures. } "ClipXmin, ClipXmaFūžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)>5NNNNNNNNNNNNNNNNNNNNNN”””ūOff,On); "AngType= (Deg,Rad,Grad); {used by procedure Ldir} "RoundType= (Up, Down, Near); {used by function Round2} "Str255= string[255]; {used by procedure Glabel}  var ŖČžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) HiNNNNNNNNNNNNNNNNNNNNNN”””ūual) in world}  begin {body of procedure "CharSize"}  ConvertVirtualToWorld(0,0,X0,Y0); {convert 0,0 in virtual to world}  ConvertVirtualToWorld(1,1,X1,Y1); {convert 1,1 in virtual to world}  Height:=Height2 žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)”“NNNNNNNNNNNNNNNNNNNNNN”””ūx: real; {soft clip limits in x} "ClipYmin, ClipYmax: real; {soft clip limits in y} $include 'DGLPRG:ConvVtoW'$  $page$ {********************************************************************}  procedure CharSize(Height, AspectRatīƒžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)kfNNNNNNNNNNNNNNNNNNNNNN”””ū"Error: integer; {display_init return variable; 0 = ok} "Decade, Units: integer; {for logarithmic X-axis} "X,Dx: real; {x-axis variables} "Xmin,Xmax,Xrange: integer; {more x-axis l–žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž) {XNNNNNNNNNNNNNNNNNNNNNN”””ū*(Y1-Y0); {convert height in virtual to world}  Width:=Height*AspectRatio*(X1-X0)/(Y1-Y0); {convert width in virtual to world}  set_char_size(Width,Height); {invoke the parameters} Ū³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)-gNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž)©€‚ƒģ„X†Ć‡.‰™ŠŒpŪŽF±‘“ˆ”ó•_—NNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*–ŲNNNNNNNNNNNNNNNNNNNNNN”””ū }  {----------------------------------------------------------------------------}  const "Deg_per_rad= 57.2957795131; {180/pi: for converting degrees to radians} "Grad_per_rad= 63.6619772368; {200/pi: for converting grads to radians} Ę­žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž* J"NNNNNNNNNNNNNNNNNNNNNNž”””ūe"), and the current label justification (set by procedure }  { "LabelJustify"). }  {----------------------------------------------------------------------------}  const "CharSizeCode= 4žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*<~NNNNNNNNNNNNNNNNNNNNNN”””ū end; {procedure "LabelJustify"} $page$ {********************************************************************}  function Atan(Y, X: real): real;  {----------------------------------------------------------------------VžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*„éNNNNNNNNNNNNNNNNNNNNNN”””ū begin {procedure "LabelDirection"}  case Units of "Deg: Direction:=Direction/Deg_per_rad; {degrees to radians} "Rad: ; {correct units already} y3žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž* ÓµNNNNNNNNNNNNNNNNNNNNNN”””ū 250; {mnemonic better than magic number} "CurrentPosition= 259; {ditto}  type "Positions= (X,Y); "PositionType= array [Positions] of real;  CharAttributes= (Width,Heighth); "CharAttrType= ŃXžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*ONNNNNNNNNNNNNNNNNNNNNN”””ū------}  { This function returns the value of the arctangent of Y/X, placing it }  { in the correct quadrant. If Y and X are both zero, the result is zero. }  {----------------------------------------------------------------------------}  cona%žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*šŗNNNNNNNNNNNNNNNNNNNNNN”””ū"Grad: Direction:=Direction/Grad_per_rad; {grads to radians}  end; {case}  CharTheta:=Direction; {put into a global variable}  set_text_rot(cos(CharTheta),sin(CharTheta)); {invoke the new text direction}  end; žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž* ą„NNNNNNNNNNNNNNNNNNNNNN”””ū array [CharAttributes] of real;  var "Chars: integer; "Charsize: CharAttrType; "Len,Height: real; {length and height of character string}  Dx,Dy: real; g=žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*qNNNNNNNNNNNNNNNNNNNNNN”””ūst "Pi= 3.14159265359; {pi}  begin {function "Atan"}  if X=0.0 then Atan:=(Pi/2+Pi*ord(Y<0.0))*ord(Y<>0.0)  else Atan:=arctan(Y/X)+Pi*ord(X<0.0)+2*Pi*ord((X>0.0) and (Y<0.0));  end; Ć žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*ƋNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure "LabelDirection"} $page$ {********************************************************************}  procedure LabelJustify(HJust: HJustifyType; VJust: VJustifyType);  {-----------------------------------------------------------<*žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*µ×NNNNNNNNNNNNNNNNNNNNNN”””ū R,Theta: real; {for rectangular-to-polar conversion}  Pac: packed array [1..1] of char; { \ These are the } "Iarray: array [1..1] of integer; { \ sundry items } "Position: ¤7žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž* ,@NNNNNNNNNNNNNNNNNNNNNNž”””ū {function "Atan"} $page$ {********************************************************************}  procedure Glabel(Text: Str255);  {----------------------------------------------------------------------------} ežNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*ZNNNNNNNNNNNNNNNNNNNNNN”””ū-----------------}  { This procedure is used in conjunction with procedures CharSize, }  { LabelDirection, and Glabel. This just puts a value into global }  { variables which will be subsequently used by Glabel. ų6žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*†ęNNNNNNNNNNNNNNNNNNNNNN”””ū PositionType; { / needed for the }  Error: integer; { / call to "inq_ws"}  begin {procedure "Glabel"}  inq_ws(CharSizeCode,0,0,2,Pac,Iarray,Charsi;HžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž* yNNNNNNNNNNNNNNNNNNNNNN”””ū { This procedure labels a string of text at the current pen position. }  { It takes into account the current label direction (set by procedure }  { "LabelDirection", the current character size (set by procedure }  { "CharSizqTžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*i-NNNNNNNNNNNNNNNNNNNNNN”””ū }  {----------------------------------------------------------------------------}  begin {procedure "LabelJustify"}  HJustification:=HJust;  VJustification:=VJust; āžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž*¶»NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖ€‚€ƒģ„X†Ć‡/‰›ŠŒqŻŽH“‘“Š”ö•a—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+iÅNNNNNNNNNNNNNNNNNNNNNN”””ū of a plot. }  {----------------------------------------------------------------------------}  begin {procedure "XaxisTitle"}  CharSize(0.04,0.6);  LabelDirection(0,Deg);  LabelJustify(HCentered,Bottom);  move(X,•žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+µ?NNNNNNNNNNNNNNNNNNNNNNž”””ū { / to rectangular coodinates. }  inq_ws(CurrentPosition,0,0,2,Pac,Iarray,Position,Error); {get pen position}  if Error=0 then begin "move(Position[X]+Dx,Position[Y]+Dy); {move to the new starting point} "gtext(text);āžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ĆcNNNNNNNNNNNNNNNNNNNNNN”””ū if Xmin0 then writeln('Error',Error:0,' in "Glabel".');  Chars:=strlen(text);  Len:=Charsize[Width]*(7*Chars+2*(Chars-1))/9; {length minus inter-char gap}  Height:=Charsize[Heighth]*8/15; ƒ•žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ <–NNNNNNNNNNNNNNNNNNNNNN”””ū {procedure "YaxisTitle"}  CharSize(0.04,0.6);  LabelDirection(90,Deg);  LabelJustify(HCentered,Top);  move(X,Y);  Glabel(Title); end; {procedure "YaxisTitle"}  $page$ {*****************SžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+JŹNNNNNNNNNNNNNNNNNNNNNN”””ū begin {procedure "MainTitle"}  CharSize(0.06,0.6);  LabelDirection(0,Deg);  LabelJustify(HCentered,Top);  move(X,Y);  Glabel(Title);  end; {procedure "MainTitle"} $page$ {*******&(žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+Ó]NNNNNNNNNNNNNNNNNNNNNNž”””ū {height minus inter-line gap}  Dx:=Len*(-ord(HJustification)/2);  Dy:=Height*(-ord(VJustification)/2);  R:=sqrt(Dx*Dx+Dy*Dy); { \ Convert to polar coordinates so } 3YžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ „NNNNNNNNNNNNNNNNNNNNNN”””ū***************************************************}  procedure ClipLimit(Xmin, Xmax, Ymin, Ymax: real);  {----------------------------------------------------------------------------}  { This procedure defines the four global variables which specify wcžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+yūNNNNNNNNNNNNNNNNNNNNNN”””ū*************************************************************} procedure XAxisTitle(X, Y: real; Title: Str255);  {----------------------------------------------------------------------------}  { This procedure writes a small label for the X-axis titleVžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+†NNNNNNNNNNNNNNNNNNNNNN”””ū Theta:=Atan(Dy,Dx); { / rotation is easy. }  Theta:=Theta+CharTheta; {add the LabelDirection angle}  Dx:=R*cos(Theta); { \ Convert R and the new Theta back }  Dy:=R*sin(Theta);%“žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ –0NNNNNNNNNNNNNNNNNNNNNN”””ūhere the }  { soft clip limits are. }  {----------------------------------------------------------------------------}  begin XšžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+ĄNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž+Ŗ€‚‚ƒķ„Y†Å‡0‰œŠŒtßŽJ¶‘"“”ų•d—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,±ANNNNNNNNNNNNNNNNNNNNNNž”””ū }  end; { / }  if YminClipXmax then Out:=[right]; {off right edge?}  if yClipYmax then Out:=Out+[top]; {off the top?}  end; GWžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,×#NNNNNNNNNNNNNNNNNNNNNN”””ū"ClipYmin:=Ymax; { / the procedure. } "ClipYmax:=Ymin; { / }  end; { / }  end;  $page$ {**************š8žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž, ĒNNNNNNNNNNNNNNNNNNNNNN”””ūlse if top in Out then begin {it crosses the top edge} $x:=X1+(X2-X1)*(ClipYmax-Y1)/(Y2-Y1);{adjust value of x appropriately} $y:=ClipYmax; {new y is top edge} "end; {top in Out?} "if Out=Out1 then begin ܳžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,8čNNNNNNNNNNNNNNNNNNNNNNž”””ū {nested procedure "Code"}  {----------------------------------------------------------------------------}  begin {body of procedure "ClipDraw"}  Code(X1,Y1,Out1); {figurī‚žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,äNNNNNNNNNNNNNNNNNNNNNN”””ū******************************************************}  procedure ClipDraw(X1, Y1, X2, Y2: real);  {----------------------------------------------------------------------------}  { This procedure takes the endpoints of a line, and clips it. The sofU2žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,’NNNNNNNNNNNNNNNNNNNNNNN”””ū$X1:=x; Y1:=y; Code(x,y,Out1); {redefine first end point} "end {Out=Out1?} "else begin $X2:=x; Y2:=y; Code(x,y,Out2); {redefine second end point} "end; {else begin}  end; {while}  move(x1,y1); {if we get to ź\žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,  ŁNNNNNNNNNNNNNNNNNNNNNNž”””ūe status of point 1}  Code(X2,Y2,Out2); {figure status of point 2}  while (Out1<>[]) or (Out2<>[]) do begin {loop while either point out of range} "if (Out1*Out2)<>[] then goto 1; {if intersection non-null, no line} šžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,}…NNNNNNNNNNNNNNNNNNNNNNž”””ūt }  { clip limits are the real global variables ClipXmin, ClipXmax, ClipYmin, }  { and ClipYmax. These may be defined through the procedure ClipLimit. }  {----------------------------------------------------------------------------}  label\/žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,”NNNNNNNNNNNNNNNNNNNNNN”””ūthis point, the line...}  line(x2,y2); {...is completely visible, so draw it}  1: end; {procedure "ClipDraw"} {return}  $page$ {********************************************************************}  function Round2(<āžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž, ^ŠNNNNNNNNNNNNNNNNNNNNNN”””ū if Out1<>[] then Out:=Out1 " else Out:=Out2; {Out is the non-empty one} "if left in Out then begin {it crosses the left edge} $y:=Y1+(Y2-Y1)*(ClipXmin-X1)/(X2-X1);{adjust value of y appropriately} $x:=ClipXmin; ĻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,N“NNNNNNNNNNNNNNNNNNNNNN”””ū "1;  type "Edges= (Left,Right,Top,Bottom); {possible edges to cross} "OutOfBounds= set of Edges; {set of edges crossed}  var  Out,Out1,Out2:OutOfBounds; "X, Y: real; jמNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,‘"NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž,Ŗ€‚ƒķ„X†Ä‡/‰›ŠŒqŪŽF²‘“‰”õ•NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-N\NNNNNNNNNNNNNNNNNNNNNN”””ūen tick marks on the axis. }  { Location: The X-value of the Y-axis. }  { Major: The number of tick marks to ge before drawing a major tick }  { mark. If Major=5, every fifth T4žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-’¦NNNNNNNNNNNNNNNNNNNNNNž”””ū {work with a positive number}  if Mode=Up then Mode:=Down {if number is negative, ...} "else if Mode=Down then Mode:=Up; {...reverse up and down}  end;  case Mode of {should we round the number...} "D7#žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-äśNNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  { This procedure turns the alpha raster on or off. }  {----------------------------------------------------------------------------}  const "Alp7מNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- }mNNNNNNNNNNNNNNNNNNNNNN”””ūtick mark will be major. }  { Majsize: The length, in world units, of the major tick marks. }  { Minsize: The length, in world units, of the minor tick marks. } ō’žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- 1NNNNNNNNNNNNNNNNNNNNNN”””ūown: Rounded:=trunc(N/M)*M; {...left on the number line?} "Up: begin *Rounded:=N/M; {...right on the number line?} *if abs(Rounded-round(Rounded))>epsilon then ,Rounded:=(trunc(Rounded)+1.0)*M *else ,Rounded:=trunc(Roundedõ†žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-×ĖNNNNNNNNNNNNNNNNNNNNNN”””ūhaRaster= 1051; {mnemonic better than magic number}  var "AlphaOn: array [1..1] of integer; { \ This is all stuff that } "Rarray: array [1..1] of real; { > is needed by the } "Error: int¶ĶžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- (>NNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  var "Y: real;  SemiMinsize: real; "SemiMajsize: real; "Counter: integer; {keeps track of when to do major ticks}  begin ‘ĄžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-8NNNNNNNNNNNNNNNNNNNNNN”””ū)*M; (end; "Near: Rounded:=trunc(N/M+M*0.5)*M; {...to the nearest multiple?}  end; {case}  if Negative then Rounded:=-Rounded; {reinstate the sign}  Round2:=Rounded; {assign to function name} čżžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-ĒõNNNNNNNNNNNNNNNNNNNNNN”””ūN, M: real; Mode: RoundType): real;  {----------------------------------------------------------------------------}  { This function rounds "N" to the nearest "M", according to "Mode". This }  { function works only when the argument is in the range…ĶžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- NNNNNNNNNNNNNNNNNNNNNN”””ū {body of procedure "YaxisClip"}  SemiMajsize:=Majsize*0.5;  SemiMinsize:=Minsize*0.5;  Counter:=0; {start with a major tick}  ClipDraw(Location,ClipYmin,Location,ClipYmax);  Y:=Round2(ClipYmin,Spacing*MóNžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-mSNNNNNNNNNNNNNNNNNNNNNN”””ū end; {function "Round2"}  $page$ {********************************************************************}  procedure YaxisClip(Spacing, Location: real; Major: integer; "Majsize, Minsize: real);  {--------------------žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-ōÄNNNNNNNNNNNNNNNNNNNNNNž”””ū of MININT..MAXINT. }  {----------------------------------------------------------------------------}  const "epsilon= 1E-10; {roundoff error fudge factor}  var "Rounded: real; {temporary holding area} E¢žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- ‚˜NNNNNNNNNNNNNNNNNNNNNN”””ūajor,Down); {round to next lower major}  while Y<=ClipYmax do begin "if Counter=0 then $ClipDraw(Location-SemiMajsize,Y,Location+SemiMajsize,Y) "else $ClipDraw(Location-SemiMinsize,Y,Location+SemiMinsize,Y);  Counter:=(Counter+1) mod Major;  Y:=÷žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-^bNNNNNNNNNNNNNNNNNNNNNN”””ū--------------------------------------------------------}  { This procedure draws an Y-axis at any intersection point on the plotting }  { surface. Parameters are as follows: }  { Spacing: The distance betweõTžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-”—NNNNNNNNNNNNNNNNNNNNNN”””ū Negative: boolean; {flag: "It is negative?"}  begin {body of "Round2"}  Negative:=(N<0.0); {is the number negative?}  if Negative then begin "N:=abs(N); ?īžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž- ±©NNNNNNNNNNNNNNNNNNNNNN”””ūY+Spacing;  end; {while}  end; {procedure "YaxisClip"}  $page$ {********************************************************************}  procedure Alpha(State: DisplayStates); š›žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž-ē–NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””Ŗ€‚€ƒė„V†Į‡,‰˜ŠŒoŚŽE±‘“‡”ņ•]—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.\)NNNNNNNNNNNNNNNNNNNNNN”””ūeger; { / "output_esc" procedure. }  begin {procedure "Alpha"}  if State=On then AlphaOn[1]:=1  else AlphaOn[1]:=0;  output_esc(AlphaRaster,1,0,AlphaOn,Rarray,Error);  if Error<>0 then writelnDWžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. €ÓNNNNNNNNNNNNNNNNNNNNNN”””ū;  {----------------------------------------------------------------------------}  { This function returns the sign of a number, i.e., -1 if the number is }  { negative, 0 if the number is zero, and +1 if the number is positive. }  {--------…(žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.öNNNNNNNNNNNNNNNNNNNNNN”””ū$page$ {********************************************************************} procedure Gload(var Screen: GRasterType);  {----------------------------------------------------------------------------}  { This procedure loads a user's array into graphi'RžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.oNNNNNNNNNNNNNNNNNNNNNN”””ū('Error ',Error:0,' in procedure "Alpha".');  end; {procedure "Alpha"} $page$ {********************************************************************} function Log10(X: real): real; †›žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. DNNNNNNNNNNNNNNNNNNNNNN”””ū--------------------------------------------------------------------}  begin {function "Sign"}  Sign:=ord(X>0.0)-ord(X<0.0); {<0 -> -1; =0 -> 0; >0 -> 1}  end; {function "Siī·žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.žNNNNNNNNNNNNNNNNNNNNNN”””ūcs memory. }  {----------------------------------------------------------------------------}  begin {procedure "Gload"}  GRaster:=Screen; {copy user array into graphics memory}  end„bžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.:KNNNNNNNNNNNNNNNNNNNNNN”””ū {----------------------------------------------------------------------------}  { This function returns the logarithm to the base ten of a number. }  {----------------------------------------------------------------------------}  const "LogÅVžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. *uNNNNNNNNNNNNNNNNNNNNNN”””ūgn"} $page$ {********************************************************************} function Intensity(Wavelength, Temperature: real): real; begin {function "Intensity"} /ĪžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.ՀNNNNNNNNNNNNNNNNNNNNNN”””ū; {procedure "Gload"} $page$ {********************************************************************} procedure Gstore(var Screen: GRasterType);  {--------------------------------------------------------------------------ŌžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. zNNNNNNNNNNNNNNNNNNNNNN”””ū_10= 2.30258509299; {log to the base e of 10}  begin {function "Log10"}  Log10:=ln(X)/Log_10;  end; {function "Log10"}  $page$ {***************************************āŚžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.&NNNNNNNNNNNNNNNNNNNNNN”””ūIntensity:=37410/XtoY(Wavelength,5)/(exp(14.39/(Wavelength*Temperature))-1); end; {function "Intensity"} $page$ {********************************************************************} begin r-žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. ę±NNNNNNNNNNNNNNNNNNNNNN”””ū--}  { This procedure stores graphics memory into a user's array. }  {----------------------------------------------------------------------------}  begin {procedure "Gstore"} ČižNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.ķNNNNNNNNNNNNNNNNNNNNNN”””ū*****************************}  function XtoY(X, Y: real): real;  {----------------------------------------------------------------------------}  { This function evaluates X to the Yth power. }  {-------------------------–!žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.LNNNNNNNNNNNNNNNNNNNNNN”””ū {body of program "GstorProg"} graphics_init; {initialize graphics library} display_init(Crt,Control,Error); {initialize CRT} if Error=0 then begin {if no error occurred...} "Alpha(Off); "set_aspect(Ratc žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž. ³āNNNNNNNNNNNNNNNNNNNNNN”””ū Screen:=GRaster; {copy graphics memory into user array}  end; {procedure "Gstore"} $page$ {********************************************************************}  function Sign(X: real): integer“žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.£ÜNNNNNNNNNNNNNNNNNNNNNN”””ū---------------------------------------------------}  begin {function "XtoY"}  XtoY:=exp(Y*ln(X)); {an logarithmic identity}  end; {function "XtoY"} )XžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.|JNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž.Ŗ€‚€ƒź„U†Į‡,‰˜ŠŒmŲŽB­‘“ƒ”ļ•Z—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/£4NNNNNNNNNNNNNNNNNNNNNN”””ū } $CharSize(0.025,0.6); { \ } $move(X,Ymin-Yrange*0.015); { \ } $Glabel('10 '); { \ Write the } $CharSize(0.015,0.6)ØMžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ĪNNNNNNNNNNNNNNNNNNNNNN”””ū {largest power for wavelength} "Xrange:=Xmax-Xmin; {distance between X extremes} "Dx:=0.1; {increment of X} "Ymin:=-5; {smallest power for intensity} "YmaxœéžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ ’NNNNNNNNNNNNNNNNNNNNNN”””ū$Glabel('10'); { \ } $CharSize(0.015,0.6); { \ Write Y-axis } $LabelJustify(Left,Bottom); { > labels in } $move(Xmin-Xrange*0.025,Y+Yrange*0.01);°ŃžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ NNNNNNNNNNNNNNNNNNNNNN”””ū; { > labels for the } $LabelJustify(Left,Bottom); { / X-axis. } $move(X+Xrange*0.01,Ymin-Yrange*0.025); { / } ø•žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ęYNNNNNNNNNNNNNNNNNNNNNN”””ū:=25; {largest power for intensity} "Yrange:=Ymax-Ymin; {distance between Y extremes} "Dy:=1; {increment of Y} "set_window(Xmin,Xmax,Ymin,Ymax); {scale the window for theōžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/:£NNNNNNNNNNNNNNNNNNNNNN”””ū { / exponential } $strwrite(Strng,1,I,Y:2:0); { / form. } $Glabel(strltrim(Strng)); { / } $Y:=Y+5*Dy; { / } "end; ÆqžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ ÅVNNNNNNNNNNNNNNNNNNNNNNž”””ū$strwrite(Strng,1,I,X:2:0); { / } $Glabel(strltrim(Strng)); { / } $X:=X+Dx*10; { / } "end; {while} "{===== Draw and label žčžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ÕhNNNNNNNNNNNNNNNNNNNNNN”””ū data} "{===== Draw and label logarithmic X-axis grid =============================} "for Decade:=Xmin to Xmax do begin {one decade equals one mantissa cycle} $for Units:=1 to 1+8*ord(Decademain } "YaxisTitle(-1,0,'Intensity of Radiation'); { / labels. } 0ōžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ ošNNNNNNNNNNNNNNNNNNNNNN”””ūin; {starting value for y} "while Y<=Ymax do begin $move(Xmin,Y); { \ Draw horizontal line for } $line(Xmax,Y); { / an X-axis. } $LabelJustify(Right,VCentered)ŹZžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/³ NNNNNNNNNNNNNNNNNNNNNN”””ūn; {starting place for X-axis labels} "Strng:=''; {null out the string} "while X<=Xmax do begin { \ } $LabelJustify(HCentered,Top); { \ )ŻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/L’NNNNNNNNNNNNNNNNNNNNNN”””ū"XaxisTitle(0,-0.92,'Wavelength (microns)'); {/ } "set_viewport(0.1,0.98,0.15/Ratio,0.9/Ratio); H{define subset of plotting surface} "Xmin:=-4; {smallest power for wavelength} "Xmax:=3; eĘžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ \ĮNNNNNNNNNNNNNNNNNNNNNN”””ū; {label origin: center of right edge} $CharSize(0.025,0.6); { \ } $move(Xmin-Xrange*0.03,Y); { \ } lYžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž/ žNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN§NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖ€‚ƒķ„Y†Ä‡0‰›ŠŒsßŽK·‘"“Ž”ł•NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0åŌNNNNNNNNNNNNNNNNNNNNNN”””ū{while} "{===== Here is where the action starts ====================================} "Gstore(Screen); {put the image into array} "CharSize(0.03,0.6); {set up charsize for temperature} "LabelJustify(Left,Bottom)|ežNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0 9.NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0OrNNNNNNNNNNNNNNNNNNNNNNž”””ū"end; {while true} end; {Error=0?} {end of conditional code} 1: graphics_term; {terminate graphics library} end. {program "GstorProg"} {end of program} qžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0ÖåNNNNNNNNNNNNNNNNNNNNNNž”””ū; {set up label origin for temperature} "while true do begin $read(keyboard,Character); {get character from keyboard} $if Character='q' then Character:='Q'; $if (Character>='1') and (Character<='9') then begin 0ļžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0  ¹NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0|CNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0ƒ¶NNNNNNNNNNNNNNNNNNNNNN”””ū&Gload(Screen); {load the image} &I:=ord(Character)-ord('0'); {translate char to number} &Temperature:=I*XtoY(10,3); {build temperature} &move(0,25.6); {move to where temp is t„žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0 “ˆNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0l}NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0°‡NNNNNNNNNNNNNNNNNNNNNN”””ūo be} &strwrite(Strng,1,I,Temperature:15:0); {translate to string} &Glabel(strltrim(Strng)); {label the temperature} &OldX:=Xmin; {X starting point} &OldY:=Intensity(XtoY(10,OldX),Temperature); {Y startißZžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0ĘŪNNNNNNNNNNNNNNNNNNNNNN”””ū program PLineProg(output);  import dgl_lib,dgl_inq;  const "CrtAddr= 3; "ControlWord= 0;  type "RDataType= array [0..10] of real;  const "Xvalues= RDataType[0,1,2,3,4,5,6,7,8,9,10]; "Yvalues= ĶžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0 _LNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0)NNNNNNNNNNNNNNNNNNNNNN”””ūng point} &X:=OldX+Dx; {second point for X} &while X<=Xmax do begin {loop through all Xs} (Y:=Intensity(XtoY(10,X),Temperature); {calculate current X} (ClipDraw(OldX,Log10(OldY),X,Log10(Y));{draw line after µ#žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0õźNNNNNNNNNNNNNNNNNNNNNNž”””ū RDataType[0,2,1,4,3,3,1,5,3,4,6];  var "ErrorReturn: integer; X, Y: RDataType;  $page$ {********************************************************************}  begin {program "PLineProgō·žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0  NNNNNNNNNNNNNNNNNNNNNN”””ūZ CLIPLIMICLIPDRAWCLIPLIMACLIPLIMBCLIPDRWACLIPDRWBXAXCLIPAXAXCLIPBYAXCLIPA~JJDJJJJJJ \N^¦ÄØõPRINTER: <l{žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0!NNNNNNNNNNNNNNNNNNNNNN”””ūclipping} (OldX:=X; OldY:=Y; {save new old values} (X:=X+2*Dx; {speed up the curve} &end; {while} $end $else if Character='Q' then goto 1 $else write(#G); {beep} OķžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž0Å·NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””Ŗ€‚ƒģ„W†Ā‡.‰šŠŒpŪŽF±‘“ˆ”ō•_—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1ÉNNNNNNNNNNNNNNNNNNNNNN”””ū {16-bit word} "Integers= array [1..Maxpoints] of Word; {to contain op. selectors}  const "Xvalues= Reals[ 1.5, 2.5, 2.5, 1.5,-1.5,-2.5,-2.5,-1.5, {Octagon} 6-2.5, 2.5, 2.5,-2.5,-2.5, {Box} 6-2.5,-4.5,-2.5,-5.0,-žäžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1Ę3NNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1°oNNNNNNNNNNNNNNNNNNNNNN”””ū LemX:=Xvalues; { \ Put into variable array so }  LemY:=Yvalues; { > it can be passed by }  OpSelectors:=OpCodes; { / reference into the DGL proc.}  Points:=MaxPoints; ĀŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 )ųNNNNNNNNNNNNNNNNNNNNNN”””ū4.0, {Left leg} 72.5, 4.5, 2.5, 5.0, 4.0, {Right leg} 6-0.5,-1.0, 1.0, 0.5]; {Nozzle} "Yvalues= Reals[ 1.0, 2.0, 3.0, 4.0, 4.0, 3.0, 2.0, 1.0, {Octagon} „ŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1_¤NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1ƒ^NNNNNNNNNNNNNNNNNNNNNN”””ū {put constant into an array variable}  graphics_init; {initialize graphics library}  display_init(Crt,Control,Error); {initialize CRT}  if Error=0 then begin {if no error occurred...}  §”žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 |«NNNNNNNNNNNNNNNNNNNNNN”””ū71.0, 1.0,-2.0,-2.0, 1.0, {Box} 6-2.0,-4.0, 0.0,-4.0,-4.0, {Left leg} 6-2.0,-4.0, 0.0,-4.0,-4.0, {Right leg} 6-2.0,-3.0,-3.0,-2.0]; {Nozzle}  OpCodes= Integers[2,1,1,1,1,1,1,1,Œ–žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1l•NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1“`NNNNNNNNNNNNNNNNNNNNNN”””ū"}  graphics_init;  display_init(CrtAddr,ControlWord,ErrorReturn);  if ErrorReturn=0 then begin  set_aspect(511,389); "set_window(0,10,0,10); "move(0,0); line(0,10); line(10,10); line(10,0); line(0,0);  X:=Xvalues; Y:=Yvalues; "polyline(11G}žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 OšNNNNNNNNNNNNNNNNNNNNNN”””ū {Octagon} 92,1,1,1,1, {Box} 92,1,1,2,1, {Right leg} 92,1,1,2,1, {Left leg} 92,1,1,1]; {Nozzle}  var "Error: ĒŗžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž19ĘNNNNNNNNNNNNNNNNNNNNNN”””ū program PolyProg(output); {program name same as file name}  import "dgl_lib,dgl_types,dgl_poly,dgl_inq; {access the necessary procedures}  const "MaxPoints= 27; {number of points in arrays} "Crt= ĮźžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 QNNNNNNNNNNNNNNNNNNNNNN”””ū,X,Y);  end; {ErrorReturn=0?}  graphics_term;  end. {program "PLineProg"} tžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 Ö NNNNNNNNNNNNNNNNNNNNNN”””ū integer; {display_init return variable; 0 = ok}  I: integer; {loop control variable} "LemX, LemY: Reals; {so we can pass it to "polygon"}  OpSelectors: Integers; {ditto}  ³6žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 ÷NNNNNNNNNNNNNNNNNNNNNN”””ū 3; {device address of graphics raster} "Control= 0; {device control word; ignored for CRT}  type "Reals= array [1..MaxPoints] of real; {to contain X and Y values} "Word= -32768..32767; XžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1õNNNNNNNNNNNNNNNNNNNNNN”””ūZ  \N.¦ÄØõPRINTER: <ڈžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž1 å it can be passed by }  OpSelectors:=OpCodes; { / reference into the DGL proc.}  Points:=MaxPoints; ĀŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2 ²$NNNNNNNNNNNNNNNNNNNNNN”””ū4.0, {Left leg} 72.5, 4.5, 2.5, 5.0, 4.0, {Right leg} 6-0.5,-1.0, 1.0, 0.5]; {Nozzle} "Yvalues= Reals[ 1.0, 2.0, 3.0, 4.0, 4.0, 3.0, 2.0, 1.0, {Octagon} „ŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2ÄxNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2‚NNNNNNNNNNNNNNNNNNNNNNž”””ū {put constant into an array variable}  graphics_init; {initialize graphics library}  display_init(Crt,Control,Error); {initialize CRT}  if Error=0 then begin {if no error occurred...}  §”žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2 ēwNNNNNNNNNNNNNNNNNNNNNN”””ū71.0, 1.0,-2.0,-2.0, 1.0, {Box} 6-2.0,-4.0, 0.0,-4.0,-4.0, {Left leg} 6-2.0,-4.0, 0.0,-4.0,-4.0, {Right leg} 6-2.0,-3.0,-3.0,-2.0]; {Nozzle}  OpCodes= Integers[2,1,1,1,1,1,1,1,Œ–žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2÷INNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž2(ßNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖ€‚ƒģ„W†Ć‡.‰™ŠŒpŪŽF²‘“ˆ”ó•_—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3÷”NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3+[NNNNNNNNNNNNNNNNNNNNNNž”””ūe graphics library}  end. {program "FillProg"} {end of program} €āžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3]NNNNNNNNNNNNNNNNNNNNNNž”””ū"polygon(13,X,Y,OpSel);  end; {ErrorReturn=0?}  graphics_term;  end. {program "FillGraph"} ÆžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3 ĐNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3²ĢNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3n6NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3 ‘ĆNNNNNNNNNNNNNNNNNNNNNN”””ū program FillGraph(output);  import dgl_lib, dgl_types, dgl_poly;  const "CrtAddr= 3; "ControlWord= 0;  type "RDataType= array [0..12] of real; "WDataType= array [0..12] of -32768..32767;  const "XvalueIEžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3żNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3~NNNNNNNNNNNNNNNNNNNNNN”””ū set_aspect(511,389); {use the whole screen}  set_window(-7.5,18.5,-10,10); {invoke isotropic units} "set_pgn_style(14); {crosshatched fill} "polygon(Points,LemX,LemY,OpSelectors); {draw the lines} 'ŚžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3 ¢ņNNNNNNNNNNNNNNNNNNNNNN”””ūs= RDataType[0,1,2,3,4,5,6,7,8,9,10,10,0]; "Yvalues= RDataType[2,4,3,6,5,5,3,7,5,6,8,0,0];  OperationSelectors= WDataType[2,1,1,1,1,1,1,1,1,1,1,1,1];  var "ErrorReturn: integer; X, Y: RDataType; N«žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3Ō®NNNNNNNNNNNNNNNNNNNNNN”””ūZ CLIPLIMICLIPDRAWCLIPLIMACLIPLIMBCLIPDRWACLIPDRWBXAXCLIPAXAXCLIPBYAXCLIPA/ÖÖŠÖÖÖÖÖÖ \N^¦ÄØõPRINTER: <ėłžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3M9NNNNNNNNNNNNNNNNNNNNNN”””ū set_window(-18.5,7,-10,10); {invoke isotropic units} "set_pgn_table(14,0.51,0,1); {set the "do a fill" flag} "set_color_table(1,0.125,0.125,0.125); {specify 12.5% gray scale} @mžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3 ;eNNNNNNNNNNNNNNNNNNNNNN”””ū"OpSel: WDataType;  $page$ {********************************************************************}  begin {program "FillGraph"}  graphics_init;  display_init(CrtAddr,ControlWord,ErrorReturn);  if Error)ižNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3ēŸNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3jNNNNNNNNNNNNNNNNNNNNNN”””ū"set_pgn_color(1); {use specified "color"} "polygon_dev_dep(Points,LemX,LemY,OpSelectors); {draw the lines}  end; {Error=0?} {end of conditional code}  graphics_term; {terminatĘūžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3 TNNNNNNNNNNNNNNNNNNNNNN”””ūReturn=0 then begin  set_aspect(511,389); "set_window(0,10,0,10); "move(0,0); line(0,10); line(10,10); line(10,0); line(0,0);  X:=Xvalues; Y:=Yvalues; OpSel:=OperationSelectors; "set_pgn_table(1,0.333,17.34,1); "set_pgn_style(1); žžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3^kNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž3Ŗ€‚€ƒė„W†Ā‡.‰™ŠŒqŻŽH“‘ “‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4/%NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 óßNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4…ƒNNNNNNNNNNNNNNNNNNNNNN”””ū program MarkrProg(output);  import dgl_lib,dgl_inq;  const "CrtAddr= 3; "ControlWord= 0;  type  MarkerNumType= array [0..4] of integer; "DataType= array [0..10] of integer;  const "MarkerNumber= {ŚžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 jHNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4¶²NNNNNNNNNNNNNNNNNNNNNNž”””ū MarkerNumType[2,5,6,8,13]; "Data= DataType[0,2,1,4,3,3,1,5,3,4,6];  var "ErrorReturn: integer; I, J: integer;  $page$ {********************************************************************}  begin ˜MžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4IGNNNNNNNNNNNNNNNNNNNNNN”””ūZ CLIPLIMICLIPDRAWCLIPLIMACLIPLIMBCLIPDRWACLIPDRWBXAXCLIPAXAXCLIPBYAXCLIPA©wwqwwwwww \N^¦ÄØõPRINTER: <ĒŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 YyNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4¦ŒNNNNNNNNNNNNNNNNNNNNNN”””ū {program "MarkrProg"}  graphics_init;  display_init(CrtAddr,ControlWord,ErrorReturn);  if ErrorReturn=0 then begin  set_aspect(511,389); "set_window(0,10,0,10); "move(0,0); line(0,10); line(10,10); line(10,0); line(0,0);RkžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4zvNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 *NNNNNNNNNNNNNNNNNNNNNN”””ū $ucsd,debug$program Test (keyboard,output); *import dgl_vars,dgl_types,dgl_lib,dgl_inq;type! States= (On,Off); 1 DrawMode= (Draw,Erase,Comp,NonDom); const FS= chr(28); BS= ch ažNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 •½NNNNNNNNNNNNNNNNNNNNNN”””ū "for I:=0 to 4 do begin $for J:=0 to 10 do begin &if J<>0 then marker(MarkerNumber[I]); &if J=0 then move(J,Data[J]+I) &else line(J,Data[J]+I); $end; {for j} "end; {for i}  end; {ErrorReturn=0?}  graphics_term; 办ĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4ćįNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4?NNNNNNNNNNNNNNNNNNNNNNž”””ūr(8); US= chr(31); LF= chr(10); CR= chr(13); Q= 'Q'; Ql= 'q';! Underline= chr(132); ! Ind_off= chr(128); ! Inv_On= R¬žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4 ĄīNNNNNNNNNNNNNNNNNNNNNN”””ū end. {program "MarkrProg"} ęjžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4ŠŠNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4FNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž4Ŗ€‚ƒģ„X†Ć‡.‰™ŠŒqŻŽH“‘ “‹”ö•b—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5Š8NNNNNNNNNNNNNNNNNNNNNN”””ūutput device?}Jif Error_Num=0 then begin {output device initialization OK?}@ AlphaDisplay(Off); {turn off alpha display}B GraphicsDisplay(On); {turn on graphics display}: set_aspect(511,389); €–žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 ĀNNNNNNNNNNNNNNNNNNNNNN”””ūicsDisplay} case State of  On:SwitchArray:=1;  Off:SwitchArray:=0; end; {case State of}6output_esc(GraphicsDisp,1,0,SwitchArray,Dummy,Error) ;if Error <> 0 then ? writeln ('Error ',Error:1,' encountered in GraphicsDisplay'); Cend; NŹžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5zžNNNNNNNNNNNNNNNNNNNNNN”””ūarHeight/2); gtext ('-Low Normal');N {---- How about some instructions -----------------------------------------}H CharWidth:=(0.02*400); {char width: 2% of screen width}L CharHeight:=(0.035*150); {char height: 3.5% of šäžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 ć NNNNNNNNNNNNNNNNNNNNNN”””ū {use whole screen}G set_window(0,400,-30,120); {scale the window for the data} ? set_color(1); {color number 1: white} J CharWidth:=(0.035*400); {char width: 3.5% of screen width}J CharHeigvūžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5•UNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure GraphicsDisplay} N$page$ {********************************************************************}.procedure AlphaDisplay(State:States {On/Off});const  AlphaDisp=1051; var  Error:integer; SwitchArray:inte0‘žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5IÆNNNNNNNNNNNNNNNNNNNNNN”””ūscreen height}@ set_char_size(CharWidth, CharHeight); {install character size} move (0, 5);& TempString:='Use the Knob to'+CR+LF; gtext (TempString); ( TempString:='Adjust the value.'+CR+LF; gtext (TempString);  TempString:=' '+CR+LF; j„žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 ¶ZNNNNNNNNNNNNNNNNNNNNNN”””ūht:=(0.05*150); {char height: 5% of screen height}@ set_char_size(CharWidth, CharHeight); {install character size}N {---- Outline the Bar -----------------------------------------------------}F move(MinBarX-0.5,MinBarY-0.5); {mov܇žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5¦dNNNNNNNNNNNNNNNNNNNNNN”””ūger; Dummy:real; @begin {procedure AlphaDisplay} case State of  On:SwitchArray:=1;  Off:SwitchArray:=0; end; {case State of}3output_esc(AlphaDisp,1,0,SwitchArray,Dummy,Error) ; if Error <> 0 then < writlLžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5Y‘NNNNNNNNNNNNNNNNNNNNNNž”””ū chr(129);  MinBarY= 0; MaxBarY= 100; MinBarX= 180; MaxBarX= 220; IncDelta= 0.1;var Error_num: integer; I,TempInt: integer; Level,Lastˆ%žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 …kNNNNNNNNNNNNNNNNNNNNNN”””ūe to lower left corner...}I line(MinBarX-0.5,MaxBarY+0.5); {...draw to upper left corner...} J line(MaxBarX+0.5,MaxBarY+0.5); {...draw to upper right corner...}I line(MaxBarX+0.5,MinBarY-0.5); {...draw to lower left corner...} KŽ-žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5ó7NNNNNNNNNNNNNNNNNNNNNN”””ūeln ('Error ',Error:1,' encountered in AlphaDisplay');@end; {procedure AlphaDisplay}N$page$ {********************************************************************}6begin {Main Program}EŌžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5j NNNNNNNNNNNNNNNNNNNNNN”””ūLevel: real;  Delta: real;  CharWidth,CharHeight: real;  Character: char; Done: boolean; keyboard: text; # TempString: Gstring255; N$page$ {***************************|žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 üNNNNNNNNNNNNNNNNNNNNNNž”””ū line(MinBarX-0.5,MinBarY-0.5); {...and draw to lower left corner.} N {---- Label the bar (numeric labels) --------------------------------------} for I:=0 to 10 do begin . strwrite(TempString,1,TempInt,I*10:3,'-');A move (179-strlen(T’žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5ĄNNNNNNNNNNNNNNNNNNNNNN”””ū?Level:=0; {current height of bar} @LastLevel:=Level; {previous height of bar}Hgraphics_init; {initialize the graphics system}>display_init(3,0,Error_Num); {which o'užNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5?óNNNNNNNNNNNNNNNNNNNNNN”””ū*****************************************}1procedure GraphicsDisplay(State:States {On/Off}); const  GraphicsDisp= 1050; var  Error:integer; SwitchArray:integer; Dummy:real; Cbegin {procedure GraphNfžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5 /ĶNNNNNNNNNNNNNNNNNNNNNN”””ūempString)*CharWidth,I*10-0.24*CharHeight);  gtext (TempString);  end; {for I:=1 to 10 }N {---- Label the bar (textual labels) --------------------------------------} move (221, 80-CharHeight/2); gtext ('-High Normal');  move (221, 60-ChĆ0žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž5yņNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žŖ€‚€ƒģ„X†Ä‡0‰›ŠŒrŽŽJµ‘!“Œ”÷•b—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6ĀMNNNNNNNNNNNNNNNNNNNNNN”””ūgtext (TempString); + TempString:='SHIFT with the knob '+CR+LF;  gtext (TempString); $ TempString:='speeds it up.'+CR+LF; gtext (TempString);  TempString:=''; N {---- Set a good character size -------------------------------------------}J tŻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6 ·NNNNNNNNNNNNNNNNNNNNNN”””ūD until Done; {repeat until user hits [Q]}C GraphicsDisplay (Off); {turn off graphics display} ? AlphaDisplay (On); {turn on alpha display} = display_term; {clean uŚžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6hėNNNNNNNNNNNNNNNNNNNNNN”””ū)}( end {if (Delta>0) and (Level<100) }4 else begin {Going Down}7 if (Delta<0) and (Level>=0.5*IncDelta) then begin @ set_color(0); {we want to erase lines} repeatB move(M ³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6ń|NNNNNNNNNNNNNNNNNNNNNNž”””ūCharWidth:=(0.035*400); {char width: 3.5% of screen width}J CharHeight:=(0.05*150); {char height: 5% of screen height}@ set_char_size(CharWidth, CharHeight); {install character size} repeat N read(keyboard,Character)šµžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6 ‡ NNNNNNNNNNNNNNNNNNNNNN”””ūp loose ends} end;Hgraphics_term; {terminate the graphics package}6end. {main program}’’play (On); {turn on alpha display} ’’ display_term; {clean uLŗžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6[ŚNNNNNNNNNNNNNNNNNNNNNN”””ūinBarX, Level); {move to the left edge...}G line(MaxBarX, Level); {...and draw to the right edge} 8 Level:=Level-IncDelta; {new top of bar}: until (Level<=LastLevel+Delta) or (Level<=MinBarY)( end; pŃžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6¤/NNNNNNNNNNNNNNNNNNNNNN”””ū; {get character without echo to screen}E Delta:=0; {start by assuming no motion} ? case Character of {what's the character?} 6 FS: Delta:=IncDelta; {right arrow?}A BS: [‘žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6 “NNNNNNNNNNNNNNNNNNNNNNž”””ū $ucsd,debug$program Test(keyboard,output);*import dgl_vars,dgl_types,dgl_lib,dgl_inq;type1 DrawMode= (Draw,Erase,Comp,NonDom); / BarX= array[1..5] of integer; ! States= (On,Off); const FS= ŒÕžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6KäNNNNNNNNNNNNNNNNNNNNNN”””ū{if (Delta<0) and (Level>0)} end;N {---- How about some numbers? -------------------------------------------}@ set_color(0); {we want to erase lines}L strwrite(TempString,1,TempInt,LastLevel:5:1); {convert level to •÷žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6—NNNNNNNNNNNNNNNNNNNNNN”””ū Delta:=-IncDelta; {left arrow (backspace)?} 5 LF: Delta:=10*IncDelta; {down arrow?} 3 US: Delta:=-10*IncDelta; {up arrow?} 2 Q,Ql: Done:=TRUE; {or Quit?}I otherwise ö‚žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6įBNNNNNNNNNNNNNNNNNNNNNN”””ū chr(28); BS= chr(8); US= chr(31); LF= chr(10); CR= chr(13); Q= 'Q'; Ql= 'q';! Underline= chr(132); ! jžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6 xÕNNNNNNNNNNNNNNNNNNNNNN”””ūchars}D move(MinBarX+(MaxBarX-MinBarX)/2-strlen(TempString)*CharWidth/2, MinBarY-2*CharHeight);> gtext(TempString); {erase the old number}@ set_color(1); {we want to erase lines}- strwrite(TempS¤žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž6‰NNNNNNNNNNNNNNNNNNNNNN”””ū {if none of the above, ignore it}  end; {case ord(Character)}2 if Delta>0 then begin {Going Up}? set_color(1); {we want to draw lines} I while (Level move(MinBarX,Level); {move to left edge...}C line(MaxBarX,Level); {...and draw to right edge} 8 end {while (Level0 then @ writeln('Error ',Error:1,' encountered in GraphicsDisplay');Cend; {procedure GraphicsDisplay} N$page$ {********************************************************************}/procvžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7įŖNNNNNNNNNNNNNNNNNNNNNN”””ū/ OUTPUT_ESC. } ?begin {procedure SetDrawMode} case Mode of I Draw: IntArray:=0; { \ } I NonDom: IntArray:=1; { \ Magic numbers for žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7—öNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure SetInd }  SetDrawMode(Draw);, move(MinBarX[Bar],MinBarY-1.3*CharHeight);- line(MaxBarX[Bar],MinBarY-1.3*CharHeight); ;end; {procedure SetInd } N$page$ {***********************HĪžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7 aNNNNNNNNNNNNNNNNNNNNNN”””ūedure AlphaDisplay(State: States {On/Off}); const K AlphaDisp= 1051; {mnemonic better than magic number} var I Error: integer; { \ All this stuff is needed } I SwitchArray: integer; { !²žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7x=NNNNNNNNNNNNNNNNNNNNNN”””ū the } I Erase: IntArray:=2; { / four drawing modes. } I Comp: IntArray:=3 { / }  end; {case Mode of} 5 output_esc(OpSelector,1,0,IntArray,RealArray,Error); ?end; ¢žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7¤ĒNNNNNNNNNNNNNNNNNNNNNN”””ū*********************************************}#procedure UpdateValue(Bar:integer); var % LastCharWidth,LastCharHeight: real; @begin {procedure UpdateValue }CLastCharWidth:=CharWidth; {store old charactq“žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7 [2NNNNNNNNNNNNNNNNNNNNNN”””ū > by the DGL procedure } I Dummy: real; { / OUTPUT_ESC. } @begin {procedure AlphaDisplay} case State of6 On: SwitchArray:=1; {1=on, and...}0 OØžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7K NNNNNNNNNNNNNNNNNNNNNNž”””ū {procedure SetDrawMode} N$page$ {********************************************************************}2procedure GraphicsDisplay(State: States {On/Off});const K GraphicsDisp= 1050; {mnemonic better than žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7“łNNNNNNNNNNNNNNNNNNNNNN”””ū0.1;var Error_num: integer; I,TempInt: integer;- Level,LastLevel: array [1..5] of real; Bar: integer; Delta: real;  CharWidth,CharHeight: real;  Character: char; ¹žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7 hNNNNNNNNNNNNNNNNNNNNNN”””ūOff: SwitchArray:=0; {0=off.} end; {case State of} 5 output_esc(AlphaDisp,1,0,SwitchArray,Dummy,Error);  if Error<>0 then ? writeln('Error ',Error:1,' encountered in AlphaDisplay'); @end; {pžžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7_NNNNNNNNNNNNNNNNNNNNNNž”””ūmagic number} var I Error: integer; { \ All this stuff is needed } I SwitchArray: integer; { > by the DGL procedure } I Dummy: real; { / OUTPUT_ESC. } Cbegin {žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7‡ČNNNNNNNNNNNNNNNNNNNNNN”””ū Done: boolean; keyboard: text; # TempString: Gstring255; N$page$ {********************************************************************}&procedure SetDrawMode(Mode: DrawMode);const K OpSelector= ųqžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7 ń”NNNNNNNNNNNNNNNNNNNNNN”””ūrocedure AlphaDisplay}N$page$ {********************************************************************}!procedure ClearInd(Bar: integer); by the DGL procedure } I Error: integer; { TžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž7 Ā„NNNNNNNNNNNNNNNNNNNNNN”””ū3*CharHeight);- line(MaxBarX[Bar],MinBarY-1.3*CharHeight); display_init(3,0,Error_Num); {which output device?}Jif Error_Num=0 then begin {output device initialization OK?}D AlphaDisplay(Off); {turn the alpha display off}F GraphicsDispo(žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8uNNNNNNNNNNNNNNNNNNNNNN”””ūold value}Kstrwrite(TempString,1,TempInt,LastLevel[Bar]:5:1); {convert to string} Mmove(MinBarX[Bar]+(MaxBarX[Bar]-MinBarX[Bar])/2- {move to right place} 9 strlen(TempString)*CharWidth/2,MinBarY-2.5*CharHeight); :gtext(TempString); \¬žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8 KNNNNNNNNNNNNNNNNNNNNNN”””ūleft.}9 {---- Label the bar --------------------------------} @ TempString:=''; {null out any old value}K strwrite(TempString,1,TempInt,'Bar ',Bar:1); {convert to string} M move(MinBarX[Bar]+(MaxBarX[Bar]-MinBarX[ŌržĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8é¾NNNNNNNNNNNNNNNNNNNNNNž”””ūlay(On); {turn the graphics display on}> set_aspect(511,389); {use the whole screen}G set_window(0,511,-50,110); {scale the window for the data} 9 set_color(1); {draw with white} ?Œ{žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž85DNNNNNNNNNNNNNNNNNNNNNN”””ū {label the string}L{---- Write the new -------------------------------------------------------}?SetDrawMode(Draw); {draw with white lines} @TempString:=''; {null out any old value}Kstrwrite(TemVØžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8CNNNNNNNNNNNNNNNNNNNNNN”””ūBar])/2- {move to right place} > strlen(TempString)*CharWidth/2,MinBarY-1.25*CharHeight);8 gtext(TempString); {label the text}9 {---- Put numbers alongside the bars ---------------}  for I:=0 to 10 do begin @ Teų\žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8 ŚNNNNNNNNNNNNNNNNNNNNNN”””ū SetDrawMode(Draw); {dominant drawing mode} H CharWidth:=(0.020*400); {char width: 2% of screen width}L CharHeight:=(0.035*150); {char height: 3.5% of screen height}D set_char_size(CharWidth,CharHeight);Ģ^žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8¬ÓNNNNNNNNNNNNNNNNNNNNNNž”””ūpString,1,TempInt,Level[Bar]:5:1); {convert to string} Mmove(MinBarX[Bar]+(MaxBarX[Bar]-MinBarX[Bar])/2- {move to right place} 9 strlen(TempString)*CharWidth/2,MinBarY-2.5*CharHeight); :gtext(TempString); {label theśŠžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8p)NNNNNNNNNNNNNNNNNNNNNN”””ūmpString:=''; {null out any old value}K strwrite(TempString,1,TempInt,I*10:3,'-'); {convert to string} M move(MinBarX[Bar]-strlen(TempString)*CharWidth, {move to right place}  I*10-0.24*CharHeight);8 gtÜsžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8 ÜNNNNNNNNNNNNNNNNNNNNNN”””ū {install the character size}N {---- Make the Bars -------------------------------------------------------} for Bar:=1 to 5 do begin9 {---- Initialize the levels ------------------------} @ Level[Bar]:=0; {all bars at lev8–žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8ŸāNNNNNNNNNNNNNNNNNNNNNN”””ū string}L{---- Reinstate the old character size ------------------------------------}ECharWidth:=LastCharWidth; {restore old character width} FCharHeight:=LastCharHeight; {restore old character height}Dset_char_size(CharWidth,pČžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž8@tNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN*NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””Ŗ€‚€ƒė„V†Į‡,‰—ŠŒnŁŽE°‘“‡”ņ•]—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9Ÿ NNNNNNNNNNNNNNNNNNNNNN”””ū],Level[Bar]); {move to the left end...} G line(MaxBarX[Bar],Level[Bar]); {...and draw to the right edge}  end {while} end {if} 1 else begin {delta<0} L if (Delta<0) and (Level[Bar]>=0.5*IncDelta) TgžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9CšNNNNNNNNNNNNNNNNNNNNNNž”””ū--------------} D Bar:=3; {which bar active at first?}= SetInd(Bar); {tell the program so} repeat O read(keyboard,Character); {read character with no echo to screen} O Delta:.ƒžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž95¬NNNNNNNNNNNNNNNNNNNNNN”””ū{right arrow} A BS= chr(8); {left arrow or backspace} 2 US= chr(31); {up arrow}4 LF= chr(10); {down arrow}9 CR= chr(13); {carriage return} D MinX¼zžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9 ¬;NNNNNNNNNNNNNNNNNNNNNN”””ūthen begin {Going Down}? SetDrawMode(Erase); {draw with black lines}  repeatF move(MinBarX[Bar],Level[Bar]); {move to left edge...}K line(MaxBarX[Bar],Level[Bar]); {...and draw to right edgej]žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9ŚgNNNNNNNNNNNNNNNNNNNNNN”””ū=0; {assume no motion until told otherwise}  case Character of 6 FS: Delta:=IncDelta; {right arrow?}D BS: Delta:=-IncDelta; {left arrow (or backspace)?}5 LF: Delta:=10*IncDelta; ö³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9NNNNNNNNNNNNNNNNNNNNNN”””ū= 0; {minimum X value for screen}D MinY= 0; {minimum Y value for screen}D MaxX= 511; {maximum X value for screen}D MaxY= 389; {maximum Y vhDžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9 łhNNNNNNNNNNNNNNNNNNNNNN”””ū} A Level[Bar]:=Level[Bar]-IncDelta; {decrement level} I until (Level[Bar]<=LastLevel[Bar]+Delta) or (Level[Bar]<=MinBarY)  end; {if} end; {else}9 {---- How about some numbers? ----------------------} H UpdateVaūäžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9éVNNNNNNNNNNNNNNNNNNNNNN”””ū {down arrow?} 3 US: Delta:=-10*IncDelta; {up arrow?} 2 Q,Ql: Done:=true; {or Quit?} '1'..'5': begin < ClearInd(Bar); {deactivate old bar}D Bar:=ord(Character)-ord('0'); {d„LžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9£NNNNNNNNNNNNNNNNNNNNNN”””ūext(TempString); {label the text} end; {for I:=1 to 10 }8 UpdateValue(Bar); {modify the bar} end; {for} 9 {---- How about some instructions --------------------} H CharWidth:=(0.02*511); {chaZåžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9 ŹYNNNNNNNNNNNNNNNNNNNNNN”””ūlue(Bar); {change the bar's numeric label}D LastLevel[Bar]:=Level[Bar]; {remember the current value}: until Done; {pressed [Q] yet?}C GraphicsDisplay(Off); {turn off graphics displsÕžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9¼NNNNNNNNNNNNNNNNNNNNNN”””ūetermine new bar's number}: SetInd(Bar); {activate new bar} end;J otherwise {if none of the above, do nothing} end; {case} 2 if(Delta>0)then begin {Going Up}? SeÖWžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9%’NNNNNNNNNNNNNNNNNNNNNN”””ūr width: 2% of screen width}L CharHeight:=(0.035*160); {char height: 3.5% of screen height}@ set_char_size(CharWidth,CharHeight); {install character size} move(0,-30);7 TempString:='Use Number Keys to select a bar.'+CR+LF;  gtext(ŲõžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž9 SĪNNNNNNNNNNNNNNNNNNNNNN”””ūay} ? AlphaDisplay(On); {turn on alpha display} = display_term; {clean up loose ends} end;Ggraphics_term; {terminate the graphics system} end. {Main Program} ’’f graphics displ9—žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž94NNNNNNNNNNNNNNNNNNNNNN”””ūtDrawMode(Draw); {draw with white lines} - while (Level[Bar] Xlast,Ylast: real; ĶžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž: ČNNNNNNNNNNNNNNNNNNNNNN”””ūhe text}=end; {procedure MenuCell} N{----------------------------------------------------------------------------} X positions for box } I Xarray[4]:=0; { / ѰžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:ėNNNNNNNNNNNNNNNNNNNNNN”””ū {last digitized point}C CharWidth,CharHeight: real; {char size in world coords} B Done: boolean; {are we supposed to quit?}9 NewLine: boolean; {start new line?} : TempString: Gstr!fžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž: ū#NNNNNNNNNNNNNNNNNNNNNN”””ū{ \ } IYarray[2]:=MinY; { \ } IYarray[3]:=MenuTop; { > Y values for box } IYarray[4]:=MenuTop; { / c}žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:ÖNNNNNNNNNNNNNNNNNNNNNN”””ū } I Xarray[5]:=0; { / } < Xlabel:=MinX+CellWidth-strlen(TempString)*CharWidth/2; end; 1..10: beginF TempPitch:=CellWidth*I; {temporary shorthand variable}I ėEžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:Ų,NNNNNNNNNNNNNNNNNNNNNN”””ūing255; {utility variable}8 EchoSelect,EchoSelector: 0..9; {menu selection} MenuTop: real; > CellWidth: real; {width of menu spaces}A Command: Commands; {which command selected?} N$pŚ5žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:®pNNNNNNNNNNNNNNNNNNNNNN”””ū } IYarray[5]:=MinY; { / } EYlabel:=MinY+(MenuTop-MinY)/2-CharHeight/2; {Y position of label} Afor I:=0 to 10 do MenuCell(I); {do all the entree cells} end; {procedure DrawMenu}N$pag¢ žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž: 7ēNNNNNNNNNNNNNNNNNNNNNN”””ū Xarray[1]:=CellWidth+TempPitch; { \ } I Xarray[2]:=2*CellWidth+TempPitch; { \ } I Xarray[3]:=2*CellWidth+TempPitch; { > X positions for box } I Xarray[4]:=CellWidth+TemߢžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:A»NNNNNNNNNNNNNNNNNNNNNN”””ūage$ {********************************************************************}procedure DrawMenu; var ? I: integer; {loop-control variable} D Ylabel: real; {Y position of entree label}" Yarray: é5žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž:ANNNNNNNNNNNNNNNNNNNNNN”””ūe$ {********************************************************************}&function CheckMenu(Xin:real):Commands;0} : else begin {No errors so far}: set_aspect(511,389); {use whole screen}? set_window(0,5`ÆžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ŲÄNNNNNNNNNNNNNNNNNNNNNN”””ūYlast) then NewLine:=true  else begin case EchoSelect of5 1..7: line(Xin,Yin); {draw a line}  8: begin" line(Xlast,Yin); line(Xin,Yin);" line(Xõ“žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž; ASNNNNNNNNNNNNNNNNNNNNNN”””ūith the program}I 1: EchoSelect:=1; { \ } I 2: EchoSelect:=2; { \ } I 3: EchoSelect:=3; { \ } I źõžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;7NNNNNNNNNNNNNNNNNNNNNN”””ū11,0,389); {scale window for data} J CharWidth:=0.035*511; {char width: 3.5% of screen width}J CharHeight:=0.05*389; {char height: 5% of screen height}@ set_char_size(CharWidth,CharHeight);{install charact/žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ėõNNNNNNNNNNNNNNNNNNNNNN”””ūin,Ylast);$ line(Xlast,Ylast); NewLine:=true; end  otherwise % end; {case EchoSelect of} @ Xlast:=Xin; {remember the last X...}; Ylast:ŸfžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž; NNNNNNNNNNNNNNNNNNNNNN”””ū4: EchoSelect:=4; { \ Select the appropriate } I 5: EchoSelect:=5; { / EchoSelector. } I 6: EchoSelect:=6; { / } I 7: EchoSelect:=7; bžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;>NNNNNNNNNNNNNNNNNNNNNN”””ūer size}N MenuTop:=Yrange/13; {menu is 1/13 the total screen height}L CellWidth:=Xrange/12; {each entree cell 1/12 screen width}7 DrawMenu; {draw the menu} I NewLine:=true; ŠŖžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ūĖNNNNNNNNNNNNNNNNNNNNNN”””ūTempInt:=trunc((Xin-CellWidth)/CellWidth); {which sell chosen?}& if TempInt>8 then CheckMenu:=Command else CheckMenu:=TempInt end;end; {function CheckMenu } N$page$ {********************************************************************}6be{NžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž; '1NNNNNNNNNNNNNNNNNNNNNN”””ū { / } I 8: EchoSelect:=8; { / }  end {case}  end {if} ? else begin {not a menu selection} : if NewLine then begin D žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;QmNNNNNNNNNNNNNNNNNNNNNN”””ū {yes, we are starting a new line} L EchoSelect:=4; {start program with default command}/ Command:=4; {ditto} @ Done:=false; {no, we're not done yet} repeat> ū`žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ČśNNNNNNNNNNNNNNNNNNNNNN”””ūgin {Main program}Hgraphics_init; {initialize the graphics system}>display_init(3,0,Error_Num); {which output device?}Iif Error_Num<>0 then begin {output devic initializa‚ŃžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž; ¾¦NNNNNNNNNNNNNNNNNNNNNN”””ū {start a new line}K NewLine:=false; {now we're in the middle of a line} B set_echo_pos(Xin,Yin); {move the graphics cursor}K move(Xin,Yin); {cause line-drawing to start there} @ "džNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;b\NNNNNNNNNNNNNNNNNNNNNN”””ū if NewLine then {starting a new line?} EchoSelector:=2 else! EchoSelector:=EchoSelect; 6 await_locator(EchoSelector,ButtonValue,Xin,Yin);B if Yin0} else begin) LOCATOR_init(LocatorAddress,Error_Num);  if Error_Num<>0 then begin3 writeln('I failed toĖõžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž; —NNNNNNNNNNNNNNNNNNNNNN”””ū Ylast:=Yin; {remember the last X...}; Xlast:=Xin; {...and the last Y} end  else beginB set_echo_pos(Xin,Yin); {move the graphics cursor}; if (Xin=Xlast) and (Yin=ÉżžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;ŪØNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž;«€‚ƒƒī„Y†Å‡1‰œŠŒsŽŽJµ‘!“Œ”ö•`—NNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<ŖęNNNNNNNNNNNNNNNNNNNNNN”””ū=Yin; {...and the last Y} end end; end;: until Done; {are we done yet?}? locator_term; {terminate the locator} ? display_term; {terKÄžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž< vNNNNNNNNNNNNNNNNNNNNNN”””ū I,TempInt: integer; {temporary variables} 1 OpArray: array[1..5] of gshortint; E Xarray,Yarray, {locations of points} I Yfill_array: array[1..5] of real; {same points, but fiœ¢žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<@NNNNNNNNNNNNNNNNNNNNNN”””ū} I Hl= 'h'; { \ These are the valid } I L= 'L'; { / user responses. } I Ll= 'l'; { / } I Q= ™#žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<™×NNNNNNNNNNNNNNNNNNNNNN”””ūminate the display}  end; {Error trap} end;Ggraphics_term; {terminate the graphics system} 6end. {Main program}’’ {terminate the locator} ’’ display_term; {terc žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž< ļ‹NNNNNNNNNNNNNNNNNNNNNN”””ūlled}  Delta: real; I HueVal: array[0..15] of real; { \ For each of the } I SatVal: array[0..15] of real; { \ sixteen pens, we } I LumVal: array[0..15] of real; { \ need to kn¼<žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<3qNNNNNNNNNNNNNNNNNNNNNN”””ū'Q'; { / } I Ql= 'q'; { / } I S= 'S'; { / } I Sl= 's'; { / ®&žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<Ģ„NNNNNNNNNNNNNNNNNNNNNN”””ū $ucsd,debug$program Test(keyboard,output);3import dgl_vars,dgl_types,dgl_lib,dgl_poly,dgl_inq; typeI Colors= (Red,Yellow,Green,Cyan,Blue,Magenta,White,Black); 8 Modes= (Hue,Sat,Lum,Table,Copy1,Copy2); EntryRange= E®žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž< ÜŗNNNNNNNNNNNNNNNNNNNNNN”””ūow the } I GreenVal: array[0..15] of real; { / HSL values as } I BlueVal: array[0..15] of real; { / well as the RGB } I RedVal: array[0..15] of real; { / values. } I Hue_ind: æžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<#ONNNNNNNNNNNNNNNNNNNNNN”””ū } K Display_Cont= 1050; {mnemonic better than magic number} H Underline= chr(132); {alpha enhancement: underlining}? Ind_off= chr(128); {turn enhancements off} J Inv_On= ŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<’µNNNNNNNNNNNNNNNNNNNNNN”””ū -1..16; G FunnyArray= array [Colors] of char; {array for alpha color} const 5 FS= chr(28); {right arrow} A BS= chr(8); {left arrow or backspace} 2 US= chr(31™[žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<‰éNNNNNNNNNNNNNNNNNNNNNN”””ū char; { \ } I Sat_ind: char; { > Various indicators. } I Lum_ind: char; { / } 5 Tab_ind: char; {andķPžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž< ~NNNNNNNNNNNNNNNNNNNNNN”””ū chr(129); {alpha enhancement: inverse video}I FunnyChar= FunnyArray[chr(139),chr(137), {\ Array for } I chr(136),chr(140), { \ holding the } I chr(142žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<f"NNNNNNNNNNNNNNNNNNNNNN”””ū); {up arrow}4 LF= chr(10); {down arrow}9 CR= chr(13); {carriage return} I C= 'C'; { \ } I Cl= 'c'; { \š’žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<ŗŲNNNNNNNNNNNNNNNNNNNNNN”””ū another} : Character: char; {utility variable}= Done: boolean; {are we through yet?} ; keyboard: text; {non-echoing input} J TempString: Gstring255; {temporary holdingŪ{žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž< E-NNNNNNNNNNNNNNNNNNNNNN”””ū),chr(143), { / alpha-color } I chr(141),chr(138)]; {/ controllers } N$page$ {********************************************************************}var 9 Error_num: integer; {return variable} =¼hžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<UNNNNNNNNNNNNNNNNNNNNNN”””ū } I E= 'E'; { \ } I El= 'e'; { \ } I H= 'H'; { \ čBžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<Š…NNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž<«€‚‚ƒķ„X†Ć‡.‰™ŠŒpŪŽF²‘“ˆ”ó•NNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=UūNNNNNNNNNNNNNNNNNNNNNN”””ūiteln(LumVal[TableEntry]:5:2);#writeln(Tab_ind,' Entry ',Ind_off); writeln(TableEntry:3);Hgotoxy(0,20); {twenty-first row, first column}IHue_ind:=chr(128); { \ } ISat_ind:=chrJXžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=‰NNNNNNNNNNNNNNNNNNNNNN”””ūer of the screen} 5write('Color Selector:',Underline,'H',Ind_off,'ue,'); *write(Underline,'S',Ind_off,'aturation,');+write(Underline,'L',Ind_off,'uminosity,'); .write('table ',Underline,'E',Ind_off,'ntry,');*write(Underline,'C',Ind_off,'opy color,');ĀžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=’]NNNNNNNNNNNNNNNNNNNNNN”””ūArray); {draw the cursor} ?end; {procedure DrawCursor} N{----------------------------------------------------------------------------}@begin {procedure UpdateCursor}=if LastTabhžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž= fŹNNNNNNNNNNNNNNNNNNNNNN”””ū(128); { \ Turn all display } ILum_ind:=chr(128); { / enhancements off } ITab_ind:=chr(128); { / } end; {procedure DisplayStuff}N$page$ ÕžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=–NNNNNNNNNNNNNNNNNNNNNN”””ū%writeln(Underline,'Q',Ind_off,'uit'); end; {procedure MenuLine}N$page$ {********************************************************************}procedure DisplayStuff; @begin {procedure DisplayStuff}Dwriteln(LabelCŁ žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=ĢlNNNNNNNNNNNNNNNNNNNNNN”””ūleEntry<>TableEntry then begin {any change?} I set_pgn_color(0); {choose fill color of background} J DrawCursor(LastTableEntry) {draw in background color (erase)} end; {if} >set_pgn_color(CursorColor); N”žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž= 3™NNNNNNNNNNNNNNNNNNNNNN”””ū{********************************************************************}+procedure UpdateCursor(TableEntry:integer); N{----------------------------------------------------------------------------})procedure DrawCursor(TableEntry:integer); >begin „ŽžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=#§NNNNNNNNNNNNNNNNNNNNNN”””ūolor); {write in appropriate color}Fcase Mode of {which value are we tweaking?}I Hue: Hue_Ind:=Inv_On; { \ } I Sat: Sat_Ind:=Inv_On; { \ Turn oµpžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=ÜRNNNNNNNNNNNNNNNNNNNNNN”””ū place for text} Mode,LastMode: Modes;# CursorColor: EntryRange; # Copy_Source: EntryRange; # LastTableEntry: EntryRange; # TableEntry: EntryRange; 0 X_Loc: array[0..15] of integer;0 Y_KAžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž= ØNNNNNNNNNNNNNNNNNNNNNN”””ū {procedure DrawCursor}IXarray[1]:=X_Loc[TableEntry]+0.1; { \ } IXarray[2]:=X_Loc[TableEntry]+0.5; { \ } IXarray[3]:=X_Loc[TableEntry]+0.9; { \ Ņ’žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=vōNNNNNNNNNNNNNNNNNNNNNN”””ūn the display } I Lum: Lum_Ind:=Inv_On; { > enhancement for the } I Table: Tab_Ind:=Inv_On; { / appropriate indicator. } I Copy1,Copy2: {No Indicators on}; { / } end;ĂžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=ļcNNNNNNNNNNNNNNNNNNNNNN”””ūLoc: array[0..15] of integer; Int_a: integer; Real_A: real; % RedBack,GreenBack,BlueBack: real;  LabelColor: char;  BackSum,OldBackSum: 0..7; N$page$ {*******************************ł»žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž= ™?NNNNNNNNNNNNNNNNNNNNNN”””ū } IXarray[4]:=X_Loc[TableEntry]+0.1; { \ Define the triangular } IYarray[1]:=Y_Loc[TableEntry]-0.09; { / cursor. } IYarray[2]:=Y_Loc[TableEntry]-0.01; { / } IYarrayÅ(žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=EÅNNNNNNNNNNNNNNNNNNNNNN”””ū {case}Bgotoxy(0,3); {fourth row, first column}!writeln(Hue_ind,' Hue ',Ind_off); writeln(HueVal[TableEntry]:5:2);!writeln(Sat_ind,' Sat ',Ind_off); writeln(SatVal[TableEntry]:5:2);!writeln(Lum_ind,' Lum ',Ind_off); wrŽWžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž=ŗ0NNNNNNNNNNNNNNNNNNNNNN”””ū*************************************}procedure MenuLine; GŽNNNNNNNNNNNNNNNNNNNNNNž”””ū {select polygon color}=DrawCursor(TableEntry); {draw the new cursor} JLastTableEntry:=TableEntry {remember the new cursor position}end; {procedure UpdateCursor}N$page$ {*************************************************H®žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž> ›tNNNNNNNNNNNNNNNNNNNNNN”””ūed } I Yarray[4]:=0.9; { / rectangle. } I Yarray[5]:=0.1; { / } I Yfill_array:=Yarray; { \ Define the outline of } I Yfill_array[JžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>ķ(NNNNNNNNNNNNNNNNNNNNNN”””ū-------------------}- set_color_model(2); {HSL} I HueVal[TableEntry]:=0; { \ Current TableEntry: 0. } I SatVal[TableEntry]:=0; { > Current entry's color: } I LumVal[TableEntry]:=0.6; žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>tæNNNNNNNNNNNNNNNNNNNNNNž”””ū*******************}6begin {Main Program}IHue_ind:=chr(128); { \ } ISat_ind:=chr(128); { \ All highlights initially } ILum_ind:=chr(128); ŗēžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž> ćNNNNNNNNNNNNNNNNNNNNNNž”””ū3]:=0.5; { > the short, filled } I Yfill_array[4]:=0.5; { / rectangle. } N {---- Draw the lower row --------------------------------------------------} for I:=0 to 7 do beginI Xarray[1Ż…žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>ŽNNNNNNNNNNNNNNNNNNNNNN”””ū { / 60% gray. } I set_color_table(TableEntry, { \ } I HueVal[TableEntry], { \ Install the currently- } I SatVal[TableEntry], { / defined color. pDžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>!ģNNNNNNNNNNNNNNNNNNNNNN”””ū { / off. } ITab_ind:=chr(128); { / } CTableEntry:=0; {currently indicated entry} DLastTableEntry:=0; {previously indicateŠŗžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž> 1ŅNNNNNNNNNNNNNNNNNNNNNNž”””ū]:=I; { \ } I Xarray[2]:=I+0.9; { \ Define the X positions } I Xarray[3]:=I+0.9; { > for this particular } I Xarray[4]:=I; ʧžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>Ī'NNNNNNNNNNNNNNNNNNNNNNž”””ū } I LumVal[TableEntry]); { / } N {---- Read the colors from the color map ----------------------------------}E for I:=0 to 15 do inq_color_table(I,HueVal[I],SatVal[I],LumVal[I]); N {---- InitiaÉ[žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>ŻNNNNNNNNNNNNNNNNNNNNNNž”””ūd entry}>Mode:=Table; {selection mode first}ICursorColor:=1; {make sure the cursor is visible} ILabelColor:=FunnyChar[Black]; {labels contrast with background} Hgraphics_init; óžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>dNNNNNNNNNNNNNNNNNNNNNN”””ū{ / rectangle. } I Xarray[5]:=I; { / } = strwrite(TempString,1,TempInt,I:2); {convert to a string} @ set_color(1); {set the color for text}M move(I+0.5RkžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž> żNNNNNNNNNNNNNNNNNNNNNN”””ūlize arrays for polygon ---------------------------------------}F OpArray[1]:=2; {2: First vertex of a polygon}N for I:=2 to 5 do OpArray[I]:=1; {1: Draw from the last vertex to this}N {---- Set up arrays for the lower ro €žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>‹JNNNNNNNNNNNNNNNNNNNNNN”””ū {initialize the graphics system}>display_init(3,0,Error_Num); {which output device?}Bif Error_Num=0 then begin {successfully initialized}C set_char_size(0.175,0.15); {define the character size} B set_pgVĻžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>W°NNNNNNNNNNNNNNNNNNNNNN”””ū-0.075,0); {move to just right of bottom center} F gtext(TempString); {label the table entry number}I set_pgn_color(I); {set the color for polygon fills} A set_color(I); {sžńžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž> ØENNNNNNNNNNNNNNNNNNNNNNž”””ūw -------------------------------------}I Yarray[1]:=0.1; { \ } I Yarray[2]:=0.1; { \ Define the outline of } I Yarray[3]:=0.9; { > the tall, unfillA+žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>ø{NNNNNNNNNNNNNNNNNNNNNN”””ūn_style(15); {select the polygon style}> set_aspect(511,389); {use the whole screen}G set_window(-1.1,8,-0.7,2.2); {scale the window for the data} N {---- Set up color system and set background color ---ŅŌžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>gķNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž>Ŗ€‚ƒģ„W†Ā‡-‰™ŠŒpÜŽG²‘“‰”ō•`—NNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?ø“NNNNNNNNNNNNNNNNNNNNNNž”””ūfill_array,OpArray); {draw and fill shortie} ; X_Loc[I+8]:=round(Xarray[1]); {store X locations} ; Y_Loc[I+8]:=round(Yarray[1]); {store Y locations}  end; {for I:=0 to 15} N {---- Start interactivity --------------------------ūóžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?diNNNNNNNNNNNNNNNNNNNNNNž”””ū } I Yfill_array:=Yarray; { \ } I Yfill_array[3]:=1.5; { > Redefine Y values only. } I Yfill_array[4]:=1.5; { / } N m~žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?5NNNNNNNNNNNNNNNNNNNNNNž”””ūleEntry; {Put it where?} % CursorColor:=Copy_Source; : UpdateCursor(TableEntry); {note current entry}G gotoxy(0,21); {twenty-second row, first column} 5 write('Use Knob to select location to '); ¢¼žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? ‹¢NNNNNNNNNNNNNNNNNNNNNNž”””ū-----------------------}8 MenuLine; {write the menu}8 UpdateCursor(TableEntry); {initial cursor}: DisplayStuff; {initial readouts}6 Done:=false; {not done yet} žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?żžNNNNNNNNNNNNNNNNNNNNNNž”””ū{---- Draw the upper row --------------------------------------------------} for I:=0 to 7 do beginI Xarray[1]:=I; { \ } I Xarray[2]:=I+0.9; { \ Define the X positions } IĢ=žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?!NNNNNNNNNNNNNNNNNNNNNNž”””ū. write('copy color to,then press'); writeln(' C');C Mode:=Copy2 {do second section next time} end  else begin5 if Mode=Copy2 then begin {Copy color to} 5 y²žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? ŽńNNNNNNNNNNNNNNNNNNNNNN”””ūP repeat {this starts the actual color selector} A read(keyboard,Character); {get a character,no echo} @ Delta:=0; {start by assuming zero}? case Character of ›ĪžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?ĪĻNNNNNNNNNNNNNNNNNNNNNNž”””ū Xarray[3]:=I+0.9; { > for this particular } I Xarray[4]:=I; { / rectangle. } I Xarray[5]:=I; { / } E strwrite(TempString,1,TeĮžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?1:NNNNNNNNNNNNNNNNNNNNNNž”””ūet the color for lines} J polyline(5,Xarray,Yarray); {draw the tall unfilled rectangle}O polygon_dev_dep(5,Xarray,Yfill_array,OpArray); {draw and fill shortie} ; X_Loc[I]:=round(Xarray[1]); {store X locations} ; Y_Loc[ż¹žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? ķĄNNNNNNNNNNNNNNNNNNNNNNž”””ū {analyze the character} I FS: Delta:=0.01; { \ } I BS: Delta:=-0.01; { \ Cursor-control } I LF: Delta:=0.1; { / characters } I²ZžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?›œNNNNNNNNNNNNNNNNNNNNNN”””ūmpInt,I+8:2); {convert to a string} @ set_color(1); {set the color for text}M move(I+0.5-0.075,1); {move to just right of bottom center} F gtext(TempString); {label the table entry num©‹žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? NNNNNNNNNNNNNNNNNNNNNNž”””ūI]:=round(Yarray[1]); {store Y locations}  end; {for I:=0 to 15} N {---- Set up the arrays for the upper row ---------------------------------}I Yarray[1]:=1.1; { \ } I Yarray[2]:=1.1; Ē®žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? tWNNNNNNNNNNNNNNNNNNNNNN”””ū US: Delta:=-0.1; { / } ; H,Hl: Mode:=Hue; {Hue-changing mode} B L,Ll: Mode:=Lum; {Luminosity-changing mode}: Q,Ql: Done:=true; {Quit the ¹žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?Ø­NNNNNNNNNNNNNNNNNNNNNN”””ūber}I set_pgn_color(I+8); {set the color for polygon fills} A set_color(I+8); {set the color for lines} J polyline(5,Xarray,Yarray); {draw the tall unfilled rectangle}O polygon_dev_dep(5,Xarray,Yž½žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?WXNNNNNNNNNNNNNNNNNNNNNN”””ū { \ } I Yarray[3]:=1.9; { > Redefine Y values only. } I Yarray[4]:=1.9; { / } I Yarray[5]:=1.1; { / gķžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž? GfNNNNNNNNNNNNNNNNNNNNNN”””ūprogram}B S,Sl: Mode:=Sat; {Saturation-changing mode}= E,El: Mode:=Table; {Entry-changing mode}  C,Cl: begin ? if Mode=Copy1 then begin {Have source, will copy.} 5 Copy_Source:=TabLQžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž?YNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž«€‚ƒƒļ„Y†Å‡/‰šŠŒpÜŽG³‘“‹”ö•NNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@§”NNNNNNNNNNNNNNNNNNNNNN”””ūgotoxy(0,21); {this location} @ writeln(strrpt(' ',79)); {"erase" old text}G inq_color_table(Copy_Source, { \ Get the } G HueVal[TableEntry], { \ HSL values } G3PžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ {[NNNNNNNNNNNNNNNNNNNNNN”””ūbegin {Background color}5 set_color_model(1); {RGB} H inq_color_table(0,RedBack,GreenBack,BlueBack); {get RGB values}I BackSum:=0; { \ Calculate the } I if RedBack<0.5 thenī±žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ NNNNNNNNNNNNNNNNNNNNNNž”””ū+Delta; {adjust it} L if SatVal[TableEntry]>1 then SatVal[TableEntry]:=1; {keep it...}N if SatVal[TableEntry]<0 then SatVal[TableEntry]:=0; {...in limits} end; Lum: beginK LumVal[TableEntry]:=LumVal —žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@”NNNNNNNNNNNNNNNNNNNNNN”””ū SatVal[TableEntry], { / from the } G LumVal[TableEntry]); { / table. } I CursorColor:=1; {reinitialize cursor color} L UpdateCursor(TableW³žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ āĢNNNNNNNNNNNNNNNNNNNNNN”””ū BackSum:=4; { \ background color } I if GreenBack<0.5 then BackSum:=BackSum+2; { / in order to make } I if BlueBack<0.5 then BackSum:=BackSum+1; { / contrasting text. } 5 if OldBackSum<>BackSum then begin {Color change!ŽžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@>6NNNNNNNNNNNNNNNNNNNNNN”””ū[TableEntry]+Delta; {adjust it} L if LumVal[TableEntry]>1 then LumVal[TableEntry]:=1; {keep it...}N if LumVal[TableEntry]<0 then LumVal[TableEntry]:=0; {...in limits} end; Table,Copy1,Copy2: begin ifųžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ĮĆNNNNNNNNNNNNNNNNNNNNNNž”””ūEntry); {indicate new cursor position}G Mode:=LastMode {third section next time}  end B else begin {Initiate copy mode} LastMode:=Mode; & Copy“ƒžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ ŃżNNNNNNNNNNNNNNNNNNNNNN”””ū}  case BackSum ofI 0: LabelColor:=FunnyChar[Black]; { \ } I 1: LabelColor:=FunnyChar[Blue]; { \ } I 2: LabelColor:=FunnyChar[Green]; { \ Translate the } I€žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@.NNNNNNNNNNNNNNNNNNNNNN”””ū Delta<>0 then beginI if Delta>0 then TableEntry:=TableEntry+1 { \ Adjust } I else TableEntry:=TableEntry-1; { / the value } I if TableEntry>15 then TableEntry:=15; { \ keep it } I wŌžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ņņNNNNNNNNNNNNNNNNNNNNNN”””ū_Source:=TableEntry; gotoxy(0,21); 1 write('Use Knob to select color '); / write('to be copied,then press');  writeln(' C'); Mode:=Copy1  end; end; enŻžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@„®NNNNNNNNNNNNNNNNNNNNNN”””ū 3: LabelColor:=FunnyChar[Cyan]; { \ RGB background } I 4: LabelColor:=FunnyChar[Red]; { / sum to a } I 5: LabelColor:=FunnyChar[Magenta]; { / complementary } I 6: LabelColor:=Fun]mžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ 9NNNNNNNNNNNNNNNNNNNNNNž”””ū if TableEntry<0 then TableEntry:=0; { / in limits } D UpdateCursor(TableEntry); {indicate new entry} end; end; end; {case} I set_color_table(TableEntry, { \ vÅžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@keNNNNNNNNNNNNNNNNNNNNNN”””ūd; otherwise  end; {case} N {---- use delta created above to modify the proper value ----------------}: case Mode of {what am I doing?} Hue: beginK HueVal[TableEntry]:=HueVal[TableEntry]+Delta; Ā`žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@·ŸNNNNNNNNNNNNNNNNNNNNNN”””ūnyChar[Yellow]; { / text color. } I 7: LabelColor:=FunnyChar[White]; { / }  end; {case BacksSum of}E MenuLine; {print the menu line} N OldBackSum:=BackSum; KžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@ HjNNNNNNNNNNNNNNNNNNNNNNž”””ū} I HueVal[TableEntry], { \ Modify the } I SatVal[TableEntry], { / color map. } I LumVal[TableEntry]); { / } 0 if TableEntry=0 then ¢žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@XTNNNNNNNNNNNNNNNNNNNNNN”””ū {adjust it} L if HueVal[TableEntry]>1 then HueVal[TableEntry]:=0; {keep it...}N if HueVal[TableEntry]<0 then HueVal[TableEntry]:=1; {...in limits} end; Sat: beginK SatVal[TableEntry]:=SatVal[TableEntry]‘!žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””ž@‡ĀNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN””«€‚€ƒź„U†Ą‡+‰•ŠŒlÖŽA­‘“„”š•[—NNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAX¼NNNNNNNNNNNNNNNNNNNNNN”””ū {Main Program}’’{ / } H display_term; {deactivate the display}end; Ographics_term; {terminate the graphics system} ’’end. <·žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA„FNNNNNNNNNNNNNNNNNNNNNN”””ūt_color_model(1); {RGB} K for I:=0 to 15 do inq_color_table(I,RedVal[I], { \ Get the RGB } K GreenVal[I], { > definition } K BlueVal[I]5 žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAņNNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA kNNNNNNNNNNNNNNNNNNNNNN”””ū TŁžēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAŃNNNNNNNNNNNNNNNNNNNNNN”””ū); { / of the color }  writeln('Table'); & write('Index Hue Sat Lum');, writeln(' Red Green Blue');I for I:=0 to 15 do begin { \ } I write(I:3,' '); ĻŪžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAĮ+NNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA >ŽNNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA.ąNNNNNNNNNNNNNNNNNNNNNN”””ū { \ } I write(HueVal[I]:3:2,' '); { \ Write the color } I write(SatVal[I]:3:2,' '); { \ map entries as } I write(LumVal[I]:3:2,' '); { > both HSL and _ žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAŃNNNNNNNNNNNNNNNNNNNNNN”””ū {store for future comparisons}I set_color_table(1,1-RedBack, { \ Make pen one } I 1-GreenBack, { > complementary, } I 1-BlueBack); { / å'žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA  ļNNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA{³NNNNNNNNNNNNNNNNNNNNNN”””ū } I write(RedVal[I]:3:2,' '); { / RGB numbers. } I write(GreenVal[I]:3:2,' '); { / } I writeln(BlueVal[I]:3:2); { / } I end; žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAā$NNNNNNNNNNNNNNNNNNNNNN”””ū too. }  end; {if} 5 set_color_model(2); {HSL}  end; {if TableEntry=0}J DisplayStuff; {update alpha information}G until Done; {untilÖvžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA ”xNNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAH‚NNNNNNNNNNNNNNNNNNNNNN”””ū { / } H display_term; {deactivate the display}end; Ographics_term; {terminate the graphics system} >end. ‰žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA·wNNNNNNNNNNNNNNNNNNNNNN”””ū user pushes [Q]} O writeln(FunnyChar[Green],chr(128)); {restore text screen to normal} N {---- Report all this good stuff ------------------------------------------} Int_A:=0; 6 output_esc(Display_Cont,1,0,Int_A,Real_A,Error_Num);5 seĄGžĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA §INNNNNNNNNNNNNNNNNNNNNN”””ū TŁžNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žAńvNNNNNNNNNNNNNNNNNNNNNN”””ūē[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ŠNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žA«€‚ƒķ„X†Ć‡/‰šŠŒqÜŽH³‘“Š”õ•NNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBJÉNNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB –3NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBąoNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žByųNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB ¤NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBÓ^NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB,«NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB <•NNNNNNNNNNNNNNNNNNNNNN”””ūį"žēNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBĆ`NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBšNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBiĘNNNNNNNNNNNNNNNNNNNNNN”””ūį"žĪNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB šQNNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB† NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBZ÷NNNNNNNNNNNNNNNNNNNNNN”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žB „NNNNNNNNNNNNNNNNNNNNNNž”””ūį"žNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN”””žBµ