home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0657.ZIP / CCE_0657.PD / EPICE.STY < prev    next >
Text File  |  1994-03-29  |  9KB  |  224 lines

  1. \makeatletter
  2. \typeout{%
  3. Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986}
  4. \def\lop#1\to#2{\expandafter\lopoff#1\lopoff#1#2}
  5. \long\def\lopoff,#1,#2\lopoff#3#4{\def#4{#1}\def#3{,#2}}
  6. \def\@@mlistempty{,}
  7. \newif\iflistnonempty
  8. \def\multiputlist(#1,#2)(#3,#4){\@ifnextchar
  9. [{\@imultiputlist(#1,#2)(#3,#4)}{\@imultiputlist(#1,#2)(#3,#4)[]}}
  10.  
  11. \long\def\@imultiputlist(#1,#2)(#3,#4)[#5]#6{{%
  12. \@xdim=#1\unitlength \@ydim=#2\unitlength
  13. \listnonemptytrue \def\@@mlist{,#6,} % need this for end condition
  14. \loop
  15. \lop\@@mlist\to\@@firstoflist
  16. \@killglue\raise\@ydim\hbox to\z@{\hskip
  17. \@xdim\@imakepicbox(0,0)[#5]{\@@firstoflist}\hss}
  18. \advance\@xdim #3\unitlength\advance\@ydim #4\unitlength
  19. \ifx\@@mlist\@@mlistempty \listnonemptyfalse\fi
  20. \iflistnonempty
  21. \repeat\relax
  22. \ignorespaces}}
  23. \newcount\@@multicnt
  24. \def\matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{%
  25. \ifnum#5>#8\@matrixput(#1,#2)(#3,#4){#5}(#6,#7){#8}{#9}%
  26. \else\@matrixput(#1,#2)(#6,#7){#8}(#3,#4){#5}{#9}\fi}
  27.  
  28. %% here #5 >= #8
  29. \long\def\@matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{{\@killglue%
  30. \@multicnt=#5\relax\@@multicnt=#8\relax%
  31. \@xdim=0pt%
  32. \@ydim=0pt%
  33. \setbox\@tempboxa\hbox{\@whilenum \@multicnt > 0\do {%
  34. %%\typeout{\the\@multicnt, \the\@@multicnt}%
  35. \raise\@ydim\hbox to \z@{\hskip\@xdim #9\hss}%
  36. \advance\@multicnt \m@ne%
  37. \advance\@xdim #3\unitlength\advance\@ydim #4\unitlength}}%
  38. \@xdim=#1\unitlength%
  39. \@ydim=#2\unitlength%
  40. \@whilenum \@@multicnt > 0\do {%
  41. \raise\@ydim\hbox to \z@{\hskip\@xdim \copy\@tempboxa\hss}%
  42. \advance\@@multicnt \m@ne%
  43. \advance\@xdim #6\unitlength\advance\@ydim #7\unitlength}%
  44. \ignorespaces}}
  45. \newcount\d@lta
  46. \newdimen\@delta
  47. \newdimen\@@delta
  48. \newcount\@gridcnt
  49. \def\grid(#1,#2)(#3,#4){\@ifnextchar [{\@igrid(#1,#2)(#3,#4)}%
  50. {\@igrid(#1,#2)(#3,#4)[@,@]}}
  51.  
  52. \long\def\@igrid(#1,#2)(#3,#4)[#5,#6]{%
  53. \makebox(#1,#2){%
  54. \@delta=#1pt\@@delta=#3pt\divide\@delta \@@delta\d@lta=\@delta%
  55. \advance\d@lta \@ne\relax\message{grid=\the\d@lta\space x}%
  56. %% copied the definition of \line(0,1){#2} for some efficiency!.
  57. \multiput(0,0)(#3,0){\d@lta}{\hbox to\z@{\hskip -\@halfwidth \vrule
  58.          \@width \@wholewidth \@height #2\unitlength \@depth \z@\hss}}%
  59. \ifx#5@\relax\else%
  60. \global\@gridcnt=#5%
  61. \multiput(0,0)(#3,0){\d@lta}{%
  62. \makebox(0,-2)[t]{\number\@gridcnt\global\advance\@gridcnt by #3}}%
  63. \global\@gridcnt=#5%
  64. \multiput(0,#2)(#3,0){\d@lta}{%
  65. \makebox(0,0)[b]{\number\@gridcnt\vspace{2mm}\global\advance\@gridcnt by #3}}%
  66. \fi%
  67. \@delta=#2pt\@@delta=#4pt\divide\@delta \@@delta\d@lta=\@delta%
  68. \advance\d@lta \@ne\relax\message{\the\d@lta . }%
  69. %% copied the definition of \line(1,0){#1} for some efficiency!.
  70. \multiput(0,0)(0,#4){\d@lta}{\vrule \@height \@halfwidth \@depth \@halfwidth
  71.          \@width #1\unitlength}%
  72. \ifx#6@\relax\else
  73. \global\@gridcnt=#6%
  74. \multiput(0,0)(0,#4){\d@lta}{%
  75. \makebox(0,0)[r]{\number\@gridcnt\ \global\advance\@gridcnt by #4}}%
  76. \global\@gridcnt=#6%
  77. \multiput(#1,0)(0,#4){\d@lta}{%
  78. \makebox(0,0)[l]{\ \number\@gridcnt\global\advance\@gridcnt by #4}}%
  79. \fi}}
  80. \def\picsquare@bl{\vrule height \@wholewidth depth \z@  width \@wholewidth}
  81. \newif\if@jointhem \global\@jointhemfalse
  82. \newif\if@firstpoint \global\@firstpointtrue
  83. \newcount\@joinkind
  84. %%%\def\dottedjoin
  85. \def\@idottedjoin[#1]#2{\gdef\dotchar@join{#1}\gdef\dotgap@join{#2}}
  86. \def\enddottedjoin{\global\@jointhemfalse \global\@firstpointtrue\egroup}
  87. \def\dashjoin{\global\@jointhemtrue \global\@joinkind=1\relax
  88.   \bgroup\@ifnextchar[{\@idashjoin}{\@idashjoin[\dashlinestretch]}}
  89. \def\@idashjoin[#1]#2{\edef\dashlinestretch{#1}\gdef\dashlen@join{#2}%
  90. \@ifnextchar[{\@iidashjoin}{\gdef\dotgap@join{}}}
  91. \def\@iidashjoin[#1]{\gdef\dotgap@join{#1}}
  92. \let\enddashjoin\enddottedjoin
  93. \def\drawjoin{\global\@jointhemtrue \global\@joinkind=2\relax
  94.   \bgroup\@ifnextchar[{\@idrawjoin}{}}
  95. \def\@idrawjoin[#1]{\def\drawlinestretch{#1}}
  96. \let\enddrawjoin\enddottedjoin
  97. %%% \jput-def.
  98. \newdimen\@dotgap
  99. \newdimen\@ddotgap
  100. \newcount\@x@diff
  101. \newcount\@y@diff
  102. \newdimen\x@diff
  103. \newdimen\y@diff
  104. \newbox\@dotbox
  105. \newcount\num@segments
  106. \newcount\num@segmentsi
  107. \newif\ifsqrt@done
  108. \def\sqrtandstuff#1#2#3{
  109. \ifdim #1 <0pt \@x@diff= -#1 \else\@x@diff=#1\fi
  110. \ifdim #2 <0pt \@y@diff= -#2 \else\@y@diff=#2\fi
  111. %% @diff's will be positive and diff's will retain their sign.
  112. \@dotgap=#3 \divide\@dotgap \tw@
  113. \advance\@x@diff \@dotgap \advance\@y@diff \@dotgap% for round-off errors
  114. \@dotgap=#3
  115. \divide\@x@diff \@dotgap \divide\@y@diff \@dotgap
  116. \sqrt@donefalse
  117. \ifnum\@x@diff < 2
  118.    \ifnum\@y@diff < 2 \num@segments=\@x@diff \advance\num@segments \@y@diff
  119.                       \sqrt@donetrue
  120.         \else\num@segments=\@y@diff \sqrt@donetrue\fi
  121.    \else\ifnum\@y@diff < 2 \num@segments=\@x@diff \sqrt@donetrue\fi
  122. \fi
  123. \ifsqrt@done \ifnum\num@segments=\z@ \num@segments=\@ne\fi\relax
  124.  \else \ifnum\@y@diff >\@x@diff
  125.                  \@tempcnta=\@x@diff \@x@diff=\@y@diff \@y@diff=\@tempcnta
  126.        \fi              %exchange @x@diff & @y@diff, so now @x@diff > @y@diff
  127.   \num@segments=\@y@diff
  128.   \multiply\num@segments \num@segments
  129.   \multiply\num@segments by 457
  130.   \divide\num@segments \@x@diff
  131.   \advance\num@segments by 750 % for round-off, going to divide by 1000.
  132.   \divide\num@segments \@m
  133.   \advance\num@segments \@x@diff
  134.                 %num@segments = @x@diff + (0.457*sqr(@y@diff)/@x@diff)
  135. \fi}
  136. %%%\def\dottedline
  137. %%%\def\@idottedline
  138. %%%\def\@iidottedline
  139. %%%\long\def\@dottedline[#1]#2(#3,#4)(#5,#6){{%
  140. %%%\x@diff=#5\relax\advance\x@diff by -#3\relax
  141. %%%\y@diff=#6\relax\advance\y@diff by -#4\relax
  142. %%%\sqrtandstuff{\x@diff}{\y@diff}{#2}
  143. %%%\divide\x@diff \num@segments
  144. %%%\divide\y@diff \num@segments
  145. %%%\advance\num@segments \@ne     % to put the last point at destination.
  146. %%%\setbox\@dotbox\hbox{#1}% just to get the dimensions of the character.
  147. %%%\@xdim=#3 \@ydim=#4
  148. %%%\ifdim\ht\@dotbox >\z@% otherwise its a circle.
  149. %%%  \advance\@xdim -0.5\wd\@dotbox
  150. %%%  \advance\@ydim -0.5\ht\@dotbox
  151. %%%  \advance\@ydim .5\dp\@dotbox\fi
  152. %%%\@killglue
  153. %%%\loop \ifnum\num@segments > 0
  154. %%%\unskip\raise\@ydim\hbox to\z@{\hskip\@xdim #1\hss}%
  155. %%%\advance\num@segments \m@ne\advance\@xdim\x@diff\advance\@ydim\y@diff%
  156. %%%\repeat
  157. %%%\ignorespaces}}
  158. \def\dashlinestretch{0} %well, could have used a counter.
  159. \def\dashline{\@ifnextchar [{\@idashline}{\@idashline[\dashlinestretch]}}
  160. \def\@idashline[#1]#2{\@ifnextchar [{\@iidashline[#1]{#2}}%
  161. {\@iidashline[#1]{#2}[\@empty]}} %\@empty needed-- later checked with \ifx
  162. \def\@iidashline[#1]#2[#3](#4,#5){\@ifnextchar (%
  163. {\@iiidashline[#1]{#2}[#3](#4,#5)}{\relax}}
  164. %%%\def\@iiidashline
  165. %%%\def\@dashline
  166. \newif\if@flippedargs
  167. \def\lineslope(#1,#2){%
  168. \ifdim #1 <0pt \@xdim= -#1 \else\@xdim=#1\fi
  169. \ifdim #2 <0pt \@ydim= -#2 \else\@ydim=#2\fi
  170. \ifdim\@xdim >\@ydim \@tempdima=\@xdim \@xdim=\@ydim \@ydim=\@tempdima
  171. \@flippedargstrue\else\@flippedargsfalse\fi% x < y
  172. \ifdim\@ydim >1pt \@tempcnta=\@ydim
  173.             \divide\@tempcnta by 65536% now \@tempcnta=integral part of #1.
  174.             \divide\@xdim \@tempcnta\fi
  175. \ifdim\@xdim <.083333pt \@xarg=1 \@yarg=0
  176.  \else\ifdim\@xdim <.183333pt   \@xarg=6 \@yarg=1
  177.  \else\ifdim\@xdim <.225pt      \@xarg=5 \@yarg=1
  178.  \else\ifdim\@xdim <.291666pt   \@xarg=4 \@yarg=1
  179.  \else\ifdim\@xdim <.366666pt   \@xarg=3 \@yarg=1
  180.  \else\ifdim\@xdim <.45pt       \@xarg=5 \@yarg=2
  181.  \else\ifdim\@xdim <.55pt       \@xarg=2 \@yarg=1
  182.  \else\ifdim\@xdim <.633333pt   \@xarg=5 \@yarg=3
  183.  \else\ifdim\@xdim <.708333pt   \@xarg=3 \@yarg=2
  184.  \else\ifdim\@xdim <.775pt      \@xarg=4 \@yarg=3
  185.  \else\ifdim\@xdim <.816666pt   \@xarg=5 \@yarg=4
  186.  \else\ifdim\@xdim <.916666pt   \@xarg=6 \@yarg=5
  187.        \else                    \@xarg=1 \@yarg=1%
  188. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  189. \if@flippedargs\relax\else\@tempcnta=\@xarg \@xarg=\@yarg \@yarg=\@tempcnta\fi
  190. \ifdim #1 <0pt \@xarg= -\@xarg\fi
  191. \ifdim #2 <0pt \@yarg= -\@yarg\fi
  192. }
  193. \newif\if@toosmall
  194. \newif\if@drawit
  195. \newif\if@horvline
  196. \def\drawlinestretch{0} %well, could have used a counter.
  197. \def\drawline{\@ifnextchar [{\@idrawline}{\@idrawline[\drawlinestretch]}}
  198. \def\@idrawline[#1](#2,#3){\@ifnextchar ({\@iidrawline[#1](#2,#3)}{\relax}}
  199. \def\@iidrawline[#1](#2,#3)(#4,#5){\@drawline[#1](#2,#3)(#4,#5)
  200. \@idrawline[#1](#4,#5)}
  201. %
  202. %%%\def\@drawline
  203. \long\def\splittwoargs#1 #2 {(#1,#2)}
  204. \newif\if@stillmore
  205. \newread\@datafile
  206. \long\def\putfile#1#2{\openin\@datafile = #1
  207. \@stillmoretrue
  208. \loop
  209. \ifeof\@datafile\relax\else\read\@datafile to\@dataline\fi
  210. %if file nonexistent, do nothing.
  211. \ifeof\@datafile\@stillmorefalse
  212. \else\ifx\@dataline\@empty \relax
  213.      \else
  214. \expandafter\expandafter\expandafter\put\expandafter\splittwoargs%
  215. \@dataline{#2}
  216.      \fi
  217. \fi
  218. \if@stillmore
  219. \repeat
  220. \closein\@datafile
  221. }
  222. \input{eepic.sty}
  223. \makeatother
  224.