home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume12 / postscript / part04 < prev    next >
Text File  |  1987-11-01  |  55KB  |  3,193 lines

  1. Subject:  v12i053:  A PostScript interpreter, Part04/18
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: Crispin Goswell <caag@vd.rl.ac.uk>
  7. Posting-number: Volume 12, Issue 53
  8. Archive-name: postscript/part04
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 4 (of 18)."
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. if test -f 'postscript/fonts/Times/rest.r' -a "${1}" != "-c" ; then 
  19.   echo shar: Will not clobber existing file \"'postscript/fonts/Times/rest.r'\"
  20. else
  21. echo shar: Extracting \"'postscript/fonts/Times/rest.r'\" \(7361 characters\)
  22. sed "s/^X//" >'postscript/fonts/Times/rest.r' <<'END_OF_FILE'
  23. XCharStrings
  24. X/Pi
  25. X<C536
  26. X454A
  27. XC636
  28. X464A
  29. XD236
  30. X524A
  31. XD336
  32. X534A
  33. XC236
  34. X5636
  35. XC24A
  36. X494A
  37. XCF4A
  38. X564A
  39. X>
  40. Xput
  41. XMetrics
  42. X/Pi
  43. X[-2
  44. X24]
  45. Xput
  46. XCharStrings
  47. X/Sigma
  48. X<C336
  49. X4A3F
  50. X424A
  51. XC236
  52. X493F
  53. XC236
  54. X5136
  55. X523B
  56. X5036
  57. XC349
  58. X5049
  59. XC24A
  60. X514A
  61. X5245
  62. X504A
  63. X>
  64. Xput
  65. XMetrics
  66. X/Sigma
  67. X[0
  68. X21]
  69. Xput
  70. XCharStrings
  71. X/parenleft
  72. X<CB30
  73. X4932
  74. X4735
  75. X4539
  76. X443E
  77. X4442
  78. X4547
  79. X474B
  80. X494E
  81. X4B50
  82. XC932
  83. X4736
  84. X4639
  85. X453E
  86. X4542
  87. X4647
  88. X474A
  89. X494E
  90. X>
  91. Xput
  92. XMetrics
  93. X/parenleft
  94. X[9
  95. X14]
  96. Xput
  97. XCharStrings
  98. X/parenright
  99. X<C330
  100. X4532
  101. X4735
  102. X4939
  103. X4A3E
  104. X4A42
  105. X4947
  106. X474B
  107. X454E
  108. X4350
  109. XC532
  110. X4736
  111. X4839
  112. X493E
  113. X4942
  114. X4847
  115. X474A
  116. X454E
  117. X>
  118. Xput
  119. XMetrics
  120. X/parenright
  121. X[9
  122. X14]
  123. Xput
  124. XCharStrings
  125. X/Braceleft
  126. X<CA2E
  127. X4731
  128. X4534
  129. X4437
  130. X443A
  131. X453D
  132. X4844
  133. X4947
  134. X494A
  135. X484D
  136. X474F
  137. XC731
  138. X4633
  139. X4536
  140. X4539
  141. X463C
  142. X4943
  143. X4A46
  144. X4A49
  145. X494C
  146. X474F
  147. X4452
  148. X>
  149. Xput
  150. XMetrics
  151. X/Braceleft
  152. X[11
  153. X14]
  154. Xput
  155. XCharStrings
  156. X/Braceright
  157. X<C42E
  158. X4731
  159. X4934
  160. X4A37
  161. X4A3A
  162. X493D
  163. X4644
  164. X4547
  165. X454A
  166. X464D
  167. X474F
  168. XC731
  169. X4833
  170. X4936
  171. X4939
  172. X483C
  173. X4543
  174. X4446
  175. X4449
  176. X454C
  177. X474F
  178. X4A52
  179. X>
  180. Xput
  181. XMetrics
  182. X/Braceright
  183. X[11
  184. X14]
  185. Xput
  186. XCharStrings
  187. X/radical
  188. X<C240
  189. X4640
  190. X514E
  191. XC641
  192. X514F
  193. XC541
  194. X5150
  195. XD728
  196. X5150
  197. X>
  198. Xput
  199. XMetrics
  200. X/radical
  201. X[7
  202. X23]
  203. Xput
  204. XCharStrings
  205. X/integral
  206. X<D531
  207. X5432
  208. X5533
  209. X5632
  210. X5631
  211. X5530
  212. X5330
  213. X5131
  214. X4F33
  215. X4E35
  216. X4D38
  217. X4C3C
  218. X4A48
  219. X494C
  220. X484E
  221. XD032
  222. X4F34
  223. X4E38
  224. X4C44
  225. X4B48
  226. X4A4B
  227. X494D
  228. X474F
  229. X4550
  230. X4350
  231. X424F
  232. X424E
  233. X434D
  234. X444E
  235. X434F
  236. X>
  237. Xput
  238. XMetrics
  239. X/integral
  240. X[4
  241. X24]
  242. Xput
  243. XCharStrings
  244. X/aleph
  245. X<C337
  246. X4439
  247. X5045
  248. X5147
  249. X5149
  250. XC43A
  251. X5046
  252. XC337
  253. X4339
  254. X443B
  255. X5047
  256. X5149
  257. XC83E
  258. X4442
  259. X4344
  260. X4346
  261. X4448
  262. X4349
  263. XC344
  264. X4548
  265. XC442
  266. X4444
  267. X4546
  268. X4548
  269. X4349
  270. XCB41
  271. X503C
  272. XCE37
  273. X4E3A
  274. X4F3C
  275. X513C
  276. X513A
  277. X4F39
  278. X4E37
  279. XCE37
  280. X4F3A
  281. X513C
  282. X>
  283. Xput
  284. XMetrics
  285. X/aleph
  286. X[-1
  287. X20]
  288. Xput
  289. XCharStrings
  290. X/epsilon
  291. X<CE3C
  292. X4C3B
  293. X493B
  294. X463C
  295. X443E
  296. X4341
  297. X4344
  298. X4447
  299. X4548
  300. X4849
  301. X4B49
  302. X4D48
  303. XC93B
  304. X473C
  305. X453E
  306. X4441
  307. X4444
  308. X4547
  309. X4648
  310. X4849
  311. XC442
  312. X4C42
  313. X>
  314. Xput
  315. XMetrics
  316. X/epsilon
  317. X[-3
  318. X17]
  319. Xput
  320. XCharStrings
  321. X/theta
  322. X<CB34
  323. X4835
  324. X4638
  325. X453A
  326. X443D
  327. X4342
  328. X4346
  329. X4448
  330. X4649
  331. X4849
  332. X4B48
  333. X4D45
  334. X4E43
  335. X4F40
  336. X503B
  337. X5037
  338. X4F35
  339. X4D34
  340. X4B34
  341. XCB34
  342. X4935
  343. X4738
  344. X463A
  345. X453D
  346. X4442
  347. X4446
  348. X4548
  349. X4649
  350. XC849
  351. X4A48
  352. X4C45
  353. X4D43
  354. X4E40
  355. X4F3B
  356. X4F37
  357. X4E35
  358. X4D34
  359. XC53E
  360. X4E3E
  361. X>
  362. Xput
  363. XMetrics
  364. X/theta
  365. X[3
  366. X19]
  367. Xput
  368. XCharStrings
  369. X/phi
  370. X<CE34
  371. X4850
  372. XCF34
  373. X4750
  374. XCA3B
  375. X463C
  376. X443E
  377. X4341
  378. X4344
  379. X4446
  380. X4648
  381. X4949
  382. X4C49
  383. X5048
  384. X5246
  385. X5343
  386. X5340
  387. X523E
  388. X503C
  389. X4D3B
  390. X4A3B
  391. XCA3B
  392. X473C
  393. X453E
  394. X4441
  395. X4444
  396. X4546
  397. X4748
  398. X4949
  399. XCC49
  400. X4F48
  401. X5146
  402. X5243
  403. X5240
  404. X513E
  405. X4F3C
  406. X4D3B
  407. X>
  408. Xput
  409. XMetrics
  410. X/phi
  411. X[1
  412. X22]
  413. Xput
  414. XCharStrings
  415. X/zeta
  416. X<CB3B
  417. X4D3C
  418. X4F3E
  419. X4F3D
  420. X4E3C
  421. X4B3B
  422. X483B
  423. X453C
  424. X443D
  425. X433F
  426. X4341
  427. X4443
  428. X4645
  429. X4A48
  430. XC83B
  431. X463C
  432. X453D
  433. X443F
  434. X4441
  435. X4543
  436. X4A48
  437. X4B4A
  438. X4B4C
  439. X4A4D
  440. X484D
  441. X>
  442. Xput
  443. XMetrics
  444. X/2187
  445. X[-3
  446. X18]
  447. Xput
  448. XCharStrings
  449. X/weierstrass
  450. X<C53B
  451. X443C
  452. X433E
  453. X4340
  454. X4443
  455. X4847
  456. X4949
  457. XC340
  458. X4442
  459. X4846
  460. X4949
  461. X494B
  462. X484E
  463. X4650
  464. X4550
  465. X444F
  466. X434D
  467. X434A
  468. X4446
  469. X4642
  470. X483F
  471. X4B3C
  472. X4D3B
  473. X4F3B
  474. X523C
  475. X533E
  476. X5342
  477. X5246
  478. X5048
  479. X4E49
  480. X4D49
  481. X4C48
  482. X4C46
  483. X4D45
  484. X4E46
  485. X4D47
  486. XCF3B
  487. X513C
  488. X523E
  489. X5242
  490. X5146
  491. X5048
  492. X>
  493. Xput
  494. XMetrics
  495. X/weierstrass
  496. X[-3
  497. X22]
  498. Xput
  499. XCharStrings
  500. X/Doublebar
  501. X<C430
  502. X4450
  503. XCA30
  504. X4A50
  505. X>
  506. Xput
  507. XMetrics
  508. X/Doublebar
  509. X[9
  510. X14]
  511. Xput
  512. XCharStrings
  513. X/plusminus
  514. X<CC38
  515. X4C49
  516. XC440
  517. X5440
  518. XC449
  519. X5449
  520. X>
  521. Xput
  522. XMetrics
  523. X/plusminus
  524. X[-4
  525. X24]
  526. Xput
  527. XCharStrings
  528. X/Minusplus
  529. X<CC38
  530. X4C49
  531. XC438
  532. X5438
  533. XC440
  534. X5440
  535. X>
  536. Xput
  537. XMetrics
  538. X/Minusplus
  539. X[-4
  540. X24]
  541. Xput
  542. XCharStrings
  543. X/multiply
  544. X<C439
  545. X5247
  546. XD239
  547. X4447
  548. X>
  549. Xput
  550. XMetrics
  551. X/multiply
  552. X[-4
  553. X22]
  554. Xput
  555. XCharStrings
  556. X/dotmath
  557. X<C53F
  558. X4440
  559. X4541
  560. X4640
  561. X453F
  562. X>
  563. Xput
  564. XMetrics
  565. X/dotmath
  566. X[-4
  567. X10]
  568. Xput
  569. XCharStrings
  570. X/divide
  571. X<CD37
  572. X4C38
  573. X4D39
  574. X4E38
  575. X4D37
  576. XC440
  577. X5640
  578. XCD47
  579. X4C48
  580. X4D49
  581. X4E48
  582. X4D47
  583. X>
  584. Xput
  585. XMetrics
  586. X/divide
  587. X[-4
  588. X26]
  589. Xput
  590. XCharStrings
  591. X/notequal
  592. X<D437
  593. X4649
  594. XC43D
  595. X563D
  596. XC443
  597. X5643
  598. X>
  599. Xput
  600. XMetrics
  601. X/notequal
  602. X[-4
  603. X26]
  604. Xput
  605. XCharStrings
  606. X/equivalence
  607. X<C43B
  608. X563B
  609. XC440
  610. X5640
  611. XC445
  612. X5645
  613. X>
  614. Xput
  615. XMetrics
  616. X/equivalence
  617. X[-4
  618. X26]
  619. Xput
  620. XCharStrings
  621. X/lessequal
  622. X<D434
  623. X443B
  624. X5442
  625. XC444
  626. X5444
  627. XC449
  628. X5449
  629. X>
  630. Xput
  631. XMetrics
  632. X/lessequal
  633. X[0
  634. X24]
  635. Xput
  636. XCharStrings
  637. X/greaterequal
  638. X<C434
  639. X543B
  640. X4442
  641. XC444
  642. X5444
  643. XC449
  644. X5449
  645. X>
  646. Xput
  647. XMetrics
  648. X/greaterequal
  649. X[0
  650. X24]
  651. Xput
  652. XCharStrings
  653. X/proportional
  654. X<D545
  655. X5345
  656. X5144
  657. X4F42
  658. X4C3E
  659. X4B3D
  660. X493C
  661. X473C
  662. X453D
  663. X443F
  664. X4441
  665. X4543
  666. X4744
  667. X4944
  668. X4B43
  669. X4C42
  670. X4F3E
  671. X513C
  672. X533B
  673. X553B
  674. X>
  675. Xput
  676. XMetrics
  677. X/proportional
  678. X[-4
  679. X25]
  680. Xput
  681. XCharStrings
  682. X/similar
  683. X<C343
  684. X4341
  685. X443E
  686. X463D
  687. X483D
  688. X4A3E
  689. X4E41
  690. X5042
  691. X5242
  692. X5441
  693. X553F
  694. XC341
  695. X443F
  696. X463E
  697. X483E
  698. X4A3F
  699. X4E42
  700. X5043
  701. X5243
  702. X5442
  703. X553F
  704. X553D
  705. X>
  706. Xput
  707. XMetrics
  708. X/similar
  709. X[-3
  710. X24]
  711. Xput
  712. XCharStrings
  713. X/acute
  714. X<C834
  715. X433A
  716. XC834
  717. X4935
  718. X433A
  719. X>
  720. Xput
  721. XMetrics
  722. X/acute
  723. X[6
  724. X12]
  725. Xput
  726. XCharStrings
  727. X/grave
  728. X<C434
  729. X493A
  730. XC434
  731. X4335
  732. X493A
  733. X>
  734. Xput
  735. XMetrics
  736. X/grave
  737. X[6
  738. X12]
  739. Xput
  740. XCharStrings
  741. X/caron
  742. X<C334
  743. X4436
  744. X4638
  745. X4939
  746. X4B39
  747. X4E38
  748. X5036
  749. X5134
  750. XC334
  751. X4437
  752. X4639
  753. X493A
  754. X4B3A
  755. X4E39
  756. X5037
  757. X5134
  758. X>
  759. Xput
  760. XMetrics
  761. X/caron
  762. X[2
  763. X20]
  764. Xput
  765. XCharStrings
  766. X/Quoteleft
  767. X<C536
  768. X4635
  769. X4534
  770. X4435
  771. X4437
  772. X4539
  773. X463A
  774. X>
  775. Xput
  776. XMetrics
  777. X/Quoteleft
  778. X[7
  779. X10]
  780. Xput
  781. XCharStrings
  782. X/Quoteright
  783. X<C434
  784. X4535
  785. X4637
  786. X4639
  787. X453A
  788. X4439
  789. X4538
  790. X>
  791. Xput
  792. XMetrics
  793. X/Quoteright
  794. X[7
  795. X10]
  796. Xput
  797. XCharStrings
  798. X/radical
  799. X<C33B
  800. X473B
  801. X4D47
  802. XC63B
  803. X4D49
  804. XD630
  805. X4D49
  806. X>
  807. Xput
  808. XMetrics
  809. X/radical
  810. X[3
  811. X22]
  812. Xput
  813. XCharStrings
  814. X/propersubset
  815. X<D438
  816. X4D38
  817. X4939
  818. X473A
  819. X453C
  820. X443F
  821. X4441
  822. X4544
  823. X4746
  824. X4947
  825. X4D48
  826. X5448
  827. X>
  828. Xput
  829. XMetrics
  830. X/propersubset
  831. X[-4
  832. X24]
  833. Xput
  834. XCharStrings
  835. X/union
  836. X<C438
  837. X443F
  838. X4543
  839. X4645
  840. X4847
  841. X4B48
  842. X4D48
  843. X5047
  844. X5245
  845. X5343
  846. X543F
  847. X5438
  848. X>
  849. Xput
  850. XMetrics
  851. X/union
  852. X[-4
  853. X24]
  854. Xput
  855. XCharStrings
  856. X/propersuperset
  857. X<C438
  858. X4B38
  859. X4F39
  860. X513A
  861. X533C
  862. X543F
  863. X5441
  864. X5344
  865. X5146
  866. X4F47
  867. X4B48
  868. X4448
  869. X>
  870. Xput
  871. XMetrics
  872. X/propersuperset
  873. X[-4
  874. X24]
  875. Xput
  876. XCharStrings
  877. X/intersection
  878. X<C448
  879. X4441
  880. X453D
  881. X463B
  882. X4839
  883. X4B38
  884. X4D38
  885. X5039
  886. X523B
  887. X533D
  888. X5441
  889. X5448
  890. X>
  891. Xput
  892. XMetrics
  893. X/intersection
  894. X[-4
  895. X24]
  896. Xput
  897. XCharStrings
  898. X/element
  899. X<D438
  900. X4D38
  901. X4939
  902. X473A
  903. X453C
  904. X443F
  905. X4441
  906. X4544
  907. X4746
  908. X4947
  909. X4D48
  910. X5448
  911. XC440
  912. X5040
  913. X>
  914. Xput
  915. XMetrics
  916. X/element
  917. X[-4
  918. X24]
  919. Xput
  920. XCharStrings
  921. X/arrowright
  922. X<D33E
  923. X5640
  924. X5342
  925. XD03B
  926. X5540
  927. X5045
  928. XC440
  929. X5540
  930. X>
  931. Xput
  932. XMetrics
  933. X/arrowright
  934. X[-4
  935. X26]
  936. Xput
  937. XCharStrings
  938. X/arrowup
  939. X<C63A
  940. X4837
  941. X4A3A
  942. XC33D
  943. X4838
  944. X4D3D
  945. XC838
  946. X4849
  947. X>
  948. Xput
  949. XMetrics
  950. X/arrowup
  951. X[1
  952. X16]
  953. Xput
  954. XCharStrings
  955. X/arrowleft
  956. X<C73E
  957. X4440
  958. X4742
  959. XCA3B
  960. X4540
  961. X4A45
  962. XC540
  963. X5640
  964. X>
  965. Xput
  966. XMetrics
  967. X/arrowleft
  968. X[-4
  969. X26]
  970. Xput
  971. XCharStrings
  972. X/arrowdown
  973. X<C646
  974. X4849
  975. X4A46
  976. XC343
  977. X4848
  978. X4D43
  979. XC837
  980. X4848
  981. X>
  982. Xput
  983. XMetrics
  984. X/arrowdown
  985. X[1
  986. X16]
  987. Xput
  988. XCharStrings
  989. X/partialdiff
  990. X<CF40
  991. X4E3D
  992. X4D3C
  993. X4B3B
  994. X493B
  995. X463C
  996. X443F
  997. X4342
  998. X4345
  999. X4447
  1000. X4548
  1001. X4749
  1002. X4949
  1003. X4C48
  1004. X4E46
  1005. X4F43
  1006. X503E
  1007. X5039
  1008. X4F36
  1009. X4E35
  1010. X4C34
  1011. X4934
  1012. X4735
  1013. X4636
  1014. X4637
  1015. X4737
  1016. X4736
  1017. XC93B
  1018. X473C
  1019. X453F
  1020. X4442
  1021. X4446
  1022. X4548
  1023. XC949
  1024. X4B48
  1025. X4D46
  1026. X4E43
  1027. X4F3E
  1028. X4F39
  1029. X4E36
  1030. X4C34
  1031. X>
  1032. Xput
  1033. XMetrics
  1034. X/partialdiff
  1035. X[3
  1036. X19]
  1037. Xput
  1038. XCharStrings
  1039. X/gradient
  1040. X<C234
  1041. X4A49
  1042. XC334
  1043. X4A47
  1044. XD234
  1045. X4A49
  1046. XC234
  1047. X5234
  1048. XC335
  1049. X5135
  1050. X>
  1051. Xput
  1052. XMetrics
  1053. X/gradient
  1054. X[2
  1055. X20]
  1056. Xput
  1057. XCharStrings
  1058. X/Radical1
  1059. X<C33B
  1060. X483B
  1061. X5147
  1062. XC73C
  1063. X5149
  1064. XE128
  1065. X5149
  1066. X>
  1067. Xput
  1068. XMetrics
  1069. X/Radical1
  1070. X[7
  1071. X33]
  1072. Xput
  1073. XCharStrings
  1074. X/integral
  1075. X<D531
  1076. X5432
  1077. X5533
  1078. X5632
  1079. X5631
  1080. X5530
  1081. X5330
  1082. X5131
  1083. X4F33
  1084. X4E35
  1085. X4D38
  1086. X4C3C
  1087. X4A48
  1088. X494C
  1089. X484E
  1090. XD032
  1091. X4F34
  1092. X4E38
  1093. X4C44
  1094. X4B48
  1095. X4A4B
  1096. X494D
  1097. X474F
  1098. X4550
  1099. X4350
  1100. X424F
  1101. X424E
  1102. X434D
  1103. X444E
  1104. X434F
  1105. X>
  1106. Xput
  1107. XMetrics
  1108. X/integral
  1109. X[4
  1110. X24]
  1111. Xput
  1112. XCharStrings
  1113. X/florin
  1114. X<D531
  1115. X5432
  1116. X5533
  1117. X5632
  1118. X5631
  1119. X5530
  1120. X5330
  1121. X5131
  1122. X4F33
  1123. X4E35
  1124. X4D38
  1125. X4C3C
  1126. X4A48
  1127. X494C
  1128. X484E
  1129. XD032
  1130. X4F34
  1131. X4E38
  1132. X4C44
  1133. X4B48
  1134. X4A4B
  1135. X494D
  1136. X474F
  1137. X4550
  1138. X4350
  1139. X424F
  1140. X424E
  1141. X434D
  1142. X444E
  1143. X434F
  1144. XCB39
  1145. X483A
  1146. X463C
  1147. X453F
  1148. X4541
  1149. X4644
  1150. X4846
  1151. X4B47
  1152. X4D47
  1153. X5046
  1154. X5244
  1155. X5341
  1156. X533F
  1157. X523C
  1158. X503A
  1159. X4D39
  1160. X4B39
  1161. X>
  1162. Xput
  1163. XMetrics
  1164. X/florin
  1165. X[4
  1166. X24]
  1167. Xput
  1168. XCharStrings
  1169. X/infinity
  1170. X<D641
  1171. X5543
  1172. X5344
  1173. X5144
  1174. X4F43
  1175. X4E42
  1176. X4B3E
  1177. X4A3D
  1178. X483C
  1179. X463C
  1180. X443D
  1181. X433F
  1182. X4341
  1183. X4443
  1184. X4644
  1185. X4844
  1186. X4A43
  1187. X4B42
  1188. X4E3E
  1189. X4F3D
  1190. X513C
  1191. X533C
  1192. X553D
  1193. X563F
  1194. X5641
  1195. X>
  1196. Xput
  1197. XMetrics
  1198. X/infinity
  1199. X[-3
  1200. X25]
  1201. Xput
  1202. XCharStrings
  1203. X/section
  1204. X<CB37
  1205. X4A38
  1206. X4B39
  1207. X4C38
  1208. X4C37
  1209. X4B35
  1210. X4934
  1211. X4734
  1212. X4535
  1213. X4437
  1214. X4439
  1215. X453B
  1216. X473D
  1217. X4C40
  1218. XC53B
  1219. X4A3E
  1220. X4C40
  1221. X4D42
  1222. X4D44
  1223. X4C46
  1224. X4A48
  1225. XC63C
  1226. X443E
  1227. X4340
  1228. X4342
  1229. X4444
  1230. X4646
  1231. X4B49
  1232. XC444
  1233. X4947
  1234. X4B49
  1235. X4C4B
  1236. X4C4D
  1237. X4B4F
  1238. X4950
  1239. X4750
  1240. X454F
  1241. X444D
  1242. X444C
  1243. X454B
  1244. X464C
  1245. X454D
  1246. X>
  1247. Xput
  1248. XMetrics
  1249. X/section
  1250. X[4
  1251. X16]
  1252. Xput
  1253. XCharStrings
  1254. X/dagger
  1255. X<C834
  1256. X4736
  1257. X4838
  1258. X4936
  1259. X4834
  1260. XC834
  1261. X4850
  1262. XC83F
  1263. X4742
  1264. X4850
  1265. X4942
  1266. X483F
  1267. XC23B
  1268. X443C
  1269. X463B
  1270. X443A
  1271. X423B
  1272. XC23B
  1273. X4E3B
  1274. XCA3B
  1275. X4C3C
  1276. X4E3B
  1277. X4C3A
  1278. X4A3B
  1279. X>
  1280. Xput
  1281. XMetrics
  1282. X/dagger
  1283. X[4
  1284. X16]
  1285. Xput
  1286. XCharStrings
  1287. X/daggerdbl
  1288. X<C834
  1289. X4736
  1290. X4838
  1291. X4936
  1292. X4834
  1293. XC834
  1294. X4842
  1295. XC83E
  1296. X4740
  1297. X4944
  1298. X4846
  1299. X4744
  1300. X4940
  1301. X483E
  1302. XC842
  1303. X4850
  1304. XC84C
  1305. X474E
  1306. X4850
  1307. X494E
  1308. X484C
  1309. XC23B
  1310. X443C
  1311. X463B
  1312. X443A
  1313. X423B
  1314. XC23B
  1315. X4E3B
  1316. XCA3B
  1317. X4C3C
  1318. X4E3B
  1319. X4C3A
  1320. X4A3B
  1321. XC249
  1322. X444A
  1323. X4649
  1324. X4448
  1325. X4249
  1326. XC249
  1327. X4E49
  1328. XCA49
  1329. X4C4A
  1330. X4E49
  1331. X4C48
  1332. X4A49
  1333. X>
  1334. Xput
  1335. XMetrics
  1336. X/daggerdbl
  1337. X[4
  1338. X16]
  1339. Xput
  1340. XCharStrings
  1341. X/existential
  1342. X<CF34
  1343. X4F49
  1344. XC234
  1345. X4F34
  1346. XC73E
  1347. X4F3E
  1348. XC249
  1349. X4F49
  1350. X>
  1351. Xput
  1352. XMetrics
  1353. X/existential
  1354. X[3
  1355. X19]
  1356. Xput
  1357. END_OF_FILE
  1358. if test 7361 -ne `wc -c <'postscript/fonts/Times/rest.r'`; then
  1359.     echo shar: \"'postscript/fonts/Times/rest.r'\" unpacked with wrong size!
  1360. fi
  1361. # end of 'postscript/fonts/Times/rest.r'
  1362. fi
  1363. if test -f 'source/adapter.c' -a "${1}" != "-c" ; then 
  1364.   echo shar: Will not clobber existing file \"'source/adapter.c'\"
  1365. else
  1366. echo shar: Extracting \"'source/adapter.c'\" \(7459 characters\)
  1367. sed "s/^X//" >'source/adapter.c' <<'END_OF_FILE'
  1368. X/*
  1369. X * Copyright (C) Rutherford Appleton Laboratory 1987
  1370. X * 
  1371. X * This source may be copied, distributed, altered or used, but not sold for profit
  1372. X * or incorporated into a product except under licence from the author.
  1373. X * It is not in the public domain.
  1374. X * This notice should remain in the source unaltered, and any changes to the source
  1375. X * made by persons other than the author should be marked as such.
  1376. X * 
  1377. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  1378. X */
  1379. X#include "main.h"
  1380. X#include "graphics.h"
  1381. X#include <stdio.h>
  1382. X
  1383. X#include "protocol.h"
  1384. X
  1385. Xstruct hardware
  1386. X {
  1387. X     struct hardware *next;
  1388. X     int serial;
  1389. X     int width, height, iswin;
  1390. X };
  1391. X
  1392. Xstatic struct hardware *alloc_hard ();
  1393. Xchar *malloc ();
  1394. Xvoid send_hardware ();
  1395. Xstatic void GetTransferSize ();
  1396. X
  1397. Xstatic int transfer_size;
  1398. X
  1399. Xstruct hardware *InitHardware ()
  1400. X {
  1401. X     int width, height;
  1402. X     
  1403. X     master_protocol ();
  1404. X     Message ("InitHardware");
  1405. X     
  1406. X     width = recv_short (); height = recv_short ();
  1407. X     GetTransferSize ();
  1408. X     return alloc_hard (width, height, TRUE);
  1409. X }
  1410. X
  1411. Xstatic void GetTransferSize ()
  1412. X {
  1413. X     send_byte (GET_TRANSFERSIZE);
  1414. X     flush_protocol ();
  1415. X    transfer_size = recv_short ();
  1416. X }
  1417. X
  1418. Xint TransferSize ()
  1419. X {
  1420. X     return transfer_size;
  1421. X }
  1422. X
  1423. Xvoid SetTransfer (tran) float *tran;
  1424. X {
  1425. X    int i;
  1426. X    
  1427. X    send_byte (SET_TRANSFER);
  1428. X    for (i = 0; i < transfer_size; i++)
  1429. X        send_small (tran [i]);
  1430. X }
  1431. X
  1432. Xint ScreenSize (freq, rot) float freq, rot;
  1433. X {
  1434. X     send_byte (SCREEN_SIZE);
  1435. X     send_float (freq);
  1436. X     send_float (rot);
  1437. X     flush_protocol ();
  1438. X     
  1439. X     return recv_short ();
  1440. X }
  1441. X
  1442. Xvoid BuildScreen (freq, rotation, x, y) float freq, rotation, *x, *y;
  1443. X {
  1444. X     int i, size;
  1445. X     
  1446. X     send_byte (BUILD_SCREEN);
  1447. X     send_float (freq);
  1448. X     send_float (rotation);
  1449. X     flush_protocol ();
  1450. X     size = recv_short ();
  1451. X     
  1452. X     for (i = 0; i < size; i++)
  1453. X      {
  1454. X         x[i] = recv_small ();
  1455. X         y[i] = recv_small ();
  1456. X      }
  1457. X }
  1458. X
  1459. Xvoid SetScreen (freq, rotation, thresh) float freq, rotation, *thresh;
  1460. X {
  1461. X     int i, size = ScreenSize (freq, rotation);
  1462. X     send_byte (SET_SCREEN);
  1463. X     send_float (freq);
  1464. X     send_float (rotation);
  1465. X     
  1466. X     for (i = 0; i < size; i++)
  1467. X         send_small (thresh [i]);
  1468. X }
  1469. X
  1470. Xstruct hardware *NewWindowHardware (width, height) int width, height;
  1471. X {
  1472. X     struct hardware *res = alloc_hard (width, height, TRUE);
  1473. X    Message ("NewWindowHardware");
  1474. X    send_byte (NEW_WINDOW);
  1475. X    send_hardware (res);
  1476. X    send_short (width);
  1477. X    send_short (height);
  1478. X    
  1479. X    return res;
  1480. X }
  1481. X
  1482. Xstruct hardware *NewBitmapHardware (width, height) int width, height;
  1483. X {
  1484. X     struct hardware *res = alloc_hard (width, height, FALSE);
  1485. X     
  1486. X     Message ("NewBitmapHardware");
  1487. X     send_byte (NEW_BITMAP);
  1488. X     send_hardware (res);
  1489. X     send_short (width);
  1490. X     send_short (height);
  1491. X     
  1492. X     return res;
  1493. X }
  1494. X
  1495. Xint IsWindowHardware (h) struct hardware *h;
  1496. X {
  1497. X     if (h == NULL)
  1498. X         return TRUE;
  1499. X     return h->iswin;
  1500. X }
  1501. X
  1502. Xvoid DestroyHardware (h) struct hardware *h;
  1503. X {
  1504. X    if (h == NULL)
  1505. X        return;
  1506. X    Message ("DestroyHardware");
  1507. X    send_byte (DESTROY_HARDWARE);
  1508. X    send_hardware (h);
  1509. X    free_hard (h);
  1510. X }
  1511. X
  1512. Xvoid BitBlt (from, to, fromPoint, toPoint, ex, rop)
  1513. X    struct hardware *from, *to;
  1514. X    DevicePoint fromPoint, toPoint, ex;
  1515. X    int rop;
  1516. X {
  1517. X     if (to == NULL)
  1518. X         return;
  1519. X     Message ("BitBlt");
  1520. X     send_byte (BITBLT);
  1521. X     send_hardware (from);
  1522. X     send_hardware (to);
  1523. X     send_point (fromPoint);
  1524. X     send_point (toPoint);
  1525. X     send_point (ex);
  1526. X     send_byte (rop);
  1527. X }
  1528. X
  1529. Xvoid Paint (from, to, fromPoint, toPoint, ex, colour)
  1530. X    struct hardware *from, *to;
  1531. X    DevicePoint fromPoint, toPoint, ex;
  1532. X    Colour colour;
  1533. X {
  1534. X     if (to == NULL)
  1535. X         return;
  1536. X     Message ("Paint");
  1537. X     send_byte (PAINT);
  1538. X     send_hardware (from);
  1539. X     send_hardware (to);
  1540. X     send_point (fromPoint);
  1541. X     send_point (toPoint);
  1542. X     send_point (ex);
  1543. X     send_colour (colour);
  1544. X }
  1545. X
  1546. XMatrix DeviceMatrix (width, height) int width, height;
  1547. X {
  1548. X     Matrix m;
  1549. X     
  1550. X     Message ("DeviceMatrix");
  1551. X     send_byte (GET_MATRIX);
  1552. X     send_short (width);
  1553. X     send_short (height);
  1554. X     flush_protocol ();
  1555. X     m.A = recv_float ();
  1556. X     m.B = recv_float ();
  1557. X     m.C = recv_float ();
  1558. X     m.D = recv_float ();
  1559. X     m.tx = recv_float ();
  1560. X     m.ty = recv_float ();
  1561. X     
  1562. X     return m;
  1563. X }
  1564. X
  1565. XDevicePoint HardwareExtent (h) struct hardware *h;
  1566. X {
  1567. X    return h == NULL ? NewDevicePoint (0, 0) : NewDevicePoint (h->width, h->height);
  1568. X }
  1569. X
  1570. Xstruct hardware *HardwareFromString (s, width, height) unsigned char *s; int width, height;
  1571. X {
  1572. X    struct hardware *res = alloc_hard (width, height, FALSE);
  1573. X    
  1574. X    Message ("HardwareFromString");
  1575. X    send_byte (SEND_BITMAP);
  1576. X    send_hardware (res);
  1577. X     send_short (res->width);
  1578. X     send_short (res->height);
  1579. X    send_string (s, hard_size (res));
  1580. X    
  1581. X    return res;
  1582. X }
  1583. X
  1584. Xchar *StringFromHardware (h) struct hardware *h;
  1585. X {
  1586. X      unsigned len = hard_size (h);
  1587. X      char *s;
  1588. X      
  1589. X      Message ("StringFromHardware");
  1590. X    send_byte (GET_BITMAP);
  1591. X     send_hardware (h);
  1592. X     flush_protocol ();
  1593. X     recv_string ((s = malloc (len)), len);
  1594. X     
  1595. X     return s;
  1596. X }
  1597. X
  1598. Xvoid Line (h, fromPoint, toPoint, rop)
  1599. X    struct hardware *h;
  1600. X    DevicePoint fromPoint, toPoint;
  1601. X    int rop;
  1602. X {
  1603. X     if (h == NULL)
  1604. X         return;
  1605. X     Message ("Line");
  1606. X     send_byte (LINE);
  1607. X     send_hardware (h);
  1608. X     send_point (fromPoint);
  1609. X     send_point (toPoint);
  1610. X     send_byte (rop);
  1611. X }
  1612. X
  1613. Xvoid PaintLine (h, fromPoint, toPoint, colour)
  1614. X    struct hardware *h;
  1615. X    DevicePoint fromPoint, toPoint;
  1616. X    Colour colour;
  1617. X {
  1618. X     if (h == NULL)
  1619. X         return;
  1620. X     Message ("PaintLine");
  1621. X     send_byte (PAINT_LINE);
  1622. X     send_hardware (h);
  1623. X     send_point (fromPoint);
  1624. X     send_point (toPoint);
  1625. X     send_colour (colour);
  1626. X }
  1627. X
  1628. Xstatic struct hardware *FreeList = NULL;
  1629. Xstatic int next_serial = 1;
  1630. X
  1631. Xstatic struct hardware *alloc_hard (width, height, iswin) int width, height, iswin;
  1632. X {
  1633. X     struct hardware *res;
  1634. X     
  1635. X     if (FreeList == NULL)
  1636. X      {
  1637. X         res = (struct hardware *) malloc (sizeof (struct hardware));
  1638. X         res->serial = next_serial++;
  1639. X      }
  1640. X     else
  1641. X      {
  1642. X          res = FreeList;
  1643. X          FreeList = FreeList->next;
  1644. X      }
  1645. X     res->width = width;
  1646. X     res->height = height;
  1647. X     res->iswin = iswin;
  1648. X     
  1649. X     return res;
  1650. X }
  1651. X
  1652. Xfree_hard (h) struct hardware *h;
  1653. X {
  1654. X     if (h == NULL)
  1655. X         return;
  1656. X     h->next = FreeList;
  1657. X     FreeList = h;
  1658. X }
  1659. X
  1660. Xint size (width, height) int width, height;
  1661. X {
  1662. X     return (width + 7) / 8 * height;
  1663. X }
  1664. X
  1665. Xint hard_size (h) struct hardware *h;
  1666. X {
  1667. X     if (h == NULL)
  1668. X         return 0;
  1669. X     return size (h->width, h->height);
  1670. X }
  1671. X    
  1672. Xvoid send_hardware (h) struct hardware *h;
  1673. X {
  1674. X    send_short (h == NULL ? 0 : h->serial);
  1675. X }
  1676. X
  1677. Xvoid HardUpdate ()
  1678. X {
  1679. X    send_byte (HARD_FLUSH);
  1680. X     flush_protocol ();
  1681. X }
  1682. X
  1683. Xvoid UpdateControl (h, flag) struct hardware *h; int flag;
  1684. X {
  1685. X     send_byte (SET_UPDATE_CONTROL);
  1686. X     send_hardware (h);
  1687. X     send_byte (flag);
  1688. X }
  1689. X
  1690. Xvoid SetClipHardware (h, clip) struct hardware *h, *clip;
  1691. X {
  1692. X     send_byte (SET_CLIP_HARDWARE);
  1693. X     send_hardware (h);
  1694. X     send_hardware (clip);
  1695. X }
  1696. X
  1697. Xvoid PaintTrapezoid (to, lefttop, leftbottom, righttop, rightbottom, top, bottom, colour)
  1698. X    struct hardware *to;
  1699. X    DevicePoint lefttop, leftbottom, righttop, rightbottom;
  1700. X    int top, bottom;
  1701. X    Colour colour;
  1702. X {
  1703. X     if (to == NULL)
  1704. X         return;
  1705. X     Message ("PaintTrapezoid");
  1706. X     send_byte (PAINT_TRAPEZOID);
  1707. X     send_hardware (to);
  1708. X     send_point (lefttop);
  1709. X     send_point (leftbottom);
  1710. X     send_point (righttop);
  1711. X     send_point (rightbottom);
  1712. X     send_short (top);
  1713. X     send_short (bottom);
  1714. X     send_colour (colour);
  1715. X }
  1716. X
  1717. Xvoid BitBltTrapezoid (to, lefttop, leftbottom, righttop, rightbottom, top, bottom, rop)
  1718. X    struct hardware *to;
  1719. X    DevicePoint lefttop, leftbottom, righttop, rightbottom;
  1720. X    int top, bottom, rop;
  1721. X {
  1722. X     if (to == NULL)
  1723. X         return;
  1724. X     Message ("BitBltTrapezoid");
  1725. X     send_byte (BITBLT_TRAPEZOID);
  1726. X     send_hardware (to);
  1727. X     send_point (lefttop);
  1728. X     send_point (leftbottom);
  1729. X     send_point (righttop);
  1730. X     send_point (rightbottom);
  1731. X     send_short (top);
  1732. X     send_short (bottom);
  1733. X     send_byte (rop);
  1734. X }
  1735. END_OF_FILE
  1736. if test 7459 -ne `wc -c <'source/adapter.c'`; then
  1737.     echo shar: \"'source/adapter.c'\" unpacked with wrong size!
  1738. fi
  1739. # end of 'source/adapter.c'
  1740. fi
  1741. if test -f 'source/control.c' -a "${1}" != "-c" ; then 
  1742.   echo shar: Will not clobber existing file \"'source/control.c'\"
  1743. else
  1744. echo shar: Extracting \"'source/control.c'\" \(6608 characters\)
  1745. sed "s/^X//" >'source/control.c' <<'END_OF_FILE'
  1746. X/*
  1747. X * Copyright (C) Rutherford Appleton Laboratory 1987
  1748. X * 
  1749. X * This source may be copied, distributed, altered or used, but not sold for profit
  1750. X * or incorporated into a product except under licence from the author.
  1751. X * It is not in the public domain.
  1752. X * This notice should remain in the source unaltered, and any changes to the source
  1753. X * made by persons other than the author should be marked as such.
  1754. X * 
  1755. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  1756. X */
  1757. X#include <signal.h>
  1758. X#include "main.h"
  1759. X
  1760. X/*
  1761. X * This file implements the flow control operators of PostScript
  1762. X *
  1763. X * All operations are implemented using the ExecStack and without recursion.
  1764. X * This is to allow error recovery to operate cleanly.
  1765. X *
  1766. X * Actual control is acheived by stacking continuation operators for the looping
  1767. X * operators, declared thus:
  1768. X *
  1769. X */
  1770. X
  1771. Xstatic Object OpLoop, OpRepeat, OpStopped;
  1772. X
  1773. X/*
  1774. X * "loop", for example, stacks the following:
  1775. X *    proc
  1776. X *    OpLoop
  1777. X *    proc
  1778. X *    Nil
  1779. X *
  1780. X * OpLoop is the continuer, proc is the body code, passed as a parameter.
  1781. X *
  1782. X * Nil is placed at the bottom by each of the looping constructs, which are 'exit'able.
  1783. X * "exit" pops the exec stack until it encounters a Nil.
  1784. X *
  1785. X * A Marker is placed on the ExecStack to enclose a Stopped context.
  1786. X * A File is placed on the ExecStack to enclose a Run context.
  1787. X * A Nil is placed on the ExecStack to enclose a Looping construct.
  1788. X * "stop" will unwind the stack down to the Marker, ignoring any Nil or File it might find.
  1789. X * "exit" will baulk if it finds a Marker or File before a Nil.
  1790. X *
  1791. X */
  1792. X
  1793. Xstatic int PExec (), PIf (), PIfElse (), PRepeat (), PFor (), PLoop ();
  1794. Xstatic int PExit (), PCountExecStack ();
  1795. Xstatic int PQuit (), PStart ();    
  1796. Xint PStop (), PStopped ();
  1797. Xstatic int Repeat (), Loop (), Stopped ();
  1798. X
  1799. XInitControl ()
  1800. X {
  1801. X     OpRepeat     = MakeOp ("(repeat)",    Repeat,    0, 0, 3, 2);
  1802. X     OpLoop         = MakeOp ("(loop)",    Loop,    0, 0, 1, 2);
  1803. X     OpStopped    = MakeOp ("(stopped)",    Stopped,0, 1, 1, 0);
  1804. X     
  1805. X    InstallOp ("exec",    PExec,        1, 1, 0, 1, Poly);
  1806. X      InstallOp ("if",    PIf,        2, 0, 0, 1, Boolean, Array);
  1807. X     InstallOp ("ifelse",    PIfElse,    3, 0, 0, 1, Boolean, Array, Array);
  1808. X     InstallOp ("repeat",    PRepeat,    2, 0, 0, 4, Integer, Array);
  1809. X    InstallOp ("for",    PFor,        4, 0, 0, 6, Poly, Poly, Poly, Array);
  1810. X     InstallOp ("loop",    PLoop,        1, 0, 0, 4, Array);
  1811. X    InstallOp ("exit",    PExit,        0, 0, 0, 0);
  1812. X     InstallOp ("stop",    PStop,        0, 1, 0, 0);
  1813. X     InstallOp ("stopped",    PStopped,    1, 1, 0, 3, Array);
  1814. X     InstallOp ("quit",    PQuit,         0, 0, 0, 0);
  1815. X     InstallOp ("start",    PStart,     0, 0, 0, 0);
  1816. X     InstallOp ("countexecstack",
  1817. X                 PCountExecStack,0, 1, 0, 0);
  1818. X }
  1819. X
  1820. Xstatic int PExec (item) Object item;
  1821. X {
  1822. X    VOID Push (OpStack, item);
  1823. X    if (xCheck (item))
  1824. X     {
  1825. X         Object fn;
  1826. X         
  1827. X        fn = Lookup (TypeOf (item), Self);
  1828. X        if (TypeOf (fn) != Condition)
  1829. X            VOID Push (ExecStack, fn);
  1830. X     }
  1831. X    return TRUE;
  1832. X }
  1833. X
  1834. Xstatic int PIf (bool, proc) Object bool, proc;
  1835. X {
  1836. X    if (!xCheck (proc))
  1837. X        return Error (PTypeCheck);
  1838. X    if (BodyBoolean (bool))
  1839. X        VOID Push (ExecStack, proc);
  1840. X    return TRUE;
  1841. X }
  1842. X
  1843. Xstatic int PIfElse (bool, proc1, proc2) Object bool, proc1, proc2;
  1844. X {
  1845. X    if (!xCheck (proc1) || !xCheck (proc2))
  1846. X         return Error (PTypeCheck);
  1847. X    VOID Push (ExecStack, BodyBoolean (bool) ? proc1 : proc2);
  1848. X    return TRUE;
  1849. X }
  1850. X
  1851. Xstatic int PRepeat (count, proc) Object count, proc;
  1852. X {
  1853. X    if (!xCheck (proc))
  1854. X        return Error (PTypeCheck);
  1855. X    else if (BodyInteger (count) < 0)
  1856. X        return Error (PRangeCheck);
  1857. X    
  1858. X    VOID Push (ExecStack, Nil);
  1859. X    VOID Push (ExecStack, proc);
  1860. X    VOID Push (ExecStack, count);
  1861. X    VOID Push (ExecStack, OpRepeat);
  1862. X    
  1863. X    return TRUE;
  1864. X }
  1865. X
  1866. Xstatic int Repeat ()
  1867. X {
  1868. X     int count;
  1869. X
  1870. X    count = BodyInteger (Pop (ExecStack));
  1871. X     
  1872. X     if (count != 0)
  1873. X      {
  1874. X          Object proc;
  1875. X          
  1876. X          proc = Top (ExecStack);
  1877. X          VOID Push (ExecStack, MakeInteger (count - 1));
  1878. X          VOID Push (ExecStack, OpRepeat);
  1879. X          VOID Push (ExecStack, proc);
  1880. X      }
  1881. X     else
  1882. X      {
  1883. X         VOID Pop (ExecStack);
  1884. X         VOID Pop (ExecStack);
  1885. X      }
  1886. X    return TRUE;
  1887. X }
  1888. X
  1889. Xstatic int PFor (initial, increment, limit, proc) Object initial, increment, limit, proc;
  1890. X {
  1891. X     int integers = 0, reals = 0, res;
  1892. X     
  1893. X     if (!xCheck (proc))
  1894. X         return Error (PTypeCheck);
  1895. X    
  1896. X     if (TypeOf (initial) == Integer || TypeOf (initial) == Real)
  1897. X         integers += TypeOf (initial) == Integer,
  1898. X         reals += TypeOf (initial) == Real;
  1899. X     
  1900. X     if (TypeOf (increment) == Integer || TypeOf (increment) == Real)
  1901. X         integers += TypeOf (increment) == Integer,
  1902. X         reals += TypeOf (increment) == Real;
  1903. X     
  1904. X     if (TypeOf (limit) == Integer || TypeOf (limit) == Real)
  1905. X         integers += TypeOf (limit) == Integer,
  1906. X         reals += TypeOf (limit) == Real;
  1907. X         
  1908. X     if (integers + reals == 3 && integers != 3 && reals != 3)
  1909. X      {
  1910. X          if (TypeOf (initial) == Integer)
  1911. X              initial = RealInteger (initial);
  1912. X          if (TypeOf (increment) == Integer)
  1913. X              increment = RealInteger (increment);
  1914. X          if (TypeOf (limit) == Integer)
  1915. X              limit = RealInteger (limit);
  1916. X      }
  1917. X     if (res = Apply (TypeOf (initial)))
  1918. X      {
  1919. X          VOID Push (OpStack, initial);
  1920. X          VOID Push (OpStack, increment);
  1921. X         VOID Push (OpStack, limit);
  1922. X        VOID Push (OpStack, proc);
  1923. X     }
  1924. X     return res;
  1925. X }
  1926. Xstatic int PLoop (proc) Object proc;
  1927. X {
  1928. X     if (!xCheck (proc))
  1929. X         return Error (PTypeCheck);
  1930. X    
  1931. X     VOID Push (ExecStack, Nil);
  1932. X    VOID Push (ExecStack, proc);
  1933. X    VOID Push (ExecStack, OpLoop);
  1934. X    VOID Push (ExecStack, proc);
  1935. X    
  1936. X    return TRUE;
  1937. X }
  1938. X
  1939. Xstatic int Loop ()     /* proc --- */
  1940. X {
  1941. X     Object proc;
  1942. X     
  1943. X     proc = Top (ExecStack);
  1944. X    VOID Push (ExecStack, OpLoop);
  1945. X    VOID Push (ExecStack, proc);
  1946. X    return TRUE;
  1947. X }
  1948. X
  1949. Xstatic int PExit ()
  1950. X {
  1951. X     int n, m, p;
  1952. X     
  1953. X     if ((n = CountTo (Null, ExecStack)) < 0
  1954. X             || (m = CountTo (Mark, ExecStack)) >= 0 && m < n    /* don't cross Stopped Context */
  1955. X             || (p = CountTo (File, ExecStack)) >= 0 && p < n)    /* don't cross Run context */
  1956. X         return Error (PInvExit);
  1957. X     VOID ClearTo (Null, ExecStack);
  1958. X     return TRUE;
  1959. X }
  1960. X
  1961. Xint PStop ()    /* --- */
  1962. X {
  1963. X     Object item;
  1964. X     
  1965. X     for (;;)
  1966. X      {
  1967. X         if (Height (ExecStack) == 0)
  1968. X          {
  1969. X              if (interactive)
  1970. X                 return Push (ExecStack, Cvx (NameFrom ("executive")));
  1971. X             else
  1972. X                 return TRUE;
  1973. X          }
  1974. X         item = Pop (ExecStack);
  1975. X         if (item.type == Mark)
  1976. X              return Push (OpStack, True);
  1977. X      }
  1978. X }
  1979. X
  1980. Xstatic int Stopped ()
  1981. X {
  1982. X    VOID Pop (ExecStack);
  1983. X    VOID Push (OpStack, False);
  1984. X    return TRUE;
  1985. X }
  1986. X
  1987. Xint PStopped (proc) Object proc;
  1988. X {
  1989. X    VOID Push (ExecStack, Marker);
  1990. X    VOID Push (ExecStack, OpStopped);
  1991. X    VOID Push (ExecStack, proc);
  1992. X    return TRUE;
  1993. X }
  1994. X
  1995. Xstatic int PCountExecStack ()
  1996. X {
  1997. X    VOID Push (OpStack, MakeInteger (Height (ExecStack)));
  1998. X    return TRUE;
  1999. X }
  2000. X
  2001. X/*
  2002. X * PExecStack ()
  2003. X *
  2004. X * This routine is in stack.c
  2005. X *
  2006. X */
  2007. X
  2008. Xstatic int PQuit ()
  2009. X {
  2010. X     Cleanup ();
  2011. X    exit (0);
  2012. X    
  2013. X    return TRUE; /* never will */
  2014. X }
  2015. X
  2016. Xstatic int PStart ()
  2017. X {
  2018. X     return TRUE;
  2019. X }
  2020. END_OF_FILE
  2021. if test 6608 -ne `wc -c <'source/control.c'`; then
  2022.     echo shar: \"'source/control.c'\" unpacked with wrong size!
  2023. fi
  2024. # end of 'source/control.c'
  2025. fi
  2026. if test -f 'source/orion.c' -a "${1}" != "-c" ; then 
  2027.   echo shar: Will not clobber existing file \"'source/orion.c'\"
  2028. else
  2029. echo shar: Extracting \"'source/orion.c'\" \(6758 characters\)
  2030. sed "s/^X//" >'source/orion.c' <<'END_OF_FILE'
  2031. X/*
  2032. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2033. X * 
  2034. X * This source may be copied, distributed, altered or used, but not sold for profit
  2035. X * or incorporated into a product except under licence from the author.
  2036. X * It is not in the public domain.
  2037. X * This notice should remain in the source unaltered, and any changes to the source
  2038. X * made by persons other than the author should be marked as such.
  2039. X * 
  2040. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2041. X */
  2042. X#include <graphics/grafix.h>
  2043. X#include <graphics/window.h>
  2044. X#include <stdio.h>
  2045. X
  2046. X#include "orion.h"
  2047. X
  2048. Xint rop_map [16];
  2049. X
  2050. Xstruct hardware
  2051. X {
  2052. X    WindowPtr win;
  2053. X    BitMapPtr bm;
  2054. X };
  2055. X
  2056. Xstatic int VirtualCol [256], nVirtual, transfer [256], bi_level [256];
  2057. X
  2058. Xstatic void InitRopMap (), InitVirtualColours ();
  2059. Xstatic struct hardware *NewHardware ();
  2060. X
  2061. Xchar *malloc (), *getenv (), *strcpy (), *strcat ();
  2062. X
  2063. Xstruct hardware *InitHardware ()
  2064. X {
  2065. X    InitGraf ();
  2066. X    
  2067. X    InitVirtualColours ();
  2068. X    InitRopMap ();
  2069. X    
  2070. X    return NewWindowHardware (1, 1);
  2071. X }
  2072. X
  2073. Xstruct hardware *NewBitmapHardware (w, h) int w, h;
  2074. X {
  2075. X     BitMapPtr res = (BitMapPtr) malloc (sizeof (BitMap));
  2076. X     
  2077. X     *res = NewRBitMap (w, h, 1);
  2078. X    return NewHardware ((WindowPtr) NULL, res);
  2079. X }
  2080. X
  2081. Xstruct hardware *NewWindowHardware (w, h) int w, h;
  2082. X {
  2083. X    Rect r;
  2084. X    WindowPtr win;
  2085. X    
  2086. X    SetRect (&r, 0, 25, w, h);
  2087. X    win = NewWindow (NIL, r, "PostScript", VISIBLE, documentProc, FRONT, NOGOAWAY, 0, 7);
  2088. X    
  2089. X    return NewHardware (win, &win->port.portBits);
  2090. X }
  2091. X
  2092. Xint IsWindowHardware (h) struct hardware *h;
  2093. X {
  2094. X    return h->win != (WindowPtr) NULL;
  2095. X }
  2096. X
  2097. Xvoid DestroyHardware (dev) struct hardware *dev;
  2098. X {
  2099. X    if (dev->win != (WindowPtr) NULL)
  2100. X        /* DisposeWindow (dev->win) ? */;
  2101. X    else
  2102. X        DisposeRBitMap (dev->bm);
  2103. X    Free ((char *) dev);
  2104. X }
  2105. X
  2106. Xstatic void InitRopMap ()
  2107. X {
  2108. X    rop_map [ROP_FALSE]    = R_ZERO;            /*  0 0000 */
  2109. X    rop_map [ROP_AND]     = R_AND;            /* 11 1011 */
  2110. X    rop_map [ROP_ANDNOT]    = R_SOURCE_AND_NOT_DEST;    /*  8 1000 */
  2111. X    rop_map [ROP_SOURCE]     = R_SOURCE;            /*  5 0101 */
  2112. X    rop_map [ROP_NOTAND]     = R_NOT_SOURCE_AND_DEST;    /*  7 0111 */
  2113. X    rop_map [ROP_DEST]    = R_DEST;            /*  3 0011 */
  2114. X    rop_map [ROP_XOR]     = R_XOR;            /*  9 1001 */
  2115. X    rop_map [ROP_OR]     = R_OR;                /* 15 1111 */
  2116. X    rop_map [ROP_NOR]    = R_NOR;            /*  6 0110 */
  2117. X    rop_map [ROP_NXOR]     = R_XNOR;            /* 12 1100 */
  2118. X    rop_map [ROP_NOTDEST]    = R_NOT_DEST;            /*  2 0010 */
  2119. X    rop_map [ROP_ORNOT]    = R_SOURCE_OR_NOT_DEST;        /* 14 1110 */
  2120. X    rop_map [ROP_NOTSOURCE]    = R_NOT_SOURCE;            /*  4 0100 */
  2121. X    rop_map [ROP_NOTOR]     = R_NOT_SOURCE_OR_DEST;        /* 13 1101 */
  2122. X    rop_map [ROP_NAND]    = R_NAND;            /* 10 1010 */
  2123. X    rop_map [ROP_TRUE]    = R_ONE;            /*  1 0001 */
  2124. X }
  2125. X
  2126. Xstatic ColMap default_cm = {
  2127. X    0, srcCopy,
  2128. X    0, srcCopy,
  2129. X    0, srcCopy,
  2130. X    0, srcCopy,
  2131. X    0, srcCopy,
  2132. X    0, srcCopy,
  2133. X    0, srcCopy,
  2134. X    0, srcCopy
  2135. X};
  2136. X
  2137. XSCM (col, mode, from, to)
  2138. X    int col, mode;
  2139. X    ColMap *from, *to;
  2140. X {
  2141. X    int i, imode = InverseMode (mode);
  2142. X
  2143. X    for (i = 0; i < 8; i++)
  2144. X     {
  2145. X        to->colMapEnt[i].plane = 0;
  2146. X        to->colMapEnt[i].mode = (col & (1 << i)) ? mode : imode;
  2147. X     }
  2148. X }
  2149. X
  2150. XUpdateHardware (h, r) struct hardware *h; Rect r;
  2151. X {
  2152. X    if (IsWindowHardware (h))
  2153. X     {
  2154. X        AddUpdate (h->win, r, 0xff);
  2155. X        UpdateWindow (h->win);
  2156. X     }
  2157. X }
  2158. X
  2159. XPrintRect (r) Rect r;
  2160. X {
  2161. X    fprintf (stderr, "[(%d, %d) (%d, %d)]\n", left (r), top (r), width (r), height (r));
  2162. X }
  2163. X
  2164. XSR (r, l, t, w, h) Rect *r; int l, t, w, h;
  2165. X {
  2166. X    left (*r) = l;
  2167. X    top (*r) = t;
  2168. X    width (*r) = w;
  2169. X    height (*r) = h;
  2170. X }
  2171. X
  2172. Xvoid BitBlt (from, to, fromPoint, toPoint, ex, rop, colour)
  2173. X    struct hardware *from, *to;
  2174. X    DevicePoint fromPoint, toPoint, ex;
  2175. X    int rop;
  2176. X    Colour colour;
  2177. X {
  2178. X     Rect sr, dr;
  2179. X     int col = HardColour (colour, (IsWindowHardware (to) ? transfer : bi_level));
  2180. X     ColMap cm;
  2181. X     
  2182. X     if (to->bm == NULL)
  2183. X         return;
  2184. X     SR (&sr, fromPoint.dx, fromPoint.dy, ex.dx, ex.dy);
  2185. X     SR (&dr, toPoint.dx, toPoint.dy, ex.dx, ex.dy);
  2186. X     SCM (col, rop_map [rop], &default_cm, &cm);
  2187. X     MapPlanes (from->bm, to->bm, &sr, &dr, &cm.colMapEnt[0]);
  2188. X    UpdateHardware (to, dr);
  2189. X }
  2190. X
  2191. XMapPlanes (sb, db, sr, dr, cm)
  2192. X    BitMapPtr sb, db;
  2193. X    Rect *sr, *dr;
  2194. X    CMEPtr cm;
  2195. X {
  2196. X    int i;
  2197. X    BitMap sbm, dbm;
  2198. X    sbm = *sb; dbm = *db;
  2199. X    sbm.nPlanes = 1; dbm.nPlanes = 1;
  2200. X    
  2201. X    for (i = 0; i < db->nPlanes; i++)
  2202. X     {
  2203. X         sbm.baseAddr = sbm.baseAddr + sbm.planeSize * (7 - cm[i].plane);
  2204. X         CopyBits (&sbm, &dbm, *sr, *dr, cm[7 - i].mode);
  2205. X         dbm.baseAddr += dbm.planeSize;
  2206. X     }
  2207. X }
  2208. X
  2209. X/*ARGSUSED*/
  2210. XMatrix DeviceMatrix (w, h) int w, h;
  2211. X {
  2212. X    return NewMatrix (PIXELS_PER_INCH / 72.0, 0.0, 0.0, -PIXELS_PER_INCH / 72.0, 0.0, (float) h);
  2213. X }
  2214. X
  2215. XDevicePoint HardwareExtent (h) struct hardware *h;
  2216. X {
  2217. X    return NewDevicePoint (width (h->bm->bounds), height (h->bm->bounds));
  2218. X }
  2219. X
  2220. Xstatic struct hardware *NewHardware (win, bm) WindowPtr win; BitMapPtr bm;
  2221. X {
  2222. X     struct hardware *res = (struct hardware *) malloc (sizeof (struct hardware));
  2223. X     
  2224. X     res->win = win;
  2225. X     res->bm = bm;
  2226. X     
  2227. X     return res;
  2228. X }
  2229. X
  2230. Xstatic int HardColour (colour, transfer) Colour colour; int *transfer;
  2231. X {
  2232. X    return VirtualCol [transfer [(int) ((nVirtual - 1) * colour.brightness + 0.5)]];
  2233. X }
  2234. X
  2235. Xint TransferSize ()
  2236. X {
  2237. X     return nVirtual;
  2238. X }
  2239. X
  2240. Xvoid SetTransfer (tran) float *tran;
  2241. X {
  2242. X    int i;
  2243. X
  2244. X    for (i = 0; i < nVirtual; i++)
  2245. X        transfer [i] = (nVirtual - 1) * tran[i] + .5;
  2246. X }
  2247. X
  2248. Xstatic void InitVirtualColours ()
  2249. X {
  2250. X    int i = 0, from, to, j;
  2251. X    char name [BUFSIZ];
  2252. X    FILE *fp;
  2253. X    
  2254. X    (void) strcpy (name, getenv ("HOME"));
  2255. X    (void) strcat (name, "/.pscolourmap");
  2256. X    
  2257. X    PanicIf (((fp = fopen (name, "r")) == NULL && (fp = fopen ("/etc/.pscolourmap", "r")) == NULL),
  2258. X        ".pscolourmap not found");
  2259. X    
  2260. X    while (fscanf (fp, "%d %d\n", &from, &to) == 2)
  2261. X        for (j = from; j <= to; j++)
  2262. X            VirtualCol [i++] = j;
  2263. X    fclose (fp);
  2264. X    nVirtual = i;
  2265. X    
  2266. X    for (i = 0; i < nVirtual; i++)
  2267. X     {
  2268. X         int b = 250 * (float) i / nVirtual + 0.5;
  2269. X         
  2270. X         SetCLTE (VirtualCol [i], b, b, b);
  2271. X     }
  2272. X    
  2273. X    for (i = 0; i < nVirtual; i++)
  2274. X     {
  2275. X        transfer [i] = i;
  2276. X        bi_level [i] = (i < nVirtual / 2) ? 0 : nVirtual - 1;
  2277. X     }
  2278. X }
  2279. X
  2280. Xstruct hardware *HardwareFromString (s, w, h) char *s; int w, h;
  2281. X {
  2282. X     char *to;
  2283. X     int i, sw = (w + 7) / 8, dw;
  2284. X     
  2285. X     BitMapPtr bmp = (BitMapPtr) malloc (sizeof (BitMap));
  2286. X     
  2287. X     *bmp = NewRBitMap (w, h, 1);
  2288. X     to = bmp->baseAddr;
  2289. X     dw = bmp->rowBits / 8;
  2290. X     
  2291. X     for (i = 0; i < h; i++)
  2292. X      {
  2293. X          (void) Bcopy (to, s, sw);
  2294. X          to += dw;
  2295. X          s += sw;
  2296. X      }
  2297. X     
  2298. X     return NewHardware ((WindowPtr) NULL, bmp);
  2299. X }
  2300. X
  2301. Xchar *StringFromHardware (d) struct hardware *d;
  2302. X {
  2303. X    unsigned sw, sh, dw = d->bm->rowBits;
  2304. X    char *res, *p, *q = d->bm->baseAddr;
  2305. X    DevicePoint ex;
  2306. X    int i;
  2307. X    
  2308. X    ex = HardwareExtent (d);
  2309. X    sw = (ex.dx + 7) / 8;
  2310. X    sh = ex.dy;
  2311. X    p = res = malloc (sw * sh);
  2312. X    
  2313. X    for (i = 0; i < sh; i++)
  2314. X     {
  2315. X         (void) Bcopy (p, q, sw);
  2316. X         p += sw; q += dw;
  2317. X     }
  2318. X    
  2319. X    return res;
  2320. X }
  2321. X
  2322. Xvoid Line (h, fromPoint, toPoint, rop, colour)
  2323. X    struct hardware *h;
  2324. X    DevicePoint fromPoint, toPoint;
  2325. X    int rop;
  2326. X    Colour colour;
  2327. X {
  2328. X    
  2329. X }
  2330. X
  2331. XSetCLTE (col, r, g, b) int col, r, g, b;
  2332. X {
  2333. X/*    fprintf (stderr, "%d = (%d, %d, %d)\n", col, r, g, b);    */
  2334. X }
  2335. X
  2336. XHardUpdate ()
  2337. X {
  2338. X }
  2339. END_OF_FILE
  2340. if test 6758 -ne `wc -c <'source/orion.c'`; then
  2341.     echo shar: \"'source/orion.c'\" unpacked with wrong size!
  2342. fi
  2343. # end of 'source/orion.c'
  2344. fi
  2345. if test -f 'source/real.c' -a "${1}" != "-c" ; then 
  2346.   echo shar: Will not clobber existing file \"'source/real.c'\"
  2347. else
  2348. echo shar: Extracting \"'source/real.c'\" \(6703 characters\)
  2349. sed "s/^X//" >'source/real.c' <<'END_OF_FILE'
  2350. X/*
  2351. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2352. X * 
  2353. X * This source may be copied, distributed, altered or used, but not sold for profit
  2354. X * or incorporated into a product except under licence from the author.
  2355. X * It is not in the public domain.
  2356. X * This notice should remain in the source unaltered, and any changes to the source
  2357. X * made by persons other than the author should be marked as such.
  2358. X * 
  2359. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2360. X */
  2361. X#include "main.h"
  2362. X
  2363. Xstatic Object OpFor;
  2364. X
  2365. Xstatic int For (), PFor (), Eq (), Lt (), Le (), Gt (), Ge (), Identity ();
  2366. Xstatic int Abs (), Add (), Sub (), Mul (), Div (), Neg (), EqEq (), Cvi (), Cvs ();
  2367. Xstatic int Exp (), Sqrt (), Sin (), Cos (), Atan (), Ln (), Log (), Ceiling (), Floor (), Round (), Truncate ();
  2368. X
  2369. XInitReal ()
  2370. X {
  2371. X     OpFor = MakeOp ("(forreal)", For, 0, 1, 5, 6, Real, Real, Real, Array);
  2372. X     
  2373. X    TypeInstallOp (Real, "cvr",     Identity,    1, 1, 0, 0, Real);
  2374. X     TypeInstallOp (Real, "cvi",     Cvi,        1, 1, 0, 0, Real);
  2375. X     TypeInstallOp (Real, "cvs",     Cvs,        2, 1, 0, 0, Real, String);
  2376. X    TypeInstallOp (Real, "==",     EqEq,        1, 0, 0, 0, Real);
  2377. X     TypeInstallOp (Real, "for",     PFor,        4, 0, 0, 6, Real, Real, Real, Array);
  2378. X      TypeInstallOp (Real, "eq",     Eq,        2, 1, 0, 0, Real, Real);
  2379. X      TypeInstallOp (Real, "lt",     Lt,        2, 1, 0, 0, Real, Real);
  2380. X     TypeInstallOp (Real, "le",     Le,        2, 1, 0, 0, Real, Real);
  2381. X     TypeInstallOp (Real, "gt",     Gt,        2, 1, 0, 0, Real, Real);
  2382. X     TypeInstallOp (Real, "ge",     Ge,        2, 1, 0, 0, Real, Real);
  2383. X    TypeInstallOp (Real, "abs",     Abs,        1, 1, 0, 0, Real);
  2384. X     TypeInstallOp (Real, "add",    Add,        2, 1, 0, 0, Real, Real);
  2385. X     TypeInstallOp (Real, "sub",     Sub,        2, 1, 0, 0, Real, Real);
  2386. X     TypeInstallOp (Real, "mul",     Mul,        2, 1, 0, 0, Real, Real);
  2387. X     TypeInstallOp (Real, "div",     Div,        2, 1, 0, 0, Real, Real);
  2388. X     TypeInstallOp (Real, "neg",     Neg,        1, 1, 0, 0, Real);
  2389. X     TypeInstallOp (Real, "exp",     Exp,        2, 1, 0, 0, Real, Real);
  2390. X     TypeInstallOp (Real, "sqrt",     Sqrt,        1, 1, 0, 0, Real);
  2391. X     TypeInstallOp (Real, "sin",     Sin,        1, 1, 0, 0, Real);
  2392. X     TypeInstallOp (Real, "cos",     Cos,        1, 1, 0, 0, Real);
  2393. X     TypeInstallOp (Real, "atan",    Atan,        2, 1, 0, 0, Real, Real);
  2394. X     TypeInstallOp (Real, "ln",     Ln,        1, 1, 0, 0, Real);
  2395. X     TypeInstallOp (Real, "log",    Log,        1, 1, 0, 0, Real);
  2396. X     TypeInstallOp (Real, "ceiling", Ceiling,    1, 1, 0, 0, Real);
  2397. X     TypeInstallOp (Real, "floor",     Floor,        1, 1, 0, 0, Real);
  2398. X     TypeInstallOp (Real, "round",     Round,        1, 1, 0, 0, Real);
  2399. X     TypeInstallOp (Real, "truncate",Truncate,    1, 1, 0, 0, Real);
  2400. X }
  2401. X
  2402. XObject MakeReal (f) float f;
  2403. X {
  2404. X     Object res;
  2405. X     
  2406. X     res = MakeObject (Real);
  2407. X     res.u.Real = f;
  2408. X     
  2409. X     return res;
  2410. X }
  2411. X
  2412. Xstatic Object Make (f) float f;
  2413. X {
  2414. X     Object res;
  2415. X     
  2416. X     res = MakeObject (Real);
  2417. X     res.u.Real = f;
  2418. X     
  2419. X     return res;
  2420. X }
  2421. X
  2422. Xstatic int Identity (item) Object item;
  2423. X {
  2424. X    return Push (OpStack, item);
  2425. X }
  2426. X
  2427. Xstatic int Cvi (item) Object item;
  2428. X {
  2429. X     return Push (OpStack, IntReal (item));
  2430. X }
  2431. X
  2432. Xstatic int Cvs (v, string) Object v, string;
  2433. X {
  2434. X     char buf [BUFSIZ];
  2435. X     int length;
  2436. X     
  2437. X    VOID sprintf (buf, "%g", BodyReal (v));
  2438. X    if ((length = strlen (buf)) > lengthString (string))
  2439. X        return Error (PRangeCheck);
  2440. X    VOID Bcopy (BodyString (string), buf, length);
  2441. X    return Push (OpStack, getIString (string, 0, length));
  2442. X }
  2443. X
  2444. Xstatic int EqEq (v) Object v;
  2445. X {
  2446. X    printf ("%g", BodyReal (v));
  2447. X    return TRUE;
  2448. X }
  2449. X
  2450. Xfloat BodyReal (item) Object item;
  2451. X {
  2452. X     return item.u.Real;
  2453. X }
  2454. X
  2455. Xstatic float Body (item) Object item;
  2456. X {
  2457. X    return item.u.Real;
  2458. X }
  2459. X
  2460. XObject RealInteger (o) Object o;
  2461. X {
  2462. X     return Make ((float) BodyInteger (o));
  2463. X }
  2464. X
  2465. Xstatic int PFor (initial, increment, limit, proc) Object initial, increment, limit, proc;
  2466. X {
  2467. X    VOID Push (ExecStack, Nil);
  2468. X    VOID Push (ExecStack, increment);
  2469. X    VOID Push (ExecStack, limit);
  2470. X    VOID Push (ExecStack, initial);
  2471. X    VOID Push (ExecStack, proc);
  2472. X    VOID Push (ExecStack, OpFor);
  2473. X    
  2474. X    return TRUE;
  2475. X }
  2476. X
  2477. Xstatic int For () 
  2478. X {
  2479. X    Object current, limit, increment, proc;
  2480. X    
  2481. X    proc      = Pop (ExecStack);
  2482. X    current   = Pop (ExecStack);
  2483. X    limit      = Pop (ExecStack);
  2484. X    increment = Pop (ExecStack);
  2485. X    
  2486. X    if (Body (increment) > 0
  2487. X                ? Body (current) > Body (limit)
  2488. X                : Body (current) < Body (limit))
  2489. X         VOID Pop (ExecStack);
  2490. X    else
  2491. X     {
  2492. X         VOID Push (ExecStack, increment);
  2493. X         VOID Push (ExecStack, limit);
  2494. X         VOID Push (ExecStack, Make (Body (current) + Body (increment)));
  2495. X         VOID Push (ExecStack, proc);
  2496. X         VOID Push (ExecStack, OpFor);
  2497. X         VOID Push (ExecStack, proc);
  2498. X         VOID Push (OpStack, current);
  2499. X     }
  2500. X    return TRUE;
  2501. X }
  2502. X
  2503. Xstatic int Eq (a, b) Object a, b;
  2504. X {
  2505. X     return Push (OpStack, MakeBoolean (Body (a) == Body (b)));
  2506. X }
  2507. X
  2508. Xstatic int Lt (a, b) Object a, b;
  2509. X {
  2510. X     return Push (OpStack, MakeBoolean (Body (a) < Body (b)));
  2511. X }
  2512. X
  2513. Xstatic int Le (a, b) Object a, b;
  2514. X {
  2515. X     return Push (OpStack, MakeBoolean (Body (a) <= Body (b)));
  2516. X }
  2517. X
  2518. Xstatic int Gt (a, b) Object a, b;
  2519. X {
  2520. X     return Push (OpStack, MakeBoolean (Body (a) > Body (b)));
  2521. X }
  2522. X
  2523. Xstatic int Ge (a, b) Object a, b;
  2524. X {
  2525. X     return Push (OpStack, MakeBoolean (Body (a) >= Body (b)));
  2526. X }
  2527. X
  2528. Xstatic int Abs (v) Object v;
  2529. X {
  2530. X      return Push (OpStack, Make (Body (v) >= 0 ? Body (v) : -Body (v)));
  2531. X }
  2532. X
  2533. Xstatic int Add (a, b) Object a, b;
  2534. X {
  2535. X     return Push (OpStack, Make (Body (a) + Body (b)));
  2536. X }
  2537. X
  2538. Xstatic int Sub (a, b) Object a, b;
  2539. X {
  2540. X     return Push (OpStack, Make (Body (a) - Body (b)));
  2541. X }
  2542. X
  2543. Xstatic int Mul (a, b) Object a, b;
  2544. X {
  2545. X     return Push (OpStack, Make (Body (a) * Body (b)));
  2546. X }
  2547. X
  2548. Xstatic int Div (a, b) Object a, b;
  2549. X {
  2550. X     return Push (OpStack, Make (Body (a) / Body (b)));
  2551. X }
  2552. X
  2553. Xstatic int Neg (a) Object a;
  2554. X {
  2555. X    return Push (OpStack, Make (-Body (a)));
  2556. X }
  2557. X
  2558. Xstatic int Sqrt (v) Object v;
  2559. X {
  2560. X     return Push (OpStack, Make ((float) sqrt ((double) Body (v))));
  2561. X }
  2562. X
  2563. Xstatic int Exp (a, b) Object a, b;
  2564. X {
  2565. X    return Push (OpStack, Make ((float) pow ((double) Body (a), (double) Body (b))));
  2566. X }
  2567. X
  2568. Xstatic int Ceiling (v) Object v;
  2569. X {
  2570. X     return Push (OpStack, Make ((float) ceil ((double) Body (v))));
  2571. X }
  2572. X
  2573. Xstatic int Floor (v) Object v;
  2574. X {
  2575. X     return Push (OpStack, Make ((float) floor ((double) Body (v))));
  2576. X }
  2577. X
  2578. Xstatic int Round (v) Object v;
  2579. X {
  2580. X    return Push (OpStack, Make (Body (v) - floor ((double) Body (v)) >= 0.5
  2581. X                     ? ceil ((double) Body (v))
  2582. X                     : floor ((double) Body (v))));
  2583. X }
  2584. X
  2585. Xstatic int Truncate (v) Object v;
  2586. X {
  2587. X     return Push (OpStack, Make (Body (v) < 0 ? ceil (Body (v)) : floor (Body (v))));
  2588. X }
  2589. X
  2590. Xstatic int Atan (a, b) Object a, b;
  2591. X {
  2592. X     return Push (OpStack, Make ((float) Deg (atan2 (Body (a), Body (b)))));
  2593. X }
  2594. X
  2595. Xstatic int Cos (v) Object v;
  2596. X {
  2597. X     return Push (OpStack, Make (cos (Rad (Body (v)))));
  2598. X }
  2599. X
  2600. Xstatic int Sin (v) Object v;
  2601. X {
  2602. X     return Push (OpStack, Make (sin (Rad (Body (v)))));
  2603. X }
  2604. X
  2605. Xstatic int Ln (v) Object v;
  2606. X {
  2607. X     return Push (OpStack, Make (log (Body (v))));
  2608. X }
  2609. X
  2610. Xstatic int Log (v) Object v;
  2611. X {
  2612. X     return Push (OpStack, Make (log10 (Body (v))));
  2613. X }
  2614. END_OF_FILE
  2615. if test 6703 -ne `wc -c <'source/real.c'`; then
  2616.     echo shar: \"'source/real.c'\" unpacked with wrong size!
  2617. fi
  2618. # end of 'source/real.c'
  2619. fi
  2620. if test -f 'source/stack.c' -a "${1}" != "-c" ; then 
  2621.   echo shar: Will not clobber existing file \"'source/stack.c'\"
  2622. else
  2623. echo shar: Extracting \"'source/stack.c'\" \(6765 characters\)
  2624. sed "s/^X//" >'source/stack.c' <<'END_OF_FILE'
  2625. X/*
  2626. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2627. X * 
  2628. X * This source may be copied, distributed, altered or used, but not sold for profit
  2629. X * or incorporated into a product except under licence from the author.
  2630. X * It is not in the public domain.
  2631. X * This notice should remain in the source unaltered, and any changes to the source
  2632. X * made by persons other than the author should be marked as such.
  2633. X * 
  2634. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2635. X */
  2636. X#include "main.h"
  2637. X
  2638. X#define   OPSTACKSIZE    500
  2639. X#define EXECSTACKSIZE    250
  2640. X#define DICTSTACKSIZE     20
  2641. X
  2642. Xstatic StackOb    DStack, EStack, OStack;
  2643. X    
  2644. XStack    DictStack = &DStack;
  2645. XStack    ExecStack = &EStack;
  2646. XStack    OpStack   = &OStack;
  2647. X
  2648. Xstatic int PPop (), PDup (), PExch (), PRoll (), PIndex (), PClear (), PCount (), PClearToMark (); 
  2649. Xstatic int PCountToMark (), PExecStack (), PCountDictStack (), PDictStack ();
  2650. Xstatic int PReverseStack ();
  2651. X
  2652. Xstatic StackOb MakeStack ();
  2653. X
  2654. XInitStack ()
  2655. X {
  2656. X    DStack    = MakeStack (DICTSTACKSIZE, PDictOverflow,    PDictUnderflow);
  2657. X        VOID Push (DictStack, SysDict);
  2658. X        
  2659. X    OStack    = MakeStack (  OPSTACKSIZE, POpOverflow,    POpUnderflow);
  2660. X    EStack    = MakeStack (EXECSTACKSIZE, PExecOverflow,    PExecUnderflow);
  2661. X    
  2662. X    Install ("mark", Marker);
  2663. X    
  2664. X    InstallOp ("pop",        PPop,        1, 0, 0, 0, Poly);
  2665. X    InstallOp ("dup",        PDup,        1, 2, 0, 0, Poly);
  2666. X    InstallOp ("exch",        PExch,        2, 2, 0, 0, Poly, Poly);
  2667. X    InstallOp ("roll",        PRoll,        2, 0, 0, 0, Integer, Integer);
  2668. X    InstallOp ("index",        PIndex,        1, 1, 0, 0, Integer);
  2669. X    InstallOp ("clear",        PClear,        0, 0, 0, 0);
  2670. X    InstallOp ("count",        PCount,        0, 1, 0, 0);
  2671. X    InstallOp ("cleartomark",    PClearToMark,    0, 0, 0, 0);
  2672. X    InstallOp ("counttomark",    PCountToMark,    0, 1, 0, 0);
  2673. X    InstallOp ("execstack",        PExecStack,    1, 1, 0, 0, Array);
  2674. X    InstallOp ("countdictstack",    PCountDictStack,0, 1, 0, 0);
  2675. X    InstallOp ("dictstack",        PDictStack,    1, 1, 0, 0, Array);
  2676. X    InstallOp ("reversestack",    PReverseStack,    1, 0, 0, 0, Integer);
  2677. X }
  2678. X
  2679. Xstatic StackOb MakeStack (size, over, under) int size; Object over, under;
  2680. X {
  2681. X    StackOb res;
  2682. X    
  2683. X    res.stack_body = (Object *) Malloc ((unsigned) sizeof (Object) * size);
  2684. X    res.stack_fill = 0; res.stack_size = size;
  2685. X    res.overflow = over; res.underflow = under;
  2686. X    
  2687. X    return res;
  2688. X }
  2689. X
  2690. X#ifdef notdef
  2691. Xint Push (stack, object) Stack stack; Object object;
  2692. X {
  2693. X    if (stack->stack_fill != stack->stack_size)
  2694. X        stack->stack_body[stack->stack_fill++] = object;
  2695. X    else
  2696. X        return FALSE;
  2697. X    return TRUE;
  2698. X }
  2699. X
  2700. XObject Pop (stack) Stack stack;
  2701. X {
  2702. X    if (stack->stack_fill)
  2703. X         return stack->stack_body[--stack->stack_fill];
  2704. X    printf ("%s", stack == OpStack ? "OpStack" : stack == ExecStack ? "ExecStack" : "OtherStack");
  2705. X    Panic (": Pop empty stack");
  2706. X    return Nil; /* for lint */
  2707. X }
  2708. X
  2709. XObject Top (stack) Stack stack;
  2710. X {
  2711. X    if (stack->stack_fill)
  2712. X         return stack->stack_body[stack->stack_fill - 1];
  2713. X    printf ("%s", stack == OpStack ? "OpStack" : stack == ExecStack ? "ExecStack" : "OtherStack");
  2714. X    Panic (": Top empty stack");
  2715. X    return Nil; /* for lint */
  2716. X }
  2717. X
  2718. Xint Height (s) Stack s;
  2719. X {
  2720. X     return s->stack_fill;
  2721. X }
  2722. X
  2723. Xint MaxStack (s) Stack s;
  2724. X {
  2725. X     return s->stack_size;
  2726. X }
  2727. X#endif
  2728. X
  2729. XObject DictLookup (o) Object o;
  2730. X {
  2731. X     int i;
  2732. X     
  2733. X     for (i = DictStack->stack_fill - 1; i >= 0; i--)
  2734. X      {
  2735. X          Object item;
  2736. X          
  2737. X          item = DictLoad (DictStack->stack_body[i], o);
  2738. X         if (TypeOf (item) != Condition)
  2739. X             return item;
  2740. X      }
  2741. X     return Absent;
  2742. X }
  2743. X
  2744. XObject Where (key) Object key;
  2745. X {
  2746. X     int i;
  2747. X     
  2748. X     for (i = DictStack->stack_fill - 1; i >= 0; i--)
  2749. X      {
  2750. X          Object t;
  2751. X          
  2752. X          t = DictLoad (DictStack->stack_body[i], key);
  2753. X          if (TypeOf (t) != Condition)
  2754. X             return DictStack->stack_body[i];
  2755. X      }
  2756. X     return Absent;
  2757. X }
  2758. X
  2759. Xstatic reverse (vec, n) Object *vec; int n;
  2760. X {
  2761. X     Object temp;
  2762. X     int i, lim = n / 2;
  2763. X     
  2764. X     for (i = 0; i < lim; i++)
  2765. X         temp = vec[i],
  2766. X         vec[i] = vec[n-1-i],
  2767. X         vec[n-1-i] = temp;
  2768. X }
  2769. X
  2770. Xint CountTo (t, s) Type t; Stack s;
  2771. X {
  2772. X     int i;
  2773. X     
  2774. X     Object *body = s->stack_body;
  2775. X     
  2776. X     for (i = Height (s) - 1; i >= 0; i--)
  2777. X         if (TypeOf (body[i]) == t)
  2778. X             return Height (s) - i - 1;
  2779. X     return -1;
  2780. X }
  2781. X
  2782. Xint ClearTo (t, s) Type t; Stack s;
  2783. X {
  2784. X     int count;
  2785. X     
  2786. X     if ((count = CountTo (t, s)) >= 0)
  2787. X        s->stack_fill = s->stack_fill - (count + 1);
  2788. X    else
  2789. X        return FALSE;
  2790. X    return TRUE;
  2791. X }
  2792. X
  2793. Xstatic int PCountDictStack ()
  2794. X {
  2795. X     return Push (OpStack, MakeInteger (DictStack->stack_fill));
  2796. X }
  2797. X
  2798. Xstatic int PDictStack (array) Object array;
  2799. X {
  2800. X    Object *body = DictStack->stack_body;
  2801. X    int i, l = Height (DictStack);
  2802. X    
  2803. X     if (!wCheck (array))
  2804. X         return Error (PInvAccess);
  2805. X     if (l > lengthArray (array))
  2806. X         return Error (PRangeCheck);
  2807. X    for (i = 0; i < l; i++)
  2808. X         putArray (array, i, body[i]);
  2809. X     return Push (OpStack, getIArray (array, 0, l));
  2810. X }
  2811. X
  2812. X/*ARGSUSED*/
  2813. Xstatic int PPop (item) Object item;
  2814. X {
  2815. X     return TRUE;
  2816. X }
  2817. X
  2818. Xstatic int PDup (item) Object item;
  2819. X {
  2820. X     return Push (OpStack, item), Push (OpStack, item);
  2821. X }
  2822. X
  2823. Xstatic int PExch (a, b) Object a, b;
  2824. X {
  2825. X     return Push (OpStack, b), Push (OpStack, a);
  2826. X }
  2827. X
  2828. Xstatic int PRoll (size, count) Object size, count;
  2829. X {
  2830. X    int s = BodyInteger (size), c = BodyInteger (count);
  2831. X    Object *body = OpStack->stack_body + Height (OpStack) - s;
  2832. X    
  2833. X     if (BodyInteger (size) < 0)
  2834. X         return Error (PRangeCheck);
  2835. X     if (BodyInteger (size) > Height (OpStack))
  2836. X         return Error (POpUnderflow);
  2837. X     if (BodyInteger (size) == 0)
  2838. X         return TRUE;
  2839. X    if (c > 0)
  2840. X     {
  2841. X         c = c % s;
  2842. X        reverse (body, s - c);
  2843. X        reverse (body + s - c, c);
  2844. X     }
  2845. X    else
  2846. X     {
  2847. X         c = (-c) % s;
  2848. X        reverse (body, c);
  2849. X        reverse (body + c, s - c);
  2850. X     }
  2851. X    reverse (body, s);
  2852. X    return TRUE;
  2853. X }
  2854. X
  2855. Xstatic int PIndex (index) Object index;
  2856. X {
  2857. X     if (BodyInteger (index) >= Height (OpStack) || BodyInteger (index) < 0)
  2858. X         return Error (PRangeCheck);
  2859. X     return Push (OpStack, OpStack->stack_body[Height (OpStack) - 1 - BodyInteger (index)]);
  2860. X }
  2861. X
  2862. Xstatic int PClear ()
  2863. X {
  2864. X     OpStack->stack_fill = 0;
  2865. X     return TRUE;
  2866. X }
  2867. X
  2868. Xstatic int PCount ()
  2869. X {
  2870. X    return Push (OpStack, MakeInteger (Height (OpStack)));
  2871. X }
  2872. X
  2873. Xstatic int PClearToMark ()
  2874. X {
  2875. X     if (ClearTo (Mark, OpStack))
  2876. X         return TRUE;
  2877. X     else
  2878. X         return Error (PUnMatched);
  2879. X }
  2880. X
  2881. Xstatic int PCountToMark ()
  2882. X {
  2883. X     int count;
  2884. X     
  2885. X     if ((count = CountTo (Mark, OpStack)) >= 0)
  2886. X         return Push (OpStack, MakeInteger (count));
  2887. X     else
  2888. X         return Error (PUnMatched);
  2889. X }
  2890. X
  2891. Xstatic int PExecStack (array) Object array;
  2892. X {
  2893. X    int i, l = Height (ExecStack);
  2894. X     Object *body = ExecStack->stack_body;
  2895. X    
  2896. X    if(!wCheck (array))
  2897. X        return Error (PInvAccess);
  2898. X    if (l > lengthArray (array))
  2899. X        return Error (PRangeCheck);
  2900. X    for (i = 0; i < l; i++)
  2901. X        putArray (array, i, body[i]);
  2902. X    VOID Push (OpStack, getIArray (array, 0, l));
  2903. X    return TRUE;
  2904. X }
  2905. X
  2906. XReverseStack (stack, n) Stack stack; int n;
  2907. X {
  2908. X     Object *body = stack->stack_body;
  2909. X     
  2910. X     reverse (&body[Height (stack) - n], n);
  2911. X }
  2912. X
  2913. Xstatic int PReverseStack (n) Object n;
  2914. X {
  2915. X     if (BodyInteger (n) > Height (OpStack))
  2916. X         return Error (PRangeCheck);
  2917. X     ReverseStack (OpStack, BodyInteger (n));
  2918. X     return TRUE;
  2919. X }
  2920. END_OF_FILE
  2921. if test 6765 -ne `wc -c <'source/stack.c'`; then
  2922.     echo shar: \"'source/stack.c'\" unpacked with wrong size!
  2923. fi
  2924. # end of 'source/stack.c'
  2925. fi
  2926. if test -f 'source/ww.c' -a "${1}" != "-c" ; then 
  2927.   echo shar: Will not clobber existing file \"'source/ww.c'\"
  2928. else
  2929. echo shar: Extracting \"'source/ww.c'\" \(6749 characters\)
  2930. sed "s/^X//" >'source/ww.c' <<'END_OF_FILE'
  2931. X/*
  2932. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2933. X * 
  2934. X * This source may be copied, distributed, altered or used, but not sold for profit
  2935. X * or incorporated into a product except under licence from the author.
  2936. X * It is not in the public domain.
  2937. X * This notice should remain in the source unaltered, and any changes to the source
  2938. X * made by persons other than the author should be marked as such.
  2939. X * 
  2940. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2941. X */
  2942. X#include "main.h"
  2943. X#include "graphics.h"
  2944. X#include "canon.h"
  2945. X#include "wwinfo.h"
  2946. X
  2947. Xstatic void xxrasterop ();
  2948. X
  2949. Xstatic struct hardware *NewHardware ();
  2950. X
  2951. Xstruct hardware *InitHardware ()
  2952. X {
  2953. X    wwstartup (2);
  2954. X    
  2955. X    InitTransfer (wwask (ASKXPPI));
  2956. X    
  2957. X    return NULL;
  2958. X }
  2959. X
  2960. Xstruct hardware *NewWindowHardware (width, height) int width, height;
  2961. X {
  2962. X     DevicePoint real_extent;
  2963. X     window *w;
  2964. X     
  2965. X     real_extent = NewDevicePoint (width, height);
  2966. X     
  2967. X     if (width == 0)
  2968. X         width = 1;
  2969. X     if (height == 0)
  2970. X         height = 1;
  2971. X     
  2972. X     if ((w = wwxget (boxbuild (0, 0, width, height), 2, "PostScript", 0)) == NULL)
  2973. X         return NULL;
  2974. X     return NewHardware (w->w_bm, real_extent, ISWIN);
  2975. X }
  2976. X
  2977. Xstruct hardware *NewBitmapHardware (width, height) int width, height;
  2978. X {
  2979. X     DevicePoint real_extent;
  2980. X     bitmap *bm;
  2981. X     
  2982. X     real_extent = NewDevicePoint (width, height);
  2983. X     
  2984. X     if (width == 0)
  2985. X         width = 1;
  2986. X     if (height == 0)
  2987. X         height = 1;
  2988. X     if ((bm = bmget (width, height)) == NULL)
  2989. X         return NULL;
  2990. X     
  2991. X     return NewHardware (bm, real_extent, 0);
  2992. X }
  2993. X
  2994. X#define DeviceBitmap(h) ((bitmap *) ((h)->hard.addr))
  2995. X
  2996. Xstatic void DestroyHard (dev) struct hardware *dev;
  2997. X {
  2998. X     bitmap *bm = DeviceBitmap (dev);
  2999. X     
  3000. X     if (bm)
  3001. X      {
  3002. X          if (bm->bm_window)
  3003. X              wwfree (bm->bm_window);
  3004. X         else
  3005. X             bmfree (bm);
  3006. X      }
  3007. X }
  3008. X
  3009. Xvoid DestroyHardware (dev) struct hardware *dev;
  3010. X {
  3011. X     if (dev == NULL)
  3012. X         return;
  3013. X     DestroyHard (dev);
  3014. X     if (dev->aux)
  3015. X         DestroyHardware (dev->aux);
  3016. X     Free ((char *) dev);
  3017. X }
  3018. X
  3019. Xstatic struct hardware *NewHardware (bm, extent, flags) bitmap *bm; DevicePoint extent; int flags;
  3020. X {
  3021. X     struct hardware *d = (struct hardware *) Malloc (sizeof (struct hardware));
  3022. X     
  3023. X     d->flags = flags;
  3024. X     d->hard.addr = (char *) bm;
  3025. X     d->aux = d->clip = NULL;
  3026. X     d->extent = extent;
  3027. X     
  3028. X     return d;
  3029. X }
  3030. X
  3031. Xstruct hardware *HardwareFromString (st, width, height) char *st; int width, height;
  3032. X {
  3033. X     unsigned size = height * (width + 7) / 8;
  3034. X     char *s = Malloc (size + 4);
  3035. X     struct hardware *h;
  3036. X     
  3037. X     s[0] = height >> 8; s[1] = height;
  3038. X     s[2] = width >> 8;  s[3] = width;
  3039. X     Bcopy (s + 4, st, size);
  3040. X     
  3041. X     h = NewHardware (bmdecode (s, ENWWSTYLE), NewDevicePoint (width, height), 0);
  3042. X     Free ((char *) s);
  3043. X     
  3044. X     return h;
  3045. X }
  3046. X
  3047. Xchar *StringFromHardware (dev) struct hardware *dev;
  3048. X {
  3049. X     int length;
  3050. X     
  3051. X     return bmencode (DeviceBitmap (dev), ENWWSTYLE, &length) + 4;
  3052. X }
  3053. X
  3054. Xvoid UpdateControl (h, flag) struct hardware *h; int flag;
  3055. X {
  3056. X     window *oldddwin = ddwin;
  3057. X     
  3058. X     if (h == NULL)
  3059. X         return;
  3060. X     ddwin = DeviceBitmap (h)->bm_window;
  3061. X     if (ddwin)
  3062. X        wwstack (flag ? WWPOP : WWPUSHOFF);
  3063. X    ddwin = oldddwin;
  3064. X }
  3065. X
  3066. Xvoid RasterTile (from, to, toPoint, extent, rop)
  3067. X    struct hardware *from, *to;
  3068. X    DevicePoint toPoint, extent;
  3069. X    int rop;
  3070. X {
  3071. X     if (to == NULL || extent.dx == 0 || extent.dy == 0)
  3072. X         return;
  3073. X     bmclip (DeviceBitmap (to), boxbuild (toPoint.dx, toPoint.dy, toPoint.dx + extent.dx - 1, toPoint.dy + extent.dy - 1));
  3074. X     xxrasterop (DeviceBitmap (from), DeviceBitmap (from)->bm_box, DeviceBitmap (to), DeviceBitmap (to)->bm_box, rop);
  3075. X     bmclip (DeviceBitmap (to), noclipbox);
  3076. X }
  3077. X
  3078. Xvoid BitBlt (from, to, fromPoint, toPoint, extent, rop)
  3079. X    struct hardware *from, *to;
  3080. X    DevicePoint fromPoint, toPoint, extent;
  3081. X    int rop;
  3082. X {
  3083. X    box frombox, tobox;
  3084. X    
  3085. X    if (to == NULL || extent.dx == 0 || extent.dy == 0)
  3086. X         return;
  3087. X    
  3088. X     if (from == NULL)
  3089. X         rop = single_rop [rop];
  3090. X     else
  3091. X         frombox = boxbuild (fromPoint.dx, fromPoint.dy, fromPoint.dx + extent.dx - 1, fromPoint.dy + extent.dy - 1);
  3092. X     
  3093. X      tobox = boxbuild (toPoint.dx, toPoint.dy, toPoint.dx + extent.dx - 1, toPoint.dy + extent.dy - 1);
  3094. X    
  3095. X    xxrasterop ((from == NULL ? NULL : DeviceBitmap (from)), frombox, DeviceBitmap (to), tobox, rop);
  3096. X }
  3097. X
  3098. Xvoid BitBltLine (h, fromPoint, toPoint, rop) 
  3099. X      struct hardware *h;
  3100. X    DevicePoint fromPoint, toPoint;
  3101. X    int rop;
  3102. X {
  3103. X     if (h == NULL)
  3104. X         return;
  3105. X     
  3106. X    switch (single_rop [rop])
  3107. X     {
  3108. X         case ROP_FALSE:     rop = WWAND;     break;
  3109. X         case ROP_TRUE:      rop = WWOR;      break;
  3110. X         case ROP_NOTDEST:     rop = WWXOR;     break;
  3111. X         case ROP_DEST:         return;     break;
  3112. X         
  3113. X         default:
  3114. X             fprintf (stderr, "illegal rasterop\n");
  3115. X             exit (1);
  3116. X     }
  3117. X    
  3118. X    ddbm = DeviceBitmap (h);
  3119. X     dd->d_line = rop;
  3120. X     
  3121. X    line (fromPoint.dx, fromPoint.dy, LNMOVEABS);
  3122. X     line (toPoint.dx, toPoint.dy, LNDRAWABS);
  3123. X }
  3124. X
  3125. Xvoid BitBltBlob (to, top, height, left, right, rop) struct hardware *to; int top, height, *left, *right, rop;
  3126. X {
  3127. X     int i, op, offset = top;
  3128. X     height += top;
  3129. X     switch (rop)
  3130. X      {
  3131. X          case ROP_FALSE:     op = BMCLEARALL; break;
  3132. X          case ROP_DEST:         return;
  3133. X          case ROP_NOTDEST:     op = BMNOTALL; break;
  3134. X          case ROP_TRUE:         op = BMNOTALL | BMCLEARALL; break;
  3135. X      }
  3136. X     ddbm = DeviceBitmap (to);
  3137. X     UpdateControl (to, FALSE);
  3138. X     for (i = top; i < height; i++)
  3139. X         bmbox (boxbuild (left[i - offset], i, right[i - offset], i), op);
  3140. X     UpdateControl (to, TRUE);
  3141. X }
  3142. X
  3143. Xstatic void xxrasterop (from, frombox, to, tobox, rop) bitmap *from, *to; box frombox, tobox; int rop;
  3144. X {
  3145. X    switch (rop)
  3146. X      {
  3147. X          case ROP_FALSE:                                 bmxbox (to, tobox, BMCLEARALL);    break;
  3148. X          case ROP_AND:         bmxcopy (from, frombox, to, tobox, WWAND);                         break;
  3149. X          case ROP_ANDNOT:    bmxcopy (from, frombox, to, tobox, WWOR | WWNOT);   bmxbox (to, tobox, BMNOTALL);     break;
  3150. X         case ROP_SOURCE:     bmxcopy (from, frombox, to, tobox, WWCOPY);                         break;
  3151. X         case ROP_NOTAND:     bmxcopy (from, frombox, to, tobox, WWAND | WWNOT);                     break;
  3152. X          case ROP_DEST:                                                     break;
  3153. X          case ROP_XOR:        bmxcopy (from, frombox, to, tobox, WWXOR);                         break;
  3154. X           case ROP_OR:        bmxcopy (from, frombox, to, tobox, WWOR);                         break;
  3155. X           case ROP_NOR:        bmxcopy (from, frombox, to, tobox, WWOR);         bmxbox (to, tobox, BMNOTALL);     break;
  3156. X           case ROP_NXOR:        bmxcopy (from, frombox, to, tobox, WWXOR);         bmxbox (to, tobox, BMNOTALL);     break;
  3157. X         case ROP_NOTDEST:                                 bmxbox (to, tobox, BMNOTALL);     break;
  3158. X         case ROP_ORNOT:        bmxcopy (from, frombox, to, tobox, WWAND | WWNOT);  bmxbox (to, tobox, BMNOTALL);    break;
  3159. X         case ROP_NOTSOURCE:    bmxcopy (from, frombox, to, tobox, WWCOPY | WWNOT);                     break;
  3160. X           case ROP_NOTOR:        bmxcopy (from, frombox, to, tobox, WWOR | WWNOT);                     break;
  3161. X         case ROP_NAND:        bmxcopy (from, frombox, to, tobox, WWAND);         bmxbox (to, tobox, BMNOTALL);     break;
  3162. X          case ROP_TRUE:                             bmxbox (to, tobox, BMCLEARALL | BMNOTALL);     break;
  3163. X          
  3164. X          default:
  3165. X              fprintf (stderr, "Illegal rasterop %d (hex 0x%x)\n", rop, rop);
  3166. X              exit (1);
  3167. X      }
  3168. X }
  3169. END_OF_FILE
  3170. if test 6749 -ne `wc -c <'source/ww.c'`; then
  3171.     echo shar: \"'source/ww.c'\" unpacked with wrong size!
  3172. fi
  3173. # end of 'source/ww.c'
  3174. fi
  3175. echo shar: End of archive 4 \(of 18\).
  3176. cp /dev/null ark4isdone
  3177. MISSING=""
  3178. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  3179.     if test ! -f ark${I}isdone ; then
  3180.     MISSING="${MISSING} ${I}"
  3181.     fi
  3182. done
  3183. if test "${MISSING}" = "" ; then
  3184.     echo You have unpacked all 18 archives.
  3185.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3186. else
  3187.     echo You still need to unpack the following archives:
  3188.     echo "        " ${MISSING}
  3189. fi
  3190. ##  End of shell archive.
  3191. exit 0
  3192.