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

  1. Newsgroups: comp.sources.misc
  2. From: woo@playfair.stanford.edu ("Alexander Woo")
  3. Subject: v40i036:  gnuplot - interactive function plotting utility, Part24/33
  4. Message-ID: <1993Oct22.163905.24742@sparky.sterling.com>
  5. X-Md4-Signature: b976a75cd41faeed91c6246da9bdd4b6
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Fri, 22 Oct 1993 16:39:05 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: woo@playfair.stanford.edu ("Alexander Woo")
  12. Posting-number: Volume 40, Issue 36
  13. Archive-name: gnuplot/part24
  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/glass.dat gnuplot/demo/surface2.dem
  22. #   gnuplot/docs/doc2rtf.c gnuplot/os2/gnupmdrv.itl
  23. #   gnuplot/term/amiga.trm gnuplot/term/dxf.trm gnuplot/term/rgip.trm
  24. #   gnuplot/term/x11.trm gnuplot/win/winmain.c
  25. # Wrapped by kent@sparky on Wed Oct 20 17:14:57 1993
  26. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  27. echo If this archive is complete, you will see the following message:
  28. echo '          "shar: End of archive 24 (of 33)."'
  29. if test -f 'gnuplot/demo/glass.dat' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'gnuplot/demo/glass.dat'\"
  31. else
  32.   echo shar: Extracting \"'gnuplot/demo/glass.dat'\" \(8596 characters\)
  33.   sed "s/^X//" >'gnuplot/demo/glass.dat' <<'END_OF_FILE'
  34. X#
  35. X# $Id: glass.dat 3.38.2.6 1992/11/14 02:25:21 woo Exp $
  36. X#
  37. X# 16x16 grid Glass shape. Created Using DRAWFN3D, Gershon Elber 1990.
  38. X#
  39. X  0.568000   0.000000  -0.911000
  40. X  0.518894   0.231026  -0.911000
  41. X  0.380066   0.422106  -0.911000
  42. X  0.175522   0.540200  -0.911000
  43. X -0.059372   0.564888  -0.911000
  44. X -0.284000   0.491902  -0.911000
  45. X -0.459522   0.333862  -0.911000
  46. X -0.555588   0.118094  -0.911000
  47. X -0.555588  -0.118094  -0.911000
  48. X -0.459522  -0.333862  -0.911000
  49. X -0.284000  -0.491902  -0.911000
  50. X -0.059372  -0.564888  -0.911000
  51. X  0.175522  -0.540200  -0.911000
  52. X  0.380066  -0.422106  -0.911000
  53. X  0.518894  -0.231027  -0.911000
  54. X  0.568000  -0.000000  -0.911000
  55. X
  56. X  0.341741   0.000000  -0.905215
  57. X  0.312196   0.138999  -0.905215
  58. X  0.228669   0.253963  -0.905215
  59. X  0.105604   0.325015  -0.905215
  60. X -0.035722   0.339869  -0.905215
  61. X -0.170870   0.295956  -0.905215
  62. X -0.276474   0.200870  -0.905215
  63. X -0.334273   0.071052  -0.905215
  64. X -0.334273  -0.071052  -0.905215
  65. X -0.276474  -0.200870  -0.905215
  66. X -0.170871  -0.295956  -0.905215
  67. X -0.035722  -0.339869  -0.905215
  68. X  0.105604  -0.325015  -0.905215
  69. X  0.228669  -0.253963  -0.905215
  70. X  0.312196  -0.138999  -0.905215
  71. X  0.341741  -0.000000  -0.905215
  72. X
  73. X  0.212153   0.000000  -0.863178
  74. X  0.193812   0.086290  -0.863178
  75. X  0.141958   0.157661  -0.863178
  76. X  0.065559   0.201770  -0.863178
  77. X -0.022176   0.210991  -0.863178
  78. X -0.106077   0.183730  -0.863178
  79. X -0.171636   0.124701  -0.863178
  80. X -0.207517   0.044109  -0.863178
  81. X -0.207517  -0.044109  -0.863178
  82. X -0.171636  -0.124701  -0.863178
  83. X -0.106077  -0.183730  -0.863178
  84. X -0.022176  -0.210991  -0.863178
  85. X  0.065559  -0.201770  -0.863178
  86. X  0.141958  -0.157661  -0.863178
  87. X  0.193812  -0.086291  -0.863178
  88. X  0.212153  -0.000000  -0.863178
  89. X
  90. X  0.138097   0.000000  -0.764660
  91. X  0.126157   0.056169  -0.764660
  92. X  0.092405   0.102626  -0.764660
  93. X  0.042674   0.131338  -0.764660
  94. X -0.014435   0.137340  -0.764660
  95. X -0.069048   0.119595  -0.764660
  96. X -0.111722   0.081171  -0.764660
  97. X -0.135079   0.028712  -0.764660
  98. X -0.135079  -0.028712  -0.764660
  99. X -0.111722  -0.081171  -0.764660
  100. X -0.069048  -0.119595  -0.764660
  101. X -0.014435  -0.137340  -0.764660
  102. X  0.042674  -0.131338  -0.764660
  103. X  0.092405  -0.102626  -0.764660
  104. X  0.126157  -0.056169  -0.764660
  105. X  0.138097  -0.000000  -0.764660
  106. X
  107. X  0.098588   0.000000  -0.618872
  108. X  0.090065   0.040099  -0.618872
  109. X  0.065968   0.073265  -0.618872
  110. X  0.030465   0.093763  -0.618872
  111. X -0.010305   0.098048  -0.618872
  112. X -0.049294   0.085380  -0.618872
  113. X -0.079760   0.057949  -0.618872
  114. X -0.096434   0.020498  -0.618872
  115. X -0.096434  -0.020498  -0.618872
  116. X -0.079760  -0.057949  -0.618872
  117. X -0.049294  -0.085380  -0.618872
  118. X -0.010305  -0.098048  -0.618872
  119. X  0.030465  -0.093763  -0.618872
  120. X  0.065968  -0.073265  -0.618872
  121. X  0.090065  -0.040099  -0.618872
  122. X  0.098588  -0.000000  -0.618872
  123. X
  124. X  0.084164   0.000000  -0.452254
  125. X  0.076887   0.034232  -0.452254
  126. X  0.056317   0.062546  -0.452254
  127. X  0.026008   0.080044  -0.452254
  128. X -0.008798   0.083703  -0.452254
  129. X -0.042082   0.072888  -0.452254
  130. X -0.068090   0.049470  -0.452254
  131. X -0.082325   0.017499  -0.452254
  132. X -0.082325  -0.017499  -0.452254
  133. X -0.068090  -0.049470  -0.452254
  134. X -0.042082  -0.072888  -0.452254
  135. X -0.008798  -0.083703  -0.452254
  136. X  0.026008  -0.080045  -0.452254
  137. X  0.056317  -0.062546  -0.452254
  138. X  0.076887  -0.034233  -0.452254
  139. X  0.084164  -0.000000  -0.452254
  140. X
  141. X  0.092386   0.000000  -0.291706
  142. X  0.084399   0.037577  -0.291706
  143. X  0.061819   0.068656  -0.291706
  144. X  0.028549   0.087865  -0.291706
  145. X -0.009657   0.091880  -0.291706
  146. X -0.046193   0.080009  -0.291706
  147. X -0.074742   0.054303  -0.291706
  148. X -0.090368   0.019208  -0.291706
  149. X -0.090368  -0.019208  -0.291706
  150. X -0.074742  -0.054303  -0.291706
  151. X -0.046193  -0.080009  -0.291706
  152. X -0.009657  -0.091880  -0.291706
  153. X  0.028549  -0.087865  -0.291706
  154. X  0.061819  -0.068656  -0.291706
  155. X  0.084399  -0.037577  -0.291706
  156. X  0.092386  -0.000000  -0.291706
  157. X
  158. X  0.124988   0.000000  -0.153861
  159. X  0.114183   0.050837  -0.153861
  160. X  0.083634   0.092885  -0.153861
  161. X  0.038624   0.118871  -0.153861
  162. X -0.013065   0.124304  -0.153861
  163. X -0.062494   0.108243  -0.153861
  164. X -0.101118   0.073466  -0.153861
  165. X -0.122257   0.025987  -0.153861
  166. X -0.122257  -0.025987  -0.153861
  167. X -0.101118  -0.073466  -0.153861
  168. X -0.062494  -0.108243  -0.153861
  169. X -0.013065  -0.124304  -0.153861
  170. X  0.038624  -0.118871  -0.153861
  171. X  0.083634  -0.092885  -0.153861
  172. X  0.114183  -0.050837  -0.153861
  173. X  0.124988  -0.000000  -0.153861
  174. X
  175. X  0.185015   0.000000  -0.041791
  176. X  0.169020   0.075253  -0.041791
  177. X  0.123799   0.137493  -0.041791
  178. X  0.057173   0.175960  -0.041791
  179. X -0.019339   0.184002  -0.041791
  180. X -0.092508   0.160228  -0.041791
  181. X -0.149681   0.108749  -0.041791
  182. X -0.180972   0.038467  -0.041791
  183. X -0.180972  -0.038467  -0.041791
  184. X -0.149681  -0.108749  -0.041791
  185. X -0.092508  -0.160228  -0.041791
  186. X -0.019339  -0.184002  -0.041791
  187. X  0.057173  -0.175960  -0.041791
  188. X  0.123799  -0.137493  -0.041791
  189. X  0.169020  -0.075253  -0.041791
  190. X  0.185015  -0.000000  -0.041791
  191. X
  192. X  0.273264   0.000000   0.053395
  193. X  0.249639   0.111146   0.053395
  194. X  0.182849   0.203075   0.053395
  195. X  0.084443   0.259889   0.053395
  196. X -0.028564   0.271767   0.053395
  197. X -0.136632   0.236653   0.053395
  198. X -0.221075   0.160620   0.053395
  199. X -0.267292   0.056815   0.053395
  200. X -0.267292  -0.056815   0.053395
  201. X -0.221075  -0.160620   0.053395
  202. X -0.136632  -0.236653   0.053395
  203. X -0.028564  -0.271767   0.053395
  204. X  0.084443  -0.259889   0.053395
  205. X  0.182849  -0.203075   0.053395
  206. X  0.249639  -0.111146   0.053395
  207. X  0.273264  -0.000000   0.053395
  208. X
  209. X  0.384384   0.000000   0.149114
  210. X  0.351152   0.156343   0.149114
  211. X  0.257203   0.285653   0.149114
  212. X  0.118781   0.365570   0.149114
  213. X -0.040179   0.382278   0.149114
  214. X -0.192192   0.332886   0.149114
  215. X -0.310973   0.225935   0.149114
  216. X -0.375984   0.079918   0.149114
  217. X -0.375984  -0.079918   0.149114
  218. X -0.310973  -0.225935   0.149114
  219. X -0.192192  -0.332886   0.149114
  220. X -0.040179  -0.382278   0.149114
  221. X  0.118781  -0.365571   0.149114
  222. X  0.257203  -0.285653   0.149114
  223. X  0.351152  -0.156343   0.149114
  224. X  0.384384  -0.000000   0.149114
  225. X
  226. X  0.504089   0.000000   0.267473
  227. X  0.460508   0.205031   0.267473
  228. X  0.337301   0.374611   0.267473
  229. X  0.155772   0.479417   0.267473
  230. X -0.052692   0.501327   0.267473
  231. X -0.252044   0.436554   0.267473
  232. X -0.407816   0.296296   0.267473
  233. X -0.493073   0.104806   0.267473
  234. X -0.493073  -0.104806   0.267473
  235. X -0.407816  -0.296296   0.267473
  236. X -0.252044  -0.436554   0.267473
  237. X -0.052692  -0.501327   0.267473
  238. X  0.155772  -0.479417   0.267473
  239. X  0.337301  -0.374611   0.267473
  240. X  0.460508  -0.205031   0.267473
  241. X  0.504089  -0.000000   0.267473
  242. X
  243. X  0.609609   0.000000   0.430046
  244. X  0.556906   0.247950   0.430046
  245. X  0.407908   0.453028   0.430046
  246. X  0.188380   0.579773   0.430046
  247. X -0.063721   0.606270   0.430046
  248. X -0.304805   0.527937   0.430046
  249. X -0.493184   0.358319   0.430046
  250. X -0.596288   0.126745   0.430046
  251. X -0.596288  -0.126745   0.430046
  252. X -0.493184  -0.358319   0.430046
  253. X -0.304805  -0.527937   0.430046
  254. X -0.063722  -0.606270   0.430046
  255. X  0.188380  -0.579773   0.430046
  256. X  0.407908  -0.453028   0.430046
  257. X  0.556906  -0.247951   0.430046
  258. X  0.609609  -0.000000   0.430046
  259. X
  260. X  0.675154   0.000000   0.647779
  261. X  0.616784   0.274610   0.647779
  262. X  0.451766   0.501737   0.647779
  263. X  0.208634   0.642110   0.647779
  264. X -0.070573   0.671455   0.647779
  265. X -0.337577   0.584700   0.647779
  266. X -0.546211   0.396846   0.647779
  267. X -0.660400   0.140372   0.647779
  268. X -0.660400  -0.140372   0.647779
  269. X -0.546211  -0.396845   0.647779
  270. X -0.337577  -0.584700   0.647779
  271. X -0.070573  -0.671455   0.647779
  272. X  0.208634  -0.642110   0.647779
  273. X  0.451766  -0.501737   0.647779
  274. X  0.616784  -0.274610   0.647779
  275. X  0.675154  -0.000000   0.647779
  276. X
  277. X  0.681825   0.000000   0.900691
  278. X  0.622878   0.277323   0.900691
  279. X  0.456230   0.506695   0.900691
  280. X  0.210696   0.648454   0.900691
  281. X -0.071270   0.678090   0.900691
  282. X -0.340913   0.590478   0.900691
  283. X -0.551608   0.400767   0.900691
  284. X -0.666926   0.141760   0.900691
  285. X -0.666926  -0.141759   0.900691
  286. X -0.551608  -0.400767   0.900691
  287. X -0.340913  -0.590478   0.900691
  288. X -0.071270  -0.678090   0.900691
  289. X  0.210695  -0.648454   0.900691
  290. X  0.456230  -0.506695   0.900691
  291. X  0.622878  -0.277324   0.900691
  292. X  0.681825  -0.000000   0.900691
  293. X
  294. X  0.626000   0.000000   1.101000
  295. X  0.571879   0.254617   1.101000
  296. X  0.418876   0.465209   1.101000
  297. X  0.193445   0.595361   1.101000
  298. X -0.065435   0.622571   1.101000
  299. X -0.313000   0.542132   1.101000
  300. X -0.506445   0.367954   1.101000
  301. X -0.612320   0.130153   1.101000
  302. X -0.612320  -0.130153   1.101000
  303. X -0.506445  -0.367953   1.101000
  304. X -0.313000  -0.542132   1.101000
  305. X -0.065435  -0.622571   1.101000
  306. X  0.193444  -0.595361   1.101000
  307. X  0.418876  -0.465209   1.101000
  308. X  0.571879  -0.254617   1.101000
  309. X  0.626000  -0.000000   1.101000
  310. X
  311. END_OF_FILE
  312.   if test 8596 -ne `wc -c <'gnuplot/demo/glass.dat'`; then
  313.     echo shar: \"'gnuplot/demo/glass.dat'\" unpacked with wrong size!
  314.   fi
  315.   # end of 'gnuplot/demo/glass.dat'
  316. fi
  317. if test -f 'gnuplot/demo/surface2.dem' -a "${1}" != "-c" ; then 
  318.   echo shar: Will not clobber existing file \"'gnuplot/demo/surface2.dem'\"
  319. else
  320.   echo shar: Extracting \"'gnuplot/demo/surface2.dem'\" \(1760 characters\)
  321.   sed "s/^X//" >'gnuplot/demo/surface2.dem' <<'END_OF_FILE'
  322. X#
  323. X# $Id: surface2.dem%v 3.38.2.139 1993/06/19 01:03:49 woo Exp woo $
  324. X#
  325. Xset parametric
  326. Xset isosamples 50,10
  327. Xset hidden
  328. X
  329. Xset title "Parametric Sphere"
  330. Xset urange [-pi/2:pi/2]
  331. Xset vrange [0:2*pi]
  332. Xset zrange [-1:1]
  333. Xset ztics -1.0,0.25,1.0
  334. Xset view 45,50,,2.5
  335. Xsplot cos(u)*cos(v),cos(u)*sin(v),sin(u)
  336. Xpause -1 "Hit return to continue (1)"
  337. X
  338. Xset view ,,,0.8
  339. Xreplot
  340. Xpause -1 "Hit return to continue (2)"
  341. X
  342. Xset view ,,,1.6
  343. Xreplot
  344. Xpause -1 "Hit return to continue (3)"
  345. X
  346. Xset view ,,,1.0
  347. X
  348. Xset title "Parametric Torus"
  349. Xset urange [0:2*pi]
  350. Xset vrange [0:2*pi]
  351. Xsplot (1-0.2*cos(v))*cos(u),(1-0.2*cos(v))*sin(u),0.2*sin(v)
  352. Xpause -1 "Hit return to continue (4)"
  353. X
  354. X
  355. Xset title "Parametric Hexagon"
  356. Xset urange [-1.3:1.3]
  357. Xset vrange [0:2*pi]
  358. Xset zrange [-0.6:0.6]
  359. Xset ztics
  360. Xsplot cos(v)**3*cos(u)**3,sin(v)**3*cos(u)**3,sin(u)**3
  361. Xpause -1 "Hit return to continue (5)"
  362. X
  363. Xset title "Parametric Helix"
  364. Xset isosamples 100,20
  365. Xset urange [0:10*pi]
  366. Xset vrange [0:2*pi]
  367. Xset zrange [-0.6:0.6]
  368. Xsplot (1-0.1*cos(v))*cos(u),(1-0.1*cos(v))*sin(u),0.1*(sin(v)+u/1.7-10)
  369. Xpause -1 "Hit return to continue (6)"
  370. X
  371. Xset title "Parametric Shell"
  372. Xset isosamples 40,20
  373. Xset view 50,30,1.0
  374. Xset urange [0:2*pi]
  375. Xset vrange [0:2*pi]
  376. Xset zrange [-3:1.5]
  377. Xsplot cos(u)*u*(1+cos(v)/2),sin(v)*u/2,sin(u)*u*(1+cos(v)/2)
  378. Xpause -1 "Hit return to continue (7)"
  379. X
  380. Xset title "Interlocking Tori"
  381. X
  382. Xset urange [-pi:pi]
  383. Xset vrange [-pi:pi]
  384. Xset isosamples 50,20
  385. Xsplot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with lines, 1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with lines
  386. Xpause -1 "Hit return to continue (8)"
  387. X
  388. X#
  389. X# Clean up:
  390. X#
  391. Xset noparametric
  392. Xset dummy x,y
  393. Xset isosamples 10,10
  394. Xset view 60,30,1,1
  395. Xset urange [-5:5]
  396. Xset vrange [-5:5]
  397. Xset zrange [-10:10]
  398. Xset auto
  399. Xset title "" 0,0
  400. Xset nohidden
  401. END_OF_FILE
  402.   if test 1760 -ne `wc -c <'gnuplot/demo/surface2.dem'`; then
  403.     echo shar: \"'gnuplot/demo/surface2.dem'\" unpacked with wrong size!
  404.   fi
  405.   # end of 'gnuplot/demo/surface2.dem'
  406. fi
  407. if test -f 'gnuplot/docs/doc2rtf.c' -a "${1}" != "-c" ; then 
  408.   echo shar: Will not clobber existing file \"'gnuplot/docs/doc2rtf.c'\"
  409. else
  410.   echo shar: Extracting \"'gnuplot/docs/doc2rtf.c'\" \(8811 characters\)
  411.   sed "s/^X//" >'gnuplot/docs/doc2rtf.c' <<'END_OF_FILE'
  412. X/*
  413. X * doc2rtf.c  -- program to convert Gnuplot .DOC format to MS windows
  414. X * help (.rtf) format.
  415. X *
  416. X * This involves stripping all lines with a leading digit or
  417. X * a leading @, #, or %.
  418. X * Modified by Maurice Castro from doc2gih.c by Thomas Williams 
  419. X *
  420. X * usage:  doc2rtf file.doc file.rtf [-d]
  421. X *
  422. X */
  423. X
  424. X/* note that tables must begin in at least the second column to */
  425. X/* be formatted correctly and tabs are forbidden */
  426. X
  427. X#include <stdio.h>
  428. X#include <ctype.h>
  429. X#include <string.h>
  430. X#include <stdlib.h>
  431. X
  432. X#define MAX_LINE_LEN    1024
  433. X#define TRUE 1
  434. X#define FALSE 0
  435. X
  436. Xstruct LIST
  437. X{
  438. X    int level;
  439. X    int line;
  440. X    char *string;
  441. X    struct LIST *next;
  442. X    };
  443. X
  444. Xstruct LIST *list = NULL;
  445. Xstruct LIST *head = NULL;
  446. X
  447. Xstruct LIST *keylist = NULL;
  448. Xstruct LIST *keyhead = NULL;
  449. X
  450. Xint debug = FALSE;
  451. X
  452. Xvoid footnote();
  453. Xvoid parse();
  454. Xvoid refs();
  455. Xvoid convert();
  456. Xvoid process_line();
  457. Xint lookup();
  458. X
  459. Xmain(argc,argv)
  460. Xint argc;
  461. Xchar **argv;
  462. X{
  463. XFILE * infile;
  464. XFILE * outfile;
  465. X    if (argc==4 && argv[3][0]=='-' && argv[3][1]=='d')
  466. X        debug = TRUE;
  467. X
  468. X    if (argc != 3 && !debug) {
  469. X        fprintf(stderr,"Usage: %s infile outfile\n", argv[0]);
  470. X        return(1);
  471. X    }
  472. X    if ( (infile = fopen(argv[1],"r")) == (FILE *)NULL) {
  473. X        fprintf(stderr,"%s: Can't open %s for reading\n",
  474. X            argv[0], argv[1]);
  475. X        return(1);
  476. X    }
  477. X    if ( (outfile = fopen(argv[2],"w")) == (FILE *)NULL) {
  478. X        fprintf(stderr,"%s: Can't open %s for writing\n",
  479. X            argv[0], argv[2]);
  480. X    }
  481. X    parse(infile);
  482. X    convert(infile,outfile);
  483. X    return(0);
  484. X}
  485. X
  486. X/* scan the file and build a list of line numbers where particular levels are */
  487. Xvoid parse(a)
  488. XFILE *a;
  489. X{
  490. X    static char line[MAX_LINE_LEN];
  491. X    char *c;
  492. X    int lineno=0;
  493. X    int lastline=0;
  494. X
  495. X    while (fgets(line,MAX_LINE_LEN,a)) 
  496. X    {
  497. X    lineno++;
  498. X    if (isdigit(line[0]))
  499. X    {
  500. X        if (list == NULL)    
  501. X            head = (list = (struct LIST *) malloc(sizeof(struct LIST)));
  502. X        else
  503. X            list = (list->next = (struct LIST *) malloc(sizeof(struct LIST)));
  504. X        list->line = lastline = lineno;
  505. X        list->level = line[0] - '0';
  506. X        list->string = (char *) malloc (strlen(line)+1);
  507. X        c = strtok(&(line[1]),"\n");
  508. X        strcpy(list->string, c);
  509. X        list->next = NULL;
  510. X    }
  511. X    if (line[0]=='?')
  512. X    {
  513. X        if (keylist == NULL)    
  514. X            keyhead = (keylist = (struct LIST *) malloc(sizeof(struct LIST)));
  515. X        else
  516. X            keylist = (keylist->next = (struct LIST *) malloc(sizeof(struct LIST)));
  517. X        keylist->line = lastline;
  518. X        keylist->level = line[0] - '0';
  519. X        keylist->string = (char *) malloc (strlen(line)+1);
  520. X        c = strtok(&(line[1]),"\n");
  521. X        strcpy(keylist->string, c);
  522. X        keylist->next = NULL;
  523. X    }
  524. X    }
  525. X    rewind(a);
  526. X    }
  527. X
  528. X/* look up an in text reference */
  529. Xint
  530. Xlookup(s)
  531. Xchar *s;
  532. X{
  533. X    char *c;
  534. X    char tokstr[MAX_LINE_LEN];
  535. X    char *match; 
  536. X    int l;
  537. X
  538. X    strcpy(tokstr, s);
  539. X
  540. X    /* first try the ? keyword entries */
  541. X    keylist = keyhead;
  542. X    while (keylist != NULL)
  543. X    {
  544. X        c = keylist->string;
  545. X        while (isspace(*c)) c++;
  546. X        if (!strcmp(s, c)) return(keylist->line);
  547. X        keylist = keylist->next;
  548. X        }
  549. X
  550. X    /* then try titles */
  551. X    match = strtok(tokstr, " \n\t");
  552. X    l = 0; /* level */
  553. X    
  554. X    list = head;
  555. X    while (list != NULL)
  556. X    {
  557. X        c = list->string;
  558. X        while (isspace(*c)) c++;
  559. X        if (!strcmp(match, c)) 
  560. X        {
  561. X            l = list->level;
  562. X            match = strtok(NULL, "\n\t ");
  563. X            if (match == NULL)
  564. X            {
  565. X                return(list->line);
  566. X                }
  567. X            }
  568. X        if (l > list->level)
  569. X            break;
  570. X        list = list->next;
  571. X        }
  572. X    return(-1);
  573. X    }
  574. X
  575. X/* search through the list to find any references */
  576. Xvoid
  577. Xrefs(l, f)
  578. Xint l;
  579. XFILE *f;
  580. X{
  581. X    int curlevel;
  582. X    char str[MAX_LINE_LEN];
  583. X    char *c;
  584. X
  585. X    /* find current line */
  586. X    list = head;
  587. X    while (list->line != l)
  588. X        list = list->next;
  589. X    curlevel = list->level;
  590. X    list = list->next;        /* look at next element before going on */
  591. X    while (list != NULL)
  592. X    {
  593. X        /* we are onto the next topic so stop */
  594. X        if (list->level == curlevel)
  595. X            break;
  596. X        /* these are the next topics down the list */
  597. X        if (list->level == curlevel+1)
  598. X        {
  599. X            c = list->string;
  600. X            while (isspace(*c)) c++;
  601. X            fprintf(f,"\\par{\\uldb %s}",c);
  602. X            fprintf(f,"{\\v loc%d}\n",list->line);
  603. X            }
  604. X        list = list->next;
  605. X        }
  606. X    }
  607. X
  608. X/* generate an RTF footnote with reference char c and text s */
  609. Xvoid footnote(c, s, b)
  610. Xchar c;
  611. Xchar *s;
  612. XFILE *b;
  613. X{
  614. X    fprintf(b,"%c{\\footnote %c %s}\n",c,c,s);
  615. X    }
  616. X
  617. Xvoid
  618. Xconvert(a,b)
  619. X    FILE *a,*b;
  620. X{
  621. X    static char line[MAX_LINE_LEN];
  622. X    
  623. X    /* generate rtf header */
  624. X    fprintf(b,"{\\rtf1\\ansi ");        /* vers 1 rtf, ansi char set */
  625. X    fprintf(b,"\\deff0");                /* default font font 0 */
  626. X    /* font table: font 0 proportional, font 1 fixed */
  627. X    fprintf(b,"{\\fonttbl{\\f0\\fswiss Helv;}{\\f1\\fmodern Courier;}{\\f2\\fmodern Pica;}}\n");
  628. X
  629. X    /* process each line of the file */
  630. X    while (fgets(line,MAX_LINE_LEN,a)) {
  631. X       process_line(line, b);
  632. X       }
  633. X
  634. X    /* close final page and generate trailer */
  635. X    fprintf(b,"}{\\plain \\page}\n");
  636. X    fprintf(b,"}\n");
  637. X}
  638. X
  639. Xvoid
  640. Xprocess_line(line, b)
  641. X    char *line;
  642. X    FILE *b;
  643. X{
  644. X    static int line_count = 0;
  645. X    static char line2[MAX_LINE_LEN];
  646. X    static int last_line;
  647. X    int i;
  648. X    int j;
  649. X    static int startpage = 1;
  650. X    char str[MAX_LINE_LEN];
  651. X    char topic[MAX_LINE_LEN];
  652. X    int k, l;
  653. X    static int tabl=0;
  654. X    static int para=0;
  655. X    static int llpara=0;
  656. X    static int inquote = FALSE;
  657. X    static int inref = FALSE;
  658. X
  659. X    line_count++;
  660. X
  661. X    i = 0;
  662. X    j = 0;
  663. X    while (line[i] != '\0')
  664. X    {
  665. X        switch(line[i])
  666. X        {
  667. X            case '\\':
  668. X            case '{':
  669. X            case '}':
  670. X                line2[j] = '\\';
  671. X                j++;
  672. X                line2[j] = line[i];
  673. X                break;
  674. X            case '\r':
  675. X            case '\n':
  676. X                break;
  677. X            case '`':    /* backquotes mean boldface or link */
  678. X                if (line[1]==' ')    /* tabular line */
  679. X                    line2[j] = line[i];
  680. X                else if ((!inref) && (!inquote))
  681. X                {
  682. X                    k=i+1;    /* index into current string */
  683. X                    l=0;    /* index into topic string */
  684. X                    while ((line[k] != '`') && (line[k] != '\0'))
  685. X                    {
  686. X                        topic[l] = line[k];
  687. X                        k++;
  688. X                        l++;
  689. X                        }
  690. X                    topic[l] = '\0';
  691. X                    k = lookup(topic);
  692. X                    if ((k > 0) && (k != last_line))
  693. X                    {
  694. X                        line2[j++] = '{';
  695. X                        line2[j++] = '\\';
  696. X                        line2[j++] = 'u';
  697. X                        line2[j++] = 'l';
  698. X                        line2[j++] = 'd';
  699. X                        line2[j++] = 'b';
  700. X                        line2[j] = ' ';
  701. X                        inref = k;
  702. X                        }
  703. X                    else
  704. X                    {
  705. X                        if (debug)
  706. X                            fprintf(stderr,"Can't make link for \042%s\042 on line %d\n",topic,line_count);
  707. X                        line2[j++] = '{';
  708. X                        line2[j++] = '\\';
  709. X                        line2[j++] = 'b';
  710. X                        line2[j] = ' ';
  711. X                        inquote = TRUE;
  712. X                        }
  713. X                    }
  714. X                else
  715. X                {
  716. X                    if (inquote && inref)
  717. X                        fprintf(stderr, "Warning: Reference Quote conflict line %d\n", line_count);
  718. X                    if (inquote)
  719. X                    {
  720. X                        line2[j] = '}';
  721. X                        inquote = FALSE;
  722. X                        }
  723. X                    if (inref)
  724. X                    {
  725. X                        /* must be inref */
  726. X                        sprintf(topic,"%d",inref);
  727. X                        line2[j++] = '}';
  728. X                        line2[j++] = '{';
  729. X                        line2[j++] = '\\';
  730. X                        line2[j++] = 'v';
  731. X                        line2[j++] = ' ';
  732. X                        line2[j++] = 'l';
  733. X                        line2[j++] = 'o';
  734. X                        line2[j++] = 'c';
  735. X                        k = 0;
  736. X                        while (topic[k] != '\0')
  737. X                        {
  738. X                            line2[j++] = topic[k];
  739. X                            k++;
  740. X                            }
  741. X                        line2[j] = '}';
  742. X                        inref = 0;
  743. X                        }
  744. X                }
  745. X                break;
  746. X            default:
  747. X                line2[j] = line[i];
  748. X            }
  749. X        i++;
  750. X        j++;
  751. X        line2[j] = '\0';
  752. X        }
  753. X
  754. X    i = 1;
  755. X
  756. X    switch(line[0]) {        /* control character */
  757. X       case '?': {            /* interactive help entry */
  758. X        if ((line2[1] != '\0') && (line2[1] != ' '))
  759. X            footnote('K',&(line2[1]),b);
  760. X          break;
  761. X       }
  762. X       case '@': {            /* start/end table */
  763. X          break;            /* ignore */
  764. X       }
  765. X       case '#': {            /* latex table entry */
  766. X          break;            /* ignore */
  767. X       }
  768. X       case '%': {            /* troff table entry */
  769. X          break;            /* ignore */
  770. X       }
  771. X       case '\n':            /* empty text line */
  772. X            fprintf(b,"\\par\n");
  773. X            llpara = para;
  774. X            para = 0;
  775. X            tabl = 0;
  776. X            break;
  777. X       case ' ': {            /* normal text line */
  778. X          if ((line2[1] == '\0') || (line2[1] == '\n'))
  779. X          {
  780. X                fprintf(b,"\\par\n"); 
  781. X                llpara = para;
  782. X                para = 0;
  783. X                tabl = 0;
  784. X                }
  785. X          if (line2[1] == ' ') 
  786. X          {
  787. X                if (!tabl)
  788. X                {
  789. X                    fprintf(b,"\\par\n"); 
  790. X                    }
  791. X                fprintf(b,"{\\pard \\plain \\f1\\fs20 ");
  792. X                  fprintf(b,"%s",&line2[1]); 
  793. X                fprintf(b,"}\\par\n");
  794. X                llpara = 0;
  795. X                para = 0;
  796. X                tabl = 1;
  797. X                }
  798. X          else
  799. X          {
  800. X                if (!para)
  801. X                {
  802. X                    if (llpara)
  803. X                        fprintf(b,"\\par\n"); /* blank line between paragraphs */
  804. X                    llpara = 0;
  805. X                    para = 1;        /* not in para so start one */
  806. X                    tabl = 0;
  807. X                    fprintf(b,"\\pard \\plain \\qj \\fs20 \\f0 ");
  808. X                    }
  809. X                  fprintf(b,"%s \n",&line2[1]); 
  810. X                }
  811. X          break;
  812. X       }
  813. X       default: {
  814. X          if (isdigit(line[0])) { /* start of section */
  815. X            if (!startpage)
  816. X            {
  817. X                refs(last_line,b);
  818. X                fprintf(b,"}{\\plain \\page}\n");
  819. X                }
  820. X            para = 0;                    /* not in a paragraph */
  821. X            tabl = 0;
  822. X            last_line = line_count;
  823. X            startpage = 0;
  824. X            fprintf(b,"{\n");
  825. X            sprintf(str,"browse:%05d", line_count);
  826. X            footnote('+',str,b);
  827. X            footnote('$',&(line2[1]),b); /* title */
  828. X            fprintf(b,"{\\b \\fs24 %s}\\plain\\par\\par\n",&(line2[1]));
  829. X            /* output unique ID */
  830. X            sprintf(str,"loc%d", line_count);
  831. X            footnote('#',str,b);
  832. X          } else
  833. X            fprintf(stderr, "unknown control code '%c' in column 1, line %d\n",
  834. X                line[0], line_count);
  835. X          break;
  836. X       }
  837. X    }
  838. X}
  839. X
  840. END_OF_FILE
  841.   if test 8811 -ne `wc -c <'gnuplot/docs/doc2rtf.c'`; then
  842.     echo shar: \"'gnuplot/docs/doc2rtf.c'\" unpacked with wrong size!
  843.   fi
  844.   # end of 'gnuplot/docs/doc2rtf.c'
  845. fi
  846. if test -f 'gnuplot/os2/gnupmdrv.itl' -a "${1}" != "-c" ; then 
  847.   echo shar: Will not clobber existing file \"'gnuplot/os2/gnupmdrv.itl'\"
  848. else
  849.   echo shar: Extracting \"'gnuplot/os2/gnupmdrv.itl'\" \(9564 characters\)
  850.   sed "s/^X//" >'gnuplot/os2/gnupmdrv.itl' <<'END_OF_FILE'
  851. X.imd dialogs.h
  852. X:userdoc.
  853. X#ifdef GENHELP  /**/
  854. X:docprof toc=1.
  855. X#else
  856. X:prolog.
  857. X:title.Gnushell
  858. X:docprof toc=12.
  859. X:eprolog.
  860. X#endif
  861. X
  862. X#ifdef GENHELP
  863. X:h1 res=5. Extended Help
  864. X:p.This program is a display interface for Gnuplot.
  865. X:p.When it starts up, it spawns a new session which contains 
  866. Xthe :hp2.GNUPLOT:ehp2. program. This new session provides the usual
  867. XGnuplot command line.
  868. X#endif
  869. X
  870. X#ifndef GENHELP
  871. X:h1. Options Menu
  872. X:p.This section describes the options available from the :hp2.Options:ehp2. menu.
  873. X#endif
  874. X
  875. X#ifdef GENHELP
  876. X:h1 res=&IDM_FILE.. Options Menu Help
  877. X#endif
  878. X#ifndef GENHELP
  879. X:h2. The options menu
  880. X#endif
  881. X:i1 id=mfile. Options menu
  882. X:i2 refid=mfile. The options menu
  883. X:p.The :hp2.Options:ehp2. menu enables you to change various options on the
  884. Xdisplayed plot, and to control printing of the plot via the OS/2 print
  885. Xsystem.
  886. X
  887. X#ifdef GENHELP
  888. X:h1 res=&IDM_ABOUT..  Help Menu Help
  889. X#endif
  890. X#ifndef GENHELP
  891. X:h2. About 
  892. X#endif
  893. X:i1 id=mabout. Help menu
  894. X:i2 refid=mabout. About 
  895. X:p.The :hp2.About:ehp2. menu item displays the About box, which
  896. Xjust identifies the program.
  897. X
  898. X#ifdef GENHELP
  899. X:h1 res=&IDM_FONTS.. Options Menu Help
  900. X#endif
  901. X#ifndef GENHELP
  902. X:h2. Font selection 
  903. X#endif
  904. X:i1 id=mfonts. Options menu
  905. X:i2 refid=mfonts. Fonts 
  906. X:p.The :hp2.Fonts:ehp2. menu item from the :hp2.Options:ehp2.
  907. Xpulldown menu enables you to change the font used in the displayed plot. 
  908. X:p.You can also 'drag and drop' a font from a Font Palette onto the Gnushell
  909. Xwindow.
  910. X
  911. X#ifdef GENHELP
  912. X:h1 res=&IDM_PRINT.. Options Menu Help
  913. X#endif
  914. X#ifndef GENHELP
  915. X:h2. Print
  916. X#endif
  917. X:i1 id=mprint. Options menu
  918. X:i2 refid=mprint. Print
  919. X:p.The :hp2.Print:ehp2. menu item from the :hp2.Options:ehp2.
  920. Xpulldown menu enables you to print the current window on the default
  921. Xprinter.
  922. X
  923. X#ifdef GENHELP
  924. X:h1 res=&IDM_PRINTSETUP.. Options Menu Help
  925. X#endif
  926. X#ifndef GENHELP
  927. X:h2. Printer selection
  928. X#endif
  929. X:i1 id=mprint. Options menu
  930. X:i2 refid=mprint. Printers
  931. X:p.The :hp2.Printers:ehp2. menu item from the :hp2.Options:ehp2.
  932. Xpulldown menu enables you to select the printer to which
  933. Xoutput is directed.
  934. X
  935. X#ifdef GENHELP
  936. X:h1 res=&IDM_LINES.. Options Menu Help
  937. X#endif
  938. X#ifndef GENHELP
  939. X:h2. Line options
  940. X#endif
  941. X:i1 id=mlines. Options menu
  942. X:i2 refid=mlines. Linetype option
  943. X:p.Selecting the :hp2.Lines:ehp2. menu item from the :hp2.Options:ehp2.
  944. Xenables you to choose various options for the lines used for the plots.
  945. X
  946. X#ifdef GENHELP
  947. X:h1 res=&IDM_LINES_THICK.. Options Menu Help
  948. X#endif
  949. X#ifndef GENHELP
  950. X:h2. Thick line option
  951. X#endif
  952. X:i1 id=mlinesth. Options menu
  953. X:i2 refid=mlinesth. Thick line option
  954. X:p.Selecting the :hp2.Thick:ehp2. option of the :hp2.Lines:ehp2.
  955. Xmenu item toggles the :hp2.thick line:ehp2. option on and off.
  956. XThe selection is active if the menu item is checked.
  957. X:p.The thick line option can give better output on high-resolution
  958. Xdevices like laser printers.
  959. X
  960. X#ifdef GENHELP
  961. X:h1 res=&IDM_LINES_SOLID.. Options Menu Help
  962. X#endif
  963. X#ifndef GENHELP
  964. X:h2. Solid Line option
  965. X#endif
  966. X:i1 id=mlinessol. Options menu
  967. X:i2 refid=mlinessol. Solid lines option
  968. X:p.Selecting the :hp2.Solid:ehp2. option of the :hp2.Lines:ehp2.
  969. Xmenu item toggles the :hp2.solid line:ehp2. option on and off.
  970. XThe selection is active if the menu item is checked.
  971. X:p.If the :hp2.Solid:ehp2. option is not active, curves on graphs will be
  972. Xplotted in various styles of broken lines. 
  973. X:p.This option can be combined with the :hp2.Colours.:ehp2. option. 
  974. XWhen a plot is printed on a printer that does not support colour, the 
  975. X:hp2.Solid:ehp2. option is disabled.
  976. X
  977. X#ifdef GENHELP
  978. X:h1 res=&IDM_COLOURS.. Options Menu Help
  979. X#endif
  980. X#ifndef GENHELP
  981. X:h2. Colours
  982. X#endif
  983. X:i1 id=mcolour. Options menu
  984. X:i2 refid=mcolour. Colours
  985. X:p.Selecting the :hp2.Colours:ehp2. menu item from the :hp2.Options:ehp2.
  986. Xpulldown menu causes lines used for graphs to be plotted in various
  987. Xcolours. This is the default option for plotting on the screen.
  988. XIt can be combined with the :hp2.Lines:ehp2. option. 
  989. X
  990. X#ifdef GENHELP
  991. X:h1 res=&IDM_PAUSEOPT.. Options Menu Help
  992. X#endif
  993. X#ifndef GENHELP
  994. X:h2. Pause options
  995. X#endif
  996. X:i1 id=mpauseopt. Options menu
  997. X:i2 refid=mpauseopt. Pause option
  998. X:p.Selecting the :hp2.Pause mode:ehp2. menu item from the :hp2.Options:ehp2.
  999. Xmenu enables you to choose how the Gnuplot 'pause' command is handled.
  1000. X
  1001. X#ifdef GENHELP
  1002. X:h1 res=&IDM_PAUSEDLG.. Options Menu Help
  1003. X#endif
  1004. X#ifndef GENHELP
  1005. X:h2. Pause options
  1006. X#endif
  1007. X:i1 id=mpausedlg. Options menu
  1008. X:i2 refid=mpausedlg. Pause with dialog box
  1009. X:p.Selecting the :hp2.Dialog box:ehp2. menu item from the :hp2.Pause options:ehp2.
  1010. Xmenu causes the Gnuplot 'pause' command to print a message in a dialog box,
  1011. Xand wait for you to end the dialog before continuing.
  1012. X
  1013. X#ifdef GENHELP
  1014. X:h1 res=&IDM_PAUSEBTN.. Options Menu Help
  1015. X#endif
  1016. X#ifndef GENHELP
  1017. X:h2. Pause options
  1018. X#endif
  1019. X:i1 id=mpausebtn. Options menu
  1020. X:i2 refid=mpausebtn. Pause with menu item
  1021. X:p.Selecting the :hp2.Menu bar:ehp2. menu item from the :hp2.Pause options:ehp2.
  1022. Xmenu causes the Gnuplot 'pause' command to enable the :hp2.Continue:ehp2.
  1023. Xmenu item. 
  1024. X:p.Plotting will be resumed when this item is selected.
  1025. X:p.Any text message is ignored.
  1026. X
  1027. X#ifdef GENHELP
  1028. X:h1 res=&IDM_PAUSEGNU.. Options Menu Help
  1029. X#endif
  1030. X#ifndef GENHELP
  1031. X:h2. Pause options
  1032. X#endif
  1033. X:i1 id=mpausegnu. Options menu
  1034. X:i2 refid=mpausegnu. Pause in Gnuplot
  1035. X:p.Selecting the :hp2.Gnuplot:ehp2. menu item from the :hp2.Pause options:ehp2.
  1036. Xmenu causes the Gnuplot 'pause' command to be handled by the Gnuplot
  1037. Xprogram.
  1038. X:p.In order to resume plotting, you will have to select the Gnuplot command line
  1039. Xwindow, and press the enter key.
  1040. X
  1041. X#ifdef GENHELP
  1042. X:h1 res=&IDM_SAVE.. Options Menu Help
  1043. X#endif
  1044. X#ifndef GENHELP
  1045. X:h2. Save option
  1046. X#endif
  1047. X:i1 id=msave. Options menu
  1048. X:i1 refid=msave. gnushell.ini
  1049. X:i2 refid=msave. Save settings
  1050. X:p.Selecting the :hp2.Save settings:ehp2. menu item from the :hp2.Options:ehp2.
  1051. Xpulldown menu causes the current line, colour and font options to be saved.
  1052. XThe positions and sizes of the windows are also saved.
  1053. X:p.The data is saved in the file :hp2.gnushell.ini:ehp2. file in the 
  1054. Xprogram&csq.s working directory. You can delete the file if you want to restore
  1055. Xall settings to their default values. (This file is created even if
  1056. Xno settings are saved.) 
  1057. X
  1058. X#ifdef GENHELP
  1059. X:h1 res=&IDM_COMMAND.. Gnuplot Menu Help
  1060. X#endif
  1061. X#ifndef GENHELP
  1062. X:h2. The Gnuplot menu
  1063. X#endif
  1064. X:i1 id=mgnu. Gnuplot menu
  1065. X:i1 refid=mgnu. Moving to GNUPLOT window
  1066. X:p.Selecting the :hp2.Gnuplot:ehp2. menu item causes the GNUPLOT
  1067. Xcommand window to be brought to the foreground. The same result can be
  1068. Xbe obtained by pressing the ESC key when the Gnushell window is active.
  1069. X
  1070. X#ifdef GENHELP
  1071. X:h1 res=&ID_QPRINT.. Printer setup dialog box help
  1072. X#else
  1073. X:h2. Printer setup
  1074. X#endif
  1075. X:i1 id=qprint. Printing
  1076. X:p.This dialog box enables you to setup the printer.
  1077. X:p.The printer that output will be sent to is indicated in the 
  1078. X:hp2.Current printer:ehp2. field. You can select a different
  1079. Xprinter by using the :hp2.Printers:ehp2. item of the :hp2.Options:ehp2.
  1080. Xmenu.
  1081. X:p.The setup can be selected by clicking on the :hp2.OK:ehp2. button.
  1082. X:p.The setup can be cancelled by selecting :hp2.Cancel:ehp2. .
  1083. X:p.If your printer driver supports printing to a file, the
  1084. X:hp2.Print to file named:ehp2. field will not be greyed out. In this case,
  1085. Xyou may enter a filename here for sending output to a file rather than to 
  1086. Xa printer. Some printer drivers also support this option from the
  1087. Xprinter setup dialog box accessible with the :hp2.Set printer:ehp2.
  1088. Xoption. You may choose either method. Some printer drivers (e.g. Postscript)
  1089. Xwill not overwrite a file if you use the second method.
  1090. X:p.The area of the page in which the plot will be displayed is
  1091. Xindicated. You can change this by selecting the :hp2.Set Page:ehp2. button.
  1092. XYou can then adjust the area with the mouse, and click on button 1
  1093. Xto select the new area. Another way of doing this is by typing
  1094. Xthe appropriate data into the entry windows which give the size of the
  1095. Xplot area, either in centimeters or relative to the page size. 
  1096. X:p.If you wish to adjust the default behaviour of the printer,
  1097. Xchoose the :hp2.Job properties:ehp2. option. This will bring up your
  1098. Xprinter setup dialog box. This is part of the printer driver, and the 
  1099. Xfeatures you can adjust will depend on your printer. You can generally
  1100. Xuse this to swich between landscape and portrait mode, for instance.
  1101. XNote that some drivers might not have any options.
  1102. X#ifdef GENHELP
  1103. X:h1 res=&IDD_QUERYPRINT.. Printer selection dialog box help
  1104. X#else
  1105. X:h2. Printer selection
  1106. X#endif
  1107. X:i1 id=qprinters. Printing
  1108. X:p.This dialog box enables you to select the printer on which
  1109. Xyour output will appear.
  1110. X:p.Choose a printer from the displayed list. The chosen printer
  1111. Xis highlighted.
  1112. X:p.The printer is selected by clicking on the :hp2.OK:ehp2. button.
  1113. X:p.The new selection is ignored by selecting :hp2.Cancel:ehp2. .
  1114. X
  1115. X#ifdef GENHELP
  1116. X:h1 res=&IDD_PAUSEBOX.. Pause dialog box help
  1117. X#else
  1118. X:h2. Puase
  1119. X#endif
  1120. X:i1 id=pausebox. Pause
  1121. X:p.This dialog box is (optionally) displayed when a 
  1122. X'pause -1 <text>' command is issued to Gnuplot.
  1123. XPlotting is paused until you:
  1124. X:p.Select :hp2.Continue:ehp2. to resume plotting.
  1125. X:p.Select :hp2.Cancel:ehp2. to cancel plotting and return to the Gnuplot
  1126. Xcommand line.
  1127. X
  1128. X#ifdef GENHELP
  1129. X:h1 res=&IDD_FONTS.. Fonts dialog box help
  1130. X#else
  1131. X:h2. Font selection
  1132. X#endif
  1133. X:i1 id=fonts. Font selection
  1134. X:p.This dialog box enables you to change the font used on the displayed plot.
  1135. X:p.The font is selected by clicking on the :hp2.OK:ehp2. button.
  1136. X:p.The new selection is ignored by selecting :hp2.Cancel:ehp2. .
  1137. X:p.Choose a font from the displayed list. The chosen font
  1138. Xis previwed in the :hp2.Example:ehp2. window.
  1139. X
  1140. X:euserdoc.
  1141. END_OF_FILE
  1142.   if test 9564 -ne `wc -c <'gnuplot/os2/gnupmdrv.itl'`; then
  1143.     echo shar: \"'gnuplot/os2/gnupmdrv.itl'\" unpacked with wrong size!
  1144.   fi
  1145.   # end of 'gnuplot/os2/gnupmdrv.itl'
  1146. fi
  1147. if test -f 'gnuplot/term/amiga.trm' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'gnuplot/term/amiga.trm'\"
  1149. else
  1150.   echo shar: Extracting \"'gnuplot/term/amiga.trm'\" \(9608 characters\)
  1151.   sed "s/^X//" >'gnuplot/term/amiga.trm' <<'END_OF_FILE'
  1152. X/*
  1153. X * $Id: amiga.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1154. X *
  1155. X */
  1156. X
  1157. X/* GNUPLOT - amiga.trm */
  1158. X/*
  1159. X * Copyright (C) 1991, 1992
  1160. X *
  1161. X * Permission to use, copy, and distribute this software and its
  1162. X * documentation for any purpose with or without fee is hereby granted, 
  1163. X * provided that the above copyright notice appear in all copies and 
  1164. X * that both that copyright notice and this permission notice appear 
  1165. X * in supporting documentation.
  1166. X *
  1167. X * Permission to modify the software is granted, but not the right to
  1168. X * distribute the modified code.  Modifications are to be distributed 
  1169. X * as patches to released version.
  1170. X *  
  1171. X * This software  is provided "as is" without express or implied warranty.
  1172. X * 
  1173. X * This file is included by ../term.c.
  1174. X *
  1175. X * This terminal driver supports:
  1176. X *   Amiga Custom Screen
  1177. X *
  1178. X * AUTHORS
  1179. X *   Carsten Steger
  1180. X * 
  1181. X *   Pat R. Empleo      Slightly modified for Aztec C v5.2a (beta); sort of
  1182. X *   08/27/91           supports overscan; for large WB 2.0 virtual screens,
  1183. X *                      we limit the plot size so we don't have to scroll
  1184. X *                      around (not fun).
  1185. X *
  1186. X *   Carsten Steger     Modified to support Kickstart 2.0.
  1187. X *   09/11/91           Opens a text overscan screen when used with WB 2.0.
  1188. X *                      Discerns between NTSC and PAL Amigas when used with
  1189. X *                      WB 1.3 and lower.
  1190. X *
  1191. X *   Pat R. Empleo      Defined some 2.0 stuff in order to get Aztec C to
  1192. X *   09/20/91           work with Carsten's new code (see above).  When
  1193. X *                      KS/WB 2.0 support gets implemented in Aztec C, this
  1194. X *                      kludge will get deleted! 
  1195. X *                      (Aztec C release 5.2 beta)
  1196. X *
  1197. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1198. X * 
  1199. X */
  1200. X
  1201. X#ifdef AMIGA_AC_5
  1202. X#include <intuition/intuitionbase.h>
  1203. X#include <intuition/screens.h>
  1204. X#include <graphics/text.h>
  1205. X#include <graphics/gfxbase.h>
  1206. X#else
  1207. X/* You will have to use the Kickstart 2.0 header files for this to compile */
  1208. X#include <exec/types.h>
  1209. X#include <intuition/intuitionbase.h>
  1210. X#include <graphics/gfxbase.h>
  1211. X#include <proto/intuition.h>
  1212. X#include <proto/graphics.h>
  1213. X#include <proto/exec.h>
  1214. X#include <proto/diskfont.h>
  1215. X#endif
  1216. X
  1217. Xextern char *getenv();
  1218. X#ifndef AMIGA_AC_5
  1219. Xextern char *strchr();
  1220. X#endif
  1221. X
  1222. X#define AMIGA_XMAX 640
  1223. X#define AMIGA_YMAX 512
  1224. X
  1225. X#define AMIGA_VCHAR (12)
  1226. X#define AMIGA_HCHAR (8)
  1227. X#define AMIGA_VTIC (AMIGA_YMAX/80)
  1228. X#define AMIGA_HTIC (AMIGA_XMAX/80)
  1229. X/* The origin is in the upper left hand corner, so we have to translate */
  1230. X/* and flip the coordinates: */
  1231. X#define AMIGA_VTF(y) (AMIGA_ymax-1-(y))
  1232. X
  1233. X
  1234. Xstruct IntuitionBase *IntuitionBase;
  1235. Xstruct GfxBase *GfxBase;
  1236. Xstruct Library *DiskfontBase;
  1237. Xstatic struct TextAttr AMIGA_Font = {
  1238. X  "topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPF_ROMFONT
  1239. X};
  1240. Xstatic struct TextFont *AMIGA_TextFont;
  1241. Xstatic struct NewScreen AMIGA_NewScreen = {
  1242. X  0,0,AMIGA_XMAX,AMIGA_YMAX,4,15,0,HIRES|LACE,
  1243. X  CUSTOMSCREEN|SCREENBEHIND|SCREENQUIET,NULL,NULL,NULL,NULL
  1244. X};
  1245. Xstatic struct Screen *AMIGA_Screen;
  1246. Xstatic UWORD AMIGA_Colors [] = {
  1247. X  0x000,0xfff,0xbbb,0x0f0,0xf00,0x00f,0x3ca,0xf0f,
  1248. X  0x94d,0x0ff,0x82f,0xff0,0x0af,0xc5e,0xfa2,0xf44
  1249. X};
  1250. Xstatic int AMIGA_slinetype;
  1251. Xstatic enum JUSTIFY AMIGA_justify = LEFT;
  1252. Xstatic unsigned int AMIGA_ymax,AMIGA_xmax; 
  1253. Xstatic WORD AMIGA_cwd,AMIGA_cht,AMIGA_bsl,AMIGA_vadj;
  1254. Xstatic struct TagItem AMIGA_ScrTagList[] = {
  1255. X  {SA_Overscan,OSCAN_TEXT},{TAG_DONE,0}
  1256. X};
  1257. X
  1258. X
  1259. XAMIGA_reset()
  1260. X{
  1261. X  if (AMIGA_TextFont != NULL) CloseFont(AMIGA_TextFont);
  1262. X  if (DiskfontBase != NULL) CloseLibrary(DiskfontBase);
  1263. X  if (AMIGA_Screen != NULL) CloseScreen(AMIGA_Screen);
  1264. X  if (IntuitionBase != NULL) CloseLibrary(IntuitionBase);
  1265. X  if (GfxBase != NULL) CloseLibrary(GfxBase);
  1266. X  AMIGA_TextFont = NULL;
  1267. X  DiskfontBase = NULL;
  1268. X  AMIGA_Screen = NULL;
  1269. X  IntuitionBase = NULL;
  1270. X  GfxBase = NULL;
  1271. X}
  1272. X
  1273. X
  1274. XAMIGA_init()
  1275. X{
  1276. X  static char fontname[80],*gnufont,*search;
  1277. X  static int fsize;
  1278. X  static char *test_str =
  1279. X    " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
  1280. X  static WORD test_len,test_pxl;
  1281. X
  1282. X
  1283. X#ifdef AMIGA_SC_6_1
  1284. X  /* Install exit trap in case of abnormal termination (see below). */
  1285. X  int AMIGA_exit();
  1286. X  if (!onexit(&AMIGA_exit)) {
  1287. X    fprintf(stderr,"Couldn't set exit trap\n");
  1288. X    exit(20);
  1289. X  }
  1290. X#endif
  1291. X  GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",0);
  1292. X  if (GfxBase == NULL) {
  1293. X    fprintf(stderr,"No Graphics-Library\n");
  1294. X    AMIGA_reset();
  1295. X    exit(20);
  1296. X  }
  1297. X  IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0);
  1298. X  if (IntuitionBase == NULL) {
  1299. X    fprintf(stderr,"No Intuition-Library\n");
  1300. X    AMIGA_reset();
  1301. X    exit(20);
  1302. X  }
  1303. X  if (IntuitionBase->LibNode.lib_Version <= 34) {
  1304. X    /* We compute the vertical resolution for those poor NTSC-souls   :-)   */
  1305. X    if (GfxBase->DisplayFlags & PAL) AMIGA_ymax = 512;
  1306. X    else AMIGA_ymax = 400;
  1307. X    AMIGA_xmax = 640;
  1308. X    AMIGA_NewScreen.Width = AMIGA_xmax;
  1309. X    AMIGA_NewScreen.Height = AMIGA_ymax;
  1310. X    AMIGA_Screen = OpenScreen(&AMIGA_NewScreen);
  1311. X    if (AMIGA_Screen == NULL) {
  1312. X      fprintf(stderr,"No Screen\n");
  1313. X      AMIGA_reset();
  1314. X      exit(20);
  1315. X    }
  1316. X  } else {
  1317. X    /* Kickstart 2.0 support */
  1318. X    AMIGA_NewScreen.Width = STDSCREENWIDTH;
  1319. X    AMIGA_NewScreen.Height = STDSCREENHEIGHT;
  1320. X    AMIGA_Screen = OpenScreenTagList(&AMIGA_NewScreen,AMIGA_ScrTagList);
  1321. X    if (AMIGA_Screen == NULL) {
  1322. X      fprintf(stderr,"No Screen\n");
  1323. X      AMIGA_reset();
  1324. X      exit(20);
  1325. X    }
  1326. X    AMIGA_xmax = AMIGA_Screen->Width;
  1327. X    AMIGA_ymax = AMIGA_Screen->Height;
  1328. X  }
  1329. X  term_tbl[term].xmax = AMIGA_xmax;
  1330. X  term_tbl[term].ymax = AMIGA_ymax;
  1331. X  gnufont = getenv("GNUFONT");
  1332. X  if (gnufont != NULL ) {
  1333. X    search = strchr(gnufont,'/');
  1334. X    if (search != NULL) {
  1335. X      *search++ = '\0';
  1336. X      strncpy(fontname,gnufont,74);
  1337. X      strcat(fontname,".font");
  1338. X      sscanf(search,"%d",&fsize);
  1339. X      /* Avoid opening "diskfont.library" if a built-in font is desired */
  1340. X      if ((strcmp("topaz.font",fontname) == 0) &&
  1341. X        ((fsize == TOPAZ_EIGHTY) || (fsize == TOPAZ_SIXTY))) {
  1342. X        AMIGA_Font.ta_Name = fontname;
  1343. X        AMIGA_Font.ta_YSize = fsize;
  1344. X        AMIGA_Font.ta_Style = FS_NORMAL;
  1345. X        AMIGA_Font.ta_Flags = FPF_ROMFONT;
  1346. X        AMIGA_TextFont = OpenFont(&AMIGA_Font);
  1347. X        if (AMIGA_TextFont != NULL) 
  1348. X          SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
  1349. X      } else {
  1350. X        DiskfontBase = OpenLibrary("diskfont.library",0);
  1351. X        if (DiskfontBase != NULL) {
  1352. X          AMIGA_Font.ta_Name = fontname;
  1353. X          AMIGA_Font.ta_YSize = fsize;
  1354. X          AMIGA_Font.ta_Style = FS_NORMAL;
  1355. X          AMIGA_Font.ta_Flags = FPF_ROMFONT|FPF_DISKFONT;
  1356. X          AMIGA_TextFont = OpenDiskFont(&AMIGA_Font);
  1357. X          if (AMIGA_TextFont != NULL)
  1358. X            SetFont(&AMIGA_Screen->RastPort,AMIGA_TextFont);
  1359. X        }
  1360. X      }
  1361. X    }
  1362. X  }
  1363. X  /* Width of characters: This works better for proportional fonts than */
  1364. X  /* AMIGA_Screen->RastPort.TxWidth + AMIGA_Screen->RastPort.TxSpacing */
  1365. X  test_len = strlen(test_str);
  1366. X  test_pxl = TextLength(&AMIGA_Screen->RastPort,test_str,test_len);
  1367. X  AMIGA_cwd = test_pxl / test_len;
  1368. X  AMIGA_cht = AMIGA_Screen->RastPort.TxHeight; /* Height of characters */
  1369. X  AMIGA_bsl = AMIGA_Screen->RastPort.TxBaseline; /* Reference line */
  1370. X  /* Amount by which characters have to be shifted upwards to be */
  1371. X  /* vertically justified: */
  1372. X  AMIGA_vadj = AMIGA_bsl / 2;
  1373. X  term_tbl[term].v_char = AMIGA_cht + 4; /* So lines won't be too close */
  1374. X  term_tbl[term].h_char = AMIGA_cwd;
  1375. X  LoadRGB4(&AMIGA_Screen->ViewPort,AMIGA_Colors,16);
  1376. X  RemakeDisplay();
  1377. X  AMIGA_slinetype = 1;
  1378. X  SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
  1379. X  SetDrMd(&AMIGA_Screen->RastPort,JAM1);
  1380. X}
  1381. X
  1382. X
  1383. XAMIGA_text()
  1384. X{
  1385. X  char c;
  1386. X
  1387. X  c = getc(stdin);
  1388. X  ungetc(c,stdin);
  1389. X  ScreenToBack(AMIGA_Screen);
  1390. X}
  1391. X
  1392. X
  1393. XAMIGA_graphics()
  1394. X{
  1395. X  SetRast(&AMIGA_Screen->RastPort,0);
  1396. X  SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
  1397. X  ScreenToFront(AMIGA_Screen);
  1398. X}
  1399. X
  1400. X
  1401. XAMIGA_move(x,y)
  1402. Xunsigned int x,y;
  1403. X{
  1404. X  if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
  1405. X  Move(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
  1406. X}
  1407. X
  1408. X
  1409. XAMIGA_vector(x,y)
  1410. Xunsigned int x,y;
  1411. X{
  1412. X  if ((x>=AMIGA_xmax) || (y>=AMIGA_ymax)) return;
  1413. X  Draw(&AMIGA_Screen->RastPort,x,AMIGA_VTF(y));
  1414. X}
  1415. X
  1416. X
  1417. XAMIGA_linetype(linetype)
  1418. Xint linetype;
  1419. X{
  1420. X  if (linetype >= 13) linetype %= 13;
  1421. X  if (linetype < -2) linetype = -2;
  1422. X  AMIGA_slinetype = linetype+3;
  1423. X  SetAPen(&AMIGA_Screen->RastPort,AMIGA_slinetype);
  1424. X}
  1425. X
  1426. X
  1427. XAMIGA_put_text(x,y,str)
  1428. Xunsigned int x,y;
  1429. Xchar *str;
  1430. X{
  1431. X  LONG len,tx_len;
  1432. X  WORD xmin,xmax,ymin,ymax;
  1433. X
  1434. X  len = strlen(str);
  1435. X  tx_len = TextLength(&AMIGA_Screen->RastPort,str,len);
  1436. X  switch (AMIGA_justify) {
  1437. X    case LEFT:
  1438. X      xmin = x;
  1439. X      xmax = x + tx_len;
  1440. X      break;
  1441. X    case CENTRE:
  1442. X      xmin = x - tx_len / 2;
  1443. X      xmax = x + tx_len - tx_len / 2; /* aviod roundoff errors ! */
  1444. X      break;
  1445. X    case RIGHT:
  1446. X      xmin = x - tx_len;
  1447. X      xmax = x;
  1448. X      break;
  1449. X  }
  1450. X  ymin = AMIGA_VTF(y) - AMIGA_vadj;
  1451. X  ymax = ymin + AMIGA_cht;
  1452. X  /* Check if character-string lies completely within the screen: */
  1453. X  if ((xmax >= AMIGA_xmax) || (ymin < 0) || (ymax >= AMIGA_ymax)) return;
  1454. X  Move(&AMIGA_Screen->RastPort,xmin,ymin+AMIGA_bsl);
  1455. X  Text(&AMIGA_Screen->RastPort,str,len);
  1456. X}
  1457. X
  1458. X
  1459. Xint AMIGA_justify_text(mode)
  1460. Xenum JUSTIFY mode;
  1461. X{
  1462. X  AMIGA_justify = mode;
  1463. X  return TRUE;
  1464. X}
  1465. X
  1466. X
  1467. X/* This function is mainly included if the program terminates abnormally */
  1468. X/* and the screen and libraries are still open. It closes down all opened */
  1469. X/* libraries and screens. This happens e.g. when loading "bivariat.demo" */
  1470. X/* and the stack is smaller than 120000 bytes. */
  1471. X#ifdef AMIGA_SC_6_1
  1472. Xint AMIGA_exit(rc)
  1473. Xint rc;
  1474. X{
  1475. X  AMIGA_reset();
  1476. X  return rc;
  1477. X}
  1478. X#endif
  1479. END_OF_FILE
  1480.   if test 9608 -ne `wc -c <'gnuplot/term/amiga.trm'`; then
  1481.     echo shar: \"'gnuplot/term/amiga.trm'\" unpacked with wrong size!
  1482.   fi
  1483.   # end of 'gnuplot/term/amiga.trm'
  1484. fi
  1485. if test -f 'gnuplot/term/dxf.trm' -a "${1}" != "-c" ; then 
  1486.   echo shar: Will not clobber existing file \"'gnuplot/term/dxf.trm'\"
  1487. else
  1488.   echo shar: Extracting \"'gnuplot/term/dxf.trm'\" \(9202 characters\)
  1489.   sed "s/^X//" >'gnuplot/term/dxf.trm' <<'END_OF_FILE'
  1490. X/*
  1491. X * $Id: dxf.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1492. X *
  1493. X */
  1494. X
  1495. X/* GNUPLOT - dxf.trm */
  1496. X/*
  1497. X * Copyright (C) 1991, 1992
  1498. X *
  1499. X * Permission to use, copy, and distribute this software and its
  1500. X * documentation for any purpose with or without fee is hereby granted,
  1501. X * provided that the above copyright notice appear in all copies and
  1502. X * that both that copyright notice and this permission notice appear
  1503. X * in supporting documentation.
  1504. X *
  1505. X * Permission to modify the software is granted, but not the right to
  1506. X * distribute the modified code.  Modifications are to be distributed
  1507. X * as patches to released version.
  1508. X *
  1509. X * This software  is provided "as is" without express or implied warranty.
  1510. X *
  1511. X * This file is included by ../term.c.
  1512. X *
  1513. X * This terminal driver supports:
  1514. X *   AutoCad (Release 10.x) dxf file format (import with AutoCad dxfin command)
  1515. X *
  1516. X *
  1517. X * AUTHOR
  1518. X *   Florian Hiss  (fhis1231@w204zrz.zrz.tu-berlin.de)
  1519. X *
  1520. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1521. X*/
  1522. X
  1523. X#define DXF_UNIT 60.0
  1524. X#define LINEWIDTH 0.0351  /* default line width is 1 pt */
  1525. X
  1526. X/* 120 (autocad units) wide by 80 (autocad units) high (default)
  1527. X   use the GNUPLOT 'set size' command to change the defaults */
  1528. X#define DXF_XMAX (120.0 * DXF_UNIT)
  1529. X#define DXF_YMAX (80.0 * DXF_UNIT)
  1530. X#define DXF_HTIC (0.01 * DXF_XMAX)  /* 1.0 percent */
  1531. X#define DXF_VTIC (0.01 * DXF_YMAX)  /* 1.0 percent */
  1532. X#define DXF_HCHAR (0.014 * DXF_XMAX) /* 1.4 percent */
  1533. X#define DXF_VCHAR (0.026 * DXF_YMAX) /* 2.6 percent */
  1534. X#define DXF_TEXTHEIGHT (0.7 * DXF_VCHAR) /* actual text height */
  1535. X#define DXF_TEXTWIDTH (0.7 * DXF_HCHAR) /* actual text width,
  1536. X only a guess, we don't know the width of a character of given height
  1537. X of the AutoCad STANDARD text font, so change it if you like */
  1538. X#define DXF_LINE_TYPES 7 /* number of line types we support. see below  */
  1539. X#define MAX_LAYER 7  /* number of layers used for the drawing. see below */
  1540. X#define LT_SCALE 1  /* line type scaling */
  1541. X
  1542. Xstatic unsigned int DXF_posx;
  1543. Xstatic unsigned int DXF_posy;
  1544. Xstatic unsigned int dxf_linetype; /* linetype is mapped to a layer. see below. */
  1545. Xenum JUSTIFY dxf_justify = LEFT;
  1546. Xstatic float dxf_angle = 0.0; /* either 0 (horizontal) or 90.0 (vertical) */
  1547. X
  1548. X/* text style used in the entire drawing */
  1549. Xstatic char *text_style = "STANDARD";
  1550. X/* text always resides on layer 0 */
  1551. X#define TEXT_LAYER 0
  1552. X/* each linetype resides on its own layer. each layer has its own color.
  1553. X   this avoids difficulties that AutoCad has with proper scaling of
  1554. X   the linetypes.
  1555. X   change the colors according to your needs */
  1556. Xstatic char *layer_name[] = {"0","1","2","3","4","5","6"};
  1557. X/* the colours are white, red, yellow, green, cyan, blue, magenta.
  1558. X   change them according to your needs.
  1559. X   when using a black and white plotting device the colours map to different
  1560. X   line thicknesses. see description of AutoCad print / plot command */
  1561. Xstatic char *layer_colour[] = {"7","1","2","3","4","5","6"};
  1562. X/* support line types AutoCad has to offer by default. */
  1563. Xstatic char *layer_lines[] = {"CONTINUOUS","DASHED","HIDDEN","CENTER","PHANTOM",
  1564. X                "DOT","DASHDOT"};
  1565. X
  1566. Xstatic TBOOLEAN vector_was_last = FALSE;
  1567. X
  1568. XDXF_init()
  1569. X{
  1570. X    DXF_posx = DXF_posy = 0;
  1571. X    dxf_linetype = 0;
  1572. X    dxf_angle = 0.0;
  1573. X    vector_was_last = FALSE;
  1574. X}
  1575. X
  1576. XDXF_graphics()
  1577. X{
  1578. X    register struct termentry *t = &term_tbl[term];
  1579. X    int i;
  1580. X    static char GPFAR dxfi1[] = "\
  1581. X999\n\
  1582. X%% GNUPLOT: dxf file for AutoCad\n\
  1583. X  0\nSECTION\n  2\nHEADER\n\
  1584. X  9\n$EXTMIN\n\
  1585. X 10\n0.000\n 20\n0.000\n\
  1586. X  9\n$EXTMAX\n\
  1587. X 10\n%-6.3f\n 20\n%-6.3f\n\
  1588. X  9\n$LIMMIN\n\
  1589. X 10\n0.000\n 20\n0.000\n\
  1590. X  9\n$LIMMAX\n\
  1591. X 10\n%-6.3f\n 20\n%-6.3f\n\
  1592. X  9\n$TEXTSTYLE\n  7\n%s\n\
  1593. X  9\n$TEXTSIZE\n 40\n%-6.3f\n\
  1594. X  9\n$PLINEWID\n 40\n%-6.4f\n\
  1595. X  9\n$LTSCALE\n  40\n%-6.3f\n\
  1596. X  9\n$COORDS\n 70\n  1\n\
  1597. X  9\n$CELTYPE\n 6\nBYLAYER\n\
  1598. X  9\n$CLAYER\n  8\n0\n\
  1599. X  9\n$CECOLOR\n 62\n   %s\n\
  1600. X  9\n$MENU\n  1\nacad\n\
  1601. X  0\nENDSEC\n\
  1602. X  0\nSECTION\n  2\nTABLES\n";
  1603. Xstatic char GPFAR dxfi2[] = "\
  1604. X0\nTABLE\n  2\nLTYPE\n 70\n    %d\n\
  1605. X0\nLTYPE\n  2\nCONTINUOUS\n 70\n    64\n\
  1606. X  3\nSolid line\n 72\n    65\n 73\n      0\n 40\n0.0\n\
  1607. X  0\nLTYPE\n  2\nDASHED\n 70\n    64\n\
  1608. X  3\n__ __ __ __ __ __ __ __ __ __ __ __ __ __ __\n\
  1609. X 72\n    65\n 73\n     2\n 40\n0.75\n 49\n0.5\n 49\n-0.25\n\
  1610. X  0\nLTYPE\n  2\nHIDDEN\n 70\n    64\n\
  1611. X  3\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\
  1612. X 72\n    65\n 73\n     2\n 40\n0.375\n 49\n0.25\n 49\n-0.125\n\
  1613. X  0\nLTYPE\n  2\nCENTER\n 70\n    64\n\
  1614. X  3\n____ _ ____ _ ____ _ ____ _ ____ _ ____ _ ____\n\
  1615. X 72\n    65\n 73\n     4\n 40\n2.0\n 49\n1.25\n 49\n-0.25\n\
  1616. X 49\n0.25\n 49\n-0.25\n\
  1617. X  0\nLTYPE\n  2\nPHANTOM\n 70\n    64\n\
  1618. X  3\n_____ _ _ _____ _ _ _____ _ _ _____ _ _ ____\n\
  1619. X 72\n    65\n 73\n     6\n 40\n2.5\n 49\n1.25\n\
  1620. X 49\n-0.25\n 49\n0.25\n 49\n-0.25\n 49\n0.25\n 49\n-0.25\n\
  1621. X  0\nLTYPE\n  2\nDOT\n 70\n    64\n\
  1622. X  3\n...............................................\n\
  1623. X 72\n    65\n 73\n     2\n 40\n0.25\n 49\n0.0\n 49\n-0.25\n\
  1624. X  0\nLTYPE\n  2\nDASHDOT\n 70\n    64\n\
  1625. X  3\n__ . __ . __ . __ . __ . __ . __ . __ . __ . __\n\
  1626. X 72\n    65\n 73\n     4\n 40\n1.0\n 49\n0.5\n 49\n-0.25\n\
  1627. X 49\n0.0\n 49\n-0.25\n\
  1628. X  0\nENDTAB\n";
  1629. X
  1630. X    fprintf(outfile, dxfi1,
  1631. X        t->xmax/DXF_UNIT,t->ymax/DXF_UNIT,
  1632. X        t->xmax/DXF_UNIT,t->ymax/DXF_UNIT,
  1633. X        text_style,
  1634. X        DXF_TEXTHEIGHT/DXF_UNIT,
  1635. X        LINEWIDTH,
  1636. X        LT_SCALE,
  1637. X        layer_colour[0]);
  1638. X    /* the linetype table */
  1639. X    fprintf(outfile, dxfi2, DXF_LINE_TYPES);
  1640. X    /* the layer table */
  1641. X    fprintf(outfile,"  0\nTABLE\n  2\nLAYER\n 70\n   %-d\n",MAX_LAYER);
  1642. X    for (i = 1; i <= MAX_LAYER; i++)
  1643. X        fprintf(outfile,"  0\nLAYER\n  2\n%s\n 70\n   64\n62\n   %s\n  6\n%s\n",
  1644. X            layer_name[i-1],layer_colour[i-1],layer_lines[i-1]);
  1645. X    fprintf(outfile,"  0\nENDTAB\n0\nENDSEC\n");
  1646. X    /* no blocks for insertion */
  1647. X    fprintf(outfile,"  0\nSECTION\n  2\nBLOCKS\n  0\nENDSEC\n");
  1648. X    /* start the entity section */
  1649. X    fprintf(outfile,"  0\nSECTION\n");
  1650. X    fprintf(outfile,"  2\nENTITIES\n");
  1651. X}
  1652. X
  1653. XDXF_text()
  1654. X{
  1655. X    if (vector_was_last) fprintf(outfile,"  0\nSEQEND\n");
  1656. X    fprintf(outfile,"  0\nENDSEC\n  0\nEOF\n");
  1657. X}
  1658. X
  1659. XDXF_linetype(linetype)
  1660. X    int linetype;
  1661. X{
  1662. X    linetype = abs(linetype);
  1663. X    linetype = linetype%DXF_LINE_TYPES;
  1664. X    dxf_linetype = linetype;
  1665. X}
  1666. X
  1667. XDXF_move(x, y)
  1668. X    unsigned int x, y;
  1669. X{
  1670. X    DXF_posx = x;
  1671. X    DXF_posy = y;
  1672. X    if (vector_was_last) fprintf(outfile,"  0\nSEQEND\n");
  1673. X    vector_was_last = FALSE;
  1674. X    fprintf(outfile,"  0\nPOLYLINE\n  8\n%s\n 66\n   1\n",layer_name[dxf_linetype]);
  1675. X    fprintf(outfile,"  6\n%s\n",layer_lines[dxf_linetype]);
  1676. X    fprintf(outfile,"  0\nVERTEX\n  8\n%s\n",layer_name[dxf_linetype]);
  1677. X    fprintf(outfile,"  6\n%s\n",layer_lines[dxf_linetype]);
  1678. X    fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",DXF_posx/DXF_UNIT,DXF_posy/DXF_UNIT);
  1679. X}
  1680. X
  1681. XDXF_vector(ux, uy)
  1682. X    unsigned int ux, uy;
  1683. X{
  1684. X    DXF_posx = ux;
  1685. X    DXF_posy = uy;
  1686. X    vector_was_last = TRUE;
  1687. X    fprintf(outfile,"  0\nVERTEX\n  8\n%s\n",layer_name[dxf_linetype]);
  1688. X    fprintf(outfile,"  6\n%s\n",layer_lines[dxf_linetype]);
  1689. X    fprintf(outfile,"  10\n%-6.3f\n  20\n%-6.3f\n  30\n0.000\n",
  1690. X                    DXF_posx/DXF_UNIT,DXF_posy/DXF_UNIT);
  1691. X}
  1692. X
  1693. XDXF_put_text(x, y, str)
  1694. X    int x, y;
  1695. X    char str[];
  1696. X{
  1697. X    int stl;
  1698. X    float xleftpos, yleftpos, xrightpos,yrightpos;
  1699. X    /* ignore empty strings */
  1700. X    if (str[0] == '\0') return;
  1701. X
  1702. X    stl = 0; while (str[stl] != '\0') ++stl; /* get string length */
  1703. X
  1704. X    if (vector_was_last) fprintf(outfile,"  0\nSEQEND\n");
  1705. X    vector_was_last = FALSE;
  1706. X    fprintf(outfile,"  0\nTEXT\n  8\n%s\n",layer_name[TEXT_LAYER]);
  1707. X    if (dxf_angle != 90.0)
  1708. X    {
  1709. X       switch (dxf_justify)
  1710. X       {
  1711. X           case LEFT  : xleftpos = (float) x;
  1712. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  1713. X                 xrightpos = (float)(x+stl*DXF_TEXTWIDTH);
  1714. X                 yrightpos = yleftpos; break;
  1715. X           case RIGHT : xleftpos = (float)(x-stl*DXF_TEXTWIDTH);
  1716. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  1717. X                 xrightpos = (float) x;
  1718. X                 yrightpos = yleftpos; break;
  1719. X        case CENTRE: xleftpos = (float)(x-stl*DXF_TEXTWIDTH/2.0);
  1720. X                 yleftpos = (float)(y-DXF_VCHAR/4.0);
  1721. X                 xrightpos = (float) x;  /* center point */
  1722. X                 yrightpos = yleftpos;
  1723. X                 break;
  1724. X        }
  1725. X    }
  1726. X    else
  1727. X    {
  1728. X        switch (dxf_justify)
  1729. X        {
  1730. X           case LEFT  : xleftpos = (float)(x+DXF_VCHAR/4.0);
  1731. X                 yleftpos = (float) y;
  1732. X                 xrightpos = xleftpos;
  1733. X                 yrightpos = (float)(y+stl*DXF_TEXTWIDTH); break;
  1734. X           case RIGHT : xleftpos = (float)(x+DXF_VCHAR/4.0);
  1735. X                 yleftpos = (float)(y-stl*DXF_HCHAR);
  1736. X                 xrightpos = xleftpos;
  1737. X                 yrightpos = (float) y; break;
  1738. X        case CENTRE: xleftpos = (float)(x+DXF_VCHAR/4.0);
  1739. X                 yleftpos = (float)(y-stl*DXF_TEXTWIDTH/2.0);
  1740. X                 xrightpos = xleftpos;
  1741. X                 yrightpos = (float) y;  /* center point */
  1742. X                 break;
  1743. X        }
  1744. X    }
  1745. X    fprintf(outfile," 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",
  1746. X                xleftpos/DXF_UNIT,yleftpos/DXF_UNIT);
  1747. X    fprintf(outfile," 40\n%-6.3f\n  1\n%s\n 50\n%-6.3f\n",
  1748. X            DXF_TEXTHEIGHT/DXF_UNIT,str,dxf_angle);
  1749. X    fprintf(outfile,"  7\n%s\n",text_style);
  1750. X    if (dxf_justify != LEFT)
  1751. X    {
  1752. X        fprintf(outfile," 72\n%d\n",dxf_justify);
  1753. X        fprintf(outfile," 11\n%-6.3f\n 21\n%-6.3f\n 31\n0.000\n",
  1754. X                xrightpos/DXF_UNIT,yrightpos/DXF_UNIT);
  1755. X    }
  1756. X}
  1757. X
  1758. XDXF_text_angle(angle)
  1759. X    int angle;
  1760. X{
  1761. X    dxf_angle = 0.0;
  1762. X    if (angle == 1) dxf_angle = 90.0;
  1763. X    return(TRUE);
  1764. X}
  1765. X
  1766. XDXF_justify_text(mode)
  1767. X    enum JUSTIFY mode;
  1768. X{
  1769. X    dxf_justify = mode;
  1770. X    return(TRUE);
  1771. X}
  1772. X
  1773. XDXF_reset()
  1774. X{
  1775. X    DXF_posx = DXF_posy = 0;
  1776. X}
  1777. X
  1778. X
  1779. END_OF_FILE
  1780.   if test 9202 -ne `wc -c <'gnuplot/term/dxf.trm'`; then
  1781.     echo shar: \"'gnuplot/term/dxf.trm'\" unpacked with wrong size!
  1782.   fi
  1783.   # end of 'gnuplot/term/dxf.trm'
  1784. fi
  1785. if test -f 'gnuplot/term/rgip.trm' -a "${1}" != "-c" ; then 
  1786.   echo shar: Will not clobber existing file \"'gnuplot/term/rgip.trm'\"
  1787. else
  1788.   echo shar: Extracting \"'gnuplot/term/rgip.trm'\" \(8514 characters\)
  1789.   sed "s/^X//" >'gnuplot/term/rgip.trm' <<'END_OF_FILE'
  1790. X/*
  1791. X * $Id: rgip.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  1792. X */
  1793. X
  1794. X/* GNUPLOT - rgip.trm Uniplex graphics metafile */
  1795. X/*
  1796. X * Copyright (C) 1990
  1797. X *
  1798. X * Permission to use, copy, and distribute this software and its
  1799. X * documentation for any purpose with or without fee is hereby granted,
  1800. X * provided that the above copyright notice appear in all copies and
  1801. X * that both that copyright notice and this permission notice appear
  1802. X * in supporting documentation.
  1803. X *
  1804. X * Permission to modify the software is granted, but not the right to
  1805. X * distribute the modified code.  Modifications are to be distributed
  1806. X * as patches to released version.
  1807. X *
  1808. X * This software  is provided "as is" without express or implied warranty.
  1809. X *
  1810. X * This file is included by ../term.c.
  1811. X *
  1812. X * This terminal driver supports:
  1813. X *   RGIP metafile
  1814. X *
  1815. X * AUTHORS
  1816. X *   Hans Olav Eggestad
  1817. X *
  1818. X * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  1819. X *
  1820. X */
  1821. X
  1822. X/*
  1823. X * Original for direct RGIP Metafile output.
  1824. X */
  1825. X/* 
  1826. X * Max pixels for X and Y in one window is 10000.
  1827. X */
  1828. X
  1829. X#include <sys/types.h>
  1830. X#include <sys/stat.h>
  1831. X
  1832. X#define RGIP_X_MAX 10000
  1833. X#define RGIP_Y_MAX 10000
  1834. X#define RGIP_XMAX 9900
  1835. X#define RGIP_YMAX 9900
  1836. X
  1837. X#define RGIPDOTS 0
  1838. X#define RGIPMARK 1
  1839. X#define RGIPTEXT 2
  1840. X#define RGIPLINE 3
  1841. X#define RGIPPOLY 4
  1842. Xstatic char *RGIP_Obj[6] = { "DOTS", "MARK", "TEXT", "LINE", "POLY" };
  1843. X
  1844. X/* 
  1845. X * RGIP fontsises range from 1 to 8 
  1846. X */
  1847. X
  1848. X#define RGIP_SC (300)
  1849. X#define RGIP_FONTSIZE 1
  1850. X#define RGIP_FACES 3
  1851. X#define RGIP_FSTYLES 4
  1852. X#define RGIP_FSIZES 8
  1853. X#define RGIP_HELVETICA 0
  1854. X#define RGIP_TIMES 1
  1855. X#define RGIP_COURIER 2
  1856. X#define RGIP_LINE_WIDTHS 8 /* future, currently invisible and visible 0
  1857. Xand 1 */
  1858. X#define RGIP_LINE_TYPES 8
  1859. X#define RGIP_COLORS 16
  1860. X#define RGIP_POINT_TYPES 8
  1861. X
  1862. X
  1863. X
  1864. X#define RGIP_HTIC (100)
  1865. X#define RGIP_VTIC (100)
  1866. X#define RGIP_VCHAR (RGIP_FONTSIZE*RGIP_SC) 
  1867. X#define RGIP_HCHAR (RGIP_VCHAR*3/7)   
  1868. X
  1869. Xstatic int RGIP_orgx;        /* absolute-pixel-ORIgin of graph.    */
  1870. Xstatic int RGIP_orgy;
  1871. Xstatic int RGIP_posx;        /* current drawing position (lines).    */
  1872. Xstatic int RGIP_posy;
  1873. Xstatic int RGIP_inplot;
  1874. Xstatic int RGIP_xmax;        /* width of graph in pixels.        */
  1875. Xstatic int RGIP_ymax;        /* height of graph in pixels.        */
  1876. Xstatic int RGIP_blofs;        /* BaseLine OFfSet from bounding box.    */
  1877. Xstatic int RGIP_angle = 0;    /* 0 for horizontal text, 90 for vertical */
  1878. Xstatic enum JUSTIFY RGIP_justify = LEFT; /* left/center/right */
  1879. Xstatic int RGIP_fface = 2;  /* Times */
  1880. Xstatic int RGIP_ftype = 1; /* style roman */
  1881. Xstatic int RGIP_fontsize = RGIP_FONTSIZE; /*  */
  1882. Xstatic int RGIP_tcol = 7;  /* text color */
  1883. Xstatic int RGIP_lsty = 1;  /* line style */
  1884. Xstatic int RGIP_lcol = 7;  /* line color */
  1885. Xstatic int RGIP_lwid = 1;  /* line width */
  1886. Xstatic int RGIP_fsty = 1;  /* fill style */
  1887. Xstatic int RGIP_fcol = 7;  /* fill color */
  1888. Xstatic int RGIP_mcol = 7;  /* marker color */
  1889. Xstatic int RGIP_msty = 1;  /* marker style */
  1890. Xstatic int RGIP_msize = 1;  /* marker size */
  1891. X
  1892. X
  1893. Xstatic unsigned char *RGIP_cvts();
  1894. X
  1895. X
  1896. XRGIP_init()
  1897. X{
  1898. X    RGIP_posx = RGIP_posy = 0;
  1899. X
  1900. X    RGIP_orgx = (RGIP_X_MAX - RGIP_XMAX) / 2;
  1901. X    RGIP_orgy = (RGIP_Y_MAX - RGIP_YMAX) / 2;
  1902. X
  1903. X}
  1904. X
  1905. XRGIP_graphics()
  1906. X{
  1907. X    static int Gnr = 0;
  1908. X    struct stat buf;
  1909. X    unsigned char *p, fn[128];
  1910. X
  1911. X    fstat(fileno(outfile),&buf);
  1912. X    if ( S_ISREG(buf.st_mode)) {
  1913. X        if (p=(unsigned char *)strchr(outstr,'X')) { /* substitute X with graphnr */
  1914. X        if ( ! Gnr ) { /* delete the base file */
  1915. X            sprintf(fn,"%s",&outstr[1]);
  1916. X            fn[strlen(fn)-1]='\0';
  1917. X            unlink(fn);
  1918. X        } else {
  1919. X                fputs("%RI_GROUPEND\n", outfile);
  1920. X            fclose(outfile);
  1921. X        }
  1922. X        *p = '\0';
  1923. X        sprintf(fn,"%s%1d%s",&outstr[1],++Gnr,p+1);
  1924. X           fn[strlen(fn)-1]='\0';
  1925. X                if ( (outfile = fopen(fn,"w")) == (FILE *)NULL ) {
  1926. X                     os_error("cannot reopen file with binary type; output unknown",
  1927. X                           NO_CARET);
  1928. X                }
  1929. X        *p = 'X';  /* put back X */
  1930. X            }
  1931. X    }
  1932. X    fputs("%RGIP_METAFILE: 1.0a\n", outfile);
  1933. X    fputs("%RI_GROUPSTART\n", outfile);
  1934. X    fputs("%RI_GROUPSTART\n", outfile);
  1935. X
  1936. X    /* RGIP_linetype(-1); */
  1937. X}
  1938. X
  1939. XRGIP_text()
  1940. X{
  1941. X}
  1942. X
  1943. XRGIP_linetype(lt)
  1944. Xint lt;
  1945. X{
  1946. X    int pen, pattern;
  1947. X
  1948. X/*  -2: axis
  1949. X *  -1: border
  1950. X *   0: arrow
  1951. X *   1-7: graph
  1952. X*/
  1953. X    if ( lt == -2 ) {
  1954. X    lt = 1;
  1955. X    RGIP_lwid = 3;
  1956. X    } else if ( lt == -1 ) {
  1957. X    lt = 5;
  1958. X    RGIP_lwid = 1;
  1959. X    } else {
  1960. X    RGIP_lwid = (int) (lt/RGIP_LINE_TYPES);
  1961. X    if ( RGIP_lwid <= 0 ) RGIP_lwid = 1;
  1962. X        lt  = (lt % RGIP_LINE_TYPES) + 1;
  1963. X    }
  1964. X    fputs("%RI_GROUPEND\n", outfile);
  1965. X    fputs("%RI_GROUPSTART\n", outfile);
  1966. X
  1967. X    /* RGIP_lsty  = (lt == 0 || lt == 2) ? 1 : lt; */
  1968. X
  1969. X    RGIP_lsty = lt;
  1970. X}
  1971. X
  1972. X
  1973. XRGIP_move(x,y)
  1974. X    unsigned int x,y;
  1975. X{
  1976. X/*
  1977. X    fputs("%RI_GROUPEND\n", outfile);
  1978. X    fputs("%RI_GROUPSTART\n", outfile);
  1979. X*/
  1980. X    RGIP_posx = x;
  1981. X    RGIP_posy = y;
  1982. X}
  1983. X
  1984. X
  1985. XRGIP_vector(ux,uy)
  1986. X    unsigned int ux,uy;
  1987. X{
  1988. X    /* Create line */
  1989. X
  1990. X    fprintf(outfile,"%1d %1d %1d %1d",
  1991. X        RGIP_posx + RGIP_orgx,
  1992. X        RGIP_posy + RGIP_orgy,
  1993. X        ux + RGIP_orgx,
  1994. X        uy + RGIP_orgy);
  1995. X
  1996. X    fprintf(outfile," %1d %d %1d %s\n", RGIP_lwid, RGIP_lsty,
  1997. X        RGIP_lcol, RGIP_Obj[RGIPLINE]);
  1998. X
  1999. X    RGIP_posx = ux;
  2000. X    RGIP_posy = uy;
  2001. X    /* RGIP_move(ux, uy); */
  2002. X}
  2003. X
  2004. X
  2005. XRGIP_text_angle(angle)
  2006. X    int angle;
  2007. X{
  2008. X    if (RGIP_angle != angle) {
  2009. X       RGIP_angle = angle;    /* record for later use */
  2010. X    }
  2011. X
  2012. X    return(TRUE);
  2013. X}
  2014. X
  2015. XRGIP_justify_text(mode)
  2016. X    enum JUSTIFY mode;
  2017. X{
  2018. X    RGIP_justify = mode;
  2019. X    return(TRUE);
  2020. X}
  2021. X
  2022. Xstatic unsigned char *
  2023. XRGIP_cvts(str,lcnt)
  2024. X    unsigned char        *str;
  2025. X    int *lcnt;            /* lines */
  2026. X{
  2027. X    unsigned char        *cp1;
  2028. X    unsigned char        *cp2;
  2029. X    static unsigned char    *buf = NULL;
  2030. X    int lc = 1;
  2031. X
  2032. X    lc = 1;
  2033. X    /* Free up old buffer, if there is one, get a new one.  Since    */
  2034. X    /* all transformations shorten the string, get a buffer that is    */
  2035. X    /* the same size as the input string.                */
  2036. X
  2037. X    if (buf != NULL)
  2038. X     (void) free(buf);
  2039. X    buf = (unsigned char *) alloc(strlen(str), "converted label string");
  2040. X
  2041. X    /* Do the transformations. */
  2042. X
  2043. X    cp1 = str;
  2044. X    cp2 = buf;
  2045. X    while (strlen(cp1) > 0) {
  2046. X       switch (*cp1) {
  2047. X            case  '\\' :    /* Escape sequence. */
  2048. X             if (*++cp1 == '\\') {
  2049. X                /* Begin new line. */
  2050. X                *cp2++ = '\n';
  2051. X                lc++;
  2052. X                break;
  2053. X             }
  2054. X        
  2055. X            /* Fall through to just copy next char out.    */
  2056. X        
  2057. X            default :
  2058. X             *cp2++ = *cp1;
  2059. X            break;
  2060. X        }
  2061. X       cp1++;
  2062. X    }
  2063. X    *cp2++ = '\n';
  2064. X    *cp2 = '\0';
  2065. X    *lcnt = lc; 
  2066. X    return (buf);
  2067. X}
  2068. X
  2069. XRGIP_put_text(x, y, str)
  2070. X    int x,y;                /* reference point of string */
  2071. X    unsigned char str[];            /* the text */
  2072. X{
  2073. X    register struct termentry *t = &term_tbl[term];
  2074. X    unsigned char *cvstr, *p;
  2075. X    int xlines;        /* lines */
  2076. X    cvstr = RGIP_cvts(str,&xlines);
  2077. X
  2078. X    x += RGIP_orgx,
  2079. X    y += RGIP_orgy;
  2080. X
  2081. X    if (! RGIP_angle) {      /* horisontal */
  2082. X    y += (int)(t->v_char)*(xlines-2)/2;
  2083. X    /* y += (t->v_char)*xlines; */
  2084. X    y += (int)(t->v_char)/4;
  2085. X    } else {
  2086. X    x -= (int)(t->v_char)*(xlines-2)/2;
  2087. X    x -= (int)(t->v_char)/4;
  2088. X    }
  2089. X
  2090. X    while ( p=(unsigned char *)strchr(cvstr,'\n' )) {
  2091. X    *p = '\0';
  2092. X    if (strlen(cvstr)) 
  2093. X            fprintf(outfile,"%1d %1d %1d  %1d (%s) %1d %1d %1d %1d %s\n",
  2094. X                x,y,RGIP_justify, RGIP_angle*90, cvstr, RGIP_fface, RGIP_ftype,
  2095. X                RGIP_fontsize, RGIP_tcol, RGIP_Obj[RGIPTEXT]);
  2096. X    cvstr = ++p;
  2097. X    if (RGIP_angle) {     /* vertical */
  2098. X        x += (t->v_char);
  2099. X    } else {
  2100. X        y -= (t->v_char);
  2101. X    }
  2102. X    }
  2103. X}
  2104. X
  2105. X
  2106. XRGIP_reset()
  2107. X{
  2108. X    fputs("%RI_GROUPEND\n", outfile);
  2109. X    fputs("%RI_GROUPEND\n", outfile);
  2110. X}
  2111. X
  2112. Xstatic void
  2113. XRGIP_setfont(sz)
  2114. X    int sz;
  2115. X{
  2116. X    RGIP_fontsize = (int) (sz);
  2117. X    if ( RGIP_fontsize < 1 ) RGIP_fontsize = 1;
  2118. X    term_tbl[term].v_char = (unsigned int)(RGIP_fontsize*RGIP_SC);
  2119. X    term_tbl[term].h_char = (unsigned int)(RGIP_fontsize*RGIP_SC*3/7);
  2120. X}
  2121. XRGIP_do_point(x,y,number)
  2122. Xint x,y;
  2123. Xint number;
  2124. X{
  2125. X
  2126. X    x += RGIP_orgx,
  2127. X    y += RGIP_orgy;
  2128. X
  2129. X    if (number < 0) {        /* do dot */
  2130. X        fprintf(outfile,"%1d %1d %1d %s\n",
  2131. X               x,y,RGIP_mcol,RGIP_Obj[RGIPDOTS]);
  2132. X        return;
  2133. X    }
  2134. X
  2135. X    RGIP_msty = (number % RGIP_POINT_TYPES) + 1;
  2136. X    RGIP_msize = ((int)(number / RGIP_POINT_TYPES)) + 1;
  2137. X
  2138. X    fprintf(outfile,"%1d %1d %1d %1d %1d %s\n",
  2139. X               x,y,RGIP_msize, RGIP_msty, RGIP_mcol, RGIP_Obj[RGIPMARK]);
  2140. X}
  2141. X
  2142. XRGIP_options()
  2143. X{
  2144. X    extern struct value *const_express();
  2145. X    extern double real();
  2146. X
  2147. X    if (!END_OF_COMMAND) {
  2148. X        /* We have font size specified */
  2149. X        struct value a;
  2150. X        RGIP_fontsize = (int)real(const_express(&a));
  2151. X        if ( RGIP_fontsize < 1 ) 
  2152. X            RGIP_fontsize = 1;
  2153. X        term_tbl[term].v_char = (unsigned int)(RGIP_fontsize*RGIP_SC);
  2154. X        term_tbl[term].h_char = (unsigned int)(RGIP_fontsize*RGIP_SC*3/7);
  2155. X    }
  2156. X    sprintf(term_options,"%d",RGIP_fontsize);
  2157. X}
  2158. END_OF_FILE
  2159.   if test 8514 -ne `wc -c <'gnuplot/term/rgip.trm'`; then
  2160.     echo shar: \"'gnuplot/term/rgip.trm'\" unpacked with wrong size!
  2161.   fi
  2162.   # end of 'gnuplot/term/rgip.trm'
  2163. fi
  2164. if test -f 'gnuplot/term/x11.trm' -a "${1}" != "-c" ; then 
  2165.   echo shar: Will not clobber existing file \"'gnuplot/term/x11.trm'\"
  2166. else
  2167.   echo shar: Extracting \"'gnuplot/term/x11.trm'\" \(8636 characters\)
  2168.   sed "s/^X//" >'gnuplot/term/x11.trm' <<'END_OF_FILE'
  2169. X/*
  2170. X * $Id: x11.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  2171. X *
  2172. X */
  2173. X
  2174. X/*
  2175. X *    x11.trm  --- inboard terminal driver for X11
  2176. X */
  2177. X
  2178. X#define X11_XMAX 4096
  2179. X#define X11_YMAX 4096
  2180. X
  2181. X/* approximations for typical font/screen sizes */
  2182. X#define X11_VCHAR (X11_YMAX/25) 
  2183. X#define X11_HCHAR (X11_XMAX/100) 
  2184. X#define X11_VTIC (X11_YMAX/100)
  2185. X#define X11_HTIC (X11_XMAX/150)
  2186. X
  2187. Xint X11_Display = 0; /* non-zero if '-display' found on command line */
  2188. X
  2189. X#define X11_nopts 27
  2190. Xchar X11_opts[X11_nopts][20] = {
  2191. X   "-mono", "-gray", "-clear", "-tvtwm", "-pointsize",
  2192. X   "-iconic", "-rv", "-reverse", "+rv", "-synchronous", 
  2193. X   "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
  2194. X   "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name", 
  2195. X   "-selectionTimeout", "-title", "-xnllanguage", "-xrm" 
  2196. X   };
  2197. Xint X11_optarg[X11_nopts] = { 
  2198. X   0, 0, 0, 0, 1,
  2199. X   0, 0, 0, 0, 0,
  2200. X   1, 1, 1, 1, 1, 1, 1,
  2201. X   1, 1, 1, 1, 1, 1, 
  2202. X   1, 1, 1, 1
  2203. X   };
  2204. X
  2205. XFILE *X11_ipc; 
  2206. Xchar X11_command[1024]= "gnuplot_x11";
  2207. X
  2208. X/*   X11_args - scan gnuplot command line for standard X Toolkit options */
  2209. X
  2210. XX11_args(argc, argv) int argc; char *argv[]; {
  2211. X   int nx11 = 0, n;
  2212. X
  2213. X   while(++argv, --argc > 0) {
  2214. X      for (n=0; n<X11_nopts; n++) {
  2215. X     if (!strcmp(*argv, X11_opts[n])) {
  2216. X        strcat(X11_command, " ");
  2217. X        strcat(X11_command, *argv); 
  2218. X        !strcmp(*argv, "-display") && X11_Display++;
  2219. X        if (X11_optarg[n]) {
  2220. X           if (--argc <= 0) return(nx11);
  2221. X           strcat(X11_command, " \"");
  2222. X           strcat(X11_command, *++argv); 
  2223. X           strcat(X11_command, "\"");
  2224. X           nx11++;
  2225. X           }
  2226. X        nx11++; break;
  2227. X        }
  2228. X     }
  2229. X      if (n == X11_nopts) break; 
  2230. X      }
  2231. X   return(nx11);
  2232. X   }
  2233. X
  2234. X/*-----------------------------------------------------------------------------
  2235. X *   Three different versions of the remainder of the X11 terminal driver
  2236. X *   are provided to support three different types of IPC with the
  2237. X *   gnuplot_x11 outboard terminal driver:
  2238. X * 
  2239. X *   DEFAULT_X11:      popen() pipe for most un*x platforms
  2240. X *
  2241. X *   CRIPPLED_SELECT : file IPC for un*x platforms with incomplete or faulty
  2242. X *                     implementation of BSD select()
  2243. X *
  2244. X *   VMS :             mailbox/spawn IPC
  2245. X *---------------------------------------------------------------------------*/
  2246. X
  2247. X#define DEFAULT_X11
  2248. X#if defined(VMS) || defined(CRIPPLED_SELECT)
  2249. X#undef DEFAULT_X11
  2250. X#endif
  2251. X#if defined(VMS) && defined(CRIPPLED_SELECT)
  2252. XError. Incompatible options.
  2253. X#endif
  2254. X
  2255. X
  2256. X#ifdef DEFAULT_X11
  2257. X/*-----------------------------------------------------------------------------
  2258. X *   DEFAULT_X11 popen() pipe IPC
  2259. X *---------------------------------------------------------------------------*/
  2260. XFILE *popen();
  2261. X
  2262. XX11_init() { X11_ipc = popen(X11_command, "w"); }
  2263. X
  2264. XX11_graphics() { 
  2265. X   fprintf(X11_ipc, "G\n"); 
  2266. X   fprintf(X11_ipc, "P7%04d%04d\n", /* size of point symbols */
  2267. X       term_tbl[term].h_tic / 2, term_tbl[term].v_tic / 2); 
  2268. X#ifdef ULTRIX_KLUDGE
  2269. X   fflush(X11_ipc);
  2270. X#endif
  2271. X   }
  2272. X
  2273. XX11_text() { 
  2274. X   fprintf(X11_ipc, "E\n"); fflush(X11_ipc);
  2275. X#ifdef ULTRIX_KLUDGE
  2276. X   fprintf(X11_ipc, "E\n"); fflush(X11_ipc);
  2277. X#endif
  2278. X   }
  2279. X
  2280. XX11_reset() { fprintf(X11_ipc, "R\n"); fflush(X11_ipc); pclose(X11_ipc); }
  2281. X
  2282. XX11_move(x,y) unsigned int x,y; { fprintf(X11_ipc, "M%04d%04d\n", x, y); }
  2283. X
  2284. XX11_vector(x,y) unsigned int x,y; { fprintf(X11_ipc, "V%04d%04d\n", x, y); }
  2285. X
  2286. XX11_linetype(lt) int lt; { fprintf(X11_ipc, "L%04d\n", lt); }
  2287. X
  2288. XX11_put_text(x,y,str) unsigned int x,y; char str[]; {
  2289. X   fprintf(X11_ipc, "T%04d%04d%s\n", x, y, str);
  2290. X   }
  2291. X
  2292. XX11_justify_text(mode) enum JUSTIFY mode; {
  2293. X   fprintf(X11_ipc, "J%04d\n", mode);
  2294. X   return(TRUE);
  2295. X   }
  2296. X
  2297. XX11_point(x,y,number) unsigned int x,y; int number; {
  2298. X   if (number>=0)
  2299. X      number %= POINT_TYPES;
  2300. X   number += 1;
  2301. X   fprintf(X11_ipc, "P%01d%04d%04d\n", number, x, y);
  2302. X   }
  2303. X
  2304. X#endif /* DEFAULT_X11 */
  2305. X
  2306. X
  2307. X#ifdef CRIPPLED_SELECT
  2308. X/*-----------------------------------------------------------------------------
  2309. X *   CRIPPLED_SELECT file IPC
  2310. X *---------------------------------------------------------------------------*/
  2311. X
  2312. Xchar X11_tmp[32], X11_tmp0[32], X11_shutdown[32];
  2313. Xint X11_pid;
  2314. X
  2315. XX11_init() { 
  2316. X   if (!(X11_pid = fork())) {
  2317. X      execl("/bin/sh", "sh", "-c", X11_command, NULL);
  2318. X      _exit(1);
  2319. X      }
  2320. X   sprintf(X11_tmp, "/tmp/Gnuplot_%d", X11_pid);
  2321. X   sprintf(X11_tmp0, "%s-", X11_tmp);
  2322. X   sprintf(X11_shutdown, "echo R >%s", X11_tmp);
  2323. X   }
  2324. X
  2325. XX11_graphics() { 
  2326. X   X11_ipc = fopen(X11_tmp0, "w"); 
  2327. X   if (!X11_ipc) { perror(X11_tmp0); system(X11_shutdown); exit(1); }
  2328. X   fprintf(X11_ipc, "G\n"); 
  2329. X   fprintf(X11_ipc, "P7%04d%04d\n", /* size of point symbols */
  2330. X       term_tbl[term].h_tic / 2, term_tbl[term].v_tic / 2); 
  2331. X#ifdef ULTRIX_KLUDGE
  2332. X   fflush(X11_ipc);
  2333. X#endif
  2334. X   }
  2335. X
  2336. XX11_text() { 
  2337. X   fprintf(X11_ipc, "E\n"); 
  2338. X#ifdef ULTRIX_KLUDGE
  2339. X   fprintf(X11_ipc, "E\n");
  2340. X#endif
  2341. X   fclose(X11_ipc);
  2342. X   rename(X11_tmp0, X11_tmp);
  2343. X   }
  2344. X
  2345. XX11_reset() { system(X11_shutdown); }
  2346. X
  2347. XX11_move(x,y) unsigned int x,y; { fprintf(X11_ipc, "M%04d%04d\n", x, y); }
  2348. X
  2349. XX11_vector(x,y) unsigned int x,y; { fprintf(X11_ipc, "V%04d%04d\n", x, y); }
  2350. X
  2351. XX11_linetype(lt) int lt; { fprintf(X11_ipc, "L%04d\n", lt); }
  2352. X
  2353. XX11_put_text(x,y,str) unsigned int x,y; char str[]; {
  2354. X   fprintf(X11_ipc, "T%04d%04d%s\n", x, y, str);
  2355. X   }
  2356. X
  2357. XX11_justify_text(mode) enum JUSTIFY mode; {
  2358. X   fprintf(X11_ipc, "J%04d\n", mode);
  2359. X   return(TRUE);
  2360. X   }
  2361. X
  2362. XX11_point(x,y,number) unsigned int x,y; int number; {
  2363. X   if (number>=0)
  2364. X      number %= POINT_TYPES;
  2365. X   number += 1;
  2366. X   fprintf(X11_ipc, "P%01d%04d%04d\n", number, x, y);
  2367. X   }
  2368. X#endif /* CRIPPLED_SELECT */
  2369. X
  2370. X
  2371. X#ifdef VMS
  2372. X/*-----------------------------------------------------------------------------
  2373. X *   VMS mailbox/spawn IPC - Yehavi Bourvine - YEHAVI@VMS.HUJI.AC.IL
  2374. X *---------------------------------------------------------------------------*/
  2375. X
  2376. X#include <iodef.h>
  2377. X#include <descrip.h>
  2378. X#define MAILBOX "PLOT_X11$MAILBOX"
  2379. X
  2380. Xint vaxc$errno;
  2381. Xstatic short X11_channel;
  2382. Xstatic $DESCRIPTOR(lognamedsc,MAILBOX);
  2383. X
  2384. XX11_init() {
  2385. X
  2386. X   /* Create a descriptor for the command. $DESCRIP doesn't work in 
  2387. X   this context... */
  2388. X   struct { 
  2389. X      short size, type; 
  2390. X      char *address;
  2391. X      } pgmdsc = { strlen(X11_command), 0, X11_command };
  2392. X
  2393. X
  2394. X   /* Create a mailbox which will be used as a pipe for commands to the 
  2395. X   subprocess.  What we'll write to it will be read by the subprocess as 
  2396. X   its STDIN. */
  2397. X   vaxc$errno = sys$crembx(0,&X11_channel,128,128,0,0,&lognamedsc,0);
  2398. X   if (!(vaxc$errno)&1) {
  2399. X      printf("SYS$CreMbx failed with status=%d\r\n", vaxc$errno);
  2400. X      os_error("sys$crembx failed",NO_CARET);
  2401. X      }
  2402. X
  2403. X   /* Assign an I/O channel to it */
  2404. X   vaxc$errno = sys$assign(&lognamedsc,&X11_channel,0,0,0);
  2405. X   if (!(vaxc$errno & 1)) {
  2406. X      printf("SYS$Assign failed with status=%d\r\n", vaxc$errno);
  2407. X      os_error("sys$crembx failed",NO_CARET);
  2408. X      }
  2409. X
  2410. X   /* Create a subprocess whose input is this mailbox. */
  2411. X   vaxc$errno = lib$spawn(&pgmdsc,&lognamedsc,0,&1,0,0,0,0,0,0,0,0,0);
  2412. X   if (!((vaxc$errno) & 1)) {
  2413. X      printf("LIB$SPAWN failed with status=%d\r\n", vaxc$errno);
  2414. X      os_error("lib$spawn failed",NO_CARET);
  2415. X      }
  2416. X   }
  2417. X
  2418. X/*   We use $QIO in order to avoid buffering problems, although it might 
  2419. X *   work  as well with simple Fprintf calls.  */
  2420. X
  2421. XX11_vmsqiow(buf) char *buf; {
  2422. X   int status = sys$qiow(0, X11_channel, IO$_WRITEVBLK, 0, 0, 0, 
  2423. X             buf, strlen(buf), 0, 0, 0, 0);
  2424. X   if((status & 0x1) == 0) exit(status);
  2425. X   }
  2426. X
  2427. Xchar   X11_vmsbuf[512];
  2428. X
  2429. XX11_graphics() { 
  2430. X   sprintf(X11_vmsbuf, "G\n");
  2431. X   X11_vmsqiow(X11_vmsbuf);
  2432. X   sprintf(X11_vmsbuf, "P7%04d%04d\n", /* size of point symbols */
  2433. X       term_tbl[term].h_tic / 2, term_tbl[term].v_tic / 2); 
  2434. X   X11_vmsqiow(X11_vmsbuf);
  2435. X   }
  2436. X
  2437. XX11_text() {
  2438. X   sprintf(X11_vmsbuf, "E\n");
  2439. X   X11_vmsqiow(X11_vmsbuf);
  2440. X   }
  2441. X
  2442. XX11_reset() { 
  2443. X   sprintf(X11_vmsbuf, "R\n");
  2444. X   X11_vmsqiow(X11_vmsbuf);
  2445. X   sleep(2);        /* Wait for subprocess to finish */
  2446. X   sys$dassgn(X11_channel);
  2447. X   }
  2448. X
  2449. XX11_move(x,y) unsigned int x,y; { 
  2450. X   sprintf(X11_vmsbuf, "M%04d%04d\n", x, y);
  2451. X   X11_vmsqiow(X11_vmsbuf);
  2452. X   }
  2453. X
  2454. XX11_vector(x,y) unsigned int x,y; { 
  2455. X   sprintf(X11_vmsbuf, "V%04d%04d\n", x, y);
  2456. X   X11_vmsqiow(X11_vmsbuf);
  2457. X   }
  2458. X
  2459. XX11_linetype(lt) int lt; { 
  2460. X   sprintf(X11_vmsbuf, "L%04d\n", lt);
  2461. X   X11_vmsqiow(X11_vmsbuf);
  2462. X   }
  2463. X
  2464. XX11_put_text(x,y,str) unsigned int x,y; char str[]; { 
  2465. X   sprintf(X11_vmsbuf, "T%04d%04d%s\n", x, y, str);
  2466. X   X11_vmsqiow(X11_vmsbuf);
  2467. X   }
  2468. X
  2469. XX11_justify_text(mode) enum JUSTIFY mode; { 
  2470. X   sprintf(X11_vmsbuf, "J%04d\n", mode);
  2471. X   X11_vmsqiow(X11_vmsbuf);
  2472. X   return(TRUE);
  2473. X   }
  2474. X
  2475. XX11_point(x,y,number) unsigned int x,y; int number; {
  2476. X   if (number>=0)
  2477. X      number %= POINT_TYPES;
  2478. X   number += 1;
  2479. X   sprintf(X11_vmsbuf, "P%01d%04d%04d\n", number, x, y);
  2480. X   X11_vmsqiow(X11_vmsbuf);
  2481. X   }
  2482. X#endif /* VMS */
  2483. END_OF_FILE
  2484.   if test 8636 -ne `wc -c <'gnuplot/term/x11.trm'`; then
  2485.     echo shar: \"'gnuplot/term/x11.trm'\" unpacked with wrong size!
  2486.   fi
  2487.   # end of 'gnuplot/term/x11.trm'
  2488. fi
  2489. if test -f 'gnuplot/win/winmain.c' -a "${1}" != "-c" ; then 
  2490.   echo shar: Will not clobber existing file \"'gnuplot/win/winmain.c'\"
  2491. else
  2492.   echo shar: Extracting \"'gnuplot/win/winmain.c'\" \(9026 characters\)
  2493.   sed "s/^X//" >'gnuplot/win/winmain.c' <<'END_OF_FILE'
  2494. X#ifndef lint
  2495. Xstatic char *RCSid = "$Id: winmain.c%v 3.50 1993/07/09 05:35:24 woo Exp $";
  2496. X#endif
  2497. X
  2498. X/* GNUPLOT - win/winmain.c */
  2499. X/*
  2500. X * Copyright (C) 1992   Maurice Castro, Russell Lang
  2501. X *
  2502. X * Permission to use, copy, and distribute this software and its
  2503. X * documentation for any purpose with or without fee is hereby granted, 
  2504. X * provided that the above copyright notice appear in all copies and 
  2505. X * that both that copyright notice and this permission notice appear 
  2506. X * in supporting documentation.
  2507. X *
  2508. X * Permission to modify the software is granted, but not the right to
  2509. X * distribute the modified code.  Modifications are to be distributed 
  2510. X * as patches to released version.
  2511. X *  
  2512. X * This software is provided "as is" without express or implied warranty.
  2513. X * 
  2514. X *
  2515. X * AUTHORS
  2516. X * 
  2517. X *   Maurice Castro
  2518. X *   Russell Lang
  2519. X * 
  2520. X * Send your comments or suggestions to 
  2521. X *  info-gnuplot@dartmouth.edu.
  2522. X * This is a mailing list; to join it send a note to 
  2523. X *  info-gnuplot-request@dartmouth.edu.  
  2524. X * Send bug reports to
  2525. X *  bug-gnuplot@dartmouth.edu.
  2526. X */
  2527. X
  2528. X/* This file implements the initialization code for running gnuplot   */
  2529. X/* under Microsoft Windows. The code currently compiles only with the */
  2530. X/* Borland C++ 3.1 compiler. 
  2531. X/*                                                                    */
  2532. X/* The modifications to allow Gnuplot to run under Windows were made  */
  2533. X/* by Maurice Castro. (maurice@bruce.cs.monash.edu.au)  3 Jul 1992    */
  2534. X/* and Russell Lang (rjl@monu1.cc.monash.edu.au) 30 Nov 1992          */
  2535. X/*                                                                    */
  2536. X#define STRICT
  2537. X#include <windows.h>
  2538. X#include <windowsx.h>
  2539. X#include <dos.h>
  2540. X#include <stdio.h>
  2541. X#include <stdlib.h>
  2542. X#include <string.h>
  2543. X#include <stdarg.h>
  2544. X#ifdef __MSC__
  2545. X#include <malloc.h>
  2546. X#else
  2547. X#include <alloc.h>
  2548. X#endif
  2549. X#include <io.h>
  2550. X#include "plot.h"
  2551. X#include "setshow.h"
  2552. X#include "wgnuplib.h"
  2553. X#include "wtext.h"
  2554. X
  2555. X/* limits */
  2556. X#define MAXSTR 255
  2557. X#define MAXPRINTF 1024
  2558. X
  2559. X/* globals */
  2560. XTW textwin;
  2561. XGW graphwin;
  2562. XPW pausewin;
  2563. XMW menuwin;
  2564. XLPSTR szModuleName;
  2565. XLPSTR winhelpname;
  2566. XLPSTR szMenuName;
  2567. X#define MENUNAME "wgnuplot.mnu"
  2568. X
  2569. Xextern char version[];
  2570. Xextern char patchlevel[];
  2571. Xextern char date[];
  2572. Xextern char *authors[];
  2573. Xextern char copyright[];
  2574. Xextern void close_printer();
  2575. Xvoid WinExit(void);
  2576. Xint gnu_main(int argc, char *argv[], char *env[]);
  2577. X
  2578. Xvoid
  2579. XCheckMemory(LPSTR str)
  2580. X{
  2581. X    if (str == (LPSTR)NULL) {
  2582. X        MessageBox(NULL, "out of memory", "gnuplot", MB_ICONSTOP | MB_OK);
  2583. X        exit(1);
  2584. X    }
  2585. X}
  2586. X
  2587. Xint
  2588. XPause(LPSTR str)
  2589. X{
  2590. X    pausewin.Message = str;
  2591. X    return (PauseBox(&pausewin) == IDOK);
  2592. X}
  2593. X
  2594. X/* atexit procedure */
  2595. Xvoid
  2596. XWinExit(void)
  2597. X{
  2598. X    if (term && term_init)
  2599. X        (*term_tbl[term].reset)();
  2600. X    if ( !strcmp(outstr,"'PRN'") )
  2601. X        close_printer();
  2602. X    fcloseall();
  2603. X    if (graphwin.hWndGraph && IsWindow(graphwin.hWndGraph))
  2604. X        GraphClose(&graphwin);
  2605. X    TextMessage();    /* process messages */
  2606. X     WinHelp(textwin.hWndText,(LPSTR)winhelpname,HELP_QUIT,(DWORD)NULL);
  2607. X    TextClose(&textwin);
  2608. X    TextMessage();    /* process messages */
  2609. X    return;
  2610. X}
  2611. X
  2612. X/* call back function from Text Window WM_CLOSE */
  2613. Xint CALLBACK _export
  2614. XShutDown(void)
  2615. X{
  2616. X    WinExit();
  2617. X    exit(0);
  2618. X    return 0;
  2619. X}
  2620. X
  2621. Xint PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  2622. X        LPSTR lpszCmdLine, int nCmdShow)
  2623. X{
  2624. X    WNDCLASS wndclass;
  2625. X    LPSTR tail;
  2626. X    
  2627. X#if defined(__MSC__)    /* MSC doesn't give us _argc and _argv[] so ...   */
  2628. X#define MAXCMDTOKENS 128
  2629. X    int     _argc=0;
  2630. X    LPSTR   _argv[MAXCMDTOKENS];
  2631. X    _argv[_argc] = "wgnuplot.exe";
  2632. X    _argv[++_argc] = _fstrtok( lpszCmdLine, " ");
  2633. X    while (_argv[_argc] != NULL)
  2634. X        _argv[++_argc] = _fstrtok( NULL, " ");
  2635. X#endif
  2636. X
  2637. X      szModuleName = (LPSTR)farmalloc(MAXSTR+1);
  2638. X      CheckMemory(szModuleName);
  2639. X    szModuleName = (LPSTR)farmalloc(MAXSTR+1);
  2640. X    CheckMemory(szModuleName);
  2641. X
  2642. X    /* get path to EXE */
  2643. X    GetModuleFileName(hInstance, (LPSTR) szModuleName, MAXSTR);
  2644. X    if (CheckWGNUPLOTVersion(WGNUPLOTVERSION)) {
  2645. X        MessageBox(NULL, "Wrong version of WGNUPLOT.DLL", szModuleName, MB_ICONSTOP | MB_OK);
  2646. X        exit(1);
  2647. X    }
  2648. X    if ((tail = _fstrrchr(szModuleName,'\\')) != (LPSTR)NULL)
  2649. X    {
  2650. X        tail++;
  2651. X        *tail = NULL;
  2652. X    }
  2653. X    szModuleName = farrealloc(szModuleName, _fstrlen(szModuleName)+1);
  2654. X    CheckMemory(szModuleName);
  2655. X
  2656. X    winhelpname = (LPSTR)farmalloc(_fstrlen(szModuleName)+_fstrlen(HELPFILE)+1);
  2657. X    CheckMemory(winhelpname);
  2658. X    _fstrcpy(winhelpname,szModuleName);
  2659. X    _fstrcat(winhelpname,HELPFILE);
  2660. X
  2661. X    szMenuName = (LPSTR)farmalloc(_fstrlen(szModuleName)+_fstrlen(MENUNAME)+1);
  2662. X    CheckMemory(szMenuName);
  2663. X    _fstrcpy(szMenuName,szModuleName);
  2664. X    _fstrcat(szMenuName,MENUNAME);
  2665. X
  2666. X    textwin.hInstance = hInstance;
  2667. X    textwin.hPrevInstance = hPrevInstance;
  2668. X    textwin.nCmdShow = nCmdShow;
  2669. X    textwin.Title = "gnuplot";
  2670. X    textwin.IniFile = "wgnuplot.ini";
  2671. X    textwin.IniSection = "WGNUPLOT";
  2672. X    textwin.DragPre = "load '";
  2673. X    textwin.DragPost = "'\n";
  2674. X    textwin.lpmw = &menuwin;
  2675. X    textwin.ScreenSize.x = 80;
  2676. X    textwin.ScreenSize.y = 80;
  2677. X    textwin.KeyBufSize = 2048;
  2678. X    textwin.CursorFlag = 1;    /* scroll to cursor after \n & \r */
  2679. X    textwin.shutdown = MakeProcInstance((FARPROC)ShutDown, hInstance);
  2680. X    textwin.AboutText = (LPSTR)farmalloc(1024);
  2681. X    CheckMemory(textwin.AboutText);
  2682. X    sprintf(textwin.AboutText,"Version %s\nPatchlevel %s\nLast Modified %s\n%s\n%s, %s",
  2683. X        version, patchlevel, date, copyright, authors[1], authors[0]);
  2684. X    textwin.AboutText = farrealloc(textwin.AboutText, _fstrlen(textwin.AboutText)+1);
  2685. X    CheckMemory(textwin.AboutText);
  2686. X
  2687. X    menuwin.szMenuName = szMenuName;
  2688. X
  2689. X    pausewin.hInstance = hInstance;
  2690. X    pausewin.hPrevInstance = hPrevInstance;
  2691. X    pausewin.Title = "gnuplot pause";
  2692. X
  2693. X    graphwin.hInstance = hInstance;
  2694. X    graphwin.hPrevInstance = hPrevInstance;
  2695. X    graphwin.Title = "gnuplot graph";
  2696. X    graphwin.lptw = &textwin;
  2697. X    graphwin.IniFile = textwin.IniFile;
  2698. X    graphwin.IniSection = textwin.IniSection;
  2699. X    graphwin.color=TRUE;
  2700. X    graphwin.fontsize = WINFONTSIZE;
  2701. X
  2702. X    if (TextInit(&textwin))
  2703. X        exit(1);
  2704. X    textwin.hIcon = LoadIcon(hInstance, "texticon");
  2705. X#ifdef WIN32
  2706. X    SetClassLong(textwin.hWndParent, GCL_HICON, (DWORD)textwin.hIcon);
  2707. X#else
  2708. X    SetClassWord(textwin.hWndParent, GCW_HICON, (WORD)textwin.hIcon);
  2709. X#endif
  2710. X    if (_argc>1)
  2711. X        ShowWindow(textwin.hWndParent,SW_SHOWMINIMIZED);
  2712. X    if (IsIconic(textwin.hWndParent)) { /* update icon */
  2713. X        RECT rect;
  2714. X        GetClientRect(textwin.hWndParent, (LPRECT) &rect);
  2715. X        InvalidateRect(textwin.hWndParent, (LPRECT) &rect, 1);
  2716. X        UpdateWindow(textwin.hWndParent);
  2717. X    }
  2718. X
  2719. X
  2720. X    atexit(WinExit);
  2721. X
  2722. X    gnu_main(_argc, _argv, environ);
  2723. X
  2724. X    return 0;
  2725. X}
  2726. X
  2727. X
  2728. X/* replacement stdio routines that use Text Window for stdin/stdout */
  2729. X/* WARNING: Do not write to stdout/stderr with functions not listed 
  2730. X   in win/wtext.h */
  2731. X
  2732. X#undef kbhit
  2733. X#undef getche
  2734. X#undef getch
  2735. X#undef putch
  2736. X
  2737. X#undef fgetc
  2738. X#undef getchar
  2739. X#undef getc
  2740. X#undef fgets
  2741. X#undef gets
  2742. X
  2743. X#undef fputc
  2744. X#undef putchar
  2745. X#undef putc
  2746. X#undef fputs
  2747. X#undef puts
  2748. X
  2749. X#undef fprintf
  2750. X#undef printf
  2751. X#undef vprintf
  2752. X#undef vfprintf
  2753. X
  2754. X#undef fwrite
  2755. X#undef fread
  2756. X
  2757. X#ifdef __MSC__
  2758. X#define isterm(f) (f==stdin || f==stdout || f==stderr)
  2759. X#else
  2760. X#define isterm(f) isatty(fileno(f))
  2761. X#endif
  2762. X
  2763. Xint
  2764. XMyPutCh(int ch)
  2765. X{
  2766. X    return TextPutCh(&textwin, (BYTE)ch);
  2767. X}
  2768. X
  2769. Xint
  2770. XMyKBHit(void)
  2771. X{
  2772. X    return TextKBHit(&textwin);
  2773. X}
  2774. X
  2775. Xint
  2776. XMyGetCh(void)
  2777. X{
  2778. X    return TextGetCh(&textwin);
  2779. X}
  2780. X
  2781. Xint
  2782. XMyGetChE(void)
  2783. X{
  2784. X    return TextGetChE(&textwin);
  2785. X}
  2786. X
  2787. Xint
  2788. XMyFGetC(FILE *file)
  2789. X{
  2790. X    if (isterm(file)) {
  2791. X        return MyGetChE();
  2792. X    }
  2793. X    return fgetc(file);
  2794. X}
  2795. X
  2796. Xchar *
  2797. XMyGetS(char *str)
  2798. X{
  2799. X    TextPutS(&textwin,"\nDANGER: gets() used\n");
  2800. X    MyFGetS(str,80,stdin);
  2801. X    if (strlen(str) > 0 
  2802. X     && str[strlen(str)-1]=='\n')
  2803. X        str[strlen(str)-1] = '\0';
  2804. X    return str;
  2805. X}
  2806. X
  2807. Xchar *
  2808. XMyFGetS(char *str, unsigned int size, FILE *file)
  2809. X{
  2810. Xchar FAR *p;
  2811. X    if (isterm(file)) {
  2812. X        p = TextGetS(&textwin, str, size);
  2813. X        if (p != (char FAR *)NULL)
  2814. X            return str;
  2815. X        return (char *)NULL;
  2816. X    }    
  2817. X    return fgets(str,size,file);
  2818. X}
  2819. X
  2820. Xint
  2821. XMyFPutC(int ch, FILE *file)
  2822. X{
  2823. X    if (isterm(file)) {
  2824. X        MyPutCh((BYTE)ch);
  2825. X        TextMessage();
  2826. X        return ch;
  2827. X    }
  2828. X    return fputc(ch,file);
  2829. X}
  2830. X
  2831. Xint
  2832. XMyFPutS(char *str, FILE *file)
  2833. X{
  2834. X    if (isterm(file)) {
  2835. X        TextPutS(&textwin, str);
  2836. X        TextMessage();
  2837. X        return (*str);    /* different from Borland library */
  2838. X    }
  2839. X    return fputs(str,file);
  2840. X}
  2841. X
  2842. Xint
  2843. XMyPutS(char *str)
  2844. X{
  2845. X    TextPutS(&textwin, str);
  2846. X    MyPutCh('\n');
  2847. X    TextMessage();
  2848. X    return 0;    /* different from Borland library */
  2849. X}
  2850. X
  2851. Xint MyFPrintF(FILE *file, char *fmt, ...)
  2852. X{
  2853. Xint count;
  2854. Xva_list args;
  2855. X    va_start(args,fmt);
  2856. X    if (isterm(file)) {
  2857. X        char buf[MAXPRINTF];
  2858. X        count = vsprintf(buf,fmt,args);
  2859. X        TextPutS(&textwin,buf);
  2860. X    }
  2861. X    else
  2862. X        count = vfprintf(file, fmt, args);
  2863. X    va_end(args);
  2864. X    return count;
  2865. X}
  2866. X
  2867. Xint MyPrintF(char *fmt, ...)
  2868. X{
  2869. Xint count;
  2870. Xchar buf[MAXPRINTF];
  2871. Xva_list args;
  2872. X    va_start(args,fmt);
  2873. X    count = vsprintf(buf,fmt,args);
  2874. X    TextPutS(&textwin,buf);
  2875. X    va_end(args);
  2876. X    return count;
  2877. X}
  2878. X
  2879. Xsize_t MyFWrite(const void *ptr, size_t size, size_t n, FILE *file)
  2880. X{
  2881. X    if (isterm(file)) {
  2882. X        int i;
  2883. X        for (i=0; i<n; i++)
  2884. X            TextPutCh(&textwin, ((BYTE *)ptr)[i]);
  2885. X        TextMessage();
  2886. X        return n;
  2887. X    }
  2888. X    return fwrite(ptr, size, n, file);
  2889. X}
  2890. X
  2891. Xsize_t MyFRead(void *ptr, size_t size, size_t n, FILE *file)
  2892. X{
  2893. X    if (isterm(file)) {
  2894. X        int i;
  2895. X        for (i=0; i<n; i++)
  2896. X            ((BYTE *)ptr)[i] = TextGetChE(&textwin);
  2897. X        TextMessage();
  2898. X        return n;
  2899. X    }
  2900. X    return fread(ptr, size, n, file);
  2901. X}
  2902. END_OF_FILE
  2903.   if test 9026 -ne `wc -c <'gnuplot/win/winmain.c'`; then
  2904.     echo shar: \"'gnuplot/win/winmain.c'\" unpacked with wrong size!
  2905.   fi
  2906.   # end of 'gnuplot/win/winmain.c'
  2907. fi
  2908. echo shar: End of archive 24 \(of 33\).
  2909. cp /dev/null ark24isdone
  2910. MISSING=""
  2911. 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
  2912.     if test ! -f ark${I}isdone ; then
  2913.     MISSING="${MISSING} ${I}"
  2914.     fi
  2915. done
  2916. if test "${MISSING}" = "" ; then
  2917.     echo You have unpacked all 33 archives.
  2918.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2919. else
  2920.     echo You still must unpack the following archives:
  2921.     echo "        " ${MISSING}
  2922. fi
  2923. exit 0
  2924. exit 0 # Just in case...
  2925.