Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Prostscript (printable)

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:2
Info:n/a
Score: (3.00 in 20 votes)
    %!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

Alternative Versions

Comments

>>  Michael said on 02/23/06 01:22:10

Michael Prostscript? Ahem, needs to be renamed to the correct spelling.

>>  Stefan said on 04/25/07 14:12:24

Stefan "Prost" = German for "Cheers" :-P

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!

Name:

eMail:

URL:

Security Code:
  
Comment: