home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource5 / 349_01 / sss.arc / EX_0403.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-04-09  |  1000 b   |  70 lines

  1. Program EX_0403;
  2. {Listing 7P - see documentation in TUTOR.SSS}
  3.  
  4. uses SSS;
  5. { For Pascal other than Turbo/Quick erase above line }
  6.  
  7. const
  8.   ARRIVL = 1;
  9.   STARTA = 2;
  10.   ENDACT = 3;
  11.  
  12. { For MS Pascal $include:'SSSP1.H' }
  13.  
  14. var
  15.   c, ecode : integer;
  16.  
  17. { For MS Pascal $include:'SSSP2.H' }
  18.  
  19. procedure prime;
  20. begin
  21.   INIQUE(0,0,1);
  22.   INISTA(1,'Occupancy',1,0,0,0);
  23.   SIMEND(40.0);
  24.   CREATE(0, 0);
  25.   c := 0;
  26.   TALLY(1,0);
  27. end;
  28.  
  29. procedure leavec;
  30. begin
  31.   c := c + 1;
  32.   TALLY(1, c);
  33.   SCHED(EX(20), ENDACT, 0);
  34.   DISPOS;
  35. end;
  36.  
  37. procedure pickc;
  38. begin
  39.   c := c - 1;
  40.   TALLY(1, c);
  41.   DISPOS;
  42. end;
  43.  
  44. begin
  45.  
  46.   prime;
  47.  
  48.   repeat
  49.     ecode := NEXTEV;
  50.     if ecode > 0 then
  51.     begin
  52.       case ecode of
  53.  
  54.         ARRIVL: begin
  55.                   CREATE(EX(2), 0);
  56.                   SCHED(0,     STARTA, 0);
  57.                 end;
  58.  
  59.         STARTA: leavec;
  60.  
  61.         ENDACT: pickc;
  62.  
  63.       end;
  64.     end;
  65.   until ecode = 0;
  66.  
  67.   SUMRY('');
  68.  
  69. end.
  70.