summaryrefslogtreecommitdiff
path: root/2004/netfilter-failover-ols2004/OLS2004-proceedings/TEMPLATES/eclepsf.sty
blob: 3f41d656624e15c3adf80f4cb56547cad0b1ef16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
% EPSF macros by Kazuhiro Kazama and modified by Hideki ISOZAKI
%   based on Trevor J. Darrell's psfig.tex
%
% All software, documentation, and related files in this distribution of
% psfig/tex are Copyright (c) 1987 Trevor J. Darrell
%
% Permission is granted for use and non-profit distribution of psfig/tex 
% providing that this notice be clearly maintained, but the right to
% distribute any portion of psfig/tex for profit or as part of any commercial
% product is specifically reserved for the author.
\endlinechar=-1

\typeout{EPSF macro package for LaTeX. version 1.5 - Released May 11, 1992}
\newcount\@arga
\newcount\@argb
\newcount\@argc
\newcount\@ctmpa
\newcount\@ctmpb
\newcount\@ctmpc
\newcount\@ctmpd
\newcount\@ctmpe
\newdimen\@darg
\newdimen\@bblen
\newif\ifepsfdraft
\epsfdraftfalse

\def\@setpsfile#1{
		\def\@psfile{#1}
                \bb@search
}
\def\@setpsheight#1{
		\@darg=#1\relax
   		\edef\@psheight{\number\@darg}
}
\def\@setpswidth#1{
		\@darg=#1\relax
   		\edef\@pswidth{\number\@darg}
}
\def\@setpsscale#1{
		\def\@pshscale{#1}
		\def\@psvscale{#1}
}
\def\@setpshscale#1{
		\def\@pshscale{#1}
}

\def\@setpsvscale#1{
		\def\@psvscale{#1}
}



%
% Go through the options setting things up.
%
\def\parse@ps@parms#1{
        \def\@bbw{0}\def\@bbh{0}
	\def\@pshscale{1}\def\@psvscale{1}
        \def\@psheight{0}\def\@pswidth{0}% in sp
        \@for\@epsfopt:=#1\do
           {\expandafter\@setparms\@epsfopt,}}

\def\@setparms#1=#2,{\@nameuse{@setps#1}{#2}}

%
% Compute %%BoundingBox height and width
%
\newif\ifcontinue

\catcode`\%=12\relax

\newread\ps@stream
\def\bb@search{\continuetrue
        \typeout{analyzing \@psfile}
	\openin\ps@stream=\@psfile
	\catcode`\%=12\relax
	\ifeof\ps@stream\errmessage{epsf: \@psfile\space not found}\fi
	\loop
		\read\ps@stream to \epsf@line
                \expandafter\epsf@getbb\epsf@line%%BoundingBox:\end@getbb
		\ifnum\@bbw=\z@\else \continuefalse\fi
                \ifeof\ps@stream \continuefalse \fi
	\ifcontinue \repeat
        \closein\ps@stream
	\catcode`\%=14
}	

\def\epsf@getbb #1%%BoundingBox:#2\end@getbb{
   \def\epsf@tmp{#1}\def\epsf@atend{ (atend)}
   \ifx\epsf@tmp\empty
     \edef\epsf@tmp{#2}
     \ifx\epsf@tmp\epsf@atend
       \errmessage{%%BoundingBox: (atend)}
     \else
       \epsf@bbarg #2 0 0 0 0 0 %%BoundingBox\end@getbb
     \fi
   \fi}

\def\epsf@bbarg #1 #2 #3 #4 #5%%BoundingBox#6\end@getbb{
  \def\epsf@tmp{#1}
  \ifx\epsf@tmp\empty
    \@darg=#4bp \advance\@darg-#2bp \edef\@bbw{\number\@darg}
    \@darg=#5bp \advance\@darg-#3bp \edef\@bbh{\number\@darg}
  \else
    \@darg=#3bp \advance\@darg-#1bp \edef\@bbw{\number\@darg}
    \@darg=#4bp \advance\@darg-#2bp \edef\@bbh{\number\@darg}
  \fi
  {\@arga=\@bbw \divide\@arga by 186468\relax
   \@argb=\@bbh \divide\@argb by 186468\relax
   \message{original: \the\@arga mm x \the\@argb mm}}
}

\catcode`\%=14\relax


% \in@hundreds performs #1 * (#2 / #3) correct to the hundreds,
%	then leaves the result in @result
%

\def\in@hundreds#1#2#3{\@argb=#2 \@argc=#3
		     \@ctmpa=\@argb	% @ctmpa is first digit #2/#3
		     \divide\@ctmpa by \@argc
		     \@ctmpb=\@ctmpa
		     \multiply\@ctmpb by \@argc
		     \advance\@argb by -\@ctmpb
		     \multiply\@argb by 10
		     \@ctmpb=\@argb	% @ctmpb is second digit of #2/#3
		     \divide\@ctmpb by \@argc
		     \@ctmpc=\@ctmpb
		     \multiply\@ctmpc by \@argc
		     \advance\@argb by -\@ctmpc
		     \multiply\@argb by 10
		     \@ctmpc=\@argb	% @ctmpc is the third digit
		     \divide\@ctmpc by \@argc
		     \@arga=#1\@ctmpe=0
		     \@ctmpd=\@arga
			\multiply\@ctmpd by \@ctmpa
		 	\advance\@ctmpe by \@ctmpd
		     \@ctmpd=\@arga
			\divide\@ctmpd by 10
			\multiply\@ctmpd by \@ctmpb
			\advance\@ctmpe by \@ctmpd
			%
		     \@ctmpd=\@arga
			\divide\@ctmpd by 100
			\multiply\@ctmpd by \@ctmpc
			\advance\@ctmpe by \@ctmpd
			%
		     \edef\@result{\number\@ctmpe}
}

\def\compute@wfromh{
                \ifnum\@psheight>\z@
		  \in@hundreds{\@psheight}{\@bbw}{\@bbh}
                  \edef\@pswidth{\@result}
                \else
		  \in@hundreds{-\@psheight}{\@bbw}{\@bbh}
                  \edef\@pswidth{\number-\@result}
                \fi
}
\def\compute@hfromw{
		% computing : height = width * (bbh / bbw)
                \ifnum\@pswidth>\z@
		  \in@hundreds{\@pswidth}{\@bbh}{\@bbw}
                  \edef\@psheight{\@result}
                \else
                  \in@hundreds{-\@pswidth}{\@bbh}{\@bbw}
                  \edef\@psheight{\number-\@result}
                \fi
}
\def\compute@handw{
	\ifnum\@psheight=\z@ 
		\ifnum\@pswidth=\z@ 
                        \@darg=\@bbh sp \@darg=\@psvscale\@darg
		        \edef\@psheight{\number\@darg}
                        \@darg=\@bbw sp \@darg=\@pshscale\@darg
                        \edef\@pswidth{\number\@darg}
                \else
			\compute@hfromw
		\fi
	\else 
		\ifnum\@pswidth=\z@ 
			\compute@wfromh
		\fi
	\fi
}
{\catcode`\p=12\catcode`\t=12
\gdef\remove@dim@frac#1.#2pt{#1}}

%
% \epsfile
% usage : \epsfile{file=, height=, width=}
% usage : \epsfile{file=, scale=}
% usage : \epsfile{file=, vscale=, hscale=}
%
\def\epsfile{\@ifnextchar[{\@epsfile}{\@epsfile[]}}
\def\@epsfile[#1]#2{{
  \parse@ps@parms{#2}
  \compute@handw
  {\@arga=\@pswidth \divide\@arga by 186468\relax
    \@argb=\@psheight \divide\@argb by 186468\relax
    \message{becomes \the\@arga mm x \the\@argb mm}}
  \@arga=\@psheight  \divide\@arga by 65782\relax
  \edef\@psvsize{\number\@arga}
  \@arga=\@pswidth   \divide\@arga by 65782\relax
  \edef\@pshsize{\number\@arga}
  \leavevmode
  \ifnum\@pswidth>\z@ 
    \hbox to \@pswidth sp\bgroup
  \else
    \hbox to -\@pswidth sp\bgroup
    \hfill
  \fi
    \ifnum\@psheight>\z@
      \vrule\@width\z@\@height\@psheight sp \@depth\z@
      \raise\@psheight sp 
    \else
      \vrule\@width\z@\@height-\@psheight sp \@depth\z@
    \fi
    \hbox to\z@\bgroup
    \ifnum\@psheight=\z@
       \ifnum\@pswidth=\z@
         \edef\epsf@tmpa{\@pshscale,\@psvscale}
         \edef\epsf@tmp{1,1}
         \ifx\epsf@tmpa\epsf@tmp
           \special{epsfile=\@psfile \space}
         \else
           \special{epsfile=\@psfile \space
              vscale=\@psvscale \space hscale=\@pshscale \space}
         \fi
       \else
         \special{epsfile=\@psfile \space hsize=\@pshsize \space}
       \fi
    \else
       \ifnum\@pswidth=\z@
         \special{epsfile=\@psfile \space vsize=\@psvsize \space}
       \else
         \special{epsfile=\@psfile \space 
           hsize=\@pshsize \space vsize=\@psvsize \space}
       \fi
    \fi
    \egroup
    \ifnum\@psheight>\z@
      \vrule\@width\z@\@height\@psheight sp \@depth\z@
    \else
      \vrule\@width\z@\@height-\@psheight sp \@depth\z@
      \raise-\@psheight sp 
    \fi
    \hbox to\z@{#1}\hfil
  \egroup
}}

% You can put anything on the original picture.
% \epsfat puts it on the correct position
%             even if you change the picture size.

\def\epsfat(#1,#2)#3{\@killglue{
    \@darg=#1 \edef\epsf@atx{\number\@darg}
    \ifnum\@pswidth>\z@
      \in@hundreds{\epsf@atx}{\@pswidth}{\@bbw}
      \edef\epsf@atx{\@result}
    \else
      \in@hundreds{\epsf@atx}{-\@pswidth}{\@bbw}
      \edef\epsf@atx{\number-\@result}
    \fi
    \@darg=#2 \edef\epsf@aty{\number\@darg}
    \ifnum\@psheight>\z@
      \in@hundreds{\epsf@aty}{\@psheight}{\@bbh}
      \edef\epsf@aty{\@result}
    \else
      \in@hundreds{\epsf@aty}{-\@psheight}{\@bbh}
      \edef\epsf@aty{\number-\@result}
    \fi
    \smash{\raise\epsf@aty sp
    \hbox to \z@{\kern\epsf@atx sp\relax#3\hss}}}\ignorespaces}

\endlinechar=13\relax
\endinput
personal git repositories of Harald Welte. Your mileage may vary