%!  PostScript Source Code
%
%% Description: PostScript prolog for a2ps program.
%% Copyright (c) 1990, Miguel Santana, miguel@imag.imag.fr
%% a2ps 4.0
%%EndComments

/$a2psdict 100 dict def
$a2psdict begin

% General macros.
/xdef {exch def} bind def
/getfont {exch findfont exch scalefont} bind def

% Create Courier backspace font
/backspacefont {
    /Courier findfont dup length dict begin
	{ %forall
	    1 index /FID eq { pop pop } { def } ifelse
	} forall
	currentdict /UniqueID known { %if
	    /UniqueID UniqueID 16#800000 xor def
	} if
	CharStrings length 1 add dict begin
	    CharStrings { def } forall
	    /backspace { -600 0 0 0 0 0 setcachedevice } bind def
	    currentdict
	end
	/CharStrings exch def
	/Encoding Encoding 256 array copy def
	Encoding 8 /backspace put
	currentdict
    end
    definefont pop
} bind def

% FUNCTIONS

% Function newfile: Initialize file printing.
/newfile
{ /filenm xdef
  /filenmwidth filenm stringwidth pop def
  /filenmfont
       filenmwidth filenmroom gt
       {
	       filenmfontname
	       filenmfontsize filenmroom mul filenmwidth div
	     getfont
       }
       { stdfilenmfont }
     ifelse
  def
} bind def

% Function header: prints page header. no page and
% sheetside are passed as arguments.
/header
  { upperx 1 index get  uppery headersize sub 1 add  moveto
    datefont setfont
    gsave
      upperx 1 index get uppery moveto pop
      0 headersize 2 div neg rmoveto 
      headersize setlinewidth
      0.85 setgray
      pagewidth 0 rlineto stroke
    grestore
    gsave
      datefontsize headermargin rmoveto
      date show				% date/hour
    grestore
    gsave
      pnum cvs pop				% page pop up
        pagewidth (Page 999) stringwidth pop sub
        headermargin
	  rmoveto
      (Page ) show pnum show		% page number
    grestore
    empty pnum copy pop
    gsave
      filenmfont setfont
         filenmroom filenm stringwidth pop sub 2 div datewidth add
          bodymargin 2 mul 
        add 
        headermargin
      rmoveto
        filenm show			% file name
      grestore
    } bind def

% Function border: prints border page. Use sheetside as arg
/border 
{ upperx 1 index get uppery moveto pop
  gsave				% print four sides
    0.7 setlinewidth		% of the square
    pagewidth 0 rlineto
    0 pageheight neg rlineto
    pagewidth neg 0 rlineto
    closepath stroke
  grestore
} bind def

% Function hborder: completes border of the header.
/hborder 
{ gsave
	0.7 setlinewidth
	0 headersize neg rmoveto
	pagewidth 0 rlineto
	stroke
  grestore
} bind def

% Function sheetnumber: prints the sheet number.
/sheetnumber
    { sheetnumberx sheetnumbery moveto
      datefont setfont
      pnum cvs
	  dup stringwidth pop (0) stringwidth pop sub neg 0 rmoveto show
      empty pnum copy pop
    } bind def

% Function currentdate: prints the current date.
/currentdate
    { datex datey moveto
      bodyfont setfont
      (Date: ) show
      currdate show
    } bind def

% Function s: print a source line
/s  { show
      /y0 y0 bodyfontsize sub def
      x0 y0 moveto
    } bind def

% Functions b and st: change to bold or standard font
/b  { show
      boldfont setfont
    } bind def
/st { show
      bodyfont setfont
    } bind def

% Strings used to make easy printing numbers
/pnum 12 string def
/empty 12 string def

% Global initializations

/CourierBack backspacefont
/filenmfontname /Helvetica-Bold def
/inch {72 mul} bind def

% Initialize page description variables.
/x0 0 def
/y0 0 def
/sheetheight 11.5 inch def
/sheetwidth 8.5 inch def
/margin 0.6 inch def
/rightmargin margin 3 div def
/leftmargin margin 2 mul 3 div def
/twinfiles false def
/date () def
/currdate (Mar 14 2005 14:35:59) def
%%EndProlog

/docsave save def

%%Trailer
docsave restore end