home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / gnuplot / part18 < prev    next >
Encoding:
Text File  |  1993-10-22  |  79.8 KB  |  2,565 lines

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i030:  gnuplot - interactive function plotting utility, Part18/33
  4. Message-ID: <1993Oct22.163646.24204@sparky.sterling.com>
  5. X-Md4-Signature: a629fd6fcbc790fd479cbaf2f9b82ff5
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Fri, 22 Oct 1993 16:36:46 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 30
  13. Archive-name: gnuplot/part18
  14. Environment: UNIX, MS-DOS, VMS
  15. Supersedes: gnuplot3: Volume 24, Issue 23-48
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  gnuplot/demo/antenna.dat gnuplot/standard.c
  22. #   gnuplot/term/latex.trm gnuplot/term/metafont.trm
  23. # Wrapped by kent@sparky on Wed Oct 20 17:14:52 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 18 (of 33)."'
  27. if test -f 'gnuplot/demo/antenna.dat' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'gnuplot/demo/antenna.dat'\"
  29. else
  30.   echo shar: Extracting \"'gnuplot/demo/antenna.dat'\" \(20641 characters\)
  31.   sed "s/^X//" >'gnuplot/demo/antenna.dat' <<'END_OF_FILE'
  32. X#
  33. X# $Id: antenna.dat 3.38.2.6 1992/11/14 02:25:21 woo Exp $
  34. X#
  35. X#
  36. X   0.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  37. X   2.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  38. X   4.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  39. X   6.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  40. X   8.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  41. X  10.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  42. X  12.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  43. X  14.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  44. X  16.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  45. X  18.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  46. X  20.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  47. X  22.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  48. X  24.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  49. X  26.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  50. X  28.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  51. X  30.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  52. X  32.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  53. X  34.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  54. X  36.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  55. X  38.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  56. X  40.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  57. X  42.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  58. X  44.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  59. X  46.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  60. X  48.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  61. X  50.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  62. X  52.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  63. X  54.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  64. X  56.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  65. X  58.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  66. X  60.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  67. X  62.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  68. X  64.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  69. X  66.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  70. X  68.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  71. X  70.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  72. X  72.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
  73. X  74.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  74. X  76.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  75. X  78.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  76. X  80.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  77. X  82.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  78. X  84.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  79. X  86.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  80. X  88.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  81. X  90.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  82. X  92.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  83. X  94.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  84. X  96.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  85. X  98.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  86. X 100.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  87. X 102.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  88. X 104.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  89. X 106.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  90. X 108.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  91. X 110.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  92. X 112.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  93. X 114.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  94. X 116.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  95. X 118.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  96. X 120.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  97. X 122.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  98. X 124.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  99. X 126.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  100. X 128.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  101. X 130.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  102. X 132.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  103. X 134.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  104. X 136.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  105. X 138.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  106. X 140.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  107. X 142.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  108. X 144.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  109. X 146.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  110. X 148.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  111. X 150.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  112. X 152.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  113. X 154.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  114. X 156.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  115. X 158.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  116. X 160.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  117. X 162.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  118. X 164.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  119. X 166.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  120. X 168.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  121. X 170.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  122. X 172.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  123. X 174.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  124. X 176.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  125. X 178.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  126. X 180.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  127. X 182.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  128. X 184.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  129. X 186.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  130. X 188.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  131. X 190.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  132. X 192.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  133. X 194.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  134. X 196.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  135. X 198.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  136. X 200.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  137. X 202.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  138. X 204.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  139. X 206.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  140. X 208.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  141. X 210.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  142. X 212.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  143. X 214.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  144. X 216.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  145. X 218.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  146. X 220.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  147. X 222.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  148. X 224.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  149. X 226.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  150. X 228.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  151. X 230.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  152. X 232.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  153. X 234.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  154. X 236.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  155. X 238.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  156. X 240.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  157. X 242.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  158. X 244.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  159. X 246.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  160. X 248.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  161. X 250.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  162. X 252.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
  163. X 254.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  164. X 256.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  165. X 258.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  166. X 260.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  167. X 262.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  168. X 264.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  169. X 266.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  170. X 268.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  171. X 270.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  172. X 272.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  173. X 274.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  174. X 276.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  175. X 278.000  13.099E-02  42.554E-01 -25.105E+00  59.101E-01
  176. X 280.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  177. X 282.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  178. X 284.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  179. X 286.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  180. X 288.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  181. X 290.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  182. X 292.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  183. X 294.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  184. X 296.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  185. X 298.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  186. X 300.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  187. X 302.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  188. X 304.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  189. X 306.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  190. X 308.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  191. X 310.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  192. X 312.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  193. X 314.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  194. X 316.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  195. X 318.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  196. X 320.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  197. X 322.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  198. X 324.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  199. X 326.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  200. X 328.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  201. X 330.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  202. X 332.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  203. X 334.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  204. X 336.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  205. X 338.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  206. X 340.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  207. X 342.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  208. X 344.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  209. X 346.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  210. X 348.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  211. X 350.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  212. X 352.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  213. X 354.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  214. X 356.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  215. X 358.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  216. X 360.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  217. X   2.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  218. X   4.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  219. X   6.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  220. X   8.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  221. X  10.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  222. X  12.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  223. X  14.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  224. X  16.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  225. X  18.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  226. X  20.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  227. X  22.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  228. X  24.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  229. X  26.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  230. X  28.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  231. X  30.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  232. X  32.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  233. X  34.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  234. X  36.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  235. X  38.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  236. X  40.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  237. X  42.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  238. X  44.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  239. X  46.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  240. X  48.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  241. X  50.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  242. X  52.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  243. X  54.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  244. X  56.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  245. X  58.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  246. X  60.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  247. X  62.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  248. X  64.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  249. X  66.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  250. X  68.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  251. X  70.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  252. X  72.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
  253. X  74.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  254. X  76.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  255. X  78.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  256. X  80.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  257. X  82.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  258. X  84.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  259. X  86.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  260. X  88.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  261. X  90.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  262. X  92.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  263. X  94.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  264. X  96.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  265. X  98.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  266. X 100.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  267. X 102.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  268. X 104.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  269. X 106.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  270. X 108.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  271. X 110.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  272. X 112.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  273. X 114.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  274. X 116.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  275. X 118.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  276. X 120.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  277. X 122.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  278. X 124.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  279. X 126.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  280. X 128.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  281. X 130.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  282. X 132.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  283. X 134.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  284. X 136.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  285. X 138.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  286. X 140.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  287. X 142.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  288. X 144.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  289. X 146.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  290. X 148.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  291. X 150.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  292. X 152.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  293. X 154.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  294. X 156.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  295. X 158.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  296. X 160.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  297. X 162.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  298. X 164.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  299. X 166.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  300. X 168.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  301. X 170.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  302. X 172.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  303. X 174.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  304. X 176.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  305. X 178.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  306. X 180.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  307. X 182.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  308. X 184.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  309. X 186.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  310. X 188.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  311. X 190.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  312. X 192.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  313. X 194.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  314. X 196.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  315. X 198.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  316. X 200.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  317. X 202.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  318. X 204.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  319. X 206.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  320. X 208.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  321. X 210.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  322. X 212.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  323. X 214.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  324. X 216.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  325. X 218.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  326. X 220.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  327. X 222.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  328. X 224.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  329. X 226.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  330. X 228.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  331. X 230.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  332. X 232.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  333. X 234.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  334. X 236.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  335. X 238.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  336. X 240.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  337. X 242.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  338. X 244.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  339. X 246.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  340. X 248.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  341. X 250.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  342. X 252.000 -41.802E+00 -37.180E+00 -39.114E+00 -24.830E+00
  343. X 254.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  344. X 256.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  345. X 258.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  346. X 260.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  347. X 262.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  348. X 264.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  349. X 266.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  350. X 268.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  351. X 270.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  352. X 272.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  353. X 274.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  354. X 276.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  355. X 278.000  13.099E-02  42.554E-01 -25.105E+00  59.101E-01
  356. X 280.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  357. X 282.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  358. X 284.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  359. X 286.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  360. X 288.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  361. X 290.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  362. X 292.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  363. X 294.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  364. X 296.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  365. X 298.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  366. X 300.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  367. X 302.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  368. X 304.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  369. X 306.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  370. X 308.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  371. X 310.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  372. X 312.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  373. X 314.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  374. X 316.000 -39.287E+00 -23.397E+00 -38.646E+00 -60.943E-01
  375. X 318.000 -38.418E+00 -14.735E+00 -29.897E+00 -76.375E-01
  376. X 320.000 -36.549E+00 -12.197E+00 -27.142E+00 -11.075E+00
  377. X 322.000 -35.220E+00 -12.594E+00 -27.052E+00 -15.787E+00
  378. X 324.000 -35.691E+00 -16.286E+00 -29.566E+00 -13.578E+00
  379. X 326.000 -37.632E+00 -21.690E+00 -37.458E+00 -96.424E-01
  380. X 328.000 -33.989E+00 -13.340E+00 -38.930E+00 -75.039E-01
  381. X 330.000 -28.216E+00 -83.757E-01 -29.576E+00 -64.985E-01
  382. X 332.000 -24.356E+00 -58.580E-01 -26.299E+00 -60.712E-01
  383. X 334.000 -22.103E+00 -48.803E-01 -25.429E+00 -59.416E-01
  384. X 336.000 -21.258E+00 -52.193E-01 -26.432E+00 -62.183E-01
  385. X 338.000 -22.060E+00 -71.064E-01 -29.743E+00 -74.312E-01
  386. X 340.000 -25.979E+00 -11.868E+00 -38.677E+00 -10.860E+00
  387. X 342.000 -41.802E+00 -37.181E+00 -39.114E+00 -24.830E+00
  388. X 344.000 -20.405E+00 -10.185E+00 -30.112E+00 -11.564E+00
  389. X 346.000 -12.849E+00 -36.543E-01 -26.702E+00 -36.253E-01
  390. X 348.000 -76.407E-01  15.917E-02 -25.211E+00  82.257E-02
  391. X 350.000 -34.589E-01  26.769E-01 -24.794E+00  38.084E-01
  392. X 352.000  13.100E-02  42.554E-01 -25.105E+00  59.101E-01
  393. X 354.000  33.053E-01  48.742E-01 -26.062E+00  73.795E-01
  394. X 356.000  60.696E-01  40.782E-01 -28.040E+00  83.501E-01
  395. X 358.000  81.667E-01  13.355E-02 -32.735E+00  89.007E-01
  396. X 360.000  90.007E-01 -35.926E+00 -71.297E+00  90.783E-01
  397. END_OF_FILE
  398.   if test 20641 -ne `wc -c <'gnuplot/demo/antenna.dat'`; then
  399.     echo shar: \"'gnuplot/demo/antenna.dat'\" unpacked with wrong size!
  400.   fi
  401.   # end of 'gnuplot/demo/antenna.dat'
  402. fi
  403. if test -f 'gnuplot/standard.c' -a "${1}" != "-c" ; then 
  404.   echo shar: Will not clobber existing file \"'gnuplot/standard.c'\"
  405. else
  406.   echo shar: Extracting \"'gnuplot/standard.c'\" \(20414 characters\)
  407.   sed "s/^X//" >'gnuplot/standard.c' <<'END_OF_FILE'
  408. X#ifndef lint
  409. Xstatic char *RCSid = "$Id: standard.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  410. X#endif
  411. X
  412. X
  413. X/* GNUPLOT - standard.c */
  414. X/*
  415. X * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  416. X *
  417. X * Permission to use, copy, and distribute this software and its
  418. X * documentation for any purpose with or without fee is hereby granted, 
  419. X * provided that the above copyright notice appear in all copies and 
  420. X * that both that copyright notice and this permission notice appear 
  421. X * in supporting documentation.
  422. X *
  423. X * Permission to modify the software is granted, but not the right to
  424. X * distribute the modified code.  Modifications are to be distributed 
  425. X * as patches to released version.
  426. X *  
  427. X * This software is provided "as is" without express or implied warranty.
  428. X * 
  429. X *
  430. X * AUTHORS
  431. X * 
  432. X *   Original Software:
  433. X *     Thomas Williams,  Colin Kelley.
  434. X * 
  435. X *   Gnuplot 2.0 additions:
  436. X *       Russell Lang, Dave Kotz, John Campbell.
  437. X *
  438. X *   Gnuplot 3.0 additions:
  439. X *       Gershon Elber and many others.
  440. X * 
  441. X */
  442. X
  443. X#include <math.h>
  444. X#include <stdio.h>
  445. X#include "plot.h"
  446. X
  447. X#ifdef vms
  448. X#include <errno.h>
  449. X#else
  450. Xextern int errno;
  451. X#endif /* vms */
  452. X
  453. X
  454. Xextern struct value stack[STACK_DEPTH];
  455. Xextern int s_p;
  456. Xextern double zero;
  457. X
  458. Xstruct value *pop(), *Gcomplex(), *Ginteger();
  459. X
  460. Xdouble magnitude(), angle(), real(), imag();
  461. X
  462. X/* The bessel function approximations here are from
  463. X * "Computer Approximations"
  464. X * by Hart, Cheney et al.
  465. X * John Wiley & Sons, 1968
  466. X */
  467. X
  468. X/* There appears to be a mistake in Hart, Cheney et al. on page 149.
  469. X * Where it list Qn(x)/x ~ P(z*z)/Q(z*z), z = 8/x, it should read
  470. X *               Qn(x)/z ~ P(z*z)/Q(z*z), z = 8/x
  471. X * In the functions below, Qn(x) is implementated using the later
  472. X * equation.
  473. X * These bessel functions are accurate to about 1e-13
  474. X */
  475. X
  476. X#if defined (ATARI) && defined(__PUREC__)
  477. X/* Sorry. But PUREC bugs here.
  478. X * These bessel functions are NOT accurate to about 1e-13
  479. X */
  480. X
  481. X#define PI_ON_FOUR     0.785398163397448309615661
  482. X#define PI_ON_TWO     1.570796326794896619231313
  483. X#define THREE_PI_ON_FOUR 2.356194490192344928846982
  484. X#define TWO_ON_PI     0.636619772367581343075535
  485. X
  486. Xstatic double dzero = 0.0;
  487. X
  488. X/* jzero for x in [0,8]
  489. X * Index 5849, 19.22 digits precision
  490. X */
  491. Xstatic double pjzero[] = {
  492. X     0.493378725179413356181681e+21,
  493. X    -0.117915762910761053603844e+21,
  494. X     0.638205934107235656228943e+19,
  495. X    -0.136762035308817138686542e+18,
  496. X     0.143435493914034611166432e+16,
  497. X    -0.808522203485379387119947e+13,
  498. X     0.250715828553688194555516e+11,
  499. X    -0.405041237183313270636066e+8,
  500. X     0.268578685698001498141585e+5
  501. X};
  502. X
  503. Xstatic double qjzero[] = {
  504. X     0.493378725179413356211328e+21,
  505. X     0.542891838409228516020019e+19,
  506. X     0.302463561670946269862733e+17,
  507. X     0.112775673967979850705603e+15,
  508. X     0.312304311494121317257247e+12,
  509. X     0.669998767298223967181403e+9,
  510. X     0.111463609846298537818240e+7,
  511. X     0.136306365232897060444281e+4,
  512. X     0.1e+1
  513. X};
  514. X
  515. X/* pzero for x in [8,inf]
  516. X * Index 6548, 18.16 digits precision
  517. X */
  518. Xstatic double ppzero[] = {
  519. X     0.227790901973046843022700e+5,
  520. X     0.413453866395807657967802e+5,
  521. X     0.211705233808649443219340e+5,
  522. X     0.348064864432492703474453e+4,
  523. X     0.153762019090083542957717e+3,
  524. X     0.889615484242104552360748e+0
  525. X};
  526. X
  527. Xstatic double qpzero[] = {
  528. X     0.227790901973046843176842e+5,
  529. X     0.413704124955104166398920e+5,
  530. X     0.212153505618801157304226e+5,
  531. X     0.350287351382356082073561e+4,
  532. X     0.157111598580808936490685e+3,
  533. X     0.1e+1
  534. X};
  535. X
  536. X/* qzero for x in [8,inf]
  537. X * Index 6948, 18.33 digits precision
  538. X */
  539. Xstatic double pqzero[] = {
  540. X    -0.892266002008000940984692e+2,
  541. X    -0.185919536443429938002522e+3,
  542. X    -0.111834299204827376112621e+3,
  543. X    -0.223002616662141984716992e+2,
  544. X    -0.124410267458356384591379e+1,
  545. X    -0.8803330304868075181663e-2,
  546. X};
  547. X
  548. Xstatic double qqzero[] = {
  549. X     0.571050241285120619052476e+4,
  550. X     0.119511315434346136469526e+5,
  551. X     0.726427801692110188369134e+4,
  552. X     0.148872312322837565816135e+4,
  553. X     0.905937695949931258588188e+2,
  554. X     0.1e+1
  555. X};
  556. X
  557. X
  558. X/* yzero for x in [0,8]
  559. X * Index 6245, 18.78 digits precision
  560. X */
  561. Xstatic double pyzero[] = {
  562. X    -0.275028667862910958370193e+20,
  563. X     0.658747327571955492599940e+20,
  564. X    -0.524706558111276494129735e+19,
  565. X     0.137562431639934407857134e+18,
  566. X    -0.164860581718572947312208e+16,
  567. X     0.102552085968639428450917e+14,
  568. X    -0.343637122297904037817103e+11,
  569. X     0.591521346568688965427383e+8,
  570. X    -0.413703549793314855412524e+5
  571. X};
  572. X
  573. Xstatic double qyzero[] = {
  574. X     0.372645883898616588198998e+21,
  575. X     0.419241704341083997390477e+19,
  576. X     0.239288304349978185743936e+17,
  577. X     0.916203803407518526248915e+14,
  578. X     0.261306575504108124956848e+12,
  579. X     0.579512264070072953738009e+9,
  580. X     0.100170264128890626566665e+7,
  581. X     0.128245277247899380417633e+4,
  582. X     0.1e+1
  583. X};
  584. X
  585. X
  586. X/* jone for x in [0,8]
  587. X * Index 6050, 20.98 digits precision
  588. X */
  589. Xstatic double pjone[] = {
  590. X     0.581199354001606143928051e+21,
  591. X    -0.667210656892491629802094e+20,
  592. X     0.231643358063400229793182e+19,
  593. X    -0.358881756991010605074364e+17,
  594. X     0.290879526383477540973760e+15,
  595. X    -0.132298348033212645312547e+13,
  596. X     0.341323418230170053909129e+10,
  597. X    -0.469575353064299585976716e+7,
  598. X     0.270112271089232341485679e+4
  599. X};
  600. X
  601. Xstatic double qjone[] = {
  602. X     0.116239870800321228785853e+22,
  603. X     0.118577071219032099983711e+20,
  604. X     0.609206139891752174610520e+17,
  605. X     0.208166122130760735124018e+15,
  606. X     0.524371026216764971540673e+12,
  607. X     0.101386351435867398996705e+10,
  608. X     0.150179359499858550592110e+7,
  609. X     0.160693157348148780197092e+4,
  610. X     0.1e+1
  611. X};
  612. X
  613. X
  614. X/* pone for x in [8,inf]
  615. X * Index 6749, 18.11 digits precision
  616. X */
  617. Xstatic double ppone[] = {
  618. X     0.352246649133679798341724e+5,
  619. X     0.627588452471612812690057e+5,
  620. X     0.313539631109159574238670e+5,
  621. X     0.498548320605943384345005e+4,
  622. X     0.211152918285396238210572e+3,
  623. X     0.12571716929145341558495e+1
  624. X};
  625. X
  626. Xstatic double qpone[] = {
  627. X     0.352246649133679798068390e+5,
  628. X     0.626943469593560511888834e+5,
  629. X     0.312404063819041039923016e+5,
  630. X     0.493039649018108897938610e+4,
  631. X     0.203077518913475932229357e+3,
  632. X     0.1e+1
  633. X};
  634. X
  635. X/* qone for x in [8,inf]
  636. X * Index 7149, 18.28 digits precision
  637. X */
  638. Xstatic double pqone[] = {
  639. X     0.351175191430355282253332e+3,
  640. X     0.721039180490447503928086e+3,
  641. X     0.425987301165444238988699e+3,
  642. X     0.831898957673850827325226e+2,
  643. X     0.45681716295512267064405e+1,
  644. X     0.3532840052740123642735e-1
  645. X};
  646. X
  647. Xstatic double qqone[] = {
  648. X     0.749173741718091277145195e+4,
  649. X     0.154141773392650970499848e+5,
  650. X     0.915223170151699227059047e+4,
  651. X     0.181118670055235135067242e+4,
  652. X     0.103818758546213372877664e+3,
  653. X     0.1e+1
  654. X};
  655. X
  656. X
  657. X/* yone for x in [0,8]
  658. X * Index 6444, 18.24 digits precision
  659. X */
  660. Xstatic double pyone[] = {
  661. X    -0.292382196153296254310105e+20,
  662. X     0.774852068218683964508809e+19,
  663. X    -0.344104806308411444618546e+18,
  664. X     0.591516076049007061849632e+16,
  665. X    -0.486331694256717507482813e+14,
  666. X     0.204969667374566218261980e+12,
  667. X    -0.428947196885524880182182e+9,
  668. X     0.355692400983052605669132e+6
  669. X};
  670. X
  671. Xstatic double qyone[] = {
  672. X     0.149131151130292035017408e+21,
  673. X     0.181866284170613498688507e+19,
  674. X     0.113163938269888452690508e+17,
  675. X     0.475517358888813771309277e+14,
  676. X     0.150022169915670898716637e+12,
  677. X     0.371666079862193028559693e+9,
  678. X     0.726914730719888456980191e+6,
  679. X     0.107269614377892552332213e+4,
  680. X     0.1e+1
  681. X};
  682. X
  683. X#else
  684. X
  685. X#define PI_ON_FOUR       0.78539816339744830961566084581987572
  686. X#define PI_ON_TWO        1.57079632679489661923131269163975144
  687. X#define THREE_PI_ON_FOUR 2.35619449019234492884698253745962716
  688. X#define TWO_ON_PI        0.63661977236758134307553505349005744
  689. X
  690. Xstatic double dzero = 0.0;
  691. X
  692. X/* jzero for x in [0,8]
  693. X * Index 5849, 19.22 digits precision
  694. X */
  695. Xstatic double pjzero[] = {
  696. X     0.4933787251794133561816813446e+21,
  697. X    -0.11791576291076105360384408e+21,
  698. X     0.6382059341072356562289432465e+19,
  699. X    -0.1367620353088171386865416609e+18,
  700. X     0.1434354939140346111664316553e+16,
  701. X    -0.8085222034853793871199468171e+13,
  702. X     0.2507158285536881945555156435e+11,
  703. X    -0.4050412371833132706360663322e+8,
  704. X     0.2685786856980014981415848441e+5
  705. X};
  706. X
  707. Xstatic double qjzero[] = {
  708. X    0.4933787251794133562113278438e+21,
  709. X    0.5428918384092285160200195092e+19,
  710. X    0.3024635616709462698627330784e+17,
  711. X    0.1127756739679798507056031594e+15,
  712. X    0.3123043114941213172572469442e+12,
  713. X    0.669998767298223967181402866e+9,
  714. X    0.1114636098462985378182402543e+7,
  715. X    0.1363063652328970604442810507e+4,
  716. X    0.1e+1
  717. X};
  718. X
  719. X/* pzero for x in [8,inf]
  720. X * Index 6548, 18.16 digits precision
  721. X */
  722. Xstatic double ppzero[] = {
  723. X    0.2277909019730468430227002627e+5,
  724. X    0.4134538663958076579678016384e+5,
  725. X    0.2117052338086494432193395727e+5,
  726. X    0.348064864432492703474453111e+4,
  727. X    0.15376201909008354295771715e+3,
  728. X    0.889615484242104552360748e+0
  729. X};
  730. X
  731. Xstatic double qpzero[] = {
  732. X    0.2277909019730468431768423768e+5,
  733. X    0.4137041249551041663989198384e+5,
  734. X    0.2121535056188011573042256764e+5,
  735. X    0.350287351382356082073561423e+4,
  736. X    0.15711159858080893649068482e+3,
  737. X    0.1e+1
  738. X};
  739. X
  740. X/* qzero for x in [8,inf]
  741. X * Index 6948, 18.33 digits precision
  742. X */
  743. Xstatic double pqzero[] = {
  744. X    -0.8922660020080009409846916e+2,
  745. X    -0.18591953644342993800252169e+3,
  746. X    -0.11183429920482737611262123e+3,
  747. X    -0.2230026166621419847169915e+2,
  748. X    -0.124410267458356384591379e+1,
  749. X    -0.8803330304868075181663e-2,
  750. X};
  751. X
  752. Xstatic double qqzero[] = {
  753. X    0.571050241285120619052476459e+4,
  754. X    0.1195113154343461364695265329e+5,
  755. X    0.726427801692110188369134506e+4,
  756. X    0.148872312322837565816134698e+4,
  757. X    0.9059376959499312585881878e+2,
  758. X    0.1e+1
  759. X};
  760. X
  761. X
  762. X/* yzero for x in [0,8]
  763. X * Index 6245, 18.78 digits precision
  764. X */
  765. Xstatic double pyzero[] = {
  766. X    -0.2750286678629109583701933175e+20,
  767. X     0.6587473275719554925999402049e+20,
  768. X    -0.5247065581112764941297350814e+19,
  769. X     0.1375624316399344078571335453e+18,
  770. X    -0.1648605817185729473122082537e+16,
  771. X     0.1025520859686394284509167421e+14,
  772. X    -0.3436371222979040378171030138e+11,
  773. X     0.5915213465686889654273830069e+8,
  774. X    -0.4137035497933148554125235152e+5
  775. X};
  776. X
  777. Xstatic double qyzero[] = {
  778. X    0.3726458838986165881989980739e+21,
  779. X    0.4192417043410839973904769661e+19,
  780. X    0.2392883043499781857439356652e+17,
  781. X    0.9162038034075185262489147968e+14,
  782. X    0.2613065755041081249568482092e+12,
  783. X    0.5795122640700729537380087915e+9,
  784. X    0.1001702641288906265666651753e+7,
  785. X    0.1282452772478993804176329391e+4,
  786. X    0.1e+1
  787. X};
  788. X
  789. X
  790. X/* jone for x in [0,8]
  791. X * Index 6050, 20.98 digits precision
  792. X */
  793. Xstatic double pjone[] = {
  794. X     0.581199354001606143928050809e+21,
  795. X    -0.6672106568924916298020941484e+20,
  796. X     0.2316433580634002297931815435e+19,
  797. X    -0.3588817569910106050743641413e+17,
  798. X     0.2908795263834775409737601689e+15,
  799. X    -0.1322983480332126453125473247e+13,
  800. X     0.3413234182301700539091292655e+10,
  801. X    -0.4695753530642995859767162166e+7,
  802. X     0.270112271089232341485679099e+4
  803. X};
  804. X
  805. Xstatic double qjone[] = {
  806. X    0.11623987080032122878585294e+22,
  807. X    0.1185770712190320999837113348e+20,
  808. X    0.6092061398917521746105196863e+17,
  809. X    0.2081661221307607351240184229e+15,
  810. X    0.5243710262167649715406728642e+12,
  811. X    0.1013863514358673989967045588e+10,
  812. X    0.1501793594998585505921097578e+7,
  813. X    0.1606931573481487801970916749e+4,
  814. X    0.1e+1
  815. X};
  816. X
  817. X
  818. X/* pone for x in [8,inf]
  819. X * Index 6749, 18.11 digits precision
  820. X */
  821. Xstatic double ppone[] = {
  822. X    0.352246649133679798341724373e+5,
  823. X    0.62758845247161281269005675e+5,
  824. X    0.313539631109159574238669888e+5,
  825. X    0.49854832060594338434500455e+4,
  826. X    0.2111529182853962382105718e+3,
  827. X    0.12571716929145341558495e+1
  828. X};
  829. X
  830. Xstatic double qpone[] = {
  831. X    0.352246649133679798068390431e+5,
  832. X    0.626943469593560511888833731e+5,
  833. X    0.312404063819041039923015703e+5,
  834. X    0.4930396490181088979386097e+4,
  835. X    0.2030775189134759322293574e+3,
  836. X    0.1e+1
  837. X};
  838. X
  839. X/* qone for x in [8,inf]
  840. X * Index 7149, 18.28 digits precision
  841. X */
  842. Xstatic double pqone[] = {
  843. X    0.3511751914303552822533318e+3,
  844. X    0.7210391804904475039280863e+3,
  845. X    0.4259873011654442389886993e+3,
  846. X    0.831898957673850827325226e+2,
  847. X    0.45681716295512267064405e+1,
  848. X    0.3532840052740123642735e-1
  849. X};
  850. X
  851. Xstatic double qqone[] = {
  852. X    0.74917374171809127714519505e+4,
  853. X    0.154141773392650970499848051e+5,
  854. X    0.91522317015169922705904727e+4,
  855. X    0.18111867005523513506724158e+4,
  856. X    0.1038187585462133728776636e+3,
  857. X    0.1e+1
  858. X};
  859. X
  860. X
  861. X/* yone for x in [0,8]
  862. X * Index 6444, 18.24 digits precision
  863. X */
  864. Xstatic double pyone[] = {
  865. X    -0.2923821961532962543101048748e+20,
  866. X     0.7748520682186839645088094202e+19,
  867. X    -0.3441048063084114446185461344e+18,
  868. X     0.5915160760490070618496315281e+16,
  869. X    -0.4863316942567175074828129117e+14,
  870. X     0.2049696673745662182619800495e+12,
  871. X    -0.4289471968855248801821819588e+9,
  872. X     0.3556924009830526056691325215e+6
  873. X};
  874. X
  875. Xstatic double qyone[] = {
  876. X    0.1491311511302920350174081355e+21,
  877. X    0.1818662841706134986885065935e+19,
  878. X    0.113163938269888452690508283e+17,
  879. X    0.4755173588888137713092774006e+14,
  880. X    0.1500221699156708987166369115e+12,
  881. X    0.3716660798621930285596927703e+9,
  882. X    0.726914730719888456980191315e+6,
  883. X    0.10726961437789255233221267e+4,
  884. X    0.1e+1
  885. X};
  886. X
  887. X#endif /* ATARI && __PUREC__ */
  888. X
  889. Xf_real()
  890. X{
  891. Xstruct value a;
  892. X    push( Gcomplex(&a,real(pop(&a)), 0.0) );
  893. X}
  894. X
  895. Xf_imag()
  896. X{
  897. Xstruct value a;
  898. X    push( Gcomplex(&a,imag(pop(&a)), 0.0) );
  899. X}
  900. X
  901. Xf_arg()
  902. X{
  903. Xstruct value a;
  904. X    push( Gcomplex(&a,angle(pop(&a)), 0.0) );
  905. X}
  906. X
  907. Xf_conjg()
  908. X{
  909. Xstruct value a;
  910. X    (void) pop(&a);
  911. X    push( Gcomplex(&a,real(&a),-imag(&a) ));
  912. X}
  913. X
  914. Xf_sin()
  915. X{
  916. Xstruct value a;
  917. X    (void) pop(&a);
  918. X    push( Gcomplex(&a,sin(real(&a))*cosh(imag(&a)), cos(real(&a))*sinh(imag(&a))) );
  919. X}
  920. X
  921. Xf_cos()
  922. X{
  923. Xstruct value a;
  924. X    (void) pop(&a);
  925. X    push( Gcomplex(&a,cos(real(&a))*cosh(imag(&a)), -sin(real(&a))*sinh(imag(&a))));
  926. X}
  927. X
  928. Xf_tan()
  929. X{
  930. Xstruct value a;
  931. Xregister double den;
  932. X    (void) pop(&a);
  933. X    if (imag(&a) == 0.0)
  934. X        push( Gcomplex(&a,tan(real(&a)),0.0) );
  935. X    else {
  936. X        den = cos(2*real(&a))+cosh(2*imag(&a));
  937. X        if (den == 0.0) {
  938. X            undefined = TRUE;
  939. X            push( &a );
  940. X        }
  941. X        else
  942. X            push( Gcomplex(&a,sin(2*real(&a))/den, sinh(2*imag(&a))/den) );
  943. X    }
  944. X}
  945. X
  946. Xf_asin()
  947. X{
  948. Xstruct value a;
  949. Xregister double alpha, beta, x, y;
  950. X    (void) pop(&a);
  951. X    x = real(&a); y = imag(&a);
  952. X    if (y == 0.0) {
  953. X        if (fabs(x) > 1.0) {
  954. X            undefined = TRUE;
  955. X            push(Gcomplex(&a,0.0, 0.0));
  956. X        } else
  957. X            push( Gcomplex(&a,asin(x),0.0) );
  958. X    } else {
  959. X        beta  = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
  960. X        alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
  961. X        push( Gcomplex(&a,asin(beta), log(alpha + sqrt(alpha*alpha-1))) );
  962. X    }
  963. X}
  964. X
  965. Xf_acos()
  966. X{
  967. Xstruct value a;
  968. Xregister double alpha, beta, x, y;
  969. X    (void) pop(&a);
  970. X    x = real(&a); y = imag(&a);
  971. X    if (y == 0.0) {
  972. X        if (fabs(x) > 1.0) {
  973. X            undefined = TRUE;
  974. X            push(Gcomplex(&a,0.0, 0.0));
  975. X        } else
  976. X            push( Gcomplex(&a,acos(x),0.0) );
  977. X    } else {
  978. X        alpha = sqrt((x + 1)*(x + 1) + y*y)/2 + sqrt((x - 1)*(x - 1) + y*y)/2;
  979. X        beta  = sqrt((x + 1)*(x + 1) + y*y)/2 - sqrt((x - 1)*(x - 1) + y*y)/2;
  980. X        push( Gcomplex(&a,acos(beta), log(alpha + sqrt(alpha*alpha-1))) );
  981. X    }
  982. X}
  983. X
  984. Xf_atan()
  985. X{
  986. Xstruct value a;
  987. Xregister double x, y, u, v, w, z;
  988. X    (void) pop(&a);
  989. X    x = real(&a); y = imag(&a);
  990. X    if (y == 0.0)
  991. X        push( Gcomplex(&a,atan(x), 0.0) );
  992. X    else if (x == 0.0 && fabs(y) == 1.0) {
  993. X        undefined = TRUE;
  994. X        push(Gcomplex(&a,0.0, 0.0));
  995. X    } else {
  996. X            if (x >= 0) {
  997. X                u = x;
  998. X            v = y;
  999. X        } else {
  1000. X                u = -x;
  1001. X            v = -y;
  1002. X        }
  1003. X        
  1004. X            z = atan(2*u/(1-u*u-v*v));
  1005. X        w = log((u*u+(v+1)*(v+1))/(u*u+(v-1)*(v-1)))/4;
  1006. X        if (z < 0)
  1007. X                z = z + 2*PI_ON_TWO;
  1008. X        if (x < 0) {
  1009. X                z = -z;
  1010. X            w = -w;
  1011. X        }
  1012. X        push( Gcomplex(&a,0.5*z, w) );
  1013. X    }
  1014. X}
  1015. X
  1016. Xf_sinh()
  1017. X{
  1018. Xstruct value a;
  1019. X    (void) pop(&a);
  1020. X    push( Gcomplex(&a,sinh(real(&a))*cos(imag(&a)), cosh(real(&a))*sin(imag(&a))) );
  1021. X}
  1022. X
  1023. Xf_cosh()
  1024. X{
  1025. Xstruct value a;
  1026. X    (void) pop(&a);
  1027. X    push( Gcomplex(&a,cosh(real(&a))*cos(imag(&a)), sinh(real(&a))*sin(imag(&a))) );
  1028. X}
  1029. X
  1030. Xf_tanh()
  1031. X{
  1032. Xstruct value a;
  1033. Xregister double den;
  1034. X    (void) pop(&a);
  1035. X    den = cosh(2*real(&a)) + cos(2*imag(&a));
  1036. X    push( Gcomplex(&a,sinh(2*real(&a))/den, sin(2*imag(&a))/den) );
  1037. X}
  1038. X
  1039. Xf_int()
  1040. X{
  1041. Xstruct value a;
  1042. X    push( Ginteger(&a,(int)real(pop(&a))) );
  1043. X}
  1044. X
  1045. X
  1046. Xf_abs()
  1047. X{
  1048. Xstruct value a;
  1049. X    (void) pop(&a);
  1050. X    switch (a.type) {
  1051. X        case INTGR:
  1052. X            push( Ginteger(&a,abs(a.v.int_val)) );            
  1053. X            break;
  1054. X        case CMPLX:
  1055. X            push( Gcomplex(&a,magnitude(&a), 0.0) );
  1056. X    }
  1057. X}
  1058. X
  1059. Xf_sgn()
  1060. X{
  1061. Xstruct value a;
  1062. X    (void) pop(&a);
  1063. X    switch(a.type) {
  1064. X        case INTGR:
  1065. X            push( Ginteger(&a,(a.v.int_val > 0) ? 1 : 
  1066. X                    (a.v.int_val < 0) ? -1 : 0) );
  1067. X            break;
  1068. X        case CMPLX:
  1069. X            push( Ginteger(&a,(a.v.cmplx_val.real > 0.0) ? 1 : 
  1070. X                    (a.v.cmplx_val.real < 0.0) ? -1 : 0) );
  1071. X            break;
  1072. X    }
  1073. X}
  1074. X
  1075. X
  1076. Xf_sqrt()
  1077. X{
  1078. Xstruct value a;
  1079. Xregister double mag, ang;
  1080. X    (void) pop(&a);
  1081. X    mag = sqrt(magnitude(&a));
  1082. X    if (imag(&a) == 0.0 && real(&a) < 0.0)
  1083. X        push( Gcomplex(&a,0.0,mag) );
  1084. X    else
  1085. X    {
  1086. X        if ( (ang = angle(&a)) < 0.0)
  1087. X            ang += 2*Pi;
  1088. X        ang /= 2;
  1089. X        push( Gcomplex(&a,mag*cos(ang), mag*sin(ang)) );
  1090. X    }
  1091. X}
  1092. X
  1093. X
  1094. Xf_exp()
  1095. X{
  1096. Xstruct value a;
  1097. Xregister double mag, ang;
  1098. X    (void) pop(&a);
  1099. X    mag = exp(real(&a));
  1100. X    ang = imag(&a);
  1101. X    push( Gcomplex(&a,mag*cos(ang), mag*sin(ang)) );
  1102. X}
  1103. X
  1104. X
  1105. Xf_log10()
  1106. X{
  1107. Xstruct value a;
  1108. Xregister double l10;;
  1109. X    (void) pop(&a);
  1110. X    l10 = log(10.0);    /***** replace with a constant! ******/
  1111. X    push( Gcomplex(&a,log(magnitude(&a))/l10, angle(&a)/l10) );
  1112. X}
  1113. X
  1114. X
  1115. Xf_log()
  1116. X{
  1117. Xstruct value a;
  1118. X    (void) pop(&a);
  1119. X    push( Gcomplex(&a,log(magnitude(&a)), angle(&a)) );
  1120. X}
  1121. X
  1122. X
  1123. Xf_floor()
  1124. X{
  1125. Xstruct value a;
  1126. X
  1127. X    (void) pop(&a);
  1128. X    switch (a.type) {
  1129. X        case INTGR:
  1130. X            push( Ginteger(&a,(int)floor((double)a.v.int_val)));            
  1131. X            break;
  1132. X        case CMPLX:
  1133. X            push( Ginteger(&a,(int)floor(a.v.cmplx_val.real)));
  1134. X    }
  1135. X}
  1136. X
  1137. X
  1138. Xf_ceil()
  1139. X{
  1140. Xstruct value a;
  1141. X
  1142. X    (void) pop(&a);
  1143. X    switch (a.type) {
  1144. X        case INTGR:
  1145. X            push( Ginteger(&a,(int)ceil((double)a.v.int_val)));            
  1146. X            break;
  1147. X        case CMPLX:
  1148. X            push( Ginteger(&a,(int)ceil(a.v.cmplx_val.real)));
  1149. X    }
  1150. X}
  1151. X
  1152. X/* bessel function approximations */
  1153. Xdouble jzero(x)
  1154. Xdouble x;
  1155. X{
  1156. Xdouble p, q, x2;
  1157. Xint n;
  1158. X
  1159. X    x2 = x * x;
  1160. X    p = pjzero[8];
  1161. X    q = qjzero[8];
  1162. X    for (n=7; n>=0; n--) {
  1163. X        p = p*x2 + pjzero[n];
  1164. X        q = q*x2 + qjzero[n];
  1165. X    }
  1166. X    return(p/q);
  1167. X}
  1168. X
  1169. Xdouble pzero(x)
  1170. Xdouble x;
  1171. X{
  1172. Xdouble p, q, z, z2;
  1173. Xint n;
  1174. X
  1175. X    z = 8.0 / x;
  1176. X    z2 = z * z;
  1177. X    p = ppzero[5];
  1178. X    q = qpzero[5];
  1179. X    for (n=4; n>=0; n--) {
  1180. X        p = p*z2 + ppzero[n];
  1181. X        q = q*z2 + qpzero[n];
  1182. X    }
  1183. X    return(p/q);
  1184. X}
  1185. X
  1186. Xdouble qzero(x)
  1187. Xdouble x;
  1188. X{
  1189. Xdouble p, q, z, z2;
  1190. Xint n;
  1191. X
  1192. X    z = 8.0 / x;
  1193. X    z2 = z * z;
  1194. X    p = pqzero[5];
  1195. X    q = qqzero[5];
  1196. X    for (n=4; n>=0; n--) {
  1197. X        p = p*z2 + pqzero[n];
  1198. X        q = q*z2 + qqzero[n];
  1199. X    }
  1200. X    return(p/q);
  1201. X}
  1202. X
  1203. Xdouble yzero(x)
  1204. Xdouble x;
  1205. X{
  1206. Xdouble p, q, x2;
  1207. Xint n;
  1208. X
  1209. X    x2 = x * x;
  1210. X    p = pyzero[8];
  1211. X    q = qyzero[8];
  1212. X    for (n=7; n>=0; n--) {
  1213. X        p = p*x2 + pyzero[n];
  1214. X        q = q*x2 + qyzero[n];
  1215. X    }
  1216. X    return(p/q);
  1217. X}
  1218. X
  1219. Xdouble rj0(x)
  1220. Xdouble x;
  1221. X{
  1222. X    if ( x <= 0.0 )
  1223. X        x = -x;
  1224. X    if ( x < 8.0 )
  1225. X        return(jzero(x));
  1226. X    else
  1227. X        return( sqrt(TWO_ON_PI/x) *
  1228. X            (pzero(x)*cos(x-PI_ON_FOUR) - 8.0/x*qzero(x)*sin(x-PI_ON_FOUR)) );
  1229. X
  1230. X}
  1231. X
  1232. Xdouble ry0(x)
  1233. Xdouble x;
  1234. X{
  1235. X    if ( x < 0.0 )
  1236. X        return(dzero/dzero); /* error */
  1237. X    if ( x < 8.0 )
  1238. X        return( yzero(x) + TWO_ON_PI*rj0(x)*log(x) );
  1239. X    else
  1240. X        return( sqrt(TWO_ON_PI/x) *
  1241. X            (pzero(x)*sin(x-PI_ON_FOUR) + 
  1242. X            (8.0/x)*qzero(x)*cos(x-PI_ON_FOUR)) );
  1243. X
  1244. X}
  1245. X
  1246. X
  1247. Xdouble jone(x)
  1248. Xdouble x;
  1249. X{
  1250. Xdouble p, q, x2;
  1251. Xint n;
  1252. X
  1253. X    x2 = x * x;
  1254. X    p = pjone[8];
  1255. X    q = qjone[8];
  1256. X    for (n=7; n>=0; n--) {
  1257. X        p = p*x2 + pjone[n];
  1258. X        q = q*x2 + qjone[n];
  1259. X    }
  1260. X    return(p/q);
  1261. X}
  1262. X
  1263. Xdouble pone(x)
  1264. Xdouble x;
  1265. X{
  1266. Xdouble p, q, z, z2;
  1267. Xint n;
  1268. X
  1269. X    z = 8.0 / x;
  1270. X    z2 = z * z;
  1271. X    p = ppone[5];
  1272. X    q = qpone[5];
  1273. X    for (n=4; n>=0; n--) {
  1274. X        p = p*z2 + ppone[n];
  1275. X        q = q*z2 + qpone[n];
  1276. X    }
  1277. X    return(p/q);
  1278. X}
  1279. X
  1280. Xdouble qone(x)
  1281. Xdouble x;
  1282. X{
  1283. Xdouble p, q, z, z2;
  1284. Xint n;
  1285. X
  1286. X    z = 8.0 / x;
  1287. X    z2 = z * z;
  1288. X    p = pqone[5];
  1289. X    q = qqone[5];
  1290. X    for (n=4; n>=0; n--) {
  1291. X        p = p*z2 + pqone[n];
  1292. X        q = q*z2 + qqone[n];
  1293. X    }
  1294. X    return(p/q);
  1295. X}
  1296. X
  1297. Xdouble yone(x)
  1298. Xdouble x;
  1299. X{
  1300. Xdouble p, q, x2;
  1301. Xint n;
  1302. X
  1303. X    x2 = x * x;
  1304. X    p = 0.0;
  1305. X    q = qyone[8];
  1306. X    for (n=7; n>=0; n--) {
  1307. X        p = p*x2 + pyone[n];
  1308. X        q = q*x2 + qyone[n];
  1309. X    }
  1310. X    return(p/q);
  1311. X}
  1312. X
  1313. Xdouble rj1(x)
  1314. Xdouble x;
  1315. X{
  1316. Xdouble v,w;
  1317. X    v = x;
  1318. X    if ( x < 0.0 )
  1319. X        x = -x;
  1320. X    if ( x < 8.0 )
  1321. X        return(v*jone(x));
  1322. X    else {
  1323. X        w = sqrt(TWO_ON_PI/x) *
  1324. X            (pone(x)*cos(x-THREE_PI_ON_FOUR) - 
  1325. X               8.0/x*qone(x)*sin(x-THREE_PI_ON_FOUR)) ;
  1326. X        if (v < 0.0)
  1327. X            w = -w;
  1328. X        return( w );
  1329. X    }
  1330. X}
  1331. X
  1332. Xdouble ry1(x)
  1333. Xdouble x;
  1334. X{
  1335. X    if ( x <= 0.0 )
  1336. X        return(dzero/dzero); /* error */
  1337. X    if ( x < 8.0 )
  1338. X        return( x*yone(x) + TWO_ON_PI*(rj1(x)*log(x) - 1.0/x) );
  1339. X    else
  1340. X        return( sqrt(TWO_ON_PI/x) *
  1341. X            (pone(x)*sin(x-THREE_PI_ON_FOUR) + 
  1342. X            (8.0/x)*qone(x)*cos(x-THREE_PI_ON_FOUR)) );
  1343. X}
  1344. X
  1345. X
  1346. Xf_besj0()    
  1347. X{
  1348. Xstruct value a;
  1349. X    (void) pop(&a);
  1350. X    if (fabs(imag(&a)) > zero)
  1351. X        int_error("can only do bessel functions of reals",NO_CARET);
  1352. X    push( Gcomplex(&a,rj0(real(&a)),0.0) );
  1353. X}
  1354. X
  1355. X
  1356. Xf_besj1()    
  1357. X{
  1358. Xstruct value a;
  1359. X    (void) pop(&a);
  1360. X    if (fabs(imag(&a)) > zero)
  1361. X        int_error("can only do bessel functions of reals",NO_CARET);
  1362. X    push( Gcomplex(&a,rj1(real(&a)),0.0) );
  1363. X}
  1364. X
  1365. X
  1366. Xf_besy0()    
  1367. X{
  1368. Xstruct value a;
  1369. X    (void) pop(&a);
  1370. X    if (fabs(imag(&a)) > zero)
  1371. X        int_error("can only do bessel functions of reals",NO_CARET);
  1372. X    if (real(&a) > 0.0)
  1373. X        push( Gcomplex(&a,ry0(real(&a)),0.0) );
  1374. X    else {
  1375. X        push( Gcomplex(&a,0.0,0.0) );
  1376. X        undefined = TRUE ;
  1377. X    }
  1378. X}
  1379. X
  1380. X
  1381. Xf_besy1()    
  1382. X{
  1383. Xstruct value a;
  1384. X    (void) pop(&a);
  1385. X    if (fabs(imag(&a)) > zero)
  1386. X        int_error("can only do bessel functions of reals",NO_CARET);
  1387. X    if (real(&a) > 0.0)
  1388. X        push( Gcomplex(&a,ry1(real(&a)),0.0) );
  1389. X    else {
  1390. X        push( Gcomplex(&a,0.0,0.0) );
  1391. X        undefined = TRUE ;
  1392. X    }
  1393. X}
  1394. END_OF_FILE
  1395.   if test 20414 -ne `wc -c <'gnuplot/standard.c'`; then
  1396.     echo shar: \"'gnuplot/standard.c'\" unpacked with wrong size!
  1397.   fi
  1398.   # end of 'gnuplot/standard.c'
  1399. fi
  1400. if test -f 'gnuplot/term/latex.trm' -a "${1}" != "-c" ; then 
  1401.   echo shar: Will not clobber existing file \"'gnuplot/term/latex.trm'\"
  1402. else
  1403.   echo shar: Extracting \"'gnuplot/term/latex.trm'\" \(20098 characters\)
  1404.   sed "s/^X//" >'gnuplot/term/latex.trm' <<'END_OF_FILE'
  1405. X/*
  1406. X * $Id: latex.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1407. X *
  1408. X */
  1409. X
  1410. X/* GNUPLOT - latex.trm */
  1411. X/*
  1412. X * Copyright (C) 1990 - 1993   
  1413. X *
  1414. X * Permission to use, copy, and distribute this software and its
  1415. X * documentation for any purpose with or without fee is hereby granted, 
  1416. X * provided that the above copyright notice appear in all copies and 
  1417. X * that both that copyright notice and this permission notice appear 
  1418. X * in supporting documentation.
  1419. X *
  1420. X * Permission to modify the software is granted, but not the right to
  1421. X * distribute the modified code.  Modifications are to be distributed 
  1422. X * as patches to released version.
  1423. X *  
  1424. X * This software  is provided "as is" without express or implied warranty.
  1425. X * 
  1426. X * This file is included by ../term.c.
  1427. X *
  1428. X * This terminal driver supports:
  1429. X *   LaTeX pictures (latex).
  1430. X *   LaTeX pictures with emTeX specials (emtex). 
  1431. X *
  1432. X * AUTHORS
  1433. X *   David Kotz, Russell Lang
  1434. X *
  1435. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1436. X * 
  1437. X */
  1438. X
  1439. X/* modified to optimize use of \rule for long lines */
  1440. X/* TLDC: modified to have nice line types */
  1441. X
  1442. X/* the following LATEX driver has been modified by 
  1443. X   Russell Lang, eln272v@monu1.cc.monash.oz from the
  1444. X   GnuTeX 1.3 driver by David Kotz, David.Kotz@Dartmouth.edu.
  1445. X   Since then it has been further extended by David Kotz.
  1446. X   EmTeX driver by Russell Lang. */
  1447. X
  1448. X/*  9 Dec 1992  LATEX_put_text rewritten to handle \\ newlines
  1449. X                Daniel S. Lewart (d-lewart@uiuc.edu) */
  1450. X
  1451. X#define TINY_STEP 0.5    /* tiny steps for high quality lines */
  1452. X
  1453. X#define LATEX_PTS_PER_INCH (72.27)
  1454. X#define DOTS_PER_INCH (300)    /* resolution of printer we expect to use */
  1455. X#define LATEX_UNIT (LATEX_PTS_PER_INCH/DOTS_PER_INCH) /* dot size in pt */
  1456. X
  1457. X/* 5 inches wide by 3 inches high (default) */
  1458. X#define LATEX_XMAX (5*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*5.0) */
  1459. X#define LATEX_YMAX (3*DOTS_PER_INCH)  /* (LATEX_PTS_PER_INCH/LATEX_UNIT*3.0) */
  1460. X
  1461. X#define LATEX_HTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  1462. X#define LATEX_VTIC (5*DOTS_PER_INCH/72)        /* (5./LATEX_UNIT) */
  1463. X#define LATEX_HCHAR (DOTS_PER_INCH*53/10/72)    /* (5.3/LATEX_UNIT) */
  1464. X#define LATEX_VCHAR (DOTS_PER_INCH*11/72)    /* (11./LATEX_UNIT) */
  1465. X
  1466. Xstatic int LATEX_posx;
  1467. Xstatic int LATEX_posy;
  1468. Xint LATEX_fontsize = 10;
  1469. Xchar LATEX_font[MAX_ID_LEN+1] = "cmr";
  1470. Xstatic enum JUSTIFY latex_justify=LEFT;
  1471. Xstatic int latex_angle=0;
  1472. X
  1473. X/* Default line-drawing character */
  1474. X/* the definition of plotpoint varies with linetype */
  1475. X#define LATEX_DOT "\\usebox{\\plotpoint}"
  1476. X#define LATEX_TINY_DOT "\\rule{1pt}{1pt}" /* for dots plot style */
  1477. X
  1478. X/* POINTS */
  1479. X#define LATEX_POINT_TYPES 12    /* we supply more point types */
  1480. Xstatic char GPFAR * GPFAR LATEX_points[] = {
  1481. X    "\\raisebox{-.8pt}{\\makebox(0,0){$\\Diamond$}}",
  1482. X    "\\makebox(0,0){$+$}",
  1483. X    "\\raisebox{-.8pt}{\\makebox(0,0){$\\Box$}}",
  1484. X    "\\makebox(0,0){$\\times$}",
  1485. X    "\\makebox(0,0){$\\triangle$}",
  1486. X    "\\makebox(0,0){$\\star$}",
  1487. X    "\\circle{12}", "\\circle{18}", "\\circle{24}",
  1488. X    "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
  1489. X};
  1490. X
  1491. X/* LINES */
  1492. Xstatic float LATEX_size = 0;    /* current thick of line in points */
  1493. Xstatic float LATEX_dotspace = 0; /* current dotspace of line in points */
  1494. X#define LATEX_LINE_TYPES 6    /* number of line types below */
  1495. X#define LATEX_THIN_LINE 0    /* the thinnest solid line type */
  1496. Xstatic struct {
  1497. X    float size;            /* size of dot, or thick of line in points */
  1498. X    float dotspace;            /* inter-dot space in points; 0 for lines */
  1499. X  } GPFAR LATEX_lines[] = {
  1500. X      {0.4, 0.0},            /* thin solid line */
  1501. X      {0.4, 5.0},            /* thin dotted line */
  1502. X      {0.8, 0.0},            /* thick solid line */
  1503. X      {1.0, 5.0},            /* thick dotted line */
  1504. X      {1.2, 0.0},            /* Thick solid line */
  1505. X      {1.0, 10.0},            /* thick widely dotted line */
  1506. X  };
  1507. X
  1508. X/* for drawing dotted and solid lines */
  1509. Xstatic void LATEX_dot_line();
  1510. Xstatic void LATEX_solid_line();
  1511. Xstatic void LATEX_rule();
  1512. Xstatic void LATEX_flushdot();
  1513. X#define LATEX_flushrule() LATEX_rule(2, 0.,0.,0.,0.) /* flush old rule */
  1514. Xstatic TBOOLEAN LATEX_moved = TRUE;    /* pen is up after move */
  1515. Xstatic float LATEX_dotsize;    /* size of LATEX_DOT in units */
  1516. Xstatic TBOOLEAN LATEX_needsdot = FALSE;/* does dotted line need termination? */
  1517. X
  1518. X#ifdef EMTEX
  1519. XTBOOLEAN emtex=FALSE; /* not currently using emtex */
  1520. Xstatic void EMTEX_solid_line();
  1521. X#endif
  1522. X
  1523. X/* ARROWS */
  1524. X/* the set of non-vertical/non-horizontal LaTeX vector slopes */
  1525. X/* except negatives - they are handled specially */
  1526. Xstatic struct vslope {
  1527. X    int dx, dy;
  1528. X} GPFAR LATEX_slopes[] = {
  1529. X    {1,1}, {1,2}, {1,3}, {1,4},
  1530. X    {2,1}, {2,3},
  1531. X    {3,1}, {3,2}, {3,4},
  1532. X    {4,1}, {4,3},
  1533. X    {0,0}                    /* terminator */
  1534. X};
  1535. Xstatic void best_latex_arrow(); /* figure out the best arrow */
  1536. X
  1537. XLATEX_options()
  1538. X{
  1539. X    extern struct value *const_express();
  1540. X    extern double real();
  1541. X
  1542. X    if (!END_OF_COMMAND) {
  1543. X        if (almost_equals(c_token,"c$ourier")) {
  1544. X            strcpy(LATEX_font,"cmtt");
  1545. X            c_token++;
  1546. X        }
  1547. X        else if (almost_equals(c_token,"r$oman")) {
  1548. X            strcpy(LATEX_font,"cmr");
  1549. X            c_token++;
  1550. X        }
  1551. X        else if (almost_equals(c_token,"d$efault")) {
  1552. X            strcpy(LATEX_font,"cmr");
  1553. X            LATEX_fontsize = 10;
  1554. X            c_token++;
  1555. X        }
  1556. X    }
  1557. X    
  1558. X    if (!END_OF_COMMAND) {
  1559. X        struct value a;
  1560. X        LATEX_fontsize = (int)real(const_express(&a));
  1561. X        term_tbl[term].v_char = (unsigned int)(LATEX_fontsize);
  1562. X        term_tbl[term].h_char = (unsigned int)(LATEX_fontsize);
  1563. X    }
  1564. X    sprintf(term_options,"%s %d point", LATEX_font ? "courier" : "roman",
  1565. X        LATEX_fontsize);
  1566. X}
  1567. X
  1568. X
  1569. XLATEX_init()
  1570. X{
  1571. X#ifdef EMTEX
  1572. X    emtex = FALSE;
  1573. X#endif
  1574. X    LATEX_posx = LATEX_posy = 0;
  1575. X    fprintf(outfile, "%% GNUPLOT: LaTeX picture\n");
  1576. X    fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
  1577. X    fprintf(outfile, 
  1578. X          "\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n");
  1579. X    LATEX_linetype(-1);
  1580. X    LATEX_size =0;
  1581. X}
  1582. X
  1583. X
  1584. XLATEX_scale(xs, ys)
  1585. X    double xs, ys;            /* scaling factors */
  1586. X{
  1587. X    register struct termentry *t = &term_tbl[term];
  1588. X
  1589. X    /* we change the table for use in graphics.c and LATEX_graphics */
  1590. X    t->xmax = (unsigned int)(LATEX_XMAX * xs);
  1591. X    t->ymax = (unsigned int)(LATEX_YMAX * ys);
  1592. X
  1593. X    return(TRUE);
  1594. X}
  1595. X
  1596. XLATEX_graphics()
  1597. X{
  1598. X    register struct termentry *t = &term_tbl[term];
  1599. X
  1600. X    fprintf(outfile, "\\begin{picture}(%d,%d)(0,0)\n", t->xmax, t->ymax);
  1601. X    fprintf(outfile, "\\font\\gnuplot=%s10 at %dpt\n", LATEX_font, LATEX_fontsize);
  1602. X    fprintf(outfile, "\\gnuplot\n");
  1603. X}
  1604. X
  1605. X
  1606. XLATEX_text()
  1607. X{
  1608. X    LATEX_flushrule();
  1609. X    LATEX_flushdot();
  1610. X    fprintf(outfile, "\\end{picture}\n");
  1611. X    LATEX_posx = LATEX_posy = 0; /* current position */
  1612. X    LATEX_moved = TRUE;    /* pen is up after move */
  1613. X}
  1614. X
  1615. XLATEX_linetype(linetype)
  1616. X    int linetype;
  1617. X{
  1618. X    float size;
  1619. X
  1620. X    if (linetype >= LATEX_LINE_TYPES)
  1621. X     linetype %= LATEX_LINE_TYPES;
  1622. X
  1623. X#ifdef EMTEX
  1624. X    if (!emtex)
  1625. X#endif
  1626. X    LATEX_flushrule();
  1627. X    LATEX_flushdot();
  1628. X
  1629. X    /* Find the new desired line thickness. */
  1630. X    /* negative linetypes (for axes) use a thin line */
  1631. X    /* only relevant for drawing axes/border in 3d */
  1632. X    size = (linetype >= 0 ? LATEX_lines[linetype].size 
  1633. X          : LATEX_lines[LATEX_THIN_LINE].size);
  1634. X
  1635. X    /* If different from current size, redefine \plotpoint */
  1636. X    if (size != LATEX_size) {
  1637. X       fprintf(outfile, 
  1638. X             "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}%%\n",
  1639. X             -size/2, size, size);
  1640. X#ifdef EMTEX
  1641. X        if (emtex)         /* change line width */
  1642. X        fprintf(outfile, "\\special{em:linewidth %.1fpt}%%\n", size);
  1643. X#endif
  1644. X    }
  1645. X    
  1646. X    LATEX_size = size;
  1647. X    LATEX_dotsize = size / LATEX_UNIT;
  1648. X    LATEX_dotspace = (linetype >= 0) ? LATEX_lines[linetype].dotspace : 0;
  1649. X    LATEX_moved = TRUE;            /* reset */
  1650. X}
  1651. X
  1652. XLATEX_move(x,y)
  1653. X    unsigned int x,y;
  1654. X{
  1655. X    LATEX_flushdot();
  1656. X
  1657. X    LATEX_posx = x;
  1658. X    LATEX_posy = y;
  1659. X    LATEX_moved = TRUE;            /* reset */
  1660. X}
  1661. X
  1662. X
  1663. XLATEX_point(x,y, number)        /* version of line_and_point */
  1664. X    unsigned int x,y;
  1665. X    int number;                /* type of point */
  1666. X{
  1667. X    LATEX_move(x,y);
  1668. X    
  1669. X    /* Print the character defined by 'number'; number < 0 means 
  1670. X      to use a dot, otherwise one of the defined points. */
  1671. X    fprintf(outfile, "\\put(%d,%d){%s}\n", x, y, 
  1672. X          (number < 0 ? LATEX_TINY_DOT
  1673. X           : LATEX_points[number % LATEX_POINT_TYPES]));
  1674. X}
  1675. X
  1676. X
  1677. XLATEX_vector(ux,uy)
  1678. X    unsigned int ux,uy;
  1679. X{
  1680. X    if (LATEX_dotspace == 0.0) {
  1681. X       /* solid line */
  1682. X#ifdef EMTEX
  1683. X       if (emtex)
  1684. X        EMTEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  1685. X       else
  1686. X#endif
  1687. X        LATEX_solid_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  1688. X    } else
  1689. X     /* dotted line */
  1690. X     LATEX_dot_line(LATEX_posx, (int)ux, LATEX_posy, (int)uy);
  1691. X
  1692. X    LATEX_posx = ux;
  1693. X    LATEX_posy = uy;
  1694. X}
  1695. X
  1696. Xstatic void
  1697. XLATEX_solid_line(x1,x2, y1,y2)
  1698. X    int x1,x2, y1,y2;
  1699. X{
  1700. X    float slope;
  1701. X    int inc;
  1702. X    float dx,dy,x,y;
  1703. X    float offset,length;
  1704. X    int code;                /* possibly combine with previous rule */
  1705. X
  1706. X    /* we draw a solid line using the current line thickness (size) */
  1707. X    /* we do it with lots of \\rules */
  1708. X
  1709. X    if (x1 == x2 && y1 == y2) { /* zero-length line - just a dot */
  1710. X       if (LATEX_moved) {
  1711. X          LATEX_flushrule();
  1712. X          /* plot a dot */
  1713. X          fprintf(outfile, "\\put(%u,%u){%s}\n", x1, y1, LATEX_DOT);
  1714. X       }
  1715. X    } else {
  1716. X       code = (LATEX_moved ? 0 : 1); /* no combine after move */
  1717. X           LATEX_moved = FALSE;
  1718. X       if (x1 == x2)        /* vertical line - special case */
  1719. X        LATEX_rule(code, (double)x1, (double)y1,
  1720. X               LATEX_dotsize, (double)y2-y1);
  1721. X       else if (y1 == y2)    /* horizontal line - special case */
  1722. X        LATEX_rule(code, (double)x1, (double)y1, (double)x2-x1,
  1723. X               LATEX_dotsize);
  1724. X       else {
  1725. X          dx = (float)x2-x1;
  1726. X          dy = (float)y2-y1;
  1727. X          slope = dy/dx;
  1728. X          if (abs(slope) <= 1.0) {
  1729. X            /* longer than high */
  1730. X            x = min(abs(dx),(0.25+1.0/abs(slope))*LATEX_dotsize);
  1731. X            offset = sign(dy)*min(LATEX_dotsize,abs(dy));
  1732. X            dy = dy - offset;
  1733. X            length = x*LATEX_UNIT;
  1734. X            inc = (x == abs(dx) ? 1 : max(1,abs(dy)/TINY_STEP+0.5));
  1735. X            if (inc == 1) {
  1736. X              fprintf(outfile,"\\put(%u,%.2f){\\rule{%.3fpt}{%.3fpt}}\n",
  1737. X             (x2>=x1? x1 : x2), ((float)y1+y2-LATEX_dotsize)/2,
  1738. X             length, LATEX_dotsize*LATEX_UNIT);
  1739. X            } else {
  1740. X              dy = dy/inc;
  1741. X              dx = (dx-sign(dx)*x)/(inc-1);
  1742. Xfprintf(outfile,"\\multiput(%.2f,%.2f)(%.3f,%.3f){%u}{\\rule{%.3fpt}{%.3fpt}}\n",
  1743. X               (dx>=0.0? (float)x1 : x1-x), 
  1744. X               (float)y1-(abs(dy)-offset)/2, 
  1745. X               dx, dy, inc, length, abs(dy)*LATEX_UNIT);
  1746. X            }
  1747. X/* done with one section, now smooth it */
  1748. X            x = x/2;
  1749. X            dx = sign(dx) * x;
  1750. X            dx = (float)x2 - x1 - dx;
  1751. X            dy = (float)y2 - y1;
  1752. Xfprintf(outfile,"\\multiput(%.2f,%.2f)(%.3f,%.3f){2}{\\rule{%.3fpt}{%.3fpt}}\n",
  1753. X             (dx>=0.0? (float)x1 : x1-x), (float)y1-LATEX_dotsize/2,
  1754. X             dx, dy, x*LATEX_UNIT, LATEX_dotsize*LATEX_UNIT);
  1755. X                LATEX_moved = TRUE;
  1756. X          } else {
  1757. X            /* higher than long */
  1758. X            y = min(abs(dy),(0.25+abs(slope))*LATEX_dotsize);
  1759. X            offset = sign(dx)*min(LATEX_dotsize,abs(dx));
  1760. X            dx = dx - offset;
  1761. X            length = y*LATEX_UNIT;
  1762. X            inc = (y == abs(dy) ? 1 : max(1,abs(dx)/TINY_STEP+0.5));
  1763. X            if (inc == 1) {
  1764. X             fprintf(outfile,"\\put(%.2f,%u){\\rule{%.3fpt}{%.3fpt}}\n",
  1765. X             ((float)x1+x2-LATEX_dotsize)/2, (y2>=y1? y1 : y2),
  1766. X             LATEX_dotsize*LATEX_UNIT, length);
  1767. X            } else {
  1768. X              dx = dx/inc;
  1769. X              dy = (dy-sign(dy)*y)/(inc-1);
  1770. Xfprintf(outfile,"\\multiput(%.2f,%.2f)(%.3f,%.3f){%u}{\\rule{%.3fpt}{%.3fpt}}\n",
  1771. X               (float)x1-(abs(dx)-offset)/2, 
  1772. X               (dy>=0? (float)y1 : y1-y), 
  1773. X               dx, dy, inc, abs(dx)*LATEX_UNIT, length);
  1774. X            }
  1775. X/* done with one section, now smooth it */
  1776. X            y = y/2;
  1777. X            dx = (float)x2 - x1;
  1778. X            dy = sign(dy) * y;
  1779. X            dy = (float)y2 - y1 - dy;
  1780. Xfprintf(outfile,"\\multiput(%.2f,%.2f)(%.3f,%.3f){2}{\\rule{%.3fpt}{%.3fpt}}\n",
  1781. X             (float)x1-LATEX_dotsize/2, (dy>=0.0? (float)y1 : y1-y),
  1782. X             dx, dy, LATEX_dotsize*LATEX_UNIT, y*LATEX_UNIT);
  1783. X                LATEX_moved = TRUE;
  1784. X          }
  1785. X       }
  1786. X    }
  1787. X}
  1788. X
  1789. X/* Draw a \rule. Width or height may be negative; we can correct.
  1790. X * The rule is never output immediately. The previous rule is output
  1791. X * as-is if code is 0, and the previous rule is
  1792. X * combined with the current rule (if possible) if code is 1.
  1793. X * The previous rule is output, and the new one ignored, if code is 2.
  1794. X */
  1795. Xstatic void
  1796. XLATEX_rule(code, x,y, width, height)
  1797. X    int code;                /* how do we treat this rule? */
  1798. X    double x, y;
  1799. X    double width;
  1800. X    double height;
  1801. X{  
  1802. X    static float lastx, lasty;
  1803. X    static float lastw, lasth;
  1804. X    static TBOOLEAN valid = FALSE; /* is 'last' data valid? */
  1805. X    TBOOLEAN combine = (code == 1);
  1806. X    TBOOLEAN flush = (code == 2);
  1807. X
  1808. X    if (!flush)
  1809. X     if (width == 0 || height == 0)
  1810. X       return;            /* ignore this rule */
  1811. X
  1812. X    if (valid && combine) {
  1813. X       /* try to combine new rule with old rule */
  1814. X       if ((int)lastx == (int)x && lastw == width) { /* vertical rule */
  1815. X          if (lasth * height >= 0) { /* same sign */
  1816. X             lasth += height;
  1817. X             return;
  1818. X          }
  1819. X       } else if ((int)lasty == (int)y && lasth == height){ /* horiz rule */
  1820. X          if (lastw * width >= 0) { /* same sign */
  1821. X             lastw += width;
  1822. X             return;
  1823. X          }
  1824. X       }
  1825. X       /* oh well, output last and remember the new one */
  1826. X    }
  1827. X
  1828. X    if (valid) {
  1829. X       /* output the rule */
  1830. X       if (lastw < 0) {
  1831. X          lastx += lastw;
  1832. X          lastw = -lastw;
  1833. X       }
  1834. X       if (lasth < 0) {
  1835. X          lasty += lasth;
  1836. X          lasth = -lasth;
  1837. X       }
  1838. X
  1839. X       /* if very small use canned dot */
  1840. X       if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
  1841. X        fprintf(outfile, "\\put(%.1f,%.1f){%s}\n",       
  1842. X               lastx, lasty, LATEX_DOT);
  1843. X       else
  1844. X        fprintf(outfile, "\\put(%.1f,%.1f){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
  1845. X               lastx, lasty, -LATEX_dotsize*LATEX_UNIT/2,
  1846. X               lastw*LATEX_UNIT, lasth*LATEX_UNIT);
  1847. X    }
  1848. X    
  1849. X    if (flush) {
  1850. X       valid = FALSE;
  1851. X    } else {
  1852. X       lastx = x; lasty = y;
  1853. X       lastw = width; lasth = height;
  1854. X       valid = TRUE;
  1855. X    }
  1856. X}
  1857. X
  1858. Xstatic void
  1859. XLATEX_dot_line(x1,x2, y1,y2)
  1860. X    int x1,x2, y1,y2;
  1861. X{
  1862. X    static float LATEX_left;    /* fraction of space left after last dot */
  1863. X#ifndef AMIGA_AC_5
  1864. X    extern double sqrt();
  1865. X#endif
  1866. X    /* we draw a dotted line using the current dot spacing */
  1867. X
  1868. X    if (LATEX_moved)
  1869. X     LATEX_left = 1.0;        /* reset after a move */
  1870. X
  1871. X    /* zero-length line? */
  1872. X    if (x1 == x2 && y1 == y2) {
  1873. X       if (LATEX_moved)
  1874. X        /* plot a dot */
  1875. X        fprintf(outfile, "\\put(%u,%u){%s}\n", x1, y1, LATEX_DOT);
  1876. X    } else {
  1877. X       float dotspace = LATEX_dotspace / LATEX_UNIT;
  1878. X       float x,y;            /* current position */
  1879. X       float xinc, yinc;    /* increments */
  1880. X       float slope;        /* slope of line */
  1881. X       float lastx = -1;    /* last x point plotted */
  1882. X       float lasty = -1;    /* last y point plotted */
  1883. X       int numdots = 0;    /* number of dots in this section */
  1884. X
  1885. X       /* first, figure out increments for x and y */
  1886. X       if (x2 == x1) {
  1887. X          xinc = 0.0;
  1888. X          yinc = (y2-y1>0)?dotspace:-dotspace;
  1889. X       } else {
  1890. X          slope = ((float)y2-y1)/((float)x2-x1);
  1891. X          xinc = dotspace / sqrt(1 + slope*slope) * sign(x2-x1);
  1892. X          yinc = slope * xinc;
  1893. X       }
  1894. X       
  1895. X       /* now draw the dotted line */
  1896. X       /* we take into account where we last placed a dot */
  1897. X       for (x=x1 + xinc*(1-LATEX_left), y=y1 + yinc*(1-LATEX_left);
  1898. X           (x2-x)*xinc >= 0 && (y2-y)*yinc >= 0; /* same sign or zero */
  1899. X           lastx = x, x += xinc, 
  1900. X           lasty = y, y += yinc)
  1901. X        numdots++;
  1902. X       if (numdots == 1)
  1903. X        fprintf(outfile, "\\put(%.2f,%.2f){%s}\n",
  1904. X           lastx, lasty, LATEX_DOT);
  1905. X       else
  1906. X        fprintf(outfile, "\\multiput(%u,%u)(%.3f,%.3f){%u}{%s}\n",
  1907. X               x1, y1, xinc, yinc, numdots, LATEX_DOT);
  1908. X
  1909. X       /* how much is left over, as a fraction of dotspace? */
  1910. X       if (xinc != 0.0)            /* xinc must be nonzero */
  1911. X        if (lastx >= 0)
  1912. X          LATEX_left = abs(x2 - lastx) / abs(xinc);
  1913. X        else
  1914. X          LATEX_left += abs(x2-x1) / abs(xinc);
  1915. X       else
  1916. X        if (lasty >= 0)
  1917. X          LATEX_left = abs(y2 - lasty) / abs(yinc);
  1918. X        else
  1919. X          LATEX_left += abs(y2-y1) / abs(yinc);
  1920. X    }
  1921. X
  1922. X    LATEX_needsdot = (LATEX_left > 0);
  1923. X
  1924. X    LATEX_moved = FALSE;
  1925. X}
  1926. X
  1927. Xstatic void
  1928. XLATEX_flushdot()
  1929. X{
  1930. X    if (LATEX_needsdot) 
  1931. X     fprintf(outfile, "\\put(%d,%d){%s}\n", 
  1932. X            LATEX_posx, LATEX_posy, LATEX_DOT);
  1933. X    LATEX_needsdot = FALSE;
  1934. X}
  1935. X
  1936. XLATEX_arrow(sx,sy, ex,ey, head)
  1937. X    int sx,sy, ex,ey;
  1938. X    TBOOLEAN head;
  1939. X{
  1940. X    best_latex_arrow(sx,sy, ex,ey, 1, head);
  1941. X
  1942. X    LATEX_posx = ex;
  1943. X    LATEX_posy = ey;
  1944. X}
  1945. X
  1946. Xstatic void best_latex_arrow(sx,sy, ex,ey, who, head)
  1947. X    int sx,sy, ex,ey;        /* start and end points */
  1948. X    int who;                /* 1=LATEX, 2=EEPIC */
  1949. X    TBOOLEAN head;
  1950. X{
  1951. X    int dx = ex - sx;
  1952. X    int dy = ey - sy;
  1953. X    float m;                /* slope of line */
  1954. X    float arrowslope;        /* slope of arrow */
  1955. X    float minerror = 0;        /* best-case error */
  1956. X    struct vslope *slope;    /* one of the slopes */
  1957. X    struct vslope *bestslope;    /* the slope with min error */
  1958. X
  1959. X    /* We try to draw a real arrow (ie, \vector). If we can't get
  1960. X    * a slope that is close, we draw a bent arrow.
  1961. X    */
  1962. X
  1963. X    if (dx == 0) {
  1964. X       /* vertical arrow */
  1965. X       fprintf(outfile, "\\put(%d,%d){\\%s(0,%d){%d}}\n",
  1966. X             sx, sy, head ? "vector":"line", 
  1967. X             sign(ey-sy), abs(ey-sy));
  1968. X    } else if (dy == 0) {
  1969. X       /* horizontal arrow */
  1970. X       fprintf(outfile, "\\put(%d,%d){\\%s(%d,0){%d}}\n",
  1971. X             sx, sy, head ? "vector":"line",
  1972. X             sign(ex-sx), abs(ex-sx));
  1973. X    } else {
  1974. X       /* Slanted arrow. We'll give it a try.
  1975. X        * we try to find the closest-slope arrowhead.
  1976. X        */
  1977. X       bestslope = NULL;
  1978. X       minerror = 0; /* to shut up turbo C */
  1979. X       m = abs((float)dy/dx); /* the slope we want */
  1980. X       for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {
  1981. X          /* find the slope of the arrow */
  1982. X          arrowslope = (float) slope->dy / slope->dx;
  1983. X          if (bestslope == NULL || abs(m-arrowslope) < minerror) {
  1984. X             minerror = abs(m-arrowslope);
  1985. X             bestslope = slope;
  1986. X          }
  1987. X       }
  1988. X
  1989. X       /* now we have the best slope arrow */
  1990. X       /* maybe it's exactly the right slope! */
  1991. X       if (minerror == 0.0)    /* unlikely but possible */
  1992. X        fprintf(outfile, "\\put(%d,%d){\\%s(%d,%d){%d}}\n",
  1993. X               sx, sy, head ? "vector" : "line",
  1994. X               bestslope->dx*sign(ex-sx), bestslope->dy*sign(ey-sy),
  1995. X               abs(ex-sx));
  1996. X       else {
  1997. X          /* we draw the line the usual way, with thin lines */
  1998. X#ifdef EMTEX
  1999. X          if (emtex) {
  2000. X             LATEX_linetype(LATEX_THIN_LINE);
  2001. X             EMTEX_solid_line(sx,ex,sy,ey);
  2002. X          } else 
  2003. X#endif
  2004. X            if (who == 1) {
  2005. X               LATEX_linetype(LATEX_THIN_LINE);
  2006. X               LATEX_solid_line(sx,ex,sy,ey);
  2007. X            }
  2008. X#ifdef EEPIC
  2009. X            else {
  2010. X               EEPIC_move(sx,sy);
  2011. X               EEPIC_vector(ex,ey);
  2012. X            }
  2013. X#endif /* EEPIC */
  2014. X          /* and then draw an arrowhead (a short vector) there */
  2015. X            if (head)
  2016. X                  fprintf(outfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
  2017. X                ex, ey, 
  2018. X                bestslope->dx*sign(ex-sx), bestslope->dy*sign(ey-sy));
  2019. X       }
  2020. X    }
  2021. X}
  2022. X
  2023. XLATEX_put_text(x, y, str)
  2024. X    int x,y;            /* reference point of string */
  2025. X    char str[];         /* the text */
  2026. X{
  2027. X    static char *justify[] = { "[l]", "", "[r]" };
  2028. X    int flag,i;
  2029. X
  2030. X    /* ignore empty strings */
  2031. X    if (str[0] == '\0')
  2032. X        return(0);
  2033. X
  2034. X    for (flag=FALSE,i=0; str[i] && !flag;)
  2035. X        flag = (str[i++] == '\\') && (str[i++] == '\\');
  2036. X
  2037. X    fprintf(outfile, "\\put(%d,%d)", x, y);
  2038. X    if (flag)
  2039. X        fprintf(outfile, "{\\makebox(0,0)%s{\\shortstack{%s}}}\n",
  2040. X            justify[latex_justify], str);
  2041. X    else
  2042. X        fprintf(outfile, "{\\makebox(0,0)%s{%s}}\n",
  2043. X            justify[latex_justify], str);
  2044. X}
  2045. X
  2046. Xint LATEX_justify_text(mode)
  2047. X    enum JUSTIFY mode;
  2048. X{
  2049. X    latex_justify = mode;
  2050. X    return (TRUE);
  2051. X}
  2052. X
  2053. Xint LATEX_text_angle(angle)
  2054. X    int angle;
  2055. X{
  2056. X    /* we can't really write text vertically, but this will 
  2057. X      put the ylabel centred at the left of the plot, and
  2058. X      then we'll make a \shortstack */
  2059. X    latex_angle = angle;
  2060. X    return (TRUE);
  2061. X}
  2062. X
  2063. XLATEX_reset()
  2064. X{
  2065. X    LATEX_posx = LATEX_posy = 0; /* current position */
  2066. X    LATEX_moved = TRUE;    /* pen is up after move */
  2067. X}
  2068. X
  2069. X
  2070. X#ifdef EMTEX
  2071. X
  2072. XEMTEX_init()
  2073. X{
  2074. X    emtex=TRUE;
  2075. X    LATEX_posx = LATEX_posy = 0;
  2076. X    fprintf(outfile, "%% GNUPLOT: LaTeX picture with emtex specials\n");
  2077. X    fprintf(outfile, "\\setlength{\\unitlength}{%fpt}\n", LATEX_UNIT);
  2078. X    fprintf(outfile, 
  2079. X          "\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n");
  2080. X    LATEX_linetype(-1);
  2081. X}
  2082. X
  2083. X
  2084. XEMTEX_reset()
  2085. X{
  2086. X    emtex=FALSE;
  2087. X    LATEX_posx = LATEX_posy = 0;
  2088. X}
  2089. X
  2090. X
  2091. XEMTEX_text()
  2092. X{
  2093. X    fprintf(outfile, "\\end{picture}\n");
  2094. X}
  2095. X
  2096. X
  2097. Xstatic void
  2098. XEMTEX_solid_line(x1,x2, y1,y2)
  2099. X    int x1,x2, y1,y2;
  2100. X{
  2101. X    /* emtex special solid line */
  2102. X    if (LATEX_moved)
  2103. X        fprintf(outfile, "\\put(%d,%d){\\special{em:moveto}}\n", x1, y1);
  2104. X    if ( (x1!=x2) || (y1!=y2) )
  2105. X        fprintf(outfile, "\\put(%d,%d){\\special{em:lineto}}\n", x2, y2);
  2106. X    LATEX_posx = x2;
  2107. X    LATEX_posy = y2;
  2108. X    LATEX_moved = FALSE;
  2109. X}
  2110. X
  2111. X
  2112. X#endif /* EMTEX */
  2113. END_OF_FILE
  2114.   if test 20098 -ne `wc -c <'gnuplot/term/latex.trm'`; then
  2115.     echo shar: \"'gnuplot/term/latex.trm'\" unpacked with wrong size!
  2116.   fi
  2117.   # end of 'gnuplot/term/latex.trm'
  2118. fi
  2119. if test -f 'gnuplot/term/metafont.trm' -a "${1}" != "-c" ; then 
  2120.   echo shar: Will not clobber existing file \"'gnuplot/term/metafont.trm'\"
  2121. else
  2122.   echo shar: Extracting \"'gnuplot/term/metafont.trm'\" \(14593 characters\)
  2123.   sed "s/^X//" >'gnuplot/term/metafont.trm' <<'END_OF_FILE'
  2124. X/*
  2125. X * $Id: metafont.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  2126. X */
  2127. X
  2128. X/*
  2129. X *              GNUPLOT -- mf.trm
  2130. X *
  2131. X *            This terminal driver supports:
  2132. X *               Metafont Plot Commands
  2133. X *
  2134. X * Written by : Pl Hedne
  2135. X *        Trondheim, Norway
  2136. X *        Pal.Hedne@termo.unit.no
  2137. X */
  2138. X
  2139. X/*
  2140. X * Improvements and bug fixes by Carsten Steger:
  2141. X * - Set default plot size to 5 by 3 inches as in the latex- and eepic-
  2142. X *   drivers
  2143. X * - Fixed some bugs concerning resolution dependent output
  2144. X * - Added MF_scale function
  2145. X * - Added MF_justify_text function and modified MF_put_text function and
  2146. X *   put_text macro accordingly
  2147. X * - Modified MF_move and MF_vector to make output shorter and modified
  2148. X *   MF_text accordingly
  2149. X * - Added various linetypes by plotting dashed lines; had to modify
  2150. X *   MF_linetype and MF_vector for this
  2151. X * - Added MF_arrow function
  2152. X * - All global variables and #define'd names begin with MF_ now
  2153. X * As a consequence almost nothing of the original code by Pl Hedne remains
  2154. X * but credit goes to him for the ingenious trick of storing the character
  2155. X * images into picture variables, without which this driver would have been
  2156. X * impossible for me to write.
  2157. X */
  2158. X
  2159. X#define MF_DPI (300)
  2160. X/* resolution of printer we expect to use; the value itself is not
  2161. X * particularly important... it is here only for compatibility to the
  2162. X * LaTeX-driver and to get the spacing right. */
  2163. X
  2164. X/* 5 inches wide by 3 inches high (default) */
  2165. X#define MF_XSIZE 5.0
  2166. X#define MF_YSIZE 3.0
  2167. X#define MF_XMAX (MF_XSIZE*MF_DPI)
  2168. X#define MF_YMAX (MF_YSIZE*MF_DPI)
  2169. X
  2170. X#define MF_HTIC (5*MF_DPI/72)
  2171. X#define MF_VTIC (5*MF_DPI/72)
  2172. X#define MF_HCHAR (MF_DPI*53/10/72)
  2173. X#define MF_VCHAR (MF_DPI*11/72)
  2174. X
  2175. X/* Plot size in inches */
  2176. Xstatic double MF_xsize = MF_XSIZE;
  2177. Xstatic double MF_ysize = MF_YSIZE;
  2178. Xstatic int MF_char_code;
  2179. Xstatic int MF_ang;
  2180. Xstatic int MF_line_type;
  2181. Xstatic enum JUSTIFY MF_justify;
  2182. Xstatic double MF_dist_left;
  2183. Xstatic int MF_is_solid;
  2184. Xstatic int MF_picked_up_pen;
  2185. X/* 
  2186. X * We keep track of where we are with respect to dashed lines by using
  2187. X * the next five variables. MF_dash_index indicates which element of
  2188. X * MF_lines[..].dashlen should be used. The MF_last.. variables keep
  2189. X * track of the position of the pen.
  2190. X */
  2191. Xstatic int MF_dash_index;
  2192. Xstatic unsigned int MF_last_x, MF_last_y;
  2193. X
  2194. Xstatic struct {
  2195. X  int solid;         /* Is the line solid? */
  2196. X  float thickness;   /* Thickness of pen we are going to use */
  2197. X  int dashlen[4];    /* Length of individual segments; even: line; odd: gap */
  2198. X} MF_lines[10] = {
  2199. X  {1,1.5,0,0,0,0},
  2200. X  {0,1.0,MF_DPI/60,MF_DPI/50,MF_DPI/60,MF_DPI/50},
  2201. X  {1,1.5,0,0,0,0},
  2202. X  {0,1.5,MF_DPI/20,MF_DPI/30,MF_DPI/20,MF_DPI/30},
  2203. X  {0,1.5,MF_DPI/30,MF_DPI/20,MF_DPI/30,MF_DPI/20},
  2204. X  {0,1.5,MF_DPI/15,MF_DPI/30,MF_DPI/60,MF_DPI/30},
  2205. X  {0,1.5,MF_DPI/30,MF_DPI/50,MF_DPI/30,MF_DPI/50},
  2206. X  {0,1.5,MF_DPI/20,MF_DPI/50,MF_DPI/60,MF_DPI/30},
  2207. X  {0,1.5,MF_DPI/30,MF_DPI/50,MF_DPI/30,MF_DPI/30},
  2208. X  {0,1.5,MF_DPI/60,MF_DPI/50,MF_DPI/60,MF_DPI/30}
  2209. X  /* dash: line,     gap,      line,     gap      */
  2210. X};
  2211. X
  2212. X
  2213. X
  2214. Xint MF_init ()
  2215. X{
  2216. X  MF_char_code = 0;
  2217. X  MF_ang = 0;
  2218. X
  2219. X  fputs ("if unknown cmbase: input cmbase fi\n\n", outfile);
  2220. X  fputs ("tracingstats:=1;\n", outfile);
  2221. X  fputs ("picture r[];\n", outfile);
  2222. X  fputs ("\ndef openit = openwindow currentwindow\n", outfile);
  2223. X  fputs ("  from (0,0) to (400,800) at (-50,500) enddef;\n", outfile);
  2224. X
  2225. X  fputs ("\nmode_setup;\n", outfile);
  2226. X
  2227. X  fputs ("\n%Include next eight lines if you have problems with the mode on your system..\n", outfile);
  2228. X  fputs ("%proofing:=0;\n", outfile);
  2229. X  fputs ("%fontmaking:=1;\n", outfile);
  2230. X  fputs ("%tracingtitles:=0;\n", outfile);
  2231. X  fputs ("%pixels_per_inch:=300;\n", outfile);
  2232. X  fputs ("%blacker:=0;\n", outfile);
  2233. X  fputs ("%fillin:=.2;\n", outfile);
  2234. X  fputs ("%o_correction:=.6;\n", outfile);
  2235. X  fputs ("%fix_units;\n", outfile);
  2236. X
  2237. X  /* Next lines must be included if text support is needed (CM base used) */
  2238. X  fputs ("\ndef put_text(expr ts,xstart,ystart,rot,justification) =\n", outfile);
  2239. X  fputs ("  begingroup\n", outfile);
  2240. X  fputs ("    text_width:=0;text_height:=0;\n", outfile);
  2241. X  fputs ("    for ind:=0 step 1 until length(ts)-1:\n", outfile);
  2242. X  fputs ("      dec_num:=ASCII substring (ind,ind+1) of ts;\n", outfile);
  2243. X  fputs ("      if unknown r[dec_num]: dec_num:=32; fi\n", outfile);
  2244. X  fputs ("      if dec_num=32: \n", outfile);
  2245. X  fputs ("        text_width:=text_width+wd[65];\n", outfile);
  2246. X  fputs ("        text_height:=max(text_height,ht[65]+dp[65]);\n", outfile);
  2247. X  fputs ("      elseif dec_num>=0: \n", outfile);
  2248. X  fputs ("        text_width:=text_width+wd[dec_num];\n", outfile);
  2249. X  fputs ("        text_height:=max(text_height,ht[dec_num]+dp[dec_num]);\n", outfile);
  2250. X  fputs ("      fi\n", outfile);
  2251. X  fputs ("    endfor\n", outfile);
  2252. X  fputs ("    if rot=90:\n", outfile);
  2253. X  fputs ("      if justification=1: ynext:=ystart;\n", outfile);
  2254. X  fputs ("      elseif justification=2: ynext:=round(ystart-text_width/2);\n", outfile);
  2255. X  fputs ("      else: ynext:=round(ystart-text_width);\n", outfile);
  2256. X  fputs ("      fi\n", outfile);
  2257. X  fputs ("      xnext:=xstart+text_height/2;\n", outfile);
  2258. X  fputs ("    else:\n", outfile);
  2259. X  fputs ("      if justification=1: xnext:=xstart;\n", outfile);
  2260. X  fputs ("      elseif justification=2: xnext:=round(xstart-text_width/2);\n", outfile);
  2261. X  fputs ("      else: xnext:=round(xstart-text_width);\n", outfile);
  2262. X  fputs ("      fi\n", outfile);
  2263. X  fputs ("      ynext:=ystart-text_height/2;\n", outfile);
  2264. X  fputs ("    fi\n", outfile);
  2265. X  fputs ("    for ind:=0 step 1 until length(ts)-1:\n", outfile);
  2266. X  fputs ("      dec_num:=ASCII substring (ind,ind+1) of ts;\n", outfile);
  2267. X  fputs ("      if unknown r[dec_num]: dec_num:=32; fi\n", outfile);
  2268. X  fputs ("      if dec_num=32: \n", outfile);
  2269. X  fputs ("        xnext:=xnext+wd[65]*cosd rot;\n", outfile);
  2270. X  fputs ("        ynext:=ynext+wd[65]*sind rot;\n", outfile);
  2271. X  fputs ("      elseif dec_num>=0: \n", outfile);
  2272. X  fputs ("        currentpicture:=currentpicture+r[dec_num] shifted(xnext,ynext)\n", outfile);
  2273. X  fputs ("          rotatedaround ((xnext,ynext),rot); \n", outfile);
  2274. X  fputs ("        xnext:=xnext+wd[dec_num]*cosd rot;\n", outfile);
  2275. X  fputs ("        ynext:=ynext+wd[dec_num]*sind rot;\n", outfile);
  2276. X  fputs ("      fi\n", outfile);
  2277. X  fputs ("    endfor\n", outfile);
  2278. X  fputs ("  endgroup \n", outfile);
  2279. X  fputs ("enddef;\n", outfile);
  2280. X
  2281. X  fputs ("\ndef endchar =\n", outfile);
  2282. X  fputs ("  r[charcode]:=currentpicture;\n", outfile);
  2283. X  fputs ("  wd[charcode]:=w;ht[charcode]:=h;dp[charcode]:=d;\n", outfile);
  2284. X  fputs ("  message \"Picture of charcode no.\" & decimal charcode;\n", outfile);
  2285. X  fputs ("  endgroup;\n", outfile);
  2286. X  fputs ("enddef;\n", outfile);
  2287. X  fputs ("let endchar_ = endchar;\n", outfile);
  2288. X  fputs ("let generate = relax;\n", outfile);
  2289. X  fputs ("let roman = relax;\n", outfile);
  2290. X
  2291. X  fputs ("input cmr10.mf\n", outfile);
  2292. X  fputs ("if ligs>1: font_coding_scheme:=\"TeX text\";\n", outfile);
  2293. X  fputs ("  spanish_shriek=oct\"074\"; spanish_query=oct\"076\";\n", outfile);
  2294. X  fputs ("else: font_coding_scheme:=\n", outfile);
  2295. X  fputs ("  if ligs=0: \"TeX typewriter text\"\n", outfile);
  2296. X  fputs ("  else: \"TeX text without f-ligatures\" fi;\n", outfile);
  2297. X  fputs ("  spanish_shriek=oct\"016\"; spanish_query=oct\"017\"; fi\n", outfile);
  2298. X  fputs ("font_setup;\n", outfile);
  2299. X  fputs ("input romanu.mf %Roman uppercase.\n", outfile);
  2300. X  fputs ("input romanl.mf %Roman lowerrcase.\n", outfile);
  2301. X  fputs ("input greeku.mf %Greek uppercase.\n", outfile);
  2302. X  fputs ("input romand.mf %Numerals.\n", outfile);
  2303. X  fputs ("input romanp.mf %Ampersand, question marks, currency sign.\n", outfile);
  2304. X  fputs ("input romspl.mf %Lowercase specials (dotless \\i, ligature \\ae, etc.)\n", outfile);
  2305. X  fputs ("input romspu.mf %Uppercase specials (\\AE, \\OE, \\O)\n", outfile);
  2306. X  fputs ("input punct.mf %Punctuation symbols.\n", outfile);
  2307. X  fputs ("\nminus=ASCII\"-\"; cmchar \"Minus sign\";\n", outfile);
  2308. X  fputs ("beginarithchar(minus); \n", outfile);
  2309. X  fputs ("  pickup rule.nib;\n", outfile);
  2310. X  fputs ("  lft x1=hround 1.5u-eps;\n", outfile);
  2311. X  fputs ("  x2=w-x1; y1=y2=math_axis;\n", outfile);
  2312. X  fputs ("  draw z1--z2;     % bar\n", outfile);
  2313. X  fputs ("  labels(1,2); \n", outfile);
  2314. X  fputs ("endchar;\n", outfile);
  2315. X
  2316. X  fputs ("\ncmchar \"Period\";\n", outfile);
  2317. X  fputs ("  numeric dot_diam#; dot_diam#:=if monospace: 5/4 fi\\ dot_size#;\n", outfile);
  2318. X  fputs ("  define_whole_blacker_pixels(dot_diam);\n", outfile);
  2319. X  fputs ("  beginchar(\".\",5u#,dot_diam#,0);\n", outfile);
  2320. X  fputs ("  adjust_fit(0,0); pickup fine.nib;\n", outfile);
  2321. X  fputs ("  pos1(dot_diam,0); pos2(dot_diam,90);\n", outfile);
  2322. X  fputs ("  lft x1l=hround(.5w-.5dot_diam); bot y2l=0; z1=z2; dot(1,2);    % dot\n", outfile);
  2323. X  fputs ("  penlabels(1,2);\n", outfile);
  2324. X  fputs ("endchar;\n", outfile);
  2325. X
  2326. X  fputs ("\ndef endchar =\n", outfile);
  2327. X  fputs ("  % Next line should probably be removed if CM base is used\n", outfile);
  2328. X  fputs ("  l:=0; r:=w;\n", outfile);
  2329. X  fputs ("  %Include the next two lines if you want to\n", outfile);
  2330. X  fputs ("  %rotate the picture 90 deg.(Portrait to Landscape)\n", outfile);
  2331. X  fputs ("  %currentpicture:=currentpicture rotated 90 shifted (h,0);\n", outfile);
  2332. X  fputs ("  %tmp:=charht; charht:=charwd; charwd:=tmp;\n", outfile);
  2333. X  fputs ("  scantokens extra_endchar;\n", outfile);
  2334. X  fputs ("  if proofing>0: makebox(proofrule); fi\n", outfile);
  2335. X  fputs ("  chardx:=w;\n", outfile);
  2336. X  fputs ("  shipit;\n", outfile);
  2337. X  fputs ("  if displaying>0: makebox(screenrule); showit; fi\n", outfile);
  2338. X  fputs ("  endgroup \n", outfile);
  2339. X  fputs ("enddef;\n", outfile);
  2340. X  fputs ("let endchar_ = endchar;\n", outfile);
  2341. X  fputs ("let generate = input;\n", outfile);
  2342. X  fputs ("let roman = roman;\n", outfile);
  2343. X
  2344. X  fputs ("\n\nfont_identifier:=\"GNUPLOT\";\n", outfile);
  2345. X  /* font_size must be bigger than em#/16 by METAFONT rules.
  2346. X   * Therefore make it pretty big so big figures will be
  2347. X   * handled correctly. Setting font_size to 72pt# lets us
  2348. X   * handle characters up to 15.94 by 15.94 inches. */
  2349. X  fputs ("font_size 72pt#;\n", outfile);
  2350. X  fputs ("th#=0.4pt#; define_whole_pixels(th);\n", outfile);
  2351. X  fputs ("\npath arrowhead;\n", outfile);
  2352. X  fputs ("arrowhead = (-7pt,-2pt){dir30}..(-6pt,0pt)..", outfile);
  2353. X  fputs ("{dir150}(-7pt,2pt) &\n", outfile);
  2354. X  fputs ("  (-7pt,2pt)--(0pt,0pt)--(-7pt,-2pt) & cycle;\n", outfile);
  2355. X}
  2356. X
  2357. X
  2358. Xint MF_graphics ()
  2359. X{
  2360. X  register struct termentry *t = &term_tbl[term];
  2361. X
  2362. X  fprintf (outfile, "\n\nbeginchar(%d,%gin#,%gin#,0);\n",
  2363. X           MF_char_code, MF_xsize, MF_ysize);
  2364. X  MF_char_code++;
  2365. X  fprintf (outfile, "a:=w/%d;b:=h/%d;\n", t->xmax, t->ymax);
  2366. X  MF_picked_up_pen = 0;
  2367. X}
  2368. X
  2369. X
  2370. Xint MF_text ()
  2371. X{
  2372. X  fprintf (outfile, "endchar;\n");
  2373. X}
  2374. X
  2375. X
  2376. Xint MF_justify_text (mode)
  2377. Xenum JUSTIFY mode;
  2378. X{
  2379. X  MF_justify = mode;
  2380. X  return TRUE;
  2381. X}
  2382. X
  2383. X
  2384. Xint MF_text_angle (ang)
  2385. Xint ang;
  2386. X{
  2387. X  if (ang > 0) MF_ang = 90;
  2388. X  else MF_ang = 0;
  2389. X  return TRUE;
  2390. X}
  2391. X
  2392. X
  2393. Xint MF_linetype (linetype)
  2394. Xint linetype;
  2395. X{
  2396. X  if (linetype >=8) linetype %= 8;
  2397. X  linetype += 2;
  2398. X  /* Only output change in pens if it actually affects the pen used */
  2399. X  if ((MF_lines[linetype].thickness != MF_lines[MF_line_type].thickness) ||
  2400. X      (!MF_picked_up_pen)) {
  2401. X    fprintf (outfile, "pickup pencircle scaled %gth;\n",
  2402. X             MF_lines[linetype].thickness);
  2403. X    MF_picked_up_pen = 1;
  2404. X  }
  2405. X  MF_line_type = linetype;
  2406. X  MF_dash_index = 0;
  2407. X  MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
  2408. X  MF_is_solid = MF_lines[MF_line_type].solid;
  2409. X}
  2410. X
  2411. X
  2412. Xint MF_scale (xs, ys)
  2413. Xdouble xs, ys;
  2414. X{
  2415. X  struct termentry *t = &term_tbl[term];
  2416. X
  2417. X  t->xmax = (unsigned int) (MF_XMAX * xs);
  2418. X  t->ymax = (unsigned int) (MF_YMAX * ys);
  2419. X  MF_xsize = MF_XSIZE * xs;
  2420. X  MF_ysize = MF_YSIZE * ys;
  2421. X  return TRUE;
  2422. X}
  2423. X
  2424. X
  2425. Xint MF_move (x, y)
  2426. Xunsigned int x, y;
  2427. X{
  2428. X  MF_last_x = x;
  2429. X  MF_last_y = y;
  2430. X  MF_dash_index = 0;
  2431. X  MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
  2432. X}
  2433. X
  2434. X
  2435. Xint MF_vector (x, y)
  2436. Xunsigned int x, y;
  2437. X{
  2438. X  double sqrt(), floor();
  2439. X
  2440. X  if (MF_is_solid) {
  2441. X    if (x == MF_last_x && y == MF_last_y)
  2442. X      fprintf (outfile, "drawdot (%da,%db);\n", x, y);
  2443. X    else
  2444. X      fprintf (outfile, "draw (%da,%db)--(%da,%db);\n",
  2445. X               MF_last_x, MF_last_y, x, y);
  2446. X  } else {
  2447. X    double dist_to_go, delta_x, delta_y, inc_x, inc_y;
  2448. X    double last_x_d, last_y_d, next_x_d, next_y_d;
  2449. X    unsigned int next_x, next_y;
  2450. X
  2451. X    if (x == MF_last_x && y == MF_last_y) {
  2452. X      if (! (MF_dash_index & 1))
  2453. X        fprintf (outfile, "drawdot (%da,%db);\n", x, y);
  2454. X    } else {
  2455. X      last_x_d = MF_last_x;
  2456. X      last_y_d = MF_last_y;
  2457. X      delta_x = x - last_x_d;
  2458. X      delta_y = y - last_y_d;
  2459. X      dist_to_go = sqrt (delta_x * delta_x + delta_y * delta_y);
  2460. X      inc_x = delta_x / dist_to_go;
  2461. X      inc_y = delta_y / dist_to_go;
  2462. X      while (MF_dist_left < dist_to_go) {
  2463. X        next_x_d = last_x_d + inc_x * MF_dist_left;
  2464. X        next_y_d = last_y_d + inc_y * MF_dist_left;
  2465. X        next_x = floor (next_x_d + 0.5);
  2466. X        next_y = floor (next_y_d + 0.5);
  2467. X        /* MF_dash_index & 1 == 0 means: draw a line; otherwise just move */
  2468. X        if (! (MF_dash_index & 1))
  2469. X          fprintf (outfile, "draw (%da,%db)--(%da,%db);\n",
  2470. X                   MF_last_x, MF_last_y, next_x, next_y);
  2471. X        MF_last_x = next_x;
  2472. X        MF_last_y = next_y;
  2473. X        last_x_d = next_x_d;
  2474. X        last_y_d = next_y_d;
  2475. X        dist_to_go -= MF_dist_left;
  2476. X        MF_dash_index = (MF_dash_index + 1) & 3;
  2477. X        MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
  2478. X      }
  2479. X      delta_x = x - last_x_d;
  2480. X      delta_y = y - last_y_d;
  2481. X      MF_dist_left -= sqrt (delta_x * delta_x + delta_y * delta_y);
  2482. X      if (! (MF_dash_index & 1)) {
  2483. X        if (x == MF_last_x && y == MF_last_y)
  2484. X          fprintf (outfile, "drawdot (%da,%db);\n", x, y);
  2485. X        else
  2486. X          fprintf (outfile, "draw (%da,%db)--(%da,%db);\n",
  2487. X                   MF_last_x, MF_last_y, x, y);
  2488. X      }
  2489. X    }
  2490. X  }
  2491. X  MF_last_x = x;
  2492. X  MF_last_y = y;
  2493. X}
  2494. X
  2495. X
  2496. Xint MF_arrow (sx, sy, ex, ey, head)
  2497. Xunsigned int sx, sy, ex, ey;
  2498. XTBOOLEAN head;
  2499. X{
  2500. X  int delta_x, delta_y;
  2501. X
  2502. X  MF_move (sx, sy);
  2503. X  MF_vector (ex, ey);
  2504. X  if (head) {
  2505. X    delta_x = ex - sx;
  2506. X    delta_y = ey - sy;
  2507. X    fprintf (outfile, "fill arrowhead rotated angle(%d,%d) shifted (%da,%db);\n",
  2508. X             delta_x, delta_y, ex, ey);
  2509. X  } 
  2510. X}
  2511. X
  2512. X
  2513. Xint MF_put_text (x, y, str)
  2514. Xunsigned int x, y;
  2515. Xchar *str;
  2516. X{
  2517. X  int i, j;
  2518. X
  2519. X  for (i = 0; i < strlen (str); i++)
  2520. X    if (str[i] == '"')
  2521. X      str[i] = '\'';        /* Replace " with ' */
  2522. X  switch (MF_justify) {
  2523. X    case LEFT:
  2524. X      j = 1;
  2525. X      break;
  2526. X    case CENTRE:
  2527. X      j = 2;
  2528. X      break;
  2529. X    case RIGHT:
  2530. X      j = 3;
  2531. X      break;
  2532. X  }
  2533. X  fprintf (outfile, "put_text(\"%s\",%da,%db,%d,%d);\n",
  2534. X           str, x, y, MF_ang, j);
  2535. X}
  2536. X
  2537. X
  2538. Xint MF_reset ()
  2539. X{
  2540. X  fprintf (outfile, "end.\n");
  2541. X}
  2542. END_OF_FILE
  2543.   if test 14593 -ne `wc -c <'gnuplot/term/metafont.trm'`; then
  2544.     echo shar: \"'gnuplot/term/metafont.trm'\" unpacked with wrong size!
  2545.   fi
  2546.   # end of 'gnuplot/term/metafont.trm'
  2547. fi
  2548. echo shar: End of archive 18 \(of 33\).
  2549. cp /dev/null ark18isdone
  2550. MISSING=""
  2551. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
  2552.     if test ! -f ark${I}isdone ; then
  2553.     MISSING="${MISSING} ${I}"
  2554.     fi
  2555. done
  2556. if test "${MISSING}" = "" ; then
  2557.     echo You have unpacked all 33 archives.
  2558.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2559. else
  2560.     echo You still must unpack the following archives:
  2561.     echo "        " ${MISSING}
  2562. fi
  2563. exit 0
  2564. exit 0 # Just in case...
  2565.