%constinteger CLI priority = 5

%Include "moose:mouse.inc"
%systemroutinespec run file (%String(255) file)
%systemintegerfnspec freestore
%externalrealfnspec sqrt(%real x)
%Begin
   %integer sym,i,prio
   %record(semaphorefm) sem
   %Real x

   %on 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 %start
      open output(0, ":T");  select output(0)
      printstring("Main program (from CLI?) stopping with ")
      write(event_event, 0);  space
      write(event_sub, 0);    space
      write(event_extra, 0);  space
      printstring(event_message);  newline
      set priority(nil, 0)
      %cycle;  %repeat
   %finish

   setup semaphore (sem)

   open input(0,":t");selectinput(0)
   open output(0,":t");selectoutput(0)

   x = sqrt(0) ;! Force the Floating pt stuff in

   create logical name ("DEFAULT",":l")
   create logical name ("sysdev",":l")

   !O create logical name ("bravo","21")
   !O create logical name ("charlie","27")
   !O create logical name ("FS_DEFAULT","bravo")

   preload ("lib:scrput.mob")
   preload ("lib:pam.mob")

   create logical name ("TT",":tx")
   run process ("bin:tcli.mob", 400000, cli priority)
   run process ("bin:cli.mob", freestore-40960, CLI priority)

   semaphore wait (sem)
%End
