home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 mARCH
/
PCWK3A99.iso
/
Linux
/
DDD331
/
DDD-3_1_.000
/
DDD-3_1_
/
ddd-3.1.1
/
ddd
/
header.ps
< prev
next >
Wrap
Text File
|
1998-10-05
|
8KB
|
364 lines
% $Id: header.ps,v 1.11 1998/10/05 12:21:09 zeller Exp $
% Header for DDD PostScript Box output
% Copyright (C) 1995-1998 Technische Universitaet Braunschweig, Germany.
% Written by Christian Lindig <lindig@ips.cs.tu-bs.de>.
%
% This file is part of DDD.
%
% DDD is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public
% License as published by the Free Software Foundation; either
% version 2 of the License, or (at your option) any later version.
%
% DDD is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% See the GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public
% License along with DDD -- see the file COPYING.
% If not, write to the Free Software Foundation, Inc.,
% 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
%
% DDD is the data display debugger.
% For details, see the DDD World-Wide-Web page,
% `http://www.cs.tu-bs.de/softech/ddd/',
% or send a mail to the DDD developers <ddd@ips.cs.tu-bs.de>.
% Make all definitions local to the ddddict dictionary
/ddddict 25 dict def
ddddict begin % make dict active
% Global variables
/fontSize+ 12 def
/font+ /Courier def
% Some small utilities
/cm { 28.34646 mul } bind def
% ISOLATIN1* - reencode a font to ISO Latin 1 encoding
%
% newfont table oldfont isolatin1*
/isolatin1* {
findfont
dup maxlength dict begin
{
1 index /FID ne { def } { pop pop } ifelse
} forall
/Encoding exch def
dup /FontName exch def
currentdict end definefont pop
} bind def
% Define the ISO Latin 1 encoding of a font
/isotable[
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign
/dollar/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma
/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S
/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore
/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar
/braceright/asciitilde/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent/dieresis
/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron/.notdef/exclamdown/cent
/sterling/currency/yen/brokenbar/section/dieresis/copyright/ordfeminine
/guilsinglleft/logicalnot/hyphen/registered/macron/degree/plusminus/twosuperior
/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
/ordmasculine/guilsinglright/onequarter/onehalf/threequarters/questiondown
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute
/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve
/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave/Uacute/Ucircumflex
/Udieresis/Yacute/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis
/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave/iacute
/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis
/divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
] def
% YCORRECT*
% The reference point of a string ist NOT its lower left corner but
% its baseline. Therefore, the y coordinate must be corrected.
% Returns the correction for the current font.
%
% ycorrect* y
/ycorrect* {
currentfont /FontBBox get
aload pop pop pop
currentfont /FontMatrix get dtransform
exch pop
} def
% TEXT*
% print out a string and make sure not to require more space than
% specified.
% font xsize ysize xorigin yorigin (string) text*
/text* {
/string+ exch def % set up some variables ..
moveto % move to (xorigin,yorigin)
/ysize+ exch def
/xsize+ exch def
/thefont+ exch def
% is the right font already selected ?
thefont+ font+ ne
ysize+ fontSize+ ne
or {
% set up the right font - reencode it
/Symbol thefont+ eq
{
thefont+ findfont
}{
/isofont+ isotable thefont+ isolatin1*
/isofont+ findfont
}ifelse
[ysize+ 0 0 ysize+ neg 0 0] makefont
setfont
/font+ thefont+ def
/fontSize+ ysize+ def
} if
% correct current point
0 ycorrect* neg rmoveto
% string too long? Scale it down ...
% The actual font is scaled. There is a good chance,
% that this will not happen too often when the font is not
% changed during the calls of text*
xsize+ string+ stringwidth pop div dup dup
1 lt {
0 0 1 0 0 6 array astore currentfont exch
makefont setfont
pop
}{
% string is too short ... scale it up
1.05 gt {
0 0 1 0 0 6 array astore currentfont exch
makefont setfont
}{
pop
} ifelse
} ifelse
string+ show
} bind def
% ARROWLINE*
% Draw a line of given width with an arrow at its end
% len gives the height of the triangle forming the head of the arrow
% and angle the angle at its top
%
% angle len x1 y1 x2 y2 linewidth arrowline*
/arrowline* {
setlinewidth % angle len x1 y1 x2 y2
/y2 exch def
/x2 exch def
/y1 exch def
/x1 exch def
/len+ exch def % height of triangle
/alpha+
y2 y1 sub % define alpha+
x2 x1 sub
atan
def
/base+ % define half of baseline
exch
2 div dup % angle angle
sin exch cos % sin(angle) cos(angle)
div % tan(angle)
len+
mul % half of baseline
def
newpath % draw the line
x1 y1 moveto
x2 len+ alpha+ cos mul sub % shorten the line to the end
y2 len+ alpha+ sin mul sub % of the triangle
lineto
stroke
gsave % set the origin to the head of
0 setlinewidth % the arrow and rotate the system
x2 y2
translate % origin now at x2 y2
alpha+ 90 sub rotate % rotate the system
newpath % draw a triangle
0 0 moveto
base+ len+ neg rlineto
base+ 2 mul neg 0 rlineto
closepath
fill
grestore
} bind def
% ARROWHEAD*
% draw an arrow head inclined by alpha at (x,y)
%
% angle len alpha x y
/arrowhead* {
/y exch def
/x exch def
/alpha+ exch def
/len+ exch def % height of triangle
/base+ % define half of baseline
exch
2 div dup % angle angle
sin exch cos % sin(angle) cos(angle)
div % tan(angle)
len+
mul % half of baseline
def
gsave % set the origin to the head of
0 setlinewidth % the arrow and rotate the system
x y
translate % origin now at x y
alpha+ 90 sub rotate % rotate the system
newpath % draw a triangle
0 0 moveto
base+ len+ neg rlineto
base+ 2 mul neg 0 rlineto
closepath
fill
grestore
} bind def
% LINE*
% draw a line of given width from (x1,y1) to (x2,y2)
%
% x1 y1 x2 y2 width line*
/line* {
setlinewidth % x1 y1 x2 y2
newpath
4 2 roll % x2 y2 x1 y1
moveto % x2 y2
lineto
stroke
} bind def
% CLEAN*
%
% fill a box given by four points with white colour ..
% x1 y1 x2 y2 x3 y3 x4 y4 clean*
/clean* {
gsave
1 setgray
0 setlinewidth
newpath
moveto lineto lineto lineto
closepath
fill
grestore
} bind def
% BOX*
% fill a box given by four points
%
% x1 y1 x2 y2 x3 y3 x4 y4 box*
/box* {
0 setlinewidth
newpath
moveto lineto lineto lineto
closepath
fill
} bind def
% ARC*
% draw an ellipse with center (cx,cy), radius dx dy, starting at start
% and ending at end.
%
% start end dx dy cx cy width arc*
/arc* {
gsave
setlinewidth
translate
newpath
dup 3 1 roll % start end dy dx dy
div 1 scale % dy dx/dy 1 scale => start end dy
0 exch 0 exch % start end 0 0 dy
5 -2 roll % 0 0 dy start end
dup
0 eq { % replace 0 by 360
pop
360
} if
arc
stroke
grestore
} bind def
% BEGINCOLOR* / ENDCOLOR*
% Draw something using a specific foreground color
%
% red green blue begincolor* SOMETHING endcolor*
/begincolor* {
currentrgbcolor % red green blue red' green' blue'
6 3 roll % red' green' blue' red green blue
setrgbcolor % red' green' blue'
} bind def
/endcolor* {
setrgbcolor
} bind def
% Set up the right font to the right size
/isofont+ isotable font+ isolatin1* % reencode font+
% and make it the current font
/isofont+ findfont
[fontSize+ 0 0 fontSize+ neg 0 0] makefont
setfont
%%EndProlog