Language Prostscript (printable)
| Date: | 04/20/05 |
| Author: | Anonymous |
| URL: | n/a |
| Comments: | 2 |
| Info: | n/a |
| Score: |
%!PS
% The 99 bottles of beer song in PostScript. This file
% can be sent to a PostScript printer (it'll be about
% eight pages or so...)
% Stuart Morris
% ------------- Variables & Procedures ------------
/LM 72 def % left margin
/ypos 720 def % initial top position
/BM 72 def % bottom margin
/lineheight 18 def % height of a line of text
% starts a new line
/crlf
{
ypos lineheight sub
/ypos exch def
LM ypos moveto
} def
% starts a new page if current one is full
/newpage?
{
ypos BM lt
{
showpage
/ypos 720 def
LM ypos moveto
} if
} def
% returns the correct syntax of the bottle
% string ("bottle" if one, "bottles" otherwise)
/bottlestring % stack: number of bottles
{
1 eq
{
( bottle of beer)
}
{
( bottles of beer)
} ifelse
} def
% ------------- Main Program ----------------
LM ypos moveto
/Times-Roman findfont
lineheight 2 sub scalefont
setfont
99 -1 1
{
/numbottles 2 string def
dup numbottles cvs show
dup bottlestring show ( on the wall, ) show
numbottles show dup bottlestring show (,) show
crlf
(Take one down, pass it around, ) show
1 sub dup numbottles cvs show
bottlestring show ( on the wall.) show
crlf crlf
newpage?
} for
showpage
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments