Input from file: DEMO
%Include "ie:terminal.inc"
%include"ie:terminal.inc"
^
unknown statement
%Include "ie:ie.inc"
%include"ie:ie.inc"
^
unknown statement
%Include "inc:util.imp"
%include"inc:util.imp"
^
unknown statement
%include "inc:dict.imp"
%include"inc:dict.imp"
^
unknown statement

%Constinteger No Of Progs = 17
%constintegernoofprogs=17
^
unknown statement
%Conststring(15)%Array Program Name (1:No Of Progs)=
%conststring(15)%arrayprogramname(1:noofprogs)=
^
unknown statement
   "Hideous",
"hideous",
^
unknown statement
   "Graphan",
"graphan",
^
unknown statement
   "Persian",
"persian",
^
unknown statement
   "Rubik",
"rubik",
^
unknown statement
   "Gas",
"gas",
^
unknown statement
   "Succ",
"succ",
^
unknown statement
   "Tetra",
"tetra",
^
unknown statement
   "Sparkle",
"sparkle",
^
unknown statement
   "Manclock",
"manclock",
^
unknown statement
   "Clock",
"clock",
^
unknown statement
   "Harmony",
"harmony",
^
unknown statement
   "Spirodem",
"spirodem",
^
unknown statement
   "Ted",
"ted",
^
unknown statement
   "Spiro",
"spiro",
^
unknown statement
   "Nut",
"nut",
^
unknown statement
   "Pacman",
"pacman",
^
unknown statement
   "Denis"
"denis"
^
unknown statement

%Conststring(40)%Array Description (1:No Of Progs)=
%conststring(40)%arraydescription(1:noofprogs)=
^
unknown statement
   "Arms to legs program",
"armstolegsprogram",
^
unknown statement
   "Tower of Hanoi",
"towerofhanoi",
^
unknown statement
   "Persian patterns",
"persianpatterns",
^
unknown statement
   "Rubik cube manipulator",
"rubikcubemanipulator",
^
unknown statement
   "Rotating APM sign",
"rotatingapmsign",
^
unknown statement
   "Long road to the APM",
"longroadtotheapm",
^
unknown statement
   "Tetrahedrons",
"tetrahedrons",
^
unknown statement
   "Coat of arms",
"coatofarms",
^
unknown statement
   "Clock - time prompted for",
"clock-timepromptedfor",
^
unknown statement
   "Clock - time obtained from filestore",
"clock-timeobtainedfromfilestore",
^
unknown statement
   "Harmonograph emulator",
"harmonographemulator",
^
unknown statement
   "Spiro patterns",
"spiropatterns",
^
unknown statement
   "Leaf Cell Editor",
"leafcelleditor",
^
unknown statement
   "Spirograph emulator",
"spirographemulator",
^
unknown statement
   "Tunnel of rectangles L1.5 graphics reqd",
"tunnelofrectanglesl1.5graphicsreqd",
^
unknown statement
   "Pacman game",
"pacmangame",
^
unknown statement
   "Denis game"
"denisgame"
^
unknown statement

%Conststring(15)%Array File Name (1:No Of Progs)=
%conststring(15)%arrayfilename(1:noofprogs)=
^
unknown statement
   "ademo:Hideous",
"ademo:hideous",
^
unknown statement
   "ademo:Graphan",
"ademo:graphan",
^
unknown statement
   "ademo:Persian",
"ademo:persian",
^
unknown statement
   "ademo:Rubik",
"ademo:rubik",
^
unknown statement
   "ademo:Gas",
"ademo:gas",
^
unknown statement
   "ademo:Succ",
"ademo:succ",
^
unknown statement
   "ademo:Tetra",
"ademo:tetra",
^
unknown statement
   "ademo:Sparkle",
"ademo:sparkle",
^
unknown statement
   "ademo:Manclock",
"ademo:manclock",
^
unknown statement
   "ademo:Clock",
"ademo:clock",
^
unknown statement
   "ademo:Harmony",
"ademo:harmony",
^
unknown statement
   "ademo:Spirodem",
"ademo:spirodem",
^
unknown statement
   "vlsi:ted",
"vlsi:ted",
^
unknown statement
   "ademo:spiro",
"ademo:spiro",
^
unknown statement
   "ademo:nut",
"ademo:nut",
^
unknown statement
   "games:pacman",
"games:pacman",
^
unknown statement
   "games:denis"
"games:denis"
^
unknown statement

%Externalroutinespec Run Program (%String(255) program)
%externalroutinespecrunprogram(%string(255)program)
^
unknown statement

%integer %function Default Terminal 
%integer%functiondefaultterminal
^
unknown statement
   %integer At
%integerat
^
unknown statement
   %string (255) T                               
%string(255)t
^
unknown statement

   At = Ref Name ("TERMINAL", Com Dict)
at=refname("terminal",comdict)
  ^
unknown procedure
   %if At > 0 %start
%ifat>0%start
^
unknown statement
      Trans Name (Integer (At), T)
transname(integer(at),t)
         ^
unknown procedure
      To Upper (T)
toupper(t)
       ^
unknown procedure
      %if T = "VISUAL200" %start
%ift="visual200"%start
^
unknown statement
         %result = Visual 200
%result=visual200
^
unknown statement
      %else %if T = "VISUAL55"
%else%ift="visual55"
^
unknown statement
         %result = Visual 55
%result=visual55
^
unknown statement
      %else %if T = "VT220"
%else%ift="vt220"
^
unknown statement
         %result = VT220
%result=vt220
^
unknown statement
      %else %if T = "WY75"
%else%ift="wy75"
^
unknown statement
         %result = WY75
%result=wy75
^
unknown statement
      %finish
%finish
^
unknown statement
   %finish
%finish
^
unknown statement
   %Result = Visual 200
%result=visual200
^
unknown statement
%end
%end
^
unknown statement

%Begin
%begin
^
unknown statement
   %Integer i,c,n,p
%integeri,c,n,p
^
unknown statement
   %String (255) message
%string(255)message
^
unknown statement
   %Switch mev (0:15)
%switchmev(0:15)
^
unknown statement

   Terminal Model = Default Terminal
terminalmodel=defaultterminal
             ^
unknown procedure
   Set Terminal Characteristics
setterminalcharacteristics
                          ^
unknown procedure
   Set Up Terminal
setupterminal
             ^
unknown procedure
   %Cycle
%cycle
^
unknown statement
      Clear Screen
clearscreen
           ^
unknown procedure
      Printstring (%c
printstring(%c
           ^
unknown procedure
"W e l c o m e   t o   t h e   A P M   d e m o n s t r a t i o n   s u i t e")
"welcometotheapmdemonstrationsuite")
^
unknown statement
      Cursor (0,1)
cursor(0,1)
      ^
unknown procedure
      Printsymbol ('-') %for i = 1,1,80
printsymbol('-')%fori=1,1,80
           ^
unknown procedure
      Cursor (0,3)
cursor(0,3)
      ^
unknown procedure
      Printstring (%c
printstring(%c
           ^
unknown procedure
"Use cursor keys to select program, and RETURN to run it. CTRL-Z stops suite")
"usecursorkeystoselectprogram,andreturntorunit.ctrl-zstopssuite")
^
unknown statement
      Cursor (0,5)
cursor(0,5)
      ^
unknown procedure
      Feature
feature
       ^
unknown procedure
      Printstring (Program Name (1))
printstring(programname(1))
           ^
unknown procedure
      Normal
normal
      ^
unknown procedure
      Cursor (40,5)
cursor(40,5)
      ^
unknown procedure
      Printstring (Description (1))
printstring(description(1))
           ^
unknown procedure

      %For i = 2,1,No Of Progs %Cycle
%fori=2,1,noofprogs%cycle
^
unknown statement
         Cursor (0,i+4)
cursor(0,i+4)
      ^
unknown procedure
         Printstring (Program Name (i))
printstring(programname(i))
           ^
unknown procedure
         Cursor (40,i+4)
cursor(40,i+4)
      ^
unknown procedure
         Printstring (Description (i))
printstring(description(i))
           ^
unknown procedure
      %Repeat
%repeat
^
unknown statement

      p = 1
p=1
 ^
unknown procedure
      %Cycle
%cycle
^
unknown statement
         c = Get Key
c=getkey
 ^
unknown procedure
         n = p
n=p
 ^
unknown procedure
         %If c = Up Key %Start
%ifc=upkey%start
^
unknown statement
            %If p > 1 %Then n = p - 1 %Else n = No Of Progs
%ifp>1%thenn=p-1%elsen=noofprogs
^
unknown statement
         %Elseif c = Down Key 
%elseifc=downkey
^
unknown statement
            %If p < No Of Progs %Then n = p + 1 %Else n = 1
%ifp<noofprogs%thenn=p+1%elsen=1
^
unknown statement
         %Elseif c = CR
%elseifc=cr
^
unknown statement
            %Exit
%exit
^
unknown statement
         %Elseif c = SUB
%elseifc=sub
^
unknown statement
            Cursor (0,23)
cursor(0,23)
      ^
unknown procedure
            Reset Terminal
resetterminal
             ^
unknown procedure
            %Stop
%stop
^
unknown statement
         %Else
%else
^
unknown statement
            PrintSymbol (Bel)
printsymbol(bel)
           ^
unknown procedure
         %Finish
%finish
^
unknown statement
         %If n # p %Start
%ifn#p%start
^
unknown statement
             Cursor (0,p+4)
cursor(0,p+4)
      ^
unknown procedure
             PrintString (Program Name (p))
printstring(programname(p))
           ^
unknown procedure
             Cursor (0,n+4)
cursor(0,n+4)
      ^
unknown procedure
             Feature
feature
       ^
unknown procedure
             PrintString (Program Name (n))
printstring(programname(n))
           ^
unknown procedure
             Normal
normal
      ^
unknown procedure
             p = n
p=n
 ^
unknown procedure
         %Finish
%finish
^
unknown statement
      %Repeat
%repeat
^
unknown statement
      Cursor (0,No Of Progs+4+2)
cursor(0,noofprogs+4+2)
      ^
unknown procedure
      Reset Terminal
resetterminal
             ^
unknown procedure
      %Begin
%begin
^
unknown statement
         %on 3 %start
%on3%start
^
unknown statement
            Open Input (0,":t")
openinput(0,":t")
         ^
unknown procedure
            -> ok
->ok
^
unknown statement
         %Finish
%finish
^
unknown statement
         Open Input (0,Filename(p).".dat")
openinput(0,filename(p).".dat")
         ^
unknown procedure
      ok:
ok:
  ^
unknown procedure
      %End
%end
^
unknown statement
      Prompt (":")
prompt(":")
      ^
unknown procedure
      Run Program (Filename(p))
runprogram(filename(p))
          ^
unknown procedure
      Set Up Terminal
setupterminal
             ^
unknown procedure
      %While testsymbol >= 0 %cycle; %repeat
%whiletestsymbol>=0%cycle;%repeat
^
unknown statement
%whiletestsymbol>=0%cycle;%repeat
                          ^
unknown statement
      Close Input
closeinput
          ^
unknown procedure
      Open Input (0,":t")
openinput(0,":t")
         ^
unknown procedure
      Close Output
closeoutput
           ^
unknown procedure
      Open Output (0,":t")
openoutput(0,":t")
          ^
unknown procedure
      -> mev(Event_Event)
->mev(event_event)
^
unknown statement

mev(0):
mev(0):
   ^
unknown procedure
      %Continue %If event_sub = 0 %or event_sub = 1
%continue%ifevent_sub=0%orevent_sub=1
^
unknown statement
      %If event_sub = 2 %or event_sub = 3 %Start
%ifevent_sub=2%orevent_sub=3%start
^
unknown statement
         c = (event_extra&16_FFFFF0)
c=(event_extra&16_fffff0)
 ^
unknown procedure
         %If c = 16_E20000 %Start
%ifc=16_e20000%start
^
unknown statement
            message = "program requires graphics board"    
message="programrequiresgraphicsboard"
       ^
unknown procedure
         %Elseif c = 16_07FFF0 
%elseifc=16_07fff0
^
unknown statement
            message = "program requires a mouse"
message="programrequiresamouse"
       ^
unknown procedure
         %Else
%else
^
unknown statement
            message = "program requires something at ".itos(event_extra,0)
message="programrequiressomethingat".itos(event_extra,0)
       ^
unknown procedure
         %Finish
%finish
^
unknown statement
      %Else
%else
^
unknown statement
         message = "something catastrophic"
message="somethingcatastrophic"
       ^
unknown procedure
      %Finish
%finish
^
unknown statement
      -> service
->service
^
unknown statement
mev(9):
mev(9):
   ^
unknown procedure
      %Continue
%continue
^
unknown statement
mev(*):
mev(*):
   ^
unknown procedure
      message = event_message
message=event_message
       ^
unknown procedure
      -> service
->service
^
unknown statement

service:
service:
       ^
unknown procedure
      Cursor (0,22)
cursor(0,22)
      ^
unknown procedure
      Erase Line
eraseline
         ^
unknown procedure
      Printsymbol(7)
printsymbol(7)
           ^
unknown procedure
      Printstring ("Program failed : ".message);newline
printstring("programfailed:".message);newline
           ^
unknown procedure
printstring("programfailed:".message);newline
                                             ^
unknown procedure
      Erase Line
eraseline
         ^
unknown procedure
      Printstring ("Type any key to continue")
printstring("typeanykeytocontinue")
           ^
unknown procedure
      c = get key
c=getkey
 ^
unknown procedure
   %Repeat
%repeat
^
unknown statement
%Endofprogram
%endofprogram
^
unknown statement

