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 Tandem TAL

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:0
Info:n/a
Score: (2.75 in 12 votes)
99 Bottles in Tandem TAL (Transaction Application Language):

?NOLIST
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (FILE_OPEN_,FILE_CLOSE_,WRITE,INITIALIZER,
?                                PROCESS_STOP_,NUMOUT,PROCESS_GETINFO_);
INT     MYTERM^NAME[0:11], MYTERM^NUM, MYTERM^LEN, ERROR, NUM^BOTTLES;
STRING  .LINE1[0:37], .LINE2[0:32], .MSG^PTR;
?LIST
PROC BOTTLES MAIN;
  BEGIN
   CALL INITIALIZER(,,,,,);
   ERROR := PROCESS_GETINFO_(,,,,,MYTERM^NAME:24,MYTERM^LEN,,,,,,,,,);
   ERROR := FILE_OPEN_(MYTERM^NAME:MYTERM^LEN,MYTERM^NUM);
   IF ERROR <> 0 THEN CALL PROCESS_STOP_(,,1);
   NUM^BOTTLES :=  99;
   LINE1 ':=' "   BOTTLES OF BEER ON THE WALL";
   CALL NUMOUT(LINE1[0],NUM^BOTTLES,10,2);
   LINE2 ':=' "TAKE ONE DOWN AND PASS IT AROUND";
   WHILE (NUM^BOTTLES > 0) DO
   BEGIN
      CALL WRITE(MYTERM^NUM, LINE1, 30);
      CALL WRITE(MYTERM^NUM, LINE1, 18);
      CALL WRITE(MYTERM^NUM, LINE2, 32);
      NUM^BOTTLES := NUM^BOTTLES - 1;
      IF (NUM^BOTTLES = 1) THEN LINE1 ':=' "   BOTTLE OF BEER ON THE WALL ";
      IF (NUM^BOTTLES > 0) THEN               
   CALL INITIALIZER(,,,,,);
   ERROR := PROCESS_GETINFO_(,,,,,MYTERM^NAME:24,MYTERM^LEN,,,,,,,,,);
   ERROR := FILE_OPEN_(MYTERM^NAME:MYTERM^LEN,MYTERM^NUM);
   IF ERROR <> 0 THEN CALL PROCESS_STOP_(,,1);
   NUM^BOTTLES :=  99;
   LINE1 ':=' "   BOTTLES OF BEER ON THE WALL";
   CALL NUMOUT(LINE1[0],NUM^BOTTLES,10,2);
   LINE2 ':=' "TAKE ONE DOWN AND PASS IT AROUND";
   WHILE (NUM^BOTTLES > 0) DO
   BEGIN
      CALL WRITE(MYTERM^NUM, LINE1, 30);
      CALL WRITE(MYTERM^NUM, LINE1, 18);
      CALL WRITE(MYTERM^NUM, LINE2, 32);
      NUM^BOTTLES := NUM^BOTTLES - 1;
      IF (NUM^BOTTLES = 1) THEN LINE1 ':=' "   BOTTLE OF BEER ON THE WALL ";
      IF (NUM^BOTTLES > 0) THEN
      BEGIN
         CALL NUMOUT(LINE1[0],NUM^BOTTLES,10,2);
         CALL WRITE(MYTERM^NUM, LINE1, 30);
      END;
   END;
   LINE1 ':=' "NO MORE BOTTLES OF BEER ON THE WALL !!";
   CALL WRITE(MYTERM^NUM, LINE1, 37);
  END;

Download Source | Write Comment

Alternative Versions

Comments

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: