home *** CD-ROM | disk | FTP | other *** search
- ' Program EX_0805.BAS
- ' Listing 17B - see documentation in TUTOR.SSS
-
- const ARRIVL = 1, STARTA = 2, ENDACT = 3, NEXTAC = 4
- const REPORT = 5, TIMEL = 120, REPTME = -1, SSIZE = 4
-
- common shared n, countr, server, ecode, a1$, b$
-
- declare sub prime ()
-
- rem $include: 'SSSB.H'
-
- call prime
-
- do
- ecode = NEXTEV
- if ecode > 0 then
- select case ecode
-
- case ARRIVL
- if IDE = REPTME then
- SCHED 0, REPORT, IDE
- else
- n = n + 1
- print using b$; T;
- locate , 1
- SETA 1, EX(.9)
- CREATE EX(1), n
- SCHED 0, NEXTAC, IDE
- end if
-
- case NEXTAC
- if server > 0 then
- SCHED 0, STARTA, IDE
- else
- QUEUE 1, 0
- end if
-
- case STARTA
- SCHED A(1), ENDACT, IDE
- server = server - 1
- TALLY 1, server
-
- case ENDACT
- DISPOS
- server = server + 1
- TALLY 1, server
- if NQ(1) > 0 then
- REMVFQ 1, 1
- SCHED 0, STARTA, IDE
- end if
-
- case REPORT
- SCHED TIMEL, REPORT, IDE
- if countr = 0 then
- print "# average avail.s "
- else
- print using a1$; countr; QAVG(1); SAVG(1)
- end if
- CLEARQ 1
- CLEARS 0
- countr = countr + 1
- if countr > SSIZE then SIMEND 0
-
- end select
- end if
- loop while ecode > 0
-
- end
-
- sub prime
- a1$ = "# #####.# ###.### "
- b$ = "Simulated time: #####.## "
- n = 0
- countr = 0
- server = 1
- INIQUE 1, 1, 1
- title$ = "bus "
- INISTA 1, sadd(title$), 1, 0, 0, 0
- TALLY 1, server
- CREATE 0, n
- CREATE TIMEL, REPTME
- end sub