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

  1. Subject:  v12i057:  A PostScript interpreter, Part08/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 57
  8. Archive-name: postscript/part08
  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 8 (of 18)."
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. if test -f 'postscript/fonts/Times/italic.r' -a "${1}" != "-c" ; then 
  19.   echo shar: Will not clobber existing file \"'postscript/fonts/Times/italic.r'\"
  20. else
  21. echo shar: Extracting \"'postscript/fonts/Times/italic.r'\" \(10938 characters\)
  22. sed "s/^X//" >'postscript/fonts/Times/italic.r' <<'END_OF_FILE'
  23. XCharStrings
  24. X/a<D03B
  25. X4E42
  26. X4D46
  27. X4D48
  28. X4E49
  29. X5149
  30. X5347
  31. X5445
  32. XD13B
  33. X4F42
  34. X4E46
  35. X4E48
  36. X4F49
  37. XCE42
  38. X4E3F
  39. X4D3C
  40. X4B3B
  41. X493B
  42. X463C
  43. X443F
  44. X4342
  45. X4345
  46. X4447
  47. X4548
  48. X4749
  49. X4949
  50. X4B48
  51. X4D45
  52. X4E42
  53. XC93B
  54. X473C
  55. X453F
  56. X4442
  57. X4446
  58. X4548
  59. X>
  60. Xput
  61. XMetrics
  62. X/a[-3
  63. X21]
  64. Xput
  65. XCharStrings
  66. X/b<C834
  67. X4441
  68. X4444
  69. X4547
  70. X4648
  71. XC934
  72. X4541
  73. XC541
  74. X463E
  75. X483C
  76. X4A3B
  77. X4C3B
  78. X4E3C
  79. X4F3D
  80. X503F
  81. X5042
  82. X4F45
  83. X4D48
  84. X4A49
  85. X4849
  86. X4648
  87. X4545
  88. X4541
  89. XCE3C
  90. X4F3E
  91. X4F42
  92. X4E45
  93. X4C48
  94. X4A49
  95. XC534
  96. X4934
  97. X>
  98. Xput
  99. XMetrics
  100. X/b[2
  101. X19]
  102. Xput
  103. XCharStrings
  104. X/c<CE3E
  105. X4E3F
  106. X4F3F
  107. X4F3E
  108. X4E3C
  109. X4C3B
  110. X493B
  111. X463C
  112. X443F
  113. X4342
  114. X4345
  115. X4447
  116. X4548
  117. X4749
  118. X4949
  119. X4C48
  120. X4E45
  121. XC93B
  122. X473C
  123. X453F
  124. X4442
  125. X4446
  126. X4548
  127. X>
  128. Xput
  129. XMetrics
  130. X/c[-3
  131. X18]
  132. Xput
  133. XCharStrings
  134. X/d<D234
  135. X4E42
  136. X4D46
  137. X4D48
  138. X4E49
  139. X5149
  140. X5347
  141. X5445
  142. XD334
  143. X4F42
  144. X4E46
  145. X4E48
  146. X4F49
  147. XCE42
  148. X4E3F
  149. X4D3C
  150. X4B3B
  151. X493B
  152. X463C
  153. X443F
  154. X4342
  155. X4345
  156. X4447
  157. X4548
  158. X4749
  159. X4949
  160. X4B48
  161. X4D45
  162. X4E42
  163. XC93B
  164. X473C
  165. X453F
  166. X4442
  167. X4446
  168. X4548
  169. XCF34
  170. X5334
  171. X>
  172. Xput
  173. XMetrics
  174. X/d[2
  175. X21]
  176. Xput
  177. XCharStrings
  178. X/e<C444
  179. X4843
  180. X4B42
  181. X4E40
  182. X4F3E
  183. X4E3C
  184. X4C3B
  185. X493B
  186. X463C
  187. X443F
  188. X4342
  189. X4345
  190. X4447
  191. X4548
  192. X4749
  193. X4949
  194. X4C48
  195. X4E46
  196. XC93B
  197. X473C
  198. X453F
  199. X4442
  200. X4446
  201. X4548
  202. X>
  203. Xput
  204. XMetrics
  205. X/e[-3
  206. X18]
  207. Xput
  208. XCharStrings
  209. X/f<CF35
  210. X4E36
  211. X4F37
  212. X5036
  213. X5035
  214. X4F34
  215. X4D34
  216. X4B35
  217. X4A36
  218. X4938
  219. X483B
  220. X4549
  221. X444D
  222. X434F
  223. XCD34
  224. X4B36
  225. X4A38
  226. X493C
  227. X4745
  228. X4649
  229. X454C
  230. X444E
  231. X434F
  232. X4150
  233. X3F50
  234. X3E4F
  235. X3E4E
  236. X3F4D
  237. X404E
  238. X3F4F
  239. XC43B
  240. X4E3B
  241. X>
  242. Xput
  243. XMetrics
  244. X/f[5
  245. X15]
  246. Xput
  247. XCharStrings
  248. X/g<D13B
  249. X4D49
  250. X4C4C
  251. X4A4F
  252. X4750
  253. X4450
  254. X424F
  255. X414E
  256. X414D
  257. X424C
  258. X434D
  259. X424E
  260. XD03B
  261. X4C49
  262. X4B4C
  263. X494F
  264. X4750
  265. XCE42
  266. X4E3F
  267. X4D3C
  268. X4B3B
  269. X493B
  270. X463C
  271. X443F
  272. X4342
  273. X4345
  274. X4447
  275. X4548
  276. X4749
  277. X4949
  278. X4B48
  279. X4D45
  280. X4E42
  281. XC93B
  282. X473C
  283. X453F
  284. X4442
  285. X4446
  286. X4548
  287. X>
  288. Xput
  289. XMetrics
  290. X/g[-1
  291. X20]
  292. Xput
  293. XCharStrings
  294. X/h<C834
  295. X4249
  296. XC934
  297. X4349
  298. XC542
  299. X473E
  300. X493C
  301. X4B3B
  302. X4D3B
  303. X4F3C
  304. X503D
  305. X503F
  306. X4E45
  307. X4E48
  308. X4F49
  309. XCD3B
  310. X4F3D
  311. X4F3F
  312. X4D45
  313. X4D48
  314. X4E49
  315. X5149
  316. X5347
  317. X5445
  318. XC534
  319. X4934
  320. X>
  321. Xput
  322. XMetrics
  323. X/h[2
  324. X21]
  325. Xput
  326. XCharStrings
  327. X/i<C934
  328. X4835
  329. X4936
  330. X4A35
  331. X4934
  332. XC13F
  333. X423D
  334. X443B
  335. X473B
  336. X483C
  337. X483F
  338. X4645
  339. X4648
  340. X4749
  341. XC63B
  342. X473C
  343. X473F
  344. X4545
  345. X4548
  346. X4649
  347. X4949
  348. X4B47
  349. X4C45
  350. X>
  351. Xput
  352. XMetrics
  353. X/i[6
  354. X13]
  355. Xput
  356. XCharStrings
  357. X/j<CA34
  358. X4935
  359. X4A36
  360. X4B35
  361. X4A34
  362. XC23F
  363. X433D
  364. X453B
  365. X483B
  366. X493C
  367. X493F
  368. X4649
  369. X454C
  370. X444E
  371. X434F
  372. X4150
  373. X3F50
  374. X3E4F
  375. X3E4E
  376. X3F4D
  377. X404E
  378. X3F4F
  379. XC73B
  380. X483C
  381. X483F
  382. X4549
  383. X444C
  384. X434E
  385. X4150
  386. X>
  387. Xput
  388. XMetrics
  389. X/j[6
  390. X13]
  391. Xput
  392. XCharStrings
  393. X/k<C834
  394. X4249
  395. XC934
  396. X4349
  397. XD03C
  398. X4F3D
  399. X503E
  400. X513D
  401. X513C
  402. X503B
  403. X4F3B
  404. X4D3C
  405. X4940
  406. X4741
  407. X4541
  408. XC741
  409. X4942
  410. X4B48
  411. X4C49
  412. XC741
  413. X4842
  414. X4A48
  415. X4B49
  416. X4D49
  417. X4F48
  418. X5145
  419. XC534
  420. X4934
  421. X>
  422. Xput
  423. XMetrics
  424. X/k[2
  425. X20]
  426. Xput
  427. XCharStrings
  428. X/l<C834
  429. X4442
  430. X4346
  431. X4348
  432. X4449
  433. X4749
  434. X4947
  435. X4A45
  436. XC934
  437. X4542
  438. X4446
  439. X4448
  440. X4549
  441. XC534
  442. X4934
  443. X>
  444. Xput
  445. XMetrics
  446. X/l[7
  447. X12]
  448. Xput
  449. XCharStrings
  450. X/m<C13F
  451. X423D
  452. X443B
  453. X473B
  454. X483C
  455. X483E
  456. X4742
  457. X4549
  458. XC63B
  459. X473C
  460. X473E
  461. X4642
  462. X4449
  463. XC742
  464. X493E
  465. X4B3C
  466. X4D3B
  467. X4F3B
  468. X513C
  469. X523D
  470. X523F
  471. X4F49
  472. XCF3B
  473. X513D
  474. X513F
  475. X4E49
  476. XD142
  477. X533E
  478. X553C
  479. X573B
  480. X593B
  481. X5B3C
  482. X5C3D
  483. X5C3F
  484. X5A45
  485. X5A48
  486. X5B49
  487. XD93B
  488. X5B3D
  489. X5B3F
  490. X5945
  491. X5948
  492. X5A49
  493. X5D49
  494. X5F47
  495. X6045
  496. X>
  497. Xput
  498. XMetrics
  499. X/m[-1
  500. X33]
  501. Xput
  502. XCharStrings
  503. X/n<C13F
  504. X423D
  505. X443B
  506. X473B
  507. X483C
  508. X483E
  509. X4742
  510. X4549
  511. XC63B
  512. X473C
  513. X473E
  514. X4642
  515. X4449
  516. XC742
  517. X493E
  518. X4B3C
  519. X4D3B
  520. X4F3B
  521. X513C
  522. X523D
  523. X523F
  524. X5045
  525. X5048
  526. X5149
  527. XCF3B
  528. X513D
  529. X513F
  530. X4F45
  531. X4F48
  532. X5049
  533. X5349
  534. X5547
  535. X5645
  536. X>
  537. Xput
  538. XMetrics
  539. X/n[-1
  540. X23]
  541. Xput
  542. XCharStrings
  543. X/o<C93B
  544. X463C
  545. X443F
  546. X4342
  547. X4345
  548. X4447
  549. X4548
  550. X4749
  551. X4949
  552. X4C48
  553. X4E45
  554. X4F42
  555. X4F3F
  556. X4E3D
  557. X4D3C
  558. X4B3B
  559. X493B
  560. XC93B
  561. X473C
  562. X453F
  563. X4442
  564. X4446
  565. X4548
  566. XC949
  567. X4B48
  568. X4D45
  569. X4E42
  570. X4E3E
  571. X4D3C
  572. X>
  573. Xput
  574. XMetrics
  575. X/o[-3
  576. X18]
  577. Xput
  578. XCharStrings
  579. X/p<C13F
  580. X423D
  581. X443B
  582. X473B
  583. X483C
  584. X483E
  585. X4742
  586. X4350
  587. XC63B
  588. X473C
  589. X473E
  590. X4642
  591. X4250
  592. XC742
  593. X483F
  594. X4A3C
  595. X4C3B
  596. X4E3B
  597. X503C
  598. X513D
  599. X523F
  600. X5242
  601. X5145
  602. X4F48
  603. X4C49
  604. X4A49
  605. X4848
  606. X4745
  607. X4742
  608. XD03C
  609. X513E
  610. X5142
  611. X5045
  612. X4E48
  613. X4C49
  614. XBF50
  615. X4650
  616. X>
  617. Xput
  618. XMetrics
  619. X/p[1
  620. X21]
  621. Xput
  622. XCharStrings
  623. X/q<D03B
  624. X4A50
  625. XD13B
  626. X4B50
  627. XCE42
  628. X4E3F
  629. X4D3C
  630. X4B3B
  631. X493B
  632. X463C
  633. X443F
  634. X4342
  635. X4345
  636. X4447
  637. X4548
  638. X4749
  639. X4949
  640. X4B48
  641. X4D45
  642. X4E42
  643. XC93B
  644. X473C
  645. X453F
  646. X4442
  647. X4446
  648. X4548
  649. XC750
  650. X4E50
  651. X>
  652. Xput
  653. XMetrics
  654. X/q[-3
  655. X20]
  656. Xput
  657. XCharStrings
  658. X/r<C13F
  659. X423D
  660. X443B
  661. X473B
  662. X483C
  663. X483E
  664. X4742
  665. X4549
  666. XC63B
  667. X473C
  668. X473E
  669. X4642
  670. X4449
  671. XC742
  672. X493E
  673. X4B3C
  674. X4D3B
  675. X4F3B
  676. X503C
  677. X503D
  678. X4F3E
  679. X4E3D
  680. X4F3C
  681. X>
  682. Xput
  683. XMetrics
  684. X/r[-1
  685. X17]
  686. Xput
  687. XCharStrings
  688. X/s<CE3D
  689. X4E3E
  690. X4F3E
  691. X4F3D
  692. X4E3C
  693. X4B3B
  694. X483B
  695. X453C
  696. X443D
  697. X443F
  698. X4540
  699. X4C44
  700. X4D45
  701. XC43E
  702. X453F
  703. X4C43
  704. X4D44
  705. X4D47
  706. X4C48
  707. X4949
  708. X4649
  709. X4348
  710. X4247
  711. X4246
  712. X4346
  713. X4347
  714. X>
  715. Xput
  716. XMetrics
  717. X/s[-2
  718. X17]
  719. Xput
  720. XCharStrings
  721. X/t<C934
  722. X4542
  723. X4446
  724. X4448
  725. X4549
  726. X4849
  727. X4A47
  728. X4B45
  729. XCA34
  730. X4642
  731. X4546
  732. X4548
  733. X4649
  734. XC33B
  735. X4C3B
  736. X>
  737. Xput
  738. XMetrics
  739. X/t[5
  740. X14]
  741. Xput
  742. XCharStrings
  743. X/u<C13F
  744. X423D
  745. X443B
  746. X473B
  747. X483C
  748. X483F
  749. X4645
  750. X4647
  751. X4849
  752. XC63B
  753. X473C
  754. X473F
  755. X4545
  756. X4547
  757. X4648
  758. X4849
  759. X4A49
  760. X4C48
  761. X4E46
  762. X5042
  763. XD23B
  764. X5042
  765. X4F46
  766. X4F48
  767. X5049
  768. X5349
  769. X5547
  770. X5645
  771. XD33B
  772. X5142
  773. X5046
  774. X5048
  775. X5149
  776. X>
  777. Xput
  778. XMetrics
  779. X/u[-1
  780. X23]
  781. Xput
  782. XCharStrings
  783. X/v<C13F
  784. X423D
  785. X443B
  786. X473B
  787. X483C
  788. X483F
  789. X4645
  790. X4647
  791. X4849
  792. XC63B
  793. X473C
  794. X473F
  795. X4545
  796. X4547
  797. X4648
  798. X4849
  799. X4949
  800. X4C48
  801. X4E46
  802. X5043
  803. X513F
  804. X513B
  805. X503B
  806. X513D
  807. X>
  808. Xput
  809. XMetrics
  810. X/v[-1
  811. X20]
  812. Xput
  813. XCharStrings
  814. X/w<C13F
  815. X423D
  816. X443B
  817. X473B
  818. X483C
  819. X483F
  820. X4645
  821. X4647
  822. X4849
  823. XC63B
  824. X473C
  825. X473F
  826. X4545
  827. X4547
  828. X4648
  829. X4849
  830. X4A49
  831. X4C48
  832. X4E46
  833. X4F44
  834. XD13B
  835. X4F44
  836. X4F47
  837. X5048
  838. X5249
  839. X5449
  840. X5648
  841. X5846
  842. X5944
  843. X5A40
  844. X5A3B
  845. X593B
  846. X5A3D
  847. XD23B
  848. X5044
  849. X5047
  850. X5249
  851. X>
  852. Xput
  853. XMetrics
  854. X/w[-1
  855. X29]
  856. Xput
  857. XCharStrings
  858. X/x<C33F
  859. X453C
  860. X473B
  861. X4A3B
  862. X4B3D
  863. X4B40
  864. XC93B
  865. X4A3D
  866. X4A40
  867. X4944
  868. X4846
  869. X4648
  870. X4449
  871. X4349
  872. X4248
  873. X4247
  874. X4346
  875. X4447
  876. X4348
  877. XC944
  878. X4947
  879. X4A49
  880. X4D49
  881. X4F48
  882. X5145
  883. XD13C
  884. X503D
  885. X513E
  886. X523D
  887. X523C
  888. X513B
  889. X503B
  890. X4E3C
  891. X4C3E
  892. X4B40
  893. X4A44
  894. X4A47
  895. X4B49
  896. X>
  897. Xput
  898. XMetrics
  899. X/x[-2
  900. X20]
  901. Xput
  902. XCharStrings
  903. X/y<C13F
  904. X423D
  905. X443B
  906. X473B
  907. X483C
  908. X483F
  909. X4645
  910. X4647
  911. X4849
  912. XC63B
  913. X473C
  914. X473F
  915. X4545
  916. X4547
  917. X4648
  918. X4849
  919. X4A49
  920. X4C48
  921. X4E46
  922. X5042
  923. XD33B
  924. X4F49
  925. X4E4C
  926. X4C4F
  927. X4950
  928. X4650
  929. X444F
  930. X434E
  931. X434D
  932. X444C
  933. X454D
  934. X444E
  935. XD23B
  936. X4E49
  937. X4D4C
  938. X4B4F
  939. X4950
  940. X>
  941. Xput
  942. XMetrics
  943. X/y[-1
  944. X21]
  945. Xput
  946. XCharStrings
  947. X/z<D13B
  948. X503D
  949. X4E3F
  950. X4645
  951. X4447
  952. X4349
  953. XC43F
  954. X453D
  955. X473B
  956. X4A3B
  957. X4E3D
  958. XC53D
  959. X473C
  960. X4A3C
  961. X4E3D
  962. X503D
  963. XC447
  964. X4647
  965. X4A48
  966. X4D48
  967. X4F47
  968. XC647
  969. X4A49
  970. X4D49
  971. X4F47
  972. X5045
  973. X>
  974. Xput
  975. XMetrics
  976. X/z[-3
  977. X20]
  978. Xput
  979. XCharStrings
  980. X/A<CD34
  981. X4049
  982. XCD34
  983. X4E49
  984. XCC36
  985. X4D49
  986. XC443
  987. X4D43
  988. XBE49
  989. X4449
  990. XCA49
  991. X5049
  992. X>
  993. Xput
  994. XMetrics
  995. X/A[2
  996. X20]
  997. Xput
  998. XCharStrings
  999. X/B<C934
  1000. X4349
  1001. XCA34
  1002. X4449
  1003. XC634
  1004. X5134
  1005. X5435
  1006. X5537
  1007. X5539
  1008. X543C
  1009. X533D
  1010. X503E
  1011. XD134
  1012. X5335
  1013. X5437
  1014. X5439
  1015. X533C
  1016. X523D
  1017. X503E
  1018. XC73E
  1019. X503E
  1020. X523F
  1021. X5341
  1022. X5343
  1023. X5246
  1024. X5048
  1025. X4C49
  1026. X4049
  1027. XD03E
  1028. X513F
  1029. X5241
  1030. X5243
  1031. X5146
  1032. X4F48
  1033. X4C49
  1034. X>
  1035. Xput
  1036. XMetrics
  1037. X/B[0
  1038. X24]
  1039. Xput
  1040. XCharStrings
  1041. X/C<D236
  1042. X5336
  1043. X5434
  1044. X533A
  1045. X5338
  1046. X5236
  1047. X5135
  1048. X4F34
  1049. X4C34
  1050. X4935
  1051. X4737
  1052. X453A
  1053. X443D
  1054. X4341
  1055. X4344
  1056. X4447
  1057. X4548
  1058. X4849
  1059. X4B49
  1060. X4D48
  1061. X4F46
  1062. X5044
  1063. XCC34
  1064. X4A35
  1065. X4837
  1066. X463A
  1067. X453D
  1068. X4441
  1069. X4444
  1070. X4547
  1071. X4648
  1072. X4849
  1073. X>
  1074. Xput
  1075. XMetrics
  1076. X/C[2
  1077. X21]
  1078. Xput
  1079. XCharStrings
  1080. X/D<C934
  1081. X4349
  1082. XCA34
  1083. X4449
  1084. XC634
  1085. X4F34
  1086. X5235
  1087. X5336
  1088. X5439
  1089. X543D
  1090. X5341
  1091. X5145
  1092. X4F47
  1093. X4D48
  1094. X4949
  1095. X4049
  1096. XCF34
  1097. X5135
  1098. X5236
  1099. X5339
  1100. X533D
  1101. X5241
  1102. X5045
  1103. X4E47
  1104. X4C48
  1105. X4949
  1106. X>
  1107. Xput
  1108. XMetrics
  1109. X/D[0
  1110. X23]
  1111. Xput
  1112. XCharStrings
  1113. X/E<C934
  1114. X4349
  1115. XCA34
  1116. X4449
  1117. XCE3A
  1118. X4C42
  1119. XC634
  1120. X5534
  1121. X543A
  1122. X5434
  1123. XC73E
  1124. X4D3E
  1125. XC049
  1126. X4F49
  1127. X5144
  1128. X4E49
  1129. X>
  1130. Xput
  1131. XMetrics
  1132. X/E[0
  1133. X23]
  1134. Xput
  1135. XCharStrings
  1136. X/F<C934
  1137. X4349
  1138. XCA34
  1139. X4449
  1140. XCE3A
  1141. X4C42
  1142. XC634
  1143. X5534
  1144. X543A
  1145. X5434
  1146. XC73E
  1147. X4D3E
  1148. XC049
  1149. X4749
  1150. X>
  1151. Xput
  1152. XMetrics
  1153. X/F[0
  1154. X22]
  1155. Xput
  1156. XCharStrings
  1157. X/G<D236
  1158. X5336
  1159. X5434
  1160. X533A
  1161. X5338
  1162. X5236
  1163. X5135
  1164. X4F34
  1165. X4C34
  1166. X4935
  1167. X4737
  1168. X453A
  1169. X443D
  1170. X4341
  1171. X4344
  1172. X4447
  1173. X4548
  1174. X4849
  1175. X4A49
  1176. X4D48
  1177. X4F46
  1178. X5142
  1179. XCC34
  1180. X4A35
  1181. X4837
  1182. X463A
  1183. X453D
  1184. X4441
  1185. X4444
  1186. X4547
  1187. X4648
  1188. X4849
  1189. XCA49
  1190. X4C48
  1191. X4E46
  1192. X5042
  1193. XCD42
  1194. X5442
  1195. X>
  1196. Xput
  1197. XMetrics
  1198. X/G[2
  1199. X22]
  1200. Xput
  1201. XCharStrings
  1202. X/H<C934
  1203. X4349
  1204. XCA34
  1205. X4449
  1206. XD634
  1207. X5049
  1208. XD734
  1209. X5149
  1210. XC634
  1211. X4D34
  1212. XD334
  1213. X5A34
  1214. XC73E
  1215. X533E
  1216. XC049
  1217. X4749
  1218. XCD49
  1219. X5449
  1220. X>
  1221. Xput
  1222. XMetrics
  1223. X/H[0
  1224. X26]
  1225. Xput
  1226. XCharStrings
  1227. X/I<C934
  1228. X4349
  1229. XCA34
  1230. X4449
  1231. XC634
  1232. X4D34
  1233. XC049
  1234. X4749
  1235. X>
  1236. Xput
  1237. XMetrics
  1238. X/I[6
  1239. X13]
  1240. Xput
  1241. XCharStrings
  1242. X/J<CF34
  1243. X4A45
  1244. X4947
  1245. X4848
  1246. X4649
  1247. X4449
  1248. X4248
  1249. X4146
  1250. X4144
  1251. X4243
  1252. X4344
  1253. X4245
  1254. XCE34
  1255. X4945
  1256. X4847
  1257. X4649
  1258. XCB34
  1259. X5234
  1260. X>
  1261. Xput
  1262. XMetrics
  1263. X/J[3
  1264. X18]
  1265. Xput
  1266. XCharStrings
  1267. X/K<C934
  1268. X4349
  1269. XCA34
  1270. X4449
  1271. XD734
  1272. X4641
  1273. XCD3D
  1274. X5149
  1275. XCC3D
  1276. X5049
  1277. XC634
  1278. X4D34
  1279. XD334
  1280. X5934
  1281. XC049
  1282. X4749
  1283. XCD49
  1284. X5349
  1285. X>
  1286. Xput
  1287. XMetrics
  1288. X/K[0
  1289. X23]
  1290. Xput
  1291. XCharStrings
  1292. X/L<C934
  1293. X4349
  1294. XCA34
  1295. X4449
  1296. XC634
  1297. X4D34
  1298. XC049
  1299. X4F49
  1300. X5143
  1301. X4E49
  1302. X>
  1303. Xput
  1304. XMetrics
  1305. X/L[2
  1306. X20]
  1307. Xput
  1308. XCharStrings
  1309. X/M<C934
  1310. X4349
  1311. XC934
  1312. X4A49
  1313. XCA34
  1314. X4B47
  1315. XD734
  1316. X4A49
  1317. XD734
  1318. X5149
  1319. XD834
  1320. X5249
  1321. XC634
  1322. X4A34
  1323. XD734
  1324. X5B34
  1325. XC049
  1326. X4649
  1327. XCE49
  1328. X5549
  1329. X>
  1330. Xput
  1331. XMetrics
  1332. X/M[0
  1333. X27]
  1334. Xput
  1335. XCharStrings
  1336. X/N<C934
  1337. X4349
  1338. XC934
  1339. X5046
  1340. XC937
  1341. X5049
  1342. XD634
  1343. X5049
  1344. XC634
  1345. X4934
  1346. XD334
  1347. X5934
  1348. XC049
  1349. X4649
  1350. X>
  1351. Xput
  1352. XMetrics
  1353. X/N[0
  1354. X25]
  1355. Xput
  1356. XCharStrings
  1357. X/O<CC34
  1358. X4935
  1359. X4737
  1360. X453A
  1361. X443D
  1362. X4341
  1363. X4344
  1364. X4447
  1365. X4548
  1366. X4749
  1367. X4A49
  1368. X4D48
  1369. X4F46
  1370. X5143
  1371. X5240
  1372. X533C
  1373. X5339
  1374. X5236
  1375. X5135
  1376. X4F34
  1377. X4C34
  1378. XCC34
  1379. X4A35
  1380. X4837
  1381. X463A
  1382. X453D
  1383. X4441
  1384. X4444
  1385. X4547
  1386. X4749
  1387. XCA49
  1388. X4C48
  1389. X4E46
  1390. X5043
  1391. X5140
  1392. X523C
  1393. X5239
  1394. X5136
  1395. X4F34
  1396. X>
  1397. Xput
  1398. XMetrics
  1399. X/O[1
  1400. X22]
  1401. Xput
  1402. XCharStrings
  1403. X/P<C934
  1404. X4349
  1405. XCA34
  1406. X4449
  1407. XC634
  1408. X5234
  1409. X5535
  1410. X5637
  1411. X5639
  1412. X553C
  1413. X533E
  1414. X4F3F
  1415. X473F
  1416. XD234
  1417. X5435
  1418. X5537
  1419. X5539
  1420. X543C
  1421. X523E
  1422. X4F3F
  1423. XC049
  1424. X4749
  1425. X>
  1426. Xput
  1427. XMetrics
  1428. X/P[0
  1429. X23]
  1430. Xput
  1431. XCharStrings
  1432. X/Q<CC34
  1433. X4935
  1434. X4737
  1435. X453A
  1436. X443D
  1437. X4341
  1438. X4344
  1439. X4447
  1440. X4548
  1441. X4749
  1442. X4A49
  1443. X4D48
  1444. X4F46
  1445. X5143
  1446. X5240
  1447. X533C
  1448. X5339
  1449. X5236
  1450. X5135
  1451. X4F34
  1452. X4C34
  1453. XCC34
  1454. X4A35
  1455. X4837
  1456. X463A
  1457. X453D
  1458. X4441
  1459. X4444
  1460. X4547
  1461. X4749
  1462. XCA49
  1463. X4C48
  1464. X4E46
  1465. X5043
  1466. X5140
  1467. X523C
  1468. X5239
  1469. X5136
  1470. X4F34
  1471. XC547
  1472. X4546
  1473. X4644
  1474. X4843
  1475. X4943
  1476. X4B44
  1477. X4C46
  1478. X4C4D
  1479. X4D4E
  1480. X4F4E
  1481. X504C
  1482. X504B
  1483. XCC46
  1484. X4D4C
  1485. X4E4D
  1486. X4F4D
  1487. X504C
  1488. X>
  1489. Xput
  1490. XMetrics
  1491. X/Q[1
  1492. X22]
  1493. Xput
  1494. XCharStrings
  1495. X/R<C934
  1496. X4349
  1497. XCA34
  1498. X4449
  1499. XC634
  1500. X5134
  1501. X5435
  1502. X5537
  1503. X5539
  1504. X543C
  1505. X533D
  1506. X503E
  1507. X473E
  1508. XD134
  1509. X5335
  1510. X5437
  1511. X5439
  1512. X533C
  1513. X523D
  1514. X503E
  1515. XCC3E
  1516. X4E3F
  1517. X4F40
  1518. X5048
  1519. X5149
  1520. X5349
  1521. X5447
  1522. X5446
  1523. XCF40
  1524. X5147
  1525. X5248
  1526. X5348
  1527. X5447
  1528. XC049
  1529. X4749
  1530. X>
  1531. Xput
  1532. XMetrics
  1533. X/R[0
  1534. X24]
  1535. Xput
  1536. XCharStrings
  1537. X/S<D336
  1538. X5436
  1539. X5534
  1540. X543A
  1541. X5438
  1542. X5336
  1543. X5235
  1544. X4F34
  1545. X4B34
  1546. X4835
  1547. X4637
  1548. X4639
  1549. X473B
  1550. X483C
  1551. X4F40
  1552. X5142
  1553. XC639
  1554. X483B
  1555. X4F3F
  1556. X5040
  1557. X5142
  1558. X5145
  1559. X5047
  1560. X4F48
  1561. X4C49
  1562. X4849
  1563. X4548
  1564. X4447
  1565. X4345
  1566. X4343
  1567. X4249
  1568. X4347
  1569. X4447
  1570. X>
  1571. Xput
  1572. XMetrics
  1573. X/S[1
  1574. X23]
  1575. Xput
  1576. XCharStrings
  1577. X/T<CD34
  1578. X4749
  1579. XCE34
  1580. X4849
  1581. XC734
  1582. X443A
  1583. X4634
  1584. X5534
  1585. X543A
  1586. X5434
  1587. XC449
  1588. X4B49
  1589. X>
  1590. Xput
  1591. XMetrics
  1592. X/T[2
  1593. X21]
  1594. Xput
  1595. XCharStrings
  1596. X/U<C834
  1597. X453F
  1598. X4443
  1599. X4446
  1600. X4548
  1601. X4849
  1602. X4C49
  1603. X4F48
  1604. X5146
  1605. X5243
  1606. X5634
  1607. XC934
  1608. X463F
  1609. X4543
  1610. X4546
  1611. X4648
  1612. X4849
  1613. XC534
  1614. X4C34
  1615. XD334
  1616. X5934
  1617. X>
  1618. Xput
  1619. XMetrics
  1620. X/U[0
  1621. X25]
  1622. Xput
  1623. XCharStrings
  1624. X/V<C634
  1625. X4749
  1626. XC734
  1627. X4847
  1628. XD434
  1629. X4749
  1630. XC434
  1631. X4A34
  1632. XD034
  1633. X5634
  1634. X>
  1635. Xput
  1636. XMetrics
  1637. X/V[2
  1638. X20]
  1639. Xput
  1640. XCharStrings
  1641. X/W<C834
  1642. X4649
  1643. XC934
  1644. X4747
  1645. XD034
  1646. X4649
  1647. XD034
  1648. X4E49
  1649. XD134
  1650. X4F47
  1651. XD834
  1652. X4E49
  1653. XC534
  1654. X4C34
  1655. XD534
  1656. X5B34
  1657. X>
  1658. Xput
  1659. XMetrics
  1660. X/W[-1
  1661. X26]
  1662. Xput
  1663. XCharStrings
  1664. X/X<C734
  1665. X4E49
  1666. XC834
  1667. X4F49
  1668. XD534
  1669. X4149
  1670. XC534
  1671. X4B34
  1672. XD134
  1673. X5734
  1674. XBF49
  1675. X4549
  1676. XCB49
  1677. X5149
  1678. X>
  1679. Xput
  1680. XMetrics
  1681. X/X[1
  1682. X22]
  1683. Xput
  1684. XCharStrings
  1685. X/Y<C634
  1686. X4A3E
  1687. X4749
  1688. XC734
  1689. X4B3E
  1690. X4849
  1691. XD534
  1692. X4B3E
  1693. XC434
  1694. X4A34
  1695. XD134
  1696. X5734
  1697. XC449
  1698. X4B49
  1699. X>
  1700. Xput
  1701. XMetrics
  1702. X/Y[2
  1703. X21]
  1704. Xput
  1705. XCharStrings
  1706. X/Z<D434
  1707. X4149
  1708. XD534
  1709. X4249
  1710. XC834
  1711. X453A
  1712. X4734
  1713. X5534
  1714. XC149
  1715. X4F49
  1716. X5143
  1717. X4E49
  1718. X>
  1719. Xput
  1720. XMetrics
  1721. X/Z[1
  1722. X22]
  1723. Xput
  1724. XCharStrings
  1725. X/ff
  1726. X<D435
  1727. X5336
  1728. X5437
  1729. X5536
  1730. X5435
  1731. X5234
  1732. X4F34
  1733. X4C35
  1734. X4A37
  1735. X4939
  1736. X483C
  1737. X4740
  1738. X4549
  1739. X444D
  1740. X434F
  1741. XCF34
  1742. X4D35
  1743. X4B37
  1744. X4A39
  1745. X493C
  1746. X4745
  1747. X4649
  1748. X454C
  1749. X444E
  1750. X434F
  1751. X4150
  1752. X3F50
  1753. X3E4F
  1754. X3E4E
  1755. X3F4D
  1756. X404E
  1757. X3F4F
  1758. XDA35
  1759. X5936
  1760. X5A37
  1761. X5B36
  1762. X5B35
  1763. X5A34
  1764. X5834
  1765. X5635
  1766. X5536
  1767. X5438
  1768. X533B
  1769. X5049
  1770. X4F4D
  1771. X4E4F
  1772. XD834
  1773. X5636
  1774. X5538
  1775. X543C
  1776. X5245
  1777. X5149
  1778. X504C
  1779. X4F4E
  1780. X4E4F
  1781. X4C50
  1782. X4A50
  1783. X494F
  1784. X494E
  1785. X4A4D
  1786. X4B4E
  1787. X4A4F
  1788. XC43B
  1789. X593B
  1790. X>
  1791. Xput
  1792. XMetrics
  1793. X/ff
  1794. X[2
  1795. X26]
  1796. Xput
  1797. XCharStrings
  1798. X/fi
  1799. X<D535
  1800. X5436
  1801. X5537
  1802. X5636
  1803. X5535
  1804. X5234
  1805. X4F34
  1806. X4C35
  1807. X4A37
  1808. X4939
  1809. X483C
  1810. X4740
  1811. X4549
  1812. X444D
  1813. X434F
  1814. XCF34
  1815. X4D35
  1816. X4B37
  1817. X4A39
  1818. X493C
  1819. X4745
  1820. X4649
  1821. X454C
  1822. X444E
  1823. X434F
  1824. X4150
  1825. X3F50
  1826. X3E4F
  1827. X3E4E
  1828. X3F4D
  1829. X404E
  1830. X3F4F
  1831. XD33B
  1832. X5142
  1833. X5046
  1834. X5048
  1835. X5149
  1836. X5449
  1837. X5647
  1838. X5745
  1839. XD43B
  1840. X5242
  1841. X5146
  1842. X5148
  1843. X5249
  1844. XC43B
  1845. X543B
  1846. X>
  1847. Xput
  1848. XMetrics
  1849. X/fi
  1850. X[2
  1851. X24]
  1852. Xput
  1853. XCharStrings
  1854. X/fl
  1855. X<D335
  1856. X5236
  1857. X5337
  1858. X5436
  1859. X5435
  1860. X5234
  1861. XD634
  1862. X4F34
  1863. X4C35
  1864. X4A37
  1865. X4939
  1866. X483C
  1867. X4740
  1868. X4549
  1869. X444D
  1870. X434F
  1871. XCF34
  1872. X4D35
  1873. X4B37
  1874. X4A39
  1875. X493C
  1876. X4745
  1877. X4649
  1878. X454C
  1879. X444E
  1880. X434F
  1881. X4150
  1882. X3F50
  1883. X3E4F
  1884. X3E4E
  1885. X3F4D
  1886. X404E
  1887. X3F4F
  1888. XD534
  1889. X5142
  1890. X5046
  1891. X5048
  1892. X5149
  1893. X5449
  1894. X5647
  1895. X5745
  1896. XD634
  1897. X5242
  1898. X5146
  1899. X5148
  1900. X5249
  1901. XC43B
  1902. X533B
  1903. X>
  1904. Xput
  1905. XMetrics
  1906. X/fl
  1907. X[2
  1908. X24]
  1909. Xput
  1910. XCharStrings
  1911. X/ffi
  1912. X<D435
  1913. X5336
  1914. X5437
  1915. X5536
  1916. X5435
  1917. X5234
  1918. X4F34
  1919. X4C35
  1920. X4A37
  1921. X4939
  1922. X483C
  1923. X4740
  1924. X4549
  1925. X444D
  1926. X434F
  1927. XCF34
  1928. X4D35
  1929. X4B37
  1930. X4A39
  1931. X493C
  1932. X4745
  1933. X4649
  1934. X454C
  1935. X444E
  1936. X434F
  1937. X4150
  1938. X3F50
  1939. X3E4F
  1940. X3E4E
  1941. X3F4D
  1942. X404E
  1943. X3F4F
  1944. XE035
  1945. X5F36
  1946. X6037
  1947. X6136
  1948. X6035
  1949. X5D34
  1950. X5A34
  1951. X5735
  1952. X5537
  1953. X5439
  1954. X533C
  1955. X5240
  1956. X5049
  1957. X4F4D
  1958. X4E4F
  1959. XDA34
  1960. X5835
  1961. X5637
  1962. X5539
  1963. X543C
  1964. X5245
  1965. X5149
  1966. X504C
  1967. X4F4E
  1968. X4E4F
  1969. X4C50
  1970. X4A50
  1971. X494F
  1972. X494E
  1973. X4A4D
  1974. X4B4E
  1975. X4A4F
  1976. XDE3B
  1977. X5C42
  1978. X5B46
  1979. X5B48
  1980. X5C49
  1981. X5F49
  1982. X6147
  1983. X6245
  1984. XDF3B
  1985. X5D42
  1986. X5C46
  1987. X5C48
  1988. X5D49
  1989. XC43B
  1990. X5F3B
  1991. X>
  1992. Xput
  1993. XMetrics
  1994. X/ffi
  1995. X[2
  1996. X35]
  1997. Xput
  1998. XCharStrings
  1999. X/ffl
  2000. X<D435
  2001. X5336
  2002. X5437
  2003. X5536
  2004. X5435
  2005. X5234
  2006. X4F34
  2007. X4C35
  2008. X4A37
  2009. X4939
  2010. X483C
  2011. X4740
  2012. X4549
  2013. X444D
  2014. X434F
  2015. XCF34
  2016. X4D35
  2017. X4B37
  2018. X4A39
  2019. X493C
  2020. X4745
  2021. X4649
  2022. X454C
  2023. X444E
  2024. X434F
  2025. X4150
  2026. X3F50
  2027. X3E4F
  2028. X3E4E
  2029. X3F4D
  2030. X404E
  2031. X3F4F
  2032. XDE35
  2033. X5D36
  2034. X5E37
  2035. X5F36
  2036. X5F35
  2037. X5D34
  2038. XE134
  2039. X5A34
  2040. X5735
  2041. X5537
  2042. X5439
  2043. X533C
  2044. X5240
  2045. X5049
  2046. X4F4D
  2047. X4E4F
  2048. XDA34
  2049. X5835
  2050. X5637
  2051. X5539
  2052. X543C
  2053. X5245
  2054. X5149
  2055. X504C
  2056. X4F4E
  2057. X4E4F
  2058. X4C50
  2059. X4A50
  2060. X494F
  2061. X494E
  2062. X4A4D
  2063. X4B4E
  2064. X4A4F
  2065. XE034
  2066. X5C42
  2067. X5B46
  2068. X5B48
  2069. X5C49
  2070. X5F49
  2071. X6147
  2072. X6245
  2073. XE134
  2074. X5D42
  2075. X5C46
  2076. X5C48
  2077. X5D49
  2078. XC43B
  2079. X5E3B
  2080. X>
  2081. Xput
  2082. XMetrics
  2083. X/ffl
  2084. X[2
  2085. X35]
  2086. Xput
  2087. XCharStrings
  2088. X/dotlessi
  2089. X<C13F
  2090. X423D
  2091. X443B
  2092. X473B
  2093. X483C
  2094. X483F
  2095. X4645
  2096. X4648
  2097. X4749
  2098. XC63B
  2099. X473C
  2100. X473F
  2101. X4545
  2102. X4548
  2103. X4649
  2104. X4949
  2105. X4B47
  2106. X4C45
  2107. X>
  2108. Xput
  2109. XMetrics
  2110. X/dotlessi
  2111. X[-1
  2112. X13]
  2113. Xput
  2114. XCharStrings
  2115. X/space
  2116. X<8000
  2117. X8563C
  2118. X4400
  2119. X008D7
  2120. X3848
  2121. X>
  2122. Xput
  2123. XMetrics
  2124. X/space
  2125. X[64
  2126. X0]
  2127. Xput
  2128. END_OF_FILE
  2129. if test 10938 -ne `wc -c <'postscript/fonts/Times/italic.r'`; then
  2130.     echo shar: \"'postscript/fonts/Times/italic.r'\" unpacked with wrong size!
  2131. fi
  2132. # end of 'postscript/fonts/Times/italic.r'
  2133. fi
  2134. if test -f 'source/hard-interface.c' -a "${1}" != "-c" ; then 
  2135.   echo shar: Will not clobber existing file \"'source/hard-interface.c'\"
  2136. else
  2137. echo shar: Extracting \"'source/hard-interface.c'\" \(10584 characters\)
  2138. sed "s/^X//" >'source/hard-interface.c' <<'END_OF_FILE'
  2139. X/*
  2140. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2141. X * 
  2142. X * This source may be copied, distributed, altered or used, but not sold for profit
  2143. X * or incorporated into a product except under licence from the author.
  2144. X * It is not in the public domain.
  2145. X * This notice should remain in the source unaltered, and any changes to the source
  2146. X * made by persons other than the author should be marked as such.
  2147. X * 
  2148. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2149. X */
  2150. X#include "main.h"
  2151. X#include "graphics.h"
  2152. X
  2153. Xstruct hardware
  2154. X {
  2155. X     /*
  2156. X      * Each driver is expected to provide its own definition of this structure.
  2157. X      * It is only ever used as a pointer and is never dereferenced outside the driver.
  2158. X      */
  2159. X     int pad;
  2160. X };
  2161. X
  2162. X/*
  2163. X *    This file describes the interface that PostScript requires to the graphics system at Version 1.4.
  2164. X *    
  2165. X *    ''Hardware'' in this context refers to a pointer to windows and/or bitmaps and is the lowest level
  2166. X *    of access that PostScript is interested in. Any Hardware parameter may be expected to be NULL.
  2167. X */
  2168. X
  2169. X/*********************************** CREATION OF WINDOWS AND BITMAPS *******************/
  2170. X
  2171. Xstruct hardware *InitHardware () {}
  2172. X/*
  2173. X *    InitHardware () returns a default device which PostScript may use immediately (or NULL if not appropriate).
  2174. X *    Its size and shape are not defined. Most typically the user will want to start up another device
  2175. X *    before it is used anyway. No attempt will be made by PostScript to Destroy the resulting
  2176. X *    device.
  2177. X */
  2178. X
  2179. Xstruct hardware *NewBitmapHardware (width, height) int width, height; {}
  2180. X
  2181. Xstruct hardware *NewWindowHardware (width, height) int width, height; {}
  2182. X/*
  2183. X *    NewBitmapHardware () is expected to create a new bitmap. Only one plane will be needed.
  2184. X *    
  2185. X *    NewWindowHardware () is expected to create a window on the screen. On a colour system this will
  2186. X *    be expected to support full colour.
  2187. X */
  2188. X
  2189. Xint IsWindowHardware (h) struct hardware *h; {}
  2190. X/*
  2191. X *    IsWindowHardware () should return TRUE if the hardware is a window, FALSE otherwise.
  2192. X *    NULL is a window.
  2193. X */
  2194. X
  2195. Xvoid DestroyHardware (h) struct hardware *h; {}
  2196. X/*    
  2197. X *    DestroyHardware () should release the resources required by the hardware, bitmap or window.
  2198. X *    This should cause a window device to vanish. NULL is not an error (does nothing).
  2199. X */
  2200. X
  2201. X
  2202. XMatrix DeviceMatrix (width, height) int width, height; {}
  2203. X
  2204. X/*
  2205. X *
  2206. X *    DeviceMatrix () should return a matrix appropriate to a device of the given height and width.
  2207. X *    For a typical display with a graphics origin at the top left of a window,
  2208. X *    an appropriate definition would be:
  2209. X *    
  2210. X *    Matrix DeviceMatrix (width, height) int width, height;
  2211. X *     {
  2212. X *         return NewMatrix (PIXELS_PER_INCH / 72.0, 0.0, 0.0, -PIXELS_PER_INCH / 72.0, 0.0, (float) height);
  2213. X *     }
  2214. X */
  2215. X
  2216. XDevicePoint HardwareExtent (h) struct hardware *h; {}
  2217. X/*    HardwareExtent () returns a DevicePoint describing the width and height of the argument.
  2218. X *    NULL has extent NewDevicePoint (0, 0).
  2219. X */
  2220. X
  2221. X/******************************************* OUTPUT PRIMITIVES ******************************/    
  2222. X
  2223. Xvoid BitBlt (from, to, fromPoint, toPoint, extent, rop)
  2224. X    struct hardware *from, *to;
  2225. X    DevicePoint toPoint, fromPoint, extent;
  2226. X    int rop;
  2227. X {}
  2228. X
  2229. Xvoid Paint (from, to, fromPoint, toPoint, extent, colour)
  2230. X    struct hardware *from, *to;
  2231. X    DevicePoint toPoint, fromPoint, extent;
  2232. X    Colour colour;
  2233. X {}
  2234. X
  2235. X/*    
  2236. X *    BitBlt () is a full function RasterOp. The 'rop' argument
  2237. X *    will have values as described in the header file hard.h. If the from argument is NULL it is taken to be
  2238. X *    a bitmap full of ones the shape of the fromPoint and extent. If the to argument is NULL, this is a no-op.
  2239. X *    
  2240. X *    Paint () is an addition to BitBlt. Bits that are set in the source are Painted into the destination
  2241. X *    in the given colour with a copying rasterop so that they replace pixels previously there. If the
  2242. X *    machine does not support colour windows, half-toning should be performed. 
  2243. X *    Colour values have hue, saturation and brightness components. on a black and white or greyscale
  2244. X *    system the brightness value will be a FP value between 0.0 (black) and 1.1 (white), which can be
  2245. X *    used as a grey level.
  2246. X *    
  2247. X *    Paint is expected to mask with the clip mask. BitBlt is not,
  2248. X */
  2249. X
  2250. Xvoid BitBltTrapezoid (to, lefttop, leftbottom, righttop, rightbottom, top, bottom, rop)
  2251. X    struct hardware *to;
  2252. X    DevicePoint lefttop, leftbottom, righttop, rightbottom;
  2253. X    int top, bottom, rop;
  2254. X {}
  2255. X
  2256. Xvoid PaintTrapezoid (to, lefttop, leftbottom, righttop, rightbottom, top, bottom, colour)
  2257. X    struct hardware *to;
  2258. X    DevicePoint lefttop, leftbottom, righttop, rightbottom;
  2259. X    int top, bottom;
  2260. X    Colour colour;
  2261. X {}
  2262. X
  2263. X/*
  2264. X *     BitBltTrapezoid () and PaintTrapezoid () render a complete trapezoidal shape.
  2265. X *    The corners of the trapezoid may lie far outside the range of interesting scan-lines, but the slope
  2266. X *    of the line should be clipped by the top and bottom. The coordinates are half-open.
  2267. X */
  2268. X
  2269. Xvoid BitBltLine (h, fromPoint, toPoint, rop)
  2270. X    struct hardware *h;
  2271. X    DevicePoint fromPoint, toPoint;
  2272. X    int rop;
  2273. X {}
  2274. X
  2275. Xvoid PaintLine (h, fromPoint, toPoint, colour)
  2276. X    struct hardware *h;
  2277. X    DevicePoint fromPoint, toPoint;
  2278. X    Colour colour;
  2279. X {}
  2280. X
  2281. X/*    
  2282. X *    BitBltLine () is expected to draw a line between the given points
  2283. X *    with the given RasterOp and colour masking.
  2284. X *    The line should be one pixel wide and half-open.
  2285. X *    [Thicker lines are done with BitBlt.]
  2286. X *    
  2287. X *    PaintLine () is expected to Paint a line by analogy with Paint and BitBlt.
  2288. X */
  2289. X
  2290. Xvoid BitBltBlob (to, top, height, left, right, rop)
  2291. X    struct hardware *to;
  2292. X    int top, height, *left, *right, rop;
  2293. X {}
  2294. X
  2295. X /*
  2296. X  *    BitBltBlob () takes a set of pixel coordinates and fills the trapezon figure
  2297. X  *    half open.
  2298. X  */
  2299. X
  2300. Xvoid RasterTile (from, to, toPoint, extent, rop)
  2301. X    struct hardware *from, *to;
  2302. X    DevicePoint toPoint, extent;
  2303. X    int rop;
  2304. X {}
  2305. X
  2306. X/*
  2307. X *    RasterTile () replicates the whole of ``from'' over ``to'', but clipped by the
  2308. X *    rectangle bounded by ``toPoint'' and ``extent''.
  2309. X */
  2310. X
  2311. X/*********************************** BRIGHTNESS TRANSFER FUNCTION ************************/
  2312. X
  2313. Xint TransferSize () {}
  2314. X
  2315. Xvoid SetTransfer (vec) float *vec; {}
  2316. X/*    
  2317. X *    TransferSize () and SetTransfer () control the mapping function between user brightnesses
  2318. X *    and device brightnesses. The interface is expected to perform this mapping of brightnesses
  2319. X *    to a sufficient resolution. SetTransfer takes a table of floating point numbers between
  2320. X *    0 and 1. User brightnesses are scaled to the size of this table and mapped through it.
  2321. X *    The argument table given to SetTransfer () will be deleted after use. TransferSize () simply
  2322. X *    enquires the required size of the table.
  2323. X *    
  2324. X *    It may be appropriate to half-tone on a grayscale or colour device to improve rendering if it is not too
  2325. X *    expensive. TransferSize () returns the size of the pattern table.
  2326. X */
  2327. X
  2328. X/********************************** BITMAP CONVERSION ********************************/
  2329. X
  2330. Xchar *StringFromHardware (h) struct hardware *h; {}
  2331. X
  2332. Xstruct hardware *HardwareFromString (s, width, height) char *s; int width, height; {}
  2333. X/*    
  2334. X *    StringFromHardware () produces a string from its argument which describes the bitmap.
  2335. X *    The bitmap is returned in row-major order with the leftmost bit of each byte in the most significant
  2336. X *    position. Rows are padded to byte boundaries. Only single plane bitmaps are used.
  2337. X *    
  2338. X *    HardwareFromString () performs the inverse mapping, generating a bitmap from a set of bits, given
  2339. X *    a width and height. Only single plane bitmaps are used.
  2340. X */
  2341. X
  2342. X/************************************* HALF-TONE SCREEN ***********************************/
  2343. X
  2344. Xint ScreenSize (freq, rotation) float freq, rotation; {}
  2345. X
  2346. Xvoid BuildScreen (freq, rotation, x, y) float freq, rotation, *x, *y; {}
  2347. X
  2348. Xvoid SetScreen (freq, rotation, thresh) float freq, rotation, *thresh; {}
  2349. X/*
  2350. X *    ScreenSize () allows PostScript to determine how large an array of sample points to expect.
  2351. X *    It should return the length of the side of the sample square.
  2352. X *    
  2353. X *    BuildScreen () returns a set of sampling coordinates to PostScript to hand to the users spot-function
  2354. X *    
  2355. X *    SetScreen () allows PostScript to set the thresholds for each sample point so that half-tone bitmaps
  2356. X *    can be made.
  2357. X */
  2358. X
  2359. X/************************************* CLIPPING **********************************************/
  2360. X
  2361. Xvoid SetClipHardware (h, clip) struct hardware *h, *clip; {}
  2362. X/*    
  2363. X *    SetClipHardware sets hardware which is a clip mask for BitBlt. This mask should be ANDed with any output
  2364. X *    operation. If clip is NULL, masking will not be needed.
  2365. X */
  2366. X
  2367. X/**************************************** UPDATE CONTROLS ******************************************/
  2368. X
  2369. Xvoid HardUpdate () {}
  2370. X/*
  2371. X *    HardUpdate is a hook to allow devices which do output buffering to flush that buffering when appropriate.
  2372. X *    This allows an interactive user to see completed graphics between prompts (it is called as a side-effect
  2373. X *    of the PostScript flush operator). Typically is is a no-op.
  2374. X */
  2375. X
  2376. Xvoid UpdateControl (h, on) struct hardware *h; int on; {}
  2377. X/*
  2378. X *     This call can be used to enable batching of output operations. UpdateControl (h, FALSE) means ``start of
  2379. X *    batching'' UpdateControl (h, TRUE) means ``end of batching''. It is used to improve performance on machines
  2380. X *    where screen updates have a high locking overhead. It may be a no-op.
  2381. X *    The operation should nest if batching is already in progress: FALSE increments a counter,
  2382. X *    TRUE decrements a counter. Display changes are allowed when the counter is non-zero.
  2383. X */
  2384. X
  2385. X/********************************** CANONICAL IMPLEMENTATION LIBRARY ******************************/
  2386. X
  2387. X/*
  2388. X *    Some parts of the above interface can be supported by a canonical library.
  2389. X *    This library contains:
  2390. X
  2391. XSetClipHardware
  2392. XHardUpdate
  2393. XIsWindowHardware
  2394. XHardwareExtent
  2395. X
  2396. XPaintTrapezoid
  2397. XBitBltTrapezoid
  2398. X
  2399. XPaint
  2400. XPaintLine
  2401. X
  2402. XDeviceMatrix
  2403. XInitTransfer
  2404. XTransferSize
  2405. XSetTransfer
  2406. XScreenSize
  2407. XBuildScreen
  2408. XSetScreen
  2409. X
  2410. X *
  2411. X *    As the driver matures, the user may provide his own versions of the canonical routines.
  2412. X *    This leaves the following for implementation by the user.
  2413. X *
  2414. X
  2415. XInitHardware
  2416. XNewBitmapHardware
  2417. XNewWindowHardware
  2418. XDestroyHardware
  2419. XHardwareFromString
  2420. XStringFromHardware
  2421. XUpdateControl
  2422. XRasterTile
  2423. XBitBlt
  2424. XBitBltLine
  2425. XBitBltBlob
  2426. X
  2427. X *    There is a pedagogical implementation in null.c
  2428. X *    
  2429. X *    There are a number of interface issues concerning the canonical driver.
  2430. X *    Firstly, a canonical struct hardware is defined, which contains a union of
  2431. X *    a char * and an int handle. The remainder are expected to use this to store
  2432. X *    device specific information.
  2433. X *
  2434. X *    InitTransfer() should be called during InitHardware with the number of pixels
  2435. X *    per inch on the display as an argument.
  2436. X */
  2437. END_OF_FILE
  2438. if test 10584 -ne `wc -c <'source/hard-interface.c'`; then
  2439.     echo shar: \"'source/hard-interface.c'\" unpacked with wrong size!
  2440. fi
  2441. # end of 'source/hard-interface.c'
  2442. fi
  2443. if test -f 'source/main.c' -a "${1}" != "-c" ; then 
  2444.   echo shar: Will not clobber existing file \"'source/main.c'\"
  2445. else
  2446. echo shar: Extracting \"'source/main.c'\" \(10508 characters\)
  2447. sed "s/^X//" >'source/main.c' <<'END_OF_FILE'
  2448. X/*
  2449. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2450. X * 
  2451. X * This source may be copied, distributed, altered or used, but not sold for profit
  2452. X * or incorporated into a product except under licence from the author.
  2453. X * It is not in the public domain.
  2454. X * This notice should remain in the source unaltered, and any changes to the source
  2455. X * made by persons other than the author should be marked as such.
  2456. X * 
  2457. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2458. X */
  2459. X#include <signal.h>
  2460. X#include "main.h"
  2461. X
  2462. X#define ERRORDICTSIZE     25
  2463. X
  2464. XObject PDictFull;
  2465. XObject PDictOverflow,        PInvFont,        PSyntaxError;
  2466. XObject PDictUnderflow,        PInvRestore,        PTypeCheck;
  2467. XObject PExecOverflow,        PIOError,        PUndefined;
  2468. XObject PExecUnderflow,        PLimitCheck,        PUnFilename;
  2469. XObject PInterrupt,        PNoCurrentPoint,    PUnResult;
  2470. XObject PInvAccess,        PRangeCheck,        PUnMatched;
  2471. XObject PInvExit,        POpOverflow,        PUnregistered;
  2472. XObject PInvFileAccess,        POpUnderflow,        PVMError;
  2473. X
  2474. XObject Lbracket, Rbracket, Nil, Marker;
  2475. XObject OpInterp, ErrorDict;
  2476. X
  2477. Xstatic int ErrorFn ();
  2478. Xstatic Object InsErr ();
  2479. Xstatic void InitErrors (), InitArguments (), Interpreter ();
  2480. Xstatic Object OpError, error_name, execName;
  2481. X
  2482. Xstatic catchint ();
  2483. Xstatic int EnableInterrupts ();
  2484. X
  2485. Xchar *library;
  2486. X
  2487. Xstatic int files_present = 0, interrupted = FALSE, protected = 0;
  2488. Xint interactive = FALSE, verbose = FALSE;
  2489. XFILE *vfp = NULL;
  2490. X
  2491. Xmain (argc, argv) int argc; char **argv;
  2492. X {
  2493. X     char profile[BUFSIZE], rcfile [BUFSIZE], *getenv ();
  2494. X     FILE *fp;
  2495. X     int here;
  2496. X     
  2497. X     library = getenv ("POSTSCRIPTLIB");
  2498. X    if (library == NULL)
  2499. X        library = default_library;
  2500. X    
  2501. X    VOID sprintf (rcfile, "%s/psrc", library);
  2502. X     
  2503. X     if (close (dup (9)) == 0)
  2504. X      {
  2505. X         verbose = TRUE;
  2506. X         vfp = fdopen (9, "w");
  2507. X      }
  2508. X     Message ("POSTSCRIPT");
  2509. X     Init ();
  2510. X     Message ("Init Errors");
  2511. X     InitErrors ();
  2512. X    Message ("Init Arguments");
  2513. X    
  2514. X    VOID Push (ExecStack, Cvx (NameFrom ("executive")));
  2515. X    
  2516. X    here = Height (ExecStack);
  2517. X    
  2518. X    Install ("Library", StringFrom (library));
  2519. X    
  2520. X    InitArguments (argc, argv);
  2521. X    interactive = interactive || isatty (0) && !files_present;
  2522. X    ReverseStack (ExecStack, Height (ExecStack) - here);
  2523. X    
  2524. X     VOID strcpy (profile, getenv ("HOME") ? getenv ("HOME") : "/etc");
  2525. X     VOID strcat (profile, "/.postscript");
  2526. X     
  2527. X     if (fp = fopen (profile, "r"))
  2528. X        VOID Push (ExecStack, Cvx (FileFrom (fp)));
  2529. X        
  2530. X    if (!interactive)
  2531. X        VOID Push (ExecStack,
  2532. X            Cvx (StringFrom (files_present ?
  2533. X                    "/executive null def" :
  2534. X                    "/executive (%stdin) (r) file cvx def")));
  2535. X    
  2536. X    if ((fp = fopen (rcfile, "r")) == NULL)
  2537. X        fprintf (stderr, "%s: cannot open %s\n", argv[0], rcfile),
  2538. X        exit (1);
  2539. X    else
  2540. X        VOID Push (ExecStack, Cvx (FileFrom (fp)));
  2541. X    InstallOp ("enableinterrupts",    EnableInterrupts, 0, 0, 0, 0);
  2542. X/*    SysDict = ReadOnly (SysDict);    */
  2543. X    Message ("Entering Interpreter");
  2544. X    Interpreter ();
  2545. X }
  2546. X
  2547. XMessage (s) char *s;
  2548. X {
  2549. X    if (vfp != NULL)
  2550. X        fprintf (vfp, "%s\n", s), fflush (vfp);
  2551. X }
  2552. X
  2553. XProtect ()
  2554. X {
  2555. X     ++protected;
  2556. X }
  2557. X
  2558. XUnprotect ()
  2559. X {
  2560. X     --protected;
  2561. X }
  2562. X
  2563. Xstatic int EnableInterrupts ()
  2564. X {
  2565. X    if (interactive)
  2566. X        VOID signal (SIGINT, catchint);
  2567. X    return TRUE;
  2568. X }
  2569. X
  2570. Xstatic void InitArguments (argc, argv) int argc; char **argv;
  2571. X {
  2572. X      int i, command = FALSE;
  2573. X    
  2574. X    for (i = 1; i < argc; i++)
  2575. X     {
  2576. X         FILE *fp;
  2577. X         
  2578. X         if (command)
  2579. X          {
  2580. X              command = FALSE;
  2581. X              VOID Push (ExecStack, Cvx (StringFrom (argv[i])));
  2582. X          }
  2583. X         else if (*argv[i] == '-')
  2584. X             switch (argv[i][1])
  2585. X              {
  2586. X                  case 'i':
  2587. X                      interactive = TRUE;
  2588. X                      break;
  2589. X                  
  2590. X                  case 'c':
  2591. X                      ++files_present; 
  2592. X                      command = TRUE;
  2593. X                      break;
  2594. X                  
  2595. X                  case 's': case '\0':
  2596. X                      ++files_present;
  2597. X                     VOID Push (ExecStack, Cvx (Fstdin));
  2598. X                      break;
  2599. X                  
  2600. X                  default:
  2601. X                      fprintf (stderr, "%s: unknown option '%c'\n", argv[0], argv[i][1]);
  2602. X                      exit (1);
  2603. X               }
  2604. X          else
  2605. X           {
  2606. X               ++files_present;
  2607. X               if (fp = Fopen (argv[i], "r"))
  2608. X                 VOID Push (ExecStack, Cvx (FileFrom (fp)));
  2609. X             else
  2610. X                 fprintf (stderr, "%s: cannot open %s\n", argv[0], argv[i]);
  2611. X          }
  2612. X      }
  2613. X }
  2614. X
  2615. Xstatic void Interpreter ()
  2616. X {
  2617. X    Self = execName = NameFrom ("exec");
  2618. X    while (Height (ExecStack) != 0)
  2619. X     {
  2620. X         int res;
  2621. X         Object item, exop;
  2622. X         
  2623. X         item = Pop (ExecStack);
  2624. X          if (!xCheck (item))
  2625. X             res = Push (OpStack, item);
  2626. X          else if (TypeOf (item) == Operator)
  2627. X              res = ExecOperator (item);
  2628. X          else if (TypeOf (item) == Array)
  2629. X              res = ExecArray (item);
  2630. X          else if (TypeOf (item) == File)
  2631. X              res = ExecFile (item);
  2632. X          else if (TypeOf (item) == Name)    /* names get special treatment for speed */
  2633. X           {
  2634. X               Object newitem;
  2635. X               
  2636. X               newitem = Load (item);
  2637. X               if (TypeOf (newitem) != Condition)
  2638. X                    item = newitem;
  2639. X               
  2640. X               if (!xCheck (item))
  2641. X                 res = Push (OpStack, item);
  2642. X              else if (TypeOf (item) == Operator)
  2643. X                  res = ExecOperator (item);
  2644. X              else if (TypeOf (item) == Array)
  2645. X                  res = ExecArray (item);
  2646. X              else if (TypeOf (item) == File)
  2647. X                  res = ExecFile (item);
  2648. X            else
  2649. X               {
  2650. X                  res = Push (OpStack, item);
  2651. X                   exop = Lookup (TypeOf (item), execName);
  2652. X                   if (TypeOf (exop) != Condition)
  2653. X                       VOID Push (ExecStack, exop);
  2654. X                }
  2655. X            }
  2656. X          else
  2657. X           {
  2658. X               res = Push (OpStack, item);
  2659. X               exop = Lookup (TypeOf (item), execName);
  2660. X               if (TypeOf (exop) != Condition)
  2661. X                   VOID Push (ExecStack, exop);
  2662. X           }
  2663. X          
  2664. X         if (interrupted && !protected)
  2665. X          {
  2666. X             interrupted = FALSE;
  2667. X             error_name = PInterrupt;
  2668. X             res = FALSE;
  2669. X          }
  2670. X         
  2671. X          if (!res)
  2672. X           {
  2673. X               Object error_op;
  2674. X               
  2675. X               VOID Push (OpStack, Self);
  2676. X            error_op = DictLoad (ErrorDict, error_name);
  2677. X            if (TypeOf (error_op) == Condition)
  2678. X                VOID Push (ExecStack, OpError);
  2679. X            else
  2680. X                VOID Push (ExecStack, error_op);
  2681. X             Cbreak (TRUE);
  2682. X          }
  2683. X     }
  2684. X }
  2685. X
  2686. Xstatic void InitErrors ()
  2687. X {
  2688. X    ErrorDict = MakeDict (ERRORDICTSIZE);
  2689. X        PDictFull    = InsErr (ErrorDict, "dictfull",            ErrorFn);
  2690. X        PDictOverflow    = InsErr (ErrorDict, "dictstackoverflow",    ErrorFn);
  2691. X        PDictUnderflow    = InsErr (ErrorDict, "dictstackunderflow",    ErrorFn);
  2692. X        PExecOverflow    = InsErr (ErrorDict, "execstackoverflow",    ErrorFn);
  2693. X        PExecUnderflow    = InsErr (ErrorDict, "execstackunderflow",    ErrorFn);
  2694. X        PInterrupt    = InsErr (ErrorDict, "interrupt",        ErrorFn);
  2695. X        PInvAccess    = InsErr (ErrorDict, "invalidaccess",        ErrorFn);
  2696. X        PInvExit    = InsErr (ErrorDict, "invalidexit",        ErrorFn);
  2697. X        PInvFileAccess    = InsErr (ErrorDict, "invalidfileaccess",    ErrorFn);
  2698. X        PInvFont    = InsErr (ErrorDict, "invalidfont",        ErrorFn);
  2699. X        PInvRestore    = InsErr (ErrorDict, "invalidrestore",        ErrorFn);
  2700. X        PIOError    = InsErr (ErrorDict, "ioerror",            ErrorFn);
  2701. X        PLimitCheck    = InsErr (ErrorDict, "limitcheck",        ErrorFn);
  2702. X        PNoCurrentPoint    = InsErr (ErrorDict, "nocurrentpoint",        ErrorFn);
  2703. X        PRangeCheck    = InsErr (ErrorDict, "rangecheck",        ErrorFn);
  2704. X        POpOverflow    = InsErr (ErrorDict, "stackoverflow",        ErrorFn);
  2705. X        POpUnderflow    = InsErr (ErrorDict, "stackunderflow",        ErrorFn);
  2706. X        PSyntaxError    = InsErr (ErrorDict, "syntaxerror",        ErrorFn);
  2707. X        PTypeCheck    = InsErr (ErrorDict, "typecheck",        ErrorFn);
  2708. X        PUndefined    = InsErr (ErrorDict, "undefined",        ErrorFn);
  2709. X        PUnFilename    = InsErr (ErrorDict, "undefinedfilename",    ErrorFn);
  2710. X        PUnResult    = InsErr (ErrorDict, "undefinedresult",        ErrorFn);
  2711. X        PUnMatched    = InsErr (ErrorDict, "unmatchedmark",        ErrorFn);
  2712. X        PUnregistered    = InsErr (ErrorDict, "unregistered",        ErrorFn);
  2713. X        PVMError    = InsErr (ErrorDict, "VMerror",            ErrorFn);
  2714. X    Install ("errordict", ErrorDict);
  2715. X    OpError = MakeOp ("(errorfn)", ErrorFn, 1, 0, 0, 1, Name);
  2716. X }
  2717. X
  2718. X/*
  2719. X * This is the code to deal with user interrupts
  2720. X * In order to do this cleanly, we effectively poll for interrupts in the
  2721. X * main interpreter loop (above). Possibly any routine which could take an
  2722. X * inordinate amount of time out of this loop should also poll the `interrupted'
  2723. X * variable and generate an error if one is found.
  2724. X * Currently none do - "run"ning a file is done by the interpreter above.
  2725. X *
  2726. X */
  2727. X
  2728. Xstatic catchint ()
  2729. X {
  2730. X     VOID signal (SIGINT, catchint);
  2731. X     interrupted = TRUE;
  2732. X }
  2733. X
  2734. Xint Interrupted ()
  2735. X {
  2736. X    return interrupted && !protected;
  2737. X }
  2738. X
  2739. X/*
  2740. X *    An intrinsic operator generates an error condition by returning FALSE.
  2741. X *    The usual way to do this is to call Error with the PostScript name of
  2742. X *    the error condition.
  2743. X *    
  2744. X */
  2745. X
  2746. Xstatic Object InsErr (dict, name, fn) Object dict; char *name; int (*fn)();
  2747. X {
  2748. X     Object op;
  2749. X     
  2750. X     DictStore (dict, op = NameFrom (name), MakeOp (name, fn, 1, 0, 0, 1, Name));
  2751. X     return op;
  2752. X }
  2753. X
  2754. Xstatic ErrorFn (name) Object name;
  2755. X {
  2756. X     PrintName (Self);
  2757. X     printf (" in operator ");
  2758. X     PrintName (name);
  2759. X     putchar ('\n');
  2760. X     return Push (ExecStack, Cvx (NameFrom ("stop")));
  2761. X }
  2762. X
  2763. Xint Error (error) Object error;
  2764. X {
  2765. X     error_name = error;
  2766. X     return FALSE;
  2767. X }
  2768. X
  2769. XObject MakeObject (type) Type type;
  2770. X {
  2771. X     Object res;
  2772. X     
  2773. X     res.type = type;
  2774. X     res.flags = READABLE | WRITEABLE;
  2775. X     res.Length = res.u.Integer = 0;
  2776. X     
  2777. X     return res;
  2778. X }
  2779. X
  2780. Xint OpCheck (args, res) int args, res;
  2781. X {
  2782. X     if (OpStack->stack_fill < args)
  2783. X         return Error (POpUnderflow);
  2784. X     else if (OpStack->stack_fill - args + res > OpStack->stack_size)
  2785. X         return Error (POpOverflow);
  2786. X     else
  2787. X         return TRUE;
  2788. X }
  2789. X
  2790. XPanicIf (cond, s) int cond; char *s;
  2791. X {
  2792. X     if (cond)
  2793. X         Panic (s);
  2794. X }
  2795. X
  2796. XPanic (s) char *s;
  2797. X {
  2798. X    fprintf (stderr, "PostScript panic: %s\n", s);
  2799. X     fprintf (stderr, "Please report this fault to the support person for this program\n");
  2800. X     Cleanup ();
  2801. X     exit (1);
  2802. X }
  2803. X
  2804. Xint min (a, b) int a, b;
  2805. X {
  2806. X     return a < b ? a : b;
  2807. X }
  2808. X
  2809. Xint rCheck (object) Object object;
  2810. X {
  2811. X     if (object.type == Dictionary)
  2812. X         return object.u.Dictionary->dict_flags & READABLE;
  2813. X     else
  2814. X         return object.flags & READABLE;
  2815. X }
  2816. X
  2817. Xint wCheck (object) Object object;
  2818. X {
  2819. X     if (object.type == Dictionary)
  2820. X         return object.u.Dictionary->dict_flags & WRITEABLE;
  2821. X     else
  2822. X         return object.flags & WRITEABLE;
  2823. X }
  2824. X
  2825. Xint xCheck (object) Object object;
  2826. X {
  2827. X     return object.flags & EXECUTABLE;
  2828. X }
  2829. X
  2830. XObject Cvx (o) Object o;
  2831. X {
  2832. X    o.flags |= EXECUTABLE;
  2833. X    return o;
  2834. X }
  2835. X
  2836. XObject Cvlit (o) Object o;
  2837. X {
  2838. X    o.flags &= ~EXECUTABLE;
  2839. X    return o;
  2840. X }
  2841. X
  2842. XObject ExecOnly (o) Object o;
  2843. X {
  2844. X     if (o.type == Dictionary)
  2845. X         o.u.Dictionary->dict_flags &= ~(READABLE | WRITEABLE);
  2846. X     else
  2847. X         o.flags &= ~(READABLE | WRITEABLE);
  2848. X     return ReadOnly (o);
  2849. X }
  2850. X
  2851. XObject ReadOnly (o) Object o;
  2852. X {
  2853. X     if (o.type == Dictionary)
  2854. X         o.u.Dictionary->dict_flags &= ~WRITEABLE;
  2855. X     else
  2856. X         o.flags &= ~WRITEABLE;
  2857. X     return o;
  2858. X }
  2859. X
  2860. XObject WriteOnly (o) Object o;
  2861. X {
  2862. X     if (o.type == Dictionary)
  2863. X         o.u.Dictionary->dict_flags &= ~READABLE;
  2864. X     else
  2865. X         o.flags &= ~READABLE;
  2866. X     return o;
  2867. X }
  2868. X
  2869. XObject SameFlags (a, b) Object a, b;
  2870. X {
  2871. X    b.flags = a.flags;
  2872. X    return b;
  2873. X }
  2874. X
  2875. Xint Max (a, b) int a, b;
  2876. X {
  2877. X    return a > b ? a : b;
  2878. X }
  2879. X
  2880. Xint Min (a, b) int a, b;
  2881. X {
  2882. X    return a < b ? a : b;
  2883. X }
  2884. END_OF_FILE
  2885. if test 10508 -ne `wc -c <'source/main.c'`; then
  2886.     echo shar: \"'source/main.c'\" unpacked with wrong size!
  2887. fi
  2888. # end of 'source/main.c'
  2889. fi
  2890. if test -f 'source/matrix.c' -a "${1}" != "-c" ; then 
  2891.   echo shar: Will not clobber existing file \"'source/matrix.c'\"
  2892. else
  2893. echo shar: Extracting \"'source/matrix.c'\" \(10133 characters\)
  2894. sed "s/^X//" >'source/matrix.c' <<'END_OF_FILE'
  2895. X/*
  2896. X * Copyright (C) Rutherford Appleton Laboratory 1987
  2897. X * 
  2898. X * This source may be copied, distributed, altered or used, but not sold for profit
  2899. X * or incorporated into a product except under licence from the author.
  2900. X * It is not in the public domain.
  2901. X * This notice should remain in the source unaltered, and any changes to the source
  2902. X * made by persons other than the author should be marked as such.
  2903. X * 
  2904. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  2905. X */
  2906. X#include "main.h"
  2907. X#include "graphics.h"
  2908. X
  2909. XObject AssignMatrix ();
  2910. Xextern Matrix identity;
  2911. Xstatic int PMatrix ();
  2912. Xstatic int PIdentMatrix ();
  2913. Xstatic int PDefaultMatrix ();
  2914. Xstatic int PCurrentMatrix ();
  2915. Xstatic int PSetMatrix ();
  2916. Xstatic int PTranslate ();
  2917. Xstatic int PScale ();
  2918. Xstatic int PRotate ();
  2919. Xstatic int PConcat ();
  2920. Xstatic int PConcatMatrix ();
  2921. Xstatic int PTransform ();
  2922. Xstatic int PDTransform ();
  2923. Xstatic int PITransform ();
  2924. Xstatic int PIDTransform ();
  2925. Xstatic int PInvertMatrix ();
  2926. X
  2927. XInitMatrix ()
  2928. X {
  2929. X     InstallOp ("matrix",        PMatrix,    0, 1, 0, 0);
  2930. X     InstallOp ("initmatrix",    PInitMatrix,    0, 0, 0, 0);
  2931. X     InstallOp ("identmatrix",    PIdentMatrix,    1, 1, 0, 0, Array);
  2932. X     InstallOp ("defaultmatrix",    PDefaultMatrix,    1, 1, 0, 0, Array);
  2933. X     InstallOp ("currentmatrix",    PCurrentMatrix,    1, 1, 0, 0, Array);
  2934. X     InstallOp ("setmatrix",        PSetMatrix,    1, 0, 0, 0, Array);
  2935. X     InstallOp ("translate",        PTranslate,    0, 0, 0, 0);
  2936. X     InstallOp ("scale",        PScale,        0, 0, 0, 0);
  2937. X     InstallOp ("rotate",        PRotate,    0, 0, 0, 0);
  2938. X     InstallOp ("concat",        PConcat,    1, 0, 0, 0, Array);
  2939. X     InstallOp ("concatmatrix",    PConcatMatrix,    3, 1, 0, 0, Array, Array, Array);
  2940. X     InstallOp ("transform",        PTransform,    0, 0, 0, 0);
  2941. X     InstallOp ("dtransform",    PDTransform,    0, 0, 0, 0);
  2942. X     InstallOp ("itransform",    PITransform,    0, 0, 0, 0);
  2943. X     InstallOp ("idtransform",    PIDTransform,    0, 0, 0, 0);
  2944. X     InstallOp ("invertmatrix",    PInvertMatrix,    2, 1, 0, 0, Array, Array);
  2945. X }
  2946. X
  2947. XObject MatrixFrom (m) Matrix m;
  2948. X {
  2949. X     return AssignMatrix (MakeArray ((Object *) Malloc (6 * sizeof (Object)), 6), m);
  2950. X }
  2951. X
  2952. Xint ExtractMatrix (pm, o) Matrix *pm; Object o;
  2953. X {
  2954. X     int i;
  2955. X     float temp[6];
  2956. X     
  2957. X     for (i = 0; i < 6; i++)
  2958. X      {
  2959. X          Object item;
  2960. X          
  2961. X          item = getArray (o, i);
  2962. X          if (TypeOf (item) == Integer)
  2963. X              temp[i] = (float) BodyInteger (item);
  2964. X          else if (TypeOf (item) == Real)
  2965. X              temp[i] = BodyReal (item);
  2966. X          else
  2967. X              return FALSE;
  2968. X      }
  2969. X     
  2970. X     *pm = NewMatrix (temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
  2971. X     return TRUE;
  2972. X }
  2973. X
  2974. Xstatic int PMatrix ()
  2975. X {
  2976. X    return Push (OpStack, MatrixFrom (identity));
  2977. X }
  2978. X
  2979. Xint PInitMatrix ()
  2980. X {
  2981. X     gstate->CTM = gstate->device->default_matrix;
  2982. X     
  2983. X     return TRUE;
  2984. X }
  2985. X
  2986. Xstatic int PIdentMatrix (array) Object array;
  2987. X {
  2988. X     if (lengthArray (array) != 6)
  2989. X         return Error (PRangeCheck);
  2990. X    VOID AssignMatrix (array, identity);
  2991. X    return Push (OpStack, array);
  2992. X }
  2993. X
  2994. Xstatic int PDefaultMatrix (array) Object array;
  2995. X {
  2996. X     if (lengthArray (array) != 6)
  2997. X         return Error (PRangeCheck);
  2998. X    VOID AssignMatrix (array, gstate->device->default_matrix);
  2999. X    return Push (OpStack, array);
  3000. X }
  3001. X
  3002. Xstatic int PCurrentMatrix (array) Object array;
  3003. X {
  3004. X     if (lengthArray (array) != 6)
  3005. X          return Error (PRangeCheck);
  3006. X    VOID AssignMatrix (array, gstate->CTM);
  3007. X    return Push (OpStack, array);
  3008. X }
  3009. X
  3010. Xstatic int PSetMatrix (array) Object array;
  3011. X {
  3012. X     if (lengthArray (array) != 6)
  3013. X           return Error (PRangeCheck);
  3014. X     else if (!ExtractMatrix (&gstate->CTM, array))
  3015. X            return Error (PTypeCheck);
  3016. X    else
  3017. X        return TRUE;
  3018. X }
  3019. X
  3020. Xstatic int PTranslate ()
  3021. X {
  3022. X     Object tx, ty, mat;
  3023. X     float x, y;
  3024. X     
  3025. X     if (!OpCheck (2, 1))
  3026. X         return FALSE;
  3027. X     mat = Pop (OpStack);
  3028. X    if (TypeOf (mat) == Array)
  3029. X         if (!wCheck (mat))
  3030. X              return Push (OpStack, mat), Error (PInvAccess);
  3031. X         else if (lengthArray (mat) != 6)
  3032. X              return Push (OpStack, mat), Error (PRangeCheck);
  3033. X         else
  3034. X          {
  3035. X              ty = Pop (OpStack);
  3036. X              if (TypeOf (ty) == Integer)
  3037. X                  y = (float) BodyInteger (ty);
  3038. X              else if (TypeOf (ty) == Real)
  3039. X                  y = BodyReal (ty);
  3040. X              else
  3041. X                  return Push (OpStack, ty), Push (OpStack, mat), Error (PTypeCheck);
  3042. X              tx = Pop (OpStack);
  3043. X              if (TypeOf (tx) == Integer)
  3044. X                  x = (float) BodyInteger (tx);
  3045. X              else if (TypeOf (tx) == Real)
  3046. X                  x = BodyReal (tx);
  3047. X              else
  3048. X                   return Push (OpStack, tx), Push (OpStack, ty), Push (OpStack, mat), Error (PTypeCheck);
  3049. X             
  3050. X              VOID AssignMatrix (mat, NewMatrix (1.0, 0.0, 0.0, 1.0, x, y));
  3051. X              
  3052. X              return Push (OpStack, mat);
  3053. X          }
  3054. X     else if (TypeOf (mat) == Integer)
  3055. X         y = (float) BodyInteger (mat);
  3056. X     else if (TypeOf (mat) == Real)
  3057. X         y = BodyReal (mat);
  3058. X     else
  3059. X         return Push (OpStack, mat), Error (PTypeCheck);
  3060. X     
  3061. X     tx = Pop (OpStack);
  3062. X     if (TypeOf (tx) == Integer)
  3063. X         x = (float) BodyInteger (tx);
  3064. X     else if (TypeOf (tx) == Real)
  3065. X         x = BodyReal (tx);
  3066. X     else
  3067. X         return Push (OpStack, tx), Push (OpStack, mat), Error (PTypeCheck);
  3068. X     gstate->CTM = Translate (gstate->CTM, x, y);
  3069. X     return TRUE;
  3070. X }
  3071. X
  3072. Xstatic int PScale ()
  3073. X {
  3074. X     Object tx, ty, mat;
  3075. X     float x, y;
  3076. X     
  3077. X     if (!OpCheck (2, 1))
  3078. X         return FALSE;
  3079. X     mat = Pop (OpStack);
  3080. X    if (TypeOf (mat) == Array)
  3081. X         if (!wCheck (mat))
  3082. X              return Push (OpStack, mat), Error (PInvAccess);
  3083. X         else if (lengthArray (mat) != 6)
  3084. X              return Push (OpStack, mat), Error (PRangeCheck);
  3085. X         else
  3086. X          {
  3087. X             ty = Pop (OpStack);
  3088. X              if (TypeOf (ty) == Integer)
  3089. X                  y = (float) BodyInteger (ty);
  3090. X              else if (TypeOf (ty) == Real)
  3091. X                  y = BodyReal (ty);
  3092. X              else
  3093. X                  return Push (OpStack, ty), Push (OpStack, mat), Error (PTypeCheck);
  3094. X              tx = Pop (OpStack);
  3095. X              if (TypeOf (tx) == Integer)
  3096. X                  x = (float) BodyInteger (tx);
  3097. X              else if (TypeOf (tx) == Real)
  3098. X                  x = BodyReal (tx);
  3099. X              else
  3100. X                   return Push (OpStack, tx), Push (OpStack, ty), Push (OpStack, mat), Error (PTypeCheck);
  3101. X             
  3102. X              VOID AssignMatrix (mat, NewMatrix (x, 0.0, 0.0, y, 0.0, 0.0));
  3103. X              
  3104. X              return Push (OpStack, mat);
  3105. X          }
  3106. X     else if (TypeOf (mat) == Integer)
  3107. X         y = (float) BodyInteger (mat);
  3108. X     else if (TypeOf (mat) == Real)
  3109. X         y = BodyReal (mat);
  3110. X     else
  3111. X         return Push (OpStack, mat), Error (PTypeCheck);
  3112. X     
  3113. X     tx = Pop (OpStack);
  3114. X     if (TypeOf (tx) == Integer)
  3115. X         x = (float) BodyInteger (tx);
  3116. X     else if (TypeOf (tx) == Real)
  3117. X         x = BodyReal (tx);
  3118. X     else
  3119. X         return Push (OpStack, tx), Push (OpStack, mat), Error (PTypeCheck);
  3120. X     gstate->CTM = Scale (gstate->CTM, x, y);
  3121. X     return TRUE;
  3122. X }
  3123. X
  3124. Xstatic int PRotate ()
  3125. X {
  3126. X     Object ang, mat;
  3127. X     float a;
  3128. X     
  3129. X     if (!OpCheck (1, 1))
  3130. X         return FALSE;
  3131. X     mat = Pop (OpStack);
  3132. X    if (TypeOf (mat) == Array)
  3133. X         if (!wCheck (mat))
  3134. X              return Push (OpStack, mat), Error (PInvAccess);
  3135. X         else if (lengthArray (mat) != 6)
  3136. X              return Push (OpStack, mat), Error (PRangeCheck);
  3137. X         else
  3138. X          {
  3139. X             ang = Pop (OpStack);
  3140. X              if (TypeOf (ang) == Integer)
  3141. X                  a = (float) BodyInteger (ang);
  3142. X              else if (TypeOf (ang) == Real)
  3143. X                  a = BodyReal (ang);
  3144. X              else
  3145. X                  return Push (OpStack, ang), Push (OpStack, mat), Error (PTypeCheck);
  3146. X              
  3147. X              VOID AssignMatrix (mat, NewMatrix (cos(a), sin(a), -sin(a), -cos(a), 0.0, 0.0));
  3148. X              
  3149. X              return Push (OpStack, mat);
  3150. X          }
  3151. X     else if (TypeOf (mat) == Integer)
  3152. X         a = (float) BodyInteger (mat);
  3153. X     else if (TypeOf (mat) == Real)
  3154. X         a = BodyReal (mat);
  3155. X     else
  3156. X         return Push (OpStack, mat), Error (PTypeCheck);
  3157. X     
  3158. X     gstate->CTM = Rotate (gstate->CTM, Rad (a));
  3159. X     return TRUE;
  3160. X }
  3161. X
  3162. Xstatic int PConcat (mat) Object mat;
  3163. X {
  3164. X     Matrix m;
  3165. X     
  3166. X     if (!ExtractMatrix (&m, mat))
  3167. X         return Error (PTypeCheck);
  3168. X     gstate->CTM = MatMult (m, gstate->CTM);
  3169. X     return TRUE;
  3170. X }
  3171. X
  3172. Xstatic int PConcatMatrix (mat1, mat2, mat3) Object mat1, mat2, mat3;
  3173. X {
  3174. X     Matrix m1, m2;
  3175. X     
  3176. X     if (!ExtractMatrix (&m1, mat1) || !ExtractMatrix (&m2, mat2) ||
  3177. X             lengthArray (mat3) != 6)
  3178. X         return Error (PTypeCheck);
  3179. X     VOID AssignMatrix (mat3, MatMult (m1, m2));
  3180. X     VOID Push (OpStack, mat3);
  3181. X     return TRUE;
  3182. X }
  3183. X
  3184. Xstatic int Transfn (fn) Vector (*fn)();
  3185. X {
  3186. X     Matrix m;
  3187. X     Object tx, ty, mat;
  3188. X     Vector v;
  3189. X     float x, y;
  3190. X     int mflag = FALSE;
  3191. X     
  3192. X     m = gstate->CTM;
  3193. X    if (!OpCheck (2, 1))
  3194. X         return FALSE;
  3195. X     
  3196. X     mat = Pop (OpStack);
  3197. X    if (TypeOf (mat) == Array)
  3198. X     {
  3199. X         if (lengthArray (mat) != 6 || !ExtractMatrix (&m, mat))
  3200. X              return Push (OpStack, mat), Error (PTypeCheck);
  3201. X         mflag = TRUE;
  3202. X      }
  3203. X    else
  3204. X         VOID Push (OpStack, mat);
  3205. X    
  3206. X    if (!OpCheck (2, 1))
  3207. X         return Push (OpStack, mat), FALSE;
  3208. X     ty = Pop (OpStack);
  3209. X    if (TypeOf (ty) == Integer)
  3210. X        y = (float) BodyInteger (ty);
  3211. X    else if (TypeOf (ty) == Real)
  3212. X        y = BodyReal (ty);
  3213. X    else
  3214. X     {
  3215. X         VOID Push (OpStack, ty);
  3216. X         if (mflag)
  3217. X            VOID Push (OpStack, mat);
  3218. X        return Error (PTypeCheck);
  3219. X     }
  3220. X    tx = Pop (OpStack);
  3221. X     if (TypeOf (tx) == Integer)
  3222. X         x = (float) BodyInteger (tx);
  3223. X     else if (TypeOf (tx) == Real)
  3224. X         x = BodyReal (tx);
  3225. X     else
  3226. X     {
  3227. X         VOID Push (OpStack, tx);
  3228. X         VOID Push (OpStack, ty);
  3229. X         if (mflag)
  3230. X            VOID Push (OpStack, mat);
  3231. X        return Error (PTypeCheck);
  3232. X     }
  3233. X    
  3234. X    v = (*fn) (NewVector (x, y, 1.0), m);
  3235. X         
  3236. X    return Push (OpStack, MakeReal (v.vx)), Push (OpStack, MakeReal (v.vy));
  3237. X }
  3238. X
  3239. Xstatic int PTransform ()
  3240. X {
  3241. X     return Transfn (Transform);
  3242. X }
  3243. X
  3244. Xstatic int PDTransform ()
  3245. X {
  3246. X     return Transfn (DTransform);
  3247. X }
  3248. X
  3249. Xstatic int PITransform ()
  3250. X {
  3251. X     return Transfn (ITransform);
  3252. X }
  3253. X
  3254. Xstatic int PIDTransform ()
  3255. X {
  3256. X     return Transfn (IDTransform);
  3257. X }
  3258. X
  3259. Xstatic int PInvertMatrix (mat1, mat2) Object mat1, mat2;
  3260. X {
  3261. X     Matrix m;
  3262. X     
  3263. X     if (!ExtractMatrix (&m, mat1) || lengthArray (mat2) != 6)
  3264. X         return Error (PTypeCheck);
  3265. X     VOID AssignMatrix (mat2, MatInvert (m));
  3266. X     VOID Push (OpStack, mat2);
  3267. X     return TRUE;
  3268. X }
  3269. X
  3270. XPoint IntToExt (p) HardPoint p;
  3271. X {
  3272. X     Vector v;
  3273. X     
  3274. X     v = Transform (NewVector ((float) p.hx, (float) p.hy, 1.0), MatInvert (gstate->CTM));
  3275. X     return NewPoint (v.vx, v.vy);
  3276. X }
  3277. X
  3278. XHardPoint ExtToInt (p) Point p;
  3279. X {
  3280. X    Vector v;
  3281. X    
  3282. X    v = Transform (NewVector (p.x, p.y, 1.0), gstate->CTM);
  3283. X    return NewHardPoint (v.vx, v.vy);
  3284. X }
  3285. X
  3286. XMatrix PointTranslate (m, p) Matrix m; Point p;
  3287. X {
  3288. X     return Translate (m, p.x, p.y);
  3289. X }
  3290. X
  3291. XMatrix HardPointTranslate (m, p) Matrix m; HardPoint p;
  3292. X {
  3293. X     m.tx += p.hx;
  3294. X     m.ty += p.hy;
  3295. X     
  3296. X     return m;
  3297. X }
  3298. X
  3299. XObject AssignMatrix (o, m) Object o; Matrix m;
  3300. X {
  3301. X     Object *vec = BodyArray (o);
  3302. X     
  3303. X     vec[0] = MakeReal (m.A);
  3304. X     vec[1] = MakeReal (m.B);
  3305. X     vec[2] = MakeReal (m.C);
  3306. X     vec[3] = MakeReal (m.D);
  3307. X     vec[4] = MakeReal (m.tx);
  3308. X     vec[5] = MakeReal (m.ty);
  3309. X     
  3310. X     return o;
  3311. X }
  3312. END_OF_FILE
  3313. if test 10133 -ne `wc -c <'source/matrix.c'`; then
  3314.     echo shar: \"'source/matrix.c'\" unpacked with wrong size!
  3315. fi
  3316. # end of 'source/matrix.c'
  3317. fi
  3318. if test -f 'source/path.c' -a "${1}" != "-c" ; then 
  3319.   echo shar: Will not clobber existing file \"'source/path.c'\"
  3320. else
  3321. echo shar: Extracting \"'source/path.c'\" \(10211 characters\)
  3322. sed "s/^X//" >'source/path.c' <<'END_OF_FILE'
  3323. X/*
  3324. X * Copyright (C) Rutherford Appleton Laboratory 1987
  3325. X * 
  3326. X * This source may be copied, distributed, altered or used, but not sold for profit
  3327. X * or incorporated into a product except under licence from the author.
  3328. X * It is not in the public domain.
  3329. X * This notice should remain in the source unaltered, and any changes to the source
  3330. X * made by persons other than the author should be marked as such.
  3331. X * 
  3332. X *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  3333. X */
  3334. X#include "main.h"
  3335. X
  3336. X#include "graphics.h"
  3337. X
  3338. X#define PATHFORALLDEPTH 500
  3339. X    
  3340. Xstatic int PCurrentPoint ();
  3341. Xstatic int PMoveTo ();
  3342. Xstatic int PRMoveTo ();
  3343. Xstatic int PLineTo ();
  3344. Xstatic int PRLineTo ();
  3345. Xstatic int PArc ();
  3346. Xstatic int PArcN ();
  3347. Xstatic int PArcTo ();
  3348. Xstatic int PCurveTo ();
  3349. Xstatic int PRCurveTo ();
  3350. Xstatic int PClosePath ();
  3351. Xstatic int PPathBBox ();
  3352. Xstatic int PReversePath ();
  3353. Xstatic int PPathForAll ();
  3354. X
  3355. Xstatic int PathForAll ();
  3356. Xstatic int PPathProc ();
  3357. X
  3358. Xint PFlattenPath ();
  3359. X
  3360. XObject OpPathForAll;
  3361. X
  3362. XInitPath ()
  3363. X {
  3364. X     OpPathForAll = MakeOp ("(oppathforall)", PathForAll, 0, 6, 7, 7);
  3365. X     
  3366. X     InstallOp ("newpath",        PNewPath,    0, 0, 0, 0);
  3367. X     InstallOp ("currentpoint",    PCurrentPoint,    0, 2, 0, 0);
  3368. X      InstallOp ("moveto",        PMoveTo,    2, 0, 0, 0, Float, Float);
  3369. X    InstallOp ("rmoveto",        PRMoveTo,    2, 0, 0, 0, Float, Float);
  3370. X     InstallOp ("lineto",        PLineTo,    2, 0, 0, 0, Float, Float);
  3371. X     InstallOp ("rlineto",        PRLineTo,    2, 0, 0, 0, Float, Float);
  3372. X     InstallOp ("arc",        PArc,        5, 0, 0, 0, Float, Float, Float, Float, Float);
  3373. X     InstallOp ("arcn",        PArcN,        5, 0, 0, 0, Float, Float, Float, Float, Float);
  3374. X     InstallOp ("arcto",        PArcTo,        5, 4, 0, 0, Float, Float, Float, Float, Float);
  3375. X     InstallOp ("curveto",        PCurveTo,    6, 0, 0, 0, Float, Float, Float, Float, Float, Float);
  3376. X     InstallOp ("rcurveto",        PRCurveTo,    6, 0, 0, 0, Float, Float, Float, Float, Float, Float);
  3377. X     InstallOp ("closepath",        PClosePath,    0, 0, 0, 0);
  3378. X     InstallOp ("pathbbox",        PPathBBox,    0, 4, 0, 0);
  3379. X     InstallOp ("flattenpath",    PFlattenPath,    0, 0, 0, 0);
  3380. X     InstallOp ("reversepath",    PReversePath,    0, 0, 0, 0);
  3381. X     InstallOp ("pathforall",    PPathForAll,    4, 0, 0, 6, Array, Array, Array, Array);
  3382. X     InstallOp ("pathproc",        PPathProc,    0, 1, 0, 0);
  3383. X    gstate->path = NewPath ();
  3384. X    gstate->clip = NewPath ();
  3385. X }
  3386. X
  3387. Xint PNewPath ()
  3388. X {
  3389. X     gstate->cp_defined = FALSE;
  3390. X     PathFree (gstate->path);
  3391. X     gstate->path = NewPath ();
  3392. X     return TRUE;
  3393. X }
  3394. X
  3395. Xstatic int PCurrentPoint ()
  3396. X {
  3397. X     Point cp;
  3398. X     
  3399. X    if (!gstate->cp_defined)
  3400. X         return Error (PNoCurrentPoint);
  3401. X     cp = IntToExt (gstate->cp);
  3402. X     VOID Push (OpStack, MakeReal (PointX (cp)));
  3403. X     VOID Push (OpStack, MakeReal (PointY (cp)));
  3404. X     return TRUE;
  3405. X }
  3406. X
  3407. Xstatic int PMoveTo (x, y) Object x, y;
  3408. X {
  3409. X     return MoveTo (gstate->path, ExtToInt (NewPoint (BodyReal (x), BodyReal (y))));
  3410. X }
  3411. X
  3412. Xstatic int PRMoveTo (x, y) Object x, y;
  3413. X {
  3414. X    if (!gstate->cp_defined)
  3415. X         return Error (PNoCurrentPoint);
  3416. X     return MoveTo (gstate->path, ExtToInt (MovePoint (NewPoint (BodyReal (x), BodyReal (y)), IntToExt (gstate->cp))));
  3417. X }
  3418. X
  3419. Xstatic int PLineTo (x, y) Object x, y;
  3420. X {
  3421. X    if (!gstate->cp_defined)
  3422. X         return Error (PNoCurrentPoint);
  3423. X    return LineTo (gstate->path, ExtToInt (NewPoint (BodyReal (x), BodyReal (y))));
  3424. X }
  3425. X
  3426. X
  3427. Xstatic int PRLineTo (x, y) Object x, y;
  3428. X {
  3429. X    if (!gstate->cp_defined)
  3430. X         return Error (PNoCurrentPoint);
  3431. X     return LineTo (gstate->path, ExtToInt (MovePoint (NewPoint (BodyReal (x), BodyReal (y)), IntToExt (gstate->cp))));
  3432. X }
  3433. X
  3434. Xstatic int PArc (x, y, rad, ang1, ang2) Object x, y, rad, ang1, ang2;
  3435. X {
  3436. X     Point centre, start;
  3437. X     float a1 = Rad (BodyReal (ang1)), a2 = Rad (BodyReal (ang2));
  3438. X     float r = BodyReal (rad);
  3439. X     
  3440. X     start = NewPoint (cos (a1) * r, sin (a1) * r);
  3441. X     centre = NewPoint (BodyReal (x), BodyReal (y));
  3442. X     if (!(*(EmptyPath (gstate->path) ? MoveTo : LineTo)) (gstate->path, ExtToInt (MovePoint (centre, start))))
  3443. X        return FALSE;
  3444. X     return Arc (gstate->path, 1, centre, r, a1, a2);
  3445. X }
  3446. X
  3447. Xstatic int PArcN (x, y, rad, ang1, ang2) Object x, y, rad, ang1, ang2;
  3448. X {
  3449. X     Point centre, start;
  3450. X     float a1 = Rad (BodyReal (ang1)), a2 = Rad (BodyReal (ang2));
  3451. X     float r = BodyReal (rad);
  3452. X     
  3453. X     start = NewPoint (cos (a1) * r, sin (a1) * r);
  3454. X     centre = NewPoint (BodyReal (x), BodyReal (y));
  3455. X     if (!(*(EmptyPath (gstate->path) ? MoveTo : LineTo)) (gstate->path, ExtToInt (MovePoint (centre, start))))
  3456. X        return FALSE;
  3457. X     return Arc (gstate->path, -1, centre, r, a1, a2);
  3458. X }
  3459. X
  3460. Xstatic int PArcTo (X1, Y1, X2, Y2, rad) Object X1, Y1, X2, Y2, rad;
  3461. X {
  3462. X     float xt1, xt2, yt1, yt2;
  3463. X     if (!gstate->cp_defined)
  3464. X         return Error (PNoCurrentPoint);
  3465. X     
  3466. X    return ArcTo (gstate->path, gstate->cp,
  3467. X            BodyReal (X1), BodyReal (Y1), BodyReal (X2), BodyReal (Y2), BodyReal (rad),
  3468. X             &xt1, &yt1, &xt2,  &yt2) &&
  3469. X         Push (OpStack, MakeReal (xt1)) &&
  3470. X        Push (OpStack, MakeReal (yt1)) &&
  3471. X        Push (OpStack, MakeReal (xt2)) &&
  3472. X        Push (OpStack, MakeReal (yt2));
  3473. X }
  3474. X
  3475. Xstatic int PCurveTo (x0, y0, x1, y1, x2, y2) Object x0, y0, x1, y1, x2, y2;
  3476. X {
  3477. X    if (!gstate->cp_defined)
  3478. X         return Error (PNoCurrentPoint);
  3479. X     return CurveTo (gstate->path,
  3480. X             ExtToInt (NewPoint (BodyReal (x0), BodyReal (y0))),
  3481. X             ExtToInt (NewPoint (BodyReal (x1), BodyReal (y1))),
  3482. X             ExtToInt (NewPoint (BodyReal (x2), BodyReal (y2))));
  3483. X }
  3484. X
  3485. Xstatic int PRCurveTo (x0, y0, x1, y1, x2, y2) Object x0, y0, x1, y1, x2, y2;
  3486. X {
  3487. X     Point cp;
  3488. X     
  3489. X    if (!gstate->cp_defined)
  3490. X         return Error (PNoCurrentPoint);
  3491. X     cp = IntToExt (gstate->cp);
  3492. X     return CurveTo (gstate->path,
  3493. X             ExtToInt (MovePoint (cp, NewPoint (BodyReal (x0), BodyReal (y0)))),
  3494. X             ExtToInt (MovePoint (cp, NewPoint (BodyReal (x1), BodyReal (y1)))),
  3495. X             ExtToInt (MovePoint (cp, NewPoint (BodyReal (x2), BodyReal (y2)))));
  3496. X }
  3497. X
  3498. Xstatic int PClosePath ()
  3499. X {
  3500. X     return ClosePath (gstate->path);
  3501. X }
  3502. X
  3503. Xint PFlattenPath ()
  3504. X {
  3505. X     Path res;
  3506. X     
  3507. X     if ((res = FlattenPath (gstate->path)) == NULL)
  3508. X         return Error (PLimitCheck);
  3509. X     SetPath (&gstate->path, res);
  3510. X    return TRUE;
  3511. X }
  3512. X
  3513. Xstatic int PReversePath ()
  3514. X {
  3515. X    Path res;
  3516. X     
  3517. X     if ((res = ReversePath (gstate->path)) == NULL)
  3518. X         return Error (PLimitCheck);
  3519. X      SetPath (&gstate->path, res);
  3520. X     return TRUE;    
  3521. X }
  3522. X
  3523. Xstatic Path pathforall [PATHFORALLDEPTH], *pathp = pathforall;
  3524. Xstatic int path_depth = 0;
  3525. X
  3526. Xstatic int PPathForAll (move, line, curve, close) Object move, line, curve, close;
  3527. X {
  3528. X     Path res;
  3529. X     
  3530. X     if ((res = PathCopy (gstate->path)) == NULL || path_depth == PATHFORALLDEPTH - 1)
  3531. X         return Error (PLimitCheck);
  3532. X     *++pathp = res;
  3533. X     ++path_depth;
  3534. X     VOID Push (ExecStack, Nil);
  3535. X     VOID Push (ExecStack, move);
  3536. X     VOID Push (ExecStack, line);
  3537. X     VOID Push (ExecStack, curve);
  3538. X     VOID Push (ExecStack, close);
  3539. X     VOID Push (ExecStack, OpPathForAll);
  3540. X     return TRUE;
  3541. X }
  3542. X
  3543. Xstatic int PathForAll ()
  3544. X {
  3545. X     Path res;
  3546. X     Object move, line, curve, close, fn;
  3547. X     Point p;
  3548. X     
  3549. X     close = Pop (ExecStack);
  3550. X     curve = Pop (ExecStack);
  3551. X     line = Pop (ExecStack);
  3552. X     move = Pop (ExecStack);
  3553. X     if (EmptyPath (*pathp))
  3554. X      {
  3555. X          PathFree (*pathp--);
  3556. X          --path_depth;
  3557. X          VOID Pop (ExecStack);
  3558. X         return TRUE;
  3559. X      }
  3560. X     res = (*pathp)->next;
  3561. X     switch (res->ptype)
  3562. X      {
  3563. X          case EMove:
  3564. X              p = IntToExt (res->pe.point);
  3565. X              VOID Push (OpStack, MakeReal (p.x));
  3566. X              VOID Push (OpStack, MakeReal (p.y));
  3567. X              fn = move;
  3568. X              break;
  3569. X          
  3570. X          case ELine:
  3571. X               p = IntToExt (res->pe.point);
  3572. X              VOID Push (OpStack, MakeReal (p.x));
  3573. X              VOID Push (OpStack, MakeReal (p.y));
  3574. X              fn = line;
  3575. X              break;
  3576. X          
  3577. X         case ECurve:
  3578. X             p = IntToExt (res->pe.curve.x0);
  3579. X              VOID Push (OpStack, MakeReal (p.x));
  3580. X              VOID Push (OpStack, MakeReal (p.y));
  3581. X             p = IntToExt (res->pe.curve.x1);
  3582. X              VOID Push (OpStack, MakeReal (p.x));
  3583. X              VOID Push (OpStack, MakeReal (p.y));
  3584. X             p = IntToExt (res->pe.curve.x2);
  3585. X              VOID Push (OpStack, MakeReal (p.x));
  3586. X              VOID Push (OpStack, MakeReal (p.y));
  3587. X             fn = curve;
  3588. X             break;
  3589. X         
  3590. X         case EClose:
  3591. X             fn = close;
  3592. X             break;
  3593. X         
  3594. X         default:
  3595. X             Panic ("OpPathForAll - encounters unknown path element");
  3596. X     }
  3597. X    VOID Push (ExecStack, move);
  3598. X    VOID Push (ExecStack, line);
  3599. X    VOID Push (ExecStack, curve);
  3600. X    VOID Push (ExecStack, close);
  3601. X    VOID Push (ExecStack, OpPathForAll);
  3602. X    VOID Push (ExecStack, fn);
  3603. X    
  3604. X    PathDelete (res->next);
  3605. X    return TRUE;
  3606. X }
  3607. X
  3608. Xstatic int PPathProc ()
  3609. X {
  3610. X     Object *body, *p;
  3611. X     int sum = 0;
  3612. X     Path pa;
  3613. X     Point po;
  3614. X     
  3615. X     for (pa = gstate->path->next; pa != gstate->path; pa = pa->next)
  3616. X         switch (pa->ptype)
  3617. X          {
  3618. X              case EMove: case ELine: sum += 3; break;
  3619. X              case ECurve: sum += 7; break;
  3620. X              case EClose: ++sum; break;
  3621. X          }
  3622. X     
  3623. X    p = body = (Object *) Malloc ((unsigned) sizeof (Object) * sum);
  3624. X     for (pa = gstate->path->next; pa != gstate->path; pa = pa->next)
  3625. X         switch (pa->ptype)
  3626. X          {
  3627. X              case EMove:
  3628. X                  po = IntToExt (pa->pe.point);
  3629. X                   *p++ = MakeReal (po.x);
  3630. X                  *p++ = MakeReal (po.y);
  3631. X                   *p++ = Cvx (NameFrom ("moveto"));
  3632. X                 break;
  3633. X              
  3634. X             case ELine:
  3635. X                 po = IntToExt (pa->pe.point);
  3636. X                   *p++ = MakeReal (po.x);
  3637. X                  *p++ = MakeReal (po.y);
  3638. X                   *p++ = Cvx (NameFrom ("lineto"));
  3639. X                 break;
  3640. X              
  3641. X              case ECurve:
  3642. X                  po = IntToExt (pa->pe.curve.x0);
  3643. X                   *p++ = MakeReal (po.x);
  3644. X                  *p++ = MakeReal (po.y);
  3645. X                  po = IntToExt (pa->pe.curve.x1);
  3646. X                   *p++ = MakeReal (po.x);
  3647. X                  *p++ = MakeReal (po.y);
  3648. X                 po = IntToExt (pa->pe.curve.x2);
  3649. X                   *p++ = MakeReal (po.x);
  3650. X                  *p++ = MakeReal (po.y);
  3651. X                 *p++ = Cvx (NameFrom ("curve"));
  3652. X                 break;
  3653. X              
  3654. X              case EClose:
  3655. X                  *p++ = Cvx (NameFrom ("closepath"));
  3656. X                  break;
  3657. X          }
  3658. X     return Push (OpStack, Cvx (MakeArray (body, sum)));
  3659. X }
  3660. X
  3661. Xstatic int PPathBBox ()
  3662. X {
  3663. X     Point right_top, left_bottom, left_top, right_bottom;
  3664. X     float left, right, top, bottom, uleft, uright, utop, ubottom;
  3665. X     
  3666. X     if (!PathBBox (&left, &right, &top, &bottom))
  3667. X         return FALSE;
  3668. X     
  3669. X     left_bottom    = IntToExt (NewHardPoint (left, bottom));
  3670. X     right_bottom    = IntToExt (NewHardPoint (right, bottom));
  3671. X     right_top     = IntToExt (NewHardPoint (right, top));
  3672. X     left_top    = IntToExt (NewHardPoint (left, top));
  3673. X     
  3674. X     uleft = uright = left_bottom.x; utop = ubottom = left_bottom.y;
  3675. X     UserBound (&uleft, &uright, &utop, &ubottom, left_top);
  3676. X     UserBound (&uleft, &uright, &utop, &ubottom, right_top);
  3677. X     UserBound (&uleft, &uright, &utop, &ubottom, right_bottom);
  3678. X     
  3679. X     VOID Push (OpStack, MakeReal (uleft));
  3680. X      VOID Push (OpStack, MakeReal (ubottom));
  3681. X     VOID Push (OpStack, MakeReal (uright));
  3682. X    VOID Push (OpStack, MakeReal (utop));
  3683. X     
  3684. X    return TRUE;
  3685. X }
  3686. END_OF_FILE
  3687. if test 10211 -ne `wc -c <'source/path.c'`; then
  3688.     echo shar: \"'source/path.c'\" unpacked with wrong size!
  3689. fi
  3690. # end of 'source/path.c'
  3691. fi
  3692. echo shar: End of archive 8 \(of 18\).
  3693. cp /dev/null ark8isdone
  3694. MISSING=""
  3695. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  3696.     if test ! -f ark${I}isdone ; then
  3697.     MISSING="${MISSING} ${I}"
  3698.     fi
  3699. done
  3700. if test "${MISSING}" = "" ; then
  3701.     echo You have unpacked all 18 archives.
  3702.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3703. else
  3704.     echo You still need to unpack the following archives:
  3705.     echo "        " ${MISSING}
  3706. fi
  3707. ##  End of shell archive.
  3708. exit 0
  3709.  
  3710.